From ff90d797b592f3586204232ae76379fbc608cf57 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 21 Feb 2024 21:45:43 -0800 Subject: [PATCH 1/6] Add support for validator transactions --- src/types/index.ts | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/types/index.ts b/src/types/index.ts index d63e131bd..f035052af 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -289,6 +289,7 @@ export enum TransactionResponseType { Genesis = "genesis_transaction", BlockMetadata = "block_metadata_transaction", StateCheckpoint = "state_checkpoint_transaction", + Validator = "validator_transaction", } export type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse; @@ -296,7 +297,8 @@ export type CommittedTransactionResponse = | UserTransactionResponse | GenesisTransactionResponse | BlockMetadataTransactionResponse - | StateCheckpointTransactionResponse; + | StateCheckpointTransactionResponse + | ValidatorTransactionResponse; export function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse { return response.type === TransactionResponseType.Pending; @@ -322,6 +324,12 @@ export function isStateCheckpointTransactionResponse( return response.type === TransactionResponseType.StateCheckpoint; } +export function isValidatorTransactionResponse( + response: TransactionResponse, +): response is ValidatorTransactionResponse { + return response.type === TransactionResponseType.Validator; +} + export type PendingTransactionResponse = { type: TransactionResponseType.Pending; hash: string; @@ -461,6 +469,34 @@ export type StateCheckpointTransactionResponse = { timestamp: string; }; +export type ValidatorTransactionResponse = { + type: TransactionResponseType.Validator; + version: string; + hash: string; + state_change_hash: string; + event_root_hash: string; + state_checkpoint_hash?: string; + gas_used: string; + /** + * Whether the transaction was successful + */ + success: boolean; + /** + * The VM status of the transaction, can tell useful information in a failure + */ + vm_status: string; + accumulator_root_hash: string; + /** + * Final state of resources changed by the transaction + */ + changes: Array; + /** + * The events emitted by the validator transaction + */ + events: Array; + timestamp: string; +}; + /** * WRITESET CHANGE TYPES */ From 0c1a2c9f0e138e1efb0b254481cdf4abf5b561cf Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 21 Feb 2024 22:26:51 -0800 Subject: [PATCH 2/6] add tests --- src/types/index.ts | 8 +- tests/e2e/api/transactionResponse.test.ts | 532 ++++++++++++++++++++++ 2 files changed, 536 insertions(+), 4 deletions(-) create mode 100644 tests/e2e/api/transactionResponse.test.ts diff --git a/src/types/index.ts b/src/types/index.ts index f035052af..3d07ee70f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -348,7 +348,7 @@ export type UserTransactionResponse = { hash: string; state_change_hash: string; event_root_hash: string; - state_checkpoint_hash?: string; + state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful @@ -411,7 +411,7 @@ export type BlockMetadataTransactionResponse = { hash: string; state_change_hash: string; event_root_hash: string; - state_checkpoint_hash?: string; + state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful @@ -451,7 +451,7 @@ export type StateCheckpointTransactionResponse = { hash: string; state_change_hash: string; event_root_hash: string; - state_checkpoint_hash?: string; + state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful @@ -475,7 +475,7 @@ export type ValidatorTransactionResponse = { hash: string; state_change_hash: string; event_root_hash: string; - state_checkpoint_hash?: string; + state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful diff --git a/tests/e2e/api/transactionResponse.test.ts b/tests/e2e/api/transactionResponse.test.ts new file mode 100644 index 000000000..de3e17257 --- /dev/null +++ b/tests/e2e/api/transactionResponse.test.ts @@ -0,0 +1,532 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable max-len */ +// Copyright © Aptos Foundation +// SPDX-License-Identifier: Apache-2.0 + +import { ValidatorTransactionResponse, TransactionResponseType, UserTransactionResponse, BlockMetadataTransactionResponse } from "../../../src"; + +describe("transaction response types", () => { + test("it tests a sample validator_transaction JSON response satisfies ValidatorTransactionResponse", async () => { + const txn = { + "version":"3", + "hash":"0xc2f1a301b4af32c817f624f7b6edb778c5ec522e1e122b1b0d74472a10809cef", + "state_change_hash":"0xf8699a3b0194c10eb0242fdeb9361deee8a3c242a21222e74df857c3c0ac1961", + "event_root_hash":"0x0db7799c6ee25bc8ca2539ba4fb04f1c701c9bc929c97c54e7a12d584ade84a1", + "state_checkpoint_hash":null, + "gas_used":"0", + "success":true, + "vm_status":"Executed successfully", + "accumulator_root_hash":"0xec3a5fa8a61310432a89b23549cea590a44e79afe9d232d241efb23a6f18592f", + "changes":[ + { + "address":"0x1", + "state_key_hash":"0x50578ada6e87f43cf8693b904e291f9a4b45e3dd8ba76fd7a5b6cfe2b04db116", + "data":{ + "type":"0x1::jwks::PatchedJWKs", + "data":{ + "jwks":{ + "entries":[ + { + "issuer":"0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", + "jwks":[ + { + "variant":{ + "data":"0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", + "type_name":"0x1::jwks::RSA_JWK" + } + }, + { + "variant":{ + "data":"0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", + "type_name":"0x1::jwks::RSA_JWK" + } + } + ], + "version":"1" + } + ] + } + } + }, + "type":"write_resource" + }, + { + "address":"0x1", + "state_key_hash":"0x5c4285a5bcbfb079714ca24ba9c766305b3d1ae093da3bce6c5c32aaa7f6cac0", + "data":{ + "type":"0x1::jwks::ObservedJWKs", + "data":{ + "jwks":{ + "entries":[ + { + "issuer":"0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", + "jwks":[ + { + "variant":{ + "data":"0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", + "type_name":"0x1::jwks::RSA_JWK" + } + }, + { + "variant":{ + "data":"0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", + "type_name":"0x1::jwks::RSA_JWK" + } + } + ], + "version":"1" + } + ] + } + } + }, + "type":"write_resource" + } + ], + "events":[ + { + "guid":{ + "creation_number":"0", + "account_address":"0x0" + }, + "sequence_number":"0", + "type":"0x1::jwks::ObservedJWKsUpdated", + "data":{ + "epoch":"2", + "jwks":{ + "entries":[ + { + "issuer":"0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", + "jwks":[ + { + "variant":{ + "data":"0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", + "type_name":"0x1::jwks::RSA_JWK" + } + }, + { + "variant":{ + "data":"0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", + "type_name":"0x1::jwks::RSA_JWK" + } + } + ], + "version":"1" + } + ] + } + } + } + ], + "timestamp":"1708575651139233", + "type":TransactionResponseType.Validator + } satisfies ValidatorTransactionResponse; + }); + + test("it tests a sample block_metadata JSON response satisfies ValidatorTransactionResponse", async () => { + const txn = { + "version":"2", + "hash":"0x55ac208f0e48f428f210125fcb7c21507f2ea3077a6526824d10a2511a9da188", + "state_change_hash":"0xb1aedbb0e61726f11bde3d5c6a44173659c288071e8deb4536ab61c7905b98b6", + "event_root_hash":"0xf90ec7849cd77a2ecd43dbca81b2ab5a20bd21adcbd6d655c69dca386c3d85f6", + "state_checkpoint_hash":null, + "gas_used":"0", + "success":true, + "vm_status":"Executed successfully", + "accumulator_root_hash":"0x4fff1c6b391b11c08aac65bf9162ca9889140fde0dc350915757382cd514f8a6", + "changes":[ + { + "address":"0x1", + "state_key_hash":"0x5ddf404c60e96e9485beafcabb95609fed8e38e941a725cae4dcec8296fb32d7", + "data":{ + "type":"0x1::block::BlockResource", + "data":{ + "epoch_interval":"60000000", + "height":"2", + "new_block_events":{ + "counter":"3", + "guid":{ + "id":{ + "addr":"0x1", + "creation_num":"3" + } + } + }, + "update_epoch_interval_events":{ + "counter":"0", + "guid":{ + "id":{ + "addr":"0x1", + "creation_num":"4" + } + } + } + } + }, + "type":"write_resource" + }, + { + "address":"0x1", + "state_key_hash":"0x8048c954221814b04533a9f0a9946c3a8d472ac62df5accb9f47c097e256e8b6", + "data":{ + "type":"0x1::stake::ValidatorPerformance", + "data":{ + "validators":[ + { + "failed_proposals":"0", + "successful_proposals":"1" + } + ] + } + }, + "type":"write_resource" + }, + { + "address":"0x1", + "state_key_hash":"0x7b1615bf012d3c94223f3f76287ee2f7bdf31d364071128b256aeff0841b626d", + "data":{ + "type":"0x1::timestamp::CurrentTimeMicroseconds", + "data":{ + "microseconds":"1708575651139233" + } + }, + "type":"write_resource" + }, + { + "address":"0x1", + "state_key_hash":"0xacb6a6ca3f454dc5ce4feee8644807c3083559c23b442c4edaa47cfc3e2f8929", + "data":{ + "type":"0x1::state_storage::StateStorageUsage", + "data":{ + "epoch":"2", + "usage":{ + "bytes":"698048", + "items":"161" + } + } + }, + "type":"write_resource" + } + ], + "id":"0x98236644cc6d0169d58492db6eac038fe21bdefe6909e06494753710615e173a", + "epoch":"2", + "round":"1", + "events":[ + { + "guid":{ + "creation_number":"3", + "account_address":"0x1" + }, + "sequence_number":"2", + "type":"0x1::block::NewBlockEvent", + "data":{ + "epoch":"2", + "failed_proposer_indices":[ + + ], + "hash":"0x98236644cc6d0169d58492db6eac038fe21bdefe6909e06494753710615e173a", + "height":"2", + "previous_block_votes_bitvec":"0x00", + "proposer":"0xfc1b1b4ed23ac63a5a80121590343578ce704901028322e827b254cc8e404558", + "round":"1", + "time_microseconds":"1708575651139233" + } + } + ], + "previous_block_votes_bitvec":[ + 0 + ], + "proposer":"0xfc1b1b4ed23ac63a5a80121590343578ce704901028322e827b254cc8e404558", + "failed_proposer_indices":[ + + ], + "timestamp":"1708575651139233", + "type":TransactionResponseType.BlockMetadata + } satisfies BlockMetadataTransactionResponse; + }); + +// Comment out this test until the API is fixed for single sender txns +// test("it tests a sample user_transaction JSON response satisfies UserTransactionResponse", async () => { +// const txn = { +// "version":"6224", +// "hash":"0xa17bffc240c11f8e9bc2ba8b4b1a45cae44846303c96bf62ca9fafa0fc2d07a8", +// "state_change_hash":"0x2d5c8a6f05e820e81b297b3cde83bf55f3e5ea86f6edc2dc11744e851beea5cb", +// "event_root_hash":"0x1b7628f4bbd261df56e25b44bdce7665193e5014c8221481f631927e1c7974ef", +// "state_checkpoint_hash":null, +// "gas_used":"994", +// "success":true, +// "vm_status":"Executed successfully", +// "accumulator_root_hash":"0x5575e1894bc25c3fbbfae26e31385ec3eb62e084592d1218c5dabddcb6f08348", +// "changes":[ +// { +// "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "state_key_hash":"0x2db694e0624e4431e199ecd0b2210d8d679eeec5d401d381e817b9ed5194d741", +// "data":{ +// "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", +// "data":{ +// "coin":{ +// "value":"99900590" +// }, +// "deposit_events":{ +// "counter":"1", +// "guid":{ +// "id":{ +// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "creation_num":"2" +// } +// } +// }, +// "frozen":false, +// "withdraw_events":{ +// "counter":"1", +// "guid":{ +// "id":{ +// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "creation_num":"3" +// } +// } +// } +// } +// }, +// "type":"write_resource" +// }, +// { +// "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "state_key_hash":"0x1df51b9e15903b1e27e35ca6dd58a3ae8e9dd2288228f431d2a72269fba638b6", +// "data":{ +// "type":"0x1::account::Account", +// "data":{ +// "authentication_key":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "coin_register_events":{ +// "counter":"1", +// "guid":{ +// "id":{ +// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "creation_num":"0" +// } +// } +// }, +// "guid_creation_num":"4", +// "key_rotation_events":{ +// "counter":"0", +// "guid":{ +// "id":{ +// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "creation_num":"1" +// } +// } +// }, +// "rotation_capability_offer":{ +// "for":{ +// "vec":[ + +// ] +// } +// }, +// "sequence_number":"1", +// "signer_capability_offer":{ +// "for":{ +// "vec":[ + +// ] +// } +// } +// } +// }, +// "type":"write_resource" +// }, +// { +// "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "state_key_hash":"0xf86d90bd7adfc6c2ee3d32c15ded3cc04281806e901a1de6691a5876e97e8a46", +// "data":{ +// "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", +// "data":{ +// "coin":{ +// "value":"10" +// }, +// "deposit_events":{ +// "counter":"1", +// "guid":{ +// "id":{ +// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "creation_num":"2" +// } +// } +// }, +// "frozen":false, +// "withdraw_events":{ +// "counter":"0", +// "guid":{ +// "id":{ +// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "creation_num":"3" +// } +// } +// } +// } +// }, +// "type":"write_resource" +// }, +// { +// "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "state_key_hash":"0xfa1bc52c80fd822e6a17cbea54d496f56d3e94f2c8ec55fafa8fef7f35379a3c", +// "data":{ +// "type":"0x1::account::Account", +// "data":{ +// "authentication_key":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "coin_register_events":{ +// "counter":"1", +// "guid":{ +// "id":{ +// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "creation_num":"0" +// } +// } +// }, +// "guid_creation_num":"4", +// "key_rotation_events":{ +// "counter":"0", +// "guid":{ +// "id":{ +// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "creation_num":"1" +// } +// } +// }, +// "rotation_capability_offer":{ +// "for":{ +// "vec":[ + +// ] +// } +// }, +// "sequence_number":"0", +// "signer_capability_offer":{ +// "for":{ +// "vec":[ + +// ] +// } +// } +// } +// }, +// "type":"write_resource" +// }, +// { +// "state_key_hash":"0x6e4b28d40f98a106a65163530924c0dcb40c1349d3aa915d108b4d6cfc1ddb19", +// "handle":"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca", +// "key":"0x0619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", +// "value":"0x4577893b000000000100000000000000", +// "data":{ +// "key":"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", +// "key_type":"address", +// "value":"18446744074708416325", +// "value_type":"u128" +// }, +// "type":"write_table_item" +// } +// ], +// "sender":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "sequence_number":"0", +// "max_gas_amount":"200000", +// "gas_unit_price":"100", +// "expiration_timestamp_secs":"1708582547", +// "payload":{ +// "function":"0x1::aptos_account::transfer", +// "type_arguments":[ + +// ], +// "arguments":[ +// "0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "10" +// ], +// "type":"entry_function_payload" +// }, +// "signature":{ +// "public_key":"0x08a3b19709c80092bb85140bf587b5e6e4676d65cb7bbbfec270641292eae92e", +// "signature":"0x6a8769016cb35c2de96ffc223f99bd827157f07a8cc794ed3eb662f119b767f467e0dbe54de3c1b6f9450d135ce2f339566da7eaf8d224a25d2b6fc6e5b9660d", +// "type":"ed25519_signature" +// }, +// "events":[ +// { +// "guid":{ +// "creation_number":"0", +// "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" +// }, +// "sequence_number":"0", +// "type":"0x1::account::CoinRegisterEvent", +// "data":{ +// "type_info":{ +// "account_address":"0x1", +// "module_name":"0x6170746f735f636f696e", +// "struct_name":"0x4170746f73436f696e" +// } +// } +// }, +// { +// "guid":{ +// "creation_number":"3", +// "account_address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71" +// }, +// "sequence_number":"0", +// "type":"0x1::coin::WithdrawEvent", +// "data":{ +// "amount":"10" +// } +// }, +// { +// "guid":{ +// "creation_number":"0", +// "account_address":"0x0" +// }, +// "sequence_number":"0", +// "type":"0x1::coin::Withdraw<0x1::aptos_coin::AptosCoin>", +// "data":{ +// "account":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", +// "amount":"10" +// } +// }, +// { +// "guid":{ +// "creation_number":"2", +// "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" +// }, +// "sequence_number":"0", +// "type":"0x1::coin::DepositEvent", +// "data":{ +// "amount":"10" +// } +// }, +// { +// "guid":{ +// "creation_number":"0", +// "account_address":"0x0" +// }, +// "sequence_number":"0", +// "type":"0x1::coin::Deposit<0x1::aptos_coin::AptosCoin>", +// "data":{ +// "account":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", +// "amount":"10" +// } +// }, +// { +// "guid":{ +// "creation_number":"0", +// "account_address":"0x0" +// }, +// "sequence_number":"0", +// "type":"0x1::transaction_fee::FeeStatement", +// "data":{ +// "execution_gas_units":"4", +// "io_gas_units":"2", +// "storage_fee_octas":"98800", +// "storage_fee_refund_octas":"0", +// "total_charge_gas_units":"994" +// } +// } +// ], +// "timestamp":"1708582527165294", +// "type":TransactionResponseType.User +// } satisfies UserTransactionResponse; +// }); +}); \ No newline at end of file From ba73164e5c698a0d9508384e0f914f2b7658a485 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 21 Feb 2024 22:33:07 -0800 Subject: [PATCH 3/6] fmt --- tests/e2e/api/transactionResponse.test.ts | 1012 ++++++++++----------- 1 file changed, 505 insertions(+), 507 deletions(-) diff --git a/tests/e2e/api/transactionResponse.test.ts b/tests/e2e/api/transactionResponse.test.ts index de3e17257..addb4da5f 100644 --- a/tests/e2e/api/transactionResponse.test.ts +++ b/tests/e2e/api/transactionResponse.test.ts @@ -3,530 +3,528 @@ // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 -import { ValidatorTransactionResponse, TransactionResponseType, UserTransactionResponse, BlockMetadataTransactionResponse } from "../../../src"; +import { + ValidatorTransactionResponse, + TransactionResponseType, + BlockMetadataTransactionResponse, +} from "../../../src"; describe("transaction response types", () => { test("it tests a sample validator_transaction JSON response satisfies ValidatorTransactionResponse", async () => { const txn = { - "version":"3", - "hash":"0xc2f1a301b4af32c817f624f7b6edb778c5ec522e1e122b1b0d74472a10809cef", - "state_change_hash":"0xf8699a3b0194c10eb0242fdeb9361deee8a3c242a21222e74df857c3c0ac1961", - "event_root_hash":"0x0db7799c6ee25bc8ca2539ba4fb04f1c701c9bc929c97c54e7a12d584ade84a1", - "state_checkpoint_hash":null, - "gas_used":"0", - "success":true, - "vm_status":"Executed successfully", - "accumulator_root_hash":"0xec3a5fa8a61310432a89b23549cea590a44e79afe9d232d241efb23a6f18592f", - "changes":[ - { - "address":"0x1", - "state_key_hash":"0x50578ada6e87f43cf8693b904e291f9a4b45e3dd8ba76fd7a5b6cfe2b04db116", - "data":{ - "type":"0x1::jwks::PatchedJWKs", - "data":{ - "jwks":{ - "entries":[ - { - "issuer":"0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", - "jwks":[ - { - "variant":{ - "data":"0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", - "type_name":"0x1::jwks::RSA_JWK" - } - }, - { - "variant":{ - "data":"0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", - "type_name":"0x1::jwks::RSA_JWK" - } - } - ], - "version":"1" - } - ] - } - } + version: "3", + hash: "0xc2f1a301b4af32c817f624f7b6edb778c5ec522e1e122b1b0d74472a10809cef", + state_change_hash: "0xf8699a3b0194c10eb0242fdeb9361deee8a3c242a21222e74df857c3c0ac1961", + event_root_hash: "0x0db7799c6ee25bc8ca2539ba4fb04f1c701c9bc929c97c54e7a12d584ade84a1", + state_checkpoint_hash: null, + gas_used: "0", + success: true, + vm_status: "Executed successfully", + accumulator_root_hash: "0xec3a5fa8a61310432a89b23549cea590a44e79afe9d232d241efb23a6f18592f", + changes: [ + { + address: "0x1", + state_key_hash: "0x50578ada6e87f43cf8693b904e291f9a4b45e3dd8ba76fd7a5b6cfe2b04db116", + data: { + type: "0x1::jwks::PatchedJWKs", + data: { + jwks: { + entries: [ + { + issuer: "0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", + jwks: [ + { + variant: { + data: "0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", + type_name: "0x1::jwks::RSA_JWK", + }, + }, + { + variant: { + data: "0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", + type_name: "0x1::jwks::RSA_JWK", + }, + }, + ], + version: "1", + }, + ], + }, }, - "type":"write_resource" - }, - { - "address":"0x1", - "state_key_hash":"0x5c4285a5bcbfb079714ca24ba9c766305b3d1ae093da3bce6c5c32aaa7f6cac0", - "data":{ - "type":"0x1::jwks::ObservedJWKs", - "data":{ - "jwks":{ - "entries":[ - { - "issuer":"0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", - "jwks":[ - { - "variant":{ - "data":"0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", - "type_name":"0x1::jwks::RSA_JWK" - } - }, - { - "variant":{ - "data":"0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", - "type_name":"0x1::jwks::RSA_JWK" - } - } - ], - "version":"1" - } - ] - } - } + }, + type: "write_resource", + }, + { + address: "0x1", + state_key_hash: "0x5c4285a5bcbfb079714ca24ba9c766305b3d1ae093da3bce6c5c32aaa7f6cac0", + data: { + type: "0x1::jwks::ObservedJWKs", + data: { + jwks: { + entries: [ + { + issuer: "0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", + jwks: [ + { + variant: { + data: "0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", + type_name: "0x1::jwks::RSA_JWK", + }, + }, + { + variant: { + data: "0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", + type_name: "0x1::jwks::RSA_JWK", + }, + }, + ], + version: "1", + }, + ], + }, }, - "type":"write_resource" - } + }, + type: "write_resource", + }, ], - "events":[ - { - "guid":{ - "creation_number":"0", - "account_address":"0x0" + events: [ + { + guid: { + creation_number: "0", + account_address: "0x0", + }, + sequence_number: "0", + type: "0x1::jwks::ObservedJWKsUpdated", + data: { + epoch: "2", + jwks: { + entries: [ + { + issuer: "0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", + jwks: [ + { + variant: { + data: "0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", + type_name: "0x1::jwks::RSA_JWK", + }, + }, + { + variant: { + data: "0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", + type_name: "0x1::jwks::RSA_JWK", + }, + }, + ], + version: "1", + }, + ], }, - "sequence_number":"0", - "type":"0x1::jwks::ObservedJWKsUpdated", - "data":{ - "epoch":"2", - "jwks":{ - "entries":[ - { - "issuer":"0x68747470733a2f2f6163636f756e74732e676f6f676c652e636f6d", - "jwks":[ - { - "variant":{ - "data":"0x2835356331383861383335343666633138386535313537366261373238333665303630306538623733035253410552533235360441514142d60271304372463378336159736a7230594f4c4d4f416845474d76794670366f34527179456455726e5444596b685a626375642d664a4551616643546e6a533951484e31496a70754b366770783569332d5a363376526a7335455158376c50316a473851672d436e426454544c7734754a6937526d6d6c4b507359614f3144624e6b464f3275454e3632734f4f7a6d4a4368316f6433435a5849315559483563765a5f734c4a614e3241345477765554553361586c5862554e4a7a5f4879336c3071314a6a746137354e724a744a3750666a3974565873387158703135745a58726e62614d2d41493070757377743335567351626d4c77556f7646464765546f6f357132635f633178596e56357551594d6164414e656b47505246504d394a5a705353497648304c765f66313556327a52716d49675837613352636d546e72332d7733514e51546f6764792d4d6f67785055645262786f77", - "type_name":"0x1::jwks::RSA_JWK" - } - }, - { - "variant":{ - "data":"0x2865643830366631383432623538383035346231386236363964643161303961346633363761666334035253410552533235360441514142d60272483351354e59364d41656145384e75537737527732436331655f6a2d6b555330343474752d57636d54467a424b54754b76496c676a357730536c536269566c38317a4274657451467475776b4d7a57676e436b732d322d4677706f795f5f324e556f7555674c74496767415645794f4767504c6679617377746b536d5a73556d575767394a3843674d55646f58466b625a41506c616444636d537169584a376370396e76726f366634736a66724744597a355f2d534e7a314151454762766354683945655a6b764b50726d6e56335945523935624a73676b486d4e4a566b51364c6357744c794b6853475147524d655459615844616a63324b724b54336e657437714e6862416d374b70576464627452356c36413054524372414d6f56324d36385f474c5246323461636a33554f35525730536b756142545a53344b5170796f7941424341746a4c53722d335259365752396e7077", - "type_name":"0x1::jwks::RSA_JWK" - } - } - ], - "version":"1" - } - ] - } - } - } + }, + }, ], - "timestamp":"1708575651139233", - "type":TransactionResponseType.Validator - } satisfies ValidatorTransactionResponse; + timestamp: "1708575651139233", + type: TransactionResponseType.Validator, + } satisfies ValidatorTransactionResponse; }); test("it tests a sample block_metadata JSON response satisfies ValidatorTransactionResponse", async () => { - const txn = { - "version":"2", - "hash":"0x55ac208f0e48f428f210125fcb7c21507f2ea3077a6526824d10a2511a9da188", - "state_change_hash":"0xb1aedbb0e61726f11bde3d5c6a44173659c288071e8deb4536ab61c7905b98b6", - "event_root_hash":"0xf90ec7849cd77a2ecd43dbca81b2ab5a20bd21adcbd6d655c69dca386c3d85f6", - "state_checkpoint_hash":null, - "gas_used":"0", - "success":true, - "vm_status":"Executed successfully", - "accumulator_root_hash":"0x4fff1c6b391b11c08aac65bf9162ca9889140fde0dc350915757382cd514f8a6", - "changes":[ - { - "address":"0x1", - "state_key_hash":"0x5ddf404c60e96e9485beafcabb95609fed8e38e941a725cae4dcec8296fb32d7", - "data":{ - "type":"0x1::block::BlockResource", - "data":{ - "epoch_interval":"60000000", - "height":"2", - "new_block_events":{ - "counter":"3", - "guid":{ - "id":{ - "addr":"0x1", - "creation_num":"3" - } - } + const txn = { + version: "2", + hash: "0x55ac208f0e48f428f210125fcb7c21507f2ea3077a6526824d10a2511a9da188", + state_change_hash: "0xb1aedbb0e61726f11bde3d5c6a44173659c288071e8deb4536ab61c7905b98b6", + event_root_hash: "0xf90ec7849cd77a2ecd43dbca81b2ab5a20bd21adcbd6d655c69dca386c3d85f6", + state_checkpoint_hash: null, + gas_used: "0", + success: true, + vm_status: "Executed successfully", + accumulator_root_hash: "0x4fff1c6b391b11c08aac65bf9162ca9889140fde0dc350915757382cd514f8a6", + changes: [ + { + address: "0x1", + state_key_hash: "0x5ddf404c60e96e9485beafcabb95609fed8e38e941a725cae4dcec8296fb32d7", + data: { + type: "0x1::block::BlockResource", + data: { + epoch_interval: "60000000", + height: "2", + new_block_events: { + counter: "3", + guid: { + id: { + addr: "0x1", + creation_num: "3", }, - "update_epoch_interval_events":{ - "counter":"0", - "guid":{ - "id":{ - "addr":"0x1", - "creation_num":"4" - } - } - } - } - }, - "type":"write_resource" - }, - { - "address":"0x1", - "state_key_hash":"0x8048c954221814b04533a9f0a9946c3a8d472ac62df5accb9f47c097e256e8b6", - "data":{ - "type":"0x1::stake::ValidatorPerformance", - "data":{ - "validators":[ - { - "failed_proposals":"0", - "successful_proposals":"1" - } - ] - } + }, + }, + update_epoch_interval_events: { + counter: "0", + guid: { + id: { + addr: "0x1", + creation_num: "4", + }, + }, + }, }, - "type":"write_resource" - }, - { - "address":"0x1", - "state_key_hash":"0x7b1615bf012d3c94223f3f76287ee2f7bdf31d364071128b256aeff0841b626d", - "data":{ - "type":"0x1::timestamp::CurrentTimeMicroseconds", - "data":{ - "microseconds":"1708575651139233" - } + }, + type: "write_resource", + }, + { + address: "0x1", + state_key_hash: "0x8048c954221814b04533a9f0a9946c3a8d472ac62df5accb9f47c097e256e8b6", + data: { + type: "0x1::stake::ValidatorPerformance", + data: { + validators: [ + { + failed_proposals: "0", + successful_proposals: "1", + }, + ], }, - "type":"write_resource" - }, - { - "address":"0x1", - "state_key_hash":"0xacb6a6ca3f454dc5ce4feee8644807c3083559c23b442c4edaa47cfc3e2f8929", - "data":{ - "type":"0x1::state_storage::StateStorageUsage", - "data":{ - "epoch":"2", - "usage":{ - "bytes":"698048", - "items":"161" - } - } + }, + type: "write_resource", + }, + { + address: "0x1", + state_key_hash: "0x7b1615bf012d3c94223f3f76287ee2f7bdf31d364071128b256aeff0841b626d", + data: { + type: "0x1::timestamp::CurrentTimeMicroseconds", + data: { + microseconds: "1708575651139233", }, - "type":"write_resource" - } - ], - "id":"0x98236644cc6d0169d58492db6eac038fe21bdefe6909e06494753710615e173a", - "epoch":"2", - "round":"1", - "events":[ - { - "guid":{ - "creation_number":"3", - "account_address":"0x1" + }, + type: "write_resource", + }, + { + address: "0x1", + state_key_hash: "0xacb6a6ca3f454dc5ce4feee8644807c3083559c23b442c4edaa47cfc3e2f8929", + data: { + type: "0x1::state_storage::StateStorageUsage", + data: { + epoch: "2", + usage: { + bytes: "698048", + items: "161", + }, }, - "sequence_number":"2", - "type":"0x1::block::NewBlockEvent", - "data":{ - "epoch":"2", - "failed_proposer_indices":[ - - ], - "hash":"0x98236644cc6d0169d58492db6eac038fe21bdefe6909e06494753710615e173a", - "height":"2", - "previous_block_votes_bitvec":"0x00", - "proposer":"0xfc1b1b4ed23ac63a5a80121590343578ce704901028322e827b254cc8e404558", - "round":"1", - "time_microseconds":"1708575651139233" - } - } - ], - "previous_block_votes_bitvec":[ - 0 + }, + type: "write_resource", + }, ], - "proposer":"0xfc1b1b4ed23ac63a5a80121590343578ce704901028322e827b254cc8e404558", - "failed_proposer_indices":[ - + id: "0x98236644cc6d0169d58492db6eac038fe21bdefe6909e06494753710615e173a", + epoch: "2", + round: "1", + events: [ + { + guid: { + creation_number: "3", + account_address: "0x1", + }, + sequence_number: "2", + type: "0x1::block::NewBlockEvent", + data: { + epoch: "2", + failed_proposer_indices: [], + hash: "0x98236644cc6d0169d58492db6eac038fe21bdefe6909e06494753710615e173a", + height: "2", + previous_block_votes_bitvec: "0x00", + proposer: "0xfc1b1b4ed23ac63a5a80121590343578ce704901028322e827b254cc8e404558", + round: "1", + time_microseconds: "1708575651139233", + }, + }, ], - "timestamp":"1708575651139233", - "type":TransactionResponseType.BlockMetadata - } satisfies BlockMetadataTransactionResponse; - }); + previous_block_votes_bitvec: [0], + proposer: "0xfc1b1b4ed23ac63a5a80121590343578ce704901028322e827b254cc8e404558", + failed_proposer_indices: [], + timestamp: "1708575651139233", + type: TransactionResponseType.BlockMetadata, + } satisfies BlockMetadataTransactionResponse; + }); + + // Comment out this test until the API is fixed for single sender txns + // test("it tests a sample user_transaction JSON response satisfies UserTransactionResponse", async () => { + // const txn = { + // "version":"6224", + // "hash":"0xa17bffc240c11f8e9bc2ba8b4b1a45cae44846303c96bf62ca9fafa0fc2d07a8", + // "state_change_hash":"0x2d5c8a6f05e820e81b297b3cde83bf55f3e5ea86f6edc2dc11744e851beea5cb", + // "event_root_hash":"0x1b7628f4bbd261df56e25b44bdce7665193e5014c8221481f631927e1c7974ef", + // "state_checkpoint_hash":null, + // "gas_used":"994", + // "success":true, + // "vm_status":"Executed successfully", + // "accumulator_root_hash":"0x5575e1894bc25c3fbbfae26e31385ec3eb62e084592d1218c5dabddcb6f08348", + // "changes":[ + // { + // "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "state_key_hash":"0x2db694e0624e4431e199ecd0b2210d8d679eeec5d401d381e817b9ed5194d741", + // "data":{ + // "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", + // "data":{ + // "coin":{ + // "value":"99900590" + // }, + // "deposit_events":{ + // "counter":"1", + // "guid":{ + // "id":{ + // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "creation_num":"2" + // } + // } + // }, + // "frozen":false, + // "withdraw_events":{ + // "counter":"1", + // "guid":{ + // "id":{ + // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "creation_num":"3" + // } + // } + // } + // } + // }, + // "type":"write_resource" + // }, + // { + // "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "state_key_hash":"0x1df51b9e15903b1e27e35ca6dd58a3ae8e9dd2288228f431d2a72269fba638b6", + // "data":{ + // "type":"0x1::account::Account", + // "data":{ + // "authentication_key":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "coin_register_events":{ + // "counter":"1", + // "guid":{ + // "id":{ + // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "creation_num":"0" + // } + // } + // }, + // "guid_creation_num":"4", + // "key_rotation_events":{ + // "counter":"0", + // "guid":{ + // "id":{ + // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "creation_num":"1" + // } + // } + // }, + // "rotation_capability_offer":{ + // "for":{ + // "vec":[ + + // ] + // } + // }, + // "sequence_number":"1", + // "signer_capability_offer":{ + // "for":{ + // "vec":[ + + // ] + // } + // } + // } + // }, + // "type":"write_resource" + // }, + // { + // "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "state_key_hash":"0xf86d90bd7adfc6c2ee3d32c15ded3cc04281806e901a1de6691a5876e97e8a46", + // "data":{ + // "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", + // "data":{ + // "coin":{ + // "value":"10" + // }, + // "deposit_events":{ + // "counter":"1", + // "guid":{ + // "id":{ + // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "creation_num":"2" + // } + // } + // }, + // "frozen":false, + // "withdraw_events":{ + // "counter":"0", + // "guid":{ + // "id":{ + // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "creation_num":"3" + // } + // } + // } + // } + // }, + // "type":"write_resource" + // }, + // { + // "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "state_key_hash":"0xfa1bc52c80fd822e6a17cbea54d496f56d3e94f2c8ec55fafa8fef7f35379a3c", + // "data":{ + // "type":"0x1::account::Account", + // "data":{ + // "authentication_key":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "coin_register_events":{ + // "counter":"1", + // "guid":{ + // "id":{ + // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "creation_num":"0" + // } + // } + // }, + // "guid_creation_num":"4", + // "key_rotation_events":{ + // "counter":"0", + // "guid":{ + // "id":{ + // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "creation_num":"1" + // } + // } + // }, + // "rotation_capability_offer":{ + // "for":{ + // "vec":[ + + // ] + // } + // }, + // "sequence_number":"0", + // "signer_capability_offer":{ + // "for":{ + // "vec":[ + + // ] + // } + // } + // } + // }, + // "type":"write_resource" + // }, + // { + // "state_key_hash":"0x6e4b28d40f98a106a65163530924c0dcb40c1349d3aa915d108b4d6cfc1ddb19", + // "handle":"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca", + // "key":"0x0619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", + // "value":"0x4577893b000000000100000000000000", + // "data":{ + // "key":"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", + // "key_type":"address", + // "value":"18446744074708416325", + // "value_type":"u128" + // }, + // "type":"write_table_item" + // } + // ], + // "sender":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "sequence_number":"0", + // "max_gas_amount":"200000", + // "gas_unit_price":"100", + // "expiration_timestamp_secs":"1708582547", + // "payload":{ + // "function":"0x1::aptos_account::transfer", + // "type_arguments":[ -// Comment out this test until the API is fixed for single sender txns -// test("it tests a sample user_transaction JSON response satisfies UserTransactionResponse", async () => { -// const txn = { -// "version":"6224", -// "hash":"0xa17bffc240c11f8e9bc2ba8b4b1a45cae44846303c96bf62ca9fafa0fc2d07a8", -// "state_change_hash":"0x2d5c8a6f05e820e81b297b3cde83bf55f3e5ea86f6edc2dc11744e851beea5cb", -// "event_root_hash":"0x1b7628f4bbd261df56e25b44bdce7665193e5014c8221481f631927e1c7974ef", -// "state_checkpoint_hash":null, -// "gas_used":"994", -// "success":true, -// "vm_status":"Executed successfully", -// "accumulator_root_hash":"0x5575e1894bc25c3fbbfae26e31385ec3eb62e084592d1218c5dabddcb6f08348", -// "changes":[ -// { -// "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "state_key_hash":"0x2db694e0624e4431e199ecd0b2210d8d679eeec5d401d381e817b9ed5194d741", -// "data":{ -// "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", -// "data":{ -// "coin":{ -// "value":"99900590" -// }, -// "deposit_events":{ -// "counter":"1", -// "guid":{ -// "id":{ -// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "creation_num":"2" -// } -// } -// }, -// "frozen":false, -// "withdraw_events":{ -// "counter":"1", -// "guid":{ -// "id":{ -// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "creation_num":"3" -// } -// } -// } -// } -// }, -// "type":"write_resource" -// }, -// { -// "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "state_key_hash":"0x1df51b9e15903b1e27e35ca6dd58a3ae8e9dd2288228f431d2a72269fba638b6", -// "data":{ -// "type":"0x1::account::Account", -// "data":{ -// "authentication_key":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "coin_register_events":{ -// "counter":"1", -// "guid":{ -// "id":{ -// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "creation_num":"0" -// } -// } -// }, -// "guid_creation_num":"4", -// "key_rotation_events":{ -// "counter":"0", -// "guid":{ -// "id":{ -// "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "creation_num":"1" -// } -// } -// }, -// "rotation_capability_offer":{ -// "for":{ -// "vec":[ - -// ] -// } -// }, -// "sequence_number":"1", -// "signer_capability_offer":{ -// "for":{ -// "vec":[ - -// ] -// } -// } -// } -// }, -// "type":"write_resource" -// }, -// { -// "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "state_key_hash":"0xf86d90bd7adfc6c2ee3d32c15ded3cc04281806e901a1de6691a5876e97e8a46", -// "data":{ -// "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", -// "data":{ -// "coin":{ -// "value":"10" -// }, -// "deposit_events":{ -// "counter":"1", -// "guid":{ -// "id":{ -// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "creation_num":"2" -// } -// } -// }, -// "frozen":false, -// "withdraw_events":{ -// "counter":"0", -// "guid":{ -// "id":{ -// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "creation_num":"3" -// } -// } -// } -// } -// }, -// "type":"write_resource" -// }, -// { -// "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "state_key_hash":"0xfa1bc52c80fd822e6a17cbea54d496f56d3e94f2c8ec55fafa8fef7f35379a3c", -// "data":{ -// "type":"0x1::account::Account", -// "data":{ -// "authentication_key":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "coin_register_events":{ -// "counter":"1", -// "guid":{ -// "id":{ -// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "creation_num":"0" -// } -// } -// }, -// "guid_creation_num":"4", -// "key_rotation_events":{ -// "counter":"0", -// "guid":{ -// "id":{ -// "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "creation_num":"1" -// } -// } -// }, -// "rotation_capability_offer":{ -// "for":{ -// "vec":[ - -// ] -// } -// }, -// "sequence_number":"0", -// "signer_capability_offer":{ -// "for":{ -// "vec":[ - -// ] -// } -// } -// } -// }, -// "type":"write_resource" -// }, -// { -// "state_key_hash":"0x6e4b28d40f98a106a65163530924c0dcb40c1349d3aa915d108b4d6cfc1ddb19", -// "handle":"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca", -// "key":"0x0619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", -// "value":"0x4577893b000000000100000000000000", -// "data":{ -// "key":"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", -// "key_type":"address", -// "value":"18446744074708416325", -// "value_type":"u128" -// }, -// "type":"write_table_item" -// } -// ], -// "sender":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "sequence_number":"0", -// "max_gas_amount":"200000", -// "gas_unit_price":"100", -// "expiration_timestamp_secs":"1708582547", -// "payload":{ -// "function":"0x1::aptos_account::transfer", -// "type_arguments":[ - -// ], -// "arguments":[ -// "0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "10" -// ], -// "type":"entry_function_payload" -// }, -// "signature":{ -// "public_key":"0x08a3b19709c80092bb85140bf587b5e6e4676d65cb7bbbfec270641292eae92e", -// "signature":"0x6a8769016cb35c2de96ffc223f99bd827157f07a8cc794ed3eb662f119b767f467e0dbe54de3c1b6f9450d135ce2f339566da7eaf8d224a25d2b6fc6e5b9660d", -// "type":"ed25519_signature" -// }, -// "events":[ -// { -// "guid":{ -// "creation_number":"0", -// "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" -// }, -// "sequence_number":"0", -// "type":"0x1::account::CoinRegisterEvent", -// "data":{ -// "type_info":{ -// "account_address":"0x1", -// "module_name":"0x6170746f735f636f696e", -// "struct_name":"0x4170746f73436f696e" -// } -// } -// }, -// { -// "guid":{ -// "creation_number":"3", -// "account_address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71" -// }, -// "sequence_number":"0", -// "type":"0x1::coin::WithdrawEvent", -// "data":{ -// "amount":"10" -// } -// }, -// { -// "guid":{ -// "creation_number":"0", -// "account_address":"0x0" -// }, -// "sequence_number":"0", -// "type":"0x1::coin::Withdraw<0x1::aptos_coin::AptosCoin>", -// "data":{ -// "account":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", -// "amount":"10" -// } -// }, -// { -// "guid":{ -// "creation_number":"2", -// "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" -// }, -// "sequence_number":"0", -// "type":"0x1::coin::DepositEvent", -// "data":{ -// "amount":"10" -// } -// }, -// { -// "guid":{ -// "creation_number":"0", -// "account_address":"0x0" -// }, -// "sequence_number":"0", -// "type":"0x1::coin::Deposit<0x1::aptos_coin::AptosCoin>", -// "data":{ -// "account":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", -// "amount":"10" -// } -// }, -// { -// "guid":{ -// "creation_number":"0", -// "account_address":"0x0" -// }, -// "sequence_number":"0", -// "type":"0x1::transaction_fee::FeeStatement", -// "data":{ -// "execution_gas_units":"4", -// "io_gas_units":"2", -// "storage_fee_octas":"98800", -// "storage_fee_refund_octas":"0", -// "total_charge_gas_units":"994" -// } -// } -// ], -// "timestamp":"1708582527165294", -// "type":TransactionResponseType.User -// } satisfies UserTransactionResponse; -// }); -}); \ No newline at end of file + // ], + // "arguments":[ + // "0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "10" + // ], + // "type":"entry_function_payload" + // }, + // "signature":{ + // "public_key":"0x08a3b19709c80092bb85140bf587b5e6e4676d65cb7bbbfec270641292eae92e", + // "signature":"0x6a8769016cb35c2de96ffc223f99bd827157f07a8cc794ed3eb662f119b767f467e0dbe54de3c1b6f9450d135ce2f339566da7eaf8d224a25d2b6fc6e5b9660d", + // "type":"ed25519_signature" + // }, + // "events":[ + // { + // "guid":{ + // "creation_number":"0", + // "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" + // }, + // "sequence_number":"0", + // "type":"0x1::account::CoinRegisterEvent", + // "data":{ + // "type_info":{ + // "account_address":"0x1", + // "module_name":"0x6170746f735f636f696e", + // "struct_name":"0x4170746f73436f696e" + // } + // } + // }, + // { + // "guid":{ + // "creation_number":"3", + // "account_address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71" + // }, + // "sequence_number":"0", + // "type":"0x1::coin::WithdrawEvent", + // "data":{ + // "amount":"10" + // } + // }, + // { + // "guid":{ + // "creation_number":"0", + // "account_address":"0x0" + // }, + // "sequence_number":"0", + // "type":"0x1::coin::Withdraw<0x1::aptos_coin::AptosCoin>", + // "data":{ + // "account":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", + // "amount":"10" + // } + // }, + // { + // "guid":{ + // "creation_number":"2", + // "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" + // }, + // "sequence_number":"0", + // "type":"0x1::coin::DepositEvent", + // "data":{ + // "amount":"10" + // } + // }, + // { + // "guid":{ + // "creation_number":"0", + // "account_address":"0x0" + // }, + // "sequence_number":"0", + // "type":"0x1::coin::Deposit<0x1::aptos_coin::AptosCoin>", + // "data":{ + // "account":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", + // "amount":"10" + // } + // }, + // { + // "guid":{ + // "creation_number":"0", + // "account_address":"0x0" + // }, + // "sequence_number":"0", + // "type":"0x1::transaction_fee::FeeStatement", + // "data":{ + // "execution_gas_units":"4", + // "io_gas_units":"2", + // "storage_fee_octas":"98800", + // "storage_fee_refund_octas":"0", + // "total_charge_gas_units":"994" + // } + // } + // ], + // "timestamp":"1708582527165294", + // "type":TransactionResponseType.User + // } satisfies UserTransactionResponse; + // }); +}); From 276364bc4b4c54428e67e01cf5c331d5358f9c39 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 22 Feb 2024 15:11:43 -0800 Subject: [PATCH 4/6] fixes --- tests/e2e/api/transactionResponse.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/api/transactionResponse.test.ts b/tests/e2e/api/transactionResponse.test.ts index addb4da5f..343d89baf 100644 --- a/tests/e2e/api/transactionResponse.test.ts +++ b/tests/e2e/api/transactionResponse.test.ts @@ -1,7 +1,7 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable max-len */ // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable max-len */ import { ValidatorTransactionResponse, @@ -127,7 +127,7 @@ describe("transaction response types", () => { } satisfies ValidatorTransactionResponse; }); - test("it tests a sample block_metadata JSON response satisfies ValidatorTransactionResponse", async () => { + test("it tests a sample block_metadata JSON response satisfies BlockMetadataTransactionResponse", async () => { const txn = { version: "2", hash: "0x55ac208f0e48f428f210125fcb7c21507f2ea3077a6526824d10a2511a9da188", From 90df80f98a37fce9592ee91741c4628d5e839862 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 23 Feb 2024 16:06:18 -0500 Subject: [PATCH 5/6] fmt and delete commented out test --- tests/e2e/api/transactionResponse.test.ts | 291 +--------------------- 1 file changed, 1 insertion(+), 290 deletions(-) diff --git a/tests/e2e/api/transactionResponse.test.ts b/tests/e2e/api/transactionResponse.test.ts index 343d89baf..b5e6bebc3 100644 --- a/tests/e2e/api/transactionResponse.test.ts +++ b/tests/e2e/api/transactionResponse.test.ts @@ -3,11 +3,7 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable max-len */ -import { - ValidatorTransactionResponse, - TransactionResponseType, - BlockMetadataTransactionResponse, -} from "../../../src"; +import { ValidatorTransactionResponse, TransactionResponseType, BlockMetadataTransactionResponse } from "../../../src"; describe("transaction response types", () => { test("it tests a sample validator_transaction JSON response satisfies ValidatorTransactionResponse", async () => { @@ -242,289 +238,4 @@ describe("transaction response types", () => { type: TransactionResponseType.BlockMetadata, } satisfies BlockMetadataTransactionResponse; }); - - // Comment out this test until the API is fixed for single sender txns - // test("it tests a sample user_transaction JSON response satisfies UserTransactionResponse", async () => { - // const txn = { - // "version":"6224", - // "hash":"0xa17bffc240c11f8e9bc2ba8b4b1a45cae44846303c96bf62ca9fafa0fc2d07a8", - // "state_change_hash":"0x2d5c8a6f05e820e81b297b3cde83bf55f3e5ea86f6edc2dc11744e851beea5cb", - // "event_root_hash":"0x1b7628f4bbd261df56e25b44bdce7665193e5014c8221481f631927e1c7974ef", - // "state_checkpoint_hash":null, - // "gas_used":"994", - // "success":true, - // "vm_status":"Executed successfully", - // "accumulator_root_hash":"0x5575e1894bc25c3fbbfae26e31385ec3eb62e084592d1218c5dabddcb6f08348", - // "changes":[ - // { - // "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "state_key_hash":"0x2db694e0624e4431e199ecd0b2210d8d679eeec5d401d381e817b9ed5194d741", - // "data":{ - // "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", - // "data":{ - // "coin":{ - // "value":"99900590" - // }, - // "deposit_events":{ - // "counter":"1", - // "guid":{ - // "id":{ - // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "creation_num":"2" - // } - // } - // }, - // "frozen":false, - // "withdraw_events":{ - // "counter":"1", - // "guid":{ - // "id":{ - // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "creation_num":"3" - // } - // } - // } - // } - // }, - // "type":"write_resource" - // }, - // { - // "address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "state_key_hash":"0x1df51b9e15903b1e27e35ca6dd58a3ae8e9dd2288228f431d2a72269fba638b6", - // "data":{ - // "type":"0x1::account::Account", - // "data":{ - // "authentication_key":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "coin_register_events":{ - // "counter":"1", - // "guid":{ - // "id":{ - // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "creation_num":"0" - // } - // } - // }, - // "guid_creation_num":"4", - // "key_rotation_events":{ - // "counter":"0", - // "guid":{ - // "id":{ - // "addr":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "creation_num":"1" - // } - // } - // }, - // "rotation_capability_offer":{ - // "for":{ - // "vec":[ - - // ] - // } - // }, - // "sequence_number":"1", - // "signer_capability_offer":{ - // "for":{ - // "vec":[ - - // ] - // } - // } - // } - // }, - // "type":"write_resource" - // }, - // { - // "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "state_key_hash":"0xf86d90bd7adfc6c2ee3d32c15ded3cc04281806e901a1de6691a5876e97e8a46", - // "data":{ - // "type":"0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", - // "data":{ - // "coin":{ - // "value":"10" - // }, - // "deposit_events":{ - // "counter":"1", - // "guid":{ - // "id":{ - // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "creation_num":"2" - // } - // } - // }, - // "frozen":false, - // "withdraw_events":{ - // "counter":"0", - // "guid":{ - // "id":{ - // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "creation_num":"3" - // } - // } - // } - // } - // }, - // "type":"write_resource" - // }, - // { - // "address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "state_key_hash":"0xfa1bc52c80fd822e6a17cbea54d496f56d3e94f2c8ec55fafa8fef7f35379a3c", - // "data":{ - // "type":"0x1::account::Account", - // "data":{ - // "authentication_key":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "coin_register_events":{ - // "counter":"1", - // "guid":{ - // "id":{ - // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "creation_num":"0" - // } - // } - // }, - // "guid_creation_num":"4", - // "key_rotation_events":{ - // "counter":"0", - // "guid":{ - // "id":{ - // "addr":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "creation_num":"1" - // } - // } - // }, - // "rotation_capability_offer":{ - // "for":{ - // "vec":[ - - // ] - // } - // }, - // "sequence_number":"0", - // "signer_capability_offer":{ - // "for":{ - // "vec":[ - - // ] - // } - // } - // } - // }, - // "type":"write_resource" - // }, - // { - // "state_key_hash":"0x6e4b28d40f98a106a65163530924c0dcb40c1349d3aa915d108b4d6cfc1ddb19", - // "handle":"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca", - // "key":"0x0619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", - // "value":"0x4577893b000000000100000000000000", - // "data":{ - // "key":"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935", - // "key_type":"address", - // "value":"18446744074708416325", - // "value_type":"u128" - // }, - // "type":"write_table_item" - // } - // ], - // "sender":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "sequence_number":"0", - // "max_gas_amount":"200000", - // "gas_unit_price":"100", - // "expiration_timestamp_secs":"1708582547", - // "payload":{ - // "function":"0x1::aptos_account::transfer", - // "type_arguments":[ - - // ], - // "arguments":[ - // "0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "10" - // ], - // "type":"entry_function_payload" - // }, - // "signature":{ - // "public_key":"0x08a3b19709c80092bb85140bf587b5e6e4676d65cb7bbbfec270641292eae92e", - // "signature":"0x6a8769016cb35c2de96ffc223f99bd827157f07a8cc794ed3eb662f119b767f467e0dbe54de3c1b6f9450d135ce2f339566da7eaf8d224a25d2b6fc6e5b9660d", - // "type":"ed25519_signature" - // }, - // "events":[ - // { - // "guid":{ - // "creation_number":"0", - // "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" - // }, - // "sequence_number":"0", - // "type":"0x1::account::CoinRegisterEvent", - // "data":{ - // "type_info":{ - // "account_address":"0x1", - // "module_name":"0x6170746f735f636f696e", - // "struct_name":"0x4170746f73436f696e" - // } - // } - // }, - // { - // "guid":{ - // "creation_number":"3", - // "account_address":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71" - // }, - // "sequence_number":"0", - // "type":"0x1::coin::WithdrawEvent", - // "data":{ - // "amount":"10" - // } - // }, - // { - // "guid":{ - // "creation_number":"0", - // "account_address":"0x0" - // }, - // "sequence_number":"0", - // "type":"0x1::coin::Withdraw<0x1::aptos_coin::AptosCoin>", - // "data":{ - // "account":"0x1b391b4238cc3abd3f057c1f3c7c825c63dcea21ef83d02c1f48e7449f3ebe71", - // "amount":"10" - // } - // }, - // { - // "guid":{ - // "creation_number":"2", - // "account_address":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3" - // }, - // "sequence_number":"0", - // "type":"0x1::coin::DepositEvent", - // "data":{ - // "amount":"10" - // } - // }, - // { - // "guid":{ - // "creation_number":"0", - // "account_address":"0x0" - // }, - // "sequence_number":"0", - // "type":"0x1::coin::Deposit<0x1::aptos_coin::AptosCoin>", - // "data":{ - // "account":"0xc8571778a962dc3bbc27d80a2d19304b214b82c032a7be2e4db82aee15264ce3", - // "amount":"10" - // } - // }, - // { - // "guid":{ - // "creation_number":"0", - // "account_address":"0x0" - // }, - // "sequence_number":"0", - // "type":"0x1::transaction_fee::FeeStatement", - // "data":{ - // "execution_gas_units":"4", - // "io_gas_units":"2", - // "storage_fee_octas":"98800", - // "storage_fee_refund_octas":"0", - // "total_charge_gas_units":"994" - // } - // } - // ], - // "timestamp":"1708582527165294", - // "type":TransactionResponseType.User - // } satisfies UserTransactionResponse; - // }); }); From 524cb50f3a60e36bdd34376efa68a896a13d2e93 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 23 Feb 2024 16:08:07 -0500 Subject: [PATCH 6/6] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf1dc8d91..fa99ef1e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T # Unreleased - Add `decimals` field to token data queries +- Add support for `validator_transaction` type introduced in 1.10. # 1.7.0 (2024-02-13)