@solana/web3.js 2.0.0-rc.3 → 2.0.0-rc.4
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.development.js +12 -20
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +175 -175
- package/package.json +19 -27
@@ -661,6 +661,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
661
661
|
"BuiltinProgramsMustConsumeComputeUnits"
|
662
662
|
];
|
663
663
|
function getSolanaErrorFromInstructionError(index, instructionError) {
|
664
|
+
const numberIndex = Number(index);
|
664
665
|
return getSolanaErrorFromRpcError(
|
665
666
|
{
|
666
667
|
errorCodeBaseOffset: 4615001,
|
@@ -668,21 +669,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
668
669
|
if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN) {
|
669
670
|
return {
|
670
671
|
errorName: rpcErrorName,
|
671
|
-
index,
|
672
|
+
index: numberIndex,
|
672
673
|
...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null
|
673
674
|
};
|
674
675
|
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM) {
|
675
676
|
return {
|
676
|
-
code: rpcErrorContext,
|
677
|
-
index
|
677
|
+
code: Number(rpcErrorContext),
|
678
|
+
index: numberIndex
|
678
679
|
};
|
679
680
|
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR) {
|
680
681
|
return {
|
681
682
|
encodedData: rpcErrorContext,
|
682
|
-
index
|
683
|
+
index: numberIndex
|
683
684
|
};
|
684
685
|
}
|
685
|
-
return { index };
|
686
|
+
return { index: numberIndex };
|
686
687
|
},
|
687
688
|
orderedErrorNames: ORDERED_ERROR_NAMES,
|
688
689
|
rpcEnumError: instructionError
|
@@ -749,11 +750,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
749
750
|
};
|
750
751
|
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION) {
|
751
752
|
return {
|
752
|
-
index: rpcErrorContext
|
753
|
+
index: Number(rpcErrorContext)
|
753
754
|
};
|
754
755
|
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) {
|
755
756
|
return {
|
756
|
-
accountIndex: rpcErrorContext.account_index
|
757
|
+
accountIndex: Number(rpcErrorContext.account_index)
|
757
758
|
};
|
758
759
|
}
|
759
760
|
},
|
@@ -763,8 +764,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
763
764
|
getSolanaErrorFromTransactionError
|
764
765
|
);
|
765
766
|
}
|
766
|
-
function getSolanaErrorFromJsonRpcError({ code, data, message }) {
|
767
|
+
function getSolanaErrorFromJsonRpcError({ code: rawCode, data, message }) {
|
767
768
|
let out;
|
769
|
+
const code = Number(rawCode);
|
768
770
|
if (code === SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE) {
|
769
771
|
const { err, ...preflightErrorContext } = data;
|
770
772
|
const causeObject = err ? { cause: getSolanaErrorFromTransactionError(err) } : null;
|
@@ -3974,20 +3976,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
3974
3976
|
function createHttpTransportForSolanaRpc(config) {
|
3975
3977
|
return createHttpTransport({
|
3976
3978
|
...config,
|
3977
|
-
fromJson: (rawResponse, payload) =>
|
3978
|
-
if (!isSolanaRequest(payload)) return JSON.parse(rawResponse);
|
3979
|
-
const response = parseJsonWithBigInts(rawResponse);
|
3980
|
-
if (isErrorResponse(response)) {
|
3981
|
-
return { ...response, error: { ...response.error, code: Number(response.error.code) } };
|
3982
|
-
}
|
3983
|
-
return response;
|
3984
|
-
},
|
3979
|
+
fromJson: (rawResponse, payload) => isSolanaRequest(payload) ? parseJsonWithBigInts(rawResponse) : JSON.parse(rawResponse),
|
3985
3980
|
toJson: (payload) => isSolanaRequest(payload) ? stringifyJsonWithBigints(payload) : JSON.stringify(payload)
|
3986
3981
|
});
|
3987
3982
|
}
|
3988
|
-
function isErrorResponse(value) {
|
3989
|
-
return !!value && typeof value === "object" && "error" in value && !!value.error && typeof value.error === "object" && "code" in value.error;
|
3990
|
-
}
|
3991
3983
|
|
3992
3984
|
// ../fast-stable-stringify/dist/index.browser.mjs
|
3993
3985
|
var objToString = Object.prototype.toString;
|
@@ -4186,7 +4178,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
4186
4178
|
...config.headers ? normalizeHeaders2(config.headers) : void 0,
|
4187
4179
|
...{
|
4188
4180
|
// Keep these headers lowercase so they will override any user-supplied headers above.
|
4189
|
-
"solana-client": `js/${"2.0.0-rc.
|
4181
|
+
"solana-client": `js/${"2.0.0-rc.4"}`
|
4190
4182
|
}
|
4191
4183
|
}
|
4192
4184
|
}),
|