Skip to content

Commit e121e57

Browse files
committed
Fix: Validate amount '0' string in EVM SDK
1 parent e4ef88c commit e121e57

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/evm-sdk/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,15 @@ export class EVMSDK {
154154
throw new ValidationError("Invalid recipient address", "to", { to });
155155
}
156156

157+
// Convert to BigInt for validation
158+
const value = typeof amount === "bigint" ? amount : BigInt(amount || "0");
159+
157160
if (
158161
amount === undefined ||
159162
amount === null ||
160163
amount === "" ||
161-
amount === BigInt(0)
164+
amount === "0" ||
165+
value === BigInt(0)
162166
) {
163167
throw new ValidationError(
164168
"Amount must be greater than zero",
@@ -181,7 +185,6 @@ export class EVMSDK {
181185
});
182186

183187
const connectedWallet = wallet.connect(this.provider);
184-
const value = typeof amount === "bigint" ? amount : BigInt(amount);
185188

186189
let txResponse: TransactionResponse;
187190

0 commit comments

Comments
 (0)