diff --git a/package.json b/package.json index 83fed31..c59f240 100644 --- a/package.json +++ b/package.json @@ -16,13 +16,14 @@ "prepare": "make" }, "dependencies": { - "@wharfkit/antelope": "^0.7.3", + "@wharfkit/antelope": "^0.10.1", + "@wharfkit/common": "^1.2.0-rc4", "@wharfkit/contract": "^0.4.3", "@wharfkit/resources": "^1.0.0", "tslib": "^2.1.0" }, "resolutions": { - "@wharfkit/antelope": "^0.7.3" + "@wharfkit/antelope": "^0.10.1" }, "devDependencies": { "@rollup/plugin-alias": "^4.0.2", diff --git a/src/account.ts b/src/account.ts index 6420468..e16a9ff 100644 --- a/src/account.ts +++ b/src/account.ts @@ -15,10 +15,10 @@ import {Permission} from './permission' import * as SystemContract from './contracts/eosio' import {Resource, ResourceType} from './resource' -export interface AccountArgs { +export interface AccountArgs { client: APIClient contract?: Contract - data: API.v1.AccountObject + data: Data } export interface BuyramOptions { @@ -40,12 +40,12 @@ export interface UndelegateOptions { net?: AssetType } -export class Account { - readonly data: API.v1.AccountObject +export class Account { + readonly data: Data readonly systemContract: SystemContract.Contract readonly client: APIClient - constructor(args: AccountArgs) { + constructor(args: AccountArgs) { this.data = args.data if (args.contract) { this.systemContract = args.contract diff --git a/src/kit.ts b/src/kit.ts index 93bffca..67094c9 100644 --- a/src/kit.ts +++ b/src/kit.ts @@ -1,33 +1,32 @@ -import {APIClient, Name, NameType} from '@wharfkit/antelope' +import {API, APIClient, NameType} from '@wharfkit/antelope' import {Contract} from '@wharfkit/contract' +import {ChainDefinition} from '@wharfkit/common' import {Account} from './account' -export interface AccountKitArgs { - client: APIClient +interface AccountKitOptions { contract?: Contract + client?: APIClient } -export class AccountKit { +export class AccountKit { + readonly chain: ChainDefinition readonly client: APIClient readonly contract?: Contract - constructor(args: AccountKitArgs) { - if (args.contract) { - this.contract = args.contract - } - if (args.client) { - this.client = args.client - } else { - throw new Error('A `client` must be passed when initializing the AccountKit.') - } + constructor(chain: ChainDefinition, options?: AccountKitOptions) { + this.chain = chain + this.contract = options?.contract + this.client = options?.client || new APIClient({url: this.chain.url}) } - async load(accountName: NameType): Promise { - return new Account({ + async load(accountName: NameType): Promise> { + const data = await this.client.v1.chain.get_account(accountName, this.chain.accountDataType) + + return new Account({ client: this.client, contract: this.contract, - data: await this.client.v1.chain.get_account(accountName), + data: data as DataType, }) } } diff --git a/test/data/1343515aa85d3148aedc98f52cbc3706fc33e53b.json b/test/data/1343515aa85d3148aedc98f52cbc3706fc33e53b.json deleted file mode 100644 index 1956bc2..0000000 --- a/test/data/1343515aa85d3148aedc98f52cbc3706fc33e53b.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "request": { - "path": "https://jungle4.greymass.com/v1/chain/send_transaction", - "params": { - "method": "POST", - "body": "{\"signatures\":[\"SIG_K1_KiwjSKNiWmRhReYjUr3G38WFh18FmEX9EGophQDsaFdHHMR9wPBaRQaaN1T3E7pW1ykyoNjwr9SyxUpGPjLE2EjJTS1gaB\"],\"compression\":0,\"packed_context_free_data\":\"00\",\"packed_trx\":\"57cdf364f01af5e82a5800000000010000000000ea30550040cbdaa8aca24a01304608d9c1754de300000000a8ed323218304608d9c1754de300000019ab9cddd4000000000000000000\"}" - } - }, - "status": 202, - "json": { - "transaction_id": "0d31acef3a28426567d4d14391a7c68ff1bb4520e312a3d823fb97c624787b28", - "processed": { - "id": "0d31acef3a28426567d4d14391a7c68ff1bb4520e312a3d823fb97c624787b28", - "block_num": 95886535, - "block_time": "2023-09-03T00:02:43.000", - "producer_block_id": null, - "receipt": { - "status": "executed", - "cpu_usage_us": 157, - "net_usage_words": 15 - }, - "elapsed": 157, - "net_usage": 120, - "scheduled": false, - "action_traces": [ - { - "action_ordinal": 1, - "creator_action_ordinal": 0, - "closest_unnotified_ancestor_action_ordinal": 0, - "receipt": { - "receiver": "eosio", - "act_digest": "1fba57292b4bfba21434191601403dc0db84eae7538e41ef19fe3c828ec64baf", - "global_sequence": 128190592, - "recv_sequence": 95947487, - "auth_sequence": [ - [ - "wharfkit1133", - 30 - ] - ], - "code_sequence": 4, - "abi_sequence": 4 - }, - "receiver": "eosio", - "act": { - "account": "eosio", - "name": "deleteauth", - "authorization": [ - { - "actor": "wharfkit1133", - "permission": "active" - } - ], - "data": { - "account": "wharfkit1133", - "permission": "unittest", - "authorized_by": "" - }, - "hex_data": "304608d9c1754de300000019ab9cddd40000000000000000" - }, - "context_free": false, - "elapsed": 39, - "console": "", - "trx_id": "0d31acef3a28426567d4d14391a7c68ff1bb4520e312a3d823fb97c624787b28", - "block_num": 95886535, - "block_time": "2023-09-03T00:02:43.000", - "producer_block_id": null, - "account_ram_deltas": [ - { - "account": "wharfkit1133", - "delta": -338 - } - ], - "except": null, - "error_code": null, - "return_value_hex_data": "" - } - ], - "account_ram_delta": null, - "except": null, - "error_code": null - } - }, - "text": "{\"transaction_id\":\"0d31acef3a28426567d4d14391a7c68ff1bb4520e312a3d823fb97c624787b28\",\"processed\":{\"id\":\"0d31acef3a28426567d4d14391a7c68ff1bb4520e312a3d823fb97c624787b28\",\"block_num\":95886535,\"block_time\":\"2023-09-03T00:02:43.000\",\"producer_block_id\":null,\"receipt\":{\"status\":\"executed\",\"cpu_usage_us\":157,\"net_usage_words\":15},\"elapsed\":157,\"net_usage\":120,\"scheduled\":false,\"action_traces\":[{\"action_ordinal\":1,\"creator_action_ordinal\":0,\"closest_unnotified_ancestor_action_ordinal\":0,\"receipt\":{\"receiver\":\"eosio\",\"act_digest\":\"1fba57292b4bfba21434191601403dc0db84eae7538e41ef19fe3c828ec64baf\",\"global_sequence\":128190592,\"recv_sequence\":95947487,\"auth_sequence\":[[\"wharfkit1133\",30]],\"code_sequence\":4,\"abi_sequence\":4},\"receiver\":\"eosio\",\"act\":{\"account\":\"eosio\",\"name\":\"deleteauth\",\"authorization\":[{\"actor\":\"wharfkit1133\",\"permission\":\"active\"}],\"data\":{\"account\":\"wharfkit1133\",\"permission\":\"unittest\",\"authorized_by\":\"\"},\"hex_data\":\"304608d9c1754de300000019ab9cddd40000000000000000\"},\"context_free\":false,\"elapsed\":39,\"console\":\"\",\"trx_id\":\"0d31acef3a28426567d4d14391a7c68ff1bb4520e312a3d823fb97c624787b28\",\"block_num\":95886535,\"block_time\":\"2023-09-03T00:02:43.000\",\"producer_block_id\":null,\"account_ram_deltas\":[{\"account\":\"wharfkit1133\",\"delta\":-338}],\"except\":null,\"error_code\":null,\"return_value_hex_data\":\"\"}],\"account_ram_delta\":null,\"except\":null,\"error_code\":null}}" -} \ No newline at end of file diff --git a/test/data/16063f7e528ffcee61e70f1aeb4ff6c88a17492b.json b/test/data/16063f7e528ffcee61e70f1aeb4ff6c88a17492b.json new file mode 100644 index 0000000..9cb747c --- /dev/null +++ b/test/data/16063f7e528ffcee61e70f1aeb4ff6c88a17492b.json @@ -0,0 +1,272 @@ +{ + "request": { + "path": "https://eos.greymass.com/v1/chain/get_account", + "params": { + "method": "POST", + "body": "{\"account_name\":\"teamgreymass\"}" + } + }, + "status": 200, + "json": { + "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\":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\":[]}" +} \ No newline at end of file diff --git a/test/data/4039a130d2e2ed01f3ba6b3c25c78c8ae290acda.json b/test/data/4039a130d2e2ed01f3ba6b3c25c78c8ae290acda.json new file mode 100644 index 0000000..45526dc --- /dev/null +++ b/test/data/4039a130d2e2ed01f3ba6b3c25c78c8ae290acda.json @@ -0,0 +1,97 @@ +{ + "request": { + "path": "https://jungle4.greymass.com/v1/chain/send_transaction", + "params": { + "method": "POST", + "body": "{\"signatures\":[\"SIG_K1_K1Ay5N1tekDiH9TTq5qtsJNdaTswkqRjrUYtNW7PwavFLDUveJTTag2wiJxBzHhyAYq5a6UcHAZ1CyfPggB7sjfZSnsVjX\"],\"compression\":1,\"packed_context_free_data\":\"789c63000000010001\",\"packed_trx\":\"789cbb1fa99e7ad840cff5992e0310308208865706a10c0ea76fadc809baca68e0c671f360a9ef6390f88ab74646dee80220ba61b5da7246b076a693c72aa7ea3f545abe68869e80f7967337e78905a9add99e2cf139fdc0dd995abca1101ba00000fc20273d\"}" + } + }, + "status": 202, + "json": { + "transaction_id": "48d2861d47d5207772d1a350247ac0e48de0d312fdf9b439271d36286b24ad7d", + "processed": { + "id": "48d2861d47d5207772d1a350247ac0e48de0d312fdf9b439271d36286b24ad7d", + "block_num": 102642195, + "block_time": "2023-10-12T02:26:47.500", + "producer_block_id": null, + "receipt": { + "status": "executed", + "cpu_usage_us": 220, + "net_usage_words": 19 + }, + "elapsed": 220, + "net_usage": 152, + "scheduled": false, + "action_traces": [ + { + "action_ordinal": 1, + "creator_action_ordinal": 0, + "closest_unnotified_ancestor_action_ordinal": 0, + "receipt": { + "receiver": "eosio", + "act_digest": "5d8239b83dcdbae9a7a29f2a5ed47b183e597d7dd16a911270c5c1749230299f", + "global_sequence": 135900873, + "recv_sequence": 102714603, + "auth_sequence": [ + [ + "wharfkit1133", + 49 + ] + ], + "code_sequence": 4, + "abi_sequence": 4 + }, + "receiver": "eosio", + "act": { + "account": "eosio", + "name": "updateauth", + "authorization": [ + { + "actor": "wharfkit1133", + "permission": "active" + } + ], + "data": { + "account": "wharfkit1133", + "permission": "active", + "parent": "owner", + "auth": { + "threshold": 1, + "keys": [ + { + "key": "EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6", + "weight": 1 + } + ], + "accounts": [], + "waits": [] + }, + "authorized_by": "" + }, + "hex_data": "304608d9c1754de300000000a8ed32320000000080ab26a701000000010002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d55010000000000000000000000" + }, + "context_free": false, + "elapsed": 68, + "console": "", + "trx_id": "48d2861d47d5207772d1a350247ac0e48de0d312fdf9b439271d36286b24ad7d", + "block_num": 102642195, + "block_time": "2023-10-12T02:26:47.500", + "producer_block_id": null, + "account_ram_deltas": [ + { + "account": "wharfkit1133", + "delta": 0 + } + ], + "except": null, + "error_code": null, + "return_value_hex_data": "" + } + ], + "account_ram_delta": null, + "except": null, + "error_code": null + } + }, + "text": "{\"transaction_id\":\"48d2861d47d5207772d1a350247ac0e48de0d312fdf9b439271d36286b24ad7d\",\"processed\":{\"id\":\"48d2861d47d5207772d1a350247ac0e48de0d312fdf9b439271d36286b24ad7d\",\"block_num\":102642195,\"block_time\":\"2023-10-12T02:26:47.500\",\"producer_block_id\":null,\"receipt\":{\"status\":\"executed\",\"cpu_usage_us\":220,\"net_usage_words\":19},\"elapsed\":220,\"net_usage\":152,\"scheduled\":false,\"action_traces\":[{\"action_ordinal\":1,\"creator_action_ordinal\":0,\"closest_unnotified_ancestor_action_ordinal\":0,\"receipt\":{\"receiver\":\"eosio\",\"act_digest\":\"5d8239b83dcdbae9a7a29f2a5ed47b183e597d7dd16a911270c5c1749230299f\",\"global_sequence\":135900873,\"recv_sequence\":102714603,\"auth_sequence\":[[\"wharfkit1133\",49]],\"code_sequence\":4,\"abi_sequence\":4},\"receiver\":\"eosio\",\"act\":{\"account\":\"eosio\",\"name\":\"updateauth\",\"authorization\":[{\"actor\":\"wharfkit1133\",\"permission\":\"active\"}],\"data\":{\"account\":\"wharfkit1133\",\"permission\":\"active\",\"parent\":\"owner\",\"auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"authorized_by\":\"\"},\"hex_data\":\"304608d9c1754de300000000a8ed32320000000080ab26a701000000010002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d55010000000000000000000000\"},\"context_free\":false,\"elapsed\":68,\"console\":\"\",\"trx_id\":\"48d2861d47d5207772d1a350247ac0e48de0d312fdf9b439271d36286b24ad7d\",\"block_num\":102642195,\"block_time\":\"2023-10-12T02:26:47.500\",\"producer_block_id\":null,\"account_ram_deltas\":[{\"account\":\"wharfkit1133\",\"delta\":0}],\"except\":null,\"error_code\":null,\"return_value_hex_data\":\"\"}],\"account_ram_delta\":null,\"except\":null,\"error_code\":null}}" +} \ No newline at end of file diff --git a/test/data/641e5bfbeee9679a87c18073de5a96be7fe56ebe.json b/test/data/641e5bfbeee9679a87c18073de5a96be7fe56ebe.json index 626e380..8c3e03c 100644 --- a/test/data/641e5bfbeee9679a87c18073de5a96be7fe56ebe.json +++ b/test/data/641e5bfbeee9679a87c18073de5a96be7fe56ebe.json @@ -9,12 +9,12 @@ "status": 200, "json": { "account_name": "teamgreymass", - "head_block_num": 95886407, - "head_block_time": "2023-09-03T00:01:39.000", + "head_block_num": 102642195, + "head_block_time": "2023-10-12T02:26:47.500", "privileged": false, "last_code_update": "1970-01-01T00:00:00.000", "created": "2022-03-09T18:59:11.000", - "core_liquid_balance": "14.7176 EOS", + "core_liquid_balance": "14.7836 EOS", "ram_quota": 5495, "net_weight": 10000, "cpu_weight": 10000, @@ -96,5 +96,5 @@ }, "eosio_any_linked_actions": [] }, - "text": "{\"account_name\":\"teamgreymass\",\"head_block_num\":95886407,\"head_block_time\":\"2023-09-03T00:01:39.000\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2022-03-09T18:59:11.000\",\"core_liquid_balance\":\"14.7176 EOS\",\"ram_quota\":5495,\"net_weight\":10000,\"cpu_weight\":10000,\"net_limit\":{\"used\":0,\"available\":15416,\"max\":15416},\"cpu_limit\":{\"used\":0,\"available\":2865,\"max\":2865},\"ram_usage\":3446,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS5w2WYgoiFT41Ad3Ax1ZkD47D4qriGaRXRsXmkFuC1hKwjbrXe3\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS5w2WYgoiFT41Ad3Ax1ZkD47D4qriGaRXRsXmkFuC1hKwjbrXe3\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]}],\"total_resources\":{\"owner\":\"teamgreymass\",\"net_weight\":\"1.0000 EOS\",\"cpu_weight\":\"1.0000 EOS\",\"ram_bytes\":4095},\"self_delegated_bandwidth\":{\"from\":\"teamgreymass\",\"to\":\"teamgreymass\",\"net_weight\":\"1.0000 EOS\",\"cpu_weight\":\"1.0000 EOS\"},\"refund_request\":null,\"voter_info\":{\"owner\":\"teamgreymass\",\"proxy\":\"\",\"producers\":[],\"staked\":20000,\"last_vote_weight\":\"0.00000000000000000\",\"proxied_vote_weight\":\"0.00000000000000000\",\"is_proxy\":0,\"flags1\":0,\"reserved2\":0,\"reserved3\":\"0 \"},\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0},\"eosio_any_linked_actions\":[]}" + "text": "{\"account_name\":\"teamgreymass\",\"head_block_num\":102642195,\"head_block_time\":\"2023-10-12T02:26:47.500\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2022-03-09T18:59:11.000\",\"core_liquid_balance\":\"14.7836 EOS\",\"ram_quota\":5495,\"net_weight\":10000,\"cpu_weight\":10000,\"net_limit\":{\"used\":0,\"available\":15416,\"max\":15416},\"cpu_limit\":{\"used\":0,\"available\":2865,\"max\":2865},\"ram_usage\":3446,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS5w2WYgoiFT41Ad3Ax1ZkD47D4qriGaRXRsXmkFuC1hKwjbrXe3\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS5w2WYgoiFT41Ad3Ax1ZkD47D4qriGaRXRsXmkFuC1hKwjbrXe3\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]}],\"total_resources\":{\"owner\":\"teamgreymass\",\"net_weight\":\"1.0000 EOS\",\"cpu_weight\":\"1.0000 EOS\",\"ram_bytes\":4095},\"self_delegated_bandwidth\":{\"from\":\"teamgreymass\",\"to\":\"teamgreymass\",\"net_weight\":\"1.0000 EOS\",\"cpu_weight\":\"1.0000 EOS\"},\"refund_request\":null,\"voter_info\":{\"owner\":\"teamgreymass\",\"proxy\":\"\",\"producers\":[],\"staked\":20000,\"last_vote_weight\":\"0.00000000000000000\",\"proxied_vote_weight\":\"0.00000000000000000\",\"is_proxy\":0,\"flags1\":0,\"reserved2\":0,\"reserved3\":\"0 \"},\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0},\"eosio_any_linked_actions\":[]}" } \ No newline at end of file diff --git a/test/data/78f7b1aaa2f758958d774220fd09a76171b37df9.json b/test/data/78f7b1aaa2f758958d774220fd09a76171b37df9.json deleted file mode 100644 index 7296a15..0000000 --- a/test/data/78f7b1aaa2f758958d774220fd09a76171b37df9.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "request": { - "path": "https://jungle4.greymass.com/v1/chain/send_transaction", - "params": { - "method": "POST", - "body": "{\"signatures\":[\"SIG_K1_Kde6NAnnGGJTWHycDj14WLojzJePjSKpVJF4SpEzDEZ2MEidNyhTjzkQjh3nZvma9cHh3fPxG6wFhfDojXsT5oQtmqN5LR\"],\"compression\":0,\"packed_context_free_data\":\"00\",\"packed_trx\":\"57cdf364f01af5e82a5800000000010000000000ea30550040cbdaa86c52d501304608d9c1754de300000000a8ed32324b304608d9c1754de300000019ab9cddd400000000a8ed323201000000010002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000000000000000000000000\"}" - } - }, - "status": 202, - "json": { - "transaction_id": "859ffba3fe71cbb5c45bfbdc19cf8e08e69d209d07ad6d36118f539a960fa7cb", - "processed": { - "id": "859ffba3fe71cbb5c45bfbdc19cf8e08e69d209d07ad6d36118f539a960fa7cb", - "block_num": 95886402, - "block_time": "2023-09-03T00:01:36.500", - "producer_block_id": null, - "receipt": { - "status": "executed", - "cpu_usage_us": 179, - "net_usage_words": 21 - }, - "elapsed": 179, - "net_usage": 168, - "scheduled": false, - "action_traces": [ - { - "action_ordinal": 1, - "creator_action_ordinal": 0, - "closest_unnotified_ancestor_action_ordinal": 0, - "receipt": { - "receiver": "eosio", - "act_digest": "0274f4685922f32b188ad3507c2fde9c83b010f912767be505501ad1a1c367e1", - "global_sequence": 128190447, - "recv_sequence": 95947351, - "auth_sequence": [ - [ - "wharfkit1133", - 27 - ] - ], - "code_sequence": 4, - "abi_sequence": 4 - }, - "receiver": "eosio", - "act": { - "account": "eosio", - "name": "updateauth", - "authorization": [ - { - "actor": "wharfkit1133", - "permission": "active" - } - ], - "data": { - "account": "wharfkit1133", - "permission": "unittest", - "parent": "active", - "auth": { - "threshold": 1, - "keys": [ - { - "key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "weight": 1 - } - ], - "accounts": [], - "waits": [] - }, - "authorized_by": "" - }, - "hex_data": "304608d9c1754de300000019ab9cddd400000000a8ed323201000000010002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf010000000000000000000000" - }, - "context_free": false, - "elapsed": 57, - "console": "", - "trx_id": "859ffba3fe71cbb5c45bfbdc19cf8e08e69d209d07ad6d36118f539a960fa7cb", - "block_num": 95886402, - "block_time": "2023-09-03T00:01:36.500", - "producer_block_id": null, - "account_ram_deltas": [ - { - "account": "wharfkit1133", - "delta": 338 - } - ], - "except": null, - "error_code": null, - "return_value_hex_data": "" - } - ], - "account_ram_delta": null, - "except": null, - "error_code": null - } - }, - "text": "{\"transaction_id\":\"859ffba3fe71cbb5c45bfbdc19cf8e08e69d209d07ad6d36118f539a960fa7cb\",\"processed\":{\"id\":\"859ffba3fe71cbb5c45bfbdc19cf8e08e69d209d07ad6d36118f539a960fa7cb\",\"block_num\":95886402,\"block_time\":\"2023-09-03T00:01:36.500\",\"producer_block_id\":null,\"receipt\":{\"status\":\"executed\",\"cpu_usage_us\":179,\"net_usage_words\":21},\"elapsed\":179,\"net_usage\":168,\"scheduled\":false,\"action_traces\":[{\"action_ordinal\":1,\"creator_action_ordinal\":0,\"closest_unnotified_ancestor_action_ordinal\":0,\"receipt\":{\"receiver\":\"eosio\",\"act_digest\":\"0274f4685922f32b188ad3507c2fde9c83b010f912767be505501ad1a1c367e1\",\"global_sequence\":128190447,\"recv_sequence\":95947351,\"auth_sequence\":[[\"wharfkit1133\",27]],\"code_sequence\":4,\"abi_sequence\":4},\"receiver\":\"eosio\",\"act\":{\"account\":\"eosio\",\"name\":\"updateauth\",\"authorization\":[{\"actor\":\"wharfkit1133\",\"permission\":\"active\"}],\"data\":{\"account\":\"wharfkit1133\",\"permission\":\"unittest\",\"parent\":\"active\",\"auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"authorized_by\":\"\"},\"hex_data\":\"304608d9c1754de300000019ab9cddd400000000a8ed323201000000010002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf010000000000000000000000\"},\"context_free\":false,\"elapsed\":57,\"console\":\"\",\"trx_id\":\"859ffba3fe71cbb5c45bfbdc19cf8e08e69d209d07ad6d36118f539a960fa7cb\",\"block_num\":95886402,\"block_time\":\"2023-09-03T00:01:36.500\",\"producer_block_id\":null,\"account_ram_deltas\":[{\"account\":\"wharfkit1133\",\"delta\":338}],\"except\":null,\"error_code\":null,\"return_value_hex_data\":\"\"}],\"account_ram_delta\":null,\"except\":null,\"error_code\":null}}" -} \ No newline at end of file diff --git a/test/data/7bb57e23b35a734db0875477bf749505aa9a3c0a.json b/test/data/7bb57e23b35a734db0875477bf749505aa9a3c0a.json index 00b9a7d..4a76e87 100644 --- a/test/data/7bb57e23b35a734db0875477bf749505aa9a3c0a.json +++ b/test/data/7bb57e23b35a734db0875477bf749505aa9a3c0a.json @@ -9,24 +9,24 @@ "status": 200, "json": { "account_name": "wharfkit1111", - "head_block_num": 95886408, - "head_block_time": "2023-09-03T00:01:39.500", + "head_block_num": 102935351, + "head_block_time": "2023-10-13T19:12:47.500", "privileged": false, "last_code_update": "1970-01-01T00:00:00.000", "created": "2022-12-07T01:11:58.500", - "core_liquid_balance": "996.6302 EOS", + "core_liquid_balance": "996.6224 EOS", "ram_quota": 13477, "net_weight": 1010000, "cpu_weight": 5010000, "net_limit": { - "used": 153, - "available": 1556955, + "used": 1607, + "available": 1555501, "max": 1557108 }, "cpu_limit": { - "used": 73, - "available": 1435568, - "max": 1435641 + "used": 1876, + "available": 1433668, + "max": 1435544 }, "ram_usage": 3606, "permissions": [ @@ -101,5 +101,5 @@ }, "eosio_any_linked_actions": [] }, - "text": "{\"account_name\":\"wharfkit1111\",\"head_block_num\":95886408,\"head_block_time\":\"2023-09-03T00:01:39.500\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2022-12-07T01:11:58.500\",\"core_liquid_balance\":\"996.6302 EOS\",\"ram_quota\":13477,\"net_weight\":1010000,\"cpu_weight\":5010000,\"net_limit\":{\"used\":153,\"available\":1556955,\"max\":1557108},\"cpu_limit\":{\"used\":73,\"available\":1435568,\"max\":1435641},\"ram_usage\":3606,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6XXTaRpWhPwnb7CTV9zVsCBrvCpYMMPSk8E8hsJxhf6VFW9DYN\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6XXTaRpWhPwnb7CTV9zVsCBrvCpYMMPSk8E8hsJxhf6VFW9DYN\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"test\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.token\",\"action\":\"transfer\"}]}],\"total_resources\":{\"owner\":\"wharfkit1111\",\"net_weight\":\"101.0000 EOS\",\"cpu_weight\":\"501.0000 EOS\",\"ram_bytes\":12077},\"self_delegated_bandwidth\":null,\"refund_request\":null,\"voter_info\":null,\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0},\"eosio_any_linked_actions\":[]}" + "text": "{\"account_name\":\"wharfkit1111\",\"head_block_num\":102935351,\"head_block_time\":\"2023-10-13T19:12:47.500\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2022-12-07T01:11:58.500\",\"core_liquid_balance\":\"996.6224 EOS\",\"ram_quota\":13477,\"net_weight\":1010000,\"cpu_weight\":5010000,\"net_limit\":{\"used\":1607,\"available\":1555501,\"max\":1557108},\"cpu_limit\":{\"used\":1876,\"available\":1433668,\"max\":1435544},\"ram_usage\":3606,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6XXTaRpWhPwnb7CTV9zVsCBrvCpYMMPSk8E8hsJxhf6VFW9DYN\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6XXTaRpWhPwnb7CTV9zVsCBrvCpYMMPSk8E8hsJxhf6VFW9DYN\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"test\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.token\",\"action\":\"transfer\"}]}],\"total_resources\":{\"owner\":\"wharfkit1111\",\"net_weight\":\"101.0000 EOS\",\"cpu_weight\":\"501.0000 EOS\",\"ram_bytes\":12077},\"self_delegated_bandwidth\":null,\"refund_request\":null,\"voter_info\":null,\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0},\"eosio_any_linked_actions\":[]}" } \ No newline at end of file diff --git a/test/data/8982bb3c2b325ba2365896eb649c1614f30ae941.json b/test/data/8982bb3c2b325ba2365896eb649c1614f30ae941.json new file mode 100644 index 0000000..6a6ce90 --- /dev/null +++ b/test/data/8982bb3c2b325ba2365896eb649c1614f30ae941.json @@ -0,0 +1,161 @@ +{ + "request": { + "path": "https://telos.greymass.com/v1/chain/get_account", + "params": { + "method": "POST", + "body": "{\"account_name\":\"teamgreymass\"}" + } + }, + "status": 200, + "json": { + "account_name": "teamgreymass", + "head_block_num": 304235653, + "head_block_time": "2023-10-12T02:26:48.000", + "privileged": false, + "last_code_update": "1970-01-01T00:00:00.000", + "created": "2018-12-12T17:46:49.000", + "core_liquid_balance": "215249.7163 TLOS", + "ram_quota": 16716, + "net_weight": 10000, + "cpu_weight": 1000000, + "net_limit": { + "used": 702, + "available": 39941998, + "max": 39942700, + "last_usage_update_time": "2023-10-11T22:27:30.500", + "current_used": 585 + }, + "cpu_limit": { + "used": 1611, + "available": 642219931, + "max": 642221542, + "last_usage_update_time": "2023-10-11T22:27:30.500", + "current_used": 1343 + }, + "ram_usage": 8366, + "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": "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" + } + ] + } + ], + "total_resources": { + "owner": "teamgreymass", + "net_weight": "1.0000 TLOS", + "cpu_weight": "100.0000 TLOS", + "ram_bytes": 15316 + }, + "self_delegated_bandwidth": { + "from": "teamgreymass", + "to": "teamgreymass", + "net_weight": "1.0000 TLOS", + "cpu_weight": "100.0000 TLOS" + }, + "refund_request": null, + "voter_info": { + "owner": "teamgreymass", + "proxy": "", + "producers": [], + "staked": "6682315286", + "last_stake": 0, + "last_vote_weight": "0.00000000000000000", + "proxied_vote_weight": "0.00000000000000000", + "is_proxy": 0, + "flags1": 0, + "reserved2": 0, + "reserved3": "0 " + }, + "rex_info": { + "version": 0, + "owner": "teamgreymass", + "vote_stake": "568130.5286 TLOS", + "rex_balance": "3326896774.2846 REX", + "matured_rex": "28424569078808", + "rex_maturities": [ + { + "first": "2023-02-22T00:00:00", + "second": "4844398664038" + } + ] + }, + "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\":304235653,\"head_block_time\":\"2023-10-12T02:26:48.000\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2018-12-12T17:46:49.000\",\"core_liquid_balance\":\"215249.7163 TLOS\",\"ram_quota\":16716,\"net_weight\":10000,\"cpu_weight\":1000000,\"net_limit\":{\"used\":702,\"available\":39941998,\"max\":39942700,\"last_usage_update_time\":\"2023-10-11T22:27:30.500\",\"current_used\":585},\"cpu_limit\":{\"used\":1611,\"available\":642219931,\"max\":642221542,\"last_usage_update_time\":\"2023-10-11T22:27:30.500\",\"current_used\":1343},\"ram_usage\":8366,\"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\":\"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\"}]}],\"total_resources\":{\"owner\":\"teamgreymass\",\"net_weight\":\"1.0000 TLOS\",\"cpu_weight\":\"100.0000 TLOS\",\"ram_bytes\":15316},\"self_delegated_bandwidth\":{\"from\":\"teamgreymass\",\"to\":\"teamgreymass\",\"net_weight\":\"1.0000 TLOS\",\"cpu_weight\":\"100.0000 TLOS\"},\"refund_request\":null,\"voter_info\":{\"owner\":\"teamgreymass\",\"proxy\":\"\",\"producers\":[],\"staked\":\"6682315286\",\"last_stake\":0,\"last_vote_weight\":\"0.00000000000000000\",\"proxied_vote_weight\":\"0.00000000000000000\",\"is_proxy\":0,\"flags1\":0,\"reserved2\":0,\"reserved3\":\"0 \"},\"rex_info\":{\"version\":0,\"owner\":\"teamgreymass\",\"vote_stake\":\"568130.5286 TLOS\",\"rex_balance\":\"3326896774.2846 REX\",\"matured_rex\":\"28424569078808\",\"rex_maturities\":[{\"first\":\"2023-02-22T00:00:00\",\"second\":\"4844398664038\"}]},\"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\":[]}" +} \ No newline at end of file diff --git a/test/data/a91ac04b00106a44611383931aef281f37cd304e.json b/test/data/a91ac04b00106a44611383931aef281f37cd304e.json new file mode 100644 index 0000000..33a7fb5 --- /dev/null +++ b/test/data/a91ac04b00106a44611383931aef281f37cd304e.json @@ -0,0 +1,32 @@ +{ + "request": { + "path": "https://jungle4.greymass.com/v1/chain/get_info", + "params": { + "method": "GET" + } + }, + "status": 200, + "json": { + "server_version": "905c5cc9", + "chain_id": "73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d", + "head_block_num": 102642193, + "last_irreversible_block_num": 102641859, + "last_irreversible_block_id": "061e30c3aa56b2e82e45e62d338ca1d08925daf74900f991138ee783325d4808", + "head_block_id": "061e3211212d3ac59bb5bfb542324ad3f2f2bef58f81e44307f930cd7335026b", + "head_block_time": "2023-10-12T02:26:46.500", + "head_block_producer": "eosnationftw", + "virtual_block_cpu_limit": 200000000, + "virtual_block_net_limit": 1048576000, + "block_cpu_limit": 200000, + "block_net_limit": 1048576, + "server_version_string": "v3.1.3", + "fork_db_head_block_num": 102642193, + "fork_db_head_block_id": "061e3211212d3ac59bb5bfb542324ad3f2f2bef58f81e44307f930cd7335026b", + "server_full_version_string": "v3.1.3-905c5cc900b4e88aed4ab6912009127bf9f4f140", + "total_cpu_weight": "120613149533319", + "total_net_weight": "117529288069341", + "earliest_available_block_num": 102456122, + "last_irreversible_block_time": "2023-10-12T02:23:59.500" + }, + "text": "{\"server_version\":\"905c5cc9\",\"chain_id\":\"73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d\",\"head_block_num\":102642193,\"last_irreversible_block_num\":102641859,\"last_irreversible_block_id\":\"061e30c3aa56b2e82e45e62d338ca1d08925daf74900f991138ee783325d4808\",\"head_block_id\":\"061e3211212d3ac59bb5bfb542324ad3f2f2bef58f81e44307f930cd7335026b\",\"head_block_time\":\"2023-10-12T02:26:46.500\",\"head_block_producer\":\"eosnationftw\",\"virtual_block_cpu_limit\":200000000,\"virtual_block_net_limit\":1048576000,\"block_cpu_limit\":200000,\"block_net_limit\":1048576,\"server_version_string\":\"v3.1.3\",\"fork_db_head_block_num\":102642193,\"fork_db_head_block_id\":\"061e3211212d3ac59bb5bfb542324ad3f2f2bef58f81e44307f930cd7335026b\",\"server_full_version_string\":\"v3.1.3-905c5cc900b4e88aed4ab6912009127bf9f4f140\",\"total_cpu_weight\":\"120613149533319\",\"total_net_weight\":\"117529288069341\",\"earliest_available_block_num\":102456122,\"last_irreversible_block_time\":\"2023-10-12T02:23:59.500\"}" +} \ No newline at end of file diff --git a/test/data/aaa72e8c80195f8444c725e12d56dd32bd74fc6e.json b/test/data/aaa72e8c80195f8444c725e12d56dd32bd74fc6e.json index f58cabc..d2146d0 100644 --- a/test/data/aaa72e8c80195f8444c725e12d56dd32bd74fc6e.json +++ b/test/data/aaa72e8c80195f8444c725e12d56dd32bd74fc6e.json @@ -9,8 +9,8 @@ "status": 200, "json": { "account_name": "wharfkit1133", - "head_block_num": 95886398, - "head_block_time": "2023-09-03T00:01:34.500", + "head_block_num": 102642193, + "head_block_time": "2023-10-12T02:26:46.500", "privileged": false, "last_code_update": "1970-01-01T00:00:00.000", "created": "2023-09-02T23:23:15.000", @@ -19,16 +19,16 @@ "net_weight": 1010000, "cpu_weight": 1010000, "net_limit": { - "used": 3996, - "available": 1553112, + "used": 1136, + "available": 1555972, "max": 1557108 }, "cpu_limit": { - "used": 5396, - "available": 284024, - "max": 289420 + "used": 1170, + "available": 288231, + "max": 289401 }, - "ram_usage": 3478, + "ram_usage": 3816, "permissions": [ { "perm_name": "active", @@ -82,6 +82,22 @@ "action": "transfer" } ] + }, + { + "perm_name": "unittest", + "parent": "active", + "required_auth": { + "threshold": 1, + "keys": [ + { + "key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", + "weight": 1 + } + ], + "accounts": [], + "waits": [] + }, + "linked_actions": [] } ], "total_resources": { @@ -101,5 +117,5 @@ }, "eosio_any_linked_actions": [] }, - "text": "{\"account_name\":\"wharfkit1133\",\"head_block_num\":95886398,\"head_block_time\":\"2023-09-03T00:01:34.500\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2023-09-02T23:23:15.000\",\"core_liquid_balance\":\"5.0000 EOS\",\"ram_quota\":13479,\"net_weight\":1010000,\"cpu_weight\":1010000,\"net_limit\":{\"used\":3996,\"available\":1553112,\"max\":1557108},\"cpu_limit\":{\"used\":5396,\"available\":284024,\"max\":289420},\"ram_usage\":3478,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6XXTaRpWhPwnb7CTV9zVsCBrvCpYMMPSk8E8hsJxhf6VFW9DYN\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"test\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.token\",\"action\":\"transfer\"}]}],\"total_resources\":{\"owner\":\"wharfkit1133\",\"net_weight\":\"101.0000 EOS\",\"cpu_weight\":\"101.0000 EOS\",\"ram_bytes\":12079},\"self_delegated_bandwidth\":null,\"refund_request\":null,\"voter_info\":null,\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0},\"eosio_any_linked_actions\":[]}" + "text": "{\"account_name\":\"wharfkit1133\",\"head_block_num\":102642193,\"head_block_time\":\"2023-10-12T02:26:46.500\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2023-09-02T23:23:15.000\",\"core_liquid_balance\":\"5.0000 EOS\",\"ram_quota\":13479,\"net_weight\":1010000,\"cpu_weight\":1010000,\"net_limit\":{\"used\":1136,\"available\":1555972,\"max\":1557108},\"cpu_limit\":{\"used\":1170,\"available\":288231,\"max\":289401},\"ram_usage\":3816,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"owner\",\"parent\":\"\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6XXTaRpWhPwnb7CTV9zVsCBrvCpYMMPSk8E8hsJxhf6VFW9DYN\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]},{\"perm_name\":\"test\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.token\",\"action\":\"transfer\"}]},{\"perm_name\":\"unittest\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[]}],\"total_resources\":{\"owner\":\"wharfkit1133\",\"net_weight\":\"101.0000 EOS\",\"cpu_weight\":\"101.0000 EOS\",\"ram_bytes\":12079},\"self_delegated_bandwidth\":null,\"refund_request\":null,\"voter_info\":null,\"rex_info\":null,\"subjective_cpu_bill_limit\":{\"used\":0,\"available\":0,\"max\":0},\"eosio_any_linked_actions\":[]}" } \ No newline at end of file diff --git a/test/data/b5ae1f53ef4cf6544fe89a0deb7a7d1043f43149.json b/test/data/b5ae1f53ef4cf6544fe89a0deb7a7d1043f43149.json deleted file mode 100644 index 5467364..0000000 --- a/test/data/b5ae1f53ef4cf6544fe89a0deb7a7d1043f43149.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "request": { - "path": "https://jungle4.greymass.com/v1/chain/get_info", - "params": { - "method": "POST" - } - }, - "status": 200, - "json": { - "server_version": "905c5cc9", - "chain_id": "73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d", - "head_block_num": 95886399, - "last_irreversible_block_num": 95886064, - "last_irreversible_block_id": "05b71af0b00b62c5f5e82a58ae5e9bac8d7f386c5a6e08d69fab71c38ef4b854", - "head_block_id": "05b71c3f60cdc58df06f76a5723e1dbf5c3cf3cd2b8453d734aee5ee089bf044", - "head_block_time": "2023-09-03T00:01:35.000", - "head_block_producer": "eosnationftw", - "virtual_block_cpu_limit": 200000000, - "virtual_block_net_limit": 1048576000, - "block_cpu_limit": 200000, - "block_net_limit": 1048576, - "server_version_string": "v3.1.3", - "fork_db_head_block_num": 95886399, - "fork_db_head_block_id": "05b71c3f60cdc58df06f76a5723e1dbf5c3cf3cd2b8453d734aee5ee089bf044", - "server_full_version_string": "v3.1.3-905c5cc900b4e88aed4ab6912009127bf9f4f140", - "total_cpu_weight": "120605081503422", - "total_net_weight": "117529275413365", - "earliest_available_block_num": 95706957, - "last_irreversible_block_time": "2023-09-02T23:58:47.500" - }, - "text": "{\"server_version\":\"905c5cc9\",\"chain_id\":\"73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d\",\"head_block_num\":95886399,\"last_irreversible_block_num\":95886064,\"last_irreversible_block_id\":\"05b71af0b00b62c5f5e82a58ae5e9bac8d7f386c5a6e08d69fab71c38ef4b854\",\"head_block_id\":\"05b71c3f60cdc58df06f76a5723e1dbf5c3cf3cd2b8453d734aee5ee089bf044\",\"head_block_time\":\"2023-09-03T00:01:35.000\",\"head_block_producer\":\"eosnationftw\",\"virtual_block_cpu_limit\":200000000,\"virtual_block_net_limit\":1048576000,\"block_cpu_limit\":200000,\"block_net_limit\":1048576,\"server_version_string\":\"v3.1.3\",\"fork_db_head_block_num\":95886399,\"fork_db_head_block_id\":\"05b71c3f60cdc58df06f76a5723e1dbf5c3cf3cd2b8453d734aee5ee089bf044\",\"server_full_version_string\":\"v3.1.3-905c5cc900b4e88aed4ab6912009127bf9f4f140\",\"total_cpu_weight\":\"120605081503422\",\"total_net_weight\":\"117529275413365\",\"earliest_available_block_num\":95706957,\"last_irreversible_block_time\":\"2023-09-02T23:58:47.500\"}" -} \ No newline at end of file diff --git a/test/data/c6bc5d3be92c14699da438430c6cdc6d776b1692.json b/test/data/c6bc5d3be92c14699da438430c6cdc6d776b1692.json deleted file mode 100644 index 7488c1d..0000000 --- a/test/data/c6bc5d3be92c14699da438430c6cdc6d776b1692.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "request": { - "path": "https://jungle4.greymass.com/v1/chain/send_transaction", - "params": { - "method": "POST", - "body": "{\"signatures\":[\"SIG_K1_K8b5rHrrWdYsX3x4g5GRjcYpvT8JcYYQyCk3zw3Gq2PRGJFdGFdqgzqCfJDcmzy4Hdn4JZYKSB1udu4gbJQejTvCDJa7CL\"],\"compression\":0,\"packed_context_free_data\":\"00\",\"packed_trx\":\"57cdf364f01af5e82a5800000000010000000000ea30550040cbdaa86c52d501304608d9c1754de300000000a8ed32324b304608d9c1754de300000000a8ed32320000000080ab26a701000000010002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d5501000000000000000000000000\"}" - } - }, - "status": 202, - "json": { - "transaction_id": "0294f4e7e66c033b229cdb7c5ec4c6259a3aa0152c2a750728a307b27e8da6e2", - "processed": { - "id": "0294f4e7e66c033b229cdb7c5ec4c6259a3aa0152c2a750728a307b27e8da6e2", - "block_num": 95886404, - "block_time": "2023-09-03T00:01:37.500", - "producer_block_id": null, - "receipt": { - "status": "executed", - "cpu_usage_us": 219, - "net_usage_words": 21 - }, - "elapsed": 219, - "net_usage": 168, - "scheduled": false, - "action_traces": [ - { - "action_ordinal": 1, - "creator_action_ordinal": 0, - "closest_unnotified_ancestor_action_ordinal": 0, - "receipt": { - "receiver": "eosio", - "act_digest": "5d8239b83dcdbae9a7a29f2a5ed47b183e597d7dd16a911270c5c1749230299f", - "global_sequence": 128190450, - "recv_sequence": 95947354, - "auth_sequence": [ - [ - "wharfkit1133", - 28 - ] - ], - "code_sequence": 4, - "abi_sequence": 4 - }, - "receiver": "eosio", - "act": { - "account": "eosio", - "name": "updateauth", - "authorization": [ - { - "actor": "wharfkit1133", - "permission": "active" - } - ], - "data": { - "account": "wharfkit1133", - "permission": "active", - "parent": "owner", - "auth": { - "threshold": 1, - "keys": [ - { - "key": "EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6", - "weight": 1 - } - ], - "accounts": [], - "waits": [] - }, - "authorized_by": "" - }, - "hex_data": "304608d9c1754de300000000a8ed32320000000080ab26a701000000010002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d55010000000000000000000000" - }, - "context_free": false, - "elapsed": 67, - "console": "", - "trx_id": "0294f4e7e66c033b229cdb7c5ec4c6259a3aa0152c2a750728a307b27e8da6e2", - "block_num": 95886404, - "block_time": "2023-09-03T00:01:37.500", - "producer_block_id": null, - "account_ram_deltas": [ - { - "account": "wharfkit1133", - "delta": 0 - } - ], - "except": null, - "error_code": null, - "return_value_hex_data": "" - } - ], - "account_ram_delta": null, - "except": null, - "error_code": null - } - }, - "text": "{\"transaction_id\":\"0294f4e7e66c033b229cdb7c5ec4c6259a3aa0152c2a750728a307b27e8da6e2\",\"processed\":{\"id\":\"0294f4e7e66c033b229cdb7c5ec4c6259a3aa0152c2a750728a307b27e8da6e2\",\"block_num\":95886404,\"block_time\":\"2023-09-03T00:01:37.500\",\"producer_block_id\":null,\"receipt\":{\"status\":\"executed\",\"cpu_usage_us\":219,\"net_usage_words\":21},\"elapsed\":219,\"net_usage\":168,\"scheduled\":false,\"action_traces\":[{\"action_ordinal\":1,\"creator_action_ordinal\":0,\"closest_unnotified_ancestor_action_ordinal\":0,\"receipt\":{\"receiver\":\"eosio\",\"act_digest\":\"5d8239b83dcdbae9a7a29f2a5ed47b183e597d7dd16a911270c5c1749230299f\",\"global_sequence\":128190450,\"recv_sequence\":95947354,\"auth_sequence\":[[\"wharfkit1133\",28]],\"code_sequence\":4,\"abi_sequence\":4},\"receiver\":\"eosio\",\"act\":{\"account\":\"eosio\",\"name\":\"updateauth\",\"authorization\":[{\"actor\":\"wharfkit1133\",\"permission\":\"active\"}],\"data\":{\"account\":\"wharfkit1133\",\"permission\":\"active\",\"parent\":\"owner\",\"auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"authorized_by\":\"\"},\"hex_data\":\"304608d9c1754de300000000a8ed32320000000080ab26a701000000010002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d55010000000000000000000000\"},\"context_free\":false,\"elapsed\":67,\"console\":\"\",\"trx_id\":\"0294f4e7e66c033b229cdb7c5ec4c6259a3aa0152c2a750728a307b27e8da6e2\",\"block_num\":95886404,\"block_time\":\"2023-09-03T00:01:37.500\",\"producer_block_id\":null,\"account_ram_deltas\":[{\"account\":\"wharfkit1133\",\"delta\":0}],\"except\":null,\"error_code\":null,\"return_value_hex_data\":\"\"}],\"account_ram_delta\":null,\"except\":null,\"error_code\":null}}" -} \ No newline at end of file diff --git a/test/data/b5616398369b9af478c9ece8462aad7ee1fe7fb7.json b/test/data/e8b7ced10560d4ef5dfd243c47f8e3aefc5052f5.json similarity index 50% rename from test/data/b5616398369b9af478c9ece8462aad7ee1fe7fb7.json rename to test/data/e8b7ced10560d4ef5dfd243c47f8e3aefc5052f5.json index 0cfbebd..1146ea9 100644 --- a/test/data/b5616398369b9af478c9ece8462aad7ee1fe7fb7.json +++ b/test/data/e8b7ced10560d4ef5dfd243c47f8e3aefc5052f5.json @@ -3,24 +3,24 @@ "path": "https://jungle4.greymass.com/v1/chain/send_transaction", "params": { "method": "POST", - "body": "{\"signatures\":[\"SIG_K1_KhEYRyq47MbxxsnZy9w74xVaNHyD2gFFPdnHvi7gnhXDFUKb2JQVrYzudjodaWJUgHXmXFrS9S1AyJM89JcYhKDWUpBNSu\"],\"compression\":0,\"packed_context_free_data\":\"00\",\"packed_trx\":\"57cdf364f01af5e82a5800000000010000000000ea30550040cbdaa86c52d501304608d9c1754de300000000a8ed32326f304608d9c1754de300000000a8ed32320000000080ab26a701000000020002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d5501000000000000000000000000\"}" + "body": "{\"signatures\":[\"SIG_K1_K38kBcQbNm9VRXyx9mTZs8xSTC5rw6ZazJvfJHDBRMdeAqsQjuLphDCbmiM1bN91VzrrAiiNRABF7eLdJDx3xLp2trp8UA\"],\"compression\":1,\"packed_context_free_data\":\"789c63000000010001\",\"packed_trx\":\"789cbb1fa99e7ad840cff5992e0310308208865706a10c0ea76fadc809baca68e0c671f360a9ef6390f88ab74646f9e80220ba61b5da7290562606a603f72eed911766fdcdbfeae8b303768f174e72329911a2be4dac6669e645db2fa6e781ca984e1eab9caaff5069f9a2197a02de5bcedd9c2716a4b6667bb2c4e7f40377676af186425c010500aa633820\"}" } }, "status": 202, "json": { - "transaction_id": "f51dccebad945d76bcd1d57d7160cd33bcd72d2f8bfb5c892bee265a07e5b343", + "transaction_id": "50b24f8808732f0ee853d4e9e0038f5532a98ef1ee83589881942d24aaf6dedb", "processed": { - "id": "f51dccebad945d76bcd1d57d7160cd33bcd72d2f8bfb5c892bee265a07e5b343", - "block_num": 95886403, - "block_time": "2023-09-03T00:01:37.000", + "id": "50b24f8808732f0ee853d4e9e0038f5532a98ef1ee83589881942d24aaf6dedb", + "block_num": 102642194, + "block_time": "2023-10-12T02:26:47.000", "producer_block_id": null, "receipt": { "status": "executed", - "cpu_usage_us": 193, - "net_usage_words": 26 + "cpu_usage_us": 241, + "net_usage_words": 23 }, - "elapsed": 193, - "net_usage": 208, + "elapsed": 241, + "net_usage": 184, "scheduled": false, "action_traces": [ { @@ -30,12 +30,12 @@ "receipt": { "receiver": "eosio", "act_digest": "212955b8945f634a0f98b8fad6eea1e9ecf2b8ef0ba910b1d5a33d818ce3cebd", - "global_sequence": 128190449, - "recv_sequence": 95947353, + "global_sequence": 135900872, + "recv_sequence": 102714602, "auth_sequence": [ [ "wharfkit1133", - 28 + 49 ] ], "code_sequence": 4, @@ -75,11 +75,11 @@ "hex_data": "304608d9c1754de300000000a8ed32320000000080ab26a701000000020002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d55010000000000000000000000" }, "context_free": false, - "elapsed": 62, + "elapsed": 78, "console": "", - "trx_id": "f51dccebad945d76bcd1d57d7160cd33bcd72d2f8bfb5c892bee265a07e5b343", - "block_num": 95886403, - "block_time": "2023-09-03T00:01:37.000", + "trx_id": "50b24f8808732f0ee853d4e9e0038f5532a98ef1ee83589881942d24aaf6dedb", + "block_num": 102642194, + "block_time": "2023-10-12T02:26:47.000", "producer_block_id": null, "account_ram_deltas": [ { @@ -97,5 +97,5 @@ "error_code": null } }, - "text": "{\"transaction_id\":\"f51dccebad945d76bcd1d57d7160cd33bcd72d2f8bfb5c892bee265a07e5b343\",\"processed\":{\"id\":\"f51dccebad945d76bcd1d57d7160cd33bcd72d2f8bfb5c892bee265a07e5b343\",\"block_num\":95886403,\"block_time\":\"2023-09-03T00:01:37.000\",\"producer_block_id\":null,\"receipt\":{\"status\":\"executed\",\"cpu_usage_us\":193,\"net_usage_words\":26},\"elapsed\":193,\"net_usage\":208,\"scheduled\":false,\"action_traces\":[{\"action_ordinal\":1,\"creator_action_ordinal\":0,\"closest_unnotified_ancestor_action_ordinal\":0,\"receipt\":{\"receiver\":\"eosio\",\"act_digest\":\"212955b8945f634a0f98b8fad6eea1e9ecf2b8ef0ba910b1d5a33d818ce3cebd\",\"global_sequence\":128190449,\"recv_sequence\":95947353,\"auth_sequence\":[[\"wharfkit1133\",28]],\"code_sequence\":4,\"abi_sequence\":4},\"receiver\":\"eosio\",\"act\":{\"account\":\"eosio\",\"name\":\"updateauth\",\"authorization\":[{\"actor\":\"wharfkit1133\",\"permission\":\"active\"}],\"data\":{\"account\":\"wharfkit1133\",\"permission\":\"active\",\"parent\":\"owner\",\"auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\",\"weight\":1},{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"authorized_by\":\"\"},\"hex_data\":\"304608d9c1754de300000000a8ed32320000000080ab26a701000000020002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d55010000000000000000000000\"},\"context_free\":false,\"elapsed\":62,\"console\":\"\",\"trx_id\":\"f51dccebad945d76bcd1d57d7160cd33bcd72d2f8bfb5c892bee265a07e5b343\",\"block_num\":95886403,\"block_time\":\"2023-09-03T00:01:37.000\",\"producer_block_id\":null,\"account_ram_deltas\":[{\"account\":\"wharfkit1133\",\"delta\":50}],\"except\":null,\"error_code\":null,\"return_value_hex_data\":\"\"}],\"account_ram_delta\":null,\"except\":null,\"error_code\":null}}" + "text": "{\"transaction_id\":\"50b24f8808732f0ee853d4e9e0038f5532a98ef1ee83589881942d24aaf6dedb\",\"processed\":{\"id\":\"50b24f8808732f0ee853d4e9e0038f5532a98ef1ee83589881942d24aaf6dedb\",\"block_num\":102642194,\"block_time\":\"2023-10-12T02:26:47.000\",\"producer_block_id\":null,\"receipt\":{\"status\":\"executed\",\"cpu_usage_us\":241,\"net_usage_words\":23},\"elapsed\":241,\"net_usage\":184,\"scheduled\":false,\"action_traces\":[{\"action_ordinal\":1,\"creator_action_ordinal\":0,\"closest_unnotified_ancestor_action_ordinal\":0,\"receipt\":{\"receiver\":\"eosio\",\"act_digest\":\"212955b8945f634a0f98b8fad6eea1e9ecf2b8ef0ba910b1d5a33d818ce3cebd\",\"global_sequence\":135900872,\"recv_sequence\":102714602,\"auth_sequence\":[[\"wharfkit1133\",49]],\"code_sequence\":4,\"abi_sequence\":4},\"receiver\":\"eosio\",\"act\":{\"account\":\"eosio\",\"name\":\"updateauth\",\"authorization\":[{\"actor\":\"wharfkit1133\",\"permission\":\"active\"}],\"data\":{\"account\":\"wharfkit1133\",\"permission\":\"active\",\"parent\":\"owner\",\"auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\",\"weight\":1},{\"key\":\"EOS6RMS3nvoN9StPzZizve6WdovaDkE5KkEcCDXW7LbepyAioMiK6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"authorized_by\":\"\"},\"hex_data\":\"304608d9c1754de300000000a8ed32320000000080ab26a701000000020002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000002c9c679952fe122a7a2982e104bb4ced99e165226acb76318f367c0dd992a0d55010000000000000000000000\"},\"context_free\":false,\"elapsed\":78,\"console\":\"\",\"trx_id\":\"50b24f8808732f0ee853d4e9e0038f5532a98ef1ee83589881942d24aaf6dedb\",\"block_num\":102642194,\"block_time\":\"2023-10-12T02:26:47.000\",\"producer_block_id\":null,\"account_ram_deltas\":[{\"account\":\"wharfkit1133\",\"delta\":50}],\"except\":null,\"error_code\":null,\"return_value_hex_data\":\"\"}],\"account_ram_delta\":null,\"except\":null,\"error_code\":null}}" } \ No newline at end of file diff --git a/test/data/ef20dbcccffc6200cd24d5706914d7f0202a9a56.json b/test/data/ef20dbcccffc6200cd24d5706914d7f0202a9a56.json new file mode 100644 index 0000000..db61072 --- /dev/null +++ b/test/data/ef20dbcccffc6200cd24d5706914d7f0202a9a56.json @@ -0,0 +1,283 @@ +{ + "request": { + "path": "https://wax.greymass.com/v1/chain/get_account", + "params": { + "method": "POST", + "body": "{\"account_name\":\"teamgreymass\"}" + } + }, + "status": 200, + "json": { + "account_name": "teamgreymass", + "head_block_num": 271212797, + "head_block_time": "2023-10-12T02:26:48.000", + "privileged": false, + "last_code_update": "1970-01-01T00:00:00.000", + "created": "2019-07-12T05:18:07.000", + "core_liquid_balance": "2501227.12188168 WAX", + "ram_quota": 20957, + "net_weight": "455096542392", + "cpu_weight": "555196542594", + "net_limit": { + "used": 194859, + "available": 552625636, + "max": 552820495, + "last_usage_update_time": "2023-10-12T02:25:57.500", + "current_used": 194745 + }, + "cpu_limit": { + "used": 444053, + "available": 970640, + "max": 1414693, + "last_usage_update_time": "2023-10-12T02:25:57.500", + "current_used": 443793 + }, + "ram_usage": 12635, + "permissions": [ + { + "perm_name": "active", + "parent": "owner", + "required_auth": { + "threshold": 1, + "keys": [ + { + "key": "EOS8KmhygTrrvtW7zJd6HXWrNqA5WX9NzScZ37JyXRiwpiJN2g2rR", + "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" + }, + { + "account": "eosio", + "action": "claimgenesis" + }, + { + "account": "eosio", + "action": "claimgbmvote" + }, + { + "account": "eosio", + "action": "claimgbmprod" + } + ] + }, + { + "perm_name": "failover", + "parent": "active", + "required_auth": { + "threshold": 1, + "keys": [ + { + "key": "EOS8NKyWVSfbfmyU98y6AfvJ8QfwbtNKAgfnZ9BbWd3UvQzMHhJY6", + "weight": 1 + } + ], + "accounts": [], + "waits": [] + }, + "linked_actions": [ + { + "account": "eosio", + "action": "regproducer" + } + ] + }, + { + "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": "EOS76TP8M48sRBGdPmsKyy3qAMCYgBNswjaWaXGR4jkS5Hro16khr", + "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": "EOS6AkZZ5YZ6G5eCQGJBAPbkmouEaiSKFkdM289wEMKcf2rnx7mrb", + "weight": 1 + }, + { + "key": "EOS6RWZ1CmDL4B6LdixuertnzxcRuUDac3NQspJEvMnebGcUwhvfX", + "weight": 1 + } + ], + "accounts": [], + "waits": [] + }, + "linked_actions": [ + { + "account": "eosio.token", + "action": "transfer" + } + ] + } + ], + "total_resources": { + "owner": "teamgreymass", + "net_weight": "4550.96542392 WAX", + "cpu_weight": "5551.96542594 WAX", + "ram_bytes": 19557 + }, + "self_delegated_bandwidth": { + "from": "teamgreymass", + "to": "teamgreymass", + "net_weight": "4550.96542392 WAX", + "cpu_weight": "5551.96542594 WAX" + }, + "refund_request": null, + "voter_info": { + "owner": "teamgreymass", + "proxy": "", + "producers": [ + "3dkrenderwax", + "alohaeosprod", + "amsterdamwax", + "blacklusionx", + "blokcrafters", + "bountyblokbp", + "bp.box", + "bp.wecan", + "cryptolions1", + "dapplica", + "eosauthority", + "eosdacserver", + "eosdublinwow", + "eosiodetroit", + "eosphereiobp", + "eosriobrazil", + "greeneosiobp", + "guild.nefty", + "hkeosguildhk", + "ivote4waxusa", + "ledgerwiseio", + "liquidstudio", + "nation.wax", + "pink.gg", + "sentnlagents", + "teamgreymass", + "tokengamerio", + "wax.eastern", + "waxhiveguild", + "waxswedenorg" + ], + "staked": "9039133084986", + "unpaid_voteshare": "0.00000000000000000", + "unpaid_voteshare_last_updated": "2023-10-11T17:50:28.000", + "unpaid_voteshare_change_rate": "84871176772458765566336581970335981633536.00000000000000000", + "last_claim_time": "2023-10-11T17:50:28.000", + "last_vote_weight": "84871176772458765566336581970335981633536.00000000000000000", + "proxied_vote_weight": "0.00000000000000000", + "is_proxy": 0, + "flags1": 0, + "reserved2": 0, + "reserved3": "0 " + }, + "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\":271212797,\"head_block_time\":\"2023-10-12T02:26:48.000\",\"privileged\":false,\"last_code_update\":\"1970-01-01T00:00:00.000\",\"created\":\"2019-07-12T05:18:07.000\",\"core_liquid_balance\":\"2501227.12188168 WAX\",\"ram_quota\":20957,\"net_weight\":\"455096542392\",\"cpu_weight\":\"555196542594\",\"net_limit\":{\"used\":194859,\"available\":552625636,\"max\":552820495,\"last_usage_update_time\":\"2023-10-12T02:25:57.500\",\"current_used\":194745},\"cpu_limit\":{\"used\":444053,\"available\":970640,\"max\":1414693,\"last_usage_update_time\":\"2023-10-12T02:25:57.500\",\"current_used\":443793},\"ram_usage\":12635,\"permissions\":[{\"perm_name\":\"active\",\"parent\":\"owner\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS8KmhygTrrvtW7zJd6HXWrNqA5WX9NzScZ37JyXRiwpiJN2g2rR\",\"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\"},{\"account\":\"eosio\",\"action\":\"claimgenesis\"},{\"account\":\"eosio\",\"action\":\"claimgbmvote\"},{\"account\":\"eosio\",\"action\":\"claimgbmprod\"}]},{\"perm_name\":\"failover\",\"parent\":\"active\",\"required_auth\":{\"threshold\":1,\"keys\":[{\"key\":\"EOS8NKyWVSfbfmyU98y6AfvJ8QfwbtNKAgfnZ9BbWd3UvQzMHhJY6\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio\",\"action\":\"regproducer\"}]},{\"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\":\"EOS76TP8M48sRBGdPmsKyy3qAMCYgBNswjaWaXGR4jkS5Hro16khr\",\"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\":\"EOS6AkZZ5YZ6G5eCQGJBAPbkmouEaiSKFkdM289wEMKcf2rnx7mrb\",\"weight\":1},{\"key\":\"EOS6RWZ1CmDL4B6LdixuertnzxcRuUDac3NQspJEvMnebGcUwhvfX\",\"weight\":1}],\"accounts\":[],\"waits\":[]},\"linked_actions\":[{\"account\":\"eosio.token\",\"action\":\"transfer\"}]}],\"total_resources\":{\"owner\":\"teamgreymass\",\"net_weight\":\"4550.96542392 WAX\",\"cpu_weight\":\"5551.96542594 WAX\",\"ram_bytes\":19557},\"self_delegated_bandwidth\":{\"from\":\"teamgreymass\",\"to\":\"teamgreymass\",\"net_weight\":\"4550.96542392 WAX\",\"cpu_weight\":\"5551.96542594 WAX\"},\"refund_request\":null,\"voter_info\":{\"owner\":\"teamgreymass\",\"proxy\":\"\",\"producers\":[\"3dkrenderwax\",\"alohaeosprod\",\"amsterdamwax\",\"blacklusionx\",\"blokcrafters\",\"bountyblokbp\",\"bp.box\",\"bp.wecan\",\"cryptolions1\",\"dapplica\",\"eosauthority\",\"eosdacserver\",\"eosdublinwow\",\"eosiodetroit\",\"eosphereiobp\",\"eosriobrazil\",\"greeneosiobp\",\"guild.nefty\",\"hkeosguildhk\",\"ivote4waxusa\",\"ledgerwiseio\",\"liquidstudio\",\"nation.wax\",\"pink.gg\",\"sentnlagents\",\"teamgreymass\",\"tokengamerio\",\"wax.eastern\",\"waxhiveguild\",\"waxswedenorg\"],\"staked\":\"9039133084986\",\"unpaid_voteshare\":\"0.00000000000000000\",\"unpaid_voteshare_last_updated\":\"2023-10-11T17:50:28.000\",\"unpaid_voteshare_change_rate\":\"84871176772458765566336581970335981633536.00000000000000000\",\"last_claim_time\":\"2023-10-11T17:50:28.000\",\"last_vote_weight\":\"84871176772458765566336581970335981633536.00000000000000000\",\"proxied_vote_weight\":\"0.00000000000000000\",\"is_proxy\":0,\"flags1\":0,\"reserved2\":0,\"reserved3\":\"0 \"},\"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\":[]}" +} \ No newline at end of file diff --git a/test/tests/account.ts b/test/tests/account.ts index bb6add3..993bbab 100644 --- a/test/tests/account.ts +++ b/test/tests/account.ts @@ -1,15 +1,16 @@ -import {assert} from 'chai' +import {assert, expect} from 'chai' import {API, Asset, Authority, Int64, KeyWeight, Serializer} from '@wharfkit/antelope' import {makeClient, mockSessionArgs, mockSessionOptions} from '@wharfkit/mock-data' import {Session} from '@wharfkit/session' import {PlaceholderAuth} from '@wharfkit/signing-request' +import {Chains} from '@wharfkit/common' import {Account, AccountKit, Permission, SystemContract} from '../../src' const mockAccountName = 'wharfkit1133' const client = makeClient('https://jungle4.greymass.com') -const accountKit = new AccountKit({client}) +const accountKit = new AccountKit(Chains.Jungle4, {client}) const session = new Session( { ...mockSessionArgs, @@ -125,13 +126,15 @@ suite('Account', function () { permission.addKey('PUB_K1_6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5BoDq63') // Get action to commit change to chain const action = testAccount.setPermission(permission) - await session.transact({action}, {broadcast: true}) + expect(String(action.name)).to.equal('updateauth') + expect(String(action.account)).to.equal('eosio') + expect(String(action.authorization[0])).to.equal(String(PlaceholderAuth)) }) test('remove it', async () => { const action = testAccount.removePermission('unittest') assert.isTrue(action.account.equals('eosio')) assert.isTrue(action.name.equals('deleteauth')) - assert.isTrue(action.authorization[0].equals(PlaceholderAuth)) + assert.isTrue(action.authorization[0].equals(String(PlaceholderAuth))) const decoded = Serializer.decode({ data: action.data, @@ -140,7 +143,9 @@ suite('Account', function () { assert.isTrue(decoded.account.equals('wharfkit1133')) assert.isTrue(decoded.permission.equals('unittest')) - await session.transact({action}, {broadcast: true}) + expect(String(action.name)).to.equal('deleteauth') + expect(String(action.account)).to.equal('eosio') + expect(String(action.authorization[0])).to.equal(String(PlaceholderAuth)) }) }) suite('modify existing', function () { diff --git a/test/tests/kit.ts b/test/tests/kit.ts index 82a13a6..751e4d6 100644 --- a/test/tests/kit.ts +++ b/test/tests/kit.ts @@ -2,6 +2,8 @@ import {assert, expect} from 'chai' import {Account, AccountKit, SystemContract} from '../../src' import {makeClient} from '@wharfkit/mock-data' +import {API} from '@wharfkit/antelope' +import {ChainDefinition, Chains, TelosAccountObject, WAXAccountObject} from '@wharfkit/common' const client = makeClient('https://jungle4.greymass.com') @@ -9,34 +11,31 @@ suite('AccountKit', function () { let accountKit: AccountKit this.beforeAll(function () { - accountKit = new AccountKit({client}) + accountKit = new AccountKit(Chains.Jungle4, { + client: makeClient('https://jungle4.greymass.com'), + }) }) suite('constructor', function () { - test('throws error if client is not provided', function () { - try { - new AccountKit({} as any) - } catch (error) { - assert.equal( - error.message, - 'A `client` must be passed when initializing the AccountKit.' - ) - } - }) - - test('sets client if provided', function () { + test('sets client from chain definition provided', function () { expect(accountKit.client).to.exist }) test('allow overriding of default contract', function () { - const kit = new AccountKit({ - client, - contract: new SystemContract.Contract({client: makeClient()}), + const kit = new AccountKit(Chains.Jungle4, { + client: makeClient('https://jungle4.greymass.com'), + contract: new SystemContract.Contract({client}), }) + + expect(kit.contract).to.exist }) }) suite('load', function () { + this.beforeAll(function () { + accountKit = new AccountKit(Chains.Jungle4, {client}) + }) + test('throws error if account does not exist', async function () { try { await accountKit.load('nonexistent') @@ -50,5 +49,57 @@ suite('AccountKit', function () { const account = await accountKit.load('teamgreymass') expect(account).to.be.instanceOf(Account) }) + + test('returns the default account object type on EOS', async function () { + const kit = new AccountKit(Chains.EOS, {client: makeClient('https://eos.greymass.com')}) + const account = await kit.load('teamgreymass') + expect(account.data).to.be.instanceOf(API.v1.AccountObject) + expect(account.data).not.to.be.instanceOf(TelosAccountObject) + expect(account.data).not.to.be.instanceOf(WAXAccountObject) + }) + + test('returns telos account type', async function () { + const kit = new AccountKit(Chains.Telos, { + client: makeClient('https://telos.greymass.com'), + }) + const account = await kit.load('teamgreymass') + expect(account.data).to.be.instanceOf(API.v1.AccountObject) + expect(account.data).not.to.be.instanceOf(WAXAccountObject) + expect(account.data).to.be.instanceOf(TelosAccountObject) + assert.isDefined(account.data.voter_info?.last_stake) + }) + + test('returns wax account type', async function () { + const kit = new AccountKit(Chains.WAX, {client: makeClient('https://wax.greymass.com')}) + const account = await kit.load('teamgreymass') + expect(account.data).to.be.instanceOf(API.v1.AccountObject) + expect(account.data).not.to.be.instanceOf(TelosAccountObject) + expect(account.data).to.be.instanceOf(WAXAccountObject) + assert.isDefined(account.data.voter_info?.unpaid_voteshare) + assert.isDefined(account.data.voter_info?.unpaid_voteshare_last_updated) + assert.isDefined(account.data.voter_info?.unpaid_voteshare_change_rate) + assert.isDefined(account.data.voter_info?.last_claim_time) + }) + + test('returns wax account type from custom definition', async function () { + const kit = new AccountKit( + ChainDefinition.from({ + id: '1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4', + url: 'https://wax.greymass.com', + accountDataType: WAXAccountObject, + }), + { + client: makeClient('https://wax.greymass.com'), + } + ) + const account = await kit.load('teamgreymass') + expect(account.data).to.be.instanceOf(API.v1.AccountObject) + expect(account.data).not.to.be.instanceOf(TelosAccountObject) + expect(account.data).to.be.instanceOf(WAXAccountObject) + assert.isDefined(account.data.voter_info?.unpaid_voteshare) + assert.isDefined(account.data.voter_info?.unpaid_voteshare_last_updated) + assert.isDefined(account.data.voter_info?.unpaid_voteshare_change_rate) + assert.isDefined(account.data.voter_info?.last_claim_time) + }) }) }) diff --git a/test/tests/permission.ts b/test/tests/permission.ts index 4794755..d72d3ab 100644 --- a/test/tests/permission.ts +++ b/test/tests/permission.ts @@ -10,11 +10,13 @@ import { WaitWeight, } from '@wharfkit/antelope' import {makeClient, mockAccountName} from '@wharfkit/mock-data' +import {Chains} from '@wharfkit/common' import {Account, AccountKit, Permission} from '../../src' -const client = makeClient('https://jungle4.greymass.com') -const accountKit = new AccountKit({client}) +const accountKit = new AccountKit(Chains.Jungle4, { + client: makeClient('https://jungle4.greymass.com'), +}) suite('Permission', function () { let testAccount: Account diff --git a/yarn.lock b/yarn.lock index b9a80e5..a118882 100644 --- a/yarn.lock +++ b/yarn.lock @@ -551,15 +551,16 @@ pako "^2.0.4" tslib "^2.1.0" -"@wharfkit/antelope@^0.7.3", "@wharfkit/antelope@^0.8.0": - version "0.7.3" - resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-0.7.3.tgz#408f6c587f4f5990d4b55596c10be2e976798641" - integrity sha512-pyUmuXUpLQh1RVpJVIcbVUHTwV/DQ+MI0nlfWDBHIICdYf6XidZtQmaHB7JEXiFzlS8T7S9Xc5VOTOQU8dnl3Q== +"@wharfkit/antelope@^0.10.1", "@wharfkit/antelope@^0.7.3", "@wharfkit/antelope@^0.8.0": + version "0.10.1" + resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-0.10.1.tgz#c51c89a814fdf409793df161f447a6763ab89840" + integrity sha512-sBOe2dFvAlFACeLjQUOrZahqSwoyUWfjY8sxn2B+dViK2WPmD3Lo76a7v/Ko+J6WgA1EjAfp4NGMWyUcBDEJ6Q== dependencies: bn.js "^4.11.9" brorand "^1.1.0" elliptic "^6.5.4" hash.js "^1.0.0" + pako "^2.1.0" tslib "^2.0.3" "@wharfkit/common@^1.1.0": @@ -569,6 +570,13 @@ dependencies: tslib "^2.1.0" +"@wharfkit/common@^1.2.0-rc4": + version "1.2.0-rc4" + resolved "https://registry.yarnpkg.com/@wharfkit/common/-/common-1.2.0-rc4.tgz#2491edf338870b47afadadd92dbb96c21b524ef7" + integrity sha512-vV6r1I0tl+3BO7KN3ir68ZWcIMrR+MrGfdduV07N1B463mzDnwCR1aBkhn5ZIXAukWdj7LOpfDLPs5OiAHHGpA== + dependencies: + tslib "^2.1.0" + "@wharfkit/contract@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@wharfkit/contract/-/contract-0.4.3.tgz#086ee80ae4b87b14a4d8674fa1f53983a9cc8817" @@ -2157,7 +2165,7 @@ package-hash@^4.0.0: lodash.flattendeep "^4.4.0" release-zalgo "^1.0.0" -pako@^2.0.4: +pako@^2.0.4, pako@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==