Skip to content

Commit

Permalink
chore: update mempool rejection reasons (#1615)
Browse files Browse the repository at this point in the history
Signed-off-by: bestmike007 <[email protected]>
  • Loading branch information
bestmike007 authored Jan 3, 2024
1 parent d0a1a32 commit bc1e27d
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
66 changes: 66 additions & 0 deletions packages/transactions/src/builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,49 @@ export type ServerFailureNoSuchChainTipRejection = {
txid: string;
};

export type TooMuchChainingRejection = {
error: string;
reason: TxRejectedReason.TooMuchChaining;
reason_data: {
actual: number;
expected: number;
is_origin: boolean;
message: string;
principal: string;
};
txid: string;
};

export type ConflictingNonceInMempoolRejection = {
error: string;
reason: TxRejectedReason.ConflictingNonceInMempool;
reason_data?: undefined;
txid: string;
};

export type BadTransactionVersionRejection = {
error: string;
reason: TxRejectedReason.BadTransactionVersion;
reason_data?: undefined;
txid: string;
};

export type TransferRecipientCannotEqualSenderRejection = {
error: string;
reason: TxRejectedReason.TransferRecipientCannotEqualSender;
reason_data: {
recipient: string;
};
txid: string;
};

export type TransferAmountMustBePositiveRejection = {
error: string;
reason: TxRejectedReason.TransferAmountMustBePositive;
reason_data?: undefined;
txid: string;
};

export type ServerFailureDatabaseRejection = {
error: string;
reason: TxRejectedReason.ServerFailureDatabase;
Expand All @@ -375,6 +418,22 @@ export type ServerFailureDatabaseRejection = {
txid: string;
};

export type EstimatorErrorRejection = {
error: string;
reason: TxRejectedReason.EstimatorError;
reason_data: {
message: string;
};
txid: string;
};

export type TemporarilyBlacklistedRejection = {
error: string;
reason: TxRejectedReason.TemporarilyBlacklisted;
reason_data?: undefined;
txid: string;
};

export type ServerFailureOtherRejection = {
error: string;
reason: TxRejectedReason.ServerFailureOther;
Expand Down Expand Up @@ -408,7 +467,14 @@ export type TxBroadcastResultRejected =
| BadAddressVersionByteRejection
| NoCoinbaseViaMempoolRejection
| ServerFailureNoSuchChainTipRejection
| TooMuchChainingRejection
| ConflictingNonceInMempoolRejection
| BadTransactionVersionRejection
| TransferRecipientCannotEqualSenderRejection
| TransferAmountMustBePositiveRejection
| ServerFailureDatabaseRejection
| EstimatorErrorRejection
| TemporarilyBlacklistedRejection
| ServerFailureOtherRejection;

export type TxBroadcastResult = TxBroadcastResultOk | TxBroadcastResultRejected;
Expand Down
7 changes: 7 additions & 0 deletions packages/transactions/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ export enum TxRejectedReason {
BadAddressVersionByte = 'BadAddressVersionByte',
NoCoinbaseViaMempool = 'NoCoinbaseViaMempool',
ServerFailureNoSuchChainTip = 'ServerFailureNoSuchChainTip',
TooMuchChaining = 'TooMuchChaining',
ConflictingNonceInMempool = 'ConflictingNonceInMempool',
BadTransactionVersion = 'BadTransactionVersion',
TransferRecipientCannotEqualSender = 'TransferRecipientCannotEqualSender',
TransferAmountMustBePositive = 'TransferAmountMustBePositive',
ServerFailureDatabase = 'ServerFailureDatabase',
EstimatorError = 'EstimatorError',
TemporarilyBlacklisted = 'TemporarilyBlacklisted',
ServerFailureOther = 'ServerFailureOther',
}

1 comment on commit bc1e27d

@vercel
Copy link

@vercel vercel bot commented on bc1e27d Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.