11import {
2- Chain ,
32 Network ,
43 TransferState ,
54 isFailed ,
65 routes ,
76 isAttested ,
87} from "@wormhole-foundation/sdk-connect" ;
9- import { MultiTokenNtt , Ntt } from "@wormhole-foundation/sdk-definitions-ntt" ;
108import { MultiTokenNttRoute } from "./types.js" ;
119import {
1210 getAxelarTransactionStatus ,
@@ -16,55 +14,25 @@ import { fetchStatus, isRelayStatusFailed } from "./executor/utils.js";
1614
1715export async function trackExecutor <
1816 R extends MultiTokenNttRoute . ManualTransferReceipt
19- > (
20- network : Network ,
21- receipt : R ,
22- destinationNtt : MultiTokenNtt < Network , Chain > ,
23- wormholeTransceiver : Ntt . TransceiverMeta
24- ) : Promise < R > {
17+ > ( network : Network , receipt : R ) : Promise < R > {
2518 if ( ! isAttested ( receipt ) && ! isFailed ( receipt ) ) {
2619 return receipt ;
2720 }
2821
29- if ( ! receipt . attestation ) {
30- throw new Error ( "No attestation found on the transfer receipt" ) ;
31- }
32-
33- const wormholeAttested = await destinationNtt . transceiverAttestedToMessage (
34- receipt . from ,
35- receipt . attestation . attestation . payload . nttManagerPayload ,
36- wormholeTransceiver . index
37- ) ;
38-
39- if ( wormholeAttested ) {
40- // Clear error state if relay status is not an error
41- if ( isFailed ( receipt ) ) {
42- return {
43- ...receipt ,
44- state : TransferState . Attested ,
45- // @ts -ignore
46- error : undefined ,
47- } ;
48- }
49-
50- return receipt ;
51- }
52-
5322 // Check if the relay was successful or failed
5423 const txid = receipt . originTxs . at ( - 1 ) ! . txid ;
5524 const [ txStatus ] = await fetchStatus ( network , txid , receipt . from ) ;
5625 if ( ! txStatus ) throw new Error ( "No transaction status found" ) ;
5726
5827 const relayStatus = txStatus . status ;
5928 if ( isRelayStatusFailed ( relayStatus ) ) {
60- receipt = {
29+ return {
6130 ...receipt ,
6231 state : TransferState . Failed ,
6332 error : new routes . RelayFailedError (
6433 `Relay failed with status: ${ relayStatus } `
6534 ) ,
6635 } ;
67- return receipt ;
6836 }
6937
7038 // Clear error state if relay status is not an error
@@ -82,40 +50,11 @@ export async function trackExecutor<
8250
8351export async function trackAxelar <
8452 R extends MultiTokenNttRoute . ManualTransferReceipt
85- > (
86- network : Network ,
87- receipt : R ,
88- destinationNtt : MultiTokenNtt < Network , Chain > ,
89- axelarTransceiver : Ntt . TransceiverMeta
90- ) : Promise < R > {
53+ > ( network : Network , receipt : R ) : Promise < R > {
9154 if ( ! isAttested ( receipt ) && ! isFailed ( receipt ) ) {
9255 return receipt ;
9356 }
9457
95- if ( ! receipt . attestation ) {
96- throw new Error ( "No attestation found on the transfer receipt" ) ;
97- }
98-
99- const axelarAttested = await destinationNtt . transceiverAttestedToMessage (
100- receipt . from ,
101- receipt . attestation . attestation . payload . nttManagerPayload ,
102- axelarTransceiver . index
103- ) ;
104-
105- if ( axelarAttested ) {
106- // Clear error state if relay status is not an error
107- if ( isFailed ( receipt ) ) {
108- return {
109- ...receipt ,
110- state : TransferState . Attested ,
111- // @ts -ignore
112- error : undefined ,
113- } ;
114- }
115-
116- return receipt ;
117- }
118-
11958 // Check relayer status
12059 const txid = receipt . originTxs . at ( - 1 ) ! . txid ;
12160 const axelarStatus = await getAxelarTransactionStatus (
@@ -130,7 +69,6 @@ export async function trackAxelar<
13069 state : TransferState . Failed ,
13170 error : new routes . RelayFailedError (
13271 `Axelar error: ${ axelarStatus . error . message } ` ,
133- // @ts -ignore
13472 {
13573 url : getAxelarExplorerUrl ( network , txid ) ,
13674 name : "Axelarscan" ,
0 commit comments