diff --git a/web3.js/src/transaction.ts b/web3.js/src/transaction.ts index 972227ce00..1a91cb5bcf 100644 --- a/web3.js/src/transaction.ts +++ b/web3.js/src/transaction.ts @@ -214,7 +214,7 @@ export class Transaction { } if (this.instructions.length < 1) { - throw new Error('No instructions provided'); + console.warn('No instructions provided'); } let feePayer: PublicKey; diff --git a/web3.js/test/transaction.test.ts b/web3.js/test/transaction.test.ts index c1e0a25016..35f484eff6 100644 --- a/web3.js/test/transaction.test.ts +++ b/web3.js/test/transaction.test.ts @@ -65,9 +65,7 @@ describe('Transaction', () => { it('validation', () => { const payer = Keypair.generate(); - const other = Keypair.generate(); const recentBlockhash = Keypair.generate().publicKey.toBase58(); - const programId = Keypair.generate().publicKey; const transaction = new Transaction(); expect(() => { @@ -76,18 +74,6 @@ describe('Transaction', () => { transaction.recentBlockhash = recentBlockhash; - expect(() => { - transaction.compileMessage(); - }).to.throw('No instructions provided'); - - transaction.add({ - keys: [ - {pubkey: other.publicKey, isSigner: true, isWritable: true}, - {pubkey: payer.publicKey, isSigner: true, isWritable: true}, - ], - programId, - }); - expect(() => { transaction.compileMessage(); }).to.throw('Transaction fee payer required');