View User Data
Once you have created a wallet ZumoKit state will be populated with account data. There are two ways of accessing ZumoKit state, via helper methods on user object decribed below and via global ZumoKit state.
Accounts
Once you have created a user wallet, ZumoKit has automatically created supported cryptocurrency accounts:
- Standard (non-segwit) / segwit / compatibility Bitcoin Testnet accounts,
- Standard (non-segwit) / segwit / compatibility Bitcoin Mainnet accounts,
- Standard Ethererum Mainnet, Ropsten, Rinkeby, Goerli, Kovan accounts.
These accounts can be accessed by calling getAccounts
on the user instance.
Addionaly, a helper method getAccount
can be used on user instance to select a specific account. Example below illustrates how we might retrieve compatibility Bitcoin account on Testnet:
Account btcAccount = user.getAccount("BTC", NetworkType.TESTNET, AccountType.COMPATIBILITY);
ZKAccount *btcAccount = [user getAccount:@"BTC" network:ZKNetworkTypeTESTNET type:ZKAccountTypeCOMPATIBILITY];
// To be added to ZumoKit React Native SDK
To get account information, use the accessor methods as described in reference (Android / iOS / React Native).
Account balance is in account currency, i.e. BTC, ETH. Use Exchange Rates to convert to other currency.
Standard Bitcoin Account
Bitcoin non-segwit account type P2PKH.
This account type is being phased out by Bitcoin community as it produces most expensive transaction fees. However, currenly this is the only supported account type by major exchanges.
These Bitcoin addresses always begin with 1 on Bitcoin Mainnet and m or n on Bitcoin Testnet.
Segwit Bitcoin Account
Segregated Witness Bitcoin account type P2WPKH. Also reffered to as bech32 addresses. Allows lowest fees but is incompatible with Standard accounts, i.e. it is not possible to send funds from Segwit to Standard account.
These addresses always begin with bc1 on Bitcoin Mainnet and tb1 on Bitcoin Testnet.
Compatibility Bitcoin Account
Compatibilty Bitcoin account P2WPKH-nested-in-P2SH, also called Segwit wrapped in ScriptHash, produces lower fees than Standard account type but higher than Segwit account type. However, it is compatible with all account types.
These addresses always begin with 3 on Bitcoin Mainnet and 2 on Bitcoin Testnet.
Standard Ethereum Accounts
Standard Ethereum Mainnet, Ropsten, Rinkeby, Goerli, Kovan accounts with checksummed account address starting with 0x.
Transactions
Once you send/receive transaction from/to these accounts ZumoKit state will be populated with your accounts' transactions. User object has two helper methods provided to list all available transactions:
getAccountTransactions
receives as a parameter account id and returns list of selected account's transactions corresponding to this account in chronological order,getTransactions
returns a list of all user's transactions irrespective of account.
To get transaction information, use the accessor methods as described in reference (Android / iOS / React Native).
Listeners
User object offers several granular mechanism to listen for changes to user data:
addListener
- subscribe to all user changes,addAccountListener
- subscribe to all changes to a specific account,addTransactionListener
- subscribe to all changes to a specific transaction.
There are corresponding removeListener
, removeAccountListener
and removeTransactionListener
methods on user instance to remove listeners once subsriptions are no longer required.
For full details on these methods see reference (Android / iOS).
For detailed explanation on how to use listeners see ZumoKit State.
Only global state listeners are currently available in ZumoKit React Native SDK. See ZumoKit State for details.