Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-deposit-id-zero.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@across-protocol/app-sdk": patch
---

Fix depositId 0 being treated as absent in getDeposit, waitForDepositTx, waitForAtomicTx and parseFillLogs
4 changes: 2 additions & 2 deletions packages/sdk/src/actions/getDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function getDeposit(
if (
!(
findBy.depositTxHash ||
(findBy.depositId && findBy.originSpokePoolAddress)
(findBy.depositId !== undefined && findBy.originSpokePoolAddress)
)
) {
throw new Error(
Expand Down Expand Up @@ -75,7 +75,7 @@ export async function getDeposit(
}

// Try to get deposit from logs by deposit id and spoke pool address on origin chain
else if (findBy.depositId && findBy.originSpokePoolAddress) {
else if (findBy.depositId !== undefined && findBy.originSpokePoolAddress) {
const { depositId, originSpokePoolAddress } = findBy;
const _depositId = BigInt(findBy.depositId);

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/actions/waitForAtomicTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function waitForAtomicTx(
receipt,
});

if (!depositLog || !depositLog.depositId) {
if (!depositLog || depositLog.depositId === undefined) {
throw new NoDepositLogError(callId as Hash, originChainId);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/actions/waitForDepositTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function waitForDepositTx(

const depositLog = getDepositFromLogs({ originChainId, receipt });

if (!depositLog || !depositLog.depositId) {
if (!depositLog || depositLog.depositId === undefined) {
throw new NoDepositLogError(receipt.transactionHash, publicClient.chain.id);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/actions/waitForFillTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function parseFillLogs(
logs,
args: {
...filter,
depositId: filter?.depositId ? BigInt(filter?.depositId) : undefined,
depositId: filter?.depositId !== undefined ? BigInt(filter.depositId) : undefined,
},
});
const v3_5Log = parsedV3_5Logs?.[0];
Expand Down