feat: update commitment variants (#15253)

* feat: update commitment variants

* fix: make pretty

* fix: deprecate, but leave in commitment types
This commit is contained in:
Josh
2021-02-17 16:15:09 -08:00
committed by GitHub
parent 7f7370c306
commit 8c8f8f3130
12 changed files with 132 additions and 126 deletions

View File

@@ -22,7 +22,7 @@ if (process.env.TEST_LIVE) {
it('load BPF C program', async () => {
const data = await fs.readFile('test/fixtures/noop-c/noop.so');
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
const {feeCalculator} = await connection.getRecentBlockhash();
const fees =
feeCalculator.lamportsPerSignature *
@@ -59,13 +59,13 @@ if (process.env.TEST_LIVE) {
programId: program.publicKey,
});
await sendAndConfirmTransaction(connection, transaction, [from], {
commitment: 'singleGossip',
preflightCommitment: 'singleGossip',
commitment: 'confirmed',
preflightCommitment: 'confirmed',
});
}).timeout(5000);
describe('load BPF Rust program', () => {
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
let program = new Account();
let payerAccount = new Account();
@@ -141,8 +141,8 @@ if (process.env.TEST_LIVE) {
transaction,
[payerAccount],
{
commitment: 'max', // `getParsedConfirmedTransaction` requires max commitment
preflightCommitment: connection.commitment || 'max',
commitment: 'finalized', // `getParsedConfirmedTransaction` requires max commitment
preflightCommitment: connection.commitment || 'finalized',
},
);

View File

@@ -125,7 +125,7 @@ describe('Connection', () => {
connection,
transaction,
signers: [account0],
commitment: 'singleGossip',
commitment: 'confirmed',
});
}
@@ -147,7 +147,7 @@ describe('Connection', () => {
connection,
transaction,
signers: [account1],
commitment: 'singleGossip',
commitment: 'confirmed',
});
}
@@ -159,7 +159,7 @@ describe('Connection', () => {
method: 'getProgramAccounts',
params: [
programId.publicKey.toBase58(),
{commitment: 'singleGossip', encoding: 'base64'},
{commitment: 'confirmed', encoding: 'base64'},
],
value: [
{
@@ -188,7 +188,7 @@ describe('Connection', () => {
const programAccounts = await connection.getProgramAccounts(
programId.publicKey,
'singleGossip',
'confirmed',
);
expect(programAccounts).to.have.length(2);
programAccounts.forEach(function (keyedAccount) {
@@ -210,7 +210,7 @@ describe('Connection', () => {
method: 'getProgramAccounts',
params: [
programId.publicKey.toBase58(),
{commitment: 'singleGossip', encoding: 'jsonParsed'},
{commitment: 'confirmed', encoding: 'jsonParsed'},
],
value: [
{
@@ -239,7 +239,7 @@ describe('Connection', () => {
const programAccounts = await connection.getParsedProgramAccounts(
programId.publicKey,
'singleGossip',
'confirmed',
);
expect(programAccounts).to.have.length(2);
@@ -319,7 +319,7 @@ describe('Connection', () => {
it('get epoch info', async () => {
await mockRpcResponse({
method: 'getEpochInfo',
params: [{commitment: 'singleGossip'}],
params: [{commitment: 'confirmed'}],
value: {
epoch: 0,
slotIndex: 1,
@@ -329,7 +329,7 @@ describe('Connection', () => {
},
});
const epochInfo = await connection.getEpochInfo('singleGossip');
const epochInfo = await connection.getEpochInfo('confirmed');
for (const key of [
'epoch',
@@ -1012,13 +1012,7 @@ describe('Connection', () => {
});
it('get recent blockhash', async () => {
for (const commitment of [
'max',
'singleGossip',
'root',
'single',
'singleGossip',
]) {
for (const commitment of ['processed', 'confirmed', 'finalized']) {
const {blockhash, feeCalculator} = await helpers.recentBlockhash({
connection,
commitment,
@@ -1032,7 +1026,7 @@ describe('Connection', () => {
const {blockhash} = await helpers.recentBlockhash({connection});
await mockRpcResponse({
method: 'getFeeCalculatorForBlockhash',
params: [blockhash, {commitment: 'singleGossip'}],
params: [blockhash, {commitment: 'confirmed'}],
value: {
feeCalculator: {
lamportsPerSignature: 5000,
@@ -1042,7 +1036,7 @@ describe('Connection', () => {
});
const feeCalculator = (
await connection.getFeeCalculatorForBlockhash(blockhash, 'singleGossip')
await connection.getFeeCalculatorForBlockhash(blockhash, 'confirmed')
).value;
if (feeCalculator === null) {
expect(feeCalculator).not.to.be.null;
@@ -1149,7 +1143,7 @@ describe('Connection', () => {
if (process.env.TEST_LIVE) {
describe('token methods', () => {
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
const newAccount = new Account().publicKey;
let testToken: Token;
@@ -1205,7 +1199,7 @@ describe('Connection', () => {
new u64(1),
);
await connection.confirmTransaction(testSignature, 'max');
await connection.confirmTransaction(testSignature, 'finalized');
testOwner = accountOwner;
testToken = token;
@@ -1421,7 +1415,7 @@ describe('Connection', () => {
authorized.publicKey,
2 * LAMPORTS_PER_SOL,
);
await connection.confirmTransaction(signature, 'singleGossip');
await connection.confirmTransaction(signature, 'confirmed');
const minimumAmount = await connection.getMinimumBalanceForRentExemption(
StakeProgram.space,
@@ -1441,8 +1435,8 @@ describe('Connection', () => {
createAndInitialize,
[authorized, newStakeAccount],
{
preflightCommitment: 'singleGossip',
commitment: 'singleGossip',
preflightCommitment: 'confirmed',
commitment: 'confirmed',
},
);
let delegation = StakeProgram.delegate({
@@ -1451,15 +1445,15 @@ describe('Connection', () => {
votePubkey,
});
await sendAndConfirmTransaction(connection, delegation, [authorized], {
preflightCommitment: 'singleGossip',
commitment: 'singleGossip',
preflightCommitment: 'confirmed',
commitment: 'confirmed',
});
const LARGE_EPOCH = 4000;
await expect(
connection.getStakeActivation(
newStakeAccount.publicKey,
'singleGossip',
'confirmed',
LARGE_EPOCH,
),
).to.be.rejectedWith(
@@ -1468,7 +1462,7 @@ describe('Connection', () => {
const activationState = await connection.getStakeActivation(
newStakeAccount.publicKey,
'singleGossip',
'confirmed',
);
expect(activationState.state).to.eq('activating');
expect(activationState.inactive).to.eq(42);
@@ -1495,15 +1489,15 @@ describe('Connection', () => {
await addStakeActivationMock('active');
let activation = await connection.getStakeActivation(
publicKey,
'singleGossip',
'confirmed',
);
expect(activation.state).to.eq('active');
expect(activation.active).to.eq(0);
expect(activation.inactive).to.eq(80);
await addStakeActivationMock('invalid');
await expect(connection.getStakeActivation(publicKey, 'singleGossip')).to
.be.rejected;
await expect(connection.getStakeActivation(publicKey, 'confirmed')).to.be
.rejected;
});
}
@@ -1529,22 +1523,19 @@ describe('Connection', () => {
await mockRpcResponse({
method: 'getBalance',
params: [account.publicKey.toBase58(), {commitment: 'singleGossip'}],
params: [account.publicKey.toBase58(), {commitment: 'confirmed'}],
value: LAMPORTS_PER_SOL,
withContext: true,
});
const balance = await connection.getBalance(
account.publicKey,
'singleGossip',
);
const balance = await connection.getBalance(account.publicKey, 'confirmed');
expect(balance).to.eq(LAMPORTS_PER_SOL);
await mockRpcResponse({
method: 'getAccountInfo',
params: [
account.publicKey.toBase58(),
{commitment: 'singleGossip', encoding: 'base64'},
{commitment: 'confirmed', encoding: 'base64'},
],
value: {
owner: '11111111111111111111111111111111',
@@ -1557,7 +1548,7 @@ describe('Connection', () => {
const accountInfo = await connection.getAccountInfo(
account.publicKey,
'singleGossip',
'confirmed',
);
if (accountInfo === null) {
expect(accountInfo).not.to.be.null;
@@ -1571,7 +1562,7 @@ describe('Connection', () => {
method: 'getAccountInfo',
params: [
account.publicKey.toBase58(),
{commitment: 'singleGossip', encoding: 'jsonParsed'},
{commitment: 'confirmed', encoding: 'jsonParsed'},
],
value: {
owner: '11111111111111111111111111111111',
@@ -1583,7 +1574,7 @@ describe('Connection', () => {
});
const parsedAccountInfo = (
await connection.getParsedAccountInfo(account.publicKey, 'singleGossip')
await connection.getParsedAccountInfo(account.publicKey, 'confirmed')
).value;
if (parsedAccountInfo === null) {
expect(parsedAccountInfo).not.to.be.null;
@@ -1621,7 +1612,7 @@ describe('Connection', () => {
connection,
transaction,
signers: [payer, newAccount],
commitment: 'singleGossip',
commitment: 'confirmed',
});
// This should fail because the account is already created
@@ -1631,7 +1622,7 @@ describe('Connection', () => {
connection,
transaction,
signers: [payer, newAccount],
commitment: 'singleGossip',
commitment: 'confirmed',
err: expectedErr,
})
).value;
@@ -1658,7 +1649,7 @@ describe('Connection', () => {
if (process.env.TEST_LIVE) {
it('transaction', async () => {
connection._commitment = 'singleGossip';
connection._commitment = 'confirmed';
const accountFrom = new Account();
const accountTo = new Account();
@@ -1689,7 +1680,7 @@ describe('Connection', () => {
connection,
transaction,
[accountFrom],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
// Send again and ensure that new blockhash is used
@@ -1706,7 +1697,7 @@ describe('Connection', () => {
connection,
transaction2,
[accountFrom],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
expect(signature).not.to.eq(signature2);
@@ -1723,7 +1714,7 @@ describe('Connection', () => {
}),
);
await sendAndConfirmTransaction(connection, transaction3, [accountFrom], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
expect(transaction2.recentBlockhash).to.eq(transaction3.recentBlockhash);
@@ -1744,7 +1735,7 @@ describe('Connection', () => {
);
await sendAndConfirmTransaction(connection, transaction4, [accountFrom], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
expect(transaction4.recentBlockhash).not.to.eq(
@@ -1761,7 +1752,7 @@ describe('Connection', () => {
}).timeout(45 * 1000); // waits 30s for cache timeout
it('multi-instruction transaction', async () => {
connection._commitment = 'singleGossip';
connection._commitment = 'confirmed';
const accountFrom = new Account();
const accountTo = new Account();
@@ -1840,7 +1831,7 @@ describe('Connection', () => {
// return;
// }
// const connection = new Connection(url, 'singleGossip');
// const connection = new Connection(url, 'confirmed');
// const owner = new Account();
// const programAccount = new Account();
@@ -1849,7 +1840,7 @@ describe('Connection', () => {
// const subscriptionId = connection.onAccountChange(
// programAccount.publicKey,
// mockCallback,
// 'singleGossip',
// 'confirmed',
// );
// const balanceNeeded = Math.max(
@@ -1871,7 +1862,7 @@ describe('Connection', () => {
// }),
// );
// await sendAndConfirmTransaction(connection, transaction, [owner], {
// commitment: 'singleGossip',
// commitment: 'confirmed',
// });
// } catch (err) {
// await connection.removeAccountChangeListener(subscriptionId);
@@ -1900,7 +1891,7 @@ describe('Connection', () => {
// });
it('program account change notification', async () => {
connection._commitment = 'singleGossip';
connection._commitment = 'confirmed';
const owner = new Account();
const programAccount = new Account();
@@ -1942,7 +1933,7 @@ describe('Connection', () => {
}),
);
await sendAndConfirmTransaction(connection, transaction, [owner], {
commitment: 'singleGossip',
commitment: 'confirmed',
});
} catch (err) {
await connection.removeProgramAccountChangeListener(subscriptionId);

View File

@@ -162,11 +162,11 @@ const airdrop = async ({
await mockRpcMessage({
method: 'signatureSubscribe',
params: [signature, {commitment: 'singleGossip'}],
params: [signature, {commitment: 'confirmed'}],
result: {err: null},
});
await connection.confirmTransaction(signature, 'singleGossip');
await connection.confirmTransaction(signature, 'confirmed');
return signature;
};

View File

@@ -78,14 +78,14 @@ describe('Nonce', () => {
connection,
transaction,
signers: [from, nonceAccount],
commitment: 'singleGossip',
commitment: 'confirmed',
});
await mockRpcResponse({
method: 'getAccountInfo',
params: [
nonceAccount.publicKey.toBase58(),
{encoding: 'base64', commitment: 'singleGossip'},
{encoding: 'base64', commitment: 'confirmed'},
],
value: {
owner: '11111111111111111111111111111111',
@@ -98,7 +98,7 @@ describe('Nonce', () => {
const nonceAccountData = await connection.getNonce(
nonceAccount.publicKey,
'singleGossip',
'confirmed',
);
if (nonceAccountData === null) {
expect(nonceAccountData).not.to.be.null;
@@ -148,14 +148,14 @@ describe('Nonce', () => {
connection,
transaction,
signers: [from],
commitment: 'singleGossip',
commitment: 'confirmed',
});
await mockRpcResponse({
method: 'getAccountInfo',
params: [
noncePubkey.toBase58(),
{encoding: 'base64', commitment: 'singleGossip'},
{encoding: 'base64', commitment: 'confirmed'},
],
value: {
owner: '11111111111111111111111111111111',
@@ -168,7 +168,7 @@ describe('Nonce', () => {
const nonceAccountData = await connection.getNonce(
noncePubkey,
'singleGossip',
'confirmed',
);
if (nonceAccountData === null) {
expect(nonceAccountData).not.to.be.null;

View File

@@ -33,12 +33,12 @@ if (process.env.TEST_LIVE) {
keccak_256.update(toBuffer(message)).digest(),
);
const {signature, recid: recoveryId} = ecdsaSign(messageHash, privateKey);
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
const from = new Account();
await connection.confirmTransaction(
await connection.requestAirdrop(from.publicKey, 2 * LAMPORTS_PER_SOL),
'singleGossip',
'confirmed',
);
const transaction = new Transaction().add(
@@ -51,19 +51,19 @@ if (process.env.TEST_LIVE) {
);
await sendAndConfirmTransaction(connection, transaction, [from], {
commitment: 'singleGossip',
preflightCommitment: 'singleGossip',
commitment: 'confirmed',
preflightCommitment: 'confirmed',
});
});
it('create secp256k1 instruction with private key', async () => {
const privateKey = randomPrivateKey();
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
const from = new Account();
await connection.confirmTransaction(
await connection.requestAirdrop(from.publicKey, 2 * LAMPORTS_PER_SOL),
'singleGossip',
'confirmed',
);
const transaction = new Transaction().add(
@@ -74,8 +74,8 @@ if (process.env.TEST_LIVE) {
);
await sendAndConfirmTransaction(connection, transaction, [from], {
commitment: 'singleGossip',
preflightCommitment: 'singleGossip',
commitment: 'confirmed',
preflightCommitment: 'confirmed',
});
});
});

View File

@@ -326,7 +326,7 @@ describe('StakeProgram', () => {
if (process.env.TEST_LIVE) {
it('live staking actions', async () => {
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
const voteAccounts = await connection.getVoteAccounts();
const voteAccount = voteAccounts.current.concat(
@@ -377,7 +377,7 @@ describe('StakeProgram', () => {
connection,
createAndInitialize,
[payer, newStakeAccount],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
expect(await connection.getBalance(newStakeAccount.publicKey)).to.eq(
minimumAmount + 42,
@@ -389,7 +389,7 @@ describe('StakeProgram', () => {
votePubkey,
});
await sendAndConfirmTransaction(connection, delegation, [authorized], {
commitment: 'singleGossip',
commitment: 'confirmed',
});
}
@@ -415,7 +415,7 @@ describe('StakeProgram', () => {
connection,
createAndInitializeWithSeed,
[payer],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
let originalStakeBalance = await connection.getBalance(newAccountPubkey);
expect(originalStakeBalance).to.eq(3 * minimumAmount + 42);
@@ -426,7 +426,7 @@ describe('StakeProgram', () => {
votePubkey,
});
await sendAndConfirmTransaction(connection, delegation, [authorized], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
// Test that withdraw fails before deactivation
@@ -439,7 +439,7 @@ describe('StakeProgram', () => {
});
await expect(
sendAndConfirmTransaction(connection, withdraw, [authorized], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
}),
).to.be.rejected;
@@ -449,7 +449,7 @@ describe('StakeProgram', () => {
authorizedPubkey: authorized.publicKey,
});
await sendAndConfirmTransaction(connection, deactivate, [authorized], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
let stakeActivationState;
@@ -468,7 +468,7 @@ describe('StakeProgram', () => {
});
await sendAndConfirmTransaction(connection, withdraw, [authorized], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
const recipientBalance = await connection.getBalance(recipient.publicKey);
expect(recipientBalance).to.eq(minimumAmount + 20);
@@ -486,7 +486,7 @@ describe('StakeProgram', () => {
split,
[authorized, newStake],
{
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
},
);
const balance = await connection.getBalance(newAccountPubkey);
@@ -506,7 +506,7 @@ describe('StakeProgram', () => {
stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,
});
await sendAndConfirmTransaction(connection, authorize, [authorized], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
authorize = StakeProgram.authorize({
stakePubkey: newAccountPubkey,
@@ -515,7 +515,7 @@ describe('StakeProgram', () => {
stakeAuthorizationType: StakeAuthorizationLayout.Staker,
});
await sendAndConfirmTransaction(connection, authorize, [authorized], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
// Test old authorized can't delegate
@@ -530,7 +530,7 @@ describe('StakeProgram', () => {
delegateNotAuthorized,
[authorized],
{
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
},
),
).to.be.rejected;
@@ -543,7 +543,7 @@ describe('StakeProgram', () => {
stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,
});
await sendAndConfirmTransaction(connection, authorize, [newAuthorized], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
// Restore the previous authority using a derived address
@@ -556,7 +556,7 @@ describe('StakeProgram', () => {
stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,
});
await sendAndConfirmTransaction(connection, authorize, [payer], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
}).timeout(10 * 1000);
}

View File

@@ -290,7 +290,7 @@ describe('SystemProgram', () => {
if (process.env.TEST_LIVE) {
it('live Nonce actions', async () => {
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
const nonceAccount = new Account();
const from = new Account();
await helpers.airdrop({
@@ -323,7 +323,7 @@ describe('SystemProgram', () => {
connection,
createNonceAccount,
[from, nonceAccount],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
const nonceBalance = await connection.getBalance(nonceAccount.publicKey);
expect(nonceBalance).to.eq(minimumAmount);
@@ -352,7 +352,7 @@ describe('SystemProgram', () => {
}),
);
await sendAndConfirmTransaction(connection, advanceNonce, [from], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
const nonceQuery3 = await connection.getNonce(nonceAccount.publicKey);
if (nonceQuery3 === null) {
@@ -373,7 +373,7 @@ describe('SystemProgram', () => {
}),
);
await sendAndConfirmTransaction(connection, authorizeNonce, [from], {
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
});
let transfer = new Transaction().add(
@@ -396,7 +396,7 @@ describe('SystemProgram', () => {
transfer,
[from, newAuthority],
{
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
},
);
const toBalance = await connection.getBalance(to.publicKey);
@@ -419,7 +419,7 @@ describe('SystemProgram', () => {
withdrawNonce,
[newAuthority],
{
preflightCommitment: 'singleGossip',
preflightCommitment: 'confirmed',
},
);
expect(await connection.getBalance(nonceAccount.publicKey)).to.eq(0);
@@ -430,7 +430,7 @@ describe('SystemProgram', () => {
}).timeout(10 * 1000);
it('live withSeed actions', async () => {
const connection = new Connection(url, 'singleGossip');
const connection = new Connection(url, 'confirmed');
const baseAccount = new Account();
await helpers.airdrop({
connection,
@@ -468,7 +468,7 @@ describe('SystemProgram', () => {
connection,
createAccountWithSeedTransaction,
[baseAccount],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
const createAccountWithSeedBalance = await connection.getBalance(
createAccountWithSeedAddress,
@@ -492,7 +492,7 @@ describe('SystemProgram', () => {
}),
),
[baseAccount],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
let transferWithSeedAddressBalance = await connection.getBalance(
transferWithSeedAddress,
@@ -521,7 +521,7 @@ describe('SystemProgram', () => {
connection,
transferWithSeedTransaction,
[baseAccount],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
const toBalance = await connection.getBalance(toPubkey);
expect(toBalance).to.eq(2 * minimumAmount);
@@ -545,7 +545,7 @@ describe('SystemProgram', () => {
connection,
allocateWithSeedTransaction,
[baseAccount],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
let account = await connection.getAccountInfo(toPubkey);
if (account === null) {
@@ -568,7 +568,7 @@ describe('SystemProgram', () => {
connection,
assignWithSeedTransaction,
[baseAccount],
{preflightCommitment: 'singleGossip'},
{preflightCommitment: 'confirmed'},
);
account = await connection.getAccountInfo(toPubkey);
if (account === null) {

View File

@@ -75,7 +75,7 @@ describe('Transaction Payer', () => {
connection,
transaction,
signers: [accountPayer, accountFrom],
commitment: 'singleGossip',
commitment: 'confirmed',
});
const signature = base58.encode(transaction.signature);
@@ -103,7 +103,7 @@ describe('Transaction Payer', () => {
await mockRpcResponse({
method: 'getBalance',
params: [accountPayer.publicKey.toBase58(), {commitment: 'singleGossip'}],
params: [accountPayer.publicKey.toBase58(), {commitment: 'confirmed'}],
value: LAMPORTS_PER_SOL - 1,
withContext: true,
});
@@ -112,7 +112,7 @@ describe('Transaction Payer', () => {
// (exact amount less depends on the current cluster fees)
const balance = await connection.getBalance(
accountPayer.publicKey,
'singleGossip',
'confirmed',
);
expect(balance).to.be.greaterThan(0);
expect(balance).to.be.at.most(LAMPORTS_PER_SOL);
@@ -120,12 +120,12 @@ describe('Transaction Payer', () => {
// accountFrom should have exactly 2, since it didn't pay for the transaction
await mockRpcResponse({
method: 'getBalance',
params: [accountFrom.publicKey.toBase58(), {commitment: 'singleGossip'}],
params: [accountFrom.publicKey.toBase58(), {commitment: 'confirmed'}],
value: minimumAmount + 2,
withContext: true,
});
expect(
await connection.getBalance(accountFrom.publicKey, 'singleGossip'),
await connection.getBalance(accountFrom.publicKey, 'confirmed'),
).to.eq(minimumAmount + 2);
});
});