@solana/transactions 2.0.0-experimental.cf6545e → 2.0.0-experimental.cf6ca9d

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,83 +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
13
- var mergeBytes = (bytesArr) => {
14
- const totalLength = bytesArr.reduce((total, arr) => total + arr.length, 0);
15
- const result = new Uint8Array(totalLength);
16
- let offset = 0;
17
- bytesArr.forEach((arr) => {
18
- result.set(arr, offset);
19
- offset += arr.length;
20
- });
21
- return result;
22
- };
23
- var padBytes = (bytes2, length) => {
24
- if (bytes2.length >= length)
25
- return bytes2;
26
- const paddedBytes = new Uint8Array(length).fill(0);
27
- paddedBytes.set(bytes2);
28
- return paddedBytes;
29
- };
30
- var fixBytes = (bytes2, length) => padBytes(bytes2.slice(0, length), length);
31
-
32
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/errors.mjs
33
- var DeserializingEmptyBufferError = class extends Error {
34
- constructor(serializer) {
35
- super(`Serializer [${serializer}] cannot deserialize empty buffers.`);
36
- __publicField(this, "name", "DeserializingEmptyBufferError");
37
- }
38
- };
39
- var NotEnoughBytesError = class extends Error {
40
- constructor(serializer, expected, actual) {
41
- super(`Serializer [${serializer}] expected ${expected} bytes, got ${actual}.`);
42
- __publicField(this, "name", "NotEnoughBytesError");
43
- }
44
- };
45
- var ExpectedFixedSizeSerializerError = class extends Error {
46
- constructor(message) {
47
- message ?? (message = "Expected a fixed-size serializer, got a variable-size one.");
48
- super(message);
49
- __publicField(this, "name", "ExpectedFixedSizeSerializerError");
50
- }
51
- };
52
-
53
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
54
- function fixSerializer(serializer, fixedBytes, description) {
55
- return {
56
- description: description ?? `fixed(${fixedBytes}, ${serializer.description})`,
57
- fixedSize: fixedBytes,
58
- maxSize: fixedBytes,
59
- serialize: (value) => fixBytes(serializer.serialize(value), fixedBytes),
60
- deserialize: (buffer, offset = 0) => {
61
- buffer = buffer.slice(offset, offset + fixedBytes);
62
- if (buffer.length < fixedBytes) {
63
- throw new NotEnoughBytesError("fixSerializer", fixedBytes, buffer.length);
64
- }
65
- if (serializer.fixedSize !== null) {
66
- buffer = fixBytes(buffer, serializer.fixedSize);
67
- }
68
- const [value] = serializer.deserialize(buffer, 0);
69
- return [value, offset + fixedBytes];
70
- }
71
- };
72
- }
73
-
74
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
75
- function mapSerializer(serializer, unmap, map) {
76
- return {
77
- description: serializer.description,
78
- fixedSize: serializer.fixedSize,
79
- maxSize: serializer.maxSize,
80
- serialize: (value) => serializer.serialize(unmap(value)),
81
- deserialize: (buffer, offset = 0) => {
82
- const [value, length] = serializer.deserialize(buffer, offset);
83
- return map ? [map(value, buffer, offset), length] : [value, length];
84
- }
85
- };
86
- }
87
-
88
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
12
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
89
13
  var InvalidBaseStringError = class extends Error {
90
14
  constructor(value, base, cause) {
91
15
  const message = `Expected a string of base ${base}, got [${value}].`;
@@ -95,7 +19,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
95
19
  }
96
20
  };
97
21
 
98
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
22
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
99
23
  var baseX = (alphabet) => {
100
24
  const base = alphabet.length;
101
25
  const baseBigInt = BigInt(base);
@@ -132,13 +56,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
132
56
  deserialize(buffer, offset = 0) {
133
57
  if (buffer.length === 0)
134
58
  return ["", 0];
135
- const bytes2 = buffer.slice(offset);
136
- let trailIndex = bytes2.findIndex((n) => n !== 0);
137
- trailIndex = trailIndex === -1 ? bytes2.length : trailIndex;
59
+ const bytes = buffer.slice(offset);
60
+ let trailIndex = bytes.findIndex((n) => n !== 0);
61
+ trailIndex = trailIndex === -1 ? bytes.length : trailIndex;
138
62
  const leadingZeroes = alphabet[0].repeat(trailIndex);
139
- if (trailIndex === bytes2.length)
63
+ if (trailIndex === bytes.length)
140
64
  return [leadingZeroes, buffer.length];
141
- let base10Number = bytes2.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
65
+ let base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
142
66
  const tailChars = [];
143
67
  while (base10Number > 0n) {
144
68
  tailChars.unshift(alphabet[Number(base10Number % baseBigInt)]);
@@ -149,350 +73,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
149
73
  };
150
74
  };
151
75
 
152
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
76
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
153
77
  var base58 = baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
154
78
 
155
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/nullCharacters.mjs
156
- var removeNullCharacters = (value) => (
157
- // eslint-disable-next-line no-control-regex
158
- value.replace(/\u0000/g, "")
159
- );
160
-
161
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/utf8.mjs
162
- var utf8 = {
163
- description: "utf8",
164
- fixedSize: null,
165
- maxSize: null,
166
- serialize(value) {
167
- return new TextEncoder().encode(value);
168
- },
169
- deserialize(buffer, offset = 0) {
170
- const value = new TextDecoder().decode(buffer.slice(offset));
171
- return [removeNullCharacters(value), buffer.length];
172
- }
173
- };
174
-
175
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/common.mjs
176
- var Endian;
177
- (function(Endian2) {
178
- Endian2["Little"] = "le";
179
- Endian2["Big"] = "be";
180
- })(Endian || (Endian = {}));
181
-
182
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/errors.mjs
183
- var NumberOutOfRangeError = class extends RangeError {
184
- constructor(serializer, min, max, actual) {
185
- super(`Serializer [${serializer}] expected number to be between ${min} and ${max}, got ${actual}.`);
186
- __publicField(this, "name", "NumberOutOfRangeError");
187
- }
188
- };
189
-
190
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/utils.mjs
191
- function numberFactory(input) {
192
- let littleEndian;
193
- let defaultDescription = input.name;
194
- if (input.size > 1) {
195
- littleEndian = !("endian" in input.options) || input.options.endian === Endian.Little;
196
- defaultDescription += littleEndian ? "(le)" : "(be)";
197
- }
198
- return {
199
- description: input.options.description ?? defaultDescription,
200
- fixedSize: input.size,
201
- maxSize: input.size,
202
- serialize(value) {
203
- if (input.range) {
204
- assertRange(input.name, input.range[0], input.range[1], value);
205
- }
206
- const buffer = new ArrayBuffer(input.size);
207
- input.set(new DataView(buffer), value, littleEndian);
208
- return new Uint8Array(buffer);
209
- },
210
- deserialize(bytes2, offset = 0) {
211
- const slice = bytes2.slice(offset, offset + input.size);
212
- assertEnoughBytes("i8", slice, input.size);
213
- const view = toDataView(slice);
214
- return [input.get(view, littleEndian), offset + input.size];
215
- }
216
- };
217
- }
218
- var toArrayBuffer = (array2) => array2.buffer.slice(array2.byteOffset, array2.byteLength + array2.byteOffset);
219
- var toDataView = (array2) => new DataView(toArrayBuffer(array2));
220
- var assertRange = (serializer, min, max, value) => {
221
- if (value < min || value > max) {
222
- throw new NumberOutOfRangeError(serializer, min, max, value);
223
- }
224
- };
225
- var assertEnoughBytes = (serializer, bytes2, expected) => {
226
- if (bytes2.length === 0) {
227
- throw new DeserializingEmptyBufferError(serializer);
228
- }
229
- if (bytes2.length < expected) {
230
- throw new NotEnoughBytesError(serializer, expected, bytes2.length);
231
- }
232
- };
233
-
234
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u8.mjs
235
- var u8 = (options = {}) => numberFactory({
236
- name: "u8",
237
- size: 1,
238
- range: [0, Number("0xff")],
239
- set: (view, value) => view.setUint8(0, Number(value)),
240
- get: (view) => view.getUint8(0),
241
- options
242
- });
243
-
244
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u32.mjs
245
- var u32 = (options = {}) => numberFactory({
246
- name: "u32",
247
- size: 4,
248
- range: [0, Number("0xffffffff")],
249
- set: (view, value, le) => view.setUint32(0, Number(value), le),
250
- get: (view, le) => view.getUint32(0, le),
251
- options
252
- });
253
-
254
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/shortU16.mjs
255
- var shortU16 = (options = {}) => ({
256
- description: options.description ?? "shortU16",
257
- fixedSize: null,
258
- maxSize: 3,
259
- serialize: (value) => {
260
- assertRange("shortU16", 0, 65535, value);
261
- const bytes2 = [0];
262
- for (let ii = 0; ; ii += 1) {
263
- const alignedValue = value >> ii * 7;
264
- if (alignedValue === 0) {
265
- break;
266
- }
267
- const nextSevenBits = 127 & alignedValue;
268
- bytes2[ii] = nextSevenBits;
269
- if (ii > 0) {
270
- bytes2[ii - 1] |= 128;
271
- }
272
- }
273
- return new Uint8Array(bytes2);
274
- },
275
- deserialize: (bytes2, offset = 0) => {
276
- let value = 0;
277
- let byteCount = 0;
278
- while (++byteCount) {
279
- const byteIndex = byteCount - 1;
280
- const currentByte = bytes2[offset + byteIndex];
281
- const nextSevenBits = 127 & currentByte;
282
- value |= nextSevenBits << byteIndex * 7;
283
- if ((currentByte & 128) === 0) {
284
- break;
285
- }
286
- }
287
- return [value, offset + byteCount];
288
- }
289
- });
290
-
291
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
292
- var InvalidNumberOfItemsError = class extends Error {
293
- constructor(serializer, expected, actual) {
294
- super(`Expected [${serializer}] to have ${expected} items, got ${actual}.`);
295
- __publicField(this, "name", "InvalidNumberOfItemsError");
296
- }
297
- };
298
- var InvalidArrayLikeRemainderSizeError = class extends Error {
299
- constructor(remainderSize, itemSize) {
300
- super(`The remainder of the buffer (${remainderSize} bytes) cannot be split into chunks of ${itemSize} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainderSize} modulo ${itemSize} should be equal to zero.`);
301
- __publicField(this, "name", "InvalidArrayLikeRemainderSizeError");
302
- }
303
- };
304
- var UnrecognizedArrayLikeSerializerSizeError = class extends Error {
305
- constructor(size) {
306
- super(`Unrecognized array-like serializer size: ${JSON.stringify(size)}`);
307
- __publicField(this, "name", "UnrecognizedArrayLikeSerializerSizeError");
308
- }
309
- };
310
-
311
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
312
- function sumSerializerSizes(sizes) {
313
- return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
314
- }
315
-
316
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
317
- function getResolvedSize(size, childrenSizes, bytes2, offset) {
318
- if (typeof size === "number") {
319
- return [size, offset];
320
- }
321
- if (typeof size === "object") {
322
- return size.deserialize(bytes2, offset);
323
- }
324
- if (size === "remainder") {
325
- const childrenSize = sumSerializerSizes(childrenSizes);
326
- if (childrenSize === null) {
327
- throw new ExpectedFixedSizeSerializerError('Serializers of "remainder" size must have fixed-size items.');
328
- }
329
- const remainder = bytes2.slice(offset).length;
330
- if (remainder % childrenSize !== 0) {
331
- throw new InvalidArrayLikeRemainderSizeError(remainder, childrenSize);
332
- }
333
- return [remainder / childrenSize, offset];
334
- }
335
- throw new UnrecognizedArrayLikeSerializerSizeError(size);
336
- }
337
- function getSizeDescription(size) {
338
- return typeof size === "object" ? size.description : `${size}`;
339
- }
340
- function getSizeFromChildren(size, childrenSizes) {
341
- if (typeof size !== "number")
342
- return null;
343
- if (size === 0)
344
- return 0;
345
- const childrenSize = sumSerializerSizes(childrenSizes);
346
- return childrenSize === null ? null : childrenSize * size;
347
- }
348
- function getSizePrefix(size, realSize) {
349
- return typeof size === "object" ? size.serialize(realSize) : new Uint8Array();
350
- }
351
-
352
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
353
- function array(item, options = {}) {
354
- const size = options.size ?? u32();
355
- if (size === "remainder" && item.fixedSize === null) {
356
- throw new ExpectedFixedSizeSerializerError('Serializers of "remainder" size must have fixed-size items.');
357
- }
358
- return {
359
- description: options.description ?? `array(${item.description}; ${getSizeDescription(size)})`,
360
- fixedSize: getSizeFromChildren(size, [item.fixedSize]),
361
- maxSize: getSizeFromChildren(size, [item.maxSize]),
362
- serialize: (value) => {
363
- if (typeof size === "number" && value.length !== size) {
364
- throw new InvalidNumberOfItemsError("array", size, value.length);
365
- }
366
- return mergeBytes([getSizePrefix(size, value.length), ...value.map((v) => item.serialize(v))]);
367
- },
368
- deserialize: (bytes2, offset = 0) => {
369
- if (typeof size === "object" && bytes2.slice(offset).length === 0) {
370
- return [[], offset];
371
- }
372
- const [resolvedSize, newOffset] = getResolvedSize(size, [item.fixedSize], bytes2, offset);
373
- offset = newOffset;
374
- const values = [];
375
- for (let i = 0; i < resolvedSize; i += 1) {
376
- const [value, newOffset2] = item.deserialize(bytes2, offset);
377
- values.push(value);
378
- offset = newOffset2;
379
- }
380
- return [values, offset];
381
- }
382
- };
383
- }
384
-
385
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
386
- function bytes(options = {}) {
387
- const size = options.size ?? "variable";
388
- const description = options.description ?? `bytes(${getSizeDescription(size)})`;
389
- const byteSerializer = {
390
- description,
391
- fixedSize: null,
392
- maxSize: null,
393
- serialize: (value) => new Uint8Array(value),
394
- deserialize: (bytes2, offset = 0) => {
395
- const slice = bytes2.slice(offset);
396
- return [slice, offset + slice.length];
397
- }
398
- };
399
- if (size === "variable") {
400
- return byteSerializer;
401
- }
402
- if (typeof size === "number") {
403
- return fixSerializer(byteSerializer, size, description);
404
- }
405
- return {
406
- description,
407
- fixedSize: null,
408
- maxSize: null,
409
- serialize: (value) => {
410
- const contentBytes = byteSerializer.serialize(value);
411
- const lengthBytes = size.serialize(contentBytes.length);
412
- return mergeBytes([lengthBytes, contentBytes]);
413
- },
414
- deserialize: (buffer, offset = 0) => {
415
- if (buffer.slice(offset).length === 0) {
416
- throw new DeserializingEmptyBufferError("bytes");
417
- }
418
- const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
419
- const length = Number(lengthBigInt);
420
- offset = lengthOffset;
421
- const contentBuffer = buffer.slice(offset, offset + length);
422
- if (contentBuffer.length < length) {
423
- throw new NotEnoughBytesError("bytes", length, contentBuffer.length);
424
- }
425
- const [value, contentOffset] = byteSerializer.deserialize(contentBuffer);
426
- offset += contentOffset;
427
- return [value, offset];
428
- }
429
- };
430
- }
431
-
432
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
433
- function string(options = {}) {
434
- const size = options.size ?? u32();
435
- const encoding = options.encoding ?? utf8;
436
- const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
437
- if (size === "variable") {
438
- return {
439
- ...encoding,
440
- description
441
- };
442
- }
443
- if (typeof size === "number") {
444
- return fixSerializer(encoding, size, description);
445
- }
446
- return {
447
- description,
448
- fixedSize: null,
449
- maxSize: null,
450
- serialize: (value) => {
451
- const contentBytes = encoding.serialize(value);
452
- const lengthBytes = size.serialize(contentBytes.length);
453
- return mergeBytes([lengthBytes, contentBytes]);
454
- },
455
- deserialize: (buffer, offset = 0) => {
456
- if (buffer.slice(offset).length === 0) {
457
- throw new DeserializingEmptyBufferError("string");
458
- }
459
- const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
460
- const length = Number(lengthBigInt);
461
- offset = lengthOffset;
462
- const contentBuffer = buffer.slice(offset, offset + length);
463
- if (contentBuffer.length < length) {
464
- throw new NotEnoughBytesError("string", length, contentBuffer.length);
465
- }
466
- const [value, contentOffset] = encoding.deserialize(contentBuffer);
467
- offset += contentOffset;
468
- return [value, offset];
469
- }
470
- };
471
- }
472
-
473
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
474
- function struct(fields, options = {}) {
475
- const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
476
- return {
477
- description: options.description ?? `struct(${fieldDescriptions})`,
478
- fixedSize: sumSerializerSizes(fields.map(([, field]) => field.fixedSize)),
479
- maxSize: sumSerializerSizes(fields.map(([, field]) => field.maxSize)),
480
- serialize: (struct2) => {
481
- const fieldBytes = fields.map(([key, serializer]) => serializer.serialize(struct2[key]));
482
- return mergeBytes(fieldBytes);
483
- },
484
- deserialize: (bytes2, offset = 0) => {
485
- const struct2 = {};
486
- fields.forEach(([key, serializer]) => {
487
- const [value, newOffset] = serializer.deserialize(bytes2, offset);
488
- offset = newOffset;
489
- struct2[key] = value;
490
- });
491
- return [struct2, offset];
492
- }
493
- };
494
- }
495
-
496
79
  // src/unsigned-transaction.ts
497
80
  function getUnsignedTransaction(transaction) {
498
81
  if ("signatures" in transaction) {
@@ -517,14 +100,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
517
100
  ) {
518
101
  throw new Error("Expected input string to decode to a byte array of length 32.");
519
102
  }
520
- const bytes2 = base58.serialize(putativeBlockhash);
521
- const numBytes = bytes2.byteLength;
103
+ const bytes = base58.serialize(putativeBlockhash);
104
+ const numBytes = bytes.byteLength;
522
105
  if (numBytes !== 32) {
523
106
  throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
524
107
  }
525
- } catch (e) {
108
+ } catch (e2) {
526
109
  throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
527
- cause: e
110
+ cause: e2
528
111
  });
529
112
  }
530
113
  }
@@ -603,7 +186,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
603
186
  instruction.accounts?.length === 3 && // First account is nonce account address
604
187
  instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole.WRITABLE && // Second account is recent blockhashes sysvar
605
188
  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;
189
+ instruction.accounts[2].address != null && isSignerRole(instruction.accounts[2].role);
607
190
  }
608
191
  function isAdvanceNonceAccountInstructionData(data) {
609
192
  return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
@@ -611,21 +194,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
611
194
  function isDurableNonceTransaction(transaction) {
612
195
  return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
613
196
  }
197
+ function isAdvanceNonceAccountInstructionForNonce(instruction, nonceAccountAddress, nonceAuthorityAddress) {
198
+ return instruction.accounts[0].address === nonceAccountAddress && instruction.accounts[2].address === nonceAuthorityAddress;
199
+ }
614
200
  function setTransactionLifetimeUsingDurableNonce({
615
201
  nonce,
616
202
  nonceAccountAddress,
617
203
  nonceAuthorityAddress
618
204
  }, 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;
205
+ let newInstructions;
206
+ const firstInstruction = transaction.instructions[0];
207
+ if (firstInstruction && isAdvanceNonceAccountInstruction(firstInstruction)) {
208
+ if (isAdvanceNonceAccountInstructionForNonce(firstInstruction, nonceAccountAddress, nonceAuthorityAddress)) {
209
+ if (isDurableNonceTransaction(transaction) && transaction.lifetimeConstraint.nonce === nonce) {
210
+ return transaction;
211
+ } else {
212
+ newInstructions = [firstInstruction, ...transaction.instructions.slice(1)];
213
+ }
214
+ } else {
215
+ newInstructions = [
216
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
217
+ ...transaction.instructions.slice(1)
218
+ ];
219
+ }
220
+ } else {
221
+ newInstructions = [
222
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
223
+ ...transaction.instructions
224
+ ];
622
225
  }
623
226
  const out = {
624
227
  ...getUnsignedTransaction(transaction),
625
- instructions: [
626
- createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
627
- ...isAlreadyDurableNonceTransaction ? transaction.instructions.slice(1) : transaction.instructions
628
- ],
228
+ instructions: newInstructions,
629
229
  lifetimeConstraint: {
630
230
  nonce
631
231
  }
@@ -665,34 +265,642 @@ this.globalThis.solanaWeb3 = (function (exports) {
665
265
  return out;
666
266
  }
667
267
 
668
- // ../assertions/dist/index.browser.js
669
- function assertIsSecureContext() {
670
- if (!globalThis.isSecureContext) {
268
+ // ../codecs-core/dist/index.browser.js
269
+ function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
270
+ if (bytes.length - offset <= 0) {
271
+ throw new Error(`Codec [${codecDescription}] cannot decode empty byte arrays.`);
272
+ }
273
+ }
274
+ function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
275
+ const bytesLength = bytes.length - offset;
276
+ if (bytesLength < expected) {
277
+ throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
278
+ }
279
+ }
280
+ var mergeBytes = (byteArrays) => {
281
+ const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length);
282
+ if (nonEmptyByteArrays.length === 0) {
283
+ return byteArrays.length ? byteArrays[0] : new Uint8Array();
284
+ }
285
+ if (nonEmptyByteArrays.length === 1) {
286
+ return nonEmptyByteArrays[0];
287
+ }
288
+ const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);
289
+ const result = new Uint8Array(totalLength);
290
+ let offset = 0;
291
+ nonEmptyByteArrays.forEach((arr) => {
292
+ result.set(arr, offset);
293
+ offset += arr.length;
294
+ });
295
+ return result;
296
+ };
297
+ var padBytes = (bytes, length) => {
298
+ if (bytes.length >= length)
299
+ return bytes;
300
+ const paddedBytes = new Uint8Array(length).fill(0);
301
+ paddedBytes.set(bytes);
302
+ return paddedBytes;
303
+ };
304
+ var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
305
+ function combineCodec(encoder, decoder, description) {
306
+ if (encoder.fixedSize !== decoder.fixedSize) {
671
307
  throw new Error(
672
- "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"
308
+ `Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`
309
+ );
310
+ }
311
+ if (encoder.maxSize !== decoder.maxSize) {
312
+ throw new Error(
313
+ `Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`
673
314
  );
674
315
  }
316
+ if (description === void 0 && encoder.description !== decoder.description) {
317
+ throw new Error(
318
+ `Encoder and decoder must have the same description, got [${encoder.description}] and [${decoder.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`
319
+ );
320
+ }
321
+ return {
322
+ decode: decoder.decode,
323
+ description: description ?? encoder.description,
324
+ encode: encoder.encode,
325
+ fixedSize: encoder.fixedSize,
326
+ maxSize: encoder.maxSize
327
+ };
675
328
  }
676
- async function assertKeyExporterIsAvailable() {
677
- assertIsSecureContext();
678
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
329
+ function fixCodecHelper(data, fixedBytes, description) {
330
+ return {
331
+ description: description ?? `fixed(${fixedBytes}, ${data.description})`,
332
+ fixedSize: fixedBytes,
333
+ maxSize: fixedBytes
334
+ };
335
+ }
336
+ function fixEncoder(encoder, fixedBytes, description) {
337
+ return {
338
+ ...fixCodecHelper(encoder, fixedBytes, description),
339
+ encode: (value) => fixBytes(encoder.encode(value), fixedBytes)
340
+ };
341
+ }
342
+ function fixDecoder(decoder, fixedBytes, description) {
343
+ return {
344
+ ...fixCodecHelper(decoder, fixedBytes, description),
345
+ decode: (bytes, offset = 0) => {
346
+ assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);
347
+ if (offset > 0 || bytes.length > fixedBytes) {
348
+ bytes = bytes.slice(offset, offset + fixedBytes);
349
+ }
350
+ if (decoder.fixedSize !== null) {
351
+ bytes = fixBytes(bytes, decoder.fixedSize);
352
+ }
353
+ const [value] = decoder.decode(bytes, 0);
354
+ return [value, offset + fixedBytes];
355
+ }
356
+ };
357
+ }
358
+ function mapEncoder(encoder, unmap) {
359
+ return {
360
+ description: encoder.description,
361
+ encode: (value) => encoder.encode(unmap(value)),
362
+ fixedSize: encoder.fixedSize,
363
+ maxSize: encoder.maxSize
364
+ };
365
+ }
366
+ function mapDecoder(decoder, map) {
367
+ return {
368
+ decode: (bytes, offset = 0) => {
369
+ const [value, length] = decoder.decode(bytes, offset);
370
+ return [map(value, bytes, offset), length];
371
+ },
372
+ description: decoder.description,
373
+ fixedSize: decoder.fixedSize,
374
+ maxSize: decoder.maxSize
375
+ };
376
+ }
377
+
378
+ // ../codecs-numbers/dist/index.browser.js
379
+ function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
380
+ if (value < min || value > max) {
381
+ throw new Error(
382
+ `Codec [${codecDescription}] expected number to be in the range [${min}, ${max}], got ${value}.`
383
+ );
384
+ }
385
+ }
386
+ function sharedNumberFactory(input) {
387
+ let littleEndian;
388
+ let defaultDescription = input.name;
389
+ if (input.size > 1) {
390
+ littleEndian = !("endian" in input.options) || input.options.endian === 0;
391
+ defaultDescription += littleEndian ? "(le)" : "(be)";
392
+ }
393
+ return {
394
+ description: input.options.description ?? defaultDescription,
395
+ fixedSize: input.size,
396
+ littleEndian,
397
+ maxSize: input.size
398
+ };
399
+ }
400
+ function numberEncoderFactory(input) {
401
+ const codecData = sharedNumberFactory(input);
402
+ return {
403
+ description: codecData.description,
404
+ encode(value) {
405
+ if (input.range) {
406
+ assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
407
+ }
408
+ const arrayBuffer = new ArrayBuffer(input.size);
409
+ input.set(new DataView(arrayBuffer), value, codecData.littleEndian);
410
+ return new Uint8Array(arrayBuffer);
411
+ },
412
+ fixedSize: codecData.fixedSize,
413
+ maxSize: codecData.maxSize
414
+ };
415
+ }
416
+ function numberDecoderFactory(input) {
417
+ const codecData = sharedNumberFactory(input);
418
+ return {
419
+ decode(bytes, offset = 0) {
420
+ assertByteArrayIsNotEmptyForCodec(codecData.description, bytes, offset);
421
+ assertByteArrayHasEnoughBytesForCodec(codecData.description, input.size, bytes, offset);
422
+ const view = new DataView(toArrayBuffer(bytes, offset, input.size));
423
+ return [input.get(view, codecData.littleEndian), offset + input.size];
424
+ },
425
+ description: codecData.description,
426
+ fixedSize: codecData.fixedSize,
427
+ maxSize: codecData.maxSize
428
+ };
429
+ }
430
+ function toArrayBuffer(bytes, offset, length) {
431
+ const bytesOffset = bytes.byteOffset + (offset ?? 0);
432
+ const bytesLength = length ?? bytes.byteLength;
433
+ return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);
434
+ }
435
+ var getShortU16Encoder = (options = {}) => ({
436
+ description: options.description ?? "shortU16",
437
+ encode: (value) => {
438
+ assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
439
+ const bytes = [0];
440
+ for (let ii = 0; ; ii += 1) {
441
+ const alignedValue = value >> ii * 7;
442
+ if (alignedValue === 0) {
443
+ break;
444
+ }
445
+ const nextSevenBits = 127 & alignedValue;
446
+ bytes[ii] = nextSevenBits;
447
+ if (ii > 0) {
448
+ bytes[ii - 1] |= 128;
449
+ }
450
+ }
451
+ return new Uint8Array(bytes);
452
+ },
453
+ fixedSize: null,
454
+ maxSize: 3
455
+ });
456
+ var getShortU16Decoder = (options = {}) => ({
457
+ decode: (bytes, offset = 0) => {
458
+ let value = 0;
459
+ let byteCount = 0;
460
+ while (++byteCount) {
461
+ const byteIndex = byteCount - 1;
462
+ const currentByte = bytes[offset + byteIndex];
463
+ const nextSevenBits = 127 & currentByte;
464
+ value |= nextSevenBits << byteIndex * 7;
465
+ if ((currentByte & 128) === 0) {
466
+ break;
467
+ }
468
+ }
469
+ return [value, offset + byteCount];
470
+ },
471
+ description: options.description ?? "shortU16",
472
+ fixedSize: null,
473
+ maxSize: 3
474
+ });
475
+ var getU32Encoder = (options = {}) => numberEncoderFactory({
476
+ name: "u32",
477
+ options,
478
+ range: [0, Number("0xffffffff")],
479
+ set: (view, value, le) => view.setUint32(0, value, le),
480
+ size: 4
481
+ });
482
+ var getU32Decoder = (options = {}) => numberDecoderFactory({
483
+ get: (view, le) => view.getUint32(0, le),
484
+ name: "u32",
485
+ options,
486
+ size: 4
487
+ });
488
+ var getU8Encoder = (options = {}) => numberEncoderFactory({
489
+ name: "u8",
490
+ options,
491
+ range: [0, Number("0xff")],
492
+ set: (view, value) => view.setUint8(0, value),
493
+ size: 1
494
+ });
495
+ var getU8Decoder = (options = {}) => numberDecoderFactory({
496
+ get: (view) => view.getUint8(0),
497
+ name: "u8",
498
+ options,
499
+ size: 1
500
+ });
501
+
502
+ // ../codecs-data-structures/dist/index.browser.js
503
+ function sumCodecSizes(sizes) {
504
+ return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
505
+ }
506
+ function decodeArrayLikeCodecSize(size, childrenSizes, bytes, offset) {
507
+ if (typeof size === "number") {
508
+ return [size, offset];
509
+ }
510
+ if (typeof size === "object") {
511
+ return size.decode(bytes, offset);
512
+ }
513
+ if (size === "remainder") {
514
+ const childrenSize = sumCodecSizes(childrenSizes);
515
+ if (childrenSize === null) {
516
+ throw new Error('Codecs of "remainder" size must have fixed-size items.');
517
+ }
518
+ const remainder = bytes.slice(offset).length;
519
+ if (remainder % childrenSize !== 0) {
520
+ throw new Error(
521
+ `The remainder of the byte array (${remainder} bytes) cannot be split into chunks of ${childrenSize} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainder} modulo ${childrenSize} should be equal to zero.`
522
+ );
523
+ }
524
+ return [remainder / childrenSize, offset];
525
+ }
526
+ throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(size)}`);
527
+ }
528
+ function getArrayLikeCodecSizeDescription(size) {
529
+ return typeof size === "object" ? size.description : `${size}`;
530
+ }
531
+ function getArrayLikeCodecSizeFromChildren(size, childrenSizes) {
532
+ if (typeof size !== "number")
533
+ return null;
534
+ if (size === 0)
535
+ return 0;
536
+ const childrenSize = sumCodecSizes(childrenSizes);
537
+ return childrenSize === null ? null : childrenSize * size;
538
+ }
539
+ function getArrayLikeCodecSizePrefix(size, realSize) {
540
+ return typeof size === "object" ? size.encode(realSize) : new Uint8Array();
541
+ }
542
+ function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
543
+ if (expected !== actual) {
544
+ throw new Error(`Expected [${codecDescription}] to have ${expected} items, got ${actual}.`);
545
+ }
546
+ }
547
+ function arrayCodecHelper(item, size, description) {
548
+ if (size === "remainder" && item.fixedSize === null) {
549
+ throw new Error('Codecs of "remainder" size must have fixed-size items.');
550
+ }
551
+ return {
552
+ description: description ?? `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`,
553
+ fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]),
554
+ maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize])
555
+ };
556
+ }
557
+ function getArrayEncoder(item, options = {}) {
558
+ const size = options.size ?? getU32Encoder();
559
+ return {
560
+ ...arrayCodecHelper(item, size, options.description),
561
+ encode: (value) => {
562
+ if (typeof size === "number") {
563
+ assertValidNumberOfItemsForCodec("array", size, value.length);
564
+ }
565
+ return mergeBytes([getArrayLikeCodecSizePrefix(size, value.length), ...value.map((v) => item.encode(v))]);
566
+ }
567
+ };
568
+ }
569
+ function getArrayDecoder(item, options = {}) {
570
+ const size = options.size ?? getU32Decoder();
571
+ return {
572
+ ...arrayCodecHelper(item, size, options.description),
573
+ decode: (bytes, offset = 0) => {
574
+ if (typeof size === "object" && bytes.slice(offset).length === 0) {
575
+ return [[], offset];
576
+ }
577
+ const [resolvedSize, newOffset] = decodeArrayLikeCodecSize(size, [item.fixedSize], bytes, offset);
578
+ offset = newOffset;
579
+ const values = [];
580
+ for (let i = 0; i < resolvedSize; i += 1) {
581
+ const [value, newOffset2] = item.decode(bytes, offset);
582
+ values.push(value);
583
+ offset = newOffset2;
584
+ }
585
+ return [values, offset];
586
+ }
587
+ };
588
+ }
589
+ function getBytesEncoder(options = {}) {
590
+ const size = options.size ?? "variable";
591
+ const sizeDescription = typeof size === "object" ? size.description : `${size}`;
592
+ const description = options.description ?? `bytes(${sizeDescription})`;
593
+ const byteEncoder = {
594
+ description,
595
+ encode: (value) => value,
596
+ fixedSize: null,
597
+ maxSize: null
598
+ };
599
+ if (size === "variable") {
600
+ return byteEncoder;
601
+ }
602
+ if (typeof size === "number") {
603
+ return fixEncoder(byteEncoder, size, description);
604
+ }
605
+ return {
606
+ ...byteEncoder,
607
+ encode: (value) => {
608
+ const contentBytes = byteEncoder.encode(value);
609
+ const lengthBytes = size.encode(contentBytes.length);
610
+ return mergeBytes([lengthBytes, contentBytes]);
611
+ }
612
+ };
613
+ }
614
+ function getBytesDecoder(options = {}) {
615
+ const size = options.size ?? "variable";
616
+ const sizeDescription = typeof size === "object" ? size.description : `${size}`;
617
+ const description = options.description ?? `bytes(${sizeDescription})`;
618
+ const byteDecoder = {
619
+ decode: (bytes, offset = 0) => {
620
+ const slice = bytes.slice(offset);
621
+ return [slice, offset + slice.length];
622
+ },
623
+ description,
624
+ fixedSize: null,
625
+ maxSize: null
626
+ };
627
+ if (size === "variable") {
628
+ return byteDecoder;
629
+ }
630
+ if (typeof size === "number") {
631
+ return fixDecoder(byteDecoder, size, description);
632
+ }
633
+ return {
634
+ ...byteDecoder,
635
+ decode: (bytes, offset = 0) => {
636
+ assertByteArrayIsNotEmptyForCodec("bytes", bytes, offset);
637
+ const [lengthBigInt, lengthOffset] = size.decode(bytes, offset);
638
+ const length = Number(lengthBigInt);
639
+ offset = lengthOffset;
640
+ const contentBytes = bytes.slice(offset, offset + length);
641
+ assertByteArrayHasEnoughBytesForCodec("bytes", length, contentBytes);
642
+ const [value, contentOffset] = byteDecoder.decode(contentBytes);
643
+ offset += contentOffset;
644
+ return [value, offset];
645
+ }
646
+ };
647
+ }
648
+ function structCodecHelper(fields, description) {
649
+ const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", ");
650
+ return {
651
+ description: description ?? `struct(${fieldDescriptions})`,
652
+ fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)),
653
+ maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize))
654
+ };
655
+ }
656
+ function getStructEncoder(fields, options = {}) {
657
+ return {
658
+ ...structCodecHelper(fields, options.description),
659
+ encode: (struct) => {
660
+ const fieldBytes = fields.map(([key, codec]) => codec.encode(struct[key]));
661
+ return mergeBytes(fieldBytes);
662
+ }
663
+ };
664
+ }
665
+ function getStructDecoder(fields, options = {}) {
666
+ return {
667
+ ...structCodecHelper(fields, options.description),
668
+ decode: (bytes, offset = 0) => {
669
+ const struct = {};
670
+ fields.forEach(([key, codec]) => {
671
+ const [value, newOffset] = codec.decode(bytes, offset);
672
+ offset = newOffset;
673
+ struct[key] = value;
674
+ });
675
+ return [struct, offset];
676
+ }
677
+ };
678
+ }
679
+
680
+ // ../codecs-strings/dist/index.browser.js
681
+ function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
682
+ if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
683
+ throw new Error(`Expected a string of base ${alphabet4.length}, got [${givenValue}].`);
684
+ }
685
+ }
686
+ var getBaseXEncoder = (alphabet4) => {
687
+ const base = alphabet4.length;
688
+ const baseBigInt = BigInt(base);
689
+ return {
690
+ description: `base${base}`,
691
+ encode(value) {
692
+ assertValidBaseString(alphabet4, value);
693
+ if (value === "")
694
+ return new Uint8Array();
695
+ const chars = [...value];
696
+ let trailIndex = chars.findIndex((c) => c !== alphabet4[0]);
697
+ trailIndex = trailIndex === -1 ? chars.length : trailIndex;
698
+ const leadingZeroes = Array(trailIndex).fill(0);
699
+ if (trailIndex === chars.length)
700
+ return Uint8Array.from(leadingZeroes);
701
+ const tailChars = chars.slice(trailIndex);
702
+ let base10Number = 0n;
703
+ let baseXPower = 1n;
704
+ for (let i = tailChars.length - 1; i >= 0; i -= 1) {
705
+ base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
706
+ baseXPower *= baseBigInt;
707
+ }
708
+ const tailBytes = [];
709
+ while (base10Number > 0n) {
710
+ tailBytes.unshift(Number(base10Number % 256n));
711
+ base10Number /= 256n;
712
+ }
713
+ return Uint8Array.from(leadingZeroes.concat(tailBytes));
714
+ },
715
+ fixedSize: null,
716
+ maxSize: null
717
+ };
718
+ };
719
+ var getBaseXDecoder = (alphabet4) => {
720
+ const base = alphabet4.length;
721
+ const baseBigInt = BigInt(base);
722
+ return {
723
+ decode(rawBytes, offset = 0) {
724
+ const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);
725
+ if (bytes.length === 0)
726
+ return ["", 0];
727
+ let trailIndex = bytes.findIndex((n) => n !== 0);
728
+ trailIndex = trailIndex === -1 ? bytes.length : trailIndex;
729
+ const leadingZeroes = alphabet4[0].repeat(trailIndex);
730
+ if (trailIndex === bytes.length)
731
+ return [leadingZeroes, rawBytes.length];
732
+ let base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
733
+ const tailChars = [];
734
+ while (base10Number > 0n) {
735
+ tailChars.unshift(alphabet4[Number(base10Number % baseBigInt)]);
736
+ base10Number /= baseBigInt;
737
+ }
738
+ return [leadingZeroes + tailChars.join(""), rawBytes.length];
739
+ },
740
+ description: `base${base}`,
741
+ fixedSize: null,
742
+ maxSize: null
743
+ };
744
+ };
745
+ var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
746
+ var getBase58Encoder = () => getBaseXEncoder(alphabet2);
747
+ var getBase58Decoder = () => getBaseXDecoder(alphabet2);
748
+ var removeNullCharacters = (value) => (
749
+ // eslint-disable-next-line no-control-regex
750
+ value.replace(/\u0000/g, "")
751
+ );
752
+ var e = globalThis.TextDecoder;
753
+ var o = globalThis.TextEncoder;
754
+ var getUtf8Encoder = () => {
755
+ let textEncoder;
756
+ return {
757
+ description: "utf8",
758
+ encode: (value) => new Uint8Array((textEncoder || (textEncoder = new o())).encode(value)),
759
+ fixedSize: null,
760
+ maxSize: null
761
+ };
762
+ };
763
+ var getUtf8Decoder = () => {
764
+ let textDecoder;
765
+ return {
766
+ decode(bytes, offset = 0) {
767
+ const value = (textDecoder || (textDecoder = new e())).decode(bytes.slice(offset));
768
+ return [removeNullCharacters(value), bytes.length];
769
+ },
770
+ description: "utf8",
771
+ fixedSize: null,
772
+ maxSize: null
773
+ };
774
+ };
775
+ var getStringEncoder = (options = {}) => {
776
+ const size = options.size ?? getU32Encoder();
777
+ const encoding = options.encoding ?? getUtf8Encoder();
778
+ const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
779
+ if (size === "variable") {
780
+ return { ...encoding, description };
781
+ }
782
+ if (typeof size === "number") {
783
+ return fixEncoder(encoding, size, description);
784
+ }
785
+ return {
786
+ description,
787
+ encode: (value) => {
788
+ const contentBytes = encoding.encode(value);
789
+ const lengthBytes = size.encode(contentBytes.length);
790
+ return mergeBytes([lengthBytes, contentBytes]);
791
+ },
792
+ fixedSize: null,
793
+ maxSize: null
794
+ };
795
+ };
796
+ var getStringDecoder = (options = {}) => {
797
+ const size = options.size ?? getU32Decoder();
798
+ const encoding = options.encoding ?? getUtf8Decoder();
799
+ const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
800
+ if (size === "variable") {
801
+ return { ...encoding, description };
802
+ }
803
+ if (typeof size === "number") {
804
+ return fixDecoder(encoding, size, description);
805
+ }
806
+ return {
807
+ decode: (bytes, offset = 0) => {
808
+ assertByteArrayIsNotEmptyForCodec("string", bytes, offset);
809
+ const [lengthBigInt, lengthOffset] = size.decode(bytes, offset);
810
+ const length = Number(lengthBigInt);
811
+ offset = lengthOffset;
812
+ const contentBytes = bytes.slice(offset, offset + length);
813
+ assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes);
814
+ const [value, contentOffset] = encoding.decode(contentBytes);
815
+ offset += contentOffset;
816
+ return [value, offset];
817
+ },
818
+ description,
819
+ fixedSize: null,
820
+ maxSize: null
821
+ };
822
+ };
823
+ function getSizeDescription(size) {
824
+ return typeof size === "object" ? size.description : `${size}`;
825
+ }
826
+
827
+ // ../assertions/dist/index.browser.js
828
+ function assertIsSecureContext() {
829
+ if (!globalThis.isSecureContext) {
830
+ throw new Error(
831
+ "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"
832
+ );
833
+ }
834
+ }
835
+ async function assertKeyExporterIsAvailable() {
836
+ assertIsSecureContext();
837
+ if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
679
838
  throw new Error("No key export implementation could be found");
680
839
  }
681
840
  }
682
- async function assertSigningCapabilityIsAvailable() {
683
- assertIsSecureContext();
684
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
685
- throw new Error("No signing implementation could be found");
686
- }
841
+ async function assertSigningCapabilityIsAvailable() {
842
+ assertIsSecureContext();
843
+ if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
844
+ throw new Error("No signing implementation could be found");
845
+ }
846
+ }
847
+
848
+ // ../addresses/dist/index.browser.js
849
+ var memoizedBase58Encoder;
850
+ var memoizedBase58Decoder;
851
+ function getMemoizedBase58Encoder() {
852
+ if (!memoizedBase58Encoder)
853
+ memoizedBase58Encoder = getBase58Encoder();
854
+ return memoizedBase58Encoder;
855
+ }
856
+ function getMemoizedBase58Decoder() {
857
+ if (!memoizedBase58Decoder)
858
+ memoizedBase58Decoder = getBase58Decoder();
859
+ return memoizedBase58Decoder;
860
+ }
861
+ function assertIsAddress(putativeBase58EncodedAddress) {
862
+ try {
863
+ if (
864
+ // Lowest address (32 bytes of zeroes)
865
+ putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
866
+ putativeBase58EncodedAddress.length > 44
867
+ ) {
868
+ throw new Error("Expected input string to decode to a byte array of length 32.");
869
+ }
870
+ const base58Encoder = getMemoizedBase58Encoder();
871
+ const bytes = base58Encoder.encode(putativeBase58EncodedAddress);
872
+ const numBytes = bytes.byteLength;
873
+ if (numBytes !== 32) {
874
+ throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
875
+ }
876
+ } catch (e2) {
877
+ throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
878
+ cause: e2
879
+ });
880
+ }
881
+ }
882
+ function address(putativeBase58EncodedAddress) {
883
+ assertIsAddress(putativeBase58EncodedAddress);
884
+ return putativeBase58EncodedAddress;
885
+ }
886
+ function getAddressEncoder(config) {
887
+ return mapEncoder(
888
+ getStringEncoder({
889
+ description: config?.description ?? "Base58EncodedAddress",
890
+ encoding: getMemoizedBase58Encoder(),
891
+ size: 32
892
+ }),
893
+ (putativeAddress) => address(putativeAddress)
894
+ );
687
895
  }
688
- function getBase58EncodedAddressCodec(config) {
689
- return string({
690
- description: config?.description ?? ("A 32-byte account address" ),
691
- encoding: base58,
896
+ function getAddressDecoder(config) {
897
+ return getStringDecoder({
898
+ description: config?.description ?? "Base58EncodedAddress",
899
+ encoding: getMemoizedBase58Decoder(),
692
900
  size: 32
693
901
  });
694
902
  }
695
- function getBase58EncodedAddressComparator() {
903
+ function getAddressComparator() {
696
904
  return new Intl.Collator("en", {
697
905
  caseFirst: "lower",
698
906
  ignorePunctuation: false,
@@ -708,20 +916,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
708
916
  throw new Error("The `CryptoKey` must be an `Ed25519` public key");
709
917
  }
710
918
  const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
711
- const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
919
+ const [base58EncodedAddress] = getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
712
920
  return base58EncodedAddress;
713
921
  }
714
922
 
715
- // ../keys/dist/index.browser.js
716
- async function signBytes(key, data) {
717
- await assertSigningCapabilityIsAvailable();
718
- const signedData = await crypto.subtle.sign("Ed25519", key, data);
719
- return new Uint8Array(signedData);
720
- }
721
-
722
923
  // src/accounts.ts
723
- function upsert(addressMap, address, update) {
724
- addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
924
+ function upsert(addressMap, address2, update) {
925
+ addressMap[address2] = update(addressMap[address2] ?? { role: AccountRole.READONLY });
725
926
  }
726
927
  var TYPE = Symbol("AddressMapTypeProperty");
727
928
  function getAddressMapFromInstructions(feePayer, instructions) {
@@ -772,7 +973,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
772
973
  const shouldReplaceEntry = (
773
974
  // Consider using the new LOOKUP_TABLE if its address is different...
774
975
  entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
775
- (addressComparator || (addressComparator = getBase58EncodedAddressComparator()))(
976
+ (addressComparator || (addressComparator = getAddressComparator()))(
776
977
  accountMeta.lookupTableAddress,
777
978
  entry.lookupTableAddress
778
979
  ) < 0
@@ -878,14 +1079,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
878
1079
  if (leftIsWritable !== isWritableRole(rightEntry.role)) {
879
1080
  return leftIsWritable ? -1 : 1;
880
1081
  }
881
- addressComparator || (addressComparator = getBase58EncodedAddressComparator());
1082
+ addressComparator || (addressComparator = getAddressComparator());
882
1083
  if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {
883
1084
  return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
884
1085
  } else {
885
1086
  return addressComparator(leftAddress, rightAddress);
886
1087
  }
887
- }).map(([address, addressMeta]) => ({
888
- address,
1088
+ }).map(([address2, addressMeta]) => ({
1089
+ address: address2,
889
1090
  ...addressMeta
890
1091
  }));
891
1092
  return orderedAccounts;
@@ -909,7 +1110,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
909
1110
  entry.readableIndices.push(account.addressIndex);
910
1111
  }
911
1112
  }
912
- return Object.keys(index).sort(getBase58EncodedAddressComparator()).map((lookupTableAddress) => ({
1113
+ return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
913
1114
  lookupTableAddress,
914
1115
  ...index[lookupTableAddress]
915
1116
  }));
@@ -954,7 +1155,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
954
1155
  return instructions.map(({ accounts, data, programAddress }) => {
955
1156
  return {
956
1157
  programAddressIndex: accountIndex[programAddress],
957
- ...accounts ? { accountIndices: accounts.map(({ address }) => accountIndex[address]) } : null,
1158
+ ...accounts ? { accountIndices: accounts.map(({ address: address2 }) => accountIndex[address2]) } : null,
958
1159
  ...data ? { data } : null
959
1160
  };
960
1161
  });
@@ -972,7 +1173,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
972
1173
  function getCompiledStaticAccounts(orderedAccounts) {
973
1174
  const firstLookupTableAccountIndex = orderedAccounts.findIndex((account) => "lookupTableAddress" in account);
974
1175
  const orderedStaticAccounts = firstLookupTableAccountIndex === -1 ? orderedAccounts : orderedAccounts.slice(0, firstLookupTableAccountIndex);
975
- return orderedStaticAccounts.map(({ address }) => address);
1176
+ return orderedStaticAccounts.map(({ address: address2 }) => address2);
976
1177
  }
977
1178
 
978
1179
  // src/message.ts
@@ -989,145 +1190,320 @@ this.globalThis.solanaWeb3 = (function (exports) {
989
1190
  };
990
1191
  }
991
1192
 
1193
+ // src/compile-transaction.ts
1194
+ function getCompiledTransaction(transaction) {
1195
+ const compiledMessage = compileMessage(transaction);
1196
+ let signatures;
1197
+ if ("signatures" in transaction) {
1198
+ signatures = [];
1199
+ for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
1200
+ signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
1201
+ }
1202
+ } else {
1203
+ signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
1204
+ }
1205
+ return {
1206
+ compiledMessage,
1207
+ signatures
1208
+ };
1209
+ }
1210
+
1211
+ // ../functional/dist/index.browser.js
1212
+ function pipe(init, ...fns) {
1213
+ return fns.reduce((acc, fn) => fn(acc), init);
1214
+ }
1215
+
1216
+ // src/decompile-transaction.ts
1217
+ function getAccountMetas(message) {
1218
+ const { header } = message;
1219
+ const numWritableSignerAccounts = header.numSignerAccounts - header.numReadonlySignerAccounts;
1220
+ const numWritableNonSignerAccounts = message.staticAccounts.length - header.numSignerAccounts - header.numReadonlyNonSignerAccounts;
1221
+ const accountMetas = [];
1222
+ let accountIndex = 0;
1223
+ for (let i = 0; i < numWritableSignerAccounts; i++) {
1224
+ accountMetas.push({
1225
+ address: message.staticAccounts[accountIndex],
1226
+ role: AccountRole.WRITABLE_SIGNER
1227
+ });
1228
+ accountIndex++;
1229
+ }
1230
+ for (let i = 0; i < header.numReadonlySignerAccounts; i++) {
1231
+ accountMetas.push({
1232
+ address: message.staticAccounts[accountIndex],
1233
+ role: AccountRole.READONLY_SIGNER
1234
+ });
1235
+ accountIndex++;
1236
+ }
1237
+ for (let i = 0; i < numWritableNonSignerAccounts; i++) {
1238
+ accountMetas.push({
1239
+ address: message.staticAccounts[accountIndex],
1240
+ role: AccountRole.WRITABLE
1241
+ });
1242
+ accountIndex++;
1243
+ }
1244
+ for (let i = 0; i < header.numReadonlyNonSignerAccounts; i++) {
1245
+ accountMetas.push({
1246
+ address: message.staticAccounts[accountIndex],
1247
+ role: AccountRole.READONLY
1248
+ });
1249
+ accountIndex++;
1250
+ }
1251
+ return accountMetas;
1252
+ }
1253
+ function convertInstruction(instruction, accountMetas) {
1254
+ const programAddress = accountMetas[instruction.programAddressIndex]?.address;
1255
+ if (!programAddress) {
1256
+ throw new Error(`Could not find program address at index ${instruction.programAddressIndex}`);
1257
+ }
1258
+ const accounts = instruction.accountIndices?.map((accountIndex) => accountMetas[accountIndex]);
1259
+ const { data } = instruction;
1260
+ return {
1261
+ programAddress,
1262
+ ...accounts && accounts.length ? { accounts } : {},
1263
+ ...data && data.length ? { data } : {}
1264
+ };
1265
+ }
1266
+ function getLifetimeConstraint(messageLifetimeToken, firstInstruction, lastValidBlockHeight) {
1267
+ if (!firstInstruction || !isAdvanceNonceAccountInstruction(firstInstruction)) {
1268
+ return {
1269
+ blockhash: messageLifetimeToken,
1270
+ lastValidBlockHeight: lastValidBlockHeight ?? 2n ** 64n - 1n
1271
+ // U64 MAX
1272
+ };
1273
+ } else {
1274
+ const nonceAccountAddress = firstInstruction.accounts[0].address;
1275
+ assertIsAddress(nonceAccountAddress);
1276
+ const nonceAuthorityAddress = firstInstruction.accounts[2].address;
1277
+ assertIsAddress(nonceAuthorityAddress);
1278
+ return {
1279
+ nonce: messageLifetimeToken,
1280
+ nonceAccountAddress,
1281
+ nonceAuthorityAddress
1282
+ };
1283
+ }
1284
+ }
1285
+ function convertSignatures(compiledTransaction) {
1286
+ const {
1287
+ compiledMessage: { staticAccounts },
1288
+ signatures
1289
+ } = compiledTransaction;
1290
+ return signatures.reduce((acc, sig, index) => {
1291
+ const allZeros = sig.every((byte) => byte === 0);
1292
+ if (allZeros)
1293
+ return acc;
1294
+ const address2 = staticAccounts[index];
1295
+ return { ...acc, [address2]: sig };
1296
+ }, {});
1297
+ }
1298
+ function decompileTransaction(compiledTransaction, lastValidBlockHeight) {
1299
+ const { compiledMessage } = compiledTransaction;
1300
+ if ("addressTableLookups" in compiledMessage && compiledMessage.addressTableLookups.length > 0) {
1301
+ throw new Error("Cannot convert transaction with addressTableLookups");
1302
+ }
1303
+ const feePayer = compiledMessage.staticAccounts[0];
1304
+ if (!feePayer)
1305
+ throw new Error("No fee payer set in CompiledTransaction");
1306
+ const accountMetas = getAccountMetas(compiledMessage);
1307
+ const instructions = compiledMessage.instructions.map(
1308
+ (compiledInstruction) => convertInstruction(compiledInstruction, accountMetas)
1309
+ );
1310
+ const firstInstruction = instructions[0];
1311
+ const lifetimeConstraint = getLifetimeConstraint(
1312
+ compiledMessage.lifetimeToken,
1313
+ firstInstruction,
1314
+ lastValidBlockHeight
1315
+ );
1316
+ const signatures = convertSignatures(compiledTransaction);
1317
+ return pipe(
1318
+ createTransaction({ version: compiledMessage.version }),
1319
+ (tx) => setTransactionFeePayer(feePayer, tx),
1320
+ (tx) => instructions.reduce((acc, instruction) => {
1321
+ return appendTransactionInstruction(instruction, acc);
1322
+ }, tx),
1323
+ (tx) => "blockhash" in lifetimeConstraint ? setTransactionLifetimeUsingBlockhash(lifetimeConstraint, tx) : setTransactionLifetimeUsingDurableNonce(lifetimeConstraint, tx),
1324
+ (tx) => compiledTransaction.signatures.length ? { ...tx, signatures } : tx
1325
+ );
1326
+ }
1327
+
992
1328
  // src/serializers/address-table-lookup.ts
993
- function getAddressTableLookupCodec() {
994
- return struct(
995
- [
1329
+ var lookupTableAddressDescription = "The address of the address lookup table account from which instruction addresses should be looked up" ;
1330
+ var writableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as writeable" ;
1331
+ var readableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as read-only" ;
1332
+ var addressTableLookupDescription = "A pointer to the address of an address lookup table, along with the readonly/writeable indices of the addresses that should be loaded from it" ;
1333
+ var memoizedAddressTableLookupEncoder;
1334
+ function getAddressTableLookupEncoder() {
1335
+ if (!memoizedAddressTableLookupEncoder) {
1336
+ memoizedAddressTableLookupEncoder = getStructEncoder(
996
1337
  [
997
- "lookupTableAddress",
998
- getBase58EncodedAddressCodec(
999
- {
1000
- description: "The address of the address lookup table account from which instruction addresses should be looked up"
1001
- }
1002
- )
1338
+ ["lookupTableAddress", getAddressEncoder({ description: lookupTableAddressDescription })],
1339
+ [
1340
+ "writableIndices",
1341
+ getArrayEncoder(getU8Encoder(), {
1342
+ description: writableIndicesDescription,
1343
+ size: getShortU16Encoder()
1344
+ })
1345
+ ],
1346
+ [
1347
+ "readableIndices",
1348
+ getArrayEncoder(getU8Encoder(), {
1349
+ description: readableIndicesDescription,
1350
+ size: getShortU16Encoder()
1351
+ })
1352
+ ]
1003
1353
  ],
1354
+ { description: addressTableLookupDescription }
1355
+ );
1356
+ }
1357
+ return memoizedAddressTableLookupEncoder;
1358
+ }
1359
+ var memoizedAddressTableLookupDecoder;
1360
+ function getAddressTableLookupDecoder() {
1361
+ if (!memoizedAddressTableLookupDecoder) {
1362
+ memoizedAddressTableLookupDecoder = getStructDecoder(
1004
1363
  [
1005
- "writableIndices",
1006
- array(u8(), {
1007
- ...{
1008
- description: "The indices of the accounts in the lookup table that should be loaded as writeable"
1009
- } ,
1010
- size: shortU16()
1011
- })
1364
+ ["lookupTableAddress", getAddressDecoder({ description: lookupTableAddressDescription })],
1365
+ [
1366
+ "writableIndices",
1367
+ getArrayDecoder(getU8Decoder(), {
1368
+ description: writableIndicesDescription,
1369
+ size: getShortU16Decoder()
1370
+ })
1371
+ ],
1372
+ [
1373
+ "readableIndices",
1374
+ getArrayDecoder(getU8Decoder(), {
1375
+ description: readableIndicesDescription,
1376
+ size: getShortU16Decoder()
1377
+ })
1378
+ ]
1012
1379
  ],
1013
- [
1014
- "readableIndices",
1015
- array(u8(), {
1016
- ...{
1017
- description: "The indices of the accounts in the lookup table that should be loaded as read-only"
1018
- } ,
1019
- size: shortU16()
1020
- })
1021
- ]
1022
- ],
1023
- {
1024
- description: "A pointer to the address of an address lookup table, along with the readonly/writeable indices of the addresses that should be loaded from it"
1025
- }
1026
- );
1380
+ { description: addressTableLookupDescription }
1381
+ );
1382
+ }
1383
+ return memoizedAddressTableLookupDecoder;
1027
1384
  }
1028
1385
 
1029
1386
  // src/serializers/header.ts
1030
- function getMessageHeaderCodec() {
1031
- return struct(
1387
+ var memoizedU8Encoder;
1388
+ function getMemoizedU8Encoder() {
1389
+ if (!memoizedU8Encoder)
1390
+ memoizedU8Encoder = getU8Encoder();
1391
+ return memoizedU8Encoder;
1392
+ }
1393
+ function getMemoizedU8EncoderDescription(description) {
1394
+ const encoder = getMemoizedU8Encoder();
1395
+ return {
1396
+ ...encoder,
1397
+ description: description ?? encoder.description
1398
+ };
1399
+ }
1400
+ var memoizedU8Decoder;
1401
+ function getMemoizedU8Decoder() {
1402
+ if (!memoizedU8Decoder)
1403
+ memoizedU8Decoder = getU8Decoder();
1404
+ return memoizedU8Decoder;
1405
+ }
1406
+ function getMemoizedU8DecoderDescription(description) {
1407
+ const decoder = getMemoizedU8Decoder();
1408
+ return {
1409
+ ...decoder,
1410
+ description: description ?? decoder.description
1411
+ };
1412
+ }
1413
+ var numSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" ;
1414
+ var numReadonlySignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable" ;
1415
+ var numReadonlyNonSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" ;
1416
+ var messageHeaderDescription = "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" ;
1417
+ function getMessageHeaderEncoder() {
1418
+ return getStructEncoder(
1032
1419
  [
1033
- [
1034
- "numSignerAccounts",
1035
- u8(
1036
- {
1037
- description: "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction"
1038
- }
1039
- )
1040
- ],
1041
- [
1042
- "numReadonlySignerAccounts",
1043
- u8(
1044
- {
1045
- description: "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable"
1046
- }
1047
- )
1048
- ],
1049
- [
1050
- "numReadonlyNonSignerAccounts",
1051
- u8(
1052
- {
1053
- description: "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable"
1054
- }
1055
- )
1056
- ]
1420
+ ["numSignerAccounts", getMemoizedU8EncoderDescription(numSignerAccountsDescription)],
1421
+ ["numReadonlySignerAccounts", getMemoizedU8EncoderDescription(numReadonlySignerAccountsDescription)],
1422
+ ["numReadonlyNonSignerAccounts", getMemoizedU8EncoderDescription(numReadonlyNonSignerAccountsDescription)]
1057
1423
  ],
1058
1424
  {
1059
- description: "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses"
1060
- }
1425
+ description: messageHeaderDescription
1426
+ }
1061
1427
  );
1062
1428
  }
1063
-
1064
- // src/serializers/instruction.ts
1065
- function getInstructionCodec() {
1066
- return mapSerializer(
1067
- struct([
1068
- [
1069
- "programAddressIndex",
1070
- u8(
1071
- {
1072
- description: "The index of the program being called, according to the well-ordered accounts list for this transaction"
1073
- }
1074
- )
1075
- ],
1076
- [
1077
- "accountIndices",
1078
- array(
1079
- u8({
1080
- description: "The index of an account, according to the well-ordered accounts list for this transaction"
1081
- }),
1082
- {
1083
- description: "An optional list of account indices, according to the well-ordered accounts list for this transaction, in the order in which the program being called expects them" ,
1084
- size: shortU16()
1085
- }
1086
- )
1087
- ],
1088
- [
1089
- "data",
1090
- bytes({
1091
- description: "An optional buffer of data passed to the instruction" ,
1092
- size: shortU16()
1093
- })
1094
- ]
1095
- ]),
1096
- (value) => {
1097
- if (value.accountIndices !== void 0 && value.data !== void 0) {
1098
- return value;
1099
- }
1100
- return {
1101
- ...value,
1102
- accountIndices: value.accountIndices ?? [],
1103
- data: value.data ?? new Uint8Array(0)
1104
- };
1105
- },
1106
- (value) => {
1107
- if (value.accountIndices.length && value.data.byteLength) {
1108
- return value;
1109
- }
1110
- const { accountIndices, data, ...rest } = value;
1111
- return {
1112
- ...rest,
1113
- ...accountIndices.length ? { accountIndices } : null,
1114
- ...data.byteLength ? { data } : null
1115
- };
1429
+ function getMessageHeaderDecoder() {
1430
+ return getStructDecoder(
1431
+ [
1432
+ ["numSignerAccounts", getMemoizedU8DecoderDescription(numSignerAccountsDescription)],
1433
+ ["numReadonlySignerAccounts", getMemoizedU8DecoderDescription(numReadonlySignerAccountsDescription)],
1434
+ ["numReadonlyNonSignerAccounts", getMemoizedU8DecoderDescription(numReadonlyNonSignerAccountsDescription)]
1435
+ ],
1436
+ {
1437
+ description: messageHeaderDescription
1116
1438
  }
1117
1439
  );
1118
1440
  }
1119
1441
 
1120
- // src/serializers/unimplemented.ts
1121
- function getError(type, name) {
1122
- const functionSuffix = name + type[0].toUpperCase() + type.slice(1);
1123
- return new Error(
1124
- `No ${type} exists for ${name}. Use \`get${functionSuffix}()\` if you need a ${type}, and \`get${name}Codec()\` if you need to both encode and decode ${name}`
1125
- );
1442
+ // src/serializers/instruction.ts
1443
+ var programAddressIndexDescription = "The index of the program being called, according to the well-ordered accounts list for this transaction" ;
1444
+ var accountIndexDescription = "The index of an account, according to the well-ordered accounts list for this transaction" ;
1445
+ var accountIndicesDescription = "An optional list of account indices, according to the well-ordered accounts list for this transaction, in the order in which the program being called expects them" ;
1446
+ var dataDescription = "An optional buffer of data passed to the instruction" ;
1447
+ var memoizedGetInstructionEncoder;
1448
+ function getInstructionEncoder() {
1449
+ if (!memoizedGetInstructionEncoder) {
1450
+ memoizedGetInstructionEncoder = mapEncoder(
1451
+ getStructEncoder([
1452
+ ["programAddressIndex", getU8Encoder({ description: programAddressIndexDescription })],
1453
+ [
1454
+ "accountIndices",
1455
+ getArrayEncoder(getU8Encoder({ description: accountIndexDescription }), {
1456
+ description: accountIndicesDescription,
1457
+ size: getShortU16Encoder()
1458
+ })
1459
+ ],
1460
+ ["data", getBytesEncoder({ description: dataDescription, size: getShortU16Encoder() })]
1461
+ ]),
1462
+ // Convert an instruction to have all fields defined
1463
+ (instruction) => {
1464
+ if (instruction.accountIndices !== void 0 && instruction.data !== void 0) {
1465
+ return instruction;
1466
+ }
1467
+ return {
1468
+ ...instruction,
1469
+ accountIndices: instruction.accountIndices ?? [],
1470
+ data: instruction.data ?? new Uint8Array(0)
1471
+ };
1472
+ }
1473
+ );
1474
+ }
1475
+ return memoizedGetInstructionEncoder;
1126
1476
  }
1127
- function getUnimplementedDecoder(name) {
1128
- return () => {
1129
- throw getError("decoder", name);
1130
- };
1477
+ var memoizedGetInstructionDecoder;
1478
+ function getInstructionDecoder() {
1479
+ if (!memoizedGetInstructionDecoder) {
1480
+ memoizedGetInstructionDecoder = mapDecoder(
1481
+ getStructDecoder([
1482
+ ["programAddressIndex", getU8Decoder({ description: programAddressIndexDescription })],
1483
+ [
1484
+ "accountIndices",
1485
+ getArrayDecoder(getU8Decoder({ description: accountIndexDescription }), {
1486
+ description: accountIndicesDescription,
1487
+ size: getShortU16Decoder()
1488
+ })
1489
+ ],
1490
+ ["data", getBytesDecoder({ description: dataDescription, size: getShortU16Decoder() })]
1491
+ ]),
1492
+ // Convert an instruction to exclude optional fields if they are empty
1493
+ (instruction) => {
1494
+ if (instruction.accountIndices.length && instruction.data.byteLength) {
1495
+ return instruction;
1496
+ }
1497
+ const { accountIndices, data, ...rest } = instruction;
1498
+ return {
1499
+ ...rest,
1500
+ ...accountIndices.length ? { accountIndices } : null,
1501
+ ...data.byteLength ? { data } : null
1502
+ };
1503
+ }
1504
+ );
1505
+ }
1506
+ return memoizedGetInstructionDecoder;
1131
1507
  }
1132
1508
 
1133
1509
  // src/serializers/transaction-version.ts
@@ -1137,8 +1513,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
1137
1513
  fixedSize: null,
1138
1514
  maxSize: 1
1139
1515
  };
1140
- function deserialize(bytes2, offset = 0) {
1141
- const firstByte = bytes2[offset];
1516
+ function decode(bytes, offset = 0) {
1517
+ const firstByte = bytes[offset];
1142
1518
  if ((firstByte & VERSION_FLAG_MASK) === 0) {
1143
1519
  return ["legacy", offset];
1144
1520
  } else {
@@ -1146,7 +1522,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1146
1522
  return [version, offset + 1];
1147
1523
  }
1148
1524
  }
1149
- function serialize(value) {
1525
+ function encode(value) {
1150
1526
  if (value === "legacy") {
1151
1527
  return new Uint8Array();
1152
1528
  }
@@ -1155,99 +1531,260 @@ this.globalThis.solanaWeb3 = (function (exports) {
1155
1531
  }
1156
1532
  return new Uint8Array([value | VERSION_FLAG_MASK]);
1157
1533
  }
1158
- function getTransactionVersionCodec() {
1534
+ function getTransactionVersionDecoder() {
1535
+ return {
1536
+ ...BASE_CONFIG,
1537
+ decode
1538
+ };
1539
+ }
1540
+ function getTransactionVersionEncoder() {
1159
1541
  return {
1160
1542
  ...BASE_CONFIG,
1161
- deserialize,
1162
- serialize
1543
+ encode
1163
1544
  };
1164
1545
  }
1165
1546
 
1166
1547
  // src/serializers/message.ts
1167
- var BASE_CONFIG2 = {
1168
- description: "The wire format of a Solana transaction message" ,
1169
- fixedSize: null,
1170
- maxSize: null
1171
- };
1172
- function serialize2(compiledMessage) {
1173
- if (compiledMessage.version === "legacy") {
1174
- return struct(getPreludeStructSerializerTuple()).serialize(compiledMessage);
1175
- } else {
1176
- return mapSerializer(
1177
- struct([
1178
- ...getPreludeStructSerializerTuple(),
1179
- ["addressTableLookups", getAddressTableLookupsSerializer()]
1180
- ]),
1181
- (value) => {
1182
- if (value.version === "legacy") {
1183
- return value;
1184
- }
1185
- return {
1186
- ...value,
1187
- addressTableLookups: value.addressTableLookups ?? []
1188
- };
1548
+ var staticAccountsDescription = "A compact-array of static account addresses belonging to this transaction" ;
1549
+ var lifetimeTokenDescription = "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ;
1550
+ var instructionsDescription = "A compact-array of instructions belonging to this transaction" ;
1551
+ var addressTableLookupsDescription = "A compact array of address table lookups belonging to this transaction" ;
1552
+ function getCompiledMessageLegacyEncoder() {
1553
+ return getStructEncoder(getPreludeStructEncoderTuple());
1554
+ }
1555
+ function getCompiledMessageVersionedEncoder() {
1556
+ return mapEncoder(
1557
+ getStructEncoder([
1558
+ ...getPreludeStructEncoderTuple(),
1559
+ ["addressTableLookups", getAddressTableLookupArrayEncoder()]
1560
+ ]),
1561
+ (value) => {
1562
+ if (value.version === "legacy") {
1563
+ return value;
1189
1564
  }
1190
- ).serialize(compiledMessage);
1191
- }
1565
+ return {
1566
+ ...value,
1567
+ addressTableLookups: value.addressTableLookups ?? []
1568
+ };
1569
+ }
1570
+ );
1192
1571
  }
1193
- function getPreludeStructSerializerTuple() {
1572
+ function getPreludeStructEncoderTuple() {
1194
1573
  return [
1195
- ["version", getTransactionVersionCodec()],
1196
- ["header", getMessageHeaderCodec()],
1574
+ ["version", getTransactionVersionEncoder()],
1575
+ ["header", getMessageHeaderEncoder()],
1197
1576
  [
1198
1577
  "staticAccounts",
1199
- array(getBase58EncodedAddressCodec(), {
1200
- description: "A compact-array of static account addresses belonging to this transaction" ,
1201
- size: shortU16()
1578
+ getArrayEncoder(getAddressEncoder(), {
1579
+ description: staticAccountsDescription,
1580
+ size: getShortU16Encoder()
1202
1581
  })
1203
1582
  ],
1204
1583
  [
1205
1584
  "lifetimeToken",
1206
- string({
1207
- description: "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ,
1208
- encoding: base58,
1585
+ getStringEncoder({
1586
+ description: lifetimeTokenDescription,
1587
+ encoding: getBase58Encoder(),
1209
1588
  size: 32
1210
1589
  })
1211
1590
  ],
1212
1591
  [
1213
1592
  "instructions",
1214
- array(getInstructionCodec(), {
1215
- description: "A compact-array of instructions belonging to this transaction" ,
1216
- size: shortU16()
1593
+ getArrayEncoder(getInstructionEncoder(), {
1594
+ description: instructionsDescription,
1595
+ size: getShortU16Encoder()
1217
1596
  })
1218
1597
  ]
1219
1598
  ];
1220
1599
  }
1221
- function getAddressTableLookupsSerializer() {
1222
- return array(getAddressTableLookupCodec(), {
1223
- ...{ description: "A compact array of address table lookups belonging to this transaction" } ,
1224
- size: shortU16()
1600
+ function getPreludeStructDecoderTuple() {
1601
+ return [
1602
+ ["version", getTransactionVersionDecoder()],
1603
+ ["header", getMessageHeaderDecoder()],
1604
+ [
1605
+ "staticAccounts",
1606
+ getArrayDecoder(getAddressDecoder(), {
1607
+ description: staticAccountsDescription,
1608
+ size: getShortU16Decoder()
1609
+ })
1610
+ ],
1611
+ [
1612
+ "lifetimeToken",
1613
+ getStringDecoder({
1614
+ description: lifetimeTokenDescription,
1615
+ encoding: getBase58Decoder(),
1616
+ size: 32
1617
+ })
1618
+ ],
1619
+ [
1620
+ "instructions",
1621
+ getArrayDecoder(getInstructionDecoder(), {
1622
+ description: instructionsDescription,
1623
+ size: getShortU16Decoder()
1624
+ })
1625
+ ],
1626
+ ["addressTableLookups", getAddressTableLookupArrayDecoder()]
1627
+ ];
1628
+ }
1629
+ function getAddressTableLookupArrayEncoder() {
1630
+ return getArrayEncoder(getAddressTableLookupEncoder(), {
1631
+ description: addressTableLookupsDescription,
1632
+ size: getShortU16Encoder()
1633
+ });
1634
+ }
1635
+ function getAddressTableLookupArrayDecoder() {
1636
+ return getArrayDecoder(getAddressTableLookupDecoder(), {
1637
+ description: addressTableLookupsDescription,
1638
+ size: getShortU16Decoder()
1225
1639
  });
1226
1640
  }
1641
+ var messageDescription = "The wire format of a Solana transaction message" ;
1227
1642
  function getCompiledMessageEncoder() {
1228
1643
  return {
1229
- ...BASE_CONFIG2,
1230
- deserialize: getUnimplementedDecoder("CompiledMessage"),
1231
- serialize: serialize2
1644
+ description: messageDescription,
1645
+ encode: (compiledMessage) => {
1646
+ if (compiledMessage.version === "legacy") {
1647
+ return getCompiledMessageLegacyEncoder().encode(compiledMessage);
1648
+ } else {
1649
+ return getCompiledMessageVersionedEncoder().encode(compiledMessage);
1650
+ }
1651
+ },
1652
+ fixedSize: null,
1653
+ maxSize: null
1232
1654
  };
1233
1655
  }
1656
+ function getCompiledMessageDecoder() {
1657
+ return mapDecoder(
1658
+ getStructDecoder(getPreludeStructDecoderTuple(), {
1659
+ description: messageDescription
1660
+ }),
1661
+ ({ addressTableLookups, ...restOfMessage }) => {
1662
+ if (restOfMessage.version === "legacy" || !addressTableLookups?.length) {
1663
+ return restOfMessage;
1664
+ }
1665
+ return { ...restOfMessage, addressTableLookups };
1666
+ }
1667
+ );
1668
+ }
1669
+
1670
+ // src/serializers/transaction.ts
1671
+ var signaturesDescription = "A compact array of 64-byte, base-64 encoded Ed25519 signatures" ;
1672
+ var transactionDescription = "The wire format of a Solana transaction" ;
1673
+ function getCompiledTransactionEncoder() {
1674
+ return getStructEncoder(
1675
+ [
1676
+ [
1677
+ "signatures",
1678
+ getArrayEncoder(getBytesEncoder({ size: 64 }), {
1679
+ description: signaturesDescription,
1680
+ size: getShortU16Encoder()
1681
+ })
1682
+ ],
1683
+ ["compiledMessage", getCompiledMessageEncoder()]
1684
+ ],
1685
+ {
1686
+ description: transactionDescription
1687
+ }
1688
+ );
1689
+ }
1690
+ function getSignatureDecoder() {
1691
+ return mapDecoder(getBytesDecoder({ size: 64 }), (bytes) => bytes);
1692
+ }
1693
+ function getCompiledTransactionDecoder() {
1694
+ return getStructDecoder(
1695
+ [
1696
+ [
1697
+ "signatures",
1698
+ getArrayDecoder(getSignatureDecoder(), {
1699
+ description: signaturesDescription,
1700
+ size: getShortU16Decoder()
1701
+ })
1702
+ ],
1703
+ ["compiledMessage", getCompiledMessageDecoder()]
1704
+ ],
1705
+ {
1706
+ description: transactionDescription
1707
+ }
1708
+ );
1709
+ }
1710
+ function getTransactionEncoder() {
1711
+ return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
1712
+ }
1713
+ function getTransactionDecoder(lastValidBlockHeight) {
1714
+ return mapDecoder(
1715
+ getCompiledTransactionDecoder(),
1716
+ (compiledTransaction) => decompileTransaction(compiledTransaction, lastValidBlockHeight)
1717
+ );
1718
+ }
1719
+ function getTransactionCodec(lastValidBlockHeight) {
1720
+ return combineCodec(getTransactionEncoder(), getTransactionDecoder(lastValidBlockHeight));
1721
+ }
1722
+
1723
+ // ../keys/dist/index.browser.js
1724
+ async function signBytes(key, data) {
1725
+ await assertSigningCapabilityIsAvailable();
1726
+ const signedData = await crypto.subtle.sign("Ed25519", key, data);
1727
+ return new Uint8Array(signedData);
1728
+ }
1234
1729
 
1235
1730
  // src/signatures.ts
1236
- async function getCompiledMessageSignature(message, secretKey) {
1237
- const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
1238
- const signature = await signBytes(secretKey, wireMessageBytes);
1239
- return signature;
1731
+ function assertIsTransactionSignature(putativeTransactionSignature) {
1732
+ try {
1733
+ if (
1734
+ // Lowest value (64 bytes of zeroes)
1735
+ putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
1736
+ putativeTransactionSignature.length > 88
1737
+ ) {
1738
+ throw new Error("Expected input string to decode to a byte array of length 64.");
1739
+ }
1740
+ const bytes = base58.serialize(putativeTransactionSignature);
1741
+ const numBytes = bytes.byteLength;
1742
+ if (numBytes !== 64) {
1743
+ throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
1744
+ }
1745
+ } catch (e2) {
1746
+ throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
1747
+ cause: e2
1748
+ });
1749
+ }
1240
1750
  }
1241
- async function signTransaction(keyPair, transaction) {
1751
+ function isTransactionSignature(putativeTransactionSignature) {
1752
+ if (
1753
+ // Lowest value (64 bytes of zeroes)
1754
+ putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
1755
+ putativeTransactionSignature.length > 88
1756
+ ) {
1757
+ return false;
1758
+ }
1759
+ const bytes = base58.serialize(putativeTransactionSignature);
1760
+ const numBytes = bytes.byteLength;
1761
+ if (numBytes !== 64) {
1762
+ return false;
1763
+ }
1764
+ return true;
1765
+ }
1766
+ function getSignatureFromTransaction(transaction) {
1767
+ const signatureBytes = transaction.signatures[transaction.feePayer];
1768
+ if (!signatureBytes) {
1769
+ throw new Error(
1770
+ "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
1771
+ );
1772
+ }
1773
+ const transactionSignature2 = base58.deserialize(signatureBytes)[0];
1774
+ return transactionSignature2;
1775
+ }
1776
+ async function signTransaction(keyPairs, transaction) {
1242
1777
  const compiledMessage = compileMessage(transaction);
1243
- const [signerPublicKey, signature] = await Promise.all([
1244
- getAddressFromPublicKey(keyPair.publicKey),
1245
- getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
1246
- ]);
1247
- const nextSignatures = {
1248
- ..."signatures" in transaction ? transaction.signatures : null,
1249
- ...{ [signerPublicKey]: signature }
1250
- };
1778
+ const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
1779
+ const wireMessageBytes = getCompiledMessageEncoder().encode(compiledMessage);
1780
+ const publicKeySignaturePairs = await Promise.all(
1781
+ keyPairs.map(
1782
+ (keyPair) => Promise.all([getAddressFromPublicKey(keyPair.publicKey), signBytes(keyPair.privateKey, wireMessageBytes)])
1783
+ )
1784
+ );
1785
+ for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
1786
+ nextSignatures[signerPublicKey] = signature;
1787
+ }
1251
1788
  const out = {
1252
1789
  ...transaction,
1253
1790
  signatures: nextSignatures
@@ -1255,55 +1792,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
1255
1792
  Object.freeze(out);
1256
1793
  return out;
1257
1794
  }
1258
-
1259
- // src/compile-transaction.ts
1260
- function getCompiledTransaction(transaction) {
1261
- const compiledMessage = compileMessage(transaction);
1262
- let signatures;
1263
- if ("signatures" in transaction) {
1264
- signatures = [];
1265
- for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
1266
- signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
1267
- }
1268
- } else {
1269
- signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
1270
- }
1271
- return {
1272
- compiledMessage,
1273
- signatures
1274
- };
1275
- }
1276
-
1277
- // src/serializers/transaction.ts
1278
- var BASE_CONFIG3 = {
1279
- description: "The wire format of a Solana transaction" ,
1280
- fixedSize: null,
1281
- maxSize: null
1282
- };
1283
- function serialize3(transaction) {
1284
- const compiledTransaction = getCompiledTransaction(transaction);
1285
- return struct([
1286
- [
1287
- "signatures",
1288
- array(bytes({ size: 64 }), {
1289
- ...{ description: "A compact array of 64-byte, base-64 encoded Ed25519 signatures" } ,
1290
- size: shortU16()
1291
- })
1292
- ],
1293
- ["compiledMessage", getCompiledMessageEncoder()]
1294
- ]).serialize(compiledTransaction);
1795
+ function transactionSignature(putativeTransactionSignature) {
1796
+ assertIsTransactionSignature(putativeTransactionSignature);
1797
+ return putativeTransactionSignature;
1295
1798
  }
1296
- function getTransactionEncoder() {
1297
- return {
1298
- ...BASE_CONFIG3,
1299
- deserialize: getUnimplementedDecoder("CompiledMessage"),
1300
- serialize: serialize3
1301
- };
1799
+ function assertTransactionIsFullySigned(transaction) {
1800
+ const signerAddressesFromInstructions = transaction.instructions.flatMap((i) => i.accounts?.filter((a) => isSignerRole(a.role)) ?? []).map((a) => a.address);
1801
+ const requiredSigners = /* @__PURE__ */ new Set([transaction.feePayer, ...signerAddressesFromInstructions]);
1802
+ requiredSigners.forEach((address2) => {
1803
+ if (!transaction.signatures[address2]) {
1804
+ throw new Error(`Transaction is missing signature for address \`${address2}\``);
1805
+ }
1806
+ });
1302
1807
  }
1303
1808
 
1304
1809
  // src/wire-transaction.ts
1305
1810
  function getBase64EncodedWireTransaction(transaction) {
1306
- const wireTransactionBytes = getTransactionEncoder().serialize(transaction);
1811
+ const wireTransactionBytes = getTransactionEncoder().encode(transaction);
1307
1812
  {
1308
1813
  return btoa(String.fromCharCode(...wireTransactionBytes));
1309
1814
  }
@@ -1312,13 +1817,22 @@ this.globalThis.solanaWeb3 = (function (exports) {
1312
1817
  exports.appendTransactionInstruction = appendTransactionInstruction;
1313
1818
  exports.assertIsBlockhash = assertIsBlockhash;
1314
1819
  exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
1820
+ exports.assertIsTransactionSignature = assertIsTransactionSignature;
1821
+ exports.assertTransactionIsFullySigned = assertTransactionIsFullySigned;
1315
1822
  exports.createTransaction = createTransaction;
1316
1823
  exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
1824
+ exports.getSignatureFromTransaction = getSignatureFromTransaction;
1825
+ exports.getTransactionCodec = getTransactionCodec;
1826
+ exports.getTransactionDecoder = getTransactionDecoder;
1827
+ exports.getTransactionEncoder = getTransactionEncoder;
1828
+ exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
1829
+ exports.isTransactionSignature = isTransactionSignature;
1317
1830
  exports.prependTransactionInstruction = prependTransactionInstruction;
1318
1831
  exports.setTransactionFeePayer = setTransactionFeePayer;
1319
1832
  exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
1320
1833
  exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
1321
1834
  exports.signTransaction = signTransaction;
1835
+ exports.transactionSignature = transactionSignature;
1322
1836
 
1323
1837
  return exports;
1324
1838