fix: rename tokens to lamports

This commit is contained in:
Michael Vines 2019-03-05 17:52:13 -08:00
parent 09b6d2b764
commit be8821e0d0
12 changed files with 68 additions and 68 deletions

View File

@ -1,6 +1,6 @@
/* /*
Example of using the Budget program to perform a time-lock payment of 50 Example of using the Budget program to perform a time-lock payment of 50
tokens from account1 to account2. lamports from account1 to account2.
*/ */
//eslint-disable-next-line import/no-commonjs //eslint-disable-next-line import/no-commonjs
@ -72,7 +72,7 @@ showBalance()
const transaction = solanaWeb3.SystemProgram.createAccount( const transaction = solanaWeb3.SystemProgram.createAccount(
account1.publicKey, account1.publicKey,
contractFunds.publicKey, contractFunds.publicKey,
50, // number of tokens to transfer 50, // number of lamports to transfer
0, 0,
solanaWeb3.BudgetProgram.programId, solanaWeb3.BudgetProgram.programId,
); );
@ -85,7 +85,7 @@ showBalance()
const transaction = solanaWeb3.SystemProgram.createAccount( const transaction = solanaWeb3.SystemProgram.createAccount(
account1.publicKey, account1.publicKey,
contractState.publicKey, contractState.publicKey,
1, // account1 pays 1 token to hold the contract state 1, // account1 pays 1 lamport to hold the contract state
solanaWeb3.BudgetProgram.space, solanaWeb3.BudgetProgram.space,
solanaWeb3.BudgetProgram.programId, solanaWeb3.BudgetProgram.programId,
); );

View File

@ -68,7 +68,7 @@ function airDrop() {
showBalance() showBalance()
.then(airDrop) .then(airDrop)
.then(() => { .then(() => {
console.log(`\n== Move 1 token to approver1`); console.log(`\n== Move 1 lamport to approver1`);
const transaction = solanaWeb3.SystemProgram.move( const transaction = solanaWeb3.SystemProgram.move(
account1.publicKey, account1.publicKey,
approver1.publicKey, approver1.publicKey,
@ -78,7 +78,7 @@ showBalance()
}) })
.then(confirmTransaction) .then(confirmTransaction)
.then(() => { .then(() => {
console.log(`\n== Move 1 token to approver2`); console.log(`\n== Move 1 lamport to approver2`);
const transaction = solanaWeb3.SystemProgram.move( const transaction = solanaWeb3.SystemProgram.move(
account1.publicKey, account1.publicKey,
approver2.publicKey, approver2.publicKey,
@ -93,7 +93,7 @@ showBalance()
const transaction = solanaWeb3.SystemProgram.createAccount( const transaction = solanaWeb3.SystemProgram.createAccount(
account1.publicKey, account1.publicKey,
contractFunds.publicKey, contractFunds.publicKey,
50, // number of tokens to transfer 50, // number of lamports to transfer
0, 0,
solanaWeb3.BudgetProgram.programId, solanaWeb3.BudgetProgram.programId,
); );
@ -106,7 +106,7 @@ showBalance()
const transaction = solanaWeb3.SystemProgram.createAccount( const transaction = solanaWeb3.SystemProgram.createAccount(
account1.publicKey, account1.publicKey,
contractState.publicKey, contractState.publicKey,
1, // account1 pays 1 token to hold the contract state 1, // account1 pays 1 lamport to hold the contract state
solanaWeb3.BudgetProgram.space, solanaWeb3.BudgetProgram.space,
solanaWeb3.BudgetProgram.programId, solanaWeb3.BudgetProgram.programId,
); );

View File

@ -39,7 +39,7 @@ declare module '@solana/web3.js' {
declare export type AccountInfo = { declare export type AccountInfo = {
executable: boolean, executable: boolean,
owner: PublicKey, owner: PublicKey,
tokens: number, lamports: number,
userdata: Buffer, userdata: Buffer,
}; };
@ -85,7 +85,7 @@ declare module '@solana/web3.js' {
static createAccount( static createAccount(
from: PublicKey, from: PublicKey,
newAccount: PublicKey, newAccount: PublicKey,
tokens: number, lamports: number,
space: number, space: number,
programId: PublicKey, programId: PublicKey,
): Transaction; ): Transaction;

View File

@ -38,7 +38,7 @@ export type TimestampCondition = {
* Represents a payment to a given public key * Represents a payment to a given public key
* *
* @typedef {Object} Payment * @typedef {Object} Payment
* @property {number} amount Number of tokens * @property {number} amount Number of lamports
* @property {PublicKey} to Public key of the recipient * @property {PublicKey} to Public key of the recipient
*/ */
export type Payment = { export type Payment = {
@ -177,7 +177,7 @@ export class BudgetProgram {
} }
/** /**
* Generates a transaction that transfers tokens once any of the conditions are met * Generates a transaction that transfers lamports once any of the conditions are met
*/ */
static pay( static pay(
from: PublicKey, from: PublicKey,
@ -258,7 +258,7 @@ export class BudgetProgram {
} }
/** /**
* Generates a transaction that transfers tokens once both conditions are met * Generates a transaction that transfers lamports once both conditions are met
*/ */
static payOnBoth( static payOnBoth(
from: PublicKey, from: PublicKey,

View File

@ -85,7 +85,7 @@ function jsonRpcResult(resultDescription: any) {
const AccountInfoResult = struct({ const AccountInfoResult = struct({
executable: 'boolean', executable: 'boolean',
owner: 'array', owner: 'array',
tokens: 'number', lamports: 'number',
userdata: 'array', userdata: 'array',
}); });
@ -144,7 +144,7 @@ const SendTransactionRpcResult = jsonRpcResult('string');
* Information describing an account * Information describing an account
* *
* @typedef {Object} AccountInfo * @typedef {Object} AccountInfo
* @property {number} tokens Number of tokens assigned to the account * @property {number} lamports Number of lamports assigned to the account
* @property {PublicKey} owner Identifier of the program that owns the account * @property {PublicKey} owner Identifier of the program that owns the account
* @property {?Buffer} userdata Optional userdata assigned to the account * @property {?Buffer} userdata Optional userdata assigned to the account
* @property {boolean} executable `true` if this account's userdata contains a loaded program * @property {boolean} executable `true` if this account's userdata contains a loaded program
@ -152,7 +152,7 @@ const SendTransactionRpcResult = jsonRpcResult('string');
type AccountInfo = { type AccountInfo = {
executable: boolean, executable: boolean,
owner: PublicKey, owner: PublicKey,
tokens: number, lamports: number,
userdata: Buffer, userdata: Buffer,
}; };
@ -266,7 +266,7 @@ export class Connection {
return { return {
executable: result.executable, executable: result.executable,
owner: new PublicKey(result.owner), owner: new PublicKey(result.owner),
tokens: result.tokens, lamports: result.lamports,
userdata: Buffer.from(result.userdata), userdata: Buffer.from(result.userdata),
}; };
} }
@ -326,7 +326,7 @@ export class Connection {
} }
/** /**
* Request an allocation of tokens to the specified account * Request an allocation of lamports to the specified account
*/ */
async requestAirdrop( async requestAirdrop(
to: PublicKey, to: PublicKey,
@ -478,7 +478,7 @@ export class Connection {
sub.callback({ sub.callback({
executable: result.executable, executable: result.executable,
owner: new PublicKey(result.owner), owner: new PublicKey(result.owner),
tokens: result.tokens, lamports: result.lamports,
userdata: Buffer.from(result.userdata), userdata: Buffer.from(result.userdata),
}); });
return true; return true;

View File

@ -25,13 +25,13 @@ export class SystemProgram {
static createAccount( static createAccount(
from: PublicKey, from: PublicKey,
newAccount: PublicKey, newAccount: PublicKey,
tokens: number, lamports: number,
space: number, space: number,
programId: PublicKey, programId: PublicKey,
): Transaction { ): Transaction {
const userdataLayout = BufferLayout.struct([ const userdataLayout = BufferLayout.struct([
BufferLayout.u32('instruction'), BufferLayout.u32('instruction'),
BufferLayout.ns64('tokens'), BufferLayout.ns64('lamports'),
BufferLayout.ns64('space'), BufferLayout.ns64('space'),
Layout.publicKey('programId'), Layout.publicKey('programId'),
]); ]);
@ -40,7 +40,7 @@ export class SystemProgram {
userdataLayout.encode( userdataLayout.encode(
{ {
instruction: 0, // Create Account instruction instruction: 0, // Create Account instruction
tokens, lamports,
space, space,
programId: programId.toBuffer(), programId: programId.toBuffer(),
}, },
@ -55,7 +55,7 @@ export class SystemProgram {
} }
/** /**
* Generate a Transaction that moves tokens from one account to another * Generate a Transaction that moves lamports from one account to another
*/ */
static move(from: PublicKey, to: PublicKey, amount: number): Transaction { static move(from: PublicKey, to: PublicKey, amount: number): Transaction {
const userdataLayout = BufferLayout.struct([ const userdataLayout = BufferLayout.struct([

View File

@ -16,7 +16,7 @@ import {sendAndConfirmTransaction} from './util/send-and-confirm-transaction';
import type {Connection} from './connection'; import type {Connection} from './connection';
/** /**
* Some amount of tokens * Some amount of lamports
*/ */
export class TokenAmount extends BN { export class TokenAmount extends BN {
/** /**
@ -55,7 +55,7 @@ export class TokenAmount extends BN {
*/ */
type TokenInfo = {| type TokenInfo = {|
/** /**
* Total supply of tokens * Total supply of lamports
*/ */
supply: TokenAmount, supply: TokenAmount,
@ -100,21 +100,21 @@ type TokenAccountInfo = {|
owner: PublicKey, owner: PublicKey,
/** /**
* Amount of tokens this account holds * Amount of lamports this account holds
*/ */
amount: TokenAmount, amount: TokenAmount,
/** /**
* The source account for the tokens. * The source account for the lamports.
* *
* If `source` is null, the source is this account. * If `source` is null, the source is this account.
* If `source` is not null, the `amount` of tokens in this account represent * If `source` is not null, the `amount` of lamports in this account represent
* an allowance of tokens that may be transferred from the source account * an allowance of lamports that may be transferred from the source account
*/ */
source: null | PublicKey, source: null | PublicKey,
/** /**
* Original amount of tokens this delegate account was authorized to spend * Original amount of lamports this delegate account was authorized to spend
* If `source` is null, originalAmount is zero * If `source` is null, originalAmount is zero
*/ */
originalAmount: TokenAmount, originalAmount: TokenAmount,
@ -185,7 +185,7 @@ export class Token {
* @param symbol Symbol for this token * @param symbol Symbol for this token
* @param decimals Location of the decimal place * @param decimals Location of the decimal place
* @param programId Optional token programId, uses the system programId by default * @param programId Optional token programId, uses the system programId by default
* @return Token object for the newly minted token, Public key of the Token Account holding the total supply of new tokens * @return Token object for the newly minted token, Public key of the Token Account holding the total supply of new lamports
*/ */
static async createNewToken( static async createNewToken(
connection: Connection, connection: Connection,
@ -253,7 +253,7 @@ export class Token {
* *
* @param owner User account that will own the new token account * @param owner User account that will own the new token account
* @param source If not null, create a delegate account that when authorized * @param source If not null, create a delegate account that when authorized
* may transfer tokens from this `source` account * may transfer lamports from this `source` account
* @return Public key of the new empty token account * @return Public key of the new empty token account
*/ */
async newAccount( async newAccount(
@ -363,12 +363,12 @@ export class Token {
} }
/** /**
* Transfer tokens to another account * Transfer lamports to another account
* *
* @param owner Owner of the source token account * @param owner Owner of the source token account
* @param source Source token account * @param source Source token account
* @param destination Destination token account * @param destination Destination token account
* @param amount Number of tokens to transfer * @param amount Number of lamports to transfer
*/ */
async transfer( async transfer(
owner: Account, owner: Account,
@ -391,12 +391,12 @@ export class Token {
} }
/** /**
* Grant a third-party permission to transfer up the specified number of tokens from an account * Grant a third-party permission to transfer up the specified number of lamports from an account
* *
* @param owner Owner of the source token account * @param owner Owner of the source token account
* @param account Public key of the token account * @param account Public key of the token account
* @param delegate Token account authorized to perform a transfer tokens from the source account * @param delegate Token account authorized to perform a transfer lamports from the source account
* @param amount Maximum number of tokens the delegate may transfer * @param amount Maximum number of lamports the delegate may transfer
*/ */
async approve( async approve(
owner: Account, owner: Account,
@ -414,7 +414,7 @@ export class Token {
} }
/** /**
* Remove approval for the transfer of any remaining tokens * Remove approval for the transfer of any remaining lamports
* *
* @param owner Owner of the source token account * @param owner Owner of the source token account
* @param account Public key of the token account * @param account Public key of the token account
@ -455,7 +455,7 @@ export class Token {
* @param owner Owner of the source token account * @param owner Owner of the source token account
* @param source Source token account * @param source Source token account
* @param destination Destination token account * @param destination Destination token account
* @param amount Number of tokens to transfer * @param amount Number of lamports to transfer
*/ */
async transferInstruction( async transferInstruction(
owner: PublicKey, owner: PublicKey,
@ -498,8 +498,8 @@ export class Token {
* *
* @param owner Owner of the source token account * @param owner Owner of the source token account
* @param account Public key of the token account * @param account Public key of the token account
* @param delegate Token account authorized to perform a transfer tokens from the source account * @param delegate Token account authorized to perform a transfer lamports from the source account
* @param amount Maximum number of tokens the delegate may transfer * @param amount Maximum number of lamports the delegate may transfer
*/ */
approveInstruction( approveInstruction(
owner: PublicKey, owner: PublicKey,
@ -533,7 +533,7 @@ export class Token {
* *
* @param owner Owner of the source token account * @param owner Owner of the source token account
* @param account Public key of the token account * @param account Public key of the token account
* @param delegate Token account authorized to perform a transfer tokens from the source account * @param delegate Token account authorized to perform a transfer lamports from the source account
*/ */
revokeInstruction( revokeInstruction(
owner: PublicKey, owner: PublicKey,

View File

@ -10,7 +10,7 @@ import {
} from '../src'; } from '../src';
import {mockRpcEnabled} from './__mocks__/node-fetch'; import {mockRpcEnabled} from './__mocks__/node-fetch';
import {url} from './url'; import {url} from './url';
import {newAccountWithTokens} from './new-account-with-tokens'; import {newAccountWithLamports} from './new-account-with-lamports';
if (!mockRpcEnabled) { if (!mockRpcEnabled) {
// The default of 5 seconds is too slow for live testing sometimes // The default of 5 seconds is too slow for live testing sometimes
@ -24,7 +24,7 @@ test('load BPF program', async () => {
} }
const connection = new Connection(url); const connection = new Connection(url);
const from = await newAccountWithTokens(connection, 1024); const from = await newAccountWithLamports(connection, 1024);
const data = await fs.readFile('test/fixtures/noop/noop.so'); const data = await fs.readFile('test/fixtures/noop/noop.so');
const programId = await BpfLoader.load(connection, from, data); const programId = await BpfLoader.load(connection, from, data);
const transaction = new Transaction().add({ const transaction = new Transaction().add({

View File

@ -213,7 +213,7 @@ test('request airdrop', async () => {
0, 0,
0, 0,
], ],
tokens: 42, lamports: 42,
userdata: [], userdata: [],
executable: false, executable: false,
}, },
@ -221,7 +221,7 @@ test('request airdrop', async () => {
]); ]);
const accountInfo = await connection.getAccountInfo(account.publicKey); const accountInfo = await connection.getAccountInfo(account.publicKey);
expect(accountInfo.tokens).toBe(42); expect(accountInfo.lamports).toBe(42);
expect(accountInfo.userdata).toHaveLength(0); expect(accountInfo.userdata).toHaveLength(0);
expect(accountInfo.owner).toEqual(SystemProgram.programId); expect(accountInfo.owner).toEqual(SystemProgram.programId);
}); });
@ -469,7 +469,7 @@ test('account change notification', async () => {
await connection.removeAccountChangeListener(subscriptionId); await connection.removeAccountChangeListener(subscriptionId);
expect(mockCallback.mock.calls[0][0].tokens).toBe(41); expect(mockCallback.mock.calls[0][0].lamports).toBe(41);
expect(mockCallback.mock.calls[0][0].owner).toEqual(BpfLoader.programId); expect(mockCallback.mock.calls[0][0].owner).toEqual(BpfLoader.programId);
expect(mockCallback.mock.calls[0][0].executable).toBe(false); expect(mockCallback.mock.calls[0][0].executable).toBe(false);
expect(mockCallback.mock.calls[0][0].userdata).toEqual( expect(mockCallback.mock.calls[0][0].userdata).toEqual(

View File

@ -8,7 +8,7 @@ import {
} from '../src'; } from '../src';
import {mockRpcEnabled} from './__mocks__/node-fetch'; import {mockRpcEnabled} from './__mocks__/node-fetch';
import {url} from './url'; import {url} from './url';
import {newAccountWithTokens} from './new-account-with-tokens'; import {newAccountWithLamports} from './new-account-with-lamports';
if (!mockRpcEnabled) { if (!mockRpcEnabled) {
// The default of 5 seconds is too slow for live testing sometimes // The default of 5 seconds is too slow for live testing sometimes
@ -22,7 +22,7 @@ test('load native program', async () => {
} }
const connection = new Connection(url); const connection = new Connection(url);
const from = await newAccountWithTokens(connection, 1024); const from = await newAccountWithLamports(connection, 1024);
const programId = await NativeLoader.load(connection, from, 'noop'); const programId = await NativeLoader.load(connection, from, 'noop');
const transaction = new Transaction().add({ const transaction = new Transaction().add({
keys: [from.publicKey], keys: [from.publicKey],

View File

@ -4,9 +4,9 @@ import {Account, Connection} from '../src';
import {mockRpc} from './__mocks__/node-fetch'; import {mockRpc} from './__mocks__/node-fetch';
import {url} from './url'; import {url} from './url';
export async function newAccountWithTokens( export async function newAccountWithLamports(
connection: Connection, connection: Connection,
amount: number = 10, lamports: number = 10,
): Promise<Account> { ): Promise<Account> {
const account = new Account(); const account = new Account();
@ -15,7 +15,7 @@ export async function newAccountWithTokens(
url, url,
{ {
method: 'requestAirdrop', method: 'requestAirdrop',
params: [account.publicKey.toBase58(), amount], params: [account.publicKey.toBase58(), lamports],
}, },
{ {
error: null, error: null,
@ -26,6 +26,6 @@ export async function newAccountWithTokens(
]); ]);
} }
await connection.requestAirdrop(account.publicKey, amount); await connection.requestAirdrop(account.publicKey, lamports);
return account; return account;
} }

View File

@ -4,7 +4,7 @@ import {Connection, PublicKey, Token, TokenAmount} from '../src';
import {SYSTEM_TOKEN_PROGRAM_ID} from '../src/token-program'; import {SYSTEM_TOKEN_PROGRAM_ID} from '../src/token-program';
import {mockRpc, mockRpcEnabled} from './__mocks__/node-fetch'; import {mockRpc, mockRpcEnabled} from './__mocks__/node-fetch';
import {url} from './url'; import {url} from './url';
import {newAccountWithTokens} from './new-account-with-tokens'; import {newAccountWithLamports} from './new-account-with-lamports';
import {mockGetRecentBlockhash} from './mockrpc/get-recent-blockhash'; import {mockGetRecentBlockhash} from './mockrpc/get-recent-blockhash';
import {sleep} from '../src/util/sleep'; import {sleep} from '../src/util/sleep';
@ -50,7 +50,7 @@ test('create new token', async () => {
const connection = new Connection(url); const connection = new Connection(url);
connection._disableBlockhashCaching = mockRpcEnabled; connection._disableBlockhashCaching = mockRpcEnabled;
initialOwner = await newAccountWithTokens(connection, 1024); initialOwner = await newAccountWithLamports(connection, 1024);
{ {
// mock SystemProgram.createAccount transaction for Token.createNewToken() // mock SystemProgram.createAccount transaction for Token.createNewToken()
@ -94,7 +94,7 @@ test('create new token', async () => {
error: null, error: null,
result: { result: {
owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()], owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()],
tokens: 1, lamports: 1,
userdata: [ userdata: [
1, 1,
16, 16,
@ -162,7 +162,7 @@ test('create new token', async () => {
error: null, error: null,
result: { result: {
owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()], owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()],
tokens: 1, lamports: 1,
userdata: [ userdata: [
2, 2,
...testToken.token.toBuffer(), ...testToken.token.toBuffer(),
@ -226,7 +226,7 @@ test('create new token', async () => {
test('create new token account', async () => { test('create new token account', async () => {
const connection = new Connection(url); const connection = new Connection(url);
connection._disableBlockhashCaching = mockRpcEnabled; connection._disableBlockhashCaching = mockRpcEnabled;
const destOwner = await newAccountWithTokens(connection); const destOwner = await newAccountWithLamports(connection);
{ {
// mock SystemProgram.createAccount transaction for Token.newAccount() // mock SystemProgram.createAccount transaction for Token.newAccount()
@ -251,7 +251,7 @@ test('create new token account', async () => {
error: null, error: null,
result: { result: {
owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()], owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()],
tokens: 1, lamports: 1,
userdata: [ userdata: [
2, 2,
...testToken.token.toBuffer(), ...testToken.token.toBuffer(),
@ -283,7 +283,7 @@ test('create new token account', async () => {
test('transfer', async () => { test('transfer', async () => {
const connection = new Connection(url); const connection = new Connection(url);
connection._disableBlockhashCaching = mockRpcEnabled; connection._disableBlockhashCaching = mockRpcEnabled;
const destOwner = await newAccountWithTokens(connection); const destOwner = await newAccountWithLamports(connection);
{ {
// mock SystemProgram.createAccount transaction for Token.newAccount() // mock SystemProgram.createAccount transaction for Token.newAccount()
@ -309,7 +309,7 @@ test('transfer', async () => {
error: null, error: null,
result: { result: {
owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()], owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()],
tokens: 1, lamports: 1,
userdata: [ userdata: [
2, 2,
...testToken.token.toBuffer(), ...testToken.token.toBuffer(),
@ -348,7 +348,7 @@ test('transfer', async () => {
error: null, error: null,
result: { result: {
owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()], owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()],
tokens: 1, lamports: 1,
userdata: [ userdata: [
2, 2,
...testToken.token.toBuffer(), ...testToken.token.toBuffer(),
@ -378,7 +378,7 @@ test('transfer', async () => {
test('approve/revoke', async () => { test('approve/revoke', async () => {
const connection = new Connection(url); const connection = new Connection(url);
connection._disableBlockhashCaching = mockRpcEnabled; connection._disableBlockhashCaching = mockRpcEnabled;
const delegateOwner = await newAccountWithTokens(connection); const delegateOwner = await newAccountWithLamports(connection);
{ {
// mock SystemProgram.createAccount transaction for Token.newAccount() // mock SystemProgram.createAccount transaction for Token.newAccount()
@ -419,7 +419,7 @@ test('approve/revoke', async () => {
error: null, error: null,
result: { result: {
owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()], owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()],
tokens: 1, lamports: 1,
userdata: [ userdata: [
2, 2,
...testToken.token.toBuffer(), ...testToken.token.toBuffer(),
@ -481,7 +481,7 @@ test('approve/revoke', async () => {
error: null, error: null,
result: { result: {
owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()], owner: [...SYSTEM_TOKEN_PROGRAM_ID.toBuffer()],
tokens: 1, lamports: 1,
userdata: [ userdata: [
2, 2,
...testToken.token.toBuffer(), ...testToken.token.toBuffer(),
@ -530,7 +530,7 @@ test('invalid approve', async () => {
} }
const connection = new Connection(url); const connection = new Connection(url);
const owner = await newAccountWithTokens(connection); const owner = await newAccountWithLamports(connection);
const account1 = await testToken.newAccount(owner); const account1 = await testToken.newAccount(owner);
const account1Delegate = await testToken.newAccount(owner, account1); const account1Delegate = await testToken.newAccount(owner, account1);
@ -554,7 +554,7 @@ test('fail on approve overspend', async () => {
} }
const connection = new Connection(url); const connection = new Connection(url);
const owner = await newAccountWithTokens(connection); const owner = await newAccountWithLamports(connection);
const account1 = await testToken.newAccount(owner); const account1 = await testToken.newAccount(owner);
const account1Delegate = await testToken.newAccount(owner, account1); const account1Delegate = await testToken.newAccount(owner, account1);
@ -597,8 +597,8 @@ test('set owner', async () => {
} }
const connection = new Connection(url); const connection = new Connection(url);
const owner = await newAccountWithTokens(connection); const owner = await newAccountWithLamports(connection);
const newOwner = await newAccountWithTokens(connection); const newOwner = await newAccountWithLamports(connection);
const account = await testToken.newAccount(owner); const account = await testToken.newAccount(owner);