diff --git a/basics/transfer-sol/anchor/package.json b/basics/transfer-sol/anchor/package.json index 7865c8c24..1f9417836 100644 --- a/basics/transfer-sol/anchor/package.json +++ b/basics/transfer-sol/anchor/package.json @@ -2,16 +2,15 @@ "type": "module", "dependencies": { "@coral-xyz/anchor": "0.32.1", - "@solana/web3.js": "^1.95.2" + "@solana/web3.js": "^1.95.2", + "litesvm": "^0.4.0" }, "devDependencies": { "@types/bn.js": "^5.1.0", "@types/chai": "^4.3.0", "@types/mocha": "^9.0.0", - "anchor-bankrun": "^0.4.0", "chai": "^4.3.4", "mocha": "^9.0.3", - "solana-bankrun": "^0.3.0", "ts-mocha": "^10.0.0", "typescript": "^4.3.5" } diff --git a/basics/transfer-sol/anchor/pnpm-lock.yaml b/basics/transfer-sol/anchor/pnpm-lock.yaml index 4cc1440b8..b423a72a4 100644 --- a/basics/transfer-sol/anchor/pnpm-lock.yaml +++ b/basics/transfer-sol/anchor/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@solana/web3.js': specifier: ^1.95.2 version: 1.98.4(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) + litesvm: + specifier: ^0.4.0 + version: 0.4.0(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) devDependencies: '@types/bn.js': specifier: ^5.1.0 @@ -24,18 +27,12 @@ importers: '@types/mocha': specifier: ^9.0.0 version: 9.1.1 - anchor-bankrun: - specifier: ^0.4.0 - version: 0.4.1(@coral-xyz/anchor@0.32.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10))(solana-bankrun@0.3.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10)) chai: specifier: ^4.3.4 version: 4.5.0 mocha: specifier: ^9.0.3 version: 9.2.2 - solana-bankrun: - specifier: ^0.3.0 - version: 0.3.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) ts-mocha: specifier: ^10.0.0 version: 10.1.0(mocha@9.2.2) @@ -137,14 +134,6 @@ packages: resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==} engines: {node: '>= 8.0.0'} - anchor-bankrun@0.4.1: - resolution: {integrity: sha512-ryCT84tw+lP4AqRpBsZJbt/KTRoVVKufkxFGd77gnx9iHkbwA5G/9cALk/eqLQm4xeUWTrJSJdEVyg2e74iP9A==} - engines: {node: '>= 10'} - peerDependencies: - '@coral-xyz/anchor': ^0.30.0 - '@solana/web3.js': '>=1.78.4 <1.92.0' - solana-bankrun: ^0.2.0 - ansi-colors@4.1.1: resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} engines: {node: '>=6'} @@ -322,6 +311,9 @@ packages: fast-stable-stringify@1.0.0: resolution: {integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==} + fastestsmallesttextencoderdecoder@1.0.22: + resolution: {integrity: sha512-Pb8d48e+oIuY4MaM64Cd7OW1gt4nxCHs7/ddPPZ/Ic3sg8yVGM7O9wDvZ7us6ScaUupzM+pfBolwtYhN1IxBIw==} + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -434,6 +426,46 @@ packages: resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} hasBin: true + litesvm-darwin-arm64@0.4.0: + resolution: {integrity: sha512-LN6iZcUQ6Xi5KO/7yJBYSALjjDCI/s/s2PgV3BqM4dpeBaLz+fXX/+qgMcBgpEVgEdEmhelux+WtAMkbEzJfrA==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [darwin] + + litesvm-darwin-x64@0.4.0: + resolution: {integrity: sha512-3ltogKQdle8LbakVqoB6plxaNwp6Vb3tnkqa3G5mAvvZNorB2iumThDaTZ381Knl69t566LZm+g/VDZwYfsfhA==} + engines: {node: '>= 20'} + cpu: [x64] + os: [darwin] + + litesvm-linux-arm64-gnu@0.4.0: + resolution: {integrity: sha512-SWlcRUqkXCMgLoDX/Wqr/S1lff+ggVI9f0YrRJMraxtEyApxutAoW2AWw4tvo6DsEgNwjxgsZOAwnE6bQBv8CA==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [linux] + + litesvm-linux-arm64-musl@0.4.0: + resolution: {integrity: sha512-YMMqwEWJUSWwL0Rwp8dFwl3jvgNU21eI7Qc+BpH9u2yeIRYQTn3rNGDnsK8v3QIZPHQdMo7NrPhzk4XoB1aKPg==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [linux] + + litesvm-linux-x64-gnu@0.4.0: + resolution: {integrity: sha512-brZ3tFABDVQEYCgci7AO8iVYLw10UXVo97/lpTy75bTzNoqkggg8wFQOrbgCdb9NRwt06Y4Zf8cpIZAoDQq2mw==} + engines: {node: '>= 20'} + cpu: [x64] + os: [linux] + + litesvm-linux-x64-musl@0.4.0: + resolution: {integrity: sha512-D98qdIOuWg4fOewIIiH1D23AtM4I7/3vLKXIL8uQz06D5ev5fsBzNp2gM7libAywTkCYy/u666xgD6PsWhrTaw==} + engines: {node: '>= 20'} + cpu: [x64] + os: [linux] + + litesvm@0.4.0: + resolution: {integrity: sha512-ySr5mB2ap4SzJpmVR2I5+gjzTH8NJbkg7DYPormzA2U9F4LhfvTTrD17X/k5N3Bn4b5Db6/CwSyX2qc0HrJtNA==} + engines: {node: '>= 20'} + locate-path@6.0.0: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} @@ -544,39 +576,6 @@ packages: serialize-javascript@6.0.0: resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} - solana-bankrun-darwin-arm64@0.3.1: - resolution: {integrity: sha512-9LWtH/3/WR9fs8Ve/srdo41mpSqVHmRqDoo69Dv1Cupi+o1zMU6HiEPUHEvH2Tn/6TDbPEDf18MYNfReLUqE6A==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [darwin] - - solana-bankrun-darwin-universal@0.3.1: - resolution: {integrity: sha512-muGHpVYWT7xCd8ZxEjs/bmsbMp8XBqroYGbE4lQPMDUuLvsJEIrjGqs3MbxEFr71sa58VpyvgywWd5ifI7sGIg==} - engines: {node: '>= 10'} - os: [darwin] - - solana-bankrun-darwin-x64@0.3.1: - resolution: {integrity: sha512-oCaxfHyt7RC3ZMldrh5AbKfy4EH3YRMl8h6fSlMZpxvjQx7nK7PxlRwMeflMnVdkKKp7U8WIDak1lilIPd3/lg==} - engines: {node: '>= 10'} - cpu: [x64] - os: [darwin] - - solana-bankrun-linux-x64-gnu@0.3.1: - resolution: {integrity: sha512-PfRFhr7igGFNt2Ecfdzh3li9eFPB3Xhmk0Eib17EFIB62YgNUg3ItRnQQFaf0spazFjjJLnglY1TRKTuYlgSVA==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - - solana-bankrun-linux-x64-musl@0.3.1: - resolution: {integrity: sha512-6r8i0NuXg3CGURql8ISMIUqhE7Hx/O7MlIworK4oN08jYrP0CXdLeB/hywNn7Z8d1NXrox/NpYUgvRm2yIzAsQ==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - - solana-bankrun@0.3.1: - resolution: {integrity: sha512-inRwON7fBU5lPC36HdEqPeDg15FXJYcf77+o0iz9amvkUMJepcwnRwEfTNyMVpVYdgjTOBW5vg+596/3fi1kGA==} - engines: {node: '>= 10'} - source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} @@ -865,12 +864,6 @@ snapshots: dependencies: humanize-ms: 1.2.1 - anchor-bankrun@0.4.1(@coral-xyz/anchor@0.32.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10))(solana-bankrun@0.3.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10)): - dependencies: - '@coral-xyz/anchor': 0.32.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.98.4(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) - solana-bankrun: 0.3.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) - ansi-colors@4.1.1: {} ansi-regex@5.0.1: {} @@ -1034,6 +1027,8 @@ snapshots: fast-stable-stringify@1.0.0: {} + fastestsmallesttextencoderdecoder@1.0.22: {} + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -1139,6 +1134,41 @@ snapshots: minimist: 1.2.8 optional: true + litesvm-darwin-arm64@0.4.0: + optional: true + + litesvm-darwin-x64@0.4.0: + optional: true + + litesvm-linux-arm64-gnu@0.4.0: + optional: true + + litesvm-linux-arm64-musl@0.4.0: + optional: true + + litesvm-linux-x64-gnu@0.4.0: + optional: true + + litesvm-linux-x64-musl@0.4.0: + optional: true + + litesvm@0.4.0(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10): + dependencies: + '@solana/web3.js': 1.98.4(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) + fastestsmallesttextencoderdecoder: 1.0.22 + optionalDependencies: + litesvm-darwin-arm64: 0.4.0 + litesvm-darwin-x64: 0.4.0 + litesvm-linux-arm64-gnu: 0.4.0 + litesvm-linux-arm64-musl: 0.4.0 + litesvm-linux-x64-gnu: 0.4.0 + litesvm-linux-x64-musl: 0.4.0 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + locate-path@6.0.0: dependencies: p-locate: 5.0.0 @@ -1261,37 +1291,6 @@ snapshots: dependencies: randombytes: 2.1.0 - solana-bankrun-darwin-arm64@0.3.1: - optional: true - - solana-bankrun-darwin-universal@0.3.1: - optional: true - - solana-bankrun-darwin-x64@0.3.1: - optional: true - - solana-bankrun-linux-x64-gnu@0.3.1: - optional: true - - solana-bankrun-linux-x64-musl@0.3.1: - optional: true - - solana-bankrun@0.3.1(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10): - dependencies: - '@solana/web3.js': 1.98.4(bufferutil@4.0.9)(typescript@4.9.5)(utf-8-validate@5.0.10) - bs58: 4.0.1 - optionalDependencies: - solana-bankrun-darwin-arm64: 0.3.1 - solana-bankrun-darwin-universal: 0.3.1 - solana-bankrun-darwin-x64: 0.3.1 - solana-bankrun-linux-x64-gnu: 0.3.1 - solana-bankrun-linux-x64-musl: 0.3.1 - transitivePeerDependencies: - - bufferutil - - encoding - - typescript - - utf-8-validate - source-map-support@0.5.21: dependencies: buffer-from: 1.1.2 diff --git a/basics/transfer-sol/anchor/tests/bankrun.test.ts b/basics/transfer-sol/anchor/tests/bankrun.test.ts deleted file mode 100644 index 0b915de35..000000000 --- a/basics/transfer-sol/anchor/tests/bankrun.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { describe, it } from "node:test"; -import * as anchor from "@coral-xyz/anchor"; -import { - Keypair, - LAMPORTS_PER_SOL, - PublicKey, - SystemProgram, - Transaction, -} from "@solana/web3.js"; -import { BankrunProvider } from "anchor-bankrun"; -import { BN } from "bn.js"; -import { startAnchor } from "solana-bankrun"; -import type { TransferSol } from "../target/types/transfer_sol"; - -import IDL from "../target/idl/transfer_sol.json"; -const PROGRAM_ID = new PublicKey(IDL.address); - -describe("Bankrun example", async () => { - const context = await startAnchor( - "", - [{ name: "transfer_sol", programId: PROGRAM_ID }], - [], - ); - const provider = new BankrunProvider(context); - const payer = provider.wallet as anchor.Wallet; - const program = new anchor.Program(IDL, provider); - - // 1 SOL - const transferAmount = 1 * LAMPORTS_PER_SOL; - - // Generate a new keypair for the recipient - const recipient = new Keypair(); - - // Generate a new keypair to create an account owned by our program - const programOwnedAccount = new Keypair(); - - it("Transfer SOL with CPI", async () => { - await getBalances(payer.publicKey, recipient.publicKey, "Beginning"); - - await program.methods - .transferSolWithCpi(new BN(transferAmount)) - .accounts({ - payer: payer.publicKey, - recipient: recipient.publicKey, - }) - .rpc(); - - await getBalances(payer.publicKey, recipient.publicKey, "Resulting"); - }); - - it("Create and fund account owned by our program", async () => { - const instruction = SystemProgram.createAccount({ - fromPubkey: payer.publicKey, - newAccountPubkey: programOwnedAccount.publicKey, - space: 0, - lamports: 1 * LAMPORTS_PER_SOL, // 1 SOL - programId: program.programId, // Program Owner, our program's address - }); - - const transaction = new Transaction().add(instruction); - transaction.recentBlockhash = context.lastBlockhash; - transaction.feePayer = payer.publicKey; - - transaction.sign(payer.payer, programOwnedAccount); - await context.banksClient.processTransaction(transaction); - }); - - it("Transfer SOL with Program", async () => { - await getBalances( - programOwnedAccount.publicKey, - payer.publicKey, - "Beginning", - ); - - await program.methods - .transferSolWithProgram(new BN(transferAmount)) - .accounts({ - payer: programOwnedAccount.publicKey, - recipient: payer.publicKey, - }) - .rpc(); - - await getBalances( - programOwnedAccount.publicKey, - payer.publicKey, - "Resulting", - ); - }); - - async function getBalances( - payerPubkey: PublicKey, - recipientPubkey: PublicKey, - timeframe: string, - ) { - const payerBalance = await context.banksClient.getBalance(payerPubkey); - const recipientBalance = - await context.banksClient.getBalance(recipientPubkey); - console.log(`${timeframe} balances:`); - console.log(` Payer: ${Number(payerBalance) / LAMPORTS_PER_SOL}`); - console.log(` Recipient: ${Number(recipientBalance) / LAMPORTS_PER_SOL}`); - } -}); diff --git a/basics/transfer-sol/anchor/tests/litesvm.test.ts b/basics/transfer-sol/anchor/tests/litesvm.test.ts new file mode 100644 index 000000000..03f8e674a --- /dev/null +++ b/basics/transfer-sol/anchor/tests/litesvm.test.ts @@ -0,0 +1,99 @@ +import anchor from "@coral-xyz/anchor"; +import { + Keypair, + LAMPORTS_PER_SOL, + PublicKey, + SystemProgram, + Transaction, + TransactionInstruction, +} from "@solana/web3.js"; +import { assert } from "chai"; +import { LiteSVM } from "litesvm"; +import Idl from "../target/idl/transfer_sol.json" with { type: "json" }; + +describe("LiteSVM: Transfer SOL", () => { + const svm = new LiteSVM(); + const programId = new PublicKey(Idl.address); + const coder = new anchor.BorshCoder(Idl as anchor.Idl); + const payer = Keypair.generate(); + svm.airdrop(payer.publicKey, BigInt(5 * LAMPORTS_PER_SOL)); + + const programFilePath = new URL( + "../target/deploy/transfer_sol.so", + import.meta.url, + ).pathname; + svm.addProgramFromFile(programId, programFilePath); + + it("Transfer SOL with CPI", () => { + const recipient = Keypair.generate(); + + const ixArgs = { + amount: new anchor.BN(LAMPORTS_PER_SOL), + }; + const data = coder.instruction.encode("transfer_sol_with_cpi", ixArgs); + const ix = new TransactionInstruction({ + keys: [ + { pubkey: payer.publicKey, isSigner: true, isWritable: true }, + { pubkey: recipient.publicKey, isSigner: false, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + ], + programId, + data, + }); + + const tx = new Transaction().add(ix); + tx.feePayer = payer.publicKey; + tx.recentBlockhash = svm.latestBlockhash(); + tx.sign(payer); + svm.sendTransaction(tx); + + const recipientAcc = svm.getAccount(recipient.publicKey); + assert.equal(recipientAcc.lamports, LAMPORTS_PER_SOL); + }); + + it("Transfer SOL with Program", () => { + const payerAccount = Keypair.generate(); + const ixPayer = SystemProgram.createAccount({ + fromPubkey: payer.publicKey, + newAccountPubkey: payerAccount.publicKey, + lamports: LAMPORTS_PER_SOL, + space: 0, + programId, + }); + const txPayer = new Transaction().add(ixPayer); + txPayer.feePayer = payer.publicKey; + txPayer.recentBlockhash = svm.latestBlockhash(); + txPayer.sign(payer, payerAccount); + svm.sendTransaction(txPayer); + svm.expireBlockhash(); + + const recipientAccount = Keypair.generate(); + + const ixArgs = { + amount: new anchor.BN(LAMPORTS_PER_SOL), + }; + const data = coder.instruction.encode("transfer_sol_with_program", ixArgs); + const ix = new TransactionInstruction({ + keys: [ + { pubkey: payerAccount.publicKey, isSigner: true, isWritable: true }, + { + pubkey: recipientAccount.publicKey, + isSigner: false, + isWritable: true, + }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + ], + programId, + data, + }); + + const tx = new Transaction().add(ix); + tx.feePayer = payer.publicKey; + tx.recentBlockhash = svm.latestBlockhash(); + tx.sign(payer, payerAccount); + svm.sendTransaction(tx); + + const recipientAcc = svm.getAccount(recipientAccount.publicKey); + assert.equal(recipientAcc.lamports, LAMPORTS_PER_SOL); + }); +}); diff --git a/basics/transfer-sol/anchor/tests/test.ts b/basics/transfer-sol/anchor/tests/test.ts index 4d64b0938..05705380a 100644 --- a/basics/transfer-sol/anchor/tests/test.ts +++ b/basics/transfer-sol/anchor/tests/test.ts @@ -8,86 +8,61 @@ import { sendAndConfirmTransaction, } from "@solana/web3.js"; import { BN } from "bn.js"; -import type { TransferSol } from "../target/types/transfer_sol"; +import { assert } from "chai"; +import type { TransferSol } from "../target/types/transfer_sol.ts"; -describe.skip("transfer-sol", () => { +describe("Anchor: Transfer SOL", () => { const provider = anchor.AnchorProvider.env(); anchor.setProvider(provider); const payer = provider.wallet as anchor.Wallet; const program = anchor.workspace.TransferSol as anchor.Program; - // 1 SOL - const transferAmount = 1 * LAMPORTS_PER_SOL; - - // Generate a new keypair for the recipient - const recipient = new Keypair(); - - // Generate a new keypair to create an account owned by our program - const programOwnedAccount = new Keypair(); - it("Transfer SOL with CPI", async () => { - await getBalances(payer.publicKey, recipient.publicKey, "Beginning"); + const recipient = Keypair.generate(); await program.methods - .transferSolWithCpi(new BN(transferAmount)) + .transferSolWithCpi(new BN(LAMPORTS_PER_SOL)) .accounts({ payer: payer.publicKey, recipient: recipient.publicKey, }) .rpc(); - await getBalances(payer.publicKey, recipient.publicKey, "Resulting"); + const recipientBalance = await provider.connection.getBalance( + recipient.publicKey, + ); + assert.equal(recipientBalance, LAMPORTS_PER_SOL); }); - it("Create and fund account owned by our program", async () => { - const instruction = SystemProgram.createAccount({ + it("Transfer SOL with Program", async () => { + const payerAccount = Keypair.generate(); + const ix = SystemProgram.createAccount({ fromPubkey: payer.publicKey, - newAccountPubkey: programOwnedAccount.publicKey, + newAccountPubkey: payerAccount.publicKey, space: 0, - lamports: 1 * LAMPORTS_PER_SOL, // 1 SOL + lamports: LAMPORTS_PER_SOL, // 1 SOL programId: program.programId, // Program Owner, our program's address }); - const transaction = new Transaction().add(instruction); + const transaction = new Transaction().add(ix); await sendAndConfirmTransaction(provider.connection, transaction, [ payer.payer, - programOwnedAccount, + payerAccount, ]); - }); - - it("Transfer SOL with Program", async () => { - await getBalances( - programOwnedAccount.publicKey, - payer.publicKey, - "Beginning", - ); + const recipientAccount = Keypair.generate(); await program.methods - .transferSolWithProgram(new BN(transferAmount)) + .transferSolWithProgram(new BN(LAMPORTS_PER_SOL)) .accounts({ - payer: programOwnedAccount.publicKey, - recipient: payer.publicKey, + payer: payerAccount.publicKey, + recipient: recipientAccount.publicKey, }) .rpc(); - await getBalances( - programOwnedAccount.publicKey, - payer.publicKey, - "Resulting", + const recipientBalance = await provider.connection.getBalance( + recipientAccount.publicKey, ); + assert.equal(recipientBalance, LAMPORTS_PER_SOL); }); - - async function getBalances( - payerPubkey: PublicKey, - recipientPubkey: PublicKey, - timeframe: string, - ) { - const payerBalance = await provider.connection.getBalance(payerPubkey); - const recipientBalance = - await provider.connection.getBalance(recipientPubkey); - console.log(`${timeframe} balances:`); - console.log(` Payer: ${payerBalance / LAMPORTS_PER_SOL}`); - console.log(` Recipient: ${recipientBalance / LAMPORTS_PER_SOL}`); - } }); diff --git a/basics/transfer-sol/anchor/tsconfig.json b/basics/transfer-sol/anchor/tsconfig.json index cd5d2e3d0..59fe75cf0 100644 --- a/basics/transfer-sol/anchor/tsconfig.json +++ b/basics/transfer-sol/anchor/tsconfig.json @@ -1,10 +1,10 @@ { - "compilerOptions": { - "types": ["mocha", "chai"], - "typeRoots": ["./node_modules/@types"], - "lib": ["es2015"], - "module": "commonjs", - "target": "es6", - "esModuleInterop": true - } + "compilerOptions": { + "types": ["mocha", "chai"], + "typeRoots": ["./node_modules/@types"], + "lib": ["es2015"], + "module": "nodenext", + "target": "es6", + "esModuleInterop": true + } }