diff --git a/web3.js/examples/budget-two-approvers.js b/web3.js/examples/budget-two-approvers.js index 12b9f4cafd..7944b2b2a7 100644 --- a/web3.js/examples/budget-two-approvers.js +++ b/web3.js/examples/budget-two-approvers.js @@ -69,7 +69,7 @@ showBalance() .then(airDrop) .then(() => { console.log(`\n== Move 1 lamport to approver1`); - const transaction = solanaWeb3.SystemProgram.move( + const transaction = solanaWeb3.SystemProgram.transfer( account1.publicKey, approver1.publicKey, 1, @@ -79,7 +79,7 @@ showBalance() .then(confirmTransaction) .then(() => { console.log(`\n== Move 1 lamport to approver2`); - const transaction = solanaWeb3.SystemProgram.move( + const transaction = solanaWeb3.SystemProgram.transfer( account1.publicKey, approver2.publicKey, 1, diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index 3e03c3e80e..ecc7e11c16 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -102,7 +102,7 @@ declare module '@solana/web3.js' { space: number, programId: PublicKey, ): Transaction; - static move(from: PublicKey, to: PublicKey, amount: number): Transaction; + static transfer(from: PublicKey, to: PublicKey, amount: number): Transaction; static assign(from: PublicKey, programId: PublicKey): Transaction; } diff --git a/web3.js/src/system-program.js b/web3.js/src/system-program.js index 2f082fec03..91c27107a4 100644 --- a/web3.js/src/system-program.js +++ b/web3.js/src/system-program.js @@ -58,9 +58,9 @@ export class SystemProgram { } /** - * Generate a Transaction that moves lamports from one account to another + * Generate a Transaction that transfers lamports from one account to another */ - static move(from: PublicKey, to: PublicKey, amount: number): Transaction { + static transfer(from: PublicKey, to: PublicKey, amount: number): Transaction { const dataLayout = BufferLayout.struct([ BufferLayout.u32('instruction'), BufferLayout.ns64('amount'), diff --git a/web3.js/test/connection.test.js b/web3.js/test/connection.test.js index 1493d73d1f..3a56e37bdd 100644 --- a/web3.js/test/connection.test.js +++ b/web3.js/test/connection.test.js @@ -296,7 +296,7 @@ test('transaction', async () => { }, ]); - const transaction = SystemProgram.move( + const transaction = SystemProgram.transfer( accountFrom.publicKey, accountTo.publicKey, 10, @@ -390,11 +390,11 @@ test('multi-instruction transaction', async () => { // 1. Move(accountFrom, accountTo) // 2. Move(accountTo, accountFrom) - const transaction = SystemProgram.move( + const transaction = SystemProgram.transfer( accountFrom.publicKey, accountTo.publicKey, 10, - ).add(SystemProgram.move(accountTo.publicKey, accountFrom.publicKey, 10)); + ).add(SystemProgram.transfer(accountTo.publicKey, accountFrom.publicKey, 10)); const signature = await connection.sendTransaction( transaction, accountFrom, diff --git a/web3.js/test/system-program.test.js b/web3.js/test/system-program.test.js index 02d020249b..2cd55cbc75 100644 --- a/web3.js/test/system-program.test.js +++ b/web3.js/test/system-program.test.js @@ -20,12 +20,12 @@ test('createAccount', () => { // TODO: Validate transaction contents more }); -test('move', () => { +test('transfer', () => { const from = new Account(); const to = new Account(); let transaction; - transaction = SystemProgram.move(from.publicKey, to.publicKey, 123); + transaction = SystemProgram.transfer(from.publicKey, to.publicKey, 123); expect(transaction.keys).toHaveLength(2); expect(transaction.programId).toEqual(SystemProgram.programId); diff --git a/web3.js/test/transaction.test.js b/web3.js/test/transaction.test.js index 0d0497b503..c7374cc295 100644 --- a/web3.js/test/transaction.test.js +++ b/web3.js/test/transaction.test.js @@ -10,12 +10,12 @@ test('signPartial', () => { const account1 = new Account(); const account2 = new Account(); const recentBlockhash = account1.publicKey.toBase58(); // Fake recentBlockhash - const move = SystemProgram.move(account1.publicKey, account2.publicKey, 123); + const transfer = SystemProgram.transfer(account1.publicKey, account2.publicKey, 123); - const transaction = new Transaction({recentBlockhash}).add(move); + const transaction = new Transaction({recentBlockhash}).add(transfer); transaction.sign(account1, account2); - const partialTransaction = new Transaction({recentBlockhash}).add(move); + const partialTransaction = new Transaction({recentBlockhash}).add(transfer); partialTransaction.signPartial(account1, account2.publicKey); expect(partialTransaction.signatures[1].signature).toBeNull(); partialTransaction.addSigner(account2); @@ -27,16 +27,16 @@ test('transfer signatures', () => { const account1 = new Account(); const account2 = new Account(); const recentBlockhash = account1.publicKey.toBase58(); // Fake recentBlockhash - const move1 = SystemProgram.move(account1.publicKey, account2.publicKey, 123); - const move2 = SystemProgram.move(account2.publicKey, account1.publicKey, 123); + const transfer1 = SystemProgram.transfer(account1.publicKey, account2.publicKey, 123); + const transfer2 = SystemProgram.transfer(account2.publicKey, account1.publicKey, 123); - const orgTransaction = new Transaction({recentBlockhash}).add(move1, move2); + const orgTransaction = new Transaction({recentBlockhash}).add(transfer1, transfer2); orgTransaction.sign(account1, account2); const newTransaction = new Transaction({ recentBlockhash: orgTransaction.recentBlockhash, signatures: orgTransaction.signatures, - }).add(move1, move2); + }).add(transfer1, transfer2); expect(newTransaction).toEqual(orgTransaction); }); @@ -50,8 +50,8 @@ test('parse wire format and serialize', () => { const recipient = new PublicKey( 'J3dxNj7nDRRqRRXuEMynDG57DkZK4jYRuv3Garmb1i99', ); // Arbitrary known public key - const move = SystemProgram.move(sender.publicKey, recipient, 49); - const expectedTransaction = new Transaction({recentBlockhash}).add(move); + const transfer = SystemProgram.transfer(sender.publicKey, recipient, 49); + const expectedTransaction = new Transaction({recentBlockhash}).add(transfer); expectedTransaction.sign(sender); const wireTransaction = Buffer.from([