@solana/transactions 2.0.0-experimental.f07dced → 2.0.0-experimental.f2b6238

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.
@@ -9,7 +9,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
9
9
  return value;
10
10
  };
11
11
 
12
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/bytes.mjs
12
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/bytes.mjs
13
13
  var mergeBytes = (bytesArr) => {
14
14
  const totalLength = bytesArr.reduce((total, arr) => total + arr.length, 0);
15
15
  const result = new Uint8Array(totalLength);
@@ -29,7 +29,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
29
29
  };
30
30
  var fixBytes = (bytes2, length) => padBytes(bytes2.slice(0, length), length);
31
31
 
32
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/errors.mjs
32
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/errors.mjs
33
33
  var DeserializingEmptyBufferError = class extends Error {
34
34
  constructor(serializer) {
35
35
  super(`Serializer [${serializer}] cannot deserialize empty buffers.`);
@@ -50,7 +50,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
50
50
  }
51
51
  };
52
52
 
53
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
53
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
54
54
  function fixSerializer(serializer, fixedBytes, description) {
55
55
  return {
56
56
  description: description ?? `fixed(${fixedBytes}, ${serializer.description})`,
@@ -71,7 +71,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
71
71
  };
72
72
  }
73
73
 
74
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
74
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
75
75
  function mapSerializer(serializer, unmap, map) {
76
76
  return {
77
77
  description: serializer.description,
@@ -85,7 +85,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
85
85
  };
86
86
  }
87
87
 
88
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
88
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
89
89
  var InvalidBaseStringError = class extends Error {
90
90
  constructor(value, base, cause) {
91
91
  const message = `Expected a string of base ${base}, got [${value}].`;
@@ -95,7 +95,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
95
95
  }
96
96
  };
97
97
 
98
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
98
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
99
99
  var baseX = (alphabet) => {
100
100
  const base = alphabet.length;
101
101
  const baseBigInt = BigInt(base);
@@ -149,16 +149,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
149
149
  };
150
150
  };
151
151
 
152
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
152
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
153
153
  var base58 = baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
154
154
 
155
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/nullCharacters.mjs
155
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/nullCharacters.mjs
156
156
  var removeNullCharacters = (value) => (
157
157
  // eslint-disable-next-line no-control-regex
158
158
  value.replace(/\u0000/g, "")
159
159
  );
160
160
 
161
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/utf8.mjs
161
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/utf8.mjs
162
162
  var utf8 = {
163
163
  description: "utf8",
164
164
  fixedSize: null,
@@ -172,14 +172,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
172
172
  }
173
173
  };
174
174
 
175
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/common.mjs
175
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/common.mjs
176
176
  var Endian;
177
177
  (function(Endian2) {
178
178
  Endian2["Little"] = "le";
179
179
  Endian2["Big"] = "be";
180
180
  })(Endian || (Endian = {}));
181
181
 
182
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/errors.mjs
182
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/errors.mjs
183
183
  var NumberOutOfRangeError = class extends RangeError {
184
184
  constructor(serializer, min, max, actual) {
185
185
  super(`Serializer [${serializer}] expected number to be between ${min} and ${max}, got ${actual}.`);
@@ -187,7 +187,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
187
187
  }
188
188
  };
189
189
 
190
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/utils.mjs
190
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/utils.mjs
191
191
  function numberFactory(input) {
192
192
  let littleEndian;
193
193
  let defaultDescription = input.name;
@@ -231,7 +231,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
231
231
  }
232
232
  };
233
233
 
234
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u8.mjs
234
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u8.mjs
235
235
  var u8 = (options = {}) => numberFactory({
236
236
  name: "u8",
237
237
  size: 1,
@@ -241,7 +241,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
241
241
  options
242
242
  });
243
243
 
244
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u32.mjs
244
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u32.mjs
245
245
  var u32 = (options = {}) => numberFactory({
246
246
  name: "u32",
247
247
  size: 4,
@@ -251,7 +251,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
251
251
  options
252
252
  });
253
253
 
254
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/shortU16.mjs
254
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/shortU16.mjs
255
255
  var shortU16 = (options = {}) => ({
256
256
  description: options.description ?? "shortU16",
257
257
  fixedSize: null,
@@ -288,7 +288,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
288
288
  }
289
289
  });
290
290
 
291
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
291
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
292
292
  var InvalidNumberOfItemsError = class extends Error {
293
293
  constructor(serializer, expected, actual) {
294
294
  super(`Expected [${serializer}] to have ${expected} items, got ${actual}.`);
@@ -308,12 +308,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
308
308
  }
309
309
  };
310
310
 
311
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
311
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
312
312
  function sumSerializerSizes(sizes) {
313
313
  return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
314
314
  }
315
315
 
316
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
316
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
317
317
  function getResolvedSize(size, childrenSizes, bytes2, offset) {
318
318
  if (typeof size === "number") {
319
319
  return [size, offset];
@@ -349,7 +349,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
349
349
  return typeof size === "object" ? size.serialize(realSize) : new Uint8Array();
350
350
  }
351
351
 
352
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
352
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
353
353
  function array(item, options = {}) {
354
354
  const size = options.size ?? u32();
355
355
  if (size === "remainder" && item.fixedSize === null) {
@@ -382,7 +382,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
382
382
  };
383
383
  }
384
384
 
385
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
385
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
386
386
  function bytes(options = {}) {
387
387
  const size = options.size ?? "variable";
388
388
  const description = options.description ?? `bytes(${getSizeDescription(size)})`;
@@ -429,7 +429,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
429
429
  };
430
430
  }
431
431
 
432
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
432
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
433
433
  function string(options = {}) {
434
434
  const size = options.size ?? u32();
435
435
  const encoding = options.encoding ?? utf8;
@@ -470,7 +470,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
470
470
  };
471
471
  }
472
472
 
473
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
473
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
474
474
  function struct(fields, options = {}) {
475
475
  const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
476
476
  return {
@@ -493,6 +493,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
493
493
  };
494
494
  }
495
495
 
496
+ // src/unsigned-transaction.ts
497
+ function getUnsignedTransaction(transaction) {
498
+ if ("signatures" in transaction) {
499
+ const {
500
+ signatures: _,
501
+ // eslint-disable-line @typescript-eslint/no-unused-vars
502
+ ...unsignedTransaction
503
+ } = transaction;
504
+ return unsignedTransaction;
505
+ } else {
506
+ return transaction;
507
+ }
508
+ }
509
+
496
510
  // src/blockhash.ts
497
511
  function assertIsBlockhash(putativeBlockhash) {
498
512
  try {
@@ -514,6 +528,17 @@ this.globalThis.solanaWeb3 = (function (exports) {
514
528
  });
515
529
  }
516
530
  }
531
+ function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
532
+ if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
533
+ return transaction;
534
+ }
535
+ const out = {
536
+ ...getUnsignedTransaction(transaction),
537
+ lifetimeConstraint: blockhashLifetimeConstraint
538
+ };
539
+ Object.freeze(out);
540
+ return out;
541
+ }
517
542
 
518
543
  // src/create-transaction.ts
519
544
  function createTransaction({
@@ -527,82 +552,120 @@ this.globalThis.solanaWeb3 = (function (exports) {
527
552
  return out;
528
553
  }
529
554
 
555
+ // ../instructions/dist/index.browser.js
556
+ var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
557
+ AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
558
+ 3] = "WRITABLE_SIGNER";
559
+ AccountRole2[AccountRole2["READONLY_SIGNER"] = /* 2 */
560
+ 2] = "READONLY_SIGNER";
561
+ AccountRole2[AccountRole2["WRITABLE"] = /* 1 */
562
+ 1] = "WRITABLE";
563
+ AccountRole2[AccountRole2["READONLY"] = /* 0 */
564
+ 0] = "READONLY";
565
+ return AccountRole2;
566
+ })(AccountRole || {});
567
+ var IS_WRITABLE_BITMASK = 1;
568
+ function isSignerRole(role) {
569
+ return role >= 2;
570
+ }
571
+ function isWritableRole(role) {
572
+ return (role & IS_WRITABLE_BITMASK) !== 0;
573
+ }
574
+ function mergeRoles(roleA, roleB) {
575
+ return roleA | roleB;
576
+ }
577
+
578
+ // src/durable-nonce.ts
579
+ var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
580
+ var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
581
+ function assertIsDurableNonceTransaction(transaction) {
582
+ if (!isDurableNonceTransaction(transaction)) {
583
+ throw new Error("Transaction is not a durable nonce transaction");
584
+ }
585
+ }
586
+ function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
587
+ return {
588
+ accounts: [
589
+ { address: nonceAccountAddress, role: AccountRole.WRITABLE },
590
+ {
591
+ address: RECENT_BLOCKHASHES_SYSVAR_ADDRESS,
592
+ role: AccountRole.READONLY
593
+ },
594
+ { address: nonceAuthorityAddress, role: AccountRole.READONLY_SIGNER }
595
+ ],
596
+ data: new Uint8Array([4, 0, 0, 0]),
597
+ programAddress: SYSTEM_PROGRAM_ADDRESS
598
+ };
599
+ }
600
+ function isAdvanceNonceAccountInstruction(instruction) {
601
+ return instruction.programAddress === SYSTEM_PROGRAM_ADDRESS && // Test for `AdvanceNonceAccount` instruction data
602
+ instruction.data != null && isAdvanceNonceAccountInstructionData(instruction.data) && // Test for exactly 3 accounts
603
+ instruction.accounts?.length === 3 && // First account is nonce account address
604
+ instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole.WRITABLE && // Second account is recent blockhashes sysvar
605
+ instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole.READONLY && // Third account is nonce authority account
606
+ instruction.accounts[2].address != null && instruction.accounts[2].role === AccountRole.READONLY_SIGNER;
607
+ }
608
+ function isAdvanceNonceAccountInstructionData(data) {
609
+ return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
610
+ }
611
+ function isDurableNonceTransaction(transaction) {
612
+ return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
613
+ }
614
+ function setTransactionLifetimeUsingDurableNonce({
615
+ nonce,
616
+ nonceAccountAddress,
617
+ nonceAuthorityAddress
618
+ }, transaction) {
619
+ const isAlreadyDurableNonceTransaction = isDurableNonceTransaction(transaction);
620
+ if (isAlreadyDurableNonceTransaction && transaction.lifetimeConstraint.nonce === nonce && transaction.instructions[0].accounts[0].address === nonceAccountAddress && transaction.instructions[0].accounts[2].address === nonceAuthorityAddress) {
621
+ return transaction;
622
+ }
623
+ const out = {
624
+ ...getUnsignedTransaction(transaction),
625
+ instructions: [
626
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
627
+ ...isAlreadyDurableNonceTransaction ? transaction.instructions.slice(1) : transaction.instructions
628
+ ],
629
+ lifetimeConstraint: {
630
+ nonce
631
+ }
632
+ };
633
+ Object.freeze(out);
634
+ return out;
635
+ }
636
+
530
637
  // src/fee-payer.ts
531
638
  function setTransactionFeePayer(feePayer, transaction) {
532
639
  if ("feePayer" in transaction && feePayer === transaction.feePayer) {
533
640
  return transaction;
534
641
  }
535
- let out;
536
- if ("signatures" in transaction) {
537
- const {
538
- signatures: _,
539
- // eslint-disable-line @typescript-eslint/no-unused-vars
540
- ...unsignedTransaction
541
- } = transaction;
542
- out = {
543
- ...unsignedTransaction,
544
- feePayer
545
- };
546
- } else {
547
- out = {
548
- ...transaction,
549
- feePayer
550
- };
551
- }
642
+ const out = {
643
+ ...getUnsignedTransaction(transaction),
644
+ feePayer
645
+ };
552
646
  Object.freeze(out);
553
647
  return out;
554
648
  }
555
649
 
556
650
  // src/instructions.ts
557
- function replaceInstructions(transaction, nextInstructions) {
558
- let out;
559
- if ("signatures" in transaction) {
560
- const {
561
- signatures: _,
562
- // eslint-disable-line @typescript-eslint/no-unused-vars
563
- ...unsignedTransaction
564
- } = transaction;
565
- out = {
566
- ...unsignedTransaction,
567
- instructions: nextInstructions
568
- };
569
- } else {
570
- out = {
571
- ...transaction,
572
- instructions: nextInstructions
573
- };
574
- }
575
- return out;
576
- }
577
651
  function appendTransactionInstruction(instruction, transaction) {
578
- const nextInstructions = [...transaction.instructions, instruction];
579
- const out = replaceInstructions(transaction, nextInstructions);
652
+ const out = {
653
+ ...getUnsignedTransaction(transaction),
654
+ instructions: [...transaction.instructions, instruction]
655
+ };
580
656
  Object.freeze(out);
581
657
  return out;
582
658
  }
583
659
  function prependTransactionInstruction(instruction, transaction) {
584
- const nextInstructions = [instruction, ...transaction.instructions];
585
- const out = replaceInstructions(transaction, nextInstructions);
660
+ const out = {
661
+ ...getUnsignedTransaction(transaction),
662
+ instructions: [instruction, ...transaction.instructions]
663
+ };
586
664
  Object.freeze(out);
587
665
  return out;
588
666
  }
589
- function getBase58EncodedAddressCodec(config) {
590
- return string({
591
- description: config?.description ?? ("A 32-byte account address" ),
592
- encoding: base58,
593
- size: 32
594
- });
595
- }
596
- function getBase58EncodedAddressComparator() {
597
- return new Intl.Collator("en", {
598
- caseFirst: "lower",
599
- ignorePunctuation: false,
600
- localeMatcher: "best fit",
601
- numeric: false,
602
- sensitivity: "variant",
603
- usage: "sort"
604
- }).compare;
605
- }
667
+
668
+ // ../assertions/dist/index.browser.js
606
669
  function assertIsSecureContext() {
607
670
  if (!globalThis.isSecureContext) {
608
671
  throw new Error(
@@ -622,7 +685,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
622
685
  throw new Error("No signing implementation could be found");
623
686
  }
624
687
  }
625
- async function getBase58EncodedAddressFromPublicKey(publicKey) {
688
+ function getBase58EncodedAddressCodec(config) {
689
+ return string({
690
+ description: config?.description ?? ("A 32-byte account address" ),
691
+ encoding: base58,
692
+ size: 32
693
+ });
694
+ }
695
+ function getBase58EncodedAddressComparator() {
696
+ return new Intl.Collator("en", {
697
+ caseFirst: "lower",
698
+ ignorePunctuation: false,
699
+ localeMatcher: "best fit",
700
+ numeric: false,
701
+ sensitivity: "variant",
702
+ usage: "sort"
703
+ }).compare;
704
+ }
705
+ async function getAddressFromPublicKey(publicKey) {
626
706
  await assertKeyExporterIsAvailable();
627
707
  if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
628
708
  throw new Error("The `CryptoKey` must be an `Ed25519` public key");
@@ -631,35 +711,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
631
711
  const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
632
712
  return base58EncodedAddress;
633
713
  }
714
+
715
+ // ../keys/dist/index.browser.js
634
716
  async function signBytes(key, data) {
635
717
  await assertSigningCapabilityIsAvailable();
636
718
  const signedData = await crypto.subtle.sign("Ed25519", key, data);
637
719
  return new Uint8Array(signedData);
638
720
  }
639
721
 
640
- // ../instructions/dist/index.browser.js
641
- var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
642
- AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
643
- 3] = "WRITABLE_SIGNER";
644
- AccountRole2[AccountRole2["READONLY_SIGNER"] = /* 2 */
645
- 2] = "READONLY_SIGNER";
646
- AccountRole2[AccountRole2["WRITABLE"] = /* 1 */
647
- 1] = "WRITABLE";
648
- AccountRole2[AccountRole2["READONLY"] = /* 0 */
649
- 0] = "READONLY";
650
- return AccountRole2;
651
- })(AccountRole || {});
652
- var IS_WRITABLE_BITMASK = 1;
653
- function isSignerRole(role) {
654
- return role >= 2;
655
- }
656
- function isWritableRole(role) {
657
- return (role & IS_WRITABLE_BITMASK) !== 0;
658
- }
659
- function mergeRoles(roleA, roleB) {
660
- return roleA | roleB;
661
- }
662
-
663
722
  // src/accounts.ts
664
723
  function upsert(addressMap, address, update) {
665
724
  addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
@@ -1015,7 +1074,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1015
1074
  )
1016
1075
  ],
1017
1076
  [
1018
- "addressIndices",
1077
+ "accountIndices",
1019
1078
  array(
1020
1079
  u8({
1021
1080
  description: "The index of an account, according to the well-ordered accounts list for this transaction"
@@ -1035,23 +1094,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
1035
1094
  ]
1036
1095
  ]),
1037
1096
  (value) => {
1038
- if (value.addressIndices !== void 0 && value.data !== void 0) {
1097
+ if (value.accountIndices !== void 0 && value.data !== void 0) {
1039
1098
  return value;
1040
1099
  }
1041
1100
  return {
1042
1101
  ...value,
1043
- addressIndices: value.addressIndices ?? [],
1102
+ accountIndices: value.accountIndices ?? [],
1044
1103
  data: value.data ?? new Uint8Array(0)
1045
1104
  };
1046
1105
  },
1047
1106
  (value) => {
1048
- if (value.addressIndices.length && value.data.byteLength) {
1107
+ if (value.accountIndices.length && value.data.byteLength) {
1049
1108
  return value;
1050
1109
  }
1051
- const { addressIndices, data, ...rest } = value;
1110
+ const { accountIndices, data, ...rest } = value;
1052
1111
  return {
1053
1112
  ...rest,
1054
- ...addressIndices.length ? { addressIndices } : null,
1113
+ ...accountIndices.length ? { accountIndices } : null,
1055
1114
  ...data.byteLength ? { data } : null
1056
1115
  };
1057
1116
  }
@@ -1179,16 +1238,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
1179
1238
  const signature = await signBytes(secretKey, wireMessageBytes);
1180
1239
  return signature;
1181
1240
  }
1182
- async function signTransaction(keyPair, transaction) {
1241
+ async function signTransaction(keyPairs, transaction) {
1183
1242
  const compiledMessage = compileMessage(transaction);
1184
- const [signerPublicKey, signature] = await Promise.all([
1185
- getBase58EncodedAddressFromPublicKey(keyPair.publicKey),
1186
- getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
1187
- ]);
1188
- const nextSignatures = {
1189
- ..."signatures" in transaction ? transaction.signatures : null,
1190
- ...{ [signerPublicKey]: signature }
1191
- };
1243
+ const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
1244
+ const publicKeySignaturePairs = await Promise.all(
1245
+ keyPairs.map(
1246
+ (keyPair) => Promise.all([
1247
+ getAddressFromPublicKey(keyPair.publicKey),
1248
+ getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
1249
+ ])
1250
+ )
1251
+ );
1252
+ for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
1253
+ nextSignatures[signerPublicKey] = signature;
1254
+ }
1192
1255
  const out = {
1193
1256
  ...transaction,
1194
1257
  signatures: nextSignatures
@@ -1252,10 +1315,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
1252
1315
 
1253
1316
  exports.appendTransactionInstruction = appendTransactionInstruction;
1254
1317
  exports.assertIsBlockhash = assertIsBlockhash;
1318
+ exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
1255
1319
  exports.createTransaction = createTransaction;
1256
1320
  exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
1257
1321
  exports.prependTransactionInstruction = prependTransactionInstruction;
1258
1322
  exports.setTransactionFeePayer = setTransactionFeePayer;
1323
+ exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
1324
+ exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
1259
1325
  exports.signTransaction = signTransaction;
1260
1326
 
1261
1327
  return exports;