Skip to content

Commit

Permalink
fix: adapted transactionTrace response
Browse files Browse the repository at this point in the history
  • Loading branch information
ivpavici committed Sep 23, 2022
1 parent 48ff4eb commit 58c21c0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion __tests__/sequencerProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describeIfSequencer('SequencerProvider', () => {

test('transaction trace', async () => {
const transactionTrace = await sequencerProvider.getTransactionTrace(exampleTransactionHash);
expect(transactionTrace).toHaveProperty('function_invocation');
// TODO test optional properties
expect(transactionTrace).toHaveProperty('signature');
});

Expand Down
25 changes: 9 additions & 16 deletions src/types/api/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ export type GetContractAddressesResponse = {
GpsStatementVerifier: string;
};

export type InvokeFunctionTrace = {
export type FunctionInvocation = {
caller_address: string;
contract_address: string;
code_address: string;
selector: string;
calldata: RawCalldata;
call_type?: string;
class_hash?: string;
selector?: string;
entry_point_type?: EntryPointType;
result: Array<any>;
execution_resources: ExecutionResources;
internal_call: Array<InvokeFunctionTrace>;
internal_calls: Array<FunctionInvocation>;
events: Array<any>;
messages: Array<any>;
};
Expand All @@ -54,18 +56,9 @@ export type ExecutionResources = {
};

export type GetTransactionTraceResponse = {
function_invocation: {
caller_address: string;
contract_address: string;
code_address: string;
selector: string;
calldata: RawArgs;
result: Array<any>;
execution_resources: ExecutionResources;
internal_call: Array<any>;
events: Array<any>;
messages: Array<any>;
};
validate_invocation?: FunctionInvocation;
function_invocation?: FunctionInvocation;
fee_transfer_invocation?: FunctionInvocation;
signature: Signature;
};

Expand Down
20 changes: 14 additions & 6 deletions www/docs/API/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,21 +271,29 @@ Gets the transaction trace from a tx hash.

```typescript
{
function_invocation: {
validate_invocation?: FunctionInvocation;
function_invocation?: FunctionInvocation;
fee_transfer_invocation?: FunctionInvocation;
signature: Signature;
}

{
FunctionInvocation: {
caller_address: string;
contract_address: string;
code_address: string;
selector: string;
calldata: {
[inputName: string]: string | string[] | { type: 'struct'; [k: string]: BigNumberish };
};
call_type?: string;
class_hash?: string;
selector?: string;
entry_point_type?: EntryPointType;
result: Array<any>;
execution_resources: any;
internal_call: Array<any>;
execution_resources: ExecutionResources;
internal_calls: Array<FunctionInvocation>;
events: Array<any>;
messages: Array<any>;
};
signature: Signature;
}
```

Expand Down

0 comments on commit 58c21c0

Please sign in to comment.