Skip to content

Commit

Permalink
feat: 1450 debug module refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
lucanicoladebiasi committed Nov 7, 2024
1 parent 62cf7e1 commit f62ac97
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
34 changes: 20 additions & 14 deletions docs/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ const thorClient = ThorClient.at(TESTNET_URL);
// 2 - Retrieve the storage range.
const result = await thorClient.debug.retrieveStorageRange({
target: {
blockID:
'0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f',
blockId: BlockId.of(
'0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f'
),
transaction: 0,
clauseIndex: 0
},
options: {
address: '0x0000000000000000000000000000456E65726779',
keyStart:
'0x0000000000000000000000000000000000000000000000000000000000000000',
address: Address.of('0x0000000000000000000000000000456E65726779'),
keyStart: BlockId.of(
'0x0000000000000000000000000000000000000000000000000000000000000000'
),
maxResult: 10
}
});
Expand Down Expand Up @@ -111,12 +113,14 @@ const thorClient = ThorClient.at(TESTNET_URL);
// 2 - Trace the contract call.
const result = await thorClient.debug.traceContractCall(
{
contractInput: {
to: '0x0000000000000000000000000000456E65726779',
data: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000',
value: '0x0'
target: {
to: Address.of('0x0000000000000000000000000000456E65726779'),
data: HexUInt.of(
'0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000'
),
value: VET.of(0)
},
transactionOptions: {
options: {
caller: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF',
gasPayer: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF',
expiration: 18,
Expand Down Expand Up @@ -170,10 +174,12 @@ const thorClient = ThorClient.at(TESTNET_URL);
const result = await thorClient.debug.traceTransactionClause(
{
target: {
blockID:
'0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f',
transaction:
'0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f',
blockId: BlockId.of(
'0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f'
),
transaction: BlockId.of(
'0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f'
),
clauseIndex: 0
},
config: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ const debugTraceCall = async (
gasPrice: transactionOptions.gasPrice
},
target: {
to: Address.of(transactionOptions.to),
to:
typeof transactionOptions.to === 'string'
? Address.of(transactionOptions.to)
: transactionOptions.to,
data:
typeof transactionOptions.data === 'string'
? HexUInt.of(transactionOptions.data)
Expand Down
2 changes: 1 addition & 1 deletion packages/network/tests/provider/formatter/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ const transactionFixtures = [
dependsOn: null,
size: 709,
meta: {
blockId:
blockID:
'0x010b7b5f0192003f70bf2a6a502221e075cb32d676e3443614d21003cc2ee440',
blockNumber: 17529695,
blockTimestamp: 1705328340
Expand Down

0 comments on commit f62ac97

Please # to comment.