Safe Haskell | None |
---|---|
Language | Haskell98 |
This module expose haskoin-wallet internals. No guarantee is made on the stability of the interface of these internal modules.
- module Network.Haskoin.Wallet
- initWallet :: MonadIO m => Double -> SqlPersistT m ()
- accounts :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => ListRequest -> SqlPersistT m ([Account], Word32)
- newAccount :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => NewAccount -> SqlPersistT m (Entity Account, Maybe Mnemonic)
- renameAccount :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> AccountName -> SqlPersistT m Account
- addAccountKeys :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> [XPubKey] -> SqlPersistT m Account
- getAccount :: (MonadIO m, MonadThrow m) => AccountName -> SqlPersistT m (Entity Account)
- isMultisigAccount :: Account -> Bool
- isReadAccount :: Account -> Bool
- isCompleteAccount :: Account -> Bool
- getAddress :: (MonadIO m, MonadThrow m) => Entity Account -> AddressType -> KeyIndex -> SqlPersistT m (Entity WalletAddr)
- addressesAll :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => SqlPersistT m [WalletAddr]
- addresses :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> AddressType -> SqlPersistT m [WalletAddr]
- addressList :: MonadIO m => Entity Account -> AddressType -> ListRequest -> SqlPersistT m ([WalletAddr], Word32)
- unusedAddresses :: MonadIO m => Entity Account -> AddressType -> ListRequest -> SqlPersistT m ([WalletAddr], Word32)
- lookupByPubKey :: (MonadIO m, MonadThrow m) => Entity Account -> PubKeyC -> AddressType -> SqlPersistT m [WalletAddr]
- addressCount :: MonadIO m => Entity Account -> AddressType -> SqlPersistT m Word32
- setAddrLabel :: (MonadIO m, MonadThrow m) => Entity Account -> KeyIndex -> AddressType -> Text -> SqlPersistT m WalletAddr
- addressPrvKey :: (MonadIO m, MonadThrow m) => Entity Account -> Maybe XPrvKey -> KeyIndex -> AddressType -> SqlPersistT m PrvKeyC
- useAddress :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => WalletAddr -> SqlPersistT m [WalletAddr]
- generateAddrs :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> AddressType -> KeyIndex -> SqlPersistT m Int
- setAccountGap :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> Word32 -> SqlPersistT m (Entity Account)
- firstAddrTime :: MonadIO m => SqlPersistT m (Maybe Timestamp)
- getPathRedeem :: Account -> SoftPath -> RedeemScript
- getPathPubKey :: Account -> SoftPath -> PubKeyC
- getBloomFilter :: (MonadIO m, MonadThrow m) => SqlPersistT m (BloomFilter, Int, Double)
- subSelectAddrCount :: Entity Account -> AddressType -> SqlExpr (Value KeyIndex)
- txs :: MonadIO m => Maybe TxConfidence -> AccountId -> ListRequest -> SqlPersistT m ([WalletTx], Word32)
- addrTxs :: MonadIO m => Entity Account -> Entity WalletAddr -> ListRequest -> SqlPersistT m ([WalletTx], Word32)
- accTxsFromBlock :: (MonadIO m, MonadThrow m) => AccountId -> BlockHeight -> Word32 -> SqlPersistT m [WalletTx]
- getTx :: MonadIO m => TxHash -> SqlPersistT m (Maybe Tx)
- getAccountTx :: MonadIO m => AccountId -> TxHash -> SqlPersistT m WalletTx
- importTx :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Tx -> Maybe (TBMChan Notif) -> AccountId -> SqlPersistT m ([WalletTx], [WalletAddr])
- importNetTx :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Tx -> Maybe (TBMChan Notif) -> SqlPersistT m ([WalletTx], [WalletAddr])
- signAccountTx :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> Maybe (TBMChan Notif) -> Maybe XPrvKey -> TxHash -> SqlPersistT m ([WalletTx], [WalletAddr])
- createWalletTx :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> Maybe (TBMChan Notif) -> Maybe XPrvKey -> [(Address, Word64)] -> Word64 -> Word32 -> Bool -> Bool -> SqlPersistT m (WalletTx, [WalletAddr])
- signOfflineTx :: Account -> Maybe XPrvKey -> Tx -> [CoinSignData] -> Tx
- getOfflineTxData :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => AccountId -> TxHash -> SqlPersistT m (OfflineTxData, [InCoinData])
- killTxs :: MonadIO m => Maybe (TBMChan Notif) -> [TxHash] -> SqlPersistT m ()
- reviveTx :: MonadIO m => Maybe (TBMChan Notif) -> Tx -> SqlPersistT m ()
- getPendingTxs :: MonadIO m => Int -> SqlPersistT m [TxHash]
- deleteTx :: (MonadIO m, MonadThrow m) => TxHash -> SqlPersistT m ()
- importMerkles :: MonadIO m => BlockChainAction -> [MerkleTxs] -> Maybe (TBMChan Notif) -> SqlPersistT m ()
- walletBestBlock :: MonadIO m => SqlPersistT m (BlockHash, Word32)
- spendableCoins :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => AccountId -> Word32 -> (SqlExpr (Entity WalletCoin) -> SqlExpr (Entity WalletTx) -> [SqlExpr OrderBy]) -> SqlPersistT m [InCoinData]
- accountBalance :: MonadIO m => AccountId -> Word32 -> Bool -> SqlPersistT m Word64
- addressBalances :: MonadIO m => Entity Account -> KeyIndex -> KeyIndex -> AddressType -> Word32 -> Bool -> SqlPersistT m [(KeyIndex, BalanceInfo)]
- resetRescan :: MonadIO m => SqlPersistT m ()
- data InCoinData = InCoinData {
- inCoinDataCoin :: !(Entity WalletCoin)
- inCoinDataTx :: !WalletTx
- inCoinDataAddr :: !WalletAddr
- module Network.Haskoin.Wallet.Client
- cmdStart :: Handler ()
- cmdStop :: Handler ()
- cmdNewAcc :: Bool -> String -> [String] -> Handler ()
- cmdAddKey :: String -> Handler ()
- cmdSetGap :: String -> String -> Handler ()
- cmdAccount :: String -> Handler ()
- cmdRenameAcc :: String -> String -> Handler ()
- cmdAccounts :: [String] -> Handler ()
- cmdList :: String -> [String] -> Handler ()
- cmdPubKeys :: String -> [String] -> Handler ()
- cmdUnused :: String -> [String] -> Handler ()
- cmdLabel :: String -> String -> String -> Handler ()
- cmdTxs :: String -> [String] -> Handler ()
- cmdAddrTxs :: String -> String -> [String] -> Handler ()
- cmdKeyIndex :: String -> String -> Handler ()
- cmdGenAddrs :: String -> String -> Handler ()
- cmdSend :: String -> String -> String -> Handler ()
- cmdSendMany :: String -> [String] -> Handler ()
- cmdImport :: String -> Handler ()
- cmdSign :: String -> String -> Handler ()
- cmdBalance :: String -> Handler ()
- cmdGetTx :: String -> String -> Handler ()
- cmdGetOffline :: String -> String -> Handler ()
- cmdSignOffline :: String -> String -> String -> Handler ()
- cmdRescan :: [String] -> Handler ()
- cmdDecodeTx :: Handler ()
- cmdVersion :: Handler ()
- cmdStatus :: Handler ()
- cmdBlockInfo :: [String] -> Handler ()
- cmdMonitor :: [String] -> Handler ()
- cmdSync :: String -> String -> [String] -> Handler ()
- cmdKeyPair :: Handler ()
- cmdDeleteTx :: String -> Handler ()
- cmdPending :: String -> [String] -> Handler ()
- cmdDead :: String -> [String] -> Handler ()
- module Network.Haskoin.Wallet.Server
- type Handler m = ReaderT HandlerSession m
- data HandlerSession = HandlerSession {
- handlerConfig :: !Config
- handlerPool :: !ConnectionPool
- handlerNodeState :: !(Maybe SharedNodeState)
- handlerNotifChan :: !(TBMChan Notif)
- runHandler :: Monad m => Handler m a -> HandlerSession -> m a
- runDB :: MonadBaseControl IO m => SqlPersistT m a -> Handler m a
- runDBPool :: MonadBaseControl IO m => SqlPersistT m a -> ConnectionPool -> m a
- tryDBPool :: MonadLoggerIO m => ConnectionPool -> SqlPersistM a -> m (Maybe a)
- runNode :: MonadIO m => NodeT m a -> Handler m a
- getAccountsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => ListRequest -> Handler m (Maybe Value)
- postAccountsR :: (MonadResource m, MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => NewAccount -> Handler m (Maybe Value)
- postAccountRenameR :: (MonadResource m, MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => AccountName -> AccountName -> Handler m (Maybe Value)
- getAccountR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> Handler m (Maybe Value)
- postAccountKeysR :: (MonadResource m, MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => AccountName -> [XPubKey] -> Handler m (Maybe Value)
- postAccountGapR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> SetAccountGap -> Handler m (Maybe Value)
- getAddressesR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> AddressType -> Word32 -> Bool -> ListRequest -> Handler m (Maybe Value)
- getAddressesUnusedR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> AddressType -> ListRequest -> Handler m (Maybe Value)
- getAddressR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> KeyIndex -> AddressType -> Word32 -> Bool -> Handler m (Maybe Value)
- getIndexR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> PubKeyC -> AddressType -> Handler m (Maybe Value)
- putAddressR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> KeyIndex -> AddressType -> AddressLabel -> Handler m (Maybe Value)
- postAddressesR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m, MonadBase IO m, MonadResource m) => AccountName -> KeyIndex -> AddressType -> Handler m (Maybe Value)
- getTxs :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> String -> (AccountId -> ListRequest -> SqlPersistT m ([WalletTx], Word32)) -> Handler m (Maybe Value)
- getTxsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> Handler m (Maybe Value)
- getPendingR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> Handler m (Maybe Value)
- getDeadR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> Handler m (Maybe Value)
- getAddrTxsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> KeyIndex -> AddressType -> ListRequest -> Handler m (Maybe Value)
- postTxsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> Maybe XPrvKey -> TxAction -> Handler m (Maybe Value)
- getTxR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> TxHash -> Handler m (Maybe Value)
- deleteTxIdR :: (MonadLoggerIO m, MonadThrow m, MonadBaseControl IO m) => TxHash -> Handler m (Maybe Value)
- getBalanceR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> Word32 -> Bool -> Handler m (Maybe Value)
- getOfflineTxR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> TxHash -> Handler m (Maybe Value)
- postOfflineTxR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> Maybe XPrvKey -> Tx -> [CoinSignData] -> Handler m (Maybe Value)
- postNodeR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => NodeAction -> Handler m (Maybe Value)
- getSyncR :: (MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => AccountName -> Either BlockHeight BlockHash -> ListRequest -> Handler m (Maybe Value)
- getBlockInfoR :: (MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => [BlockHash] -> Handler m (Maybe Value)
- whenOnline :: Monad m => Handler m () -> Handler m ()
- updateNodeFilter :: (MonadBaseControl IO m, MonadLoggerIO m, MonadThrow m) => Handler m ()
- adjustFCTime :: Timestamp -> Timestamp
- format :: String -> Text
- module Network.Haskoin.Wallet.Settings
- type DatabaseConfType = SqliteConf
- getDatabasePool :: (MonadLoggerIO m, MonadBaseControl IO m) => DatabaseConfType -> m ConnectionPool
- paramLimit :: Int
- type AccountName = Text
- data JsonAccount = JsonAccount {
- jsonAccountName :: !Text
- jsonAccountType :: !AccountType
- jsonAccountMaster :: !(Maybe XPrvKey)
- jsonAccountMnemonic :: !(Maybe Text)
- jsonAccountDerivation :: !(Maybe HardPath)
- jsonAccountKeys :: ![XPubKey]
- jsonAccountGap :: !Word32
- jsonAccountCreated :: !UTCTime
- data JsonAddr = JsonAddr {
- jsonAddrAddress :: !Address
- jsonAddrIndex :: !KeyIndex
- jsonAddrType :: !AddressType
- jsonAddrLabel :: !Text
- jsonAddrRedeem :: !(Maybe ScriptOutput)
- jsonAddrKey :: !(Maybe PubKeyC)
- jsonAddrCreated :: !UTCTime
- jsonAddrBalance :: !(Maybe BalanceInfo)
- data JsonCoin = JsonCoin {
- jsonCoinHash :: !TxHash
- jsonCoinPos :: !Word32
- jsonCoinValue :: !Word64
- jsonCoinScript :: !ScriptOutput
- jsonCoinCreated :: !UTCTime
- jsonCoinTx :: !(Maybe JsonTx)
- jsonCoinAddress :: !(Maybe JsonAddr)
- jsonCoinSpendingTx :: !(Maybe JsonTx)
- data JsonTx = JsonTx {
- jsonTxHash :: !TxHash
- jsonTxNosigHash :: !TxHash
- jsonTxType :: !TxType
- jsonTxInValue :: !Word64
- jsonTxOutValue :: !Word64
- jsonTxValue :: !Int64
- jsonTxInputs :: ![AddressInfo]
- jsonTxOutputs :: ![AddressInfo]
- jsonTxChange :: ![AddressInfo]
- jsonTxTx :: !Tx
- jsonTxIsCoinbase :: !Bool
- jsonTxConfidence :: !TxConfidence
- jsonTxConfirmedBy :: !(Maybe BlockHash)
- jsonTxConfirmedHeight :: !(Maybe Word32)
- jsonTxConfirmedDate :: !(Maybe Word32)
- jsonTxCreated :: !UTCTime
- jsonTxAccount :: !AccountName
- jsonTxConfirmations :: !(Maybe Word32)
- jsonTxBestBlock :: !(Maybe BlockHash)
- jsonTxBestBlockHeight :: !(Maybe BlockHeight)
- data WalletRequest
- = GetAccountsR !ListRequest
- | PostAccountsR !NewAccount
- | PostAccountRenameR !AccountName !AccountName
- | GetAccountR !AccountName
- | PostAccountKeysR !AccountName ![XPubKey]
- | PostAccountGapR !AccountName !SetAccountGap
- | GetAddressesR !AccountName !AddressType !Word32 !Bool !ListRequest
- | GetAddressesUnusedR !AccountName !AddressType !ListRequest
- | GetAddressR !AccountName !KeyIndex !AddressType !Word32 !Bool
- | GetIndexR !AccountName !PubKeyC !AddressType
- | PutAddressR !AccountName !KeyIndex !AddressType !AddressLabel
- | PostAddressesR !AccountName !KeyIndex !AddressType
- | GetTxsR !AccountName !ListRequest
- | GetAddrTxsR !AccountName !KeyIndex !AddressType !ListRequest
- | PostTxsR !AccountName !(Maybe XPrvKey) !TxAction
- | GetTxR !AccountName !TxHash
- | GetOfflineTxR !AccountName !TxHash
- | PostOfflineTxR !AccountName !(Maybe XPrvKey) !Tx ![CoinSignData]
- | GetBalanceR !AccountName !Word32 !Bool
- | PostNodeR !NodeAction
- | DeleteTxIdR !TxHash
- | GetSyncR !AccountName !BlockHash !ListRequest
- | GetSyncHeightR !AccountName !BlockHeight !ListRequest
- | GetPendingR !AccountName !ListRequest
- | GetDeadR !AccountName !ListRequest
- | GetBlockInfoR ![BlockHash]
- | StopServerR
- data ListRequest = ListRequest {
- listOffset :: !Word32
- listLimit :: !Word32
- listReverse :: !Bool
- data NewAccount = NewAccount {
- newAccountName :: !AccountName
- newAccountType :: !AccountType
- newAccountMnemonic :: !(Maybe Text)
- newAccountMaster :: !(Maybe XPrvKey)
- newAccountDeriv :: !(Maybe HardPath)
- newAccountKeys :: ![XPubKey]
- newAccountReadOnly :: !Bool
- data SetAccountGap = SetAccountGap {
- getAccountGap :: !Word32
- data OfflineTxData = OfflineTxData {
- offlineTxDataTx :: !Tx
- offlineTxDataCoinData :: ![CoinSignData]
- data CoinSignData = CoinSignData {
- coinSignOutPoint :: !OutPoint
- coinSignScriptOutput :: !ScriptOutput
- coinSignDeriv :: !SoftPath
- data TxAction
- = CreateTx {
- accTxActionRecipients :: ![(Address, Word64)]
- accTxActionFee :: !Word64
- accTxActionMinConf :: !Word32
- accTxActionRcptFee :: !Bool
- accTxActionSign :: !Bool
- | ImportTx {
- accTxActionTx :: !Tx
- | SignTx {
- accTxActionHash :: !TxHash
- = CreateTx {
- data AddressLabel = AddressLabel {
- addressLabelLabel :: !Text
- data NodeAction
- = NodeActionRescan {
- nodeActionTimestamp :: !(Maybe Word32)
- | NodeActionStatus
- = NodeActionRescan {
- data AccountType
- data AddressType
- addrTypeIndex :: AddressType -> KeyIndex
- data TxType
- data TxConfidence
- data AddressInfo = AddressInfo {
- addressInfoAddress :: !Address
- addressInfoValue :: !(Maybe Word64)
- addressInfoIsLocal :: !Bool
- data BalanceInfo = BalanceInfo {}
- data WalletResponse a
- = ResponseError {
- responseError :: !Text
- | ResponseValid {
- responseResult :: !(Maybe a)
- = ResponseError {
- data TxCompleteRes = TxCompleteRes {
- txCompleteTx :: !Tx
- txCompleteComplete :: !Bool
- data ListResult a = ListResult {
- listResultItems :: ![a]
- listResultTotal :: !Word32
- data RescanRes = RescanRes {}
- data JsonSyncBlock = JsonSyncBlock {
- jsonSyncBlockHash :: !BlockHash
- jsonSyncBlockHeight :: !BlockHeight
- jsonSyncBlockPrev :: !BlockHash
- jsonSyncBlockTxs :: ![JsonTx]
- data JsonBlock = JsonBlock {
- jsonBlockHash :: !BlockHash
- jsonBlockHeight :: !BlockHeight
- jsonBlockPrev :: !BlockHash
- data Notif
- = NotifBlock !JsonBlock
- | NotifTx !JsonTx
- data BlockInfo = BlockInfo {
- blockInfoHash :: !BlockHash
- blockInfoHeight :: !BlockHeight
- blockInfoVersion :: !Word32
- blockInfoTimestamp :: !UTCTime
- blockInfoPrevBlock :: !BlockHash
- blockInfoMerkleRoot :: !JsonHash256
- blockInfoBits :: !Word32
- blockInfoNonce :: !Word32
- blockInfoChain :: !Word32
- blockInfoChainWork :: !Double
- data WalletException = WalletException !String
- data BTCNode = BTCNode {
- btcNodeHost :: !String
- btcNodePort :: !Int
- splitSelect :: (SqlSelect a r, MonadIO m) => [t] -> ([t] -> SqlQuery a) -> SqlPersistT m [r]
- splitUpdate :: (MonadIO m, PersistEntity val, PersistEntityBackend val ~ SqlBackend) => [t] -> ([t] -> SqlExpr (Entity val) -> SqlQuery ()) -> SqlPersistT m ()
- splitDelete :: MonadIO m => [t] -> ([t] -> SqlQuery ()) -> SqlPersistT m ()
- splitInsertMany_ :: (MonadIO m, PersistEntity val, PersistEntityBackend val ~ SqlBackend) => [val] -> SqlPersistT m ()
- join2 :: [SqlExpr (Value Bool)] -> SqlExpr (Value Bool)
- limitOffset :: Word32 -> Word32 -> SqlQuery ()
- module Network.Haskoin.Wallet.Model
Documentation
module Network.Haskoin.Wallet
Database Wallet
initWallet :: MonadIO m => Double -> SqlPersistT m () Source #
Database Accounts
accounts :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => ListRequest -> SqlPersistT m ([Account], Word32) Source #
Fetch all accounts
newAccount :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => NewAccount -> SqlPersistT m (Entity Account, Maybe Mnemonic) Source #
Create a new account
renameAccount :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> AccountName -> SqlPersistT m Account Source #
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) | |
=> Entity Account | Account Entity |
-> [XPubKey] | Thirdparty public keys to add |
-> SqlPersistT m Account | Account information |
Add new thirdparty keys to a multisignature account. This function can fail if the multisignature account already has all required keys.
getAccount :: (MonadIO m, MonadThrow m) => AccountName -> SqlPersistT m (Entity Account) Source #
isMultisigAccount :: Account -> Bool Source #
isReadAccount :: Account -> Bool Source #
isCompleteAccount :: Account -> Bool Source #
Database Addresses
:: (MonadIO m, MonadThrow m) | |
=> Entity Account | Account Entity |
-> AddressType | Address type |
-> KeyIndex | Derivation index (key) |
-> SqlPersistT m (Entity WalletAddr) | Address |
Get an address if it exists, or throw an exception otherwise. Fetching addresses in the hidden gap will also throw an exception.
addressesAll :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => SqlPersistT m [WalletAddr] Source #
All addresses in the wallet, including hidden gap addresses. This is useful for building a bloom filter.
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) | |
=> Entity Account | Account Entity |
-> AddressType | Address Type |
-> SqlPersistT m [WalletAddr] | Addresses |
All addresses in one account excluding hidden gap.
:: MonadIO m | |
=> Entity Account | Account Entity |
-> AddressType | Address type |
-> ListRequest | List request |
-> SqlPersistT m ([WalletAddr], Word32) | List result |
Get address list.
:: MonadIO m | |
=> Entity Account | Account ID |
-> AddressType | Address type |
-> ListRequest | |
-> SqlPersistT m ([WalletAddr], Word32) | Unused addresses |
Get a list of all unused addresses.
:: (MonadIO m, MonadThrow m) | |
=> Entity Account | Account Entity |
-> PubKeyC | Pubkey of interest |
-> AddressType | Address type |
-> SqlPersistT m [WalletAddr] |
:: MonadIO m | |
=> Entity Account | Account Entity |
-> AddressType | Address type |
-> SqlPersistT m Word32 | Address Count |
Get a count of all the addresses in an account
:: (MonadIO m, MonadThrow m) | |
=> Entity Account | Account ID |
-> KeyIndex | Derivation index |
-> AddressType | Address type |
-> Text | New label |
-> SqlPersistT m WalletAddr |
Add a label to an address.
:: (MonadIO m, MonadThrow m) | |
=> Entity Account | Account Entity |
-> Maybe XPrvKey | If not in account |
-> KeyIndex | Derivation index of the address |
-> AddressType | Address type |
-> SqlPersistT m PrvKeyC | Private key |
Returns the private key of an address.
useAddress :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => WalletAddr -> SqlPersistT m [WalletAddr] Source #
Use an address and make sure we have enough gap addresses after it. Returns the new addresses that have been created.
generateAddrs :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> AddressType -> KeyIndex -> SqlPersistT m Int Source #
Generate all the addresses up to certain index.
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) | |
=> Entity Account | Account Entity |
-> Word32 | New gap value |
-> SqlPersistT m (Entity Account) |
Set the address gap of an account to a new value. This will create new internal and external addresses as required. The gap can only be increased, not decreased in size.
firstAddrTime :: MonadIO m => SqlPersistT m (Maybe Timestamp) Source #
getPathRedeem :: Account -> SoftPath -> RedeemScript Source #
getPathPubKey :: Account -> SoftPath -> PubKeyC Source #
Database Bloom Filter
getBloomFilter :: (MonadIO m, MonadThrow m) => SqlPersistT m (BloomFilter, Int, Double) Source #
Returns a bloom filter containing all the addresses in this wallet. This includes internal and external addresses. The bloom filter can be set on a peer connection to filter the transactions received by that peer.
Helpers
subSelectAddrCount :: Entity Account -> AddressType -> SqlExpr (Value KeyIndex) Source #
Database transactions
:: MonadIO m | |
=> Maybe TxConfidence | |
-> AccountId | Account ID |
-> ListRequest | List request |
-> SqlPersistT m ([WalletTx], Word32) | List result |
Get transactions.
:: MonadIO m | |
=> Entity Account | Account entity |
-> Entity WalletAddr | Address entity |
-> ListRequest | List request |
-> SqlPersistT m ([WalletTx], Word32) |
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) | |
=> Tx | Transaction to import |
-> Maybe (TBMChan Notif) | |
-> AccountId | Account ID |
-> SqlPersistT m ([WalletTx], [WalletAddr]) | New transactions and addresses created |
Import a transaction into the wallet from an unknown source. If the transaction is standard, valid, all inputs are known and all inputs can be spent, then the transaction will be imported as a network transaction. Otherwise, the transaction will be imported into the local account as an offline transaction.
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) | |
=> Tx | |
-> Maybe (TBMChan Notif) | |
-> SqlPersistT m ([WalletTx], [WalletAddr]) | Returns the new transactions and addresses created |
Import a transaction from the network into the wallet. This function assumes transactions are imported in-order (parents first). It also assumes that the confirmations always arrive after the transaction imports. This function is idempotent.
When re-importing an existing transaction, this function will recompute the inputs, outputs and transaction details for each account. A non-dead transaction could be set to dead due to new inputs being double spent. However, we do not allow dead transactions to be revived by reimporting them. Transactions can only be revived if they make it into the main chain.
This function returns the network confidence of the imported transaction.
signAccountTx :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => Entity Account -> Maybe (TBMChan Notif) -> Maybe XPrvKey -> TxHash -> SqlPersistT m ([WalletTx], [WalletAddr]) Source #
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) | |
=> Entity Account | Account Entity |
-> Maybe (TBMChan Notif) | Notification channel |
-> Maybe XPrvKey | Key if not provided by account |
-> [(Address, Word64)] | List of recipient addresses and amounts |
-> Word64 | Fee per 1000 bytes |
-> Word32 | Minimum confirmations |
-> Bool | Should fee be paid by recipient |
-> Bool | Should the transaction be signed |
-> SqlPersistT m (WalletTx, [WalletAddr]) | (New transaction hash, Completed flag) |
Create a transaction sending some coins to a list of recipient addresses.
:: Account | Account used for signing |
-> Maybe XPrvKey | Key if not provided in account |
-> Tx | Transaction to sign |
-> [CoinSignData] | Input signing data |
-> Tx |
getOfflineTxData :: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) => AccountId -> TxHash -> SqlPersistT m (OfflineTxData, [InCoinData]) Source #
getPendingTxs :: MonadIO m => Int -> SqlPersistT m [TxHash] Source #
Database blocks
importMerkles :: MonadIO m => BlockChainAction -> [MerkleTxs] -> Maybe (TBMChan Notif) -> SqlPersistT m () Source #
walletBestBlock :: MonadIO m => SqlPersistT m (BlockHash, Word32) Source #
Database coins and balances
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m) | |
=> AccountId | Account key |
-> Word32 | Minimum confirmations |
-> (SqlExpr (Entity WalletCoin) -> SqlExpr (Entity WalletTx) -> [SqlExpr OrderBy]) | Coin ordering policy |
-> SqlPersistT m [InCoinData] | Spendable coins |
addressBalances :: MonadIO m => Entity Account -> KeyIndex -> KeyIndex -> AddressType -> Word32 -> Bool -> SqlPersistT m [(KeyIndex, BalanceInfo)] Source #
Rescan
resetRescan :: MonadIO m => SqlPersistT m () Source #
Helpers
data InCoinData Source #
InCoinData | |
|
Coin InCoinData Source # | |
cmdAccount :: String -> Handler () Source #
cmdRenameAcc :: String -> String -> Handler () Source #
cmdAccounts :: [String] -> Handler () Source #
cmdPubKeys :: String -> [String] -> Handler () Source #
cmdKeyIndex :: String -> String -> Handler () Source #
cmdGenAddrs :: String -> String -> Handler () Source #
cmdSendMany :: String -> [String] -> Handler () Source #
cmdBalance :: String -> Handler () Source #
cmdGetOffline :: String -> String -> Handler () Source #
cmdDecodeTx :: Handler () Source #
cmdVersion :: Handler () Source #
cmdBlockInfo :: [String] -> Handler () Source #
cmdMonitor :: [String] -> Handler () Source #
cmdKeyPair :: Handler () Source #
cmdDeleteTx :: String -> Handler () Source #
cmdPending :: String -> [String] -> Handler () Source #
type Handler m = ReaderT HandlerSession m Source #
data HandlerSession Source #
HandlerSession | |
|
runHandler :: Monad m => Handler m a -> HandlerSession -> m a Source #
getAccountsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => ListRequest -> Handler m (Maybe Value) Source #
postAccountsR :: (MonadResource m, MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => NewAccount -> Handler m (Maybe Value) Source #
postAccountRenameR :: (MonadResource m, MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => AccountName -> AccountName -> Handler m (Maybe Value) Source #
getAccountR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> Handler m (Maybe Value) Source #
postAccountKeysR :: (MonadResource m, MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => AccountName -> [XPubKey] -> Handler m (Maybe Value) Source #
postAccountGapR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> SetAccountGap -> Handler m (Maybe Value) Source #
getAddressesR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> AddressType -> Word32 -> Bool -> ListRequest -> Handler m (Maybe Value) Source #
getAddressesUnusedR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> AddressType -> ListRequest -> Handler m (Maybe Value) Source #
getAddressR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> KeyIndex -> AddressType -> Word32 -> Bool -> Handler m (Maybe Value) Source #
getIndexR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> PubKeyC -> AddressType -> Handler m (Maybe Value) Source #
putAddressR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> KeyIndex -> AddressType -> AddressLabel -> Handler m (Maybe Value) Source #
postAddressesR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m, MonadBase IO m, MonadResource m) => AccountName -> KeyIndex -> AddressType -> Handler m (Maybe Value) Source #
getTxs :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> String -> (AccountId -> ListRequest -> SqlPersistT m ([WalletTx], Word32)) -> Handler m (Maybe Value) Source #
getTxsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> Handler m (Maybe Value) Source #
getPendingR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> Handler m (Maybe Value) Source #
getDeadR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> ListRequest -> Handler m (Maybe Value) Source #
getAddrTxsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> KeyIndex -> AddressType -> ListRequest -> Handler m (Maybe Value) Source #
postTxsR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> Maybe XPrvKey -> TxAction -> Handler m (Maybe Value) Source #
getTxR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> TxHash -> Handler m (Maybe Value) Source #
deleteTxIdR :: (MonadLoggerIO m, MonadThrow m, MonadBaseControl IO m) => TxHash -> Handler m (Maybe Value) Source #
getBalanceR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => AccountName -> Word32 -> Bool -> Handler m (Maybe Value) Source #
getOfflineTxR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> TxHash -> Handler m (Maybe Value) Source #
postOfflineTxR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadBase IO m, MonadThrow m, MonadResource m) => AccountName -> Maybe XPrvKey -> Tx -> [CoinSignData] -> Handler m (Maybe Value) Source #
postNodeR :: (MonadLoggerIO m, MonadBaseControl IO m, MonadThrow m) => NodeAction -> Handler m (Maybe Value) Source #
getSyncR :: (MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => AccountName -> Either BlockHeight BlockHash -> ListRequest -> Handler m (Maybe Value) Source #
getBlockInfoR :: (MonadThrow m, MonadLoggerIO m, MonadBaseControl IO m) => [BlockHash] -> Handler m (Maybe Value) Source #
updateNodeFilter :: (MonadBaseControl IO m, MonadLoggerIO m, MonadThrow m) => Handler m () Source #
adjustFCTime :: Timestamp -> Timestamp Source #
type DatabaseConfType = SqliteConf Source #
getDatabasePool :: (MonadLoggerIO m, MonadBaseControl IO m) => DatabaseConfType -> m ConnectionPool Source #
paramLimit :: Int Source #
type AccountName = Text Source #
data JsonAccount Source #
JsonAccount | |
|
Eq JsonAccount Source # | |
Read JsonAccount Source # | |
Show JsonAccount Source # | |
ToJSON JsonAccount Source # | |
FromJSON JsonAccount Source # | |
JsonAddr | |
|
JsonCoin | |
|
JsonTx | |
|
data WalletRequest Source #
Eq WalletRequest Source # | |
Show WalletRequest Source # | |
ToJSON WalletRequest Source # | |
FromJSON WalletRequest Source # | |
data ListRequest Source #
ListRequest | |
|
Eq ListRequest Source # | |
Read ListRequest Source # | |
Show ListRequest Source # | |
ToJSON ListRequest Source # | |
FromJSON ListRequest Source # | |
data NewAccount Source #
NewAccount | |
|
Eq NewAccount Source # | |
Read NewAccount Source # | |
Show NewAccount Source # | |
ToJSON NewAccount Source # | |
FromJSON NewAccount Source # | |
data SetAccountGap Source #
Eq SetAccountGap Source # | |
Read SetAccountGap Source # | |
Show SetAccountGap Source # | |
ToJSON SetAccountGap Source # | |
FromJSON SetAccountGap Source # | |
data OfflineTxData Source #
OfflineTxData | |
|
ToJSON OfflineTxData Source # | |
FromJSON OfflineTxData Source # | |
data CoinSignData Source #
CoinSignData | |
|
Eq CoinSignData Source # | |
Show CoinSignData Source # | |
ToJSON CoinSignData Source # | |
FromJSON CoinSignData Source # | |
CreateTx | |
| |
ImportTx | |
| |
SignTx | |
|
data AddressLabel Source #
AddressLabel | |
|
Eq AddressLabel Source # | |
Read AddressLabel Source # | |
Show AddressLabel Source # | |
ToJSON AddressLabel Source # | |
FromJSON AddressLabel Source # | |
data NodeAction Source #
Eq NodeAction Source # | |
Read NodeAction Source # | |
Show NodeAction Source # | |
ToJSON NodeAction Source # | |
FromJSON NodeAction Source # | |
data AccountType Source #
Eq AccountType Source # | |
Read AccountType Source # | |
Show AccountType Source # | |
NFData AccountType Source # | |
ToJSON AccountType Source # | |
FromJSON AccountType Source # | |
PersistField AccountType Source # | |
PersistFieldSql AccountType Source # | |
data AddressType Source #
Eq AddressType Source # | |
Read AddressType Source # | |
Show AddressType Source # | |
NFData AddressType Source # | |
ToJSON AddressType Source # | |
FromJSON AddressType Source # | |
PersistField AddressType Source # | |
PersistFieldSql AddressType Source # | |
addrTypeIndex :: AddressType -> KeyIndex Source #
data TxConfidence Source #
Eq TxConfidence Source # | |
Read TxConfidence Source # | |
Show TxConfidence Source # | |
NFData TxConfidence Source # | |
ToJSON TxConfidence Source # | |
FromJSON TxConfidence Source # | |
PersistField TxConfidence Source # | |
PersistFieldSql TxConfidence Source # | |
data AddressInfo Source #
AddressInfo | |
|
Eq AddressInfo Source # | |
Read AddressInfo Source # | |
Show AddressInfo Source # | |
Generic AddressInfo Source # | |
NFData AddressInfo Source # | |
ToJSON AddressInfo Source # | |
FromJSON AddressInfo Source # | |
Serialize AddressInfo Source # | |
PersistField [AddressInfo] Source # | |
PersistFieldSql [AddressInfo] Source # | |
type Rep AddressInfo Source # | |
data BalanceInfo Source #
Eq BalanceInfo Source # | |
Read BalanceInfo Source # | |
Show BalanceInfo Source # | |
NFData BalanceInfo Source # | |
ToJSON BalanceInfo Source # | |
FromJSON BalanceInfo Source # | |
data WalletResponse a Source #
ResponseError | |
| |
ResponseValid | |
|
Eq a => Eq (WalletResponse a) Source # | |
Show a => Show (WalletResponse a) Source # | |
ToJSON a0 => ToJSON (WalletResponse a0) Source # | |
FromJSON a0 => FromJSON (WalletResponse a0) Source # | |
data TxCompleteRes Source #
TxCompleteRes | |
|
Eq TxCompleteRes Source # | |
Read TxCompleteRes Source # | |
Show TxCompleteRes Source # | |
ToJSON TxCompleteRes Source # | |
FromJSON TxCompleteRes Source # | |
data ListResult a Source #
ListResult | |
|
ToJSON a0 => ToJSON (ListResult a0) Source # | |
FromJSON a0 => FromJSON (ListResult a0) Source # | |
data JsonSyncBlock Source #
JsonSyncBlock | |
|
Eq JsonSyncBlock Source # | |
Read JsonSyncBlock Source # | |
Show JsonSyncBlock Source # | |
ToJSON JsonSyncBlock Source # | |
FromJSON JsonSyncBlock Source # | |
JsonBlock | |
|
BlockInfo | |
|
data WalletException Source #
BTCNode | |
|
Helpers
splitSelect :: (SqlSelect a r, MonadIO m) => [t] -> ([t] -> SqlQuery a) -> SqlPersistT m [r] Source #
splitUpdate :: (MonadIO m, PersistEntity val, PersistEntityBackend val ~ SqlBackend) => [t] -> ([t] -> SqlExpr (Entity val) -> SqlQuery ()) -> SqlPersistT m () Source #
splitDelete :: MonadIO m => [t] -> ([t] -> SqlQuery ()) -> SqlPersistT m () Source #
splitInsertMany_ :: (MonadIO m, PersistEntity val, PersistEntityBackend val ~ SqlBackend) => [val] -> SqlPersistT m () Source #
limitOffset :: Word32 -> Word32 -> SqlQuery () Source #
module Network.Haskoin.Wallet.Model