@solana/web3.js 1.39.0 → 1.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.iife.js CHANGED
@@ -14044,6 +14044,26 @@ var solanaWeb3 = (function (exports) {
14044
14044
  this.data = opts.data;
14045
14045
  }
14046
14046
  }
14047
+ /**
14048
+ * @internal
14049
+ */
14050
+
14051
+
14052
+ toJSON() {
14053
+ return {
14054
+ keys: this.keys.map(({
14055
+ pubkey,
14056
+ isSigner,
14057
+ isWritable
14058
+ }) => ({
14059
+ pubkey: pubkey.toJSON(),
14060
+ isSigner,
14061
+ isWritable
14062
+ })),
14063
+ programId: this.programId.toJSON(),
14064
+ data: [...this.data]
14065
+ };
14066
+ }
14047
14067
 
14048
14068
  }
14049
14069
  /**
@@ -14083,8 +14103,33 @@ var solanaWeb3 = (function (exports) {
14083
14103
  this.instructions = [];
14084
14104
  this.recentBlockhash = void 0;
14085
14105
  this.nonceInfo = void 0;
14106
+ this._message = void 0;
14107
+ this._json = void 0;
14086
14108
  opts && Object.assign(this, opts);
14087
14109
  }
14110
+ /**
14111
+ * @internal
14112
+ */
14113
+
14114
+
14115
+ toJSON() {
14116
+ return {
14117
+ recentBlockhash: this.recentBlockhash || null,
14118
+ feePayer: this.feePayer ? this.feePayer.toJSON() : null,
14119
+ nonceInfo: this.nonceInfo ? {
14120
+ nonce: this.nonceInfo.nonce,
14121
+ nonceInstruction: this.nonceInfo.nonceInstruction.toJSON()
14122
+ } : null,
14123
+ instructions: this.instructions.map(instruction => instruction.toJSON()),
14124
+ signatures: this.signatures.map(({
14125
+ publicKey,
14126
+ signature
14127
+ }) => ({
14128
+ publicKey: publicKey.toJSON(),
14129
+ signature: signature ? [...signature] : null
14130
+ }))
14131
+ };
14132
+ }
14088
14133
  /**
14089
14134
  * Add one or more instructions to this Transaction
14090
14135
  */
@@ -14112,6 +14157,14 @@ var solanaWeb3 = (function (exports) {
14112
14157
 
14113
14158
 
14114
14159
  compileMessage() {
14160
+ if (this._message) {
14161
+ if (JSON.stringify(this.toJSON()) !== JSON.stringify(this._json)) {
14162
+ throw new Error('Transaction mutated after being populated from Message');
14163
+ }
14164
+
14165
+ return this._message;
14166
+ }
14167
+
14115
14168
  const {
14116
14169
  nonceInfo
14117
14170
  } = this;
@@ -14633,6 +14686,8 @@ var solanaWeb3 = (function (exports) {
14633
14686
  data: bs58$1.decode(instruction.data)
14634
14687
  }));
14635
14688
  });
14689
+ transaction._message = message;
14690
+ transaction._json = transaction.toJSON();
14636
14691
  return transaction;
14637
14692
  }
14638
14693
 
@@ -22526,7 +22581,9 @@ var solanaWeb3 = (function (exports) {
22526
22581
  });
22527
22582
  transaction.instructions = transactionOrMessage.instructions;
22528
22583
  } else {
22529
- transaction = Transaction.populate(transactionOrMessage);
22584
+ transaction = Transaction.populate(transactionOrMessage); // HACK: this function relies on mutating the populated transaction
22585
+
22586
+ transaction._message = transaction._json = undefined;
22530
22587
  }
22531
22588
 
22532
22589
  if (transaction.nonceInfo && signers) {