@solana/web3.js 2.0.0-experimental.585314d → 2.0.0-experimental.5c3e7e8
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 +153 -89
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +26 -26
- package/package.json +14 -14
package/dist/index.browser.js
CHANGED
|
@@ -913,7 +913,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
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");
|
|
@@ -1484,7 +1484,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1484
1484
|
)
|
|
1485
1485
|
],
|
|
1486
1486
|
[
|
|
1487
|
-
"
|
|
1487
|
+
"accountIndices",
|
|
1488
1488
|
array(
|
|
1489
1489
|
u8({
|
|
1490
1490
|
description: "The index of an account, according to the well-ordered accounts list for this transaction"
|
|
@@ -1504,23 +1504,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1504
1504
|
]
|
|
1505
1505
|
]),
|
|
1506
1506
|
(value) => {
|
|
1507
|
-
if (value.
|
|
1507
|
+
if (value.accountIndices !== void 0 && value.data !== void 0) {
|
|
1508
1508
|
return value;
|
|
1509
1509
|
}
|
|
1510
1510
|
return {
|
|
1511
1511
|
...value,
|
|
1512
|
-
|
|
1512
|
+
accountIndices: value.accountIndices ?? [],
|
|
1513
1513
|
data: value.data ?? new Uint8Array(0)
|
|
1514
1514
|
};
|
|
1515
1515
|
},
|
|
1516
1516
|
(value) => {
|
|
1517
|
-
if (value.
|
|
1517
|
+
if (value.accountIndices.length && value.data.byteLength) {
|
|
1518
1518
|
return value;
|
|
1519
1519
|
}
|
|
1520
|
-
const {
|
|
1520
|
+
const { accountIndices, data, ...rest } = value;
|
|
1521
1521
|
return {
|
|
1522
1522
|
...rest,
|
|
1523
|
-
...
|
|
1523
|
+
...accountIndices.length ? { accountIndices } : null,
|
|
1524
1524
|
...data.byteLength ? { data } : null
|
|
1525
1525
|
};
|
|
1526
1526
|
}
|
|
@@ -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,85 +1736,149 @@ 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
|
-
|
|
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
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
return memoizedKeypaths;
|
|
1881
|
+
}
|
|
1818
1882
|
function getNextAllowedKeypaths(keyPaths, property) {
|
|
1819
1883
|
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1));
|
|
1820
1884
|
}
|
|
@@ -1841,7 +1905,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1841
1905
|
}
|
|
1842
1906
|
}
|
|
1843
1907
|
function patchResponseForSolanaLabsRpc(rawResponse, methodName) {
|
|
1844
|
-
const allowedKeypaths = methodName ?
|
|
1908
|
+
const allowedKeypaths = methodName ? getAllowedNumericKeypaths()[methodName] : void 0;
|
|
1845
1909
|
return visitNode2(rawResponse, allowedKeypaths ?? []);
|
|
1846
1910
|
}
|
|
1847
1911
|
function createSolanaRpcApi(config) {
|
|
@@ -2186,9 +2250,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2186
2250
|
exports.downgradeRoleToNonSigner = downgradeRoleToNonSigner;
|
|
2187
2251
|
exports.downgradeRoleToReadonly = downgradeRoleToReadonly;
|
|
2188
2252
|
exports.generateKeyPair = generateKeyPair;
|
|
2253
|
+
exports.getAddressFromPublicKey = getAddressFromPublicKey;
|
|
2189
2254
|
exports.getBase58EncodedAddressCodec = getBase58EncodedAddressCodec;
|
|
2190
2255
|
exports.getBase58EncodedAddressComparator = getBase58EncodedAddressComparator;
|
|
2191
|
-
exports.getBase58EncodedAddressFromPublicKey = getBase58EncodedAddressFromPublicKey;
|
|
2192
2256
|
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
2193
2257
|
exports.getProgramDerivedAddress = getProgramDerivedAddress;
|
|
2194
2258
|
exports.isSignerRole = isSignerRole;
|