From e4e8617e03178bd9324ce48dff498f64a0ac517b Mon Sep 17 00:00:00 2001 From: changzeng Date: Tue, 29 Sep 2020 15:52:01 +0800 Subject: [PATCH] [FIX] fix apply exception for solana/web3.js v78.1 --- src/utils/wallet.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/wallet.js b/src/utils/wallet.js index 979b418..816f6b6 100644 --- a/src/utils/wallet.js +++ b/src/utils/wallet.js @@ -1,6 +1,6 @@ import React, { useContext, useMemo } from 'react'; import * as bip32 from 'bip32'; -import { Account, SystemProgram } from '@solana/web3.js'; +import { Account, SystemProgram, Transaction } from '@solana/web3.js'; import nacl from 'tweetnacl'; import { setInitialAccountInfo, @@ -86,12 +86,15 @@ export class Wallet { }; transferSol = async (destination, amount) => { - return await this.connection.sendTransaction( + const trx = new Transaction().add( SystemProgram.transfer({ fromPubkey: this.publicKey, toPubkey: destination, lamports: amount, - }), + }) + ); + return await this.connection.sendTransaction( + trx, [this.account], ); };