Skip to content

Commit

Permalink
Merge pull request #681 from 0xs34n/fix/transaction-response-type
Browse files Browse the repository at this point in the history
Fix FailedTransactionResponse
  • Loading branch information
tabaktoni authored Jul 12, 2023
2 parents 866972a + 65b1ef4 commit 9b67e23
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/types/provider/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ export interface GetCodeResponse {
// abi: string; // is not consistent between rpc and sequencer (is it?), therefore not included in the provider interface
}

export type GetTransactionResponse = InvokeTransactionResponse & DeclareTransactionResponse;
export type RejectedTransactionResponse = {
status: `${TransactionStatus.REJECTED}`;
transaction_failure_reason: {
code: string;
error_message: string;
};
};

export type GetTransactionResponse =
| InvokeTransactionResponse
| DeclareTransactionResponse
| RejectedTransactionResponse;

export interface CommonTransactionResponse {
transaction_hash?: string;
Expand All @@ -67,9 +78,13 @@ export interface DeclareTransactionResponse extends CommonTransactionResponse {
sender_address?: string;
}

export type RejectedTransactionReceiptResponse = RejectedTransactionResponse &
(InvokeTransactionReceiptResponse | DeclareTransactionReceiptResponse);

export type GetTransactionReceiptResponse =
| InvokeTransactionReceiptResponse
| DeclareTransactionReceiptResponse;
| DeclareTransactionReceiptResponse
| RejectedTransactionReceiptResponse;

export interface CommonTransactionReceiptResponse {
transaction_hash: string;
Expand Down

0 comments on commit 9b67e23

Please sign in to comment.