@solana/web3.js 2.0.0-experimental.659134e → 2.0.0-experimental.6a124b1

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.
@@ -137,5 +137,3 @@ function createDefaultRpcTransport(config) {
137
137
  }
138
138
 
139
139
  export { createDefaultRpcTransport, createSolanaRpc };
140
- //# sourceMappingURL=out.js.map
141
- //# sourceMappingURL=index.browser.js.map
@@ -729,9 +729,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
729
729
  if (numBytes !== 32) {
730
730
  throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
731
731
  }
732
- } catch (e2) {
732
+ } catch (e3) {
733
733
  throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
734
- cause: e2
734
+ cause: e3
735
735
  });
736
736
  }
737
737
  }
@@ -903,17 +903,17 @@ this.globalThis.solanaWeb3 = (function (exports) {
903
903
  seeds: [...seeds, new Uint8Array([bumpSeed])]
904
904
  })
905
905
  };
906
- } catch (e2) {
907
- if (e2 instanceof PointOnCurveError) {
906
+ } catch (e3) {
907
+ if (e3 instanceof PointOnCurveError) {
908
908
  bumpSeed--;
909
909
  } else {
910
- throw e2;
910
+ throw e3;
911
911
  }
912
912
  }
913
913
  }
914
914
  throw new Error("Unable to find a viable program address bump seed");
915
915
  }
916
- async function getBase58EncodedAddressFromPublicKey(publicKey) {
916
+ async function getAddressFromPublicKey(publicKey) {
917
917
  await assertKeyExporterIsAvailable();
918
918
  if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
919
919
  throw new Error("The `CryptoKey` must be an `Ed25519` public key");
@@ -1014,9 +1014,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
1014
1014
  if (numBytes !== 32) {
1015
1015
  throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
1016
1016
  }
1017
- } catch (e2) {
1017
+ } catch (e3) {
1018
1018
  throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
1019
- cause: e2
1019
+ cause: e3
1020
1020
  });
1021
1021
  }
1022
1022
  }
@@ -1643,7 +1643,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1643
1643
  async function signTransaction(keyPair, transaction) {
1644
1644
  const compiledMessage = compileMessage(transaction);
1645
1645
  const [signerPublicKey, signature] = await Promise.all([
1646
- getBase58EncodedAddressFromPublicKey(keyPair.publicKey),
1646
+ getAddressFromPublicKey(keyPair.publicKey),
1647
1647
  getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
1648
1648
  ]);
1649
1649
  const nextSignatures = {
@@ -1736,86 +1736,150 @@ this.globalThis.solanaWeb3 = (function (exports) {
1736
1736
  return visitNode(params, [], onIntegerOverflow);
1737
1737
  }
1738
1738
  var KEYPATH_WILDCARD = {};
1739
- var ALLOWED_NUMERIC_KEYPATHS = {
1740
- getAccountInfo: [
1741
- // parsed AddressTableLookup account
1742
- ["value", "data", "parsed", "info", "lastExtendedSlotStartIndex"],
1743
- // parsed Config account
1744
- ["value", "data", "parsed", "info", "slashPenalty"],
1745
- ["value", "data", "parsed", "info", "warmupCooldownRate"],
1746
- // parsed Token/Token22 token account
1747
- ["value", "data", "parsed", "info", "tokenAmount", "decimals"],
1748
- ["value", "data", "parsed", "info", "tokenAmount", "uiAmount"],
1749
- ["value", "data", "parsed", "info", "rentExemptReserve", "decimals"],
1750
- ["value", "data", "parsed", "info", "delegatedAmount", "decimals"],
1751
- [
1752
- "value",
1753
- "data",
1754
- "parsed",
1755
- "info",
1756
- "extensions",
1757
- KEYPATH_WILDCARD,
1758
- "state",
1759
- "olderTransferFee",
1760
- "transferFeeBasisPoints"
1761
- ],
1762
- [
1763
- "value",
1764
- "data",
1765
- "parsed",
1766
- "info",
1767
- "extensions",
1768
- KEYPATH_WILDCARD,
1769
- "state",
1770
- "newerTransferFee",
1771
- "transferFeeBasisPoints"
1772
- ],
1773
- ["value", "data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "preUpdateAverageRate"],
1774
- ["value", "data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "currentRate"],
1775
- // parsed Token/Token22 mint account
1776
- ["value", "data", "parsed", "info", "decimals"],
1777
- // parsed Token/Token22 multisig account
1778
- ["value", "data", "parsed", "info", "numRequiredSigners"],
1779
- ["value", "data", "parsed", "info", "numValidSigners"],
1780
- // parsed Stake account
1781
- ["value", "data", "parsed", "info", "stake", "delegation", "warmupCooldownRate"],
1782
- // parsed Sysvar rent account
1783
- ["value", "data", "parsed", "info", "exemptionThreshold"],
1784
- ["value", "data", "parsed", "info", "burnPercent"],
1785
- // parsed Vote account
1786
- ["value", "data", "parsed", "info", "commission"],
1787
- ["value", "data", "parsed", "info", "votes", KEYPATH_WILDCARD, "confirmationCount"]
1788
- ],
1789
- getBlockTime: [[]],
1790
- getInflationGovernor: [["initial"], ["foundation"], ["foundationTerm"], ["taper"], ["terminal"]],
1791
- getInflationReward: [[KEYPATH_WILDCARD, "commission"]],
1792
- getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]],
1793
- getTokenLargestAccounts: [
1794
- ["value", KEYPATH_WILDCARD, "decimals"],
1795
- ["value", KEYPATH_WILDCARD, "uiAmount"]
1796
- ],
1797
- getTransaction: [
1798
- ["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
1799
- ["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
1800
- ["meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
1801
- ["meta", "postTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
1802
- ["meta", "rewards", KEYPATH_WILDCARD, "commission"],
1803
- ["meta", "innerInstructions", KEYPATH_WILDCARD, "index"],
1804
- ["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "programIdIndex"],
1805
- ["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD],
1806
- ["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "writableIndexes", KEYPATH_WILDCARD],
1807
- ["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "readonlyIndexes", KEYPATH_WILDCARD],
1808
- ["transaction", "message", "instructions", KEYPATH_WILDCARD, "programIdIndex"],
1809
- ["transaction", "message", "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD],
1810
- ["transaction", "message", "header", "numReadonlySignedAccounts"],
1811
- ["transaction", "message", "header", "numReadonlyUnsignedAccounts"],
1812
- ["transaction", "message", "header", "numRequiredSignatures"]
1813
- ],
1814
- getVoteAccounts: [
1815
- ["current", KEYPATH_WILDCARD, "commission"],
1816
- ["delinquent", KEYPATH_WILDCARD, "commission"]
1817
- ]
1818
- };
1739
+ var memoizedKeypaths;
1740
+ function getAllowedNumericKeypaths() {
1741
+ if (!memoizedKeypaths) {
1742
+ const jsonParsedTokenAccountsConfigs = [
1743
+ // parsed Token/Token22 token account
1744
+ ["data", "parsed", "info", "tokenAmount", "decimals"],
1745
+ ["data", "parsed", "info", "tokenAmount", "uiAmount"],
1746
+ ["data", "parsed", "info", "rentExemptReserve", "decimals"],
1747
+ ["data", "parsed", "info", "rentExemptReserve", "uiAmount"],
1748
+ ["data", "parsed", "info", "delegatedAmount", "decimals"],
1749
+ ["data", "parsed", "info", "delegatedAmount", "uiAmount"],
1750
+ [
1751
+ "data",
1752
+ "parsed",
1753
+ "info",
1754
+ "extensions",
1755
+ KEYPATH_WILDCARD,
1756
+ "state",
1757
+ "olderTransferFee",
1758
+ "transferFeeBasisPoints"
1759
+ ],
1760
+ [
1761
+ "data",
1762
+ "parsed",
1763
+ "info",
1764
+ "extensions",
1765
+ KEYPATH_WILDCARD,
1766
+ "state",
1767
+ "newerTransferFee",
1768
+ "transferFeeBasisPoints"
1769
+ ],
1770
+ ["data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "preUpdateAverageRate"],
1771
+ ["data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "currentRate"]
1772
+ ];
1773
+ const jsonParsedAccountsConfigs = [
1774
+ ...jsonParsedTokenAccountsConfigs,
1775
+ // parsed AddressTableLookup account
1776
+ ["data", "parsed", "info", "lastExtendedSlotStartIndex"],
1777
+ // parsed Config account
1778
+ ["data", "parsed", "info", "slashPenalty"],
1779
+ ["data", "parsed", "info", "warmupCooldownRate"],
1780
+ // parsed Token/Token22 mint account
1781
+ ["data", "parsed", "info", "decimals"],
1782
+ // parsed Token/Token22 multisig account
1783
+ ["data", "parsed", "info", "numRequiredSigners"],
1784
+ ["data", "parsed", "info", "numValidSigners"],
1785
+ // parsed Stake account
1786
+ ["data", "parsed", "info", "stake", "delegation", "warmupCooldownRate"],
1787
+ // parsed Sysvar rent account
1788
+ ["data", "parsed", "info", "exemptionThreshold"],
1789
+ ["data", "parsed", "info", "burnPercent"],
1790
+ // parsed Vote account
1791
+ ["data", "parsed", "info", "commission"],
1792
+ ["data", "parsed", "info", "votes", KEYPATH_WILDCARD, "confirmationCount"]
1793
+ ];
1794
+ memoizedKeypaths = {
1795
+ getAccountInfo: jsonParsedAccountsConfigs.map((c) => ["value", ...c]),
1796
+ getBlockTime: [[]],
1797
+ getClusterNodes: [
1798
+ [KEYPATH_WILDCARD, "featureSet"],
1799
+ [KEYPATH_WILDCARD, "shredVersion"]
1800
+ ],
1801
+ getInflationGovernor: [["initial"], ["foundation"], ["foundationTerm"], ["taper"], ["terminal"]],
1802
+ getInflationRate: [["foundation"], ["total"], ["validator"]],
1803
+ getInflationReward: [[KEYPATH_WILDCARD, "commission"]],
1804
+ getMultipleAccounts: jsonParsedAccountsConfigs.map((c) => ["value", KEYPATH_WILDCARD, ...c]),
1805
+ getProgramAccounts: jsonParsedAccountsConfigs.flatMap((c) => [
1806
+ ["value", KEYPATH_WILDCARD, "account", ...c],
1807
+ [KEYPATH_WILDCARD, "account", ...c]
1808
+ ]),
1809
+ getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]],
1810
+ getTokenAccountBalance: [
1811
+ ["value", "decimals"],
1812
+ ["value", "uiAmount"]
1813
+ ],
1814
+ getTokenAccountsByDelegate: jsonParsedTokenAccountsConfigs.map((c) => [
1815
+ "value",
1816
+ KEYPATH_WILDCARD,
1817
+ "account",
1818
+ ...c
1819
+ ]),
1820
+ getTokenAccountsByOwner: jsonParsedTokenAccountsConfigs.map((c) => [
1821
+ "value",
1822
+ KEYPATH_WILDCARD,
1823
+ "account",
1824
+ ...c
1825
+ ]),
1826
+ getTokenLargestAccounts: [
1827
+ ["value", KEYPATH_WILDCARD, "decimals"],
1828
+ ["value", KEYPATH_WILDCARD, "uiAmount"]
1829
+ ],
1830
+ getTokenSupply: [
1831
+ ["value", "decimals"],
1832
+ ["value", "uiAmount"]
1833
+ ],
1834
+ getTransaction: [
1835
+ ["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
1836
+ ["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
1837
+ ["meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
1838
+ ["meta", "postTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
1839
+ ["meta", "rewards", KEYPATH_WILDCARD, "commission"],
1840
+ ["meta", "innerInstructions", KEYPATH_WILDCARD, "index"],
1841
+ ["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "programIdIndex"],
1842
+ [
1843
+ "meta",
1844
+ "innerInstructions",
1845
+ KEYPATH_WILDCARD,
1846
+ "instructions",
1847
+ KEYPATH_WILDCARD,
1848
+ "accounts",
1849
+ KEYPATH_WILDCARD
1850
+ ],
1851
+ [
1852
+ "transaction",
1853
+ "message",
1854
+ "addressTableLookups",
1855
+ KEYPATH_WILDCARD,
1856
+ "writableIndexes",
1857
+ KEYPATH_WILDCARD
1858
+ ],
1859
+ [
1860
+ "transaction",
1861
+ "message",
1862
+ "addressTableLookups",
1863
+ KEYPATH_WILDCARD,
1864
+ "readonlyIndexes",
1865
+ KEYPATH_WILDCARD
1866
+ ],
1867
+ ["transaction", "message", "instructions", KEYPATH_WILDCARD, "programIdIndex"],
1868
+ ["transaction", "message", "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD],
1869
+ ["transaction", "message", "header", "numReadonlySignedAccounts"],
1870
+ ["transaction", "message", "header", "numReadonlyUnsignedAccounts"],
1871
+ ["transaction", "message", "header", "numRequiredSignatures"]
1872
+ ],
1873
+ getVersion: [["feature-set"]],
1874
+ getVoteAccounts: [
1875
+ ["current", KEYPATH_WILDCARD, "commission"],
1876
+ ["delinquent", KEYPATH_WILDCARD, "commission"]
1877
+ ],
1878
+ simulateTransaction: jsonParsedAccountsConfigs.map((c) => ["value", "accounts", KEYPATH_WILDCARD, ...c])
1879
+ };
1880
+ }
1881
+ return memoizedKeypaths;
1882
+ }
1819
1883
  function getNextAllowedKeypaths(keyPaths, property) {
1820
1884
  return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1));
1821
1885
  }
@@ -1842,7 +1906,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1842
1906
  }
1843
1907
  }
1844
1908
  function patchResponseForSolanaLabsRpc(rawResponse, methodName) {
1845
- const allowedKeypaths = methodName ? ALLOWED_NUMERIC_KEYPATHS[methodName] : void 0;
1909
+ const allowedKeypaths = methodName ? getAllowedNumericKeypaths()[methodName] : void 0;
1846
1910
  return visitNode2(rawResponse, allowedKeypaths ?? []);
1847
1911
  }
1848
1912
  function createSolanaRpcApi(config) {
@@ -2119,14 +2183,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
2119
2183
  if (signal) {
2120
2184
  const responsePromise = coalescedRequest.responsePromise;
2121
2185
  return await new Promise((resolve, reject) => {
2122
- const handleAbort = (e2) => {
2186
+ const handleAbort = (e3) => {
2123
2187
  signal.removeEventListener("abort", handleAbort);
2124
2188
  coalescedRequest.numConsumers -= 1;
2125
2189
  if (coalescedRequest.numConsumers === 0) {
2126
2190
  const abortController = coalescedRequest.abortController;
2127
2191
  abortController.abort();
2128
2192
  }
2129
- const abortError = new DOMException(e2.target.reason, "AbortError");
2193
+ const abortError = new DOMException(e3.target.reason, "AbortError");
2130
2194
  reject(abortError);
2131
2195
  };
2132
2196
  signal.addEventListener("abort", handleAbort);
@@ -2187,9 +2251,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
2187
2251
  exports.downgradeRoleToNonSigner = downgradeRoleToNonSigner;
2188
2252
  exports.downgradeRoleToReadonly = downgradeRoleToReadonly;
2189
2253
  exports.generateKeyPair = generateKeyPair;
2254
+ exports.getAddressFromPublicKey = getAddressFromPublicKey;
2190
2255
  exports.getBase58EncodedAddressCodec = getBase58EncodedAddressCodec;
2191
2256
  exports.getBase58EncodedAddressComparator = getBase58EncodedAddressComparator;
2192
- exports.getBase58EncodedAddressFromPublicKey = getBase58EncodedAddressFromPublicKey;
2193
2257
  exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
2194
2258
  exports.getProgramDerivedAddress = getProgramDerivedAddress;
2195
2259
  exports.isSignerRole = isSignerRole;