Skip to content

Commit

Permalink
fix: response type for get-transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
janek26 committed Jun 16, 2022
1 parent 9c77760 commit a232725
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export type InvokeFunctionTransaction = {
version?: BigNumberish;
};

export interface InvokeFunctionTransactionResponse extends InvokeFunctionTransaction {
transaction_hash: string;
}

export type InvokeFunctionTrace = {
caller_address: string;
contract_address: string;
Expand Down Expand Up @@ -157,6 +161,10 @@ export type CallContractTransaction = Omit<
>;

export type Transaction = DeclareTransaction | DeployTransaction | InvokeFunctionTransaction;
export type TransactionResponse =
| DeclareTransaction
| DeployTransaction
| InvokeFunctionTransactionResponse;

export type CallContractResponse = {
result: string[];
Expand All @@ -167,7 +175,7 @@ export type GetBlockResponse = {
state_root: string;
block_hash: string;
transactions: {
[txHash: string]: Transaction;
[txHash: string]: TransactionResponse;
};
timestamp: number;
transaction_receipts: {
Expand Down Expand Up @@ -221,7 +229,7 @@ export type GetTransactionTraceResponse = {

export type SuccessfulTransactionResponse = {
status: Status;
transaction: Transaction;
transaction: TransactionResponse;
block_hash: string;
block_number: BlockNumber;
transaction_index: number;
Expand All @@ -233,7 +241,7 @@ export type FailedTransactionResponse = {
code: string;
error_message: string;
};
transaction: Transaction;
transaction: TransactionResponse;
};

export type GetTransactionResponse = SuccessfulTransactionResponse | FailedTransactionResponse;
Expand Down

0 comments on commit a232725

Please sign in to comment.