fix: ingest only the relevant properties when constructing `Transactions`
This commit is contained in:
parent
5f3b7bdd16
commit
6f6e5172d3
|
@ -258,17 +258,25 @@ export class Transaction {
|
||||||
) {
|
) {
|
||||||
if (!opts) {
|
if (!opts) {
|
||||||
return;
|
return;
|
||||||
} else if (
|
}
|
||||||
Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')
|
if (opts.feePayer) {
|
||||||
) {
|
this.feePayer = opts.feePayer;
|
||||||
const newOpts = opts as TransactionBlockhashCtor;
|
}
|
||||||
Object.assign(this, newOpts);
|
if (opts.signatures) {
|
||||||
this.recentBlockhash = newOpts.blockhash;
|
this.signatures = opts.signatures;
|
||||||
this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
|
||||||
|
const {blockhash, lastValidBlockHeight} =
|
||||||
|
opts as TransactionBlockhashCtor;
|
||||||
|
this.recentBlockhash = blockhash;
|
||||||
|
this.lastValidBlockHeight = lastValidBlockHeight;
|
||||||
} else {
|
} else {
|
||||||
const oldOpts = opts as TransactionCtorFields_DEPRECATED;
|
const {recentBlockhash, nonceInfo} =
|
||||||
Object.assign(this, oldOpts);
|
opts as TransactionCtorFields_DEPRECATED;
|
||||||
this.recentBlockhash = oldOpts.recentBlockhash;
|
if (nonceInfo) {
|
||||||
|
this.nonceInfo = nonceInfo;
|
||||||
|
}
|
||||||
|
this.recentBlockhash = recentBlockhash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue