State
State contains up to date information on active user, wallets (keystores), transactions and exchange rates.
Android
After initializing ZumoKit application state can be accessed by calling:
State state = this.zumoKit.store().getState();
Methods
Accessor | Type | Description |
---|---|---|
getActiveUser | User | Authenticated active user or null. |
getKeystores | ArrayList<Keystore> | Active user's keystores, ie. wallets. |
getTransactions | ArrayList<Transaction> | Active user's transactions. |
getTxServiceConnection | TxServiceConnection | Transaction service connection status object. |
getExchangeRates | String | Latest cryptocurrency to fiat exchange rates. |
getEthGasPrice | String | Latest ETH gas price. |
Active user
If user has been successfully authenticated active user property is set to current user User object, containing user id and username. Otherwise active user property is null.
Accessor | Type | Description |
---|---|---|
getId | int | Internal user id. |
getUsername | String | Username. |
Keystores
This property contains keystores, ie. wallets, for current active user.
Methods
Accessor | Type | Description |
---|---|---|
getId | String | Internal keystore id. |
getCurrency | Currency | Keystore currency. Currently only Currency.ETH is supported. |
getAddress | String | Wallet blockchain address. |
getUnlocked | boolean | Flag indicating whether keystore is unlocked, ie. decrypted. |
getJson | String | Encrypted keystore JSON. |
Transactions
This property contains transactions for current active user.
Methods
Accessor | Type | Description |
---|---|---|
getId | String | Internal keystore id. |
getTxHash | String | Transaction hash. |
getCurrency | Currency | Transaction currency. Currently only Currency.ETH is supported. |
getTimestamp | long | Transaction confirmed timestamp. If it wasn't confirmed yet, timestamp when transaction was submitted. Timestamps are stored in epoch seconds format. |
getStatus | TransactionStatus | Enum with possible values PENDING , CONFIRMED , FAILED . |
getFromAddress | String | Wallet address of sender. |
getFromUserId | String | Username of sender if available. |
getToAddress | String | Wallet address of recipient. |
getToUserId | String | Username of recipient if available. |
getGasPrice | String | Transaction gas price. |
getGasLimit | String | Transaction gas limit. |
getAmount | String | Transaction gas amount. |
getPayload | String | Transaction payload. |
Transaction statuses follow following flow:
PENDING
- waiting for transaction confirmation.CONFIRMED/FAILED
- transaction has been confirmed or it did not go through.
Transaction service connection
This property contains transactions service status object.
Methods
Accessor | Type | Description |
---|---|---|
getStatus | ConnectionStatus | Enum with possible values CONNECTED /NOT_CONNECTED . |
getLastConnected | long | Timestamp when was connection last closed in epoch format. |
Exchange rates
Exchange rates property contains latest exchange rates between EUR/USD and BTC/ETH. Exchange rates property contains stringified JSON in the following format:
{
"ETH":{
"USD":{
"timestamp":1554470495,
"value":"166.30"
},
"EUR":{
"timestamp":1554470493,
"value":"148.51"
}
},
"BTC":{
"USD":{
"timestamp":1554470493,
"value":"5029.44"
},
"EUR":{
"timestamp":1554470493,
"value":"4491.68"
}
}
}
ETH Gas Price
ETH gas price property contains latest ETH gas prices. ETH gas price property contains stringified JSON in the following format:
{
"id":"9581fc06-45e7-4a60-8cef-7df347909dc2",
"type":"ETH",
"slow":"20",
"average":"20",
"fast":"20",
"slow_time":"0.5",
"average_time":"0.5",
"fast_time":"0.5",
"source":"ETHGASSTATION",
"created_at":1564656984,
"updated_at":1564656984
}
Gas prices are in Gwei unit. Transaction times are in minutes.
iOS
CPState *state = [[_zumoKit store] getState];
Props
Prop | Type | Description |
---|---|---|
activeUser | nullable CPUser * | Authenticated active user or null. |
keystores | nonnull NSArray<CPKeystore *> * | Active user's keystores, ie. wallets. |
transactions | nonnull NSArray<CPTransaction *> * | Active user's transactions. |
txServiceConnection | nonnull CPTxServiceConnection | Transaction service connection status object. |
exchangeRates | nonnull NSString * | Latest cryptocurrency to fiat exchange rates. |
ethGasPrice | String | Latest ETH gas price. |
Active user
If user has been successfully authenticated active user property is set to current user User object, containing user id and username. Otherwise active user properly is null.
Prop | Type | Description |
---|---|---|
id | int32_t | Internal user id. |
username | nonnull NSString * | Username. |
Keystores
This property contains keystores, ie. wallets, for current active user.
Props
Prop | Type | Description |
---|---|---|
id | nonnull NSString * | Internal keystore id. |
currency | CPCurrency | Keystore currency. Currently only CPCurrencyETH is supported. |
address | nonnull NSString * | Wallet blockchain address. |
unlocked | BOOL | Flag indicating whether keystore is unlocked, ie. decrypted. |
json | nonnull NSString * | Encrypted keystore JSON. |
Transactions
This property contains transactions in chronological order for current active user.
Props
Prop | Type | Description |
---|---|---|
id | nonnull NSString * | Internal keystore id. |
txHash | nonnull NSString * | Transaction hash. |
currency | CPCurrency | Transaction currency. Currently only CPCurrencyETH is supported. |
timestamp | int64_t | Transaction confirmed timestamp. If it wasn't confirmed yet, timestamp when transaction was submitted. Timestamps are stored in epoch seconds format. |
status | CPTransactionStatus | Enum with possible values PENDING , CONFIRMED , FAILED . |
fromAddress | nonnull NSString * | Wallet address of sender. |
fromUserId | nonnull NSString * | Username of sender if available. |
toAddress | nonnull NSString * | Wallet address of recipient. |
toUserId | nonnull NSString * | Username of recepient if available. |
gasPrice | nonnull NSString * | Transaction gas price. |
gasLimit | nonnull NSString * | Transaction gas limit. |
amount | nonnull NSString * | Transaction gas amount. |
payload | nonnull NSString * | Transaction payload. |
Transaction statuses follow following flow:
PENDING
- waiting for transaction confirmation.CONFIRMED/FAILED
- transaction has been confirmed or it did not go through.
Transaction service connection
This property contains transactions service status object.
Props
Accessor | Type | Description |
---|---|---|
status | CPConnectionStatus | Enum with possible values CONNECTED /NOT_CONNECTED . |
lastConnected | int64_t | Timestamp when was connection last closed in epoch format. |
Exchange rates
Exchange rates property contains latest exchange rates between EUR/USD and BTC/ETH. Exchange rates property contains stringified JSON in the following format:
{
"ETH":{
"USD":{
"timestamp":1554470495,
"value":"166.30"
},
"EUR":{
"timestamp":1554470493,
"value":"148.51"
}
},
"BTC":{
"USD":{
"timestamp":1554470493,
"value":"5029.44"
},
"EUR":{
"timestamp":1554470493,
"value":"4491.68"
}
}
}
ETH Gas Price
ETH gas price property contains latest ETH gas prices. ETH gas price property contains stringified JSON in the following format:
{
"id":"9581fc06-45e7-4a60-8cef-7df347909dc2",
"type":"ETH",
"slow":"20",
"average":"20",
"fast":"20",
"slow_time":"0.5",
"average_time":"0.5",
"fast_time":"0.5",
"source":"ETHGASSTATION",
"created_at":1564656984,
"updated_at":1564656984
}
Gas prices are in Gwei unit. Transaction times are in minutes.