@solana/web3.js 2.0.0-experimental.dc614af → 2.0.0-experimental.e09b513
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.cjs
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,16 +903,37 @@ 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 createAddressWithSeed({
|
|
917
|
+
baseAddress,
|
|
918
|
+
programAddress,
|
|
919
|
+
seed
|
|
920
|
+
}) {
|
|
921
|
+
const { serialize: serialize4, deserialize: deserialize2 } = getBase58EncodedAddressCodec();
|
|
922
|
+
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
923
|
+
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
924
|
+
throw new Error(`The seed exceeds the maximum length of 32 bytes`);
|
|
925
|
+
}
|
|
926
|
+
const programAddressBytes = serialize4(programAddress);
|
|
927
|
+
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
928
|
+
throw new Error(`programAddress cannot end with the PDA marker`);
|
|
929
|
+
}
|
|
930
|
+
const addressBytesBuffer = await crypto.subtle.digest(
|
|
931
|
+
"SHA-256",
|
|
932
|
+
new Uint8Array([...serialize4(baseAddress), ...seedBytes, ...programAddressBytes])
|
|
933
|
+
);
|
|
934
|
+
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
935
|
+
return deserialize2(addressBytes)[0];
|
|
936
|
+
}
|
|
916
937
|
async function getAddressFromPublicKey(publicKey) {
|
|
917
938
|
await assertKeyExporterIsAvailable();
|
|
918
939
|
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
@@ -1014,9 +1035,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1014
1035
|
if (numBytes !== 32) {
|
|
1015
1036
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
1016
1037
|
}
|
|
1017
|
-
} catch (
|
|
1038
|
+
} catch (e3) {
|
|
1018
1039
|
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
1019
|
-
cause:
|
|
1040
|
+
cause: e3
|
|
1020
1041
|
});
|
|
1021
1042
|
}
|
|
1022
1043
|
}
|
|
@@ -1874,7 +1895,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1874
1895
|
getVoteAccounts: [
|
|
1875
1896
|
["current", KEYPATH_WILDCARD, "commission"],
|
|
1876
1897
|
["delinquent", KEYPATH_WILDCARD, "commission"]
|
|
1877
|
-
]
|
|
1898
|
+
],
|
|
1899
|
+
simulateTransaction: jsonParsedAccountsConfigs.map((c) => ["value", "accounts", KEYPATH_WILDCARD, ...c])
|
|
1878
1900
|
};
|
|
1879
1901
|
}
|
|
1880
1902
|
return memoizedKeypaths;
|
|
@@ -2182,14 +2204,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2182
2204
|
if (signal) {
|
|
2183
2205
|
const responsePromise = coalescedRequest.responsePromise;
|
|
2184
2206
|
return await new Promise((resolve, reject) => {
|
|
2185
|
-
const handleAbort = (
|
|
2207
|
+
const handleAbort = (e3) => {
|
|
2186
2208
|
signal.removeEventListener("abort", handleAbort);
|
|
2187
2209
|
coalescedRequest.numConsumers -= 1;
|
|
2188
2210
|
if (coalescedRequest.numConsumers === 0) {
|
|
2189
2211
|
const abortController = coalescedRequest.abortController;
|
|
2190
2212
|
abortController.abort();
|
|
2191
2213
|
}
|
|
2192
|
-
const abortError = new DOMException(
|
|
2214
|
+
const abortError = new DOMException(e3.target.reason, "AbortError");
|
|
2193
2215
|
reject(abortError);
|
|
2194
2216
|
};
|
|
2195
2217
|
signal.addEventListener("abort", handleAbort);
|
|
@@ -2244,6 +2266,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2244
2266
|
exports.assertIsBase58EncodedAddress = assertIsBase58EncodedAddress;
|
|
2245
2267
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
2246
2268
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
2269
|
+
exports.createAddressWithSeed = createAddressWithSeed;
|
|
2247
2270
|
exports.createDefaultRpcTransport = createDefaultRpcTransport;
|
|
2248
2271
|
exports.createSolanaRpc = createSolanaRpc;
|
|
2249
2272
|
exports.createTransaction = createTransaction;
|