Skip to content

Commit

Permalink
Merge pull request #20 from wharfkit/fixing-balance
Browse files Browse the repository at this point in the history
Allowing token contract to be passed on account balance() method
  • Loading branch information
aaroncox committed Feb 28, 2024
2 parents 1758726 + da0201b commit 6e44fa2
Show file tree
Hide file tree
Showing 26 changed files with 302 additions and 348 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"@wharfkit/common": "^1.2.0",
"@wharfkit/contract": "^1.0.0",
"@wharfkit/resources": "^1.1.0",
"@wharfkit/token": "^1.0.1",
"@wharfkit/token": "^1.1.2",
"tslib": "^2.1.0"
},
"resolutions": {
"@wharfkit/antelope": "^0.10.1"
"@wharfkit/antelope": "^1.0.0"
},
"devDependencies": {
"@rollup/plugin-alias": "^4.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export class Account<Data extends API.v1.AccountObject = API.v1.AccountObject> {
return Asset.Symbol.from(this.data.total_resources.cpu_weight.symbol)
}

balance(symbol?: Asset.SymbolType) {
return this.token.balance(this.accountName, symbol)
balance(symbol?: Asset.SymbolType, tokenContract?: NameType) {
return this.token.balance(this.accountName, symbol, tokenContract)
}

permission(permissionName: NameType): Permission {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@
"path": "https://eos.greymass.com/v1/chain/get_account",
"params": {
"method": "POST",
"body": "{\"account_name\":\"teamgreymass\"}"
"body": "{\"account_name\":\"teamgreymass\"}",
"headers": {}
}
},
"status": 200,
"json": {
"account_name": "teamgreymass",
"head_block_num": 335951648,
"head_block_time": "2023-10-13T02:36:14.500",
"head_block_num": 359769067,
"head_block_time": "2024-02-28T00:38:46.500",
"privileged": false,
"last_code_update": "1970-01-01T00:00:00.000",
"created": "2018-06-10T13:04:15.000",
"core_liquid_balance": "10012.5616 EOS",
"ram_quota": 67988,
"net_weight": 4493839,
"core_liquid_balance": "9634.2269 EOS",
"ram_quota": 68084,
"net_weight": 9797071,
"cpu_weight": "14044943815",
"net_limit": {
"used": 246873,
"available": 8226226,
"max": 8473099,
"last_usage_update_time": "2023-10-13T02:36:06.000",
"current_used": 246849
"used": 215815,
"available": 18257292,
"max": 18473107,
"last_usage_update_time": "2024-02-28T00:38:06.500",
"current_used": 215715
},
"cpu_limit": {
"used": 1028121,
"available": 238153,
"max": 1266274,
"last_usage_update_time": "2023-10-13T02:36:06.000",
"current_used": 1028020
"used": 876761,
"available": 389911,
"max": 1266672,
"last_usage_update_time": "2024-02-28T00:38:06.500",
"current_used": 876354
},
"ram_usage": 18101,
"ram_usage": 18341,
"permissions": [
{
"perm_name": "active",
Expand Down Expand Up @@ -240,9 +241,9 @@
],
"total_resources": {
"owner": "teamgreymass",
"net_weight": "449.3839 EOS",
"net_weight": "979.7071 EOS",
"cpu_weight": "1404494.3815 EOS",
"ram_bytes": 66588
"ram_bytes": 66684
},
"self_delegated_bandwidth": null,
"refund_request": null,
Expand All @@ -268,5 +269,5 @@
},
"eosio_any_linked_actions": []
},
"text": "{\"account_name\":\"teamgreymass\",\"head_block_num\":335951648,\"head_block_time\":\"2023-10-13T02:36:14.500\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2018-06-10T13:04:15.000\",\"core_liquid_balance\":\"10012.5616 EOS\",\"ram_quota\":67988,\"net_weight\":4493839,\"cpu_weight\":\"14044943815\",\"net_limit\":{\"used\":246873,\"available\":8226226,\"max\":8473099,\"last_usage_update_time\":\"2023-10-13T02:36:06.000\",\"current_used\":246849},\"cpu_limit\":{\"used\":1028121,\"available\":238153,\"max\":1266274,\"last_usage_update_time\":\"2023-10-13T02:36:06.000\",\"current_used\":1028020},\"ram_usage\":18101,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6gqJ7sdPgjHLFLtks9cRPs5qYHa9U3CwK4P2JasTLWKQ9kXZK1\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"claim\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6DLD9HxMcwn73U41jjdGsNe9vDFRKB26um6qTAqrtYcJFtED4C\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio\",\"action\":\"claimrewards\"}]},{\"perm_name\":\"decentium\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7knG7M5TUEdRv1bkVjTPddVoDQnwS7oEZXAgFk3A4hhocA3eJf\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"decentiumorg\"}]},{\"perm_name\":\"killswitch\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7CjC7GL71msPzAuAzd2WwiBEAzTcPL47ACrjSuiNmnnGGufYSn\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio\",\"action\":\"unregprod\"}]},{\"perm_name\":\"oracle\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS88VqmDmJJ9S23eNqdeWYf2zySxv3ckQrWBKy7EvVRCUuhSU4f3\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"delphioracle\",\"action\":\"write\"}]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS8QzGtCea2thiqcTVeXGdyRZpdKYptQznbcWSMj73FD5RgwKN82\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"producerjson\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS5JCEciUdfXnQmTyj85T98bXTAZZ1g7Nmajseu7ZWB8DrDa6Etp\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"producerjson\",\"action\":\"set\"}]},{\"perm_name\":\"transfer\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7qZ8nnmn6KBnjQL4oukyZFWCj8DmC9nJE2nkAYAZbwgKhMu8cW\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.token\",\"action\":\"transfer\"}]},{\"perm_name\":\"vote\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS65NrHPVXaV4voxepQREmYCmnMJm4tAWdxPaK46CbUN1rrVmRzg\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio\",\"action\":\"voteproducer\"}]},{\"perm_name\":\"voting\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7pn6P5FftyNAKRfx9VcUzBFMvC4UitNbnoKbfxNe8SShELo2it\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.forum\",\"action\":\"vote\"},{\"account\":\"eosio.forum\",\"action\":\"unvote\"}]}],\"total_resources\":{\"owner\":\"teamgreymass\",\"net_weight\":\"449.3839 EOS\",\"cpu_weight\":\"1404494.3815 EOS\",\"ram_bytes\":66588},\"self_delegated_bandwidth\":null,\"refund_request\":null,\"voter_info\":{\"owner\":\"teamgreymass\",\"proxy\":\"greymassvote\",\"producers\":[],\"staked\":100202,\"last_vote_weight\":\"1413639875193.77856445312500000\",\"proxied_vote_weight\":\"0.00000000000000000\",\"is_proxy\":0,\"flags1\":0,\"reserved2\":0,\"reserved3\":\"0.0000 EOS\"},\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0,\"last_usage_update_time\":\"2000-01-01T00:00:00.000\",\"current_used\":0},\"eosio_any_linked_actions\":[]}"
"text": "{\"account_name\":\"teamgreymass\",\"head_block_num\":359769067,\"head_block_time\":\"2024-02-28T00:38:46.500\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2018-06-10T13:04:15.000\",\"core_liquid_balance\":\"9634.2269 EOS\",\"ram_quota\":68084,\"net_weight\":9797071,\"cpu_weight\":\"14044943815\",\"net_limit\":{\"used\":215815,\"available\":18257292,\"max\":18473107,\"last_usage_update_time\":\"2024-02-28T00:38:06.500\",\"current_used\":215715},\"cpu_limit\":{\"used\":876761,\"available\":389911,\"max\":1266672,\"last_usage_update_time\":\"2024-02-28T00:38:06.500\",\"current_used\":876354},\"ram_usage\":18341,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6gqJ7sdPgjHLFLtks9cRPs5qYHa9U3CwK4P2JasTLWKQ9kXZK1\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"claim\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6DLD9HxMcwn73U41jjdGsNe9vDFRKB26um6qTAqrtYcJFtED4C\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio\",\"action\":\"claimrewards\"}]},{\"perm_name\":\"decentium\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7knG7M5TUEdRv1bkVjTPddVoDQnwS7oEZXAgFk3A4hhocA3eJf\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"decentiumorg\"}]},{\"perm_name\":\"killswitch\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7CjC7GL71msPzAuAzd2WwiBEAzTcPL47ACrjSuiNmnnGGufYSn\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio\",\"action\":\"unregprod\"}]},{\"perm_name\":\"oracle\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS88VqmDmJJ9S23eNqdeWYf2zySxv3ckQrWBKy7EvVRCUuhSU4f3\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"delphioracle\",\"action\":\"write\"}]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS8QzGtCea2thiqcTVeXGdyRZpdKYptQznbcWSMj73FD5RgwKN82\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"producerjson\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS5JCEciUdfXnQmTyj85T98bXTAZZ1g7Nmajseu7ZWB8DrDa6Etp\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"producerjson\",\"action\":\"set\"}]},{\"perm_name\":\"transfer\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7qZ8nnmn6KBnjQL4oukyZFWCj8DmC9nJE2nkAYAZbwgKhMu8cW\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.token\",\"action\":\"transfer\"}]},{\"perm_name\":\"vote\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS65NrHPVXaV4voxepQREmYCmnMJm4tAWdxPaK46CbUN1rrVmRzg\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio\",\"action\":\"voteproducer\"}]},{\"perm_name\":\"voting\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS7pn6P5FftyNAKRfx9VcUzBFMvC4UitNbnoKbfxNe8SShELo2it\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.forum\",\"action\":\"vote\"},{\"account\":\"eosio.forum\",\"action\":\"unvote\"}]}],\"total_resources\":{\"owner\":\"teamgreymass\",\"net_weight\":\"979.7071 EOS\",\"cpu_weight\":\"1404494.3815 EOS\",\"ram_bytes\":66684},\"self_delegated_bandwidth\":null,\"refund_request\":null,\"voter_info\":{\"owner\":\"teamgreymass\",\"proxy\":\"greymassvote\",\"producers\":[],\"staked\":100202,\"last_vote_weight\":\"1413639875193.77856445312500000\",\"proxied_vote_weight\":\"0.00000000000000000\",\"is_proxy\":0,\"flags1\":0,\"reserved2\":0,\"reserved3\":\"0.0000 EOS\"},\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0,\"last_usage_update_time\":\"2000-01-01T00:00:00.000\",\"current_used\":0},\"eosio_any_linked_actions\":[]}"
}
Loading

0 comments on commit 6e44fa2

Please sign in to comment.