Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly reference ABCIErrorKey #84

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/provider/jsonrpc/jsonrpc.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ABCIAccount,
ABCIErrorKey,
ABCIResponse,
BlockInfo,
BlockResult,
Expand Down Expand Up @@ -83,7 +84,7 @@ describe('JSON-RPC Provider', () => {
const mockLog = 'random error message';
const invalidResult: BroadcastTxSyncResult = {
error: {
ABCIErrorKey: mockError,
[ABCIErrorKey]: mockError,
},
data: null,
Log: mockLog,
Expand Down
7 changes: 4 additions & 3 deletions src/provider/jsonrpc/jsonrpc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Provider } from '../provider';
import {
ABCIErrorKey,
ABCIResponse,
BlockInfo,
BlockResult,
Expand Down Expand Up @@ -175,7 +176,7 @@ export class JSONRPCProvider implements Provider {
// Check if there is an immediate tx-broadcast error
// (originating from basic transaction checks like CheckTx)
if (response.error) {
const errType: string = response.error.ABCIErrorKey;
const errType: string = response.error[ABCIErrorKey];
const log: string = response.Log;

throw constructRequestError(errType, log);
Expand All @@ -196,15 +197,15 @@ export class JSONRPCProvider implements Provider {

// Check if there is an immediate tx-broadcast error (in CheckTx)
if (check_tx.ResponseBase.Error) {
const errType: string = check_tx.ResponseBase.Error.ABCIErrorKey;
const errType: string = check_tx.ResponseBase.Error[ABCIErrorKey];
const log: string = check_tx.ResponseBase.Log;

throw constructRequestError(errType, log);
}

// Check if there is a parsing error with the transaction (in DeliverTx)
if (deliver_tx.ResponseBase.Error) {
const errType: string = deliver_tx.ResponseBase.Error.ABCIErrorKey;
const errType: string = deliver_tx.ResponseBase.Error[ABCIErrorKey];
const log: string = deliver_tx.ResponseBase.Log;

throw constructRequestError(errType, log);
Expand Down
3 changes: 2 additions & 1 deletion src/provider/websocket/ws.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ABCIAccount,
ABCIErrorKey,
ABCIResponse,
ABCIResponseBase,
BeginBlock,
Expand Down Expand Up @@ -264,7 +265,7 @@ describe('WS Provider', () => {
const mockLog = 'random error message';
const invalidResult: BroadcastTxSyncResult = {
error: {
ABCIErrorKey: mockError,
[ABCIErrorKey]: mockError,
},
data: null,
Log: mockLog,
Expand Down
7 changes: 4 additions & 3 deletions src/provider/websocket/ws.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Provider } from '../provider';
import {
ABCIErrorKey,
ABCIResponse,
BlockInfo,
BlockResult,
Expand Down Expand Up @@ -287,7 +288,7 @@ export class WSProvider implements Provider {
// Check if there is an immediate tx-broadcast error
// (originating from basic transaction checks like CheckTx)
if (broadcastResponse.error) {
const errType: string = broadcastResponse.error.ABCIErrorKey;
const errType: string = broadcastResponse.error[ABCIErrorKey];
const log: string = broadcastResponse.Log;

throw constructRequestError(errType, log);
Expand All @@ -309,15 +310,15 @@ export class WSProvider implements Provider {

// Check if there is an immediate tx-broadcast error (in CheckTx)
if (check_tx.ResponseBase.Error) {
const errType: string = check_tx.ResponseBase.Error.ABCIErrorKey;
const errType: string = check_tx.ResponseBase.Error[ABCIErrorKey];
const log: string = check_tx.ResponseBase.Log;

throw constructRequestError(errType, log);
}

// Check if there is a parsing error with the transaction (in DeliverTx)
if (deliver_tx.ResponseBase.Error) {
const errType: string = deliver_tx.ResponseBase.Error.ABCIErrorKey;
const errType: string = deliver_tx.ResponseBase.Error[ABCIErrorKey];
const log: string = deliver_tx.ResponseBase.Log;

throw constructRequestError(errType, log);
Expand Down