@solana/kit 5.0.1-canary-20251119203851 → 5.1.0-canary-20251204140906

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.
@@ -142,6 +142,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
142
142
  var SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS = 5508009;
143
143
  var SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING = 5508010;
144
144
  var SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED = 5508011;
145
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED = 5607e3;
146
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE = 5607001;
147
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE = 5607002;
148
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH = 5607003;
149
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH = 5607004;
150
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO = 5607005;
151
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED = 5607006;
152
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH = 5607007;
153
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH = 5607008;
154
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY = 5607009;
155
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO = 5607010;
156
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING = 5607011;
157
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH = 5607012;
158
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE = 5607013;
159
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION = 5607014;
160
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED = 5607015;
161
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE = 5607016;
162
+ var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE = 5607017;
145
163
  var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663e3;
146
164
  var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663001;
147
165
  var SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME = 5663002;
@@ -396,6 +414,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
396
414
  [SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR]: "$message",
397
415
  [SOLANA_ERROR__MALFORMED_NUMBER_STRING]: "`$value` cannot be parsed as a `Number`",
398
416
  [SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
417
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH]: "Expected base58 encoded application domain to decode to a byte array of length 32. Actual length: $actualLength.",
418
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE]: "Attempted to sign an offchain message with an address that is not a signer for it",
419
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded application domain string of length in the range [32, 44]. Actual length: $actualLength.",
420
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH]: "The signer addresses in this offchain message envelope do not match the list of required signers in the message preamble. These unexpected signers were present in the envelope: `[$unexpectedSigners]`. These required signers were missing from the envelope `[$missingSigners]`.",
421
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED]: "The message body provided has a byte-length of $actualBytes. The maximum allowable byte-length is $maxBytes",
422
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH]: "Expected message format $expectedMessageFormat, got $actualMessageFormat",
423
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH]: "The message length specified in the message preamble is $specifiedLength bytes. The actual length of the message is $actualLength bytes.",
424
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY]: "Offchain message content must be non-empty",
425
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO]: "Offchain message must specify the address of at least one required signer",
426
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO]: "Offchain message envelope must reserve space for at least one signature",
427
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH]: "The offchain message preamble specifies $numRequiredSignatures required signature(s), got $signaturesLength.",
428
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED]: "The signatories of this offchain message must be listed in lexicographical order",
429
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE]: "An address must be listed no more than once among the signatories of an offchain message",
430
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING]: "Offchain message is missing signatures for addresses: $addresses.",
431
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE]: "Offchain message signature verification failed. Signature mismatch for required signatories [$signatoriesWithInvalidSignatures]. Missing signatures for signatories [$signatoriesWithMissingSignatures]",
432
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE]: "The message body provided contains characters whose codes fall outside the allowed range. In order to ensure clear-signing compatiblity with hardware wallets, the message may only contain line feeds and characters in the range [\\x20-\\x7e].",
433
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION]: "Expected offchain message version $expectedVersion. Got $actualVersion.",
434
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED]: "This version of Kit does not support decoding offchain messages with version $unsupportedVersion. The current max supported version is 0.",
399
435
  [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN]: "The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",
400
436
  [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED]: "WebSocket was closed before payload could be added to the send buffer",
401
437
  [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED]: "WebSocket connection closed",
@@ -883,8 +919,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
883
919
  var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
884
920
  function containsBytes(data, bytes, offset) {
885
921
  const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);
886
- if (slice.length !== bytes.length) return false;
887
- return bytes.every((b, i) => b === slice[i]);
922
+ return bytesEqual(slice, bytes);
923
+ }
924
+ function bytesEqual(bytes1, bytes2) {
925
+ return bytes1.length === bytes2.length && bytes1.every((value, index) => value === bytes2[index]);
888
926
  }
889
927
  function getEncodedSize(value, encoder) {
890
928
  return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
@@ -958,7 +996,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
958
996
  };
959
997
  }
960
998
  function addEncoderSentinel(encoder, sentinel) {
961
- const write = (value, bytes, offset) => {
999
+ const write = ((value, bytes, offset) => {
962
1000
  const encoderBytes = encoder.encode(value);
963
1001
  if (findSentinelIndex(encoderBytes, sentinel) >= 0) {
964
1002
  throw new SolanaError(SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL, {
@@ -973,7 +1011,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
973
1011
  bytes.set(sentinel, offset);
974
1012
  offset += sentinel.length;
975
1013
  return offset;
976
- };
1014
+ });
977
1015
  if (isFixedSize(encoder)) {
978
1016
  return createEncoder({ ...encoder, fixedSize: encoder.fixedSize + sentinel.length, write });
979
1017
  }
@@ -985,7 +1023,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
985
1023
  });
986
1024
  }
987
1025
  function addDecoderSentinel(decoder, sentinel) {
988
- const read = (bytes, offset) => {
1026
+ const read = ((bytes, offset) => {
989
1027
  const candidateBytes = offset === 0 ? bytes : bytes.slice(offset);
990
1028
  const sentinelIndex = findSentinelIndex(candidateBytes, sentinel);
991
1029
  if (sentinelIndex === -1) {
@@ -998,7 +1036,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
998
1036
  }
999
1037
  const preSentinelBytes = candidateBytes.slice(0, sentinelIndex);
1000
1038
  return [decoder.decode(preSentinelBytes), offset + preSentinelBytes.length + sentinel.length];
1001
- };
1039
+ });
1002
1040
  if (isFixedSize(decoder)) {
1003
1041
  return createDecoder({ ...decoder, fixedSize: decoder.fixedSize + sentinel.length, read });
1004
1042
  }
@@ -1048,12 +1086,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
1048
1086
  }
1049
1087
  function addEncoderSizePrefix(encoder, prefix) {
1050
1088
  var _a, _b;
1051
- const write = (value, bytes, offset) => {
1089
+ const write = ((value, bytes, offset) => {
1052
1090
  const encoderBytes = encoder.encode(value);
1053
1091
  offset = prefix.write(encoderBytes.length, bytes, offset);
1054
1092
  bytes.set(encoderBytes, offset);
1055
1093
  return offset + encoderBytes.length;
1056
- };
1094
+ });
1057
1095
  if (isFixedSize(prefix) && isFixedSize(encoder)) {
1058
1096
  return createEncoder({ ...encoder, fixedSize: prefix.fixedSize + encoder.fixedSize, write });
1059
1097
  }
@@ -1072,7 +1110,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1072
1110
  }
1073
1111
  function addDecoderSizePrefix(decoder, prefix) {
1074
1112
  var _a, _b;
1075
- const read = (bytes, offset) => {
1113
+ const read = ((bytes, offset) => {
1076
1114
  const [bigintSize, decoderOffset] = prefix.read(bytes, offset);
1077
1115
  const size = Number(bigintSize);
1078
1116
  offset = decoderOffset;
@@ -1081,7 +1119,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1081
1119
  }
1082
1120
  assertByteArrayHasEnoughBytesForCodec("addDecoderSizePrefix", size, bytes);
1083
1121
  return [decoder.decode(bytes), offset + size];
1084
- };
1122
+ });
1085
1123
  if (isFixedSize(prefix) && isFixedSize(decoder)) {
1086
1124
  return createDecoder({ ...decoder, fixedSize: prefix.fixedSize + decoder.fixedSize, read });
1087
1125
  }
@@ -1994,7 +2032,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1994
2032
  });
1995
2033
  }
1996
2034
  const programAddressBytes = encode(programAddress);
1997
- if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
2035
+ if (programAddressBytes.length >= PDA_MARKER_BYTES.length && bytesEqual(programAddressBytes.slice(-PDA_MARKER_BYTES.length), new Uint8Array(PDA_MARKER_BYTES))) {
1998
2036
  throw new SolanaError(SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER);
1999
2037
  }
2000
2038
  const addressBytesBuffer = await crypto.subtle.digest(
@@ -3132,10 +3170,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
3132
3170
  var IS_SIGNER_BITMASK = 2;
3133
3171
  var IS_WRITABLE_BITMASK = 1;
3134
3172
  function downgradeRoleToNonSigner(role) {
3135
- return role & -3;
3173
+ return role & ~IS_SIGNER_BITMASK;
3136
3174
  }
3137
3175
  function downgradeRoleToReadonly(role) {
3138
- return role & -2;
3176
+ return role & ~IS_WRITABLE_BITMASK;
3139
3177
  }
3140
3178
  function isSignerRole(role) {
3141
3179
  return role >= 2;
@@ -4589,9 +4627,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
4589
4627
  const transactionSignature = base58Decoder.decode(signatureBytes2);
4590
4628
  return transactionSignature;
4591
4629
  }
4592
- function uint8ArraysEqual(arr1, arr2) {
4593
- return arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);
4594
- }
4595
4630
  async function partiallySignTransaction(keyPairs, transaction) {
4596
4631
  let newSignatures;
4597
4632
  let unexpectedSigners;
@@ -4608,7 +4643,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
4608
4643
  return;
4609
4644
  }
4610
4645
  const newSignature = await signBytes(keyPair.privateKey, transaction.messageBytes);
4611
- if (existingSignature !== null && uint8ArraysEqual(newSignature, existingSignature)) {
4646
+ if (existingSignature !== null && bytesEqual(newSignature, existingSignature)) {
4612
4647
  return;
4613
4648
  }
4614
4649
  newSignatures || (newSignatures = {});
@@ -4901,7 +4936,19 @@ this.globalThis.solanaWeb3 = (function (exports) {
4901
4936
  return Object.freeze({
4902
4937
  kind: "single",
4903
4938
  message: transactionMessage,
4904
- status: Object.freeze({ context: context != null ? context : {}, kind: "successful", transaction })
4939
+ status: Object.freeze({
4940
+ context: context != null ? context : {},
4941
+ kind: "successful",
4942
+ signature: getSignatureFromTransaction(transaction),
4943
+ transaction
4944
+ })
4945
+ });
4946
+ }
4947
+ function successfulSingleTransactionPlanResultFromSignature(transactionMessage, signature2, context) {
4948
+ return Object.freeze({
4949
+ kind: "single",
4950
+ message: transactionMessage,
4951
+ status: Object.freeze({ context: context != null ? context : {}, kind: "successful", signature: signature2 })
4905
4952
  });
4906
4953
  }
4907
4954
  function failedSingleTransactionPlanResult(transactionMessage, error) {
@@ -4918,6 +4965,48 @@ this.globalThis.solanaWeb3 = (function (exports) {
4918
4965
  status: Object.freeze({ kind: "canceled" })
4919
4966
  });
4920
4967
  }
4968
+ function flattenTransactionPlanResult(result) {
4969
+ const transactionPlanResults = [];
4970
+ function traverse3(result2) {
4971
+ if (result2.kind === "single") {
4972
+ transactionPlanResults.push(result2);
4973
+ } else {
4974
+ for (const subResult of result2.plans) {
4975
+ traverse3(subResult);
4976
+ }
4977
+ }
4978
+ }
4979
+ traverse3(result);
4980
+ return transactionPlanResults;
4981
+ }
4982
+ function summarizeTransactionPlanResult(result) {
4983
+ const successfulTransactions = [];
4984
+ const failedTransactions = [];
4985
+ const canceledTransactions = [];
4986
+ const flattenedResults = flattenTransactionPlanResult(result);
4987
+ for (const singleResult of flattenedResults) {
4988
+ switch (singleResult.status.kind) {
4989
+ case "successful": {
4990
+ successfulTransactions.push(singleResult);
4991
+ break;
4992
+ }
4993
+ case "failed": {
4994
+ failedTransactions.push(singleResult);
4995
+ break;
4996
+ }
4997
+ case "canceled": {
4998
+ canceledTransactions.push(singleResult);
4999
+ break;
5000
+ }
5001
+ }
5002
+ }
5003
+ return Object.freeze({
5004
+ canceledTransactions,
5005
+ failedTransactions,
5006
+ successful: failedTransactions.length === 0 && canceledTransactions.length === 0,
5007
+ successfulTransactions
5008
+ });
5009
+ }
4921
5010
  function createTransactionPlanExecutor(config) {
4922
5011
  return async (plan, { abortSignal } = {}) => {
4923
5012
  var _a, _b;
@@ -4980,7 +5069,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
4980
5069
  context.executeTransactionMessage(transactionPlan.message, { abortSignal: context.abortSignal }),
4981
5070
  context.abortSignal
4982
5071
  );
4983
- return successfulSingleTransactionPlanResult(transactionPlan.message, result.transaction, result.context);
5072
+ if ("transaction" in result) {
5073
+ return successfulSingleTransactionPlanResult(transactionPlan.message, result.transaction, result.context);
5074
+ } else {
5075
+ return successfulSingleTransactionPlanResultFromSignature(
5076
+ transactionPlan.message,
5077
+ result.signature,
5078
+ result.context
5079
+ );
5080
+ }
4984
5081
  } catch (error) {
4985
5082
  context.canceled = true;
4986
5083
  return failedSingleTransactionPlanResult(transactionPlan.message, error);
@@ -5024,7 +5121,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
5024
5121
  const plan = await traverse2(instructionPlan, {
5025
5122
  abortSignal,
5026
5123
  createTransactionMessage: config.createTransactionMessage,
5027
- onTransactionMessageUpdated: (_a = config.onTransactionMessageUpdated) != null ? _a : (msg) => msg,
5124
+ onTransactionMessageUpdated: (_a = config.onTransactionMessageUpdated) != null ? _a : ((msg) => msg),
5028
5125
  parent: null,
5029
5126
  parentCandidates: []
5030
5127
  });
@@ -5256,6 +5353,764 @@ this.globalThis.solanaWeb3 = (function (exports) {
5256
5353
  }
5257
5354
  }
5258
5355
 
5356
+ // ../offchain-messages/dist/index.browser.mjs
5357
+ function isOffchainMessageApplicationDomain(putativeApplicationDomain) {
5358
+ return isAddress(putativeApplicationDomain);
5359
+ }
5360
+ function assertIsOffchainMessageApplicationDomain(putativeApplicationDomain) {
5361
+ try {
5362
+ assertIsAddress(putativeApplicationDomain);
5363
+ } catch (error) {
5364
+ if (isSolanaError(error, SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE)) {
5365
+ throw new SolanaError(
5366
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE,
5367
+ error.context
5368
+ );
5369
+ }
5370
+ if (isSolanaError(error, SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH)) {
5371
+ throw new SolanaError(
5372
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH,
5373
+ error.context
5374
+ );
5375
+ }
5376
+ throw error;
5377
+ }
5378
+ }
5379
+ function offchainMessageApplicationDomain(putativeApplicationDomain) {
5380
+ assertIsOffchainMessageApplicationDomain(putativeApplicationDomain);
5381
+ return putativeApplicationDomain;
5382
+ }
5383
+ function getOffchainMessageApplicationDomainEncoder() {
5384
+ return transformEncoder(
5385
+ getAddressEncoder(),
5386
+ (putativeApplicationDomain) => offchainMessageApplicationDomain(putativeApplicationDomain)
5387
+ );
5388
+ }
5389
+ function getOffchainMessageApplicationDomainDecoder() {
5390
+ return getAddressDecoder();
5391
+ }
5392
+ function getOffchainMessageApplicationDomainCodec() {
5393
+ return combineCodec(getOffchainMessageApplicationDomainEncoder(), getOffchainMessageApplicationDomainDecoder());
5394
+ }
5395
+ var OFFCHAIN_MESSAGE_SIGNING_DOMAIN_BYTES = new Uint8Array([
5396
+ 255,
5397
+ 115,
5398
+ 111,
5399
+ 108,
5400
+ 97,
5401
+ 110,
5402
+ 97,
5403
+ 32,
5404
+ 111,
5405
+ 102,
5406
+ 102,
5407
+ 99,
5408
+ 104,
5409
+ 97,
5410
+ 105,
5411
+ 110
5412
+ ]);
5413
+ function getOffchainMessageSigningDomainDecoder() {
5414
+ return getConstantDecoder(OFFCHAIN_MESSAGE_SIGNING_DOMAIN_BYTES);
5415
+ }
5416
+ function getOffchainMessageSigningDomainEncoder() {
5417
+ return getConstantEncoder(OFFCHAIN_MESSAGE_SIGNING_DOMAIN_BYTES);
5418
+ }
5419
+ function getSigningDomainPrefixedDecoder(...fields) {
5420
+ return getHiddenPrefixDecoder(getStructDecoder(fields), [getOffchainMessageSigningDomainDecoder()]);
5421
+ }
5422
+ function getSigningDomainPrefixedEncoder(...fields) {
5423
+ return getHiddenPrefixEncoder(getStructEncoder(fields), [getOffchainMessageSigningDomainEncoder()]);
5424
+ }
5425
+ function getVersionTransformer(fixedVersion) {
5426
+ return (version) => {
5427
+ if (version > 1) {
5428
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED, {
5429
+ unsupportedVersion: version
5430
+ });
5431
+ }
5432
+ if (fixedVersion != null && version !== fixedVersion) {
5433
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION, {
5434
+ actualVersion: version,
5435
+ expectedVersion: fixedVersion
5436
+ });
5437
+ }
5438
+ return version;
5439
+ };
5440
+ }
5441
+ function createOffchainMessagePreambleDecoder(version, ...fields) {
5442
+ return getSigningDomainPrefixedDecoder(
5443
+ ["version", transformDecoder(getU8Decoder(), getVersionTransformer(version))],
5444
+ ...fields
5445
+ );
5446
+ }
5447
+ function createOffchainMessagePreambleEncoder(version, ...fields) {
5448
+ return getSigningDomainPrefixedEncoder(
5449
+ ["version", transformEncoder(getU8Encoder(), getVersionTransformer(version))],
5450
+ ...fields
5451
+ );
5452
+ }
5453
+ function decodeRequiredSignatoryAddresses(bytes) {
5454
+ const { version, bytesAfterVersion } = getSigningDomainPrefixedDecoder(
5455
+ ["version", transformDecoder(getU8Decoder(), getVersionTransformer())],
5456
+ ["bytesAfterVersion", getBytesDecoder()]
5457
+ ).decode(bytes);
5458
+ return offsetDecoder(
5459
+ transformDecoder(getArrayDecoder(getAddressDecoder(), { size: getU8Decoder() }), (signatoryAddresses) => {
5460
+ if (signatoryAddresses.length === 0) {
5461
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO);
5462
+ }
5463
+ return signatoryAddresses;
5464
+ }),
5465
+ {
5466
+ preOffset: ({ preOffset }) => preOffset + (version === 0 ? 32 + 1 : 0)
5467
+ }
5468
+ ).decode(bytesAfterVersion);
5469
+ }
5470
+ function getSignatoriesComparator() {
5471
+ return (x, y) => {
5472
+ if (x.length !== y.length) {
5473
+ return x.length < y.length ? -1 : 1;
5474
+ }
5475
+ for (let ii = 0; ii < x.length; ii++) {
5476
+ if (x[ii] === y[ii]) {
5477
+ continue;
5478
+ } else {
5479
+ return x[ii] < y[ii] ? -1 : 1;
5480
+ }
5481
+ }
5482
+ return 0;
5483
+ };
5484
+ }
5485
+ function getSignaturesToEncode2(signaturesMap) {
5486
+ const signatures = Object.values(signaturesMap);
5487
+ if (signatures.length === 0) {
5488
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO);
5489
+ }
5490
+ return signatures.map((signature2) => {
5491
+ if (!signature2) {
5492
+ return new Uint8Array(64).fill(0);
5493
+ }
5494
+ return signature2;
5495
+ });
5496
+ }
5497
+ function getSignaturesEncoder2() {
5498
+ return transformEncoder(
5499
+ getArrayEncoder(fixEncoderSize(getBytesEncoder(), 64), { size: getU8Encoder() }),
5500
+ getSignaturesToEncode2
5501
+ );
5502
+ }
5503
+ function getOffchainMessageEnvelopeEncoder() {
5504
+ return transformEncoder(
5505
+ getStructEncoder([
5506
+ ["signatures", getSignaturesEncoder2()],
5507
+ ["content", getBytesEncoder()]
5508
+ ]),
5509
+ (envelope) => {
5510
+ const signaturesMapAddresses = Object.keys(envelope.signatures).map(address);
5511
+ if (signaturesMapAddresses.length === 0) {
5512
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO);
5513
+ }
5514
+ const signatoryAddresses = decodeAndValidateRequiredSignatoryAddresses(envelope.content);
5515
+ const missingRequiredSigners = [];
5516
+ const unexpectedSigners = [];
5517
+ for (const address2 of signatoryAddresses) {
5518
+ if (!signaturesMapAddresses.includes(address2)) {
5519
+ missingRequiredSigners.push(address2);
5520
+ }
5521
+ }
5522
+ for (const address2 of signaturesMapAddresses) {
5523
+ if (!signatoryAddresses.includes(address2)) {
5524
+ unexpectedSigners.push(address2);
5525
+ }
5526
+ }
5527
+ if (missingRequiredSigners.length || unexpectedSigners.length) {
5528
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH, {
5529
+ missingRequiredSigners,
5530
+ unexpectedSigners
5531
+ });
5532
+ }
5533
+ const orderedSignatureMap = {};
5534
+ for (const address2 of signatoryAddresses) {
5535
+ orderedSignatureMap[address2] = envelope.signatures[address2];
5536
+ }
5537
+ return {
5538
+ ...envelope,
5539
+ signatures: orderedSignatureMap
5540
+ };
5541
+ }
5542
+ );
5543
+ }
5544
+ function getOffchainMessageEnvelopeDecoder() {
5545
+ return transformDecoder(
5546
+ getStructDecoder([
5547
+ ["signatures", getArrayDecoder(fixDecoderSize(getBytesDecoder(), 64), { size: getU8Decoder() })],
5548
+ ["content", getBytesDecoder()]
5549
+ ]),
5550
+ decodePartiallyDecodedOffchainMessageEnvelope
5551
+ );
5552
+ }
5553
+ function getOffchainMessageEnvelopeCodec() {
5554
+ return combineCodec(getOffchainMessageEnvelopeEncoder(), getOffchainMessageEnvelopeDecoder());
5555
+ }
5556
+ function decodePartiallyDecodedOffchainMessageEnvelope(offchainMessageEnvelope) {
5557
+ const { content, signatures } = offchainMessageEnvelope;
5558
+ if (signatures.length === 0) {
5559
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO);
5560
+ }
5561
+ const signatoryAddresses = decodeAndValidateRequiredSignatoryAddresses(content);
5562
+ if (signatoryAddresses.length !== signatures.length) {
5563
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH, {
5564
+ numRequiredSignatures: signatoryAddresses.length,
5565
+ signatoryAddresses,
5566
+ signaturesLength: signatures.length
5567
+ });
5568
+ }
5569
+ const signaturesMap = {};
5570
+ signatoryAddresses.forEach((address2, index) => {
5571
+ const signatureForAddress = signatures[index];
5572
+ if (signatureForAddress.every((b) => b === 0)) {
5573
+ signaturesMap[address2] = null;
5574
+ } else {
5575
+ signaturesMap[address2] = signatureForAddress;
5576
+ }
5577
+ });
5578
+ return Object.freeze({
5579
+ content,
5580
+ signatures: Object.freeze(signaturesMap)
5581
+ });
5582
+ }
5583
+ function decodeAndValidateRequiredSignatoryAddresses(bytes) {
5584
+ const signatoryAddresses = decodeRequiredSignatoryAddresses(bytes);
5585
+ if (signatoryAddresses.length === 0) {
5586
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO);
5587
+ }
5588
+ return signatoryAddresses;
5589
+ }
5590
+ var MAX_BODY_BYTES = (
5591
+ // Largest 16-bit unsigned integer
5592
+ 65535
5593
+ );
5594
+ var MAX_BODY_BYTES_HARDWARE_WALLET_SIGNABLE = (
5595
+ // Space remaining in the mininum IPv6 MTU after network header overhead
5596
+ 1232
5597
+ );
5598
+ var OffchainMessageContentFormat = /* @__PURE__ */ ((OffchainMessageContentFormat3) => {
5599
+ OffchainMessageContentFormat3[OffchainMessageContentFormat3["RESTRICTED_ASCII_1232_BYTES_MAX"] = 0] = "RESTRICTED_ASCII_1232_BYTES_MAX";
5600
+ OffchainMessageContentFormat3[OffchainMessageContentFormat3["UTF8_1232_BYTES_MAX"] = 1] = "UTF8_1232_BYTES_MAX";
5601
+ OffchainMessageContentFormat3[OffchainMessageContentFormat3["UTF8_65535_BYTES_MAX"] = 2] = "UTF8_65535_BYTES_MAX";
5602
+ return OffchainMessageContentFormat3;
5603
+ })(OffchainMessageContentFormat || {});
5604
+ function assertIsOffchainMessageContentRestrictedAsciiOf1232BytesMax(putativeContent) {
5605
+ if (putativeContent.format !== 0) {
5606
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH, {
5607
+ actualMessageFormat: putativeContent.format,
5608
+ expectedMessageFormat: 0
5609
+ /* RESTRICTED_ASCII_1232_BYTES_MAX */
5610
+ });
5611
+ }
5612
+ if (putativeContent.text.length === 0) {
5613
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY);
5614
+ }
5615
+ if (isTextRestrictedAscii(putativeContent.text) === false) {
5616
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE);
5617
+ }
5618
+ const length = getUtf8Encoder().getSizeFromValue(putativeContent.text);
5619
+ if (length > MAX_BODY_BYTES_HARDWARE_WALLET_SIGNABLE) {
5620
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED, {
5621
+ actualBytes: length,
5622
+ maxBytes: MAX_BODY_BYTES_HARDWARE_WALLET_SIGNABLE
5623
+ });
5624
+ }
5625
+ }
5626
+ function isOffchainMessageContentRestrictedAsciiOf1232BytesMax(putativeContent) {
5627
+ if (putativeContent.format !== 0 || putativeContent.text.length === 0 || isTextRestrictedAscii(putativeContent.text) === false) {
5628
+ return false;
5629
+ }
5630
+ const length = getUtf8Encoder().getSizeFromValue(putativeContent.text);
5631
+ return length <= MAX_BODY_BYTES_HARDWARE_WALLET_SIGNABLE;
5632
+ }
5633
+ function offchainMessageContentRestrictedAsciiOf1232BytesMax(text) {
5634
+ const putativeContent = Object.freeze({
5635
+ format: 0,
5636
+ text
5637
+ });
5638
+ assertIsOffchainMessageContentRestrictedAsciiOf1232BytesMax(putativeContent);
5639
+ return putativeContent;
5640
+ }
5641
+ function assertIsOffchainMessageContentUtf8Of1232BytesMax(putativeContent) {
5642
+ if (putativeContent.text.length === 0) {
5643
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY);
5644
+ }
5645
+ if (putativeContent.format !== 1) {
5646
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH, {
5647
+ actualMessageFormat: putativeContent.format,
5648
+ expectedMessageFormat: 1
5649
+ /* UTF8_1232_BYTES_MAX */
5650
+ });
5651
+ }
5652
+ const length = getUtf8Encoder().getSizeFromValue(putativeContent.text);
5653
+ if (length > MAX_BODY_BYTES_HARDWARE_WALLET_SIGNABLE) {
5654
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED, {
5655
+ actualBytes: length,
5656
+ maxBytes: MAX_BODY_BYTES_HARDWARE_WALLET_SIGNABLE
5657
+ });
5658
+ }
5659
+ }
5660
+ function isOffchainMessageContentUtf8Of1232BytesMax(putativeContent) {
5661
+ if (putativeContent.format !== 1 || putativeContent.text.length === 0) {
5662
+ return false;
5663
+ }
5664
+ const length = getUtf8Encoder().getSizeFromValue(putativeContent.text);
5665
+ return length <= MAX_BODY_BYTES_HARDWARE_WALLET_SIGNABLE;
5666
+ }
5667
+ function offchainMessageContentUtf8Of1232BytesMax(text) {
5668
+ const putativeContent = Object.freeze({
5669
+ format: 1,
5670
+ text
5671
+ });
5672
+ assertIsOffchainMessageContentUtf8Of1232BytesMax(putativeContent);
5673
+ return putativeContent;
5674
+ }
5675
+ function assertIsOffchainMessageContentUtf8Of65535BytesMax(putativeContent) {
5676
+ if (putativeContent.format !== 2) {
5677
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH, {
5678
+ actualMessageFormat: putativeContent.format,
5679
+ expectedMessageFormat: 2
5680
+ /* UTF8_65535_BYTES_MAX */
5681
+ });
5682
+ }
5683
+ if (putativeContent.text.length === 0) {
5684
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY);
5685
+ }
5686
+ const length = getUtf8Encoder().getSizeFromValue(putativeContent.text);
5687
+ if (length > MAX_BODY_BYTES) {
5688
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED, {
5689
+ actualBytes: length,
5690
+ maxBytes: MAX_BODY_BYTES
5691
+ });
5692
+ }
5693
+ }
5694
+ function isOffchainMessageContentUtf8Of65535BytesMax(putativeContent) {
5695
+ if (putativeContent.format !== 2 || putativeContent.text.length === 0) {
5696
+ return false;
5697
+ }
5698
+ const length = getUtf8Encoder().getSizeFromValue(putativeContent.text);
5699
+ return length <= MAX_BODY_BYTES;
5700
+ }
5701
+ function offchainMessageContentUtf8Of65535BytesMax(text) {
5702
+ const putativeContent = Object.freeze({
5703
+ format: 2,
5704
+ text
5705
+ });
5706
+ assertIsOffchainMessageContentUtf8Of65535BytesMax(putativeContent);
5707
+ return putativeContent;
5708
+ }
5709
+ function isTextRestrictedAscii(putativeRestrictedAsciiString) {
5710
+ return /^[\x20-\x7e]+$/.test(putativeRestrictedAsciiString);
5711
+ }
5712
+ function assertIsOffchainMessageRestrictedAsciiOf1232BytesMax(putativeMessage) {
5713
+ assertIsOffchainMessageContentRestrictedAsciiOf1232BytesMax(putativeMessage.content);
5714
+ }
5715
+ function assertIsOffchainMessageUtf8Of1232BytesMax(putativeMessage) {
5716
+ assertIsOffchainMessageContentUtf8Of1232BytesMax(putativeMessage.content);
5717
+ }
5718
+ function assertIsOffchainMessageUtf8Of65535BytesMax(putativeMessage) {
5719
+ assertIsOffchainMessageContentUtf8Of65535BytesMax(putativeMessage.content);
5720
+ }
5721
+ function getOffchainMessageContentFormatDecoder() {
5722
+ return getEnumDecoder(OffchainMessageContentFormat, {
5723
+ useValuesAsDiscriminators: true
5724
+ });
5725
+ }
5726
+ function getOffchainMessageContentFormatEncoder() {
5727
+ return getEnumEncoder(OffchainMessageContentFormat, {
5728
+ useValuesAsDiscriminators: true
5729
+ });
5730
+ }
5731
+ function getOffchainMessageV0PreambleDecoder() {
5732
+ return createOffchainMessagePreambleDecoder(
5733
+ /* version */
5734
+ 0,
5735
+ ["applicationDomain", getOffchainMessageApplicationDomainDecoder()],
5736
+ ["messageFormat", getOffchainMessageContentFormatDecoder()],
5737
+ [
5738
+ "requiredSignatories",
5739
+ transformDecoder(getArrayDecoder(getAddressDecoder(), { size: getU8Decoder() }), (signatoryAddresses) => {
5740
+ if (signatoryAddresses.length === 0) {
5741
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO);
5742
+ }
5743
+ return signatoryAddresses.map((address2) => Object.freeze({ address: address2 }));
5744
+ })
5745
+ ],
5746
+ ["messageLength", getU16Decoder()]
5747
+ );
5748
+ }
5749
+ function getOffchainMessageV0PreambleEncoder() {
5750
+ return createOffchainMessagePreambleEncoder(
5751
+ /* version */
5752
+ 0,
5753
+ ["applicationDomain", getOffchainMessageApplicationDomainEncoder()],
5754
+ ["messageFormat", getOffchainMessageContentFormatEncoder()],
5755
+ [
5756
+ "requiredSignatories",
5757
+ transformEncoder(
5758
+ getArrayEncoder(getAddressEncoder(), { size: getU8Encoder() }),
5759
+ (signatoryAddresses) => {
5760
+ if (signatoryAddresses.length === 0) {
5761
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO);
5762
+ }
5763
+ return signatoryAddresses.map(({ address: address2 }) => address2);
5764
+ }
5765
+ )
5766
+ ],
5767
+ ["messageLength", getU16Encoder()]
5768
+ );
5769
+ }
5770
+ function getOffchainMessageV0Decoder() {
5771
+ return transformDecoder(
5772
+ getTupleDecoder([getOffchainMessageV0PreambleDecoder(), getUtf8Decoder()]),
5773
+ ([{ messageLength, messageFormat, requiredSignatories, ...preambleRest }, text]) => {
5774
+ const actualLength = getUtf8Encoder().getSizeFromValue(text);
5775
+ if (messageLength !== actualLength) {
5776
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH, {
5777
+ actualLength,
5778
+ specifiedLength: messageLength
5779
+ });
5780
+ }
5781
+ const offchainMessage = Object.freeze({
5782
+ ...preambleRest,
5783
+ content: Object.freeze({
5784
+ format: messageFormat,
5785
+ text
5786
+ }),
5787
+ requiredSignatories: Object.freeze(requiredSignatories)
5788
+ });
5789
+ switch (messageFormat) {
5790
+ case 0: {
5791
+ assertIsOffchainMessageRestrictedAsciiOf1232BytesMax(offchainMessage);
5792
+ return offchainMessage;
5793
+ }
5794
+ case 1: {
5795
+ assertIsOffchainMessageUtf8Of1232BytesMax(offchainMessage);
5796
+ return offchainMessage;
5797
+ }
5798
+ case 2: {
5799
+ assertIsOffchainMessageUtf8Of65535BytesMax(offchainMessage);
5800
+ return offchainMessage;
5801
+ }
5802
+ default: {
5803
+ throw new SolanaError(SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE, {
5804
+ unexpectedValue: messageFormat
5805
+ });
5806
+ }
5807
+ }
5808
+ }
5809
+ );
5810
+ }
5811
+ function getOffchainMessageV0Encoder() {
5812
+ return transformEncoder(
5813
+ getTupleEncoder([getOffchainMessageV0PreambleEncoder(), getUtf8Encoder()]),
5814
+ (offchainMessage) => {
5815
+ const { content, ...preamble } = offchainMessage;
5816
+ switch (offchainMessage.content.format) {
5817
+ case 0: {
5818
+ assertIsOffchainMessageRestrictedAsciiOf1232BytesMax(offchainMessage);
5819
+ break;
5820
+ }
5821
+ case 1: {
5822
+ assertIsOffchainMessageUtf8Of1232BytesMax(offchainMessage);
5823
+ break;
5824
+ }
5825
+ case 2: {
5826
+ assertIsOffchainMessageUtf8Of65535BytesMax(offchainMessage);
5827
+ break;
5828
+ }
5829
+ default: {
5830
+ throw new SolanaError(SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE, {
5831
+ unexpectedValue: offchainMessage.content
5832
+ });
5833
+ }
5834
+ }
5835
+ const messageLength = getUtf8Encoder().getSizeFromValue(content.text);
5836
+ const compiledPreamble = {
5837
+ ...preamble,
5838
+ messageFormat: content.format,
5839
+ messageLength
5840
+ };
5841
+ return [compiledPreamble, content.text];
5842
+ }
5843
+ );
5844
+ }
5845
+ function getOffchainMessageV0Codec() {
5846
+ return combineCodec(getOffchainMessageV0Encoder(), getOffchainMessageV0Decoder());
5847
+ }
5848
+ function getOffchainMessageV1PreambleDecoder() {
5849
+ return createOffchainMessagePreambleDecoder(
5850
+ /* version */
5851
+ 1,
5852
+ [
5853
+ "requiredSignatories",
5854
+ transformDecoder(
5855
+ getArrayDecoder(fixDecoderSize(getBytesDecoder(), 32), { size: getU8Decoder() }),
5856
+ (signatoryAddressesBytes) => {
5857
+ if (signatoryAddressesBytes.length === 0) {
5858
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO);
5859
+ }
5860
+ const comparator = getSignatoriesComparator();
5861
+ for (let ii = 0; ii < signatoryAddressesBytes.length - 1; ii++) {
5862
+ switch (comparator(signatoryAddressesBytes[ii], signatoryAddressesBytes[ii + 1])) {
5863
+ case 0:
5864
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE);
5865
+ case 1:
5866
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED);
5867
+ }
5868
+ }
5869
+ const addressDecoder = getAddressDecoder();
5870
+ return signatoryAddressesBytes.map(
5871
+ (addressBytes) => Object.freeze({
5872
+ address: addressDecoder.decode(addressBytes)
5873
+ })
5874
+ );
5875
+ }
5876
+ )
5877
+ ]
5878
+ );
5879
+ }
5880
+ function getOffchainMessageV1PreambleEncoder() {
5881
+ return createOffchainMessagePreambleEncoder(
5882
+ /* version */
5883
+ 1,
5884
+ [
5885
+ "requiredSignatories",
5886
+ transformEncoder(
5887
+ transformEncoder(
5888
+ getArrayEncoder(getBytesEncoder(), { size: getU8Encoder() }),
5889
+ (signatoryAddressesBytes) => {
5890
+ return signatoryAddressesBytes.toSorted(getSignatoriesComparator());
5891
+ }
5892
+ ),
5893
+ (signatoryAddresses) => {
5894
+ if (signatoryAddresses.length === 0) {
5895
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO);
5896
+ }
5897
+ const seenSignatories = /* @__PURE__ */ new Set();
5898
+ for (const { address: address2 } of signatoryAddresses) {
5899
+ if (seenSignatories.has(address2)) {
5900
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE);
5901
+ }
5902
+ seenSignatories.add(address2);
5903
+ }
5904
+ const addressEncoder = getAddressEncoder();
5905
+ return signatoryAddresses.map(({ address: address2 }) => addressEncoder.encode(address2));
5906
+ }
5907
+ )
5908
+ ]
5909
+ );
5910
+ }
5911
+ function getOffchainMessageV1Decoder() {
5912
+ return transformDecoder(
5913
+ getTupleDecoder([getOffchainMessageV1PreambleDecoder(), getUtf8Decoder()]),
5914
+ ([{ requiredSignatories, ...preambleRest }, text]) => {
5915
+ if (text.length === 0) {
5916
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY);
5917
+ }
5918
+ return Object.freeze({
5919
+ ...preambleRest,
5920
+ content: text,
5921
+ requiredSignatories: Object.freeze(requiredSignatories)
5922
+ });
5923
+ }
5924
+ );
5925
+ }
5926
+ function getOffchainMessageV1Encoder() {
5927
+ return transformEncoder(
5928
+ getTupleEncoder([getOffchainMessageV1PreambleEncoder(), getUtf8Encoder()]),
5929
+ (offchainMessage) => {
5930
+ const { content, ...compiledPreamble } = offchainMessage;
5931
+ if (content.length === 0) {
5932
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY);
5933
+ }
5934
+ return [compiledPreamble, content];
5935
+ }
5936
+ );
5937
+ }
5938
+ function getOffchainMessageV1Codec() {
5939
+ return combineCodec(getOffchainMessageV1Encoder(), getOffchainMessageV1Decoder());
5940
+ }
5941
+ function getOffchainMessageDecoder() {
5942
+ return createDecoder({
5943
+ read(bytes, offset) {
5944
+ const version = getHiddenPrefixDecoder(getU8Decoder(), [
5945
+ // Discard the signing domain
5946
+ getOffchainMessageSigningDomainDecoder()
5947
+ ]).decode(bytes, offset);
5948
+ switch (version) {
5949
+ case 0:
5950
+ return getOffchainMessageV0Decoder().read(bytes, offset);
5951
+ case 1:
5952
+ return getOffchainMessageV1Decoder().read(bytes, offset);
5953
+ default:
5954
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED, {
5955
+ unsupportedVersion: version
5956
+ });
5957
+ }
5958
+ }
5959
+ });
5960
+ }
5961
+ function getOffchainMessageEncoder() {
5962
+ return createEncoder({
5963
+ getSizeFromValue: (offchainMessage) => {
5964
+ const { version } = offchainMessage;
5965
+ switch (version) {
5966
+ case 0:
5967
+ return getOffchainMessageV0Encoder().getSizeFromValue(offchainMessage);
5968
+ case 1:
5969
+ return getOffchainMessageV1Encoder().getSizeFromValue(offchainMessage);
5970
+ default:
5971
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED, {
5972
+ unsupportedVersion: version
5973
+ });
5974
+ }
5975
+ },
5976
+ write: (offchainMessage, bytes, offset) => {
5977
+ const { version } = offchainMessage;
5978
+ switch (version) {
5979
+ case 0:
5980
+ return getOffchainMessageV0Encoder().write(offchainMessage, bytes, offset);
5981
+ case 1:
5982
+ return getOffchainMessageV1Encoder().write(offchainMessage, bytes, offset);
5983
+ default:
5984
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED, {
5985
+ unsupportedVersion: version
5986
+ });
5987
+ }
5988
+ }
5989
+ });
5990
+ }
5991
+ function getOffchainMessageCodec() {
5992
+ return combineCodec(getOffchainMessageEncoder(), getOffchainMessageDecoder());
5993
+ }
5994
+ function compileOffchainMessageEnvelopeUsingEncoder(offchainMessage, encoder) {
5995
+ const offchainMessageBytes = encoder.encode(offchainMessage);
5996
+ const signatures = {};
5997
+ for (const { address: address2 } of offchainMessage.requiredSignatories) {
5998
+ signatures[address2] = null;
5999
+ }
6000
+ return Object.freeze({
6001
+ content: offchainMessageBytes,
6002
+ signatures: Object.freeze(signatures)
6003
+ });
6004
+ }
6005
+ function compileOffchainMessageV0Envelope(offchainMessage) {
6006
+ return compileOffchainMessageEnvelopeUsingEncoder(offchainMessage, getOffchainMessageV0Encoder());
6007
+ }
6008
+ function compileOffchainMessageV1Envelope(offchainMessage) {
6009
+ return compileOffchainMessageEnvelopeUsingEncoder(offchainMessage, getOffchainMessageV1Encoder());
6010
+ }
6011
+ function compileOffchainMessageEnvelope(offchainMessage) {
6012
+ const { version } = offchainMessage;
6013
+ switch (version) {
6014
+ case 0:
6015
+ return compileOffchainMessageV0Envelope(offchainMessage);
6016
+ case 1:
6017
+ return compileOffchainMessageV1Envelope(offchainMessage);
6018
+ default:
6019
+ throw new SolanaError(SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE, {
6020
+ unexpectedValue: version
6021
+ });
6022
+ }
6023
+ }
6024
+ async function partiallySignOffchainMessageEnvelope(keyPairs, offchainMessageEnvelope) {
6025
+ let newSignatures;
6026
+ let unexpectedSigners;
6027
+ const requiredSignatoryAddresses = decodeRequiredSignatoryAddresses(offchainMessageEnvelope.content);
6028
+ await Promise.all(
6029
+ keyPairs.map(async (keyPair) => {
6030
+ const address2 = await getAddressFromPublicKey(keyPair.publicKey);
6031
+ if (!requiredSignatoryAddresses.includes(address2)) {
6032
+ unexpectedSigners || (unexpectedSigners = /* @__PURE__ */ new Set());
6033
+ unexpectedSigners.add(address2);
6034
+ return;
6035
+ }
6036
+ if (unexpectedSigners) {
6037
+ return;
6038
+ }
6039
+ const existingSignature = offchainMessageEnvelope.signatures[address2];
6040
+ const newSignature = await signBytes(keyPair.privateKey, offchainMessageEnvelope.content);
6041
+ if (existingSignature != null && bytesEqual(newSignature, existingSignature)) {
6042
+ return;
6043
+ }
6044
+ newSignatures || (newSignatures = {});
6045
+ newSignatures[address2] = newSignature;
6046
+ })
6047
+ );
6048
+ if (unexpectedSigners && unexpectedSigners.size > 0) {
6049
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE, {
6050
+ expectedAddresses: requiredSignatoryAddresses,
6051
+ unexpectedAddresses: [...unexpectedSigners]
6052
+ });
6053
+ }
6054
+ if (!newSignatures) {
6055
+ return offchainMessageEnvelope;
6056
+ }
6057
+ return Object.freeze({
6058
+ ...offchainMessageEnvelope,
6059
+ signatures: Object.freeze({
6060
+ ...offchainMessageEnvelope.signatures,
6061
+ ...newSignatures
6062
+ })
6063
+ });
6064
+ }
6065
+ async function signOffchainMessageEnvelope(keyPairs, offchainMessageEnvelope) {
6066
+ const out = await partiallySignOffchainMessageEnvelope(keyPairs, offchainMessageEnvelope);
6067
+ assertIsFullySignedOffchainMessageEnvelope(out);
6068
+ Object.freeze(out);
6069
+ return out;
6070
+ }
6071
+ function isFullySignedOffchainMessageEnvelope(offchainMessage) {
6072
+ return Object.entries(offchainMessage.signatures).every(([_, signatureBytes2]) => !!signatureBytes2);
6073
+ }
6074
+ function assertIsFullySignedOffchainMessageEnvelope(offchainMessage) {
6075
+ const missingSigs = [];
6076
+ Object.entries(offchainMessage.signatures).forEach(([address2, signatureBytes2]) => {
6077
+ if (!signatureBytes2) {
6078
+ missingSigs.push(address2);
6079
+ }
6080
+ });
6081
+ if (missingSigs.length > 0) {
6082
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING, {
6083
+ addresses: missingSigs
6084
+ });
6085
+ }
6086
+ }
6087
+ async function verifyOffchainMessageEnvelope(offchainMessageEnvelope) {
6088
+ let errorContext;
6089
+ const requiredSignatories = decodeRequiredSignatoryAddresses(offchainMessageEnvelope.content);
6090
+ await Promise.all(
6091
+ requiredSignatories.map(async (address2) => {
6092
+ const signature2 = offchainMessageEnvelope.signatures[address2];
6093
+ if (signature2 == null) {
6094
+ errorContext || (errorContext = {});
6095
+ errorContext.signatoriesWithMissingSignatures || (errorContext.signatoriesWithMissingSignatures = []);
6096
+ errorContext.signatoriesWithMissingSignatures.push(address2);
6097
+ } else {
6098
+ const publicKey = await getPublicKeyFromAddress(address2);
6099
+ if (await verifySignature(publicKey, signature2, offchainMessageEnvelope.content)) {
6100
+ return true;
6101
+ } else {
6102
+ errorContext || (errorContext = {});
6103
+ errorContext.signatoriesWithInvalidSignatures || (errorContext.signatoriesWithInvalidSignatures = []);
6104
+ errorContext.signatoriesWithInvalidSignatures.push(address2);
6105
+ }
6106
+ }
6107
+ })
6108
+ );
6109
+ if (errorContext) {
6110
+ throw new SolanaError(SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE, errorContext);
6111
+ }
6112
+ }
6113
+
5259
6114
  // ../programs/dist/index.browser.mjs
5260
6115
  function isProgramError(error, transactionMessage, programAddress, code) {
5261
6116
  var _a;
@@ -6210,7 +7065,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
6210
7065
  ...config.headers ? normalizeHeaders2(config.headers) : void 0,
6211
7066
  ...{
6212
7067
  // Keep these headers lowercase so they will override any user-supplied headers above.
6213
- "solana-client": `js/${"5.0.1-canary-20251119203851"}`
7068
+ "solana-client": `js/${"5.1.0-canary-20251204140906"}`
6214
7069
  }
6215
7070
  }
6216
7071
  }),
@@ -7198,7 +8053,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
7198
8053
  );
7199
8054
  }
7200
8055
  const { intervalMs, ...rest } = config;
7201
- const createDefaultRpcSubscriptionsChannel = ({ abortSignal }) => {
8056
+ const createDefaultRpcSubscriptionsChannel = (({ abortSignal }) => {
7202
8057
  var _a2;
7203
8058
  return createWebSocketChannel({
7204
8059
  ...rest,
@@ -7214,7 +8069,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
7214
8069
  intervalMs: intervalMs != null ? intervalMs : 5e3
7215
8070
  })
7216
8071
  );
7217
- };
8072
+ });
7218
8073
  return getChannelPoolingChannelCreator(createDefaultRpcSubscriptionsChannel, {
7219
8074
  maxSubscriptionsPerChannel: (_a = config.maxSubscriptionsPerChannel) != null ? _a : (
7220
8075
  /**
@@ -7292,10 +8147,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
7292
8147
  );
7293
8148
  }
7294
8149
  function createRpcSubscriptionsTransportFromChannelCreator(createChannel) {
7295
- return async ({ execute, signal }) => {
8150
+ return (async ({ execute, signal }) => {
7296
8151
  const channel = await createChannel({ abortSignal: signal });
7297
8152
  return await execute({ channel, signal });
7298
- };
8153
+ });
7299
8154
  }
7300
8155
  function createSolanaRpcSubscriptionsImpl(clusterUrl, config) {
7301
8156
  const transport = createDefaultRpcSubscriptionsTransport({
@@ -7497,6 +8352,60 @@ this.globalThis.solanaWeb3 = (function (exports) {
7497
8352
  };
7498
8353
  return Object.freeze(out);
7499
8354
  }
8355
+ function getSignersFromOffchainMessage({
8356
+ requiredSignatories
8357
+ }) {
8358
+ const messageSigners = requiredSignatories.filter(isMessageSigner);
8359
+ return deduplicateSigners(messageSigners);
8360
+ }
8361
+ async function partiallySignOffchainMessageWithSigners(offchainMessage, config) {
8362
+ const { partialSigners, modifyingSigners } = categorizeMessageSigners(
8363
+ getSignersFromOffchainMessage(offchainMessage)
8364
+ );
8365
+ return await signModifyingAndPartialMessageSigners(offchainMessage, modifyingSigners, partialSigners, config);
8366
+ }
8367
+ async function signOffchainMessageWithSigners(offchainMessage, config) {
8368
+ const signedOffchainMessageEnvelope = await partiallySignOffchainMessageWithSigners(offchainMessage, config);
8369
+ assertIsFullySignedOffchainMessageEnvelope(signedOffchainMessageEnvelope);
8370
+ return signedOffchainMessageEnvelope;
8371
+ }
8372
+ function categorizeMessageSigners(signers) {
8373
+ const modifyingSigners = identifyMessageModifyingSigners(signers);
8374
+ const partialSigners = signers.filter(isMessagePartialSigner).filter((signer) => !modifyingSigners.includes(signer));
8375
+ return Object.freeze({ modifyingSigners, partialSigners });
8376
+ }
8377
+ function identifyMessageModifyingSigners(signers) {
8378
+ const modifyingSigners = signers.filter(isMessageModifyingSigner);
8379
+ if (modifyingSigners.length === 0) return [];
8380
+ const nonPartialSigners = modifyingSigners.filter((signer) => !isMessagePartialSigner(signer));
8381
+ if (nonPartialSigners.length > 0) return nonPartialSigners;
8382
+ return [modifyingSigners[0]];
8383
+ }
8384
+ async function signModifyingAndPartialMessageSigners(offchainMessage, modifyingSigners = [], partialSigners = [], config) {
8385
+ var _a, _b;
8386
+ const offchainMessageEnvelope = compileOffchainMessageEnvelope(offchainMessage);
8387
+ const modifiedOffchainMessage = await modifyingSigners.reduce(async (offchainMessageEnvelope2, modifyingSigner) => {
8388
+ var _a2;
8389
+ (_a2 = config == null ? void 0 : config.abortSignal) == null ? void 0 : _a2.throwIfAborted();
8390
+ const [message] = await modifyingSigner.modifyAndSignMessages([await offchainMessageEnvelope2], config);
8391
+ return Object.freeze(message);
8392
+ }, Promise.resolve(offchainMessageEnvelope));
8393
+ (_a = config == null ? void 0 : config.abortSignal) == null ? void 0 : _a.throwIfAborted();
8394
+ const signatureDictionaries = await Promise.all(
8395
+ partialSigners.map(async (partialSigner) => {
8396
+ const [signatures] = await partialSigner.signMessages([modifiedOffchainMessage], config);
8397
+ return signatures;
8398
+ })
8399
+ );
8400
+ return Object.freeze({
8401
+ ...modifiedOffchainMessage,
8402
+ signatures: Object.freeze(
8403
+ signatureDictionaries.reduce((signatures, signatureDictionary) => {
8404
+ return { ...signatures, ...signatureDictionary };
8405
+ }, (_b = modifiedOffchainMessage.signatures) != null ? _b : {})
8406
+ )
8407
+ });
8408
+ }
7500
8409
  function isTransactionMessageWithSingleSendingSigner(transaction) {
7501
8410
  try {
7502
8411
  assertIsTransactionMessageWithSingleSendingSigner(transaction);
@@ -8123,6 +9032,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8123
9032
  exports.DEFAULT_RPC_SUBSCRIPTIONS_CONFIG = DEFAULT_RPC_SUBSCRIPTIONS_CONFIG;
8124
9033
  exports.Endian = Endian;
8125
9034
  exports.MAX_SUPPORTED_TRANSACTION_VERSION = MAX_SUPPORTED_TRANSACTION_VERSION;
9035
+ exports.OffchainMessageContentFormat = OffchainMessageContentFormat;
8126
9036
  exports.SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND = SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND;
8127
9037
  exports.SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED = SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED;
8128
9038
  exports.SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT = SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT;
@@ -8272,6 +9182,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
8272
9182
  exports.SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR = SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR;
8273
9183
  exports.SOLANA_ERROR__MALFORMED_NUMBER_STRING = SOLANA_ERROR__MALFORMED_NUMBER_STRING;
8274
9184
  exports.SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND;
9185
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE = SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE;
9186
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE = SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE;
9187
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH = SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH;
9188
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH = SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH;
9189
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED = SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED;
9190
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH = SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH;
9191
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH = SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH;
9192
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY = SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY;
9193
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO = SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO;
9194
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO = SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO;
9195
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH = SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH;
9196
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE = SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE;
9197
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED = SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED;
9198
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE = SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE;
9199
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING = SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING;
9200
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE = SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE;
9201
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION = SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION;
9202
+ exports.SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED = SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED;
8275
9203
  exports.SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN = SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN;
8276
9204
  exports.SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED = SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED;
8277
9205
  exports.SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED = SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED;
@@ -8388,6 +9316,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8388
9316
  exports.assertIsAddress = assertIsAddress;
8389
9317
  exports.assertIsBlockhash = assertIsBlockhash;
8390
9318
  exports.assertIsFixedSize = assertIsFixedSize;
9319
+ exports.assertIsFullySignedOffchainMessageEnvelope = assertIsFullySignedOffchainMessageEnvelope;
8391
9320
  exports.assertIsFullySignedTransaction = assertIsFullySignedTransaction;
8392
9321
  exports.assertIsInstructionForProgram = assertIsInstructionForProgram;
8393
9322
  exports.assertIsInstructionWithAccounts = assertIsInstructionWithAccounts;
@@ -8398,6 +9327,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
8398
9327
  exports.assertIsMessagePartialSigner = assertIsMessagePartialSigner;
8399
9328
  exports.assertIsMessageSigner = assertIsMessageSigner;
8400
9329
  exports.assertIsOffCurveAddress = assertIsOffCurveAddress;
9330
+ exports.assertIsOffchainMessageApplicationDomain = assertIsOffchainMessageApplicationDomain;
9331
+ exports.assertIsOffchainMessageContentRestrictedAsciiOf1232BytesMax = assertIsOffchainMessageContentRestrictedAsciiOf1232BytesMax;
9332
+ exports.assertIsOffchainMessageContentUtf8Of1232BytesMax = assertIsOffchainMessageContentUtf8Of1232BytesMax;
9333
+ exports.assertIsOffchainMessageContentUtf8Of65535BytesMax = assertIsOffchainMessageContentUtf8Of65535BytesMax;
9334
+ exports.assertIsOffchainMessageRestrictedAsciiOf1232BytesMax = assertIsOffchainMessageRestrictedAsciiOf1232BytesMax;
9335
+ exports.assertIsOffchainMessageUtf8Of1232BytesMax = assertIsOffchainMessageUtf8Of1232BytesMax;
9336
+ exports.assertIsOffchainMessageUtf8Of65535BytesMax = assertIsOffchainMessageUtf8Of65535BytesMax;
8401
9337
  exports.assertIsProgramDerivedAddress = assertIsProgramDerivedAddress;
8402
9338
  exports.assertIsSendableTransaction = assertIsSendableTransaction;
8403
9339
  exports.assertIsSignature = assertIsSignature;
@@ -8421,9 +9357,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
8421
9357
  exports.assertValidBaseString = assertValidBaseString;
8422
9358
  exports.assertValidNumberOfItemsForCodec = assertValidNumberOfItemsForCodec;
8423
9359
  exports.blockhash = blockhash;
9360
+ exports.bytesEqual = bytesEqual;
8424
9361
  exports.canceledSingleTransactionPlanResult = canceledSingleTransactionPlanResult;
8425
9362
  exports.combineCodec = combineCodec;
8426
9363
  exports.commitmentComparator = commitmentComparator;
9364
+ exports.compileOffchainMessageEnvelope = compileOffchainMessageEnvelope;
9365
+ exports.compileOffchainMessageV0Envelope = compileOffchainMessageV0Envelope;
9366
+ exports.compileOffchainMessageV1Envelope = compileOffchainMessageV1Envelope;
8427
9367
  exports.compileTransaction = compileTransaction;
8428
9368
  exports.compileTransactionMessage = compileTransactionMessage;
8429
9369
  exports.compressTransactionMessageUsingAddressLookupTables = compressTransactionMessageUsingAddressLookupTables;
@@ -8479,6 +9419,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8479
9419
  exports.fixCodecSize = fixCodecSize;
8480
9420
  exports.fixDecoderSize = fixDecoderSize;
8481
9421
  exports.fixEncoderSize = fixEncoderSize;
9422
+ exports.flattenTransactionPlanResult = flattenTransactionPlanResult;
8482
9423
  exports.generateKeyPair = generateKeyPair;
8483
9424
  exports.generateKeyPairSigner = generateKeyPairSigner;
8484
9425
  exports.getAddressCodec = getAddressCodec;
@@ -8580,6 +9521,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
8580
9521
  exports.getNullableCodec = getNullableCodec;
8581
9522
  exports.getNullableDecoder = getNullableDecoder;
8582
9523
  exports.getNullableEncoder = getNullableEncoder;
9524
+ exports.getOffchainMessageApplicationDomainCodec = getOffchainMessageApplicationDomainCodec;
9525
+ exports.getOffchainMessageApplicationDomainDecoder = getOffchainMessageApplicationDomainDecoder;
9526
+ exports.getOffchainMessageApplicationDomainEncoder = getOffchainMessageApplicationDomainEncoder;
9527
+ exports.getOffchainMessageCodec = getOffchainMessageCodec;
9528
+ exports.getOffchainMessageDecoder = getOffchainMessageDecoder;
9529
+ exports.getOffchainMessageEncoder = getOffchainMessageEncoder;
9530
+ exports.getOffchainMessageEnvelopeCodec = getOffchainMessageEnvelopeCodec;
9531
+ exports.getOffchainMessageEnvelopeDecoder = getOffchainMessageEnvelopeDecoder;
9532
+ exports.getOffchainMessageEnvelopeEncoder = getOffchainMessageEnvelopeEncoder;
9533
+ exports.getOffchainMessageV0Codec = getOffchainMessageV0Codec;
9534
+ exports.getOffchainMessageV0Decoder = getOffchainMessageV0Decoder;
9535
+ exports.getOffchainMessageV0Encoder = getOffchainMessageV0Encoder;
9536
+ exports.getOffchainMessageV1Codec = getOffchainMessageV1Codec;
9537
+ exports.getOffchainMessageV1Decoder = getOffchainMessageV1Decoder;
9538
+ exports.getOffchainMessageV1Encoder = getOffchainMessageV1Encoder;
8583
9539
  exports.getOptionCodec = getOptionCodec;
8584
9540
  exports.getOptionDecoder = getOptionDecoder;
8585
9541
  exports.getOptionEncoder = getOptionEncoder;
@@ -8599,6 +9555,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8599
9555
  exports.getShortU16Encoder = getShortU16Encoder;
8600
9556
  exports.getSignatureFromTransaction = getSignatureFromTransaction;
8601
9557
  exports.getSignersFromInstruction = getSignersFromInstruction;
9558
+ exports.getSignersFromOffchainMessage = getSignersFromOffchainMessage;
8602
9559
  exports.getSignersFromTransactionMessage = getSignersFromTransactionMessage;
8603
9560
  exports.getSolanaErrorFromInstructionError = getSolanaErrorFromInstructionError;
8604
9561
  exports.getSolanaErrorFromJsonRpcError = getSolanaErrorFromJsonRpcError;
@@ -8646,6 +9603,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8646
9603
  exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
8647
9604
  exports.isBlockhash = isBlockhash;
8648
9605
  exports.isFixedSize = isFixedSize;
9606
+ exports.isFullySignedOffchainMessageEnvelope = isFullySignedOffchainMessageEnvelope;
8649
9607
  exports.isFullySignedTransaction = isFullySignedTransaction;
8650
9608
  exports.isInstructionForProgram = isInstructionForProgram;
8651
9609
  exports.isInstructionWithAccounts = isInstructionWithAccounts;
@@ -8658,6 +9616,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
8658
9616
  exports.isMessageSigner = isMessageSigner;
8659
9617
  exports.isNone = isNone;
8660
9618
  exports.isOffCurveAddress = isOffCurveAddress;
9619
+ exports.isOffchainMessageApplicationDomain = isOffchainMessageApplicationDomain;
9620
+ exports.isOffchainMessageContentRestrictedAsciiOf1232BytesMax = isOffchainMessageContentRestrictedAsciiOf1232BytesMax;
9621
+ exports.isOffchainMessageContentUtf8Of1232BytesMax = isOffchainMessageContentUtf8Of1232BytesMax;
9622
+ exports.isOffchainMessageContentUtf8Of65535BytesMax = isOffchainMessageContentUtf8Of65535BytesMax;
8661
9623
  exports.isOption = isOption;
8662
9624
  exports.isProgramDerivedAddress = isProgramDerivedAddress;
8663
9625
  exports.isProgramError = isProgramError;
@@ -8692,6 +9654,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
8692
9654
  exports.nonDivisibleSequentialTransactionPlanResult = nonDivisibleSequentialTransactionPlanResult;
8693
9655
  exports.none = none;
8694
9656
  exports.offCurveAddress = offCurveAddress;
9657
+ exports.offchainMessageApplicationDomain = offchainMessageApplicationDomain;
9658
+ exports.offchainMessageContentRestrictedAsciiOf1232BytesMax = offchainMessageContentRestrictedAsciiOf1232BytesMax;
9659
+ exports.offchainMessageContentUtf8Of1232BytesMax = offchainMessageContentUtf8Of1232BytesMax;
9660
+ exports.offchainMessageContentUtf8Of65535BytesMax = offchainMessageContentUtf8Of65535BytesMax;
8695
9661
  exports.offsetCodec = offsetCodec;
8696
9662
  exports.offsetDecoder = offsetDecoder;
8697
9663
  exports.offsetEncoder = offsetEncoder;
@@ -8709,6 +9675,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
8709
9675
  exports.parseBase58RpcAccount = parseBase58RpcAccount;
8710
9676
  exports.parseBase64RpcAccount = parseBase64RpcAccount;
8711
9677
  exports.parseJsonRpcAccount = parseJsonRpcAccount;
9678
+ exports.partiallySignOffchainMessageEnvelope = partiallySignOffchainMessageEnvelope;
9679
+ exports.partiallySignOffchainMessageWithSigners = partiallySignOffchainMessageWithSigners;
8712
9680
  exports.partiallySignTransaction = partiallySignTransaction;
8713
9681
  exports.partiallySignTransactionMessageWithSigners = partiallySignTransactionMessageWithSigners;
8714
9682
  exports.pipe = pipe;
@@ -8734,6 +9702,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
8734
9702
  exports.setTransactionMessageLifetimeUsingDurableNonce = setTransactionMessageLifetimeUsingDurableNonce;
8735
9703
  exports.signAndSendTransactionMessageWithSigners = signAndSendTransactionMessageWithSigners;
8736
9704
  exports.signBytes = signBytes;
9705
+ exports.signOffchainMessageEnvelope = signOffchainMessageEnvelope;
9706
+ exports.signOffchainMessageWithSigners = signOffchainMessageWithSigners;
8737
9707
  exports.signTransaction = signTransaction;
8738
9708
  exports.signTransactionMessageWithSigners = signTransactionMessageWithSigners;
8739
9709
  exports.signature = signature;
@@ -8744,6 +9714,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
8744
9714
  exports.stringifiedBigInt = stringifiedBigInt;
8745
9715
  exports.stringifiedNumber = stringifiedNumber;
8746
9716
  exports.successfulSingleTransactionPlanResult = successfulSingleTransactionPlanResult;
9717
+ exports.successfulSingleTransactionPlanResultFromSignature = successfulSingleTransactionPlanResultFromSignature;
9718
+ exports.summarizeTransactionPlanResult = summarizeTransactionPlanResult;
8747
9719
  exports.testnet = testnet;
8748
9720
  exports.transformChannelInboundMessages = transformChannelInboundMessages;
8749
9721
  exports.transformChannelOutboundMessages = transformChannelOutboundMessages;
@@ -8755,6 +9727,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8755
9727
  exports.unwrapOptionRecursively = unwrapOptionRecursively;
8756
9728
  exports.upgradeRoleToSigner = upgradeRoleToSigner;
8757
9729
  exports.upgradeRoleToWritable = upgradeRoleToWritable;
9730
+ exports.verifyOffchainMessageEnvelope = verifyOffchainMessageEnvelope;
8758
9731
  exports.verifySignature = verifySignature;
8759
9732
  exports.wrapNullable = wrapNullable;
8760
9733