sdk/js: fix number overflow

Change-Id: Iba73f620ee8e99737e38eee0246599ca28af7bba
This commit is contained in:
Evan Gray 2021-09-15 15:58:30 -04:00
parent f91cccc819
commit 06984351b8
5 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
import { Token, TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { Token, TOKEN_PROGRAM_ID, u64 } from "@solana/spl-token";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { ixFromRust } from "../solana";
@ -21,7 +21,7 @@ export default async function addLiquidity(
new PublicKey(authority_address(program_id)),
new PublicKey(payerAddress),
[],
Number(amount)
new u64(amount.toString(16), 16)
);
const ix = ixFromRust(
add_liquidity(

View File

@ -1,4 +1,4 @@
import { Token, TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { Token, TOKEN_PROGRAM_ID, u64 } from "@solana/spl-token";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { ixFromRust } from "../solana";
@ -21,7 +21,7 @@ export default async function claimShares(
new PublicKey(authority_address(program_id)),
new PublicKey(payerAddress),
[],
Number(amount)
new u64(amount.toString(16), 16)
);
const ix = ixFromRust(
claim_shares(

View File

@ -1,4 +1,4 @@
import { Token, TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { Token, TOKEN_PROGRAM_ID, u64 } from "@solana/spl-token";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { ixFromRust } from "../solana";
@ -21,7 +21,7 @@ export default async function migrateTokens(
new PublicKey(authority_address(program_id)),
new PublicKey(payerAddress),
[],
Number(amount)
new u64(amount.toString(16), 16)
);
const ix = ixFromRust(
migrate_tokens(

View File

@ -1,4 +1,4 @@
import { Token, TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { Token, TOKEN_PROGRAM_ID, u64 } from "@solana/spl-token";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { ixFromRust } from "../solana";
@ -21,7 +21,7 @@ export default async function removeLiquidity(
new PublicKey(authority_address(program_id)),
new PublicKey(payerAddress),
[],
Number(amount)
new u64(amount.toString(16), 16)
);
const ix = ixFromRust(
remove_liquidity(

View File

@ -1,4 +1,4 @@
import { Token, TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { Token, TOKEN_PROGRAM_ID, u64 } from "@solana/spl-token";
import { Connection, Keypair, PublicKey, Transaction } from "@solana/web3.js";
import { MsgExecuteContract } from "@terra-money/terra.js";
import { ethers } from "ethers";
@ -128,7 +128,7 @@ export async function transferFromSolana(
new PublicKey(approval_authority_address(tokenBridgeAddress)),
new PublicKey(payerAddress),
[],
Number(amount)
new u64(amount.toString(16), 16)
);
let messageKey = Keypair.generate();
const isSolanaNative =