@solana/web3.js 1.44.1 → 1.45.0

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
@@ -14201,24 +14201,27 @@ var solanaWeb3 = (function (exports) {
14201
14201
  return this._message;
14202
14202
  }
14203
14203
 
14204
- const {
14205
- nonceInfo
14206
- } = this;
14204
+ let recentBlockhash;
14205
+ let instructions;
14207
14206
 
14208
- if (nonceInfo && this.instructions[0] != nonceInfo.nonceInstruction) {
14209
- this.recentBlockhash = nonceInfo.nonce;
14210
- this.instructions.unshift(nonceInfo.nonceInstruction);
14211
- }
14207
+ if (this.nonceInfo) {
14208
+ recentBlockhash = this.nonceInfo.nonce;
14212
14209
 
14213
- const {
14214
- recentBlockhash
14215
- } = this;
14210
+ if (this.instructions[0] != this.nonceInfo.nonceInstruction) {
14211
+ instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];
14212
+ } else {
14213
+ instructions = this.instructions;
14214
+ }
14215
+ } else {
14216
+ recentBlockhash = this.recentBlockhash;
14217
+ instructions = this.instructions;
14218
+ }
14216
14219
 
14217
14220
  if (!recentBlockhash) {
14218
14221
  throw new Error('Transaction recentBlockhash required');
14219
14222
  }
14220
14223
 
14221
- if (this.instructions.length < 1) {
14224
+ if (instructions.length < 1) {
14222
14225
  console.warn('No instructions provided');
14223
14226
  }
14224
14227
 
@@ -14233,15 +14236,15 @@ var solanaWeb3 = (function (exports) {
14233
14236
  throw new Error('Transaction fee payer required');
14234
14237
  }
14235
14238
 
14236
- for (let i = 0; i < this.instructions.length; i++) {
14237
- if (this.instructions[i].programId === undefined) {
14239
+ for (let i = 0; i < instructions.length; i++) {
14240
+ if (instructions[i].programId === undefined) {
14238
14241
  throw new Error(`Transaction instruction index ${i} has undefined program id`);
14239
14242
  }
14240
14243
  }
14241
14244
 
14242
14245
  const programIds = [];
14243
14246
  const accountMetas = [];
14244
- this.instructions.forEach(instruction => {
14247
+ instructions.forEach(instruction => {
14245
14248
  instruction.keys.forEach(accountMeta => {
14246
14249
  accountMetas.push({ ...accountMeta
14247
14250
  });
@@ -14351,7 +14354,7 @@ var solanaWeb3 = (function (exports) {
14351
14354
  }
14352
14355
  });
14353
14356
  const accountKeys = signedKeys.concat(unsignedKeys);
14354
- const instructions = this.instructions.map(instruction => {
14357
+ const compiledInstructions = instructions.map(instruction => {
14355
14358
  const {
14356
14359
  data,
14357
14360
  programId
@@ -14362,7 +14365,7 @@ var solanaWeb3 = (function (exports) {
14362
14365
  data: bs58$1.encode(data)
14363
14366
  };
14364
14367
  });
14365
- instructions.forEach(instruction => {
14368
+ compiledInstructions.forEach(instruction => {
14366
14369
  assert$c(instruction.programIdIndex >= 0);
14367
14370
  instruction.accounts.forEach(keyIndex => assert$c(keyIndex >= 0));
14368
14371
  });
@@ -14374,7 +14377,7 @@ var solanaWeb3 = (function (exports) {
14374
14377
  },
14375
14378
  accountKeys,
14376
14379
  recentBlockhash,
14377
- instructions
14380
+ instructions: compiledInstructions
14378
14381
  });
14379
14382
  }
14380
14383
  /**
@@ -19421,6 +19424,7 @@ var solanaWeb3 = (function (exports) {
19421
19424
  return url.toString();
19422
19425
  }
19423
19426
 
19427
+ var _process$env$npm_pack;
19424
19428
  const PublicKeyFromString = coerce(instance(PublicKey), string(), value => new PublicKey(value));
19425
19429
  const RawAccountDataResult = tuple([string(), literal('base64')]);
19426
19430
  const BufferFromRawAccountData = coerce(instance(buffer.Buffer), RawAccountDataResult, value => buffer.Buffer.from(value[0], 'base64'));
@@ -19631,7 +19635,7 @@ var solanaWeb3 = (function (exports) {
19631
19635
  agent,
19632
19636
  headers: Object.assign({
19633
19637
  'Content-Type': 'application/json'
19634
- }, httpHeaders || {})
19638
+ }, httpHeaders || {}, COMMON_HTTP_HEADERS)
19635
19639
  };
19636
19640
 
19637
19641
  try {
@@ -20304,9 +20308,14 @@ var solanaWeb3 = (function (exports) {
20304
20308
  * Filter for log subscriptions.
20305
20309
  */
20306
20310
 
20311
+ /** @internal */
20312
+ const COMMON_HTTP_HEADERS = {
20313
+ 'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
20314
+ };
20307
20315
  /**
20308
20316
  * A connection to a fullnode JSON RPC endpoint
20309
20317
  */
20318
+
20310
20319
  class Connection {
20311
20320
  /** @internal */
20312
20321
 
@@ -21582,7 +21591,13 @@ var solanaWeb3 = (function (exports) {
21582
21591
  throw new Error('failed to get transactions: ' + res.error.message);
21583
21592
  }
21584
21593
 
21585
- return res.result;
21594
+ const result = res.result;
21595
+ if (!result) return result;
21596
+ return { ...result,
21597
+ transaction: { ...result.transaction,
21598
+ message: new Message(result.transaction.message)
21599
+ }
21600
+ };
21586
21601
  });
21587
21602
  return res;
21588
21603
  }