Merge pull request #15 from cz-it/master
[FIX] fix apply exception for solana/web3.js v78.1
This commit is contained in:
commit
f582876458
|
@ -1,6 +1,6 @@
|
||||||
import React, { useContext, useMemo } from 'react';
|
import React, { useContext, useMemo } from 'react';
|
||||||
import * as bip32 from 'bip32';
|
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 nacl from 'tweetnacl';
|
||||||
import {
|
import {
|
||||||
setInitialAccountInfo,
|
setInitialAccountInfo,
|
||||||
|
@ -86,12 +86,15 @@ export class Wallet {
|
||||||
};
|
};
|
||||||
|
|
||||||
transferSol = async (destination, amount) => {
|
transferSol = async (destination, amount) => {
|
||||||
return await this.connection.sendTransaction(
|
const trx = new Transaction().add(
|
||||||
SystemProgram.transfer({
|
SystemProgram.transfer({
|
||||||
fromPubkey: this.publicKey,
|
fromPubkey: this.publicKey,
|
||||||
toPubkey: destination,
|
toPubkey: destination,
|
||||||
lamports: amount,
|
lamports: amount,
|
||||||
}),
|
})
|
||||||
|
);
|
||||||
|
return await this.connection.sendTransaction(
|
||||||
|
trx,
|
||||||
[this.account],
|
[this.account],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue