Skip to content

Commit

Permalink
Revert "remove unnecessary type casts"
Browse files Browse the repository at this point in the history
This reverts commit 5c33ccf.
  • Loading branch information
artursapek committed Jan 3, 2024
1 parent 5c33ccf commit 7b29bb4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions connect/src/protocols/cctpTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ import { signSendWait } from "../common";
import { DEFAULT_TASK_TIMEOUT } from "../config";
import { Wormhole } from "../wormhole";
import {
AttestedTransferReceipt,
CompletedTransferReceipt,
SourceInitiatedTransferReceipt,
SourceFinalizedTransferReceipt,
TransferQuote,
TransferReceipt,
TransferState,
WormholeTransfer,
isSourceInitiated,
isSourceFinalized,
isAttested,
AttestedTransferReceipt,
} from "../wormholeTransfer";

type CircleTransferProtocol = "CircleBridge" | "AutomaticCircleBridge";
Expand Down Expand Up @@ -490,7 +493,9 @@ export class CircleTransfer<N extends Network = Network>

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<CircleTransferProtocol, Chain, Chain>
>;
}

const att = xfer.attestations.filter((a) =>
Expand All @@ -516,7 +521,7 @@ export class CircleTransfer<N extends Network = Network>
...receipt,
state: TransferState.DestinationInitiated,
destinationTxs,
};
} as CompletedTransferReceipt<CircleTransferProtocol, Chain, Chain>;
}

return receipt as TransferReceipt<CircleTransferProtocol>;
Expand Down Expand Up @@ -552,7 +557,7 @@ export class CircleTransfer<N extends Network = Network>
...receipt,
attestation: { id: xfermsg },
state: TransferState.SourceFinalized,
};
} as SourceFinalizedTransferReceipt<CircleTransferProtocol, SC, DC>;
yield receipt;
}

Expand All @@ -574,7 +579,7 @@ export class CircleTransfer<N extends Network = Network>
...receipt,
attestation: { id: receipt.attestation.id, attestation: vaa },
state: TransferState.Attested,
};
} as AttestedTransferReceipt<CircleTransferProtocol, SC, DC>;
yield receipt;
}
}
Expand All @@ -597,7 +602,7 @@ export class CircleTransfer<N extends Network = Network>
...receipt,
destinationTxs: [{ chain: toChain(chainId) as DC, txid: txHash }],
state: TransferState.DestinationFinalized,
};
} as CompletedTransferReceipt<CircleTransferProtocol, SC, DC>;
yield receipt;
}

Expand All @@ -612,7 +617,7 @@ export class CircleTransfer<N extends Network = Network>
))
? TransferState.DestinationFinalized
: TransferState.Attested,
};
} as AttestedTransferReceipt<CircleTransferProtocol, SC, DC>;
yield receipt;
}
}
Expand Down

0 comments on commit 7b29bb4

Please sign in to comment.