@solana/web3.js 2.0.0-experimental.58b1699 → 2.0.0-experimental.5b8e43b

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.
Files changed (46) hide show
  1. package/README.md +1155 -43
  2. package/dist/index.browser.cjs +12 -5
  3. package/dist/index.browser.cjs.map +1 -1
  4. package/dist/index.browser.js +10 -5
  5. package/dist/index.browser.js.map +1 -1
  6. package/dist/index.development.js +973 -699
  7. package/dist/index.development.js.map +1 -1
  8. package/dist/index.native.js +10 -5
  9. package/dist/index.native.js.map +1 -1
  10. package/dist/index.node.cjs +10 -5
  11. package/dist/index.node.cjs.map +1 -1
  12. package/dist/index.node.js +10 -5
  13. package/dist/index.node.js.map +1 -1
  14. package/dist/index.production.min.js +82 -72
  15. package/dist/types/airdrop-confirmer.d.ts +6 -7
  16. package/dist/types/airdrop-confirmer.d.ts.map +1 -1
  17. package/dist/types/airdrop.d.ts +8 -10
  18. package/dist/types/airdrop.d.ts.map +1 -1
  19. package/dist/types/index.d.ts +9 -9
  20. package/dist/types/rpc-request-coalescer.d.ts +1 -1
  21. package/dist/types/rpc-request-coalescer.d.ts.map +1 -1
  22. package/dist/types/rpc-subscription-coalescer.d.ts +1 -1
  23. package/dist/types/rpc-subscription-coalescer.d.ts.map +1 -1
  24. package/dist/types/rpc-transport.d.ts +1 -2
  25. package/dist/types/rpc-transport.d.ts.map +1 -1
  26. package/dist/types/rpc-websocket-autopinger.d.ts +1 -1
  27. package/dist/types/rpc-websocket-autopinger.d.ts.map +1 -1
  28. package/dist/types/rpc-websocket-connection-sharding.d.ts +1 -1
  29. package/dist/types/rpc-websocket-connection-sharding.d.ts.map +1 -1
  30. package/dist/types/rpc-websocket-transport.d.ts +1 -2
  31. package/dist/types/rpc-websocket-transport.d.ts.map +1 -1
  32. package/dist/types/rpc.d.ts +1 -2
  33. package/dist/types/rpc.d.ts.map +1 -1
  34. package/dist/types/send-transaction.d.ts +7 -6
  35. package/dist/types/send-transaction.d.ts.map +1 -1
  36. package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +2 -3
  37. package/dist/types/transaction-confirmation-strategy-blockheight.d.ts.map +1 -1
  38. package/dist/types/transaction-confirmation-strategy-nonce.d.ts +4 -5
  39. package/dist/types/transaction-confirmation-strategy-nonce.d.ts.map +1 -1
  40. package/dist/types/transaction-confirmation-strategy-racer.d.ts +3 -3
  41. package/dist/types/transaction-confirmation-strategy-racer.d.ts.map +1 -1
  42. package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +4 -5
  43. package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts.map +1 -1
  44. package/dist/types/transaction-confirmation.d.ts +5 -10
  45. package/dist/types/transaction-confirmation.d.ts.map +1 -1
  46. package/package.json +15 -15
@@ -138,23 +138,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
138
138
  throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
139
139
  }
140
140
  }
141
- var mergeBytes = (byteArrays) => {
142
- const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length);
143
- if (nonEmptyByteArrays.length === 0) {
144
- return byteArrays.length ? byteArrays[0] : new Uint8Array();
145
- }
146
- if (nonEmptyByteArrays.length === 1) {
147
- return nonEmptyByteArrays[0];
148
- }
149
- const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);
150
- const result = new Uint8Array(totalLength);
151
- let offset = 0;
152
- nonEmptyByteArrays.forEach((arr) => {
153
- result.set(arr, offset);
154
- offset += arr.length;
155
- });
156
- return result;
157
- };
158
141
  var padBytes = (bytes, length) => {
159
142
  if (bytes.length >= length)
160
143
  return bytes;
@@ -163,66 +146,100 @@ this.globalThis.solanaWeb3 = (function (exports) {
163
146
  return paddedBytes;
164
147
  };
165
148
  var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
166
- function combineCodec(encoder, decoder, description) {
167
- if (encoder.fixedSize !== decoder.fixedSize) {
149
+ function getEncodedSize(value, encoder) {
150
+ return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
151
+ }
152
+ function createEncoder(encoder) {
153
+ return Object.freeze({
154
+ ...encoder,
155
+ encode: (value) => {
156
+ const bytes = new Uint8Array(getEncodedSize(value, encoder));
157
+ encoder.write(value, bytes, 0);
158
+ return bytes;
159
+ }
160
+ });
161
+ }
162
+ function createDecoder(decoder) {
163
+ return Object.freeze({
164
+ ...decoder,
165
+ decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
166
+ });
167
+ }
168
+ function isFixedSize(codec) {
169
+ return "fixedSize" in codec && typeof codec.fixedSize === "number";
170
+ }
171
+ function assertIsFixedSize(codec, message) {
172
+ if (!isFixedSize(codec)) {
173
+ throw new Error(message != null ? message : "Expected a fixed-size codec, got a variable-size one.");
174
+ }
175
+ }
176
+ function isVariableSize(codec) {
177
+ return !isFixedSize(codec);
178
+ }
179
+ function combineCodec(encoder, decoder) {
180
+ if (isFixedSize(encoder) !== isFixedSize(decoder)) {
181
+ throw new Error(`Encoder and decoder must either both be fixed-size or variable-size.`);
182
+ }
183
+ if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
168
184
  throw new Error(
169
185
  `Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`
170
186
  );
171
187
  }
172
- if (encoder.maxSize !== decoder.maxSize) {
188
+ if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
173
189
  throw new Error(
174
190
  `Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`
175
191
  );
176
192
  }
177
- if (description === void 0 && encoder.description !== decoder.description) {
178
- throw new Error(
179
- `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.`
180
- );
181
- }
182
193
  return {
194
+ ...decoder,
195
+ ...encoder,
183
196
  decode: decoder.decode,
184
- description: description ?? encoder.description,
185
197
  encode: encoder.encode,
186
- fixedSize: encoder.fixedSize,
187
- maxSize: encoder.maxSize
198
+ read: decoder.read,
199
+ write: encoder.write
188
200
  };
189
201
  }
190
- function fixCodecHelper(data, fixedBytes, description) {
191
- return {
192
- description: description ?? `fixed(${fixedBytes}, ${data.description})`,
202
+ function fixEncoder(encoder, fixedBytes) {
203
+ return createEncoder({
193
204
  fixedSize: fixedBytes,
194
- maxSize: fixedBytes
195
- };
196
- }
197
- function fixEncoder(encoder, fixedBytes, description) {
198
- return {
199
- ...fixCodecHelper(encoder, fixedBytes, description),
200
- encode: (value) => fixBytes(encoder.encode(value), fixedBytes)
201
- };
205
+ write: (value, bytes, offset) => {
206
+ const variableByteArray = encoder.encode(value);
207
+ const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
208
+ bytes.set(fixedByteArray, offset);
209
+ return offset + fixedBytes;
210
+ }
211
+ });
202
212
  }
203
- function fixDecoder(decoder, fixedBytes, description) {
204
- return {
205
- ...fixCodecHelper(decoder, fixedBytes, description),
206
- decode: (bytes, offset = 0) => {
213
+ function fixDecoder(decoder, fixedBytes) {
214
+ return createDecoder({
215
+ fixedSize: fixedBytes,
216
+ read: (bytes, offset) => {
207
217
  assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);
208
218
  if (offset > 0 || bytes.length > fixedBytes) {
209
219
  bytes = bytes.slice(offset, offset + fixedBytes);
210
220
  }
211
- if (decoder.fixedSize !== null) {
221
+ if (isFixedSize(decoder)) {
212
222
  bytes = fixBytes(bytes, decoder.fixedSize);
213
223
  }
214
- const [value] = decoder.decode(bytes, 0);
224
+ const [value] = decoder.read(bytes, 0);
215
225
  return [value, offset + fixedBytes];
216
226
  }
217
- };
227
+ });
218
228
  }
219
229
  function mapEncoder(encoder, unmap) {
220
- return {
221
- description: encoder.description,
222
- encode: (value) => encoder.encode(unmap(value)),
223
- fixedSize: encoder.fixedSize,
224
- maxSize: encoder.maxSize
225
- };
230
+ return createEncoder({
231
+ ...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,
232
+ write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
233
+ });
234
+ }
235
+ function mapDecoder(decoder, map) {
236
+ return createDecoder({
237
+ ...decoder,
238
+ read: (bytes, offset) => {
239
+ const [value, newOffset] = decoder.read(bytes, offset);
240
+ return [map(value, bytes, offset), newOffset];
241
+ }
242
+ });
226
243
  }
227
244
 
228
245
  // ../codecs-strings/dist/index.browser.js
@@ -237,96 +254,107 @@ this.globalThis.solanaWeb3 = (function (exports) {
237
254
  );
238
255
  }
239
256
  }
240
- function sharedNumberFactory(input) {
241
- let littleEndian;
242
- let defaultDescription = input.name;
243
- if (input.size > 1) {
244
- littleEndian = !("endian" in input.options) || input.options.endian === 0;
245
- defaultDescription += littleEndian ? "(le)" : "(be)";
246
- }
247
- return {
248
- description: input.options.description ?? defaultDescription,
249
- fixedSize: input.size,
250
- littleEndian,
251
- maxSize: input.size
252
- };
257
+ function isLittleEndian(config) {
258
+ return (config == null ? void 0 : config.endian) === 1 ? false : true;
253
259
  }
254
260
  function numberEncoderFactory(input) {
255
- const codecData = sharedNumberFactory(input);
256
- return {
257
- description: codecData.description,
258
- encode(value) {
261
+ return createEncoder({
262
+ fixedSize: input.size,
263
+ write(value, bytes, offset) {
259
264
  if (input.range) {
260
265
  assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
261
266
  }
262
267
  const arrayBuffer = new ArrayBuffer(input.size);
263
- input.set(new DataView(arrayBuffer), value, codecData.littleEndian);
264
- return new Uint8Array(arrayBuffer);
265
- },
266
- fixedSize: codecData.fixedSize,
267
- maxSize: codecData.maxSize
268
- };
268
+ input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));
269
+ bytes.set(new Uint8Array(arrayBuffer), offset);
270
+ return offset + input.size;
271
+ }
272
+ });
269
273
  }
270
274
  function numberDecoderFactory(input) {
271
- const codecData = sharedNumberFactory(input);
272
- return {
273
- decode(bytes, offset = 0) {
274
- assertByteArrayIsNotEmptyForCodec(codecData.description, bytes, offset);
275
- assertByteArrayHasEnoughBytesForCodec(codecData.description, input.size, bytes, offset);
275
+ return createDecoder({
276
+ fixedSize: input.size,
277
+ read(bytes, offset = 0) {
278
+ assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);
279
+ assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);
276
280
  const view = new DataView(toArrayBuffer(bytes, offset, input.size));
277
- return [input.get(view, codecData.littleEndian), offset + input.size];
278
- },
279
- description: codecData.description,
280
- fixedSize: codecData.fixedSize,
281
- maxSize: codecData.maxSize
282
- };
281
+ return [input.get(view, isLittleEndian(input.config)), offset + input.size];
282
+ }
283
+ });
283
284
  }
284
285
  function toArrayBuffer(bytes, offset, length) {
285
- const bytesOffset = bytes.byteOffset + (offset ?? 0);
286
- const bytesLength = length ?? bytes.byteLength;
286
+ const bytesOffset = bytes.byteOffset + (offset != null ? offset : 0);
287
+ const bytesLength = length != null ? length : bytes.byteLength;
287
288
  return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);
288
289
  }
289
- var getShortU16Encoder = (options = {}) => ({
290
- description: options.description ?? "shortU16",
291
- encode: (value) => {
290
+ var getShortU16Encoder = () => createEncoder({
291
+ getSizeFromValue: (value) => {
292
+ if (value <= 127)
293
+ return 1;
294
+ if (value <= 16383)
295
+ return 2;
296
+ return 3;
297
+ },
298
+ maxSize: 3,
299
+ write: (value, bytes, offset) => {
292
300
  assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
293
- const bytes = [0];
301
+ const shortU16Bytes = [0];
294
302
  for (let ii = 0; ; ii += 1) {
295
303
  const alignedValue = value >> ii * 7;
296
304
  if (alignedValue === 0) {
297
305
  break;
298
306
  }
299
307
  const nextSevenBits = 127 & alignedValue;
300
- bytes[ii] = nextSevenBits;
308
+ shortU16Bytes[ii] = nextSevenBits;
301
309
  if (ii > 0) {
302
- bytes[ii - 1] |= 128;
310
+ shortU16Bytes[ii - 1] |= 128;
303
311
  }
304
312
  }
305
- return new Uint8Array(bytes);
306
- },
307
- fixedSize: null,
308
- maxSize: 3
313
+ bytes.set(shortU16Bytes, offset);
314
+ return offset + shortU16Bytes.length;
315
+ }
309
316
  });
310
- var getU32Encoder = (options = {}) => numberEncoderFactory({
317
+ var getShortU16Decoder = () => createDecoder({
318
+ maxSize: 3,
319
+ read: (bytes, offset) => {
320
+ let value = 0;
321
+ let byteCount = 0;
322
+ while (++byteCount) {
323
+ const byteIndex = byteCount - 1;
324
+ const currentByte = bytes[offset + byteIndex];
325
+ const nextSevenBits = 127 & currentByte;
326
+ value |= nextSevenBits << byteIndex * 7;
327
+ if ((currentByte & 128) === 0) {
328
+ break;
329
+ }
330
+ }
331
+ return [value, offset + byteCount];
332
+ }
333
+ });
334
+ var getU32Encoder = (config = {}) => numberEncoderFactory({
335
+ config,
311
336
  name: "u32",
312
- options,
313
337
  range: [0, Number("0xffffffff")],
314
338
  set: (view, value, le) => view.setUint32(0, value, le),
315
339
  size: 4
316
340
  });
317
- var getU32Decoder = (options = {}) => numberDecoderFactory({
341
+ var getU32Decoder = (config = {}) => numberDecoderFactory({
342
+ config,
318
343
  get: (view, le) => view.getUint32(0, le),
319
344
  name: "u32",
320
- options,
321
345
  size: 4
322
346
  });
323
- var getU8Encoder = (options = {}) => numberEncoderFactory({
347
+ var getU8Encoder = () => numberEncoderFactory({
324
348
  name: "u8",
325
- options,
326
349
  range: [0, Number("0xff")],
327
350
  set: (view, value) => view.setUint8(0, value),
328
351
  size: 1
329
352
  });
353
+ var getU8Decoder = () => numberDecoderFactory({
354
+ get: (view) => view.getUint8(0),
355
+ name: "u8",
356
+ size: 1
357
+ });
330
358
 
331
359
  // ../codecs-strings/dist/index.browser.js
332
360
  function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
@@ -335,43 +363,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
335
363
  }
336
364
  }
337
365
  var getBaseXEncoder = (alphabet4) => {
338
- const base = alphabet4.length;
339
- const baseBigInt = BigInt(base);
340
- return {
341
- description: `base${base}`,
342
- encode(value) {
366
+ return createEncoder({
367
+ getSizeFromValue: (value) => {
368
+ const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
369
+ if (tailChars === "")
370
+ return value.length;
371
+ const base10Number = getBigIntFromBaseX(tailChars, alphabet4);
372
+ return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);
373
+ },
374
+ write(value, bytes, offset) {
343
375
  assertValidBaseString(alphabet4, value);
344
376
  if (value === "")
345
- return new Uint8Array();
346
- const chars = [...value];
347
- let trailIndex = chars.findIndex((c) => c !== alphabet4[0]);
348
- trailIndex = trailIndex === -1 ? chars.length : trailIndex;
349
- const leadingZeroes = Array(trailIndex).fill(0);
350
- if (trailIndex === chars.length)
351
- return Uint8Array.from(leadingZeroes);
352
- const tailChars = chars.slice(trailIndex);
353
- let base10Number = 0n;
354
- let baseXPower = 1n;
355
- for (let i = tailChars.length - 1; i >= 0; i -= 1) {
356
- base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
357
- baseXPower *= baseBigInt;
377
+ return offset;
378
+ const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
379
+ if (tailChars === "") {
380
+ bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);
381
+ return offset + leadingZeroes.length;
358
382
  }
383
+ let base10Number = getBigIntFromBaseX(tailChars, alphabet4);
359
384
  const tailBytes = [];
360
385
  while (base10Number > 0n) {
361
386
  tailBytes.unshift(Number(base10Number % 256n));
362
387
  base10Number /= 256n;
363
388
  }
364
- return Uint8Array.from(leadingZeroes.concat(tailBytes));
365
- },
366
- fixedSize: null,
367
- maxSize: null
368
- };
389
+ const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];
390
+ bytes.set(bytesToAdd, offset);
391
+ return offset + bytesToAdd.length;
392
+ }
393
+ });
369
394
  };
370
395
  var getBaseXDecoder = (alphabet4) => {
371
- const base = alphabet4.length;
372
- const baseBigInt = BigInt(base);
373
- return {
374
- decode(rawBytes, offset = 0) {
396
+ return createDecoder({
397
+ read(rawBytes, offset) {
375
398
  const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);
376
399
  if (bytes.length === 0)
377
400
  return ["", 0];
@@ -380,22 +403,65 @@ this.globalThis.solanaWeb3 = (function (exports) {
380
403
  const leadingZeroes = alphabet4[0].repeat(trailIndex);
381
404
  if (trailIndex === bytes.length)
382
405
  return [leadingZeroes, rawBytes.length];
383
- let base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
384
- const tailChars = [];
385
- while (base10Number > 0n) {
386
- tailChars.unshift(alphabet4[Number(base10Number % baseBigInt)]);
387
- base10Number /= baseBigInt;
388
- }
389
- return [leadingZeroes + tailChars.join(""), rawBytes.length];
390
- },
391
- description: `base${base}`,
392
- fixedSize: null,
393
- maxSize: null
394
- };
406
+ const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
407
+ const tailChars = getBaseXFromBigInt(base10Number, alphabet4);
408
+ return [leadingZeroes + tailChars, rawBytes.length];
409
+ }
410
+ });
395
411
  };
412
+ function partitionLeadingZeroes(value, zeroCharacter) {
413
+ const leadingZeroIndex = [...value].findIndex((c) => c !== zeroCharacter);
414
+ return leadingZeroIndex === -1 ? [value, ""] : [value.slice(0, leadingZeroIndex), value.slice(leadingZeroIndex)];
415
+ }
416
+ function getBigIntFromBaseX(value, alphabet4) {
417
+ const base = BigInt(alphabet4.length);
418
+ return [...value].reduce((sum, char) => sum * base + BigInt(alphabet4.indexOf(char)), 0n);
419
+ }
420
+ function getBaseXFromBigInt(value, alphabet4) {
421
+ const base = BigInt(alphabet4.length);
422
+ const tailChars = [];
423
+ while (value > 0n) {
424
+ tailChars.unshift(alphabet4[Number(value % base)]);
425
+ value /= base;
426
+ }
427
+ return tailChars.join("");
428
+ }
396
429
  var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
397
430
  var getBase58Encoder = () => getBaseXEncoder(alphabet2);
398
431
  var getBase58Decoder = () => getBaseXDecoder(alphabet2);
432
+ var getBase64Encoder = () => {
433
+ {
434
+ return createEncoder({
435
+ getSizeFromValue: (value) => {
436
+ try {
437
+ return atob(value).length;
438
+ } catch (e23) {
439
+ throw new Error(`Expected a string of base 64, got [${value}].`);
440
+ }
441
+ },
442
+ write(value, bytes, offset) {
443
+ try {
444
+ const bytesToAdd = atob(value).split("").map((c) => c.charCodeAt(0));
445
+ bytes.set(bytesToAdd, offset);
446
+ return bytesToAdd.length + offset;
447
+ } catch (e23) {
448
+ throw new Error(`Expected a string of base 64, got [${value}].`);
449
+ }
450
+ }
451
+ });
452
+ }
453
+ };
454
+ var getBase64Decoder = () => {
455
+ {
456
+ return createDecoder({
457
+ read(bytes, offset = 0) {
458
+ const slice = bytes.slice(offset);
459
+ const value = btoa(String.fromCharCode(...slice));
460
+ return [value, bytes.length];
461
+ }
462
+ });
463
+ }
464
+ };
399
465
  var removeNullCharacters = (value) => (
400
466
  // eslint-disable-next-line no-control-regex
401
467
  value.replace(/\u0000/g, "")
@@ -404,75 +470,69 @@ this.globalThis.solanaWeb3 = (function (exports) {
404
470
  var o = globalThis.TextEncoder;
405
471
  var getUtf8Encoder = () => {
406
472
  let textEncoder;
407
- return {
408
- description: "utf8",
409
- encode: (value) => new Uint8Array((textEncoder || (textEncoder = new o())).encode(value)),
410
- fixedSize: null,
411
- maxSize: null
412
- };
473
+ return createEncoder({
474
+ getSizeFromValue: (value) => (textEncoder || (textEncoder = new o())).encode(value).length,
475
+ write: (value, bytes, offset) => {
476
+ const bytesToAdd = (textEncoder || (textEncoder = new o())).encode(value);
477
+ bytes.set(bytesToAdd, offset);
478
+ return offset + bytesToAdd.length;
479
+ }
480
+ });
413
481
  };
414
482
  var getUtf8Decoder = () => {
415
483
  let textDecoder;
416
- return {
417
- decode(bytes, offset = 0) {
484
+ return createDecoder({
485
+ read(bytes, offset) {
418
486
  const value = (textDecoder || (textDecoder = new e())).decode(bytes.slice(offset));
419
487
  return [removeNullCharacters(value), bytes.length];
420
- },
421
- description: "utf8",
422
- fixedSize: null,
423
- maxSize: null
424
- };
488
+ }
489
+ });
425
490
  };
426
- var getStringEncoder = (options = {}) => {
427
- const size = options.size ?? getU32Encoder();
428
- const encoding = options.encoding ?? getUtf8Encoder();
429
- const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
491
+ function getStringEncoder(config = {}) {
492
+ var _a, _b;
493
+ const size = (_a = config.size) != null ? _a : getU32Encoder();
494
+ const encoding = (_b = config.encoding) != null ? _b : getUtf8Encoder();
430
495
  if (size === "variable") {
431
- return { ...encoding, description };
496
+ return encoding;
432
497
  }
433
498
  if (typeof size === "number") {
434
- return fixEncoder(encoding, size, description);
499
+ return fixEncoder(encoding, size);
435
500
  }
436
- return {
437
- description,
438
- encode: (value) => {
439
- const contentBytes = encoding.encode(value);
440
- const lengthBytes = size.encode(contentBytes.length);
441
- return mergeBytes([lengthBytes, contentBytes]);
501
+ return createEncoder({
502
+ getSizeFromValue: (value) => {
503
+ const contentSize = getEncodedSize(value, encoding);
504
+ return getEncodedSize(contentSize, size) + contentSize;
442
505
  },
443
- fixedSize: null,
444
- maxSize: null
445
- };
446
- };
447
- var getStringDecoder = (options = {}) => {
448
- const size = options.size ?? getU32Decoder();
449
- const encoding = options.encoding ?? getUtf8Decoder();
450
- const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
506
+ write: (value, bytes, offset) => {
507
+ const contentSize = getEncodedSize(value, encoding);
508
+ offset = size.write(contentSize, bytes, offset);
509
+ return encoding.write(value, bytes, offset);
510
+ }
511
+ });
512
+ }
513
+ function getStringDecoder(config = {}) {
514
+ var _a, _b;
515
+ const size = (_a = config.size) != null ? _a : getU32Decoder();
516
+ const encoding = (_b = config.encoding) != null ? _b : getUtf8Decoder();
451
517
  if (size === "variable") {
452
- return { ...encoding, description };
518
+ return encoding;
453
519
  }
454
520
  if (typeof size === "number") {
455
- return fixDecoder(encoding, size, description);
521
+ return fixDecoder(encoding, size);
456
522
  }
457
- return {
458
- decode: (bytes, offset = 0) => {
523
+ return createDecoder({
524
+ read: (bytes, offset = 0) => {
459
525
  assertByteArrayIsNotEmptyForCodec("string", bytes, offset);
460
- const [lengthBigInt, lengthOffset] = size.decode(bytes, offset);
526
+ const [lengthBigInt, lengthOffset] = size.read(bytes, offset);
461
527
  const length = Number(lengthBigInt);
462
528
  offset = lengthOffset;
463
529
  const contentBytes = bytes.slice(offset, offset + length);
464
530
  assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes);
465
- const [value, contentOffset] = encoding.decode(contentBytes);
531
+ const [value, contentOffset] = encoding.read(contentBytes, 0);
466
532
  offset += contentOffset;
467
533
  return [value, offset];
468
- },
469
- description,
470
- fixedSize: null,
471
- maxSize: null
472
- };
473
- };
474
- function getSizeDescription(size) {
475
- return typeof size === "object" ? size.description : `${size}`;
534
+ }
535
+ });
476
536
  }
477
537
 
478
538
  // ../assertions/dist/index.browser.js
@@ -507,14 +567,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
507
567
  }
508
568
  }
509
569
  async function assertDigestCapabilityIsAvailable() {
570
+ var _a;
510
571
  assertIsSecureContext();
511
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") {
572
+ if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.digest) !== "function") {
512
573
  throw new Error("No digest implementation could be found");
513
574
  }
514
575
  }
515
576
  async function assertKeyGenerationIsAvailable() {
577
+ var _a;
516
578
  assertIsSecureContext();
517
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") {
579
+ if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.generateKey) !== "function") {
518
580
  throw new Error("No key generation implementation could be found");
519
581
  }
520
582
  if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
@@ -524,20 +586,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
524
586
  }
525
587
  }
526
588
  async function assertKeyExporterIsAvailable() {
589
+ var _a;
527
590
  assertIsSecureContext();
528
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
591
+ if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.exportKey) !== "function") {
529
592
  throw new Error("No key export implementation could be found");
530
593
  }
531
594
  }
532
595
  async function assertSigningCapabilityIsAvailable() {
596
+ var _a;
533
597
  assertIsSecureContext();
534
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
598
+ if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.sign) !== "function") {
535
599
  throw new Error("No signing implementation could be found");
536
600
  }
537
601
  }
538
602
  async function assertVerificationCapabilityIsAvailable() {
603
+ var _a;
539
604
  assertIsSecureContext();
540
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.verify !== "function") {
605
+ if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.verify) !== "function") {
541
606
  throw new Error("No signature verification implementation could be found");
542
607
  }
543
608
  }
@@ -555,66 +620,58 @@ this.globalThis.solanaWeb3 = (function (exports) {
555
620
  memoizedBase58Decoder = getBase58Decoder();
556
621
  return memoizedBase58Decoder;
557
622
  }
558
- function isAddress(putativeBase58EncodedAddress) {
623
+ function isAddress(putativeAddress) {
559
624
  if (
560
625
  // Lowest address (32 bytes of zeroes)
561
- putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
562
- putativeBase58EncodedAddress.length > 44
626
+ putativeAddress.length < 32 || // Highest address (32 bytes of 255)
627
+ putativeAddress.length > 44
563
628
  ) {
564
629
  return false;
565
630
  }
566
- const base58Encoder = getMemoizedBase58Encoder();
567
- const bytes = base58Encoder.encode(putativeBase58EncodedAddress);
631
+ const base58Encoder3 = getMemoizedBase58Encoder();
632
+ const bytes = base58Encoder3.encode(putativeAddress);
568
633
  const numBytes = bytes.byteLength;
569
634
  if (numBytes !== 32) {
570
635
  return false;
571
636
  }
572
637
  return true;
573
638
  }
574
- function assertIsAddress(putativeBase58EncodedAddress) {
639
+ function assertIsAddress(putativeAddress) {
575
640
  try {
576
641
  if (
577
642
  // Lowest address (32 bytes of zeroes)
578
- putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
579
- putativeBase58EncodedAddress.length > 44
643
+ putativeAddress.length < 32 || // Highest address (32 bytes of 255)
644
+ putativeAddress.length > 44
580
645
  ) {
581
646
  throw new Error("Expected input string to decode to a byte array of length 32.");
582
647
  }
583
- const base58Encoder = getMemoizedBase58Encoder();
584
- const bytes = base58Encoder.encode(putativeBase58EncodedAddress);
648
+ const base58Encoder3 = getMemoizedBase58Encoder();
649
+ const bytes = base58Encoder3.encode(putativeAddress);
585
650
  const numBytes = bytes.byteLength;
586
651
  if (numBytes !== 32) {
587
652
  throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
588
653
  }
589
654
  } catch (e3) {
590
- throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
655
+ throw new Error(`\`${putativeAddress}\` is not a base-58 encoded address`, {
591
656
  cause: e3
592
657
  });
593
658
  }
594
659
  }
595
- function address(putativeBase58EncodedAddress) {
596
- assertIsAddress(putativeBase58EncodedAddress);
597
- return putativeBase58EncodedAddress;
660
+ function address(putativeAddress) {
661
+ assertIsAddress(putativeAddress);
662
+ return putativeAddress;
598
663
  }
599
- function getAddressEncoder(config) {
664
+ function getAddressEncoder() {
600
665
  return mapEncoder(
601
- getStringEncoder({
602
- description: config?.description ?? "Base58EncodedAddress",
603
- encoding: getMemoizedBase58Encoder(),
604
- size: 32
605
- }),
666
+ getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }),
606
667
  (putativeAddress) => address(putativeAddress)
607
668
  );
608
669
  }
609
- function getAddressDecoder(config) {
610
- return getStringDecoder({
611
- description: config?.description ?? "Base58EncodedAddress",
612
- encoding: getMemoizedBase58Decoder(),
613
- size: 32
614
- });
670
+ function getAddressDecoder() {
671
+ return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 });
615
672
  }
616
- function getAddressCodec(config) {
617
- return combineCodec(getAddressEncoder(config), getAddressDecoder(config));
673
+ function getAddressCodec() {
674
+ return combineCodec(getAddressEncoder(), getAddressDecoder());
618
675
  }
619
676
  function getAddressComparator() {
620
677
  return new Intl.Collator("en", {
@@ -719,7 +776,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
719
776
  const validFormat = Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";
720
777
  if (!validFormat) {
721
778
  throw new Error(
722
- `Expected given program derived address to have the following format: [Base58EncodedAddress, ProgramDerivedAddressBump].`
779
+ `Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].`
723
780
  );
724
781
  }
725
782
  if (value[1] < 0 || value[1] > 255) {
@@ -755,10 +812,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
755
812
  ];
756
813
  var PointOnCurveError = class extends Error {
757
814
  };
758
- async function createProgramDerivedAddress({
759
- programAddress,
760
- seeds
761
- }) {
815
+ async function createProgramDerivedAddress({ programAddress, seeds }) {
762
816
  await assertDigestCapabilityIsAvailable();
763
817
  if (seeds.length > MAX_SEEDS) {
764
818
  throw new Error(`A maximum of ${MAX_SEEDS} seeds may be supplied when creating an address`);
@@ -782,7 +836,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
782
836
  if (await compressedPointBytesAreOnCurve(addressBytes)) {
783
837
  throw new PointOnCurveError("Invalid seeds; point must fall off the Ed25519 curve");
784
838
  }
785
- return base58EncodedAddressCodec.decode(addressBytes)[0];
839
+ return base58EncodedAddressCodec.decode(addressBytes);
786
840
  }
787
841
  async function getProgramDerivedAddress({
788
842
  programAddress,
@@ -806,26 +860,22 @@ this.globalThis.solanaWeb3 = (function (exports) {
806
860
  }
807
861
  throw new Error("Unable to find a viable program address bump seed");
808
862
  }
809
- async function createAddressWithSeed({
810
- baseAddress,
811
- programAddress,
812
- seed
813
- }) {
814
- const { encode: encode2, decode } = getAddressCodec();
863
+ async function createAddressWithSeed({ baseAddress, programAddress, seed }) {
864
+ const { encode, decode } = getAddressCodec();
815
865
  const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
816
866
  if (seedBytes.byteLength > MAX_SEED_LENGTH) {
817
867
  throw new Error(`The seed exceeds the maximum length of 32 bytes`);
818
868
  }
819
- const programAddressBytes = encode2(programAddress);
869
+ const programAddressBytes = encode(programAddress);
820
870
  if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
821
871
  throw new Error(`programAddress cannot end with the PDA marker`);
822
872
  }
823
873
  const addressBytesBuffer = await crypto.subtle.digest(
824
874
  "SHA-256",
825
- new Uint8Array([...encode2(baseAddress), ...seedBytes, ...programAddressBytes])
875
+ new Uint8Array([...encode(baseAddress), ...seedBytes, ...programAddressBytes])
826
876
  );
827
877
  const addressBytes = new Uint8Array(addressBytesBuffer);
828
- return decode(addressBytes)[0];
878
+ return decode(addressBytes);
829
879
  }
830
880
  async function getAddressFromPublicKey(publicKey) {
831
881
  await assertKeyExporterIsAvailable();
@@ -833,8 +883,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
833
883
  throw new Error("The `CryptoKey` must be an `Ed25519` public key");
834
884
  }
835
885
  const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
836
- const [base58EncodedAddress] = getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
837
- return base58EncodedAddress;
886
+ return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
838
887
  }
839
888
 
840
889
  // ../instructions/dist/index.browser.js
@@ -890,14 +939,111 @@ this.globalThis.solanaWeb3 = (function (exports) {
890
939
  );
891
940
  return keyPair;
892
941
  }
942
+ function addPkcs8Header(bytes) {
943
+ return new Uint8Array([
944
+ /**
945
+ * PKCS#8 header
946
+ */
947
+ 48,
948
+ // ASN.1 sequence tag
949
+ 46,
950
+ // Length of sequence (46 more bytes)
951
+ 2,
952
+ // ASN.1 integer tag
953
+ 1,
954
+ // Length of integer
955
+ 0,
956
+ // Version number
957
+ 48,
958
+ // ASN.1 sequence tag
959
+ 5,
960
+ // Length of sequence
961
+ 6,
962
+ // ASN.1 object identifier tag
963
+ 3,
964
+ // Length of object identifier
965
+ // Edwards curve algorithms identifier https://oid-rep.orange-labs.fr/get/1.3.101.112
966
+ 43,
967
+ // iso(1) / identified-organization(3) (The first node is multiplied by the decimal 40 and the result is added to the value of the second node)
968
+ 101,
969
+ // thawte(101)
970
+ // Ed25519 identifier
971
+ 112,
972
+ // id-Ed25519(112)
973
+ /**
974
+ * Private key payload
975
+ */
976
+ 4,
977
+ // ASN.1 octet string tag
978
+ 34,
979
+ // String length (34 more bytes)
980
+ // Private key bytes as octet string
981
+ 4,
982
+ // ASN.1 octet string tag
983
+ 32,
984
+ // String length (32 bytes)
985
+ ...bytes
986
+ ]);
987
+ }
988
+ async function createPrivateKeyFromBytes(bytes, extractable) {
989
+ if (bytes.byteLength !== 32) {
990
+ throw new Error("Private key bytes must be of length 32");
991
+ }
992
+ const privateKeyBytesPkcs8 = addPkcs8Header(bytes);
993
+ return await crypto.subtle.importKey("pkcs8", privateKeyBytesPkcs8, "Ed25519", extractable != null ? extractable : false, ["sign"]);
994
+ }
995
+ var base58Encoder;
996
+ function assertIsSignature(putativeSignature) {
997
+ if (!base58Encoder)
998
+ base58Encoder = getBase58Encoder();
999
+ try {
1000
+ if (
1001
+ // Lowest value (64 bytes of zeroes)
1002
+ putativeSignature.length < 64 || // Highest value (64 bytes of 255)
1003
+ putativeSignature.length > 88
1004
+ ) {
1005
+ throw new Error("Expected input string to decode to a byte array of length 64.");
1006
+ }
1007
+ const bytes = base58Encoder.encode(putativeSignature);
1008
+ const numBytes = bytes.byteLength;
1009
+ if (numBytes !== 64) {
1010
+ throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
1011
+ }
1012
+ } catch (e3) {
1013
+ throw new Error(`\`${putativeSignature}\` is not a signature`, {
1014
+ cause: e3
1015
+ });
1016
+ }
1017
+ }
1018
+ function isSignature(putativeSignature) {
1019
+ if (!base58Encoder)
1020
+ base58Encoder = getBase58Encoder();
1021
+ if (
1022
+ // Lowest value (64 bytes of zeroes)
1023
+ putativeSignature.length < 64 || // Highest value (64 bytes of 255)
1024
+ putativeSignature.length > 88
1025
+ ) {
1026
+ return false;
1027
+ }
1028
+ const bytes = base58Encoder.encode(putativeSignature);
1029
+ const numBytes = bytes.byteLength;
1030
+ if (numBytes !== 64) {
1031
+ return false;
1032
+ }
1033
+ return true;
1034
+ }
893
1035
  async function signBytes(key, data) {
894
1036
  await assertSigningCapabilityIsAvailable();
895
1037
  const signedData = await crypto.subtle.sign("Ed25519", key, data);
896
1038
  return new Uint8Array(signedData);
897
1039
  }
898
- async function verifySignature(key, signature, data) {
1040
+ function signature(putativeSignature) {
1041
+ assertIsSignature(putativeSignature);
1042
+ return putativeSignature;
1043
+ }
1044
+ async function verifySignature(key, signature2, data) {
899
1045
  await assertVerificationCapabilityIsAvailable();
900
- return await crypto.subtle.verify("Ed25519", key, signature, data);
1046
+ return await crypto.subtle.verify("Ed25519", key, signature2, data);
901
1047
  }
902
1048
 
903
1049
  // ../rpc-types/dist/index.browser.js
@@ -996,239 +1142,205 @@ this.globalThis.solanaWeb3 = (function (exports) {
996
1142
  // ../transactions/dist/index.browser.js
997
1143
  init_env_shim();
998
1144
 
999
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/index.mjs
1000
- init_env_shim();
1001
-
1002
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
1145
+ // ../codecs-data-structures/dist/index.browser.js
1003
1146
  init_env_shim();
1004
- function mapSerializer(serializer, unmap, map) {
1005
- return {
1006
- description: serializer.description,
1007
- fixedSize: serializer.fixedSize,
1008
- maxSize: serializer.maxSize,
1009
- serialize: (value) => serializer.serialize(unmap(value)),
1010
- deserialize: (buffer, offset = 0) => {
1011
- const [value, length] = serializer.deserialize(buffer, offset);
1012
- return map ? [map(value, buffer, offset), length] : [value, length];
1013
- }
1014
- };
1147
+ function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
1148
+ if (expected !== actual) {
1149
+ throw new Error(`Expected [${codecDescription}] to have ${expected} items, got ${actual}.`);
1150
+ }
1015
1151
  }
1016
-
1017
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/index.mjs
1018
- init_env_shim();
1019
-
1020
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
1021
- init_env_shim();
1022
-
1023
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
1024
- init_env_shim();
1025
- var InvalidBaseStringError = class extends Error {
1026
- constructor(value, base, cause) {
1027
- const message = `Expected a string of base ${base}, got [${value}].`;
1028
- super(message);
1029
- __publicField(this, "name", "InvalidBaseStringError");
1030
- this.cause = cause;
1152
+ function sumCodecSizes(sizes) {
1153
+ return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
1154
+ }
1155
+ function getFixedSize(codec) {
1156
+ return isFixedSize(codec) ? codec.fixedSize : null;
1157
+ }
1158
+ function getMaxSize(codec) {
1159
+ var _a;
1160
+ return isFixedSize(codec) ? codec.fixedSize : (_a = codec.maxSize) != null ? _a : null;
1161
+ }
1162
+ function getArrayEncoder(item, config = {}) {
1163
+ var _a, _b;
1164
+ const size = (_a = config.size) != null ? _a : getU32Encoder();
1165
+ if (size === "remainder") {
1166
+ assertIsFixedSize(item, 'Codecs of "remainder" size must have fixed-size items.');
1031
1167
  }
1032
- };
1033
-
1034
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
1035
- var baseX = (alphabet) => {
1036
- const base = alphabet.length;
1037
- const baseBigInt = BigInt(base);
1038
- return {
1039
- description: `base${base}`,
1040
- fixedSize: null,
1041
- maxSize: null,
1042
- serialize(value) {
1043
- if (!value.match(new RegExp(`^[${alphabet}]*$`))) {
1044
- throw new InvalidBaseStringError(value, base);
1045
- }
1046
- if (value === "")
1047
- return new Uint8Array();
1048
- const chars = [...value];
1049
- let trailIndex = chars.findIndex((c) => c !== alphabet[0]);
1050
- trailIndex = trailIndex === -1 ? chars.length : trailIndex;
1051
- const leadingZeroes = Array(trailIndex).fill(0);
1052
- if (trailIndex === chars.length)
1053
- return Uint8Array.from(leadingZeroes);
1054
- const tailChars = chars.slice(trailIndex);
1055
- let base10Number = 0n;
1056
- let baseXPower = 1n;
1057
- for (let i = tailChars.length - 1; i >= 0; i -= 1) {
1058
- base10Number += baseXPower * BigInt(alphabet.indexOf(tailChars[i]));
1059
- baseXPower *= baseBigInt;
1060
- }
1061
- const tailBytes = [];
1062
- while (base10Number > 0n) {
1063
- tailBytes.unshift(Number(base10Number % 256n));
1064
- base10Number /= 256n;
1065
- }
1066
- return Uint8Array.from(leadingZeroes.concat(tailBytes));
1168
+ const fixedSize = computeArrayLikeCodecSize(size, getFixedSize(item));
1169
+ const maxSize = (_b = computeArrayLikeCodecSize(size, getMaxSize(item))) != null ? _b : void 0;
1170
+ return createEncoder({
1171
+ ...fixedSize !== null ? { fixedSize } : {
1172
+ getSizeFromValue: (array) => {
1173
+ const prefixSize = typeof size === "object" ? getEncodedSize(array.length, size) : 0;
1174
+ return prefixSize + [...array].reduce((all, value) => all + getEncodedSize(value, item), 0);
1175
+ },
1176
+ maxSize
1067
1177
  },
1068
- deserialize(buffer, offset = 0) {
1069
- if (buffer.length === 0)
1070
- return ["", 0];
1071
- const bytes = buffer.slice(offset);
1072
- let trailIndex = bytes.findIndex((n) => n !== 0);
1073
- trailIndex = trailIndex === -1 ? bytes.length : trailIndex;
1074
- const leadingZeroes = alphabet[0].repeat(trailIndex);
1075
- if (trailIndex === bytes.length)
1076
- return [leadingZeroes, buffer.length];
1077
- let base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
1078
- const tailChars = [];
1079
- while (base10Number > 0n) {
1080
- tailChars.unshift(alphabet[Number(base10Number % baseBigInt)]);
1081
- base10Number /= baseBigInt;
1178
+ write: (array, bytes, offset) => {
1179
+ if (typeof size === "number") {
1180
+ assertValidNumberOfItemsForCodec("array", size, array.length);
1082
1181
  }
1083
- return [leadingZeroes + tailChars.join(""), buffer.length];
1084
- }
1085
- };
1086
- };
1087
-
1088
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
1089
- init_env_shim();
1090
- var base58 = baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
1091
-
1092
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base64.mjs
1093
- init_env_shim();
1094
-
1095
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseXReslice.mjs
1096
- init_env_shim();
1097
- var baseXReslice = (alphabet, bits) => {
1098
- const base = alphabet.length;
1099
- const reslice = (input, inputBits, outputBits, useRemainder) => {
1100
- const output = [];
1101
- let accumulator = 0;
1102
- let bitsInAccumulator = 0;
1103
- const mask = (1 << outputBits) - 1;
1104
- for (const value of input) {
1105
- accumulator = accumulator << inputBits | value;
1106
- bitsInAccumulator += inputBits;
1107
- while (bitsInAccumulator >= outputBits) {
1108
- bitsInAccumulator -= outputBits;
1109
- output.push(accumulator >> bitsInAccumulator & mask);
1182
+ if (typeof size === "object") {
1183
+ offset = size.write(array.length, bytes, offset);
1110
1184
  }
1185
+ array.forEach((value) => {
1186
+ offset = item.write(value, bytes, offset);
1187
+ });
1188
+ return offset;
1111
1189
  }
1112
- if (useRemainder && bitsInAccumulator > 0) {
1113
- output.push(accumulator << outputBits - bitsInAccumulator & mask);
1114
- }
1115
- return output;
1116
- };
1117
- return {
1118
- description: `base${base}`,
1119
- fixedSize: null,
1120
- maxSize: null,
1121
- serialize(value) {
1122
- if (!value.match(new RegExp(`^[${alphabet}]*$`))) {
1123
- throw new InvalidBaseStringError(value, base);
1190
+ });
1191
+ }
1192
+ function getArrayDecoder(item, config = {}) {
1193
+ var _a, _b;
1194
+ const size = (_a = config.size) != null ? _a : getU32Decoder();
1195
+ if (size === "remainder") {
1196
+ assertIsFixedSize(item, 'Codecs of "remainder" size must have fixed-size items.');
1197
+ }
1198
+ const itemSize = getFixedSize(item);
1199
+ const fixedSize = computeArrayLikeCodecSize(size, itemSize);
1200
+ const maxSize = (_b = computeArrayLikeCodecSize(size, getMaxSize(item))) != null ? _b : void 0;
1201
+ return createDecoder({
1202
+ ...fixedSize !== null ? { fixedSize } : { maxSize },
1203
+ read: (bytes, offset) => {
1204
+ const array = [];
1205
+ if (typeof size === "object" && bytes.slice(offset).length === 0) {
1206
+ return [array, offset];
1124
1207
  }
1125
- if (value === "")
1126
- return new Uint8Array();
1127
- const charIndices = [...value].map((c) => alphabet.indexOf(c));
1128
- const bytes = reslice(charIndices, bits, 8, false);
1129
- return Uint8Array.from(bytes);
1130
- },
1131
- deserialize(buffer, offset = 0) {
1132
- if (buffer.length === 0)
1133
- return ["", 0];
1134
- const bytes = [...buffer.slice(offset)];
1135
- const charIndices = reslice(bytes, 8, bits, true);
1136
- return [charIndices.map((i) => alphabet[i]).join(""), buffer.length];
1208
+ const [resolvedSize, newOffset] = readArrayLikeCodecSize(size, itemSize, bytes, offset);
1209
+ offset = newOffset;
1210
+ for (let i = 0; i < resolvedSize; i += 1) {
1211
+ const [value, newOffset2] = item.read(bytes, offset);
1212
+ offset = newOffset2;
1213
+ array.push(value);
1214
+ }
1215
+ return [array, offset];
1137
1216
  }
1138
- };
1139
- };
1140
-
1141
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base64.mjs
1142
- var base64 = mapSerializer(baseXReslice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 6), (value) => value.replace(/=/g, ""), (value) => value.padEnd(Math.ceil(value.length / 4) * 4, "="));
1143
-
1144
- // ../codecs-data-structures/dist/index.browser.js
1145
- init_env_shim();
1146
- function sumCodecSizes(sizes) {
1147
- return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
1217
+ });
1148
1218
  }
1149
- function getArrayLikeCodecSizeDescription(size) {
1150
- return typeof size === "object" ? size.description : `${size}`;
1219
+ function readArrayLikeCodecSize(size, itemSize, bytes, offset) {
1220
+ if (typeof size === "number") {
1221
+ return [size, offset];
1222
+ }
1223
+ if (typeof size === "object") {
1224
+ return size.read(bytes, offset);
1225
+ }
1226
+ if (size === "remainder") {
1227
+ if (itemSize === null) {
1228
+ throw new Error('Codecs of "remainder" size must have fixed-size items.');
1229
+ }
1230
+ const remainder = Math.max(0, bytes.length - offset);
1231
+ if (remainder % itemSize !== 0) {
1232
+ throw new Error(
1233
+ `The remainder of the byte array (${remainder} bytes) cannot be split into chunks of ${itemSize} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainder} modulo ${itemSize} should be equal to zero.`
1234
+ );
1235
+ }
1236
+ return [remainder / itemSize, offset];
1237
+ }
1238
+ throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(size)}`);
1151
1239
  }
1152
- function getArrayLikeCodecSizeFromChildren(size, childrenSizes) {
1240
+ function computeArrayLikeCodecSize(size, itemSize) {
1153
1241
  if (typeof size !== "number")
1154
1242
  return null;
1155
1243
  if (size === 0)
1156
1244
  return 0;
1157
- const childrenSize = sumCodecSizes(childrenSizes);
1158
- return childrenSize === null ? null : childrenSize * size;
1159
- }
1160
- function getArrayLikeCodecSizePrefix(size, realSize) {
1161
- return typeof size === "object" ? size.encode(realSize) : new Uint8Array();
1245
+ return itemSize === null ? null : itemSize * size;
1162
1246
  }
1163
- function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
1164
- if (expected !== actual) {
1165
- throw new Error(`Expected [${codecDescription}] to have ${expected} items, got ${actual}.`);
1247
+ function getBytesEncoder(config = {}) {
1248
+ var _a;
1249
+ const size = (_a = config.size) != null ? _a : "variable";
1250
+ const byteEncoder = createEncoder({
1251
+ getSizeFromValue: (value) => value.length,
1252
+ write: (value, bytes, offset) => {
1253
+ bytes.set(value, offset);
1254
+ return offset + value.length;
1255
+ }
1256
+ });
1257
+ if (size === "variable") {
1258
+ return byteEncoder;
1166
1259
  }
1167
- }
1168
- function arrayCodecHelper(item, size, description) {
1169
- if (size === "remainder" && item.fixedSize === null) {
1170
- throw new Error('Codecs of "remainder" size must have fixed-size items.');
1260
+ if (typeof size === "number") {
1261
+ return fixEncoder(byteEncoder, size);
1171
1262
  }
1172
- return {
1173
- description: description ?? `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`,
1174
- fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]),
1175
- maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize])
1176
- };
1177
- }
1178
- function getArrayEncoder(item, options = {}) {
1179
- const size = options.size ?? getU32Encoder();
1180
- return {
1181
- ...arrayCodecHelper(item, size, options.description),
1182
- encode: (value) => {
1183
- if (typeof size === "number") {
1184
- assertValidNumberOfItemsForCodec("array", size, value.length);
1185
- }
1186
- return mergeBytes([getArrayLikeCodecSizePrefix(size, value.length), ...value.map((v) => item.encode(v))]);
1263
+ return createEncoder({
1264
+ getSizeFromValue: (value) => getEncodedSize(value.length, size) + value.length,
1265
+ write: (value, bytes, offset) => {
1266
+ offset = size.write(value.length, bytes, offset);
1267
+ return byteEncoder.write(value, bytes, offset);
1187
1268
  }
1188
- };
1269
+ });
1189
1270
  }
1190
- function getBytesEncoder(options = {}) {
1191
- const size = options.size ?? "variable";
1192
- const sizeDescription = typeof size === "object" ? size.description : `${size}`;
1193
- const description = options.description ?? `bytes(${sizeDescription})`;
1194
- const byteEncoder = {
1195
- description,
1196
- encode: (value) => value,
1197
- fixedSize: null,
1198
- maxSize: null
1199
- };
1271
+ function getBytesDecoder(config = {}) {
1272
+ var _a;
1273
+ const size = (_a = config.size) != null ? _a : "variable";
1274
+ const byteDecoder = createDecoder({
1275
+ read: (bytes, offset) => {
1276
+ const slice = bytes.slice(offset);
1277
+ return [slice, offset + slice.length];
1278
+ }
1279
+ });
1200
1280
  if (size === "variable") {
1201
- return byteEncoder;
1281
+ return byteDecoder;
1202
1282
  }
1203
1283
  if (typeof size === "number") {
1204
- return fixEncoder(byteEncoder, size, description);
1284
+ return fixDecoder(byteDecoder, size);
1205
1285
  }
1206
- return {
1207
- ...byteEncoder,
1208
- encode: (value) => {
1209
- const contentBytes = byteEncoder.encode(value);
1210
- const lengthBytes = size.encode(contentBytes.length);
1211
- return mergeBytes([lengthBytes, contentBytes]);
1286
+ return createDecoder({
1287
+ read: (bytes, offset) => {
1288
+ assertByteArrayIsNotEmptyForCodec("bytes", bytes, offset);
1289
+ const [lengthBigInt, lengthOffset] = size.read(bytes, offset);
1290
+ const length = Number(lengthBigInt);
1291
+ offset = lengthOffset;
1292
+ const contentBytes = bytes.slice(offset, offset + length);
1293
+ assertByteArrayHasEnoughBytesForCodec("bytes", length, contentBytes);
1294
+ const [value, contentOffset] = byteDecoder.read(contentBytes, 0);
1295
+ offset += contentOffset;
1296
+ return [value, offset];
1212
1297
  }
1213
- };
1298
+ });
1214
1299
  }
1215
- function structCodecHelper(fields, description) {
1216
- const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", ");
1217
- return {
1218
- description: description ?? `struct(${fieldDescriptions})`,
1219
- fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)),
1220
- maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize))
1221
- };
1300
+ function getStructEncoder(fields) {
1301
+ var _a;
1302
+ const fieldCodecs = fields.map(([, codec]) => codec);
1303
+ const fixedSize = sumCodecSizes(fieldCodecs.map(getFixedSize));
1304
+ const maxSize = (_a = sumCodecSizes(fieldCodecs.map(getMaxSize))) != null ? _a : void 0;
1305
+ return createEncoder({
1306
+ ...fixedSize === null ? {
1307
+ getSizeFromValue: (value) => fields.map(([key, codec]) => getEncodedSize(value[key], codec)).reduce((all, one) => all + one, 0),
1308
+ maxSize
1309
+ } : { fixedSize },
1310
+ write: (struct, bytes, offset) => {
1311
+ fields.forEach(([key, codec]) => {
1312
+ offset = codec.write(struct[key], bytes, offset);
1313
+ });
1314
+ return offset;
1315
+ }
1316
+ });
1222
1317
  }
1223
- function getStructEncoder(fields, options = {}) {
1224
- return {
1225
- ...structCodecHelper(fields, options.description),
1226
- encode: (struct) => {
1227
- const fieldBytes = fields.map(([key, codec]) => codec.encode(struct[key]));
1228
- return mergeBytes(fieldBytes);
1318
+ function getStructDecoder(fields) {
1319
+ var _a;
1320
+ const fieldCodecs = fields.map(([, codec]) => codec);
1321
+ const fixedSize = sumCodecSizes(fieldCodecs.map(getFixedSize));
1322
+ const maxSize = (_a = sumCodecSizes(fieldCodecs.map(getMaxSize))) != null ? _a : void 0;
1323
+ return createDecoder({
1324
+ ...fixedSize === null ? { maxSize } : { fixedSize },
1325
+ read: (bytes, offset) => {
1326
+ const struct = {};
1327
+ fields.forEach(([key, codec]) => {
1328
+ const [value, newOffset] = codec.read(bytes, offset);
1329
+ offset = newOffset;
1330
+ struct[key] = value;
1331
+ });
1332
+ return [struct, offset];
1229
1333
  }
1230
- };
1334
+ });
1335
+ }
1336
+
1337
+ // ../functional/dist/index.browser.js
1338
+ init_env_shim();
1339
+ function pipe(init, ...fns) {
1340
+ return fns.reduce((acc, fn) => fn(acc), init);
1231
1341
  }
1342
+
1343
+ // ../transactions/dist/index.browser.js
1232
1344
  function getUnsignedTransaction(transaction) {
1233
1345
  if ("signatures" in transaction) {
1234
1346
  const {
@@ -1241,7 +1353,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
1241
1353
  return transaction;
1242
1354
  }
1243
1355
  }
1356
+ var base58Encoder2;
1244
1357
  function assertIsBlockhash(putativeBlockhash) {
1358
+ if (!base58Encoder2)
1359
+ base58Encoder2 = getBase58Encoder();
1245
1360
  try {
1246
1361
  if (
1247
1362
  // Lowest value (32 bytes of zeroes)
@@ -1250,7 +1365,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1250
1365
  ) {
1251
1366
  throw new Error("Expected input string to decode to a byte array of length 32.");
1252
1367
  }
1253
- const bytes = base58.serialize(putativeBlockhash);
1368
+ const bytes = base58Encoder2.encode(putativeBlockhash);
1254
1369
  const numBytes = bytes.byteLength;
1255
1370
  if (numBytes !== 32) {
1256
1371
  throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
@@ -1261,6 +1376,22 @@ this.globalThis.solanaWeb3 = (function (exports) {
1261
1376
  });
1262
1377
  }
1263
1378
  }
1379
+ function isTransactionWithBlockhashLifetime(transaction) {
1380
+ const lifetimeConstraintShapeMatches = "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.blockhash === "string" && typeof transaction.lifetimeConstraint.lastValidBlockHeight === "bigint";
1381
+ if (!lifetimeConstraintShapeMatches)
1382
+ return false;
1383
+ try {
1384
+ assertIsBlockhash(transaction.lifetimeConstraint.blockhash);
1385
+ return true;
1386
+ } catch {
1387
+ return false;
1388
+ }
1389
+ }
1390
+ function assertIsTransactionWithBlockhashLifetime(transaction) {
1391
+ if (!isTransactionWithBlockhashLifetime(transaction)) {
1392
+ throw new Error("Transaction does not have a blockhash lifetime");
1393
+ }
1394
+ }
1264
1395
  function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
1265
1396
  if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
1266
1397
  return transaction;
@@ -1325,12 +1456,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
1325
1456
  };
1326
1457
  }
1327
1458
  function isAdvanceNonceAccountInstruction(instruction) {
1459
+ var _a;
1328
1460
  return instruction.programAddress === SYSTEM_PROGRAM_ADDRESS && // Test for `AdvanceNonceAccount` instruction data
1329
1461
  instruction.data != null && isAdvanceNonceAccountInstructionData(instruction.data) && // Test for exactly 3 accounts
1330
- instruction.accounts?.length === 3 && // First account is nonce account address
1462
+ ((_a = instruction.accounts) == null ? void 0 : _a.length) === 3 && // First account is nonce account address
1331
1463
  instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole2.WRITABLE && // Second account is recent blockhashes sysvar
1332
1464
  instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole2.READONLY && // Third account is nonce authority account
1333
- instruction.accounts[2].address != null && instruction.accounts[2].role === AccountRole2.READONLY_SIGNER;
1465
+ instruction.accounts[2].address != null && isSignerRole2(instruction.accounts[2].role);
1334
1466
  }
1335
1467
  function isAdvanceNonceAccountInstructionData(data) {
1336
1468
  return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
@@ -1338,21 +1470,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
1338
1470
  function isDurableNonceTransaction(transaction) {
1339
1471
  return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
1340
1472
  }
1473
+ function isAdvanceNonceAccountInstructionForNonce(instruction, nonceAccountAddress, nonceAuthorityAddress) {
1474
+ return instruction.accounts[0].address === nonceAccountAddress && instruction.accounts[2].address === nonceAuthorityAddress;
1475
+ }
1341
1476
  function setTransactionLifetimeUsingDurableNonce({
1342
1477
  nonce,
1343
1478
  nonceAccountAddress,
1344
1479
  nonceAuthorityAddress
1345
1480
  }, transaction) {
1346
- const isAlreadyDurableNonceTransaction = isDurableNonceTransaction(transaction);
1347
- if (isAlreadyDurableNonceTransaction && transaction.lifetimeConstraint.nonce === nonce && transaction.instructions[0].accounts[0].address === nonceAccountAddress && transaction.instructions[0].accounts[2].address === nonceAuthorityAddress) {
1348
- return transaction;
1481
+ let newInstructions;
1482
+ const firstInstruction = transaction.instructions[0];
1483
+ if (firstInstruction && isAdvanceNonceAccountInstruction(firstInstruction)) {
1484
+ if (isAdvanceNonceAccountInstructionForNonce(firstInstruction, nonceAccountAddress, nonceAuthorityAddress)) {
1485
+ if (isDurableNonceTransaction(transaction) && transaction.lifetimeConstraint.nonce === nonce) {
1486
+ return transaction;
1487
+ } else {
1488
+ newInstructions = [firstInstruction, ...transaction.instructions.slice(1)];
1489
+ }
1490
+ } else {
1491
+ newInstructions = [
1492
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
1493
+ ...transaction.instructions.slice(1)
1494
+ ];
1495
+ }
1496
+ } else {
1497
+ newInstructions = [
1498
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
1499
+ ...transaction.instructions
1500
+ ];
1349
1501
  }
1350
1502
  const out = {
1351
1503
  ...getUnsignedTransaction(transaction),
1352
- instructions: [
1353
- createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
1354
- ...isAlreadyDurableNonceTransaction ? transaction.instructions.slice(1) : transaction.instructions
1355
- ],
1504
+ instructions: newInstructions,
1356
1505
  lifetimeConstraint: {
1357
1506
  nonce
1358
1507
  }
@@ -1388,7 +1537,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
1388
1537
  return out;
1389
1538
  }
1390
1539
  function upsert(addressMap, address2, update) {
1391
- addressMap[address2] = update(addressMap[address2] ?? { role: AccountRole2.READONLY });
1540
+ var _a;
1541
+ addressMap[address2] = update((_a = addressMap[address2]) != null ? _a : { role: AccountRole2.READONLY });
1392
1542
  }
1393
1543
  var TYPE = Symbol("AddressMapTypeProperty");
1394
1544
  function getAddressMapFromInstructions(feePayer, instructions) {
@@ -1645,140 +1795,141 @@ this.globalThis.solanaWeb3 = (function (exports) {
1645
1795
  version: transaction.version
1646
1796
  };
1647
1797
  }
1648
- function getCompiledTransaction(transaction) {
1649
- const compiledMessage = compileMessage(transaction);
1650
- let signatures;
1651
- if ("signatures" in transaction) {
1652
- signatures = [];
1653
- for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
1654
- signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
1655
- }
1656
- } else {
1657
- signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
1658
- }
1659
- return {
1660
- compiledMessage,
1661
- signatures
1662
- };
1663
- }
1664
- var lookupTableAddressDescription = "The address of the address lookup table account from which instruction addresses should be looked up" ;
1665
- var writableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as writeable" ;
1666
- var readableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as read-only" ;
1667
- 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" ;
1668
1798
  var memoizedAddressTableLookupEncoder;
1669
1799
  function getAddressTableLookupEncoder() {
1670
1800
  if (!memoizedAddressTableLookupEncoder) {
1671
- memoizedAddressTableLookupEncoder = getStructEncoder(
1801
+ memoizedAddressTableLookupEncoder = getStructEncoder([
1802
+ ["lookupTableAddress", getAddressEncoder()],
1672
1803
  [
1673
- ["lookupTableAddress", getAddressEncoder({ description: lookupTableAddressDescription })],
1674
- [
1675
- "writableIndices",
1676
- getArrayEncoder(getU8Encoder(), {
1677
- description: writableIndicesDescription,
1678
- size: getShortU16Encoder()
1679
- })
1680
- ],
1681
- [
1682
- "readableIndices",
1683
- getArrayEncoder(getU8Encoder(), {
1684
- description: readableIndicesDescription,
1685
- size: getShortU16Encoder()
1686
- })
1687
- ]
1804
+ "writableIndices",
1805
+ getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
1688
1806
  ],
1689
- { description: addressTableLookupDescription }
1690
- );
1807
+ [
1808
+ "readableIndices",
1809
+ getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
1810
+ ]
1811
+ ]);
1691
1812
  }
1692
1813
  return memoizedAddressTableLookupEncoder;
1693
1814
  }
1815
+ var memoizedAddressTableLookupDecoder;
1816
+ function getAddressTableLookupDecoder() {
1817
+ if (!memoizedAddressTableLookupDecoder) {
1818
+ memoizedAddressTableLookupDecoder = getStructDecoder([
1819
+ ["lookupTableAddress", getAddressDecoder()],
1820
+ ["writableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })],
1821
+ ["readableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })]
1822
+ ]);
1823
+ }
1824
+ return memoizedAddressTableLookupDecoder;
1825
+ }
1694
1826
  var memoizedU8Encoder;
1695
1827
  function getMemoizedU8Encoder() {
1696
1828
  if (!memoizedU8Encoder)
1697
1829
  memoizedU8Encoder = getU8Encoder();
1698
1830
  return memoizedU8Encoder;
1699
1831
  }
1700
- function getMemoizedU8EncoderDescription(description) {
1701
- const encoder = getMemoizedU8Encoder();
1702
- return {
1703
- ...encoder,
1704
- description: description ?? encoder.description
1705
- };
1832
+ var memoizedU8Decoder;
1833
+ function getMemoizedU8Decoder() {
1834
+ if (!memoizedU8Decoder)
1835
+ memoizedU8Decoder = getU8Decoder();
1836
+ return memoizedU8Decoder;
1706
1837
  }
1707
- var numSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" ;
1708
- 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" ;
1709
- var numReadonlyNonSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" ;
1710
- var messageHeaderDescription = "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" ;
1711
1838
  function getMessageHeaderEncoder() {
1712
- return getStructEncoder(
1713
- [
1714
- ["numSignerAccounts", getMemoizedU8EncoderDescription(numSignerAccountsDescription)],
1715
- ["numReadonlySignerAccounts", getMemoizedU8EncoderDescription(numReadonlySignerAccountsDescription)],
1716
- ["numReadonlyNonSignerAccounts", getMemoizedU8EncoderDescription(numReadonlyNonSignerAccountsDescription)]
1717
- ],
1718
- {
1719
- description: messageHeaderDescription
1720
- }
1721
- );
1839
+ return getStructEncoder([
1840
+ ["numSignerAccounts", getMemoizedU8Encoder()],
1841
+ ["numReadonlySignerAccounts", getMemoizedU8Encoder()],
1842
+ ["numReadonlyNonSignerAccounts", getMemoizedU8Encoder()]
1843
+ ]);
1844
+ }
1845
+ function getMessageHeaderDecoder() {
1846
+ return getStructDecoder([
1847
+ ["numSignerAccounts", getMemoizedU8Decoder()],
1848
+ ["numReadonlySignerAccounts", getMemoizedU8Decoder()],
1849
+ ["numReadonlyNonSignerAccounts", getMemoizedU8Decoder()]
1850
+ ]);
1722
1851
  }
1723
- var programAddressIndexDescription = "The index of the program being called, according to the well-ordered accounts list for this transaction" ;
1724
- var accountIndexDescription = "The index of an account, according to the well-ordered accounts list for this transaction" ;
1725
- 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" ;
1726
- var dataDescription = "An optional buffer of data passed to the instruction" ;
1727
1852
  var memoizedGetInstructionEncoder;
1728
1853
  function getInstructionEncoder() {
1729
1854
  if (!memoizedGetInstructionEncoder) {
1730
1855
  memoizedGetInstructionEncoder = mapEncoder(
1731
1856
  getStructEncoder([
1732
- ["programAddressIndex", getU8Encoder({ description: programAddressIndexDescription })],
1733
- [
1734
- "accountIndices",
1735
- getArrayEncoder(getU8Encoder({ description: accountIndexDescription }), {
1736
- description: accountIndicesDescription,
1737
- size: getShortU16Encoder()
1738
- })
1739
- ],
1740
- ["data", getBytesEncoder({ description: dataDescription, size: getShortU16Encoder() })]
1857
+ ["programAddressIndex", getU8Encoder()],
1858
+ ["accountIndices", getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })],
1859
+ ["data", getBytesEncoder({ size: getShortU16Encoder() })]
1741
1860
  ]),
1742
1861
  // Convert an instruction to have all fields defined
1743
1862
  (instruction) => {
1863
+ var _a, _b;
1744
1864
  if (instruction.accountIndices !== void 0 && instruction.data !== void 0) {
1745
1865
  return instruction;
1746
1866
  }
1747
1867
  return {
1748
1868
  ...instruction,
1749
- accountIndices: instruction.accountIndices ?? [],
1750
- data: instruction.data ?? new Uint8Array(0)
1869
+ accountIndices: (_a = instruction.accountIndices) != null ? _a : [],
1870
+ data: (_b = instruction.data) != null ? _b : new Uint8Array(0)
1751
1871
  };
1752
1872
  }
1753
1873
  );
1754
1874
  }
1755
1875
  return memoizedGetInstructionEncoder;
1756
1876
  }
1757
- var VERSION_FLAG_MASK = 128;
1758
- var BASE_CONFIG = {
1759
- description: "A single byte that encodes the version of the transaction" ,
1760
- fixedSize: null,
1761
- maxSize: 1
1762
- };
1763
- function encode(value) {
1764
- if (value === "legacy") {
1765
- return new Uint8Array();
1766
- }
1767
- if (value < 0 || value > 127) {
1768
- throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
1877
+ var memoizedGetInstructionDecoder;
1878
+ function getInstructionDecoder() {
1879
+ if (!memoizedGetInstructionDecoder) {
1880
+ memoizedGetInstructionDecoder = mapDecoder(
1881
+ getStructDecoder([
1882
+ ["programAddressIndex", getU8Decoder()],
1883
+ ["accountIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })],
1884
+ ["data", getBytesDecoder({ size: getShortU16Decoder() })]
1885
+ ]),
1886
+ // Convert an instruction to exclude optional fields if they are empty
1887
+ (instruction) => {
1888
+ if (instruction.accountIndices.length && instruction.data.byteLength) {
1889
+ return instruction;
1890
+ }
1891
+ const { accountIndices, data, ...rest } = instruction;
1892
+ return {
1893
+ ...rest,
1894
+ ...accountIndices.length ? { accountIndices } : null,
1895
+ ...data.byteLength ? { data } : null
1896
+ };
1897
+ }
1898
+ );
1769
1899
  }
1770
- return new Uint8Array([value | VERSION_FLAG_MASK]);
1900
+ return memoizedGetInstructionDecoder;
1771
1901
  }
1902
+ var VERSION_FLAG_MASK = 128;
1772
1903
  function getTransactionVersionEncoder() {
1773
- return {
1774
- ...BASE_CONFIG,
1775
- encode
1776
- };
1904
+ return createEncoder({
1905
+ getSizeFromValue: (value) => value === "legacy" ? 0 : 1,
1906
+ maxSize: 1,
1907
+ write: (value, bytes, offset) => {
1908
+ if (value === "legacy") {
1909
+ return offset;
1910
+ }
1911
+ if (value < 0 || value > 127) {
1912
+ throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
1913
+ }
1914
+ bytes.set([value | VERSION_FLAG_MASK], offset);
1915
+ return offset + 1;
1916
+ }
1917
+ });
1918
+ }
1919
+ function getTransactionVersionDecoder() {
1920
+ return createDecoder({
1921
+ maxSize: 1,
1922
+ read: (bytes, offset) => {
1923
+ const firstByte = bytes[offset];
1924
+ if ((firstByte & VERSION_FLAG_MASK) === 0) {
1925
+ return ["legacy", offset];
1926
+ } else {
1927
+ const version = firstByte ^ VERSION_FLAG_MASK;
1928
+ return [version, offset + 1];
1929
+ }
1930
+ }
1931
+ });
1777
1932
  }
1778
- var staticAccountsDescription = "A compact-array of static account addresses belonging to this transaction" ;
1779
- var lifetimeTokenDescription = "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ;
1780
- var instructionsDescription = "A compact-array of instructions belonging to this transaction" ;
1781
- var addressTableLookupsDescription = "A compact array of address table lookups belonging to this transaction" ;
1782
1933
  function getCompiledMessageLegacyEncoder() {
1783
1934
  return getStructEncoder(getPreludeStructEncoderTuple());
1784
1935
  }
@@ -1789,12 +1940,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
1789
1940
  ["addressTableLookups", getAddressTableLookupArrayEncoder()]
1790
1941
  ]),
1791
1942
  (value) => {
1943
+ var _a;
1792
1944
  if (value.version === "legacy") {
1793
1945
  return value;
1794
1946
  }
1795
1947
  return {
1796
1948
  ...value,
1797
- addressTableLookups: value.addressTableLookups ?? []
1949
+ addressTableLookups: (_a = value.addressTableLookups) != null ? _a : []
1798
1950
  };
1799
1951
  }
1800
1952
  );
@@ -1803,136 +1955,237 @@ this.globalThis.solanaWeb3 = (function (exports) {
1803
1955
  return [
1804
1956
  ["version", getTransactionVersionEncoder()],
1805
1957
  ["header", getMessageHeaderEncoder()],
1806
- [
1807
- "staticAccounts",
1808
- getArrayEncoder(getAddressEncoder(), {
1809
- description: staticAccountsDescription,
1810
- size: getShortU16Encoder()
1811
- })
1812
- ],
1813
- [
1814
- "lifetimeToken",
1815
- getStringEncoder({
1816
- description: lifetimeTokenDescription,
1817
- encoding: getBase58Encoder(),
1818
- size: 32
1819
- })
1820
- ],
1821
- [
1822
- "instructions",
1823
- getArrayEncoder(getInstructionEncoder(), {
1824
- description: instructionsDescription,
1825
- size: getShortU16Encoder()
1826
- })
1827
- ]
1958
+ ["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })],
1959
+ ["lifetimeToken", getStringEncoder({ encoding: getBase58Encoder(), size: 32 })],
1960
+ ["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })]
1961
+ ];
1962
+ }
1963
+ function getPreludeStructDecoderTuple() {
1964
+ return [
1965
+ ["version", getTransactionVersionDecoder()],
1966
+ ["header", getMessageHeaderDecoder()],
1967
+ ["staticAccounts", getArrayDecoder(getAddressDecoder(), { size: getShortU16Decoder() })],
1968
+ ["lifetimeToken", getStringDecoder({ encoding: getBase58Decoder(), size: 32 })],
1969
+ ["instructions", getArrayDecoder(getInstructionDecoder(), { size: getShortU16Decoder() })],
1970
+ ["addressTableLookups", getAddressTableLookupArrayDecoder()]
1828
1971
  ];
1829
1972
  }
1830
1973
  function getAddressTableLookupArrayEncoder() {
1831
- return getArrayEncoder(getAddressTableLookupEncoder(), {
1832
- description: addressTableLookupsDescription,
1833
- size: getShortU16Encoder()
1834
- });
1974
+ return getArrayEncoder(getAddressTableLookupEncoder(), { size: getShortU16Encoder() });
1975
+ }
1976
+ function getAddressTableLookupArrayDecoder() {
1977
+ return getArrayDecoder(getAddressTableLookupDecoder(), { size: getShortU16Decoder() });
1835
1978
  }
1836
- var messageDescription = "The wire format of a Solana transaction message" ;
1837
1979
  function getCompiledMessageEncoder() {
1838
- return {
1839
- description: messageDescription,
1840
- encode: (compiledMessage) => {
1980
+ return createEncoder({
1981
+ getSizeFromValue: (compiledMessage) => {
1841
1982
  if (compiledMessage.version === "legacy") {
1842
- return getCompiledMessageLegacyEncoder().encode(compiledMessage);
1983
+ return getCompiledMessageLegacyEncoder().getSizeFromValue(compiledMessage);
1843
1984
  } else {
1844
- return getCompiledMessageVersionedEncoder().encode(compiledMessage);
1985
+ return getCompiledMessageVersionedEncoder().getSizeFromValue(compiledMessage);
1845
1986
  }
1846
1987
  },
1847
- fixedSize: null,
1848
- maxSize: null
1849
- };
1988
+ write: (compiledMessage, bytes, offset) => {
1989
+ if (compiledMessage.version === "legacy") {
1990
+ return getCompiledMessageLegacyEncoder().write(compiledMessage, bytes, offset);
1991
+ } else {
1992
+ return getCompiledMessageVersionedEncoder().write(compiledMessage, bytes, offset);
1993
+ }
1994
+ }
1995
+ });
1850
1996
  }
1851
- var transactionDescription = "The wire format of a Solana transaction" ;
1852
- var signaturesDescription = "A compact array of 64-byte, base-64 encoded Ed25519 signatures" ;
1853
- function getCompiledTransactionEncoder() {
1854
- return getStructEncoder(
1855
- [
1856
- [
1857
- "signatures",
1858
- getArrayEncoder(getBytesEncoder({ size: 64 }), {
1859
- description: signaturesDescription,
1860
- size: getShortU16Encoder()
1861
- })
1862
- ],
1863
- ["compiledMessage", getCompiledMessageEncoder()]
1864
- ],
1865
- {
1866
- description: transactionDescription
1997
+ function getCompiledMessageDecoder() {
1998
+ return mapDecoder(getStructDecoder(getPreludeStructDecoderTuple()), ({ addressTableLookups, ...restOfMessage }) => {
1999
+ if (restOfMessage.version === "legacy" || !(addressTableLookups == null ? void 0 : addressTableLookups.length)) {
2000
+ return restOfMessage;
1867
2001
  }
1868
- );
2002
+ return { ...restOfMessage, addressTableLookups };
2003
+ });
1869
2004
  }
1870
- function getTransactionEncoder() {
1871
- return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
2005
+ function getCompiledMessageCodec() {
2006
+ return combineCodec(getCompiledMessageEncoder(), getCompiledMessageDecoder());
1872
2007
  }
1873
- function assertIsTransactionSignature(putativeTransactionSignature) {
1874
- try {
1875
- if (
1876
- // Lowest value (64 bytes of zeroes)
1877
- putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
1878
- putativeTransactionSignature.length > 88
1879
- ) {
1880
- throw new Error("Expected input string to decode to a byte array of length 64.");
1881
- }
1882
- const bytes = base58.serialize(putativeTransactionSignature);
1883
- const numBytes = bytes.byteLength;
1884
- if (numBytes !== 64) {
1885
- throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
2008
+ function getCompiledTransaction(transaction) {
2009
+ var _a;
2010
+ const compiledMessage = compileMessage(transaction);
2011
+ let signatures;
2012
+ if ("signatures" in transaction) {
2013
+ signatures = [];
2014
+ for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
2015
+ signatures[ii] = (_a = transaction.signatures[compiledMessage.staticAccounts[ii]]) != null ? _a : new Uint8Array(Array(64).fill(0));
1886
2016
  }
1887
- } catch (e3) {
1888
- throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
1889
- cause: e3
2017
+ } else {
2018
+ signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
2019
+ }
2020
+ return {
2021
+ compiledMessage,
2022
+ signatures
2023
+ };
2024
+ }
2025
+ function getAccountMetas(message) {
2026
+ const { header } = message;
2027
+ const numWritableSignerAccounts = header.numSignerAccounts - header.numReadonlySignerAccounts;
2028
+ const numWritableNonSignerAccounts = message.staticAccounts.length - header.numSignerAccounts - header.numReadonlyNonSignerAccounts;
2029
+ const accountMetas = [];
2030
+ let accountIndex = 0;
2031
+ for (let i = 0; i < numWritableSignerAccounts; i++) {
2032
+ accountMetas.push({
2033
+ address: message.staticAccounts[accountIndex],
2034
+ role: AccountRole2.WRITABLE_SIGNER
1890
2035
  });
2036
+ accountIndex++;
1891
2037
  }
2038
+ for (let i = 0; i < header.numReadonlySignerAccounts; i++) {
2039
+ accountMetas.push({
2040
+ address: message.staticAccounts[accountIndex],
2041
+ role: AccountRole2.READONLY_SIGNER
2042
+ });
2043
+ accountIndex++;
2044
+ }
2045
+ for (let i = 0; i < numWritableNonSignerAccounts; i++) {
2046
+ accountMetas.push({
2047
+ address: message.staticAccounts[accountIndex],
2048
+ role: AccountRole2.WRITABLE
2049
+ });
2050
+ accountIndex++;
2051
+ }
2052
+ for (let i = 0; i < header.numReadonlyNonSignerAccounts; i++) {
2053
+ accountMetas.push({
2054
+ address: message.staticAccounts[accountIndex],
2055
+ role: AccountRole2.READONLY
2056
+ });
2057
+ accountIndex++;
2058
+ }
2059
+ return accountMetas;
1892
2060
  }
1893
- function isTransactionSignature(putativeTransactionSignature) {
1894
- if (
1895
- // Lowest value (64 bytes of zeroes)
1896
- putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
1897
- putativeTransactionSignature.length > 88
1898
- ) {
1899
- return false;
2061
+ function convertInstruction(instruction, accountMetas) {
2062
+ var _a, _b;
2063
+ const programAddress = (_a = accountMetas[instruction.programAddressIndex]) == null ? void 0 : _a.address;
2064
+ if (!programAddress) {
2065
+ throw new Error(`Could not find program address at index ${instruction.programAddressIndex}`);
1900
2066
  }
1901
- const bytes = base58.serialize(putativeTransactionSignature);
1902
- const numBytes = bytes.byteLength;
1903
- if (numBytes !== 64) {
1904
- return false;
2067
+ const accounts = (_b = instruction.accountIndices) == null ? void 0 : _b.map((accountIndex) => accountMetas[accountIndex]);
2068
+ const { data } = instruction;
2069
+ return {
2070
+ programAddress,
2071
+ ...accounts && accounts.length ? { accounts } : {},
2072
+ ...data && data.length ? { data } : {}
2073
+ };
2074
+ }
2075
+ function getLifetimeConstraint(messageLifetimeToken, firstInstruction, lastValidBlockHeight) {
2076
+ if (!firstInstruction || !isAdvanceNonceAccountInstruction(firstInstruction)) {
2077
+ return {
2078
+ blockhash: messageLifetimeToken,
2079
+ lastValidBlockHeight: lastValidBlockHeight != null ? lastValidBlockHeight : 2n ** 64n - 1n
2080
+ // U64 MAX
2081
+ };
2082
+ } else {
2083
+ const nonceAccountAddress = firstInstruction.accounts[0].address;
2084
+ assertIsAddress(nonceAccountAddress);
2085
+ const nonceAuthorityAddress = firstInstruction.accounts[2].address;
2086
+ assertIsAddress(nonceAuthorityAddress);
2087
+ return {
2088
+ nonce: messageLifetimeToken,
2089
+ nonceAccountAddress,
2090
+ nonceAuthorityAddress
2091
+ };
1905
2092
  }
1906
- return true;
1907
2093
  }
1908
- async function getCompiledMessageSignature(message, secretKey) {
1909
- const wireMessageBytes = getCompiledMessageEncoder().encode(message);
1910
- const signature = await signBytes(secretKey, wireMessageBytes);
1911
- return signature;
2094
+ function convertSignatures(compiledTransaction) {
2095
+ const {
2096
+ compiledMessage: { staticAccounts },
2097
+ signatures
2098
+ } = compiledTransaction;
2099
+ return signatures.reduce((acc, sig, index) => {
2100
+ const allZeros = sig.every((byte) => byte === 0);
2101
+ if (allZeros)
2102
+ return acc;
2103
+ const address2 = staticAccounts[index];
2104
+ return { ...acc, [address2]: sig };
2105
+ }, {});
2106
+ }
2107
+ function decompileTransaction(compiledTransaction, lastValidBlockHeight) {
2108
+ const { compiledMessage } = compiledTransaction;
2109
+ if ("addressTableLookups" in compiledMessage && compiledMessage.addressTableLookups.length > 0) {
2110
+ throw new Error("Cannot convert transaction with addressTableLookups");
2111
+ }
2112
+ const feePayer = compiledMessage.staticAccounts[0];
2113
+ if (!feePayer)
2114
+ throw new Error("No fee payer set in CompiledTransaction");
2115
+ const accountMetas = getAccountMetas(compiledMessage);
2116
+ const instructions = compiledMessage.instructions.map(
2117
+ (compiledInstruction) => convertInstruction(compiledInstruction, accountMetas)
2118
+ );
2119
+ const firstInstruction = instructions[0];
2120
+ const lifetimeConstraint = getLifetimeConstraint(
2121
+ compiledMessage.lifetimeToken,
2122
+ firstInstruction,
2123
+ lastValidBlockHeight
2124
+ );
2125
+ const signatures = convertSignatures(compiledTransaction);
2126
+ return pipe(
2127
+ createTransaction({ version: compiledMessage.version }),
2128
+ (tx) => setTransactionFeePayer(feePayer, tx),
2129
+ (tx) => instructions.reduce((acc, instruction) => {
2130
+ return appendTransactionInstruction(instruction, acc);
2131
+ }, tx),
2132
+ (tx) => "blockhash" in lifetimeConstraint ? setTransactionLifetimeUsingBlockhash(lifetimeConstraint, tx) : setTransactionLifetimeUsingDurableNonce(lifetimeConstraint, tx),
2133
+ (tx) => compiledTransaction.signatures.length ? { ...tx, signatures } : tx
2134
+ );
2135
+ }
2136
+ function getCompiledTransactionEncoder() {
2137
+ return getStructEncoder([
2138
+ ["signatures", getArrayEncoder(getBytesEncoder({ size: 64 }), { size: getShortU16Encoder() })],
2139
+ ["compiledMessage", getCompiledMessageEncoder()]
2140
+ ]);
2141
+ }
2142
+ function getCompiledTransactionDecoder() {
2143
+ return getStructDecoder([
2144
+ [
2145
+ "signatures",
2146
+ getArrayDecoder(getBytesDecoder({ size: 64 }), {
2147
+ size: getShortU16Decoder()
2148
+ })
2149
+ ],
2150
+ ["compiledMessage", getCompiledMessageDecoder()]
2151
+ ]);
2152
+ }
2153
+ function getTransactionEncoder() {
2154
+ return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
1912
2155
  }
2156
+ function getTransactionDecoder(lastValidBlockHeight) {
2157
+ return mapDecoder(
2158
+ getCompiledTransactionDecoder(),
2159
+ (compiledTransaction) => decompileTransaction(compiledTransaction, lastValidBlockHeight)
2160
+ );
2161
+ }
2162
+ function getTransactionCodec(lastValidBlockHeight) {
2163
+ return combineCodec(getTransactionEncoder(), getTransactionDecoder(lastValidBlockHeight));
2164
+ }
2165
+ var base58Decoder;
1913
2166
  function getSignatureFromTransaction(transaction) {
2167
+ if (!base58Decoder)
2168
+ base58Decoder = getBase58Decoder();
1914
2169
  const signatureBytes = transaction.signatures[transaction.feePayer];
1915
2170
  if (!signatureBytes) {
1916
2171
  throw new Error(
1917
2172
  "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
1918
2173
  );
1919
2174
  }
1920
- const transactionSignature2 = base58.deserialize(signatureBytes)[0];
1921
- return transactionSignature2;
2175
+ const transactionSignature = base58Decoder.decode(signatureBytes);
2176
+ return transactionSignature;
1922
2177
  }
1923
- async function signTransaction(keyPairs, transaction) {
2178
+ async function partiallySignTransaction(keyPairs, transaction) {
1924
2179
  const compiledMessage = compileMessage(transaction);
1925
2180
  const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
2181
+ const wireMessageBytes = getCompiledMessageEncoder().encode(compiledMessage);
1926
2182
  const publicKeySignaturePairs = await Promise.all(
1927
2183
  keyPairs.map(
1928
- (keyPair) => Promise.all([
1929
- getAddressFromPublicKey(keyPair.publicKey),
1930
- getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
1931
- ])
2184
+ (keyPair) => Promise.all([getAddressFromPublicKey(keyPair.publicKey), signBytes(keyPair.privateKey, wireMessageBytes)])
1932
2185
  )
1933
2186
  );
1934
- for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
1935
- nextSignatures[signerPublicKey] = signature;
2187
+ for (const [signerPublicKey, signature2] of publicKeySignaturePairs) {
2188
+ nextSignatures[signerPublicKey] = signature2;
1936
2189
  }
1937
2190
  const out = {
1938
2191
  ...transaction,
@@ -1941,15 +2194,27 @@ this.globalThis.solanaWeb3 = (function (exports) {
1941
2194
  Object.freeze(out);
1942
2195
  return out;
1943
2196
  }
1944
- function transactionSignature(putativeTransactionSignature) {
1945
- assertIsTransactionSignature(putativeTransactionSignature);
1946
- return putativeTransactionSignature;
2197
+ async function signTransaction(keyPairs, transaction) {
2198
+ const out = await partiallySignTransaction(keyPairs, transaction);
2199
+ assertTransactionIsFullySigned(out);
2200
+ Object.freeze(out);
2201
+ return out;
2202
+ }
2203
+ function assertTransactionIsFullySigned(transaction) {
2204
+ const signerAddressesFromInstructions = transaction.instructions.flatMap((i) => {
2205
+ var _a, _b;
2206
+ return (_b = (_a = i.accounts) == null ? void 0 : _a.filter((a) => isSignerRole2(a.role))) != null ? _b : [];
2207
+ }).map((a) => a.address);
2208
+ const requiredSigners = /* @__PURE__ */ new Set([transaction.feePayer, ...signerAddressesFromInstructions]);
2209
+ requiredSigners.forEach((address2) => {
2210
+ if (!transaction.signatures[address2]) {
2211
+ throw new Error(`Transaction is missing signature for address \`${address2}\``);
2212
+ }
2213
+ });
1947
2214
  }
1948
2215
  function getBase64EncodedWireTransaction(transaction) {
1949
2216
  const wireTransactionBytes = getTransactionEncoder().encode(transaction);
1950
- {
1951
- return btoa(String.fromCharCode(...wireTransactionBytes));
1952
- }
2217
+ return getBase64Decoder().decode(wireTransactionBytes);
1953
2218
  }
1954
2219
 
1955
2220
  // src/airdrop.ts
@@ -1960,9 +2225,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
1960
2225
 
1961
2226
  // src/transaction-confirmation-strategy-racer.ts
1962
2227
  init_env_shim();
1963
- async function raceStrategies(signature, config, getSpecificStrategiesForRace) {
2228
+ async function raceStrategies(signature2, config, getSpecificStrategiesForRace) {
1964
2229
  const { abortSignal: callerAbortSignal, commitment, getRecentSignatureConfirmationPromise } = config;
1965
- callerAbortSignal?.throwIfAborted();
2230
+ callerAbortSignal == null ? void 0 : callerAbortSignal.throwIfAborted();
1966
2231
  const abortController = new AbortController();
1967
2232
  if (callerAbortSignal) {
1968
2233
  const handleAbort = () => {
@@ -1979,7 +2244,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1979
2244
  getRecentSignatureConfirmationPromise({
1980
2245
  abortSignal: abortController.signal,
1981
2246
  commitment,
1982
- signature
2247
+ signature: signature2
1983
2248
  }),
1984
2249
  ...specificStrategies
1985
2250
  ]);
@@ -1994,18 +2259,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
1994
2259
  return async function getRecentSignatureConfirmationPromise({
1995
2260
  abortSignal: callerAbortSignal,
1996
2261
  commitment,
1997
- signature
2262
+ signature: signature2
1998
2263
  }) {
1999
2264
  const abortController = new AbortController();
2000
2265
  function handleAbort() {
2001
2266
  abortController.abort();
2002
2267
  }
2003
2268
  callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
2004
- const signatureStatusNotifications = await rpcSubscriptions.signatureNotifications(signature, { commitment }).subscribe({ abortSignal: abortController.signal });
2269
+ const signatureStatusNotifications = await rpcSubscriptions.signatureNotifications(signature2, { commitment }).subscribe({ abortSignal: abortController.signal });
2005
2270
  const signatureDidCommitPromise = (async () => {
2006
2271
  for await (const signatureStatusNotification of signatureStatusNotifications) {
2007
2272
  if (signatureStatusNotification.value.err) {
2008
- throw new Error(`The transaction with signature \`${signature}\` failed.`, {
2273
+ throw new Error(`The transaction with signature \`${signature2}\` failed.`, {
2009
2274
  cause: signatureStatusNotification.value.err
2010
2275
  });
2011
2276
  } else {
@@ -2014,7 +2279,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
2014
2279
  }
2015
2280
  })();
2016
2281
  const signatureStatusLookupPromise = (async () => {
2017
- const { value: signatureStatusResults } = await rpc.getSignatureStatuses([signature]).send({ abortSignal: abortController.signal });
2282
+ const { value: signatureStatusResults } = await rpc.getSignatureStatuses([signature2]).send({ abortSignal: abortController.signal });
2018
2283
  const signatureStatus = signatureStatusResults[0];
2019
2284
  if (signatureStatus && signatureStatus.confirmationStatus && commitmentComparator(signatureStatus.confirmationStatus, commitment) >= 0) {
2020
2285
  return;
@@ -2121,12 +2386,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
2121
2386
  // src/rpc.ts
2122
2387
  init_env_shim();
2123
2388
 
2124
- // ../functional/dist/index.browser.js
2125
- init_env_shim();
2126
- function pipe(init, ...fns) {
2127
- return fns.reduce((acc, fn) => fn(acc), init);
2128
- }
2129
-
2130
2389
  // ../rpc-core/dist/index.browser.js
2131
2390
  init_env_shim();
2132
2391
  function visitNode(value, keyPath, onIntegerOverflow) {
@@ -2569,11 +2828,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
2569
2828
  }
2570
2829
  function patchResponseForSolanaLabsRpc(rawResponse, methodName) {
2571
2830
  const allowedKeypaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0;
2572
- return visitNode2(rawResponse, allowedKeypaths ?? []);
2831
+ return visitNode2(rawResponse, allowedKeypaths != null ? allowedKeypaths : []);
2573
2832
  }
2574
2833
  function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, methodName) {
2575
2834
  const allowedKeypaths = methodName ? getAllowedNumericKeypathsForNotification()[methodName] : void 0;
2576
- return visitNode2(rawResponse, allowedKeypaths ?? []);
2835
+ return visitNode2(rawResponse, allowedKeypaths != null ? allowedKeypaths : []);
2577
2836
  }
2578
2837
  function createSolanaRpcApi(config) {
2579
2838
  return new Proxy({}, {
@@ -2587,7 +2846,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
2587
2846
  const [_, p] = args;
2588
2847
  const methodName = p.toString();
2589
2848
  return function(...rawParams) {
2590
- const handleIntegerOverflow = config?.onIntegerOverflow;
2849
+ const handleIntegerOverflow = config == null ? void 0 : config.onIntegerOverflow;
2591
2850
  const params = patchParamsForSolanaLabsRpc(
2592
2851
  rawParams,
2593
2852
  handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(methodName, keyPath, value) : void 0
@@ -2613,7 +2872,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
2613
2872
  const [_, p] = args;
2614
2873
  const notificationName = p.toString();
2615
2874
  return function(...rawParams) {
2616
- const handleIntegerOverflow = config?.onIntegerOverflow;
2875
+ const handleIntegerOverflow = config == null ? void 0 : config.onIntegerOverflow;
2617
2876
  const params = patchParamsForSolanaLabsRpc(
2618
2877
  rawParams,
2619
2878
  handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(notificationName, keyPath, value) : void 0
@@ -2637,6 +2896,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
2637
2896
  var SolanaJsonRpcError = class extends Error {
2638
2897
  constructor(details) {
2639
2898
  super(`JSON-RPC 2.0 error (${details.code}): ${details.message}`);
2899
+ __publicField(this, "code");
2900
+ __publicField(this, "data");
2640
2901
  Error.captureStackTrace(this, this.constructor);
2641
2902
  this.code = details.code;
2642
2903
  this.data = details.data;
@@ -2666,7 +2927,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
2666
2927
  const payload = createJsonRpcMessage(methodName, params);
2667
2928
  const response = await rpcConfig.transport({
2668
2929
  payload,
2669
- signal: options?.abortSignal
2930
+ signal: options == null ? void 0 : options.abortSignal
2670
2931
  });
2671
2932
  if ("error" in response) {
2672
2933
  throw new SolanaJsonRpcError(response.error);
@@ -2795,6 +3056,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
2795
3056
  var SolanaHttpError = class extends Error {
2796
3057
  constructor(details) {
2797
3058
  super(`HTTP error (${details.statusCode}): ${details.message}`);
3059
+ __publicField(this, "statusCode");
2798
3060
  Error.captureStackTrace(this, this.constructor);
2799
3061
  this.statusCode = details.statusCode;
2800
3062
  }
@@ -2850,16 +3112,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
2850
3112
  }
2851
3113
  return out;
2852
3114
  }
2853
- function createHttpTransport({ httpAgentNodeOnly, headers, url }) {
3115
+ function createHttpTransport({ headers, url }) {
2854
3116
  if (headers) {
2855
3117
  assertIsAllowedHttpRequestHeaders(headers);
2856
3118
  }
2857
- const agent = void 0;
2858
- if (httpAgentNodeOnly != null) {
2859
- console.warn(
2860
- "createHttpTransport(): The `httpAgentNodeOnly` config you supplied has been ignored; HTTP agents are only usable in Node environments."
2861
- );
2862
- }
2863
3119
  const customHeaders = headers && normalizeHeaders(headers);
2864
3120
  return async function makeHttpRequest({
2865
3121
  payload,
@@ -2867,7 +3123,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
2867
3123
  }) {
2868
3124
  const body = JSON.stringify(payload);
2869
3125
  const requestInfo = {
2870
- agent,
2871
3126
  body,
2872
3127
  headers: {
2873
3128
  ...customHeaders,
@@ -2891,7 +3146,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
2891
3146
  }
2892
3147
  var e22 = globalThis.WebSocket;
2893
3148
  var EXPLICIT_ABORT_TOKEN = Symbol(
2894
- "This symbol is thrown from a socket's iterator when the connection is explicity aborted by the user"
3149
+ "This symbol is thrown from a socket's iterator when the connection is explicitly aborted by the user"
2895
3150
  );
2896
3151
  async function createWebSocketConnection({
2897
3152
  sendBufferHighWatermark,
@@ -2918,7 +3173,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
2918
3173
  }
2919
3174
  }
2920
3175
  function handleClose(ev) {
2921
- bufferDrainWatcher?.onCancel();
3176
+ bufferDrainWatcher == null ? void 0 : bufferDrainWatcher.onCancel();
2922
3177
  signal.removeEventListener("abort", handleAbort);
2923
3178
  webSocket.removeEventListener("close", handleClose);
2924
3179
  webSocket.removeEventListener("error", handleError);
@@ -3041,13 +3296,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
3041
3296
  );
3042
3297
  }
3043
3298
  return async function sendWebSocketMessage({ payload, signal }) {
3044
- signal?.throwIfAborted();
3299
+ signal == null ? void 0 : signal.throwIfAborted();
3045
3300
  const connection = await createWebSocketConnection({
3046
3301
  sendBufferHighWatermark,
3047
3302
  signal,
3048
3303
  url
3049
3304
  });
3050
- signal?.throwIfAborted();
3305
+ signal == null ? void 0 : signal.throwIfAborted();
3051
3306
  await connection.send(payload);
3052
3307
  return {
3053
3308
  [Symbol.asyncIterator]: connection[Symbol.asyncIterator].bind(connection),
@@ -3083,6 +3338,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
3083
3338
  super(
3084
3339
  `The ${ordinal} argument to the \`${methodName}\` RPC method${path ? ` at path \`${path}\`` : ""} was \`${value}\`. This number is unsafe for use with the Solana JSON-RPC because it exceeds \`Number.MAX_SAFE_INTEGER\`.`
3085
3340
  );
3341
+ __publicField(this, "methodName");
3342
+ __publicField(this, "keyPath");
3343
+ __publicField(this, "value");
3086
3344
  this.keyPath = keyPath;
3087
3345
  this.methodName = methodName;
3088
3346
  this.value = value;
@@ -3229,7 +3487,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3229
3487
  getAbortSignalFromInputArgs: ({ abortSignal }) => abortSignal,
3230
3488
  getCacheEntryMissingError(deduplicationKey2) {
3231
3489
  return new Error(
3232
- `Found no cache entry for subscription with deduplication key \`${deduplicationKey2?.toString()}\``
3490
+ `Found no cache entry for subscription with deduplication key \`${deduplicationKey2 == null ? void 0 : deduplicationKey2.toString()}\``
3233
3491
  );
3234
3492
  },
3235
3493
  getCacheKeyFromInputArgs: () => deduplicationKey,
@@ -3394,6 +3652,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3394
3652
  return out;
3395
3653
  }
3396
3654
  function createDefaultRpcTransport(config) {
3655
+ var _a;
3397
3656
  return pipe(
3398
3657
  createHttpTransport({
3399
3658
  ...config,
@@ -3401,7 +3660,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3401
3660
  ...config.headers ? normalizeHeaders2(config.headers) : void 0,
3402
3661
  ...{
3403
3662
  // Keep these headers lowercase so they will override any user-supplied headers above.
3404
- "solana-client": `js/${"2.0.0-development"}` ?? "UNKNOWN"
3663
+ "solana-client": (_a = `js/${"2.0.0-development"}`) != null ? _a : "UNKNOWN"
3405
3664
  }
3406
3665
  }
3407
3666
  }),
@@ -3485,7 +3744,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3485
3744
  return getCachedAbortableIterableFactory({
3486
3745
  getAbortSignalFromInputArgs: ({ signal }) => signal,
3487
3746
  getCacheEntryMissingError(shardKey) {
3488
- return new Error(`Found no cache entry for connection with shard key \`${shardKey?.toString()}\``);
3747
+ return new Error(`Found no cache entry for connection with shard key \`${shardKey == null ? void 0 : shardKey.toString()}\``);
3489
3748
  },
3490
3749
  getCacheKeyFromInputArgs: ({ payload }) => getShard ? getShard(payload) : NULL_SHARD_CACHE_KEY,
3491
3750
  onCacheHit: (connection, { payload }) => connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(payload),
@@ -3498,15 +3757,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
3498
3757
 
3499
3758
  // src/rpc-websocket-transport.ts
3500
3759
  function createDefaultRpcSubscriptionsTransport(config) {
3760
+ var _a;
3501
3761
  const { getShard, intervalMs, ...rest } = config;
3502
3762
  return pipe(
3503
3763
  createWebSocketTransport({
3504
3764
  ...rest,
3505
- sendBufferHighWatermark: config.sendBufferHighWatermark ?? // Let 128KB of data into the WebSocket buffer before buffering it in the app.
3506
- 131072
3765
+ sendBufferHighWatermark: (_a = config.sendBufferHighWatermark) != null ? _a : (
3766
+ // Let 128KB of data into the WebSocket buffer before buffering it in the app.
3767
+ 131072
3768
+ )
3507
3769
  }),
3508
3770
  (transport) => getWebSocketTransportWithAutoping({
3509
- intervalMs: intervalMs ?? 5e3,
3771
+ intervalMs: intervalMs != null ? intervalMs : 5e3,
3510
3772
  transport
3511
3773
  }),
3512
3774
  (transport) => getWebSocketTransportWithConnectionSharding({
@@ -3564,10 +3826,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
3564
3826
  }
3565
3827
  callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
3566
3828
  const accountNotifications = await rpcSubscriptions.accountNotifications(nonceAccountAddress, { commitment, encoding: "base64" }).subscribe({ abortSignal: abortController.signal });
3829
+ const base58Decoder2 = getBase58Decoder();
3830
+ const base64Encoder = getBase64Encoder();
3567
3831
  function getNonceFromAccountData([base64EncodedBytes]) {
3568
- const data = base64.serialize(base64EncodedBytes);
3832
+ const data = base64Encoder.encode(base64EncodedBytes);
3569
3833
  const nonceValueBytes = data.slice(NONCE_VALUE_OFFSET, NONCE_VALUE_OFFSET + 32);
3570
- return base58.deserialize(nonceValueBytes)[0];
3834
+ return base58Decoder2.decode(nonceValueBytes);
3571
3835
  }
3572
3836
  const nonceAccountDidAdvancePromise = (async () => {
3573
3837
  for await (const accountNotification of accountNotifications) {
@@ -3680,7 +3944,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3680
3944
  function getSendTransactionConfigWithAdjustedPreflightCommitment(commitment, config) {
3681
3945
  if (
3682
3946
  // The developer has supplied no value for `preflightCommitment`.
3683
- !config?.preflightCommitment && // The value of `commitment` is lower than the server default of `preflightCommitment`.
3947
+ !(config == null ? void 0 : config.preflightCommitment) && // The value of `commitment` is lower than the server default of `preflightCommitment`.
3684
3948
  commitmentComparator(
3685
3949
  commitment,
3686
3950
  "finalized"
@@ -3753,7 +4017,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3753
4017
  transaction,
3754
4018
  ...sendTransactionConfig
3755
4019
  }) {
3756
- const transactionSignature2 = await sendTransaction_INTERNAL({
4020
+ const transactionSignature = await sendTransaction_INTERNAL({
3757
4021
  ...sendTransactionConfig,
3758
4022
  abortSignal,
3759
4023
  commitment,
@@ -3765,7 +4029,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3765
4029
  commitment,
3766
4030
  transaction
3767
4031
  });
3768
- return transactionSignature2;
4032
+ return transactionSignature;
3769
4033
  }
3770
4034
  async function sendAndConfirmTransaction({
3771
4035
  abortSignal,
@@ -3775,7 +4039,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3775
4039
  transaction,
3776
4040
  ...sendTransactionConfig
3777
4041
  }) {
3778
- const transactionSignature2 = await sendTransaction_INTERNAL({
4042
+ const transactionSignature = await sendTransaction_INTERNAL({
3779
4043
  ...sendTransactionConfig,
3780
4044
  abortSignal,
3781
4045
  commitment,
@@ -3787,7 +4051,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3787
4051
  commitment,
3788
4052
  transaction
3789
4053
  });
3790
- return transactionSignature2;
4054
+ return transactionSignature;
3791
4055
  }
3792
4056
 
3793
4057
  exports.AccountRole = AccountRole;
@@ -3798,11 +4062,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
3798
4062
  exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
3799
4063
  exports.assertIsLamports = assertIsLamports;
3800
4064
  exports.assertIsProgramDerivedAddress = assertIsProgramDerivedAddress;
4065
+ exports.assertIsSignature = assertIsSignature;
3801
4066
  exports.assertIsStringifiedBigInt = assertIsStringifiedBigInt;
3802
4067
  exports.assertIsStringifiedNumber = assertIsStringifiedNumber;
3803
- exports.assertIsTransactionSignature = assertIsTransactionSignature;
4068
+ exports.assertIsTransactionWithBlockhashLifetime = assertIsTransactionWithBlockhashLifetime;
3804
4069
  exports.assertIsUnixTimestamp = assertIsUnixTimestamp;
4070
+ exports.assertTransactionIsFullySigned = assertTransactionIsFullySigned;
3805
4071
  exports.commitmentComparator = commitmentComparator;
4072
+ exports.compileMessage = compileMessage;
3806
4073
  exports.createAddressWithSeed = createAddressWithSeed;
3807
4074
  exports.createBlockHeightExceedencePromiseFactory = createBlockHeightExceedencePromiseFactory;
3808
4075
  exports.createDefaultAirdropRequester = createDefaultAirdropRequester;
@@ -3813,6 +4080,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3813
4080
  exports.createDefaultRpcTransport = createDefaultRpcTransport;
3814
4081
  exports.createDefaultTransactionSender = createDefaultTransactionSender;
3815
4082
  exports.createNonceInvalidationPromiseFactory = createNonceInvalidationPromiseFactory;
4083
+ exports.createPrivateKeyFromBytes = createPrivateKeyFromBytes;
3816
4084
  exports.createRecentSignatureConfirmationPromiseFactory = createRecentSignatureConfirmationPromiseFactory;
3817
4085
  exports.createSolanaRpc = createSolanaRpc;
3818
4086
  exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
@@ -3827,21 +4095,27 @@ this.globalThis.solanaWeb3 = (function (exports) {
3827
4095
  exports.getAddressEncoder = getAddressEncoder;
3828
4096
  exports.getAddressFromPublicKey = getAddressFromPublicKey;
3829
4097
  exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
4098
+ exports.getCompiledMessageCodec = getCompiledMessageCodec;
4099
+ exports.getCompiledMessageDecoder = getCompiledMessageDecoder;
4100
+ exports.getCompiledMessageEncoder = getCompiledMessageEncoder;
3830
4101
  exports.getProgramDerivedAddress = getProgramDerivedAddress;
3831
4102
  exports.getSignatureFromTransaction = getSignatureFromTransaction;
4103
+ exports.getTransactionCodec = getTransactionCodec;
4104
+ exports.getTransactionDecoder = getTransactionDecoder;
3832
4105
  exports.getTransactionEncoder = getTransactionEncoder;
3833
4106
  exports.isAddress = isAddress;
3834
4107
  exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
3835
4108
  exports.isLamports = isLamports;
3836
4109
  exports.isProgramDerivedAddress = isProgramDerivedAddress;
4110
+ exports.isSignature = isSignature;
3837
4111
  exports.isSignerRole = isSignerRole;
3838
4112
  exports.isStringifiedBigInt = isStringifiedBigInt;
3839
4113
  exports.isStringifiedNumber = isStringifiedNumber;
3840
- exports.isTransactionSignature = isTransactionSignature;
3841
4114
  exports.isUnixTimestamp = isUnixTimestamp;
3842
4115
  exports.isWritableRole = isWritableRole;
3843
4116
  exports.lamports = lamports;
3844
4117
  exports.mergeRoles = mergeRoles;
4118
+ exports.partiallySignTransaction = partiallySignTransaction;
3845
4119
  exports.prependTransactionInstruction = prependTransactionInstruction;
3846
4120
  exports.requestAndConfirmAirdrop = requestAndConfirmAirdrop;
3847
4121
  exports.sendAndConfirmDurableNonceTransaction = sendAndConfirmDurableNonceTransaction;
@@ -3851,9 +4125,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
3851
4125
  exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
3852
4126
  exports.signBytes = signBytes;
3853
4127
  exports.signTransaction = signTransaction;
4128
+ exports.signature = signature;
3854
4129
  exports.stringifiedBigInt = stringifiedBigInt;
3855
4130
  exports.stringifiedNumber = stringifiedNumber;
3856
- exports.transactionSignature = transactionSignature;
3857
4131
  exports.unixTimestamp = unixTimestamp;
3858
4132
  exports.upgradeRoleToSigner = upgradeRoleToSigner;
3859
4133
  exports.upgradeRoleToWritable = upgradeRoleToWritable;