@solana/web3.js 2.0.0-rc.4 → 2.0.1-canary-20241112013415

Sign up to get free protection for your applications and to get access to all the features.
@@ -2711,6 +2711,37 @@ this.globalThis.solanaWeb3 = (function (exports) {
2711
2711
  function getHiddenSuffixCodec(codec, suffixedCodecs) {
2712
2712
  return combineCodec(getHiddenSuffixEncoder(codec, suffixedCodecs), getHiddenSuffixDecoder(codec, suffixedCodecs));
2713
2713
  }
2714
+ function getLiteralUnionEncoder(variants, config = {}) {
2715
+ var _a;
2716
+ const discriminator = (_a = config.size) != null ? _a : getU8Encoder();
2717
+ return transformEncoder(discriminator, (variant) => {
2718
+ const index = variants.indexOf(variant);
2719
+ if (index < 0) {
2720
+ throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT, {
2721
+ value: variant,
2722
+ variants
2723
+ });
2724
+ }
2725
+ return index;
2726
+ });
2727
+ }
2728
+ function getLiteralUnionDecoder(variants, config = {}) {
2729
+ var _a;
2730
+ const discriminator = (_a = config.size) != null ? _a : getU8Decoder();
2731
+ return transformDecoder(discriminator, (index) => {
2732
+ if (index < 0 || index >= variants.length) {
2733
+ throw new SolanaError(SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE, {
2734
+ discriminator: index,
2735
+ maxRange: variants.length - 1,
2736
+ minRange: 0
2737
+ });
2738
+ }
2739
+ return variants[Number(index)];
2740
+ });
2741
+ }
2742
+ function getLiteralUnionCodec(variants, config = {}) {
2743
+ return combineCodec(getLiteralUnionEncoder(variants, config), getLiteralUnionDecoder(variants, config));
2744
+ }
2714
2745
  function getMapEncoder(key, value, config = {}) {
2715
2746
  return transformEncoder(
2716
2747
  getArrayEncoder(getTupleEncoder([key, value]), config),
@@ -4178,7 +4209,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
4178
4209
  ...config.headers ? normalizeHeaders2(config.headers) : void 0,
4179
4210
  ...{
4180
4211
  // Keep these headers lowercase so they will override any user-supplied headers above.
4181
- "solana-client": `js/${"2.0.0-rc.4"}`
4212
+ "solana-client": `js/${"2.0.1-canary-20241112013415"}`
4182
4213
  }
4183
4214
  }
4184
4215
  }),
@@ -7899,6 +7930,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
7899
7930
  exports.getLamportsCodec = getLamportsCodec;
7900
7931
  exports.getLamportsDecoder = getLamportsDecoder;
7901
7932
  exports.getLamportsEncoder = getLamportsEncoder;
7933
+ exports.getLiteralUnionCodec = getLiteralUnionCodec;
7934
+ exports.getLiteralUnionDecoder = getLiteralUnionDecoder;
7935
+ exports.getLiteralUnionEncoder = getLiteralUnionEncoder;
7902
7936
  exports.getMapCodec = getMapCodec;
7903
7937
  exports.getMapDecoder = getMapDecoder;
7904
7938
  exports.getMapEncoder = getMapEncoder;