Skip to content

Commit 6d38f78

Browse files
committed
sdk: pr review cleanup
1 parent 6e5dcfb commit 6d38f78

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

evm/ts/src/axelar.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,20 @@ export async function getAxelarTransactionStatus(
153153
export function parseGMPStatus(response: any): GMPStatus | string {
154154
const { error, status } = response;
155155

156-
if (status === "error" && error) return GMPStatus.DEST_EXECUTE_ERROR;
157-
else if (status === "executed") return GMPStatus.DEST_EXECUTED;
158-
else if (status === "approved") return GMPStatus.DEST_GATEWAY_APPROVED;
159-
else if (status === "called") return GMPStatus.SRC_GATEWAY_CALLED;
160-
else if (status === "executing") return GMPStatus.DEST_EXECUTING;
161-
else {
162-
return status;
156+
switch (status) {
157+
case "error":
158+
if (error) return GMPStatus.DEST_EXECUTE_ERROR;
159+
return status;
160+
case "executed":
161+
return GMPStatus.DEST_EXECUTED;
162+
case "approved":
163+
return GMPStatus.DEST_GATEWAY_APPROVED;
164+
case "called":
165+
return GMPStatus.SRC_GATEWAY_CALLED;
166+
case "executing":
167+
return GMPStatus.DEST_EXECUTING;
168+
default:
169+
return status;
163170
}
164171
}
165172

evm/ts/src/multiTokenNtt.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,8 @@ export class EvmMultiTokenNtt<N extends Network, C extends EvmChains>
9898
attestation.payload.nttManagerPayload
9999
)
100100
);
101-
if (!isExecuted) return false;
102101

103-
// Also check that the transfer is not queued for it to be considered complete
104-
const isInboundQueued = await this.getIsTransferInboundQueued(attestation);
105-
return !isInboundQueued;
102+
return isExecuted && !(await this.getIsTransferInboundQueued(attestation));
106103
}
107104

108105
async getIsTransferInboundQueued(
@@ -681,6 +678,9 @@ export class EvmMultiTokenNtt<N extends Network, C extends EvmChains>
681678
return 1_000_000n;
682679
}
683680

681+
// Upper estimate for redeeming an existing token. Based on observed gas usage
682+
// (~178k gas: https://sepolia.etherscan.io/tx/0xd008af053861cdfea0b6c1f4d973ee59f0c4fcc2e2de57b9945a193cb185bb29)
683+
// but padded to be well above the limit.
684684
return 300_000n;
685685
}
686686
}

sdk/route/src/tracking.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export async function trackExecutor<
2020
}
2121

2222
// Check if the relay was successful or failed
23+
if (receipt.originTxs.length === 0) {
24+
throw new Error("No origin transactions found in receipt");
25+
}
2326
const txid = receipt.originTxs.at(-1)!.txid;
2427
const [txStatus] = await fetchStatus(network, txid, receipt.from);
2528
if (!txStatus) throw new Error("No transaction status found");
@@ -57,6 +60,9 @@ export async function trackAxelar<R extends MultiTokenNttRoute.TransferReceipt>(
5760
}
5861

5962
// Check relayer status
63+
if (receipt.originTxs.length === 0) {
64+
throw new Error("No origin transactions found in receipt");
65+
}
6066
const txid = receipt.originTxs.at(-1)!.txid;
6167
const axelarStatus = await getAxelarTransactionStatus(
6268
network,

0 commit comments

Comments
 (0)