@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.
- package/dist/index.browser.js +0 -2
- package/dist/index.development.js +157 -93
- package/dist/index.development.js.map +1 -1
- package/dist/index.node.cjs +0 -2
- package/dist/index.production.min.js +23 -23
- package/package.json +12 -12
package/dist/index.browser.js
CHANGED
|
@@ -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 (
|
|
732
|
+
} catch (e3) {
|
|
733
733
|
throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
|
|
734
|
-
cause:
|
|
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 (
|
|
907
|
-
if (
|
|
906
|
+
} catch (e3) {
|
|
907
|
+
if (e3 instanceof PointOnCurveError) {
|
|
908
908
|
bumpSeed--;
|
|
909
909
|
} else {
|
|
910
|
-
throw
|
|
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
|
|
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 (
|
|
1017
|
+
} catch (e3) {
|
|
1018
1018
|
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
1019
|
-
cause:
|
|
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
|
-
|
|
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
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
"
|
|
1771
|
-
"
|
|
1772
|
-
]
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
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 ?
|
|
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 = (
|
|
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(
|
|
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;
|