From 7b29bb48cfa80c07875f202eab7ef57981603fd5 Mon Sep 17 00:00:00 2001 From: Artur Sapek Date: Wed, 3 Jan 2024 17:18:33 -0500 Subject: [PATCH] Revert "remove unnecessary type casts" This reverts commit 5c33ccfc2b4e14602ba27b0f76a2b1e616d4e72d. --- connect/src/protocols/cctpTransfer.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/connect/src/protocols/cctpTransfer.ts b/connect/src/protocols/cctpTransfer.ts index d5c89c812..b2a0c1c18 100644 --- a/connect/src/protocols/cctpTransfer.ts +++ b/connect/src/protocols/cctpTransfer.ts @@ -31,6 +31,10 @@ import { signSendWait } from "../common"; import { DEFAULT_TASK_TIMEOUT } from "../config"; import { Wormhole } from "../wormhole"; import { + AttestedTransferReceipt, + CompletedTransferReceipt, + SourceInitiatedTransferReceipt, + SourceFinalizedTransferReceipt, TransferQuote, TransferReceipt, TransferState, @@ -38,7 +42,6 @@ import { isSourceInitiated, isSourceFinalized, isAttested, - AttestedTransferReceipt, } from "../wormholeTransfer"; type CircleTransferProtocol = "CircleBridge" | "AutomaticCircleBridge"; @@ -490,7 +493,9 @@ export class CircleTransfer const originTxs = xfer.txids.filter((txid) => txid.chain === xfer.transfer.from.chain); if (originTxs.length > 0) { - receipt = { ...receipt, state: TransferState.SourceInitiated, originTxs }; + receipt = { ...receipt, state: TransferState.SourceInitiated, originTxs } as Partial< + SourceInitiatedTransferReceipt + >; } const att = xfer.attestations.filter((a) => @@ -516,7 +521,7 @@ export class CircleTransfer ...receipt, state: TransferState.DestinationInitiated, destinationTxs, - }; + } as CompletedTransferReceipt; } return receipt as TransferReceipt; @@ -552,7 +557,7 @@ export class CircleTransfer ...receipt, attestation: { id: xfermsg }, state: TransferState.SourceFinalized, - }; + } as SourceFinalizedTransferReceipt; yield receipt; } @@ -574,7 +579,7 @@ export class CircleTransfer ...receipt, attestation: { id: receipt.attestation.id, attestation: vaa }, state: TransferState.Attested, - }; + } as AttestedTransferReceipt; yield receipt; } } @@ -597,7 +602,7 @@ export class CircleTransfer ...receipt, destinationTxs: [{ chain: toChain(chainId) as DC, txid: txHash }], state: TransferState.DestinationFinalized, - }; + } as CompletedTransferReceipt; yield receipt; } @@ -612,7 +617,7 @@ export class CircleTransfer )) ? TransferState.DestinationFinalized : TransferState.Attested, - }; + } as AttestedTransferReceipt; yield receipt; } }