From fe2b0d4d0765ffced20f694ac12c1b88dd407f57 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Fri, 15 Oct 2021 14:11:55 +0000 Subject: [PATCH] Update js sdk transfer from solana Change-Id: I1e81e5c068e00a2c02fea74df6c21603d44b9d74 --- sdk/js/src/token_bridge/transfer.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/js/src/token_bridge/transfer.ts b/sdk/js/src/token_bridge/transfer.ts index ffe45557..771699d5 100644 --- a/sdk/js/src/token_bridge/transfer.ts +++ b/sdk/js/src/token_bridge/transfer.ts @@ -272,7 +272,8 @@ export async function transferFromSolana( targetAddress: Uint8Array, targetChain: ChainId, originAddress?: Uint8Array, - originChain?: ChainId + originChain?: ChainId, + fromOwnerAddress?: string ) { const nonce = createNonce().readUInt32LE(0); const fee = BigInt(0); // for now, this won't do anything, we may add later @@ -290,7 +291,7 @@ export async function transferFromSolana( TOKEN_PROGRAM_ID, new PublicKey(fromAddress), new PublicKey(approval_authority_address(tokenBridgeAddress)), - new PublicKey(payerAddress), + new PublicKey(fromOwnerAddress || payerAddress), [], new u64(amount.toString(16), 16) ); @@ -321,7 +322,7 @@ export async function transferFromSolana( payerAddress, messageKey.publicKey.toString(), fromAddress, - payerAddress, + fromOwnerAddress || payerAddress, originChain as number, // checked by isSolanaNative originAddress as Uint8Array, // checked by throw nonce,