feat: allow setting explicit fee payer for transaction (#13129)

This commit is contained in:
Justin Starry
2020-10-25 09:59:38 +08:00
committed by GitHub
parent 0cc9c94c43
commit 6e13dbe206
7 changed files with 225 additions and 90 deletions

View File

@@ -176,7 +176,7 @@ describe('load BPF Rust program', () => {
);
});
test('simulate transaction without signature verification', async () => {
test('deprecated - simulate transaction without signature verification', async () => {
const simulatedTransaction = new Transaction().add({
keys: [
{pubkey: payerAccount.publicKey, isSigner: true, isWritable: true},
@@ -202,6 +202,33 @@ describe('load BPF Rust program', () => {
);
});
test('simulate transaction without signature verification', async () => {
const simulatedTransaction = new Transaction({
feePayer: payerAccount.publicKey,
}).add({
keys: [
{pubkey: payerAccount.publicKey, isSigner: true, isWritable: true},
],
programId: program.publicKey,
});
const {err, logs} = (
await connection.simulateTransaction(simulatedTransaction)
).value;
expect(err).toBeNull();
if (logs === null) {
expect(logs).not.toBeNull();
return;
}
expect(logs.length).toBeGreaterThanOrEqual(2);
expect(logs[0]).toEqual(`Call BPF program ${program.publicKey.toBase58()}`);
expect(logs[logs.length - 1]).toEqual(
`BPF program ${program.publicKey.toBase58()} success`,
);
});
test('simulate transaction with bad programId', async () => {
const simulatedTransaction = new Transaction().add({
keys: [