From 5b264ab395c86a76ba2c284c6b953e770a3586c0 Mon Sep 17 00:00:00 2001 From: Artur Sapek Date: Thu, 8 Aug 2024 11:32:06 -0700 Subject: [PATCH] new TransferState that represents a refunded transfer --- connect/src/types.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/connect/src/types.ts b/connect/src/types.ts index a555bc830..f2cf45266 100644 --- a/connect/src/types.ts +++ b/connect/src/types.ts @@ -16,6 +16,7 @@ export enum TransferState { SourceFinalized, // Source chain transactions are finalized or whenever we have a message id InReview, // Transfer is in review (e.g. held by governor) Attested, // VAA or Circle Attestation is available + Refunded, // Transfer failed and was refunded on the source chain DestinationInitiated, // Attestation is submitted to destination chain DestinationQueued, // Transfer is queued on destination chain DestinationFinalized, // Destination transaction is finalized @@ -70,6 +71,14 @@ export interface AttestedTransferReceipt; } +export interface RefundedTransferReceipt + extends BaseTransferReceipt { + state: TransferState.Refunded; + originTxs: TransactionId[]; + refundTxs: TransactionId[]; + attestation: AT; +} + export interface RedeemedTransferReceipt extends BaseTransferReceipt { state: TransferState.DestinationInitiated; @@ -131,6 +140,12 @@ export function isAttested( return receipt.state === TransferState.Attested; } +export function isRefunded( + receipt: TransferReceipt, +): receipt is RefundedTransferReceipt { + return receipt.state === TransferState.Refunded; +} + export function isRedeemed( receipt: TransferReceipt, ): receipt is RedeemedTransferReceipt { @@ -160,6 +175,7 @@ export type TransferReceipt | InReviewTransferReceipt | AttestedTransferReceipt + | RefundedTransferReceipt | RedeemedTransferReceipt | DestinationQueuedTransferReceipt | CompletedTransferReceipt;