fix: allow messages to be compiled without instructions (#17621)
* fix: allow messages to be compiled without instructions * chore: fix tests
This commit is contained in:
parent
19c49e2e25
commit
3e13cde988
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue