@solana/kit 4.0.0-canary-20251007224953 → 4.0.0-canary-20251008190231

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.
@@ -229,6 +229,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
229
229
  var SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL = 8078020;
230
230
  var SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES = 8078021;
231
231
  var SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS = 8078022;
232
+ var SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY = 8078023;
232
233
  var SOLANA_ERROR__RPC__INTEGER_OVERFLOW = 81e5;
233
234
  var SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN = 8100001;
234
235
  var SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR = 8100002;
@@ -288,6 +289,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
288
289
  [SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE]: "Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",
289
290
  [SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES]: "Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",
290
291
  [SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE]: "Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",
292
+ [SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY]: "This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",
291
293
  [SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED]: "No random values implementation could be found.",
292
294
  [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED]: "instruction requires an uninitialized account",
293
295
  [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED]: "instruction tries to borrow reference for an account which is already borrowed",
@@ -1091,6 +1093,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
1091
1093
  function addCodecSizePrefix(codec, prefix) {
1092
1094
  return combineCodec(addEncoderSizePrefix(codec, prefix), addDecoderSizePrefix(codec, prefix));
1093
1095
  }
1096
+ function createDecoderThatConsumesEntireByteArray(decoder) {
1097
+ return createDecoder({
1098
+ ...decoder,
1099
+ read(bytes, offset) {
1100
+ const [value, newOffset] = decoder.read(bytes, offset);
1101
+ if (bytes.length > newOffset) {
1102
+ throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY, {
1103
+ expectedLength: newOffset,
1104
+ numExcessBytes: bytes.length - newOffset
1105
+ });
1106
+ }
1107
+ return [value, newOffset];
1108
+ }
1109
+ });
1110
+ }
1094
1111
  function fixEncoderSize(encoder, fixedBytes) {
1095
1112
  return createEncoder({
1096
1113
  fixedSize: fixedBytes,
@@ -3919,7 +3936,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
3919
3936
  }
3920
3937
  }
3921
3938
  function compressTransactionMessageUsingAddressLookupTables(transactionMessage, addressesByLookupTableAddress) {
3922
- const lookupTableAddresses = new Set(Object.values(addressesByLookupTableAddress).flatMap((a) => a));
3939
+ const programAddresses = new Set(transactionMessage.instructions.map((ix) => ix.programAddress));
3940
+ const eligibleLookupAddresses = new Set(
3941
+ Object.values(addressesByLookupTableAddress).flatMap((a) => a).filter((address2) => !programAddresses.has(address2))
3942
+ );
3923
3943
  const newInstructions = [];
3924
3944
  let updatedAnyInstructions = false;
3925
3945
  for (const instruction of transactionMessage.instructions) {
@@ -3930,7 +3950,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
3930
3950
  const newAccounts = [];
3931
3951
  let updatedAnyAccounts = false;
3932
3952
  for (const account of instruction.accounts) {
3933
- if ("lookupTableAddress" in account || !lookupTableAddresses.has(account.address) || isSignerRole(account.role)) {
3953
+ if ("lookupTableAddress" in account || !eligibleLookupAddresses.has(account.address) || isSignerRole(account.role)) {
3934
3954
  newAccounts.push(account);
3935
3955
  continue;
3936
3956
  }
@@ -6190,7 +6210,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
6190
6210
  ...config.headers ? normalizeHeaders2(config.headers) : void 0,
6191
6211
  ...{
6192
6212
  // Keep these headers lowercase so they will override any user-supplied headers above.
6193
- "solana-client": `js/${"4.0.0-canary-20251007224953"}`
6213
+ "solana-client": `js/${"4.0.0-canary-20251008190231"}`
6194
6214
  }
6195
6215
  }
6196
6216
  }),
@@ -8129,6 +8149,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8129
8149
  exports.SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH = SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH;
8130
8150
  exports.SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH;
8131
8151
  exports.SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE = SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE;
8152
+ exports.SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY = SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY;
8132
8153
  exports.SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH = SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH;
8133
8154
  exports.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH = SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH;
8134
8155
  exports.SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH = SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH;
@@ -8410,6 +8431,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
8410
8431
  exports.createAddressWithSeed = createAddressWithSeed;
8411
8432
  exports.createCodec = createCodec;
8412
8433
  exports.createDecoder = createDecoder;
8434
+ exports.createDecoderThatConsumesEntireByteArray = createDecoderThatConsumesEntireByteArray;
8413
8435
  exports.createDefaultRpcSubscriptionsChannelCreator = createDefaultRpcSubscriptionsChannelCreator;
8414
8436
  exports.createDefaultRpcSubscriptionsTransport = createDefaultRpcSubscriptionsTransport;
8415
8437
  exports.createDefaultRpcTransport = createDefaultRpcTransport;