fix: Appease flow
This commit is contained in:
parent
41d14bec22
commit
78ad376bcd
|
@ -77,7 +77,7 @@ type SignaturePubkeyPair = {|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
type TransactionCtorFields = {|
|
type TransactionCtorFields = {|
|
||||||
recentBlockhash?: Blockhash,
|
recentBlockhash?: Blockhash | null,
|
||||||
signatures?: Array<SignaturePubkeyPair>,
|
signatures?: Array<SignaturePubkeyPair>,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ export class Transaction {
|
||||||
/**
|
/**
|
||||||
* A recent transaction id. Must be populated by the caller
|
* A recent transaction id. Must be populated by the caller
|
||||||
*/
|
*/
|
||||||
recentBlockhash: ?Blockhash;
|
recentBlockhash: Blockhash | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an empty Transaction
|
* Construct an empty Transaction
|
||||||
|
@ -122,7 +122,9 @@ export class Transaction {
|
||||||
* Add one or more instructions to this Transaction
|
* Add one or more instructions to this Transaction
|
||||||
*/
|
*/
|
||||||
add(
|
add(
|
||||||
...items: Array<Transaction | TransactionInstructionCtorFields>
|
...items: Array<
|
||||||
|
Transaction | TransactionInstruction | TransactionInstructionCtorFields,
|
||||||
|
>
|
||||||
): Transaction {
|
): Transaction {
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
throw new Error('No instructions');
|
throw new Error('No instructions');
|
||||||
|
@ -131,6 +133,8 @@ export class Transaction {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (item instanceof Transaction) {
|
if (item instanceof Transaction) {
|
||||||
this.instructions = this.instructions.concat(item.instructions);
|
this.instructions = this.instructions.concat(item.instructions);
|
||||||
|
} else if (item instanceof TransactionInstruction) {
|
||||||
|
this.instructions.push(item);
|
||||||
} else {
|
} else {
|
||||||
this.instructions.push(new TransactionInstruction(item));
|
this.instructions.push(new TransactionInstruction(item));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue