FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

41
node_modules/@wallet-standard/errors/lib/cjs/codes.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors/#adding-a-new-error
*
* WARNING:
* - Don't remove error codes
* - Don't change or reorder error codes.
*
* Good naming conventions:
* - Prefixing common errors — e.g. under the same package — can be a good way to namespace them. E.g. All codec-related errors start with `WALLET_STANDARD_ERROR__ACCOUNT__`.
* - Use consistent names — e.g. choose `PDA` or `PROGRAM_DERIVED_ADDRESS` and stick with it. Ensure your names are consistent with existing error codes. The decision might have been made for you.
* - Recommended prefixes and suffixes:
* - `MALFORMED_`: Some input was not constructed properly. E.g. `MALFORMED_BASE58_ENCODED_ADDRESS`.
* - `INVALID_`: Some input is invalid (other than because it was MALFORMED). E.g. `INVALID_NUMBER_OF_BYTES`.
* - `EXPECTED_`: Some input was different than expected, no need to specify the "GOT" part unless necessary. E.g. `EXPECTED_DECODED_ACCOUNT`.
* - `_CANNOT_`: Some operation cannot be performed or some input cannot be used due to some condition. E.g. `CANNOT_DECODE_EMPTY_BYTE_ARRAY` or `PDA_CANNOT_END_WITH_PDA_MARKER`.
* - `_MUST_BE_`: Some condition must be true. E.g. `NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE`.
* - `_FAILED_TO_`: Tried to perform some operation and failed. E.g. `FAILED_TO_DECODE_ACCOUNT`.
* - `_NOT_FOUND`: Some operation lead to not finding something. E.g. `ACCOUNT_NOT_FOUND`.
* - `_OUT_OF_RANGE`: Some value is out of range. E.g. `ENUM_DISCRIMINATOR_OUT_OF_RANGE`.
* - `_EXCEEDED`: Some limit was exceeded. E.g. `PDA_MAX_SEED_LENGTH_EXCEEDED`.
* - `_MISMATCH`: Some elements do not match. E.g. `ENCODER_DECODER_FIXED_SIZE_MISMATCH`.
* - `_MISSING`: Some required input is missing. E.g. `TRANSACTION_FEE_PAYER_MISSING`.
* - `_UNIMPLEMENTED`: Some required component is not available in the environment. E.g. `SUBTLE_CRYPTO_VERIFY_FUNCTION_UNIMPLEMENTED`.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED = exports.WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED = exports.WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED = exports.WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED = exports.WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND = exports.WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND = void 0;
// Registry-related errors.
// Reserve error codes in the range [3834000-3834999].
exports.WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND = 3834000;
exports.WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND = 3834001;
// User-related errors.
// Reserve error codes in the range [4001000-4001999].
exports.WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED = 4001000;
// Feature-related errors.
// Reserve error codes in the range [6160000-6160999].
exports.WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED = 6160000;
exports.WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED = 6160001;
exports.WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED = 6160002;
//# sourceMappingURL=codes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../../src/codes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AAEH,2BAA2B;AAC3B,sDAAsD;AACzC,QAAA,iDAAiD,GAAG,OAAgB,CAAC;AACrE,QAAA,yDAAyD,GAAG,OAAgB,CAAC;AAE1F,uBAAuB;AACvB,sDAAsD;AACzC,QAAA,6CAA6C,GAAG,OAAgB,CAAC;AAE9E,0BAA0B;AAC1B,sDAAsD;AACzC,QAAA,iEAAiE,GAAG,OAAgB,CAAC;AACrF,QAAA,qEAAqE,GAAG,OAAgB,CAAC;AACzF,QAAA,6DAA6D,GAAG,OAAgB,CAAC"}

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeEncodedContext = decodeEncodedContext;
exports.encodeContextObject = encodeContextObject;
function decodeEncodedContext(encodedContext) {
const decodedUrlString = atob(encodedContext);
return Object.fromEntries(new URLSearchParams(decodedUrlString).entries());
}
function encodeValue(value) {
if (Array.isArray(value)) {
const commaSeparatedValues = value.map(encodeValue).join('%2C%20' /* ", " */);
return '%5B' /* "[" */ + commaSeparatedValues + /* "]" */ '%5D';
}
else if (typeof value === 'bigint') {
return `${value}n`;
}
else {
return encodeURIComponent(String(value != null && Object.getPrototypeOf(value) === null
? // Plain objects with no prototype don't have a `toString` method.
Object.assign({}, value) : value));
}
}
function encodeObjectContextEntry([key, value]) {
return `${key}=${encodeValue(value)}`;
}
function encodeContextObject(context) {
const searchParamsString = Object.entries(context).map(encodeObjectContextEntry).join('&');
return btoa(searchParamsString);
}
//# sourceMappingURL=context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";;AA6CA,oDAGC;AAyBD,kDAGC;AA/BD,SAAgB,oBAAoB,CAAC,cAAsB;IACvD,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,eAAe,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,oBAAoB,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC9E,OAAO,KAAK,CAAC,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAAC,KAAK,CAAC;IACpE,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,GAAG,KAAK,GAAG,CAAC;IACvB,CAAC;SAAM,CAAC;QACJ,OAAO,kBAAkB,CACrB,MAAM,CACF,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI;YAClD,CAAC,CAAC,kEAAkE;+BAE5D,KAAgB,EACxB,CAAC,CAAC,KAAK,CACd,CACJ,CAAC;IACN,CAAC;AACL,CAAC;AAED,SAAS,wBAAwB,CAAC,CAAC,GAAG,EAAE,KAAK,CAAoB;IAC7D,OAAO,GAAG,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1C,CAAC;AAED,SAAgB,mBAAmB,CAAC,OAAe;IAC/C,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3F,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACpC,CAAC"}

50
node_modules/@wallet-standard/errors/lib/cjs/error.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WalletStandardError = void 0;
exports.isWalletStandardError = isWalletStandardError;
const message_formatter_js_1 = require("./message-formatter.js");
function isWalletStandardError(e, code) {
const isWalletStandardError = e instanceof Error && e.name === 'WalletStandardError';
if (isWalletStandardError) {
if (code !== undefined) {
return e.context.__code === code;
}
return true;
}
return false;
}
class WalletStandardError extends Error {
constructor(...[code, contextAndErrorOptions]) {
let context;
let errorOptions;
if (contextAndErrorOptions) {
// If the `ErrorOptions` type ever changes, update this code.
const { cause } = contextAndErrorOptions, contextRest = __rest(contextAndErrorOptions, ["cause"]);
if (cause) {
errorOptions = { cause };
}
if (Object.keys(contextRest).length > 0) {
context = contextRest;
}
}
const message = (0, message_formatter_js_1.getErrorMessage)(code, context);
super(message, errorOptions);
this.context = Object.assign({ __code: code }, context);
// This is necessary so that `isWalletStandardError()` can identify a `WalletStandardError`
// without having to import the class for use in an `instanceof` check.
this.name = 'WalletStandardError';
}
}
exports.WalletStandardError = WalletStandardError;
//# sourceMappingURL=error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,sDAYC;AAdD,iEAAyD;AAEzD,SAAgB,qBAAqB,CACjC,CAAU,EACV,IAAiB;IAEjB,MAAM,qBAAqB,GAAG,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,qBAAqB,CAAC;IACrF,IAAI,qBAAqB,EAAE,CAAC;QACxB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAQ,CAAqC,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC;QAC1E,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAUD,MAAa,mBAA0F,SAAQ,KAAK;IAEhH,YACI,GAAG,CAAC,IAAI,EAAE,sBAAsB,CAKzB;QAEP,IAAI,OAA2D,CAAC;QAChE,IAAI,YAAsC,CAAC;QAC3C,IAAI,sBAAsB,EAAE,CAAC;YACzB,6DAA6D;YAC7D,MAAM,EAAE,KAAK,KAAqB,sBAAsB,EAAtC,WAAW,UAAK,sBAAsB,EAAlD,SAAyB,CAAyB,CAAC;YACzD,IAAI,KAAK,EAAE,CAAC;gBACR,YAAY,GAAG,EAAE,KAAK,EAAE,CAAC;YAC7B,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtC,OAAO,GAAG,WAAqD,CAAC;YACpE,CAAC;QACL,CAAC;QACD,MAAM,OAAO,GAAG,IAAA,sCAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,gBACX,MAAM,EAAE,IAAI,IACT,OAAO,CACkC,CAAC;QACjD,2FAA2F;QAC3F,uEAAuE;QACvE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACtC,CAAC;CACJ;AAhCD,kDAgCC"}

20
node_modules/@wallet-standard/errors/lib/cjs/index.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./codes.js"), exports);
__exportStar(require("./error.js"), exports);
__exportStar(require("./stack-trace.js"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,mDAAiC"}

View File

@@ -0,0 +1,95 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHumanReadableErrorMessage = getHumanReadableErrorMessage;
exports.getErrorMessage = getErrorMessage;
const context_js_1 = require("./context.js");
const messages_js_1 = require("./messages.js");
var StateType;
(function (StateType) {
StateType[StateType["EscapeSequence"] = 0] = "EscapeSequence";
StateType[StateType["Text"] = 1] = "Text";
StateType[StateType["Variable"] = 2] = "Variable";
})(StateType || (StateType = {}));
const START_INDEX = 'i';
const TYPE = 't';
function getHumanReadableErrorMessage(code, context = {}) {
const messageFormatString = messages_js_1.WalletStandardErrorMessages[code];
if (messageFormatString.length === 0) {
return '';
}
let state;
function commitStateUpTo(endIndex) {
if (state[TYPE] === StateType.Variable) {
const variableName = messageFormatString.slice(state[START_INDEX] + 1, endIndex);
fragments.push(variableName in context ? `${context[variableName]}` : `$${variableName}`);
}
else if (state[TYPE] === StateType.Text) {
fragments.push(messageFormatString.slice(state[START_INDEX], endIndex));
}
}
const fragments = [];
messageFormatString.split('').forEach((char, ii) => {
if (ii === 0) {
state = {
[START_INDEX]: 0,
[TYPE]: messageFormatString[0] === '\\'
? StateType.EscapeSequence
: messageFormatString[0] === '$'
? StateType.Variable
: StateType.Text,
};
return;
}
let nextState;
switch (state[TYPE]) {
case StateType.EscapeSequence:
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Text };
break;
case StateType.Text:
if (char === '\\') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.EscapeSequence };
}
else if (char === '$') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Variable };
}
break;
case StateType.Variable:
if (char === '\\') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.EscapeSequence };
}
else if (char === '$') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Variable };
}
else if (!char.match(/\w/)) {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Text };
}
break;
}
if (nextState) {
if (state !== nextState) {
commitStateUpTo(ii);
}
state = nextState;
}
});
commitStateUpTo();
return fragments.join('');
}
function getErrorMessage(code, context = {}) {
if (process.env.NODE_ENV !== 'production') {
return getHumanReadableErrorMessage(code, context);
}
else {
let decodingAdviceMessage = `Wallet Standard error #${code}; Decode this error by running \`npx @wallet-standard/errors decode -- ${code}`;
if (Object.keys(context).length) {
/**
* DANGER: Be sure that the shell command is escaped in such a way that makes it
* impossible for someone to craft malicious context values that would result in
* an exploit against anyone who bindly copy/pastes it into their terminal.
*/
decodingAdviceMessage += ` '${(0, context_js_1.encodeContextObject)(context)}'`;
}
return `${decodingAdviceMessage}\``;
}
}
//# sourceMappingURL=message-formatter.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"message-formatter.js","sourceRoot":"","sources":["../../src/message-formatter.ts"],"names":[],"mappings":";;AAgBA,oEAgEC;AAED,0CAkBC;AAnGD,6CAAmD;AACnD,+CAA4D;AAE5D,IAAW,SAIV;AAJD,WAAW,SAAS;IAChB,6DAAc,CAAA;IACd,yCAAI,CAAA;IACJ,iDAAQ,CAAA;AACZ,CAAC,EAJU,SAAS,KAAT,SAAS,QAInB;AAKD,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,SAAgB,4BAA4B,CACxC,IAAgB,EAChB,UAAkB,EAAE;IAEpB,MAAM,mBAAmB,GAAG,yCAA2B,CAAC,IAAI,CAA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Z,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtB,eAAe,CAAC,EAAE,CAAC,CAAC;YACxB,CAAC;YACD,KAAK,GAAG,SAAS,CAAC;QACtB,CAAC;IACL,CAAC,CAAC,CAAC;IACH,eAAe,EAAE,CAAC;IAClB,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,SAAgB,eAAe,CAC3B,IAAgB,EAChB,UAAkB,EAAE;IAEpB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QACxC,OAAO,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACJ,IAAI,qBAAqB,GAAG,0BAA0B,IAAI,0EAA0E,IAAI,EAAE,CAAC;QAC3I,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;YAC9B;;;;eAIG;YACH,qBAAqB,IAAI,KAAK,IAAA,gCAAmB,EAAC,OAAO,CAAC,GAAG,CAAC;QAClE,CAAC;QACD,OAAO,GAAG,qBAAqB,IAAI,CAAC;IACxC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WalletStandardErrorMessages = void 0;
const codes_js_1 = require("./codes.js");
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors#adding-a-new-error
*
* WARNING:
* - Don't change the meaning of an error message.
*/
exports.WalletStandardErrorMessages = {
[codes_js_1.WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED]: 'The wallet account $address does not support the chain `$chain`',
[codes_js_1.WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED]: 'The wallet account $address does not support the `$featureName` feature',
[codes_js_1.WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED]: "The wallet '$walletName' does not support the `$featureName` feature",
[codes_js_1.WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND]: "No account with address $address could be found in the '$walletName' wallet",
[codes_js_1.WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND]: 'No underlying Wallet Standard wallet could be found for this handle. This can happen if ' +
'the wallet associated with the handle has been unregistered.',
[codes_js_1.WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED]: 'The user rejected the request',
};
//# sourceMappingURL=messages.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":";;;AACA,yCAOoB;AAEpB;;;;;;GAMG;AACU,QAAA,2BAA2B,GAInC;IACD,CAAC,4EAAiE,CAAC,EAC/D,iEAAiE;IACrE,CAAC,gFAAqE,CAAC,EACnE,yEAAyE;IAC7E,CAAC,wEAA6D,CAAC,EAC3D,sEAAsE;IAC1E,CAAC,oEAAyD,CAAC,EACvD,6EAA6E;IACjF,CAAC,4DAAiD,CAAC,EAC/C,0FAA0F;QAC1F,8DAA8D;IAClE,CAAC,wDAA6C,CAAC,EAAE,+BAA+B;CACnF,CAAC"}

View File

@@ -0,0 +1 @@
{ "type": "commonjs" }

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.safeCaptureStackTrace = safeCaptureStackTrace;
function safeCaptureStackTrace(...args) {
if ('captureStackTrace' in Error && typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(...args);
}
}
//# sourceMappingURL=stack-trace.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"stack-trace.js","sourceRoot":"","sources":["../../src/stack-trace.ts"],"names":[],"mappings":";;AAAA,sDAIC;AAJD,SAAgB,qBAAqB,CAAC,GAAG,IAAgD;IACrF,IAAI,mBAAmB,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAChF,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;AACL,CAAC"}

182
node_modules/@wallet-standard/errors/lib/cli.mjs generated vendored Normal file
View File

@@ -0,0 +1,182 @@
import $3Sr93$chalk from "chalk";
import {Command as $3Sr93$Command, InvalidArgumentError as $3Sr93$InvalidArgumentError} from "commander";
var $a2eff9e01820a9b9$exports = {};
$a2eff9e01820a9b9$exports = JSON.parse("{\"name\":\"@wallet-standard/errors\",\"version\":\"0.1.1\",\"author\":\"Solana Maintainers <maintainers@solana.foundation>\",\"repository\":\"https://github.com/wallet-standard/wallet-standard\",\"license\":\"Apache-2.0\",\"publishConfig\":{\"access\":\"public\"},\"files\":[\"bin\",\"lib\",\"src\",\"LICENSE\"],\"engines\":{\"node\":\">=16\"},\"type\":\"module\",\"sideEffects\":false,\"bin\":\"./bin/cli.mjs\",\"main\":\"./lib/cjs/index.js\",\"module\":\"./lib/esm/index.js\",\"types\":\"./lib/types/index.d.ts\",\"exports\":{\"require\":\"./lib/cjs/index.js\",\"import\":\"./lib/esm/index.js\",\"types\":\"./lib/types/index.d.ts\"},\"targets\":{\"bin\":{\"context\":\"node\",\"distDir\":\"lib/\",\"isLibrary\":true,\"optimize\":false,\"sourceMap\":false}},\"scripts\":{\"clean\":\"shx mkdir -p lib && shx rm -rf lib\",\"build\":\"parcel build --target bin src/cli.ts\",\"package\":\"shx mkdir -p lib/cjs && shx echo '{ \\\"type\\\": \\\"commonjs\\\" }' > lib/cjs/package.json\",\"test\":\"jest -c ../../../node_modules/@wallet-standard/test-config/jest.config.ts --rootDir .\"},\"dependencies\":{\"chalk\":\"^5.4.1\",\"commander\":\"^13.1.0\"},\"devDependencies\":{\"parcel\":\"^2.14.4\",\"shx\":\"^0.4.0\"}}");
function $a9fe8b2a0a510d92$export$5cdc53290040c8ea(encodedContext) {
const decodedUrlString = atob(encodedContext);
return Object.fromEntries(new URLSearchParams(decodedUrlString).entries());
}
function $a9fe8b2a0a510d92$var$encodeValue(value) {
if (Array.isArray(value)) {
const commaSeparatedValues = value.map($a9fe8b2a0a510d92$var$encodeValue).join('%2C%20' /* ", " */ );
return '%5B' /* "[" */ + commaSeparatedValues + /* "]" */ '%5D';
} else if (typeof value === 'bigint') return `${value}n`;
else return encodeURIComponent(String(value != null && Object.getPrototypeOf(value) === null ? // Convert them before stringifying them.
{
...value
} : value));
}
function $a9fe8b2a0a510d92$var$encodeObjectContextEntry([key, value]) {
return `${key}=${$a9fe8b2a0a510d92$var$encodeValue(value)}`;
}
function $a9fe8b2a0a510d92$export$718674e070bbe277(context) {
const searchParamsString = Object.entries(context).map($a9fe8b2a0a510d92$var$encodeObjectContextEntry).join('&');
return btoa(searchParamsString);
}
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors/#adding-a-new-error
*
* WARNING:
* - Don't remove error codes
* - Don't change or reorder error codes.
*
* Good naming conventions:
* - Prefixing common errors — e.g. under the same package — can be a good way to namespace them. E.g. All codec-related errors start with `WALLET_STANDARD_ERROR__ACCOUNT__`.
* - Use consistent names — e.g. choose `PDA` or `PROGRAM_DERIVED_ADDRESS` and stick with it. Ensure your names are consistent with existing error codes. The decision might have been made for you.
* - Recommended prefixes and suffixes:
* - `MALFORMED_`: Some input was not constructed properly. E.g. `MALFORMED_BASE58_ENCODED_ADDRESS`.
* - `INVALID_`: Some input is invalid (other than because it was MALFORMED). E.g. `INVALID_NUMBER_OF_BYTES`.
* - `EXPECTED_`: Some input was different than expected, no need to specify the "GOT" part unless necessary. E.g. `EXPECTED_DECODED_ACCOUNT`.
* - `_CANNOT_`: Some operation cannot be performed or some input cannot be used due to some condition. E.g. `CANNOT_DECODE_EMPTY_BYTE_ARRAY` or `PDA_CANNOT_END_WITH_PDA_MARKER`.
* - `_MUST_BE_`: Some condition must be true. E.g. `NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE`.
* - `_FAILED_TO_`: Tried to perform some operation and failed. E.g. `FAILED_TO_DECODE_ACCOUNT`.
* - `_NOT_FOUND`: Some operation lead to not finding something. E.g. `ACCOUNT_NOT_FOUND`.
* - `_OUT_OF_RANGE`: Some value is out of range. E.g. `ENUM_DISCRIMINATOR_OUT_OF_RANGE`.
* - `_EXCEEDED`: Some limit was exceeded. E.g. `PDA_MAX_SEED_LENGTH_EXCEEDED`.
* - `_MISMATCH`: Some elements do not match. E.g. `ENCODER_DECODER_FIXED_SIZE_MISMATCH`.
* - `_MISSING`: Some required input is missing. E.g. `TRANSACTION_FEE_PAYER_MISSING`.
* - `_UNIMPLEMENTED`: Some required component is not available in the environment. E.g. `SUBTLE_CRYPTO_VERIFY_FUNCTION_UNIMPLEMENTED`.
*/ // Registry-related errors.
// Reserve error codes in the range [3834000-3834999].
const $530d27d1911236a2$export$52bc1fe1597469c4 = 3834000;
const $530d27d1911236a2$export$2d71e59415bfcd93 = 3834001;
const $530d27d1911236a2$export$6aef8b8f5962a16 = 4001000;
const $530d27d1911236a2$export$4a71b6cd17f698 = 6160000;
const $530d27d1911236a2$export$37ca37218d933bd9 = 6160001;
const $530d27d1911236a2$export$82cec0501ccee60d = 6160002;
const $07e15bc1b3e9ee4c$export$7349a4bcf219522a = {
[(0, $530d27d1911236a2$export$4a71b6cd17f698)]: 'The wallet account $address does not support the chain `$chain`',
[(0, $530d27d1911236a2$export$37ca37218d933bd9)]: 'The wallet account $address does not support the `$featureName` feature',
[(0, $530d27d1911236a2$export$82cec0501ccee60d)]: "The wallet '$walletName' does not support the `$featureName` feature",
[(0, $530d27d1911236a2$export$2d71e59415bfcd93)]: "No account with address $address could be found in the '$walletName' wallet",
[(0, $530d27d1911236a2$export$52bc1fe1597469c4)]: "No underlying Wallet Standard wallet could be found for this handle. This can happen if the wallet associated with the handle has been unregistered.",
[(0, $530d27d1911236a2$export$6aef8b8f5962a16)]: 'The user rejected the request'
};
const $d3e987deabbb48c3$var$START_INDEX = 'i';
const $d3e987deabbb48c3$var$TYPE = 't';
function $d3e987deabbb48c3$export$19d2f6f104531a75(code, context = {}) {
const messageFormatString = (0, $07e15bc1b3e9ee4c$export$7349a4bcf219522a)[code];
if (messageFormatString.length === 0) return '';
let state;
function commitStateUpTo(endIndex) {
if (state[$d3e987deabbb48c3$var$TYPE] === 2) {
const variableName = messageFormatString.slice(state[$d3e987deabbb48c3$var$START_INDEX] + 1, endIndex);
fragments.push(variableName in context ? `${context[variableName]}` : `$${variableName}`);
} else if (state[$d3e987deabbb48c3$var$TYPE] === 1) fragments.push(messageFormatString.slice(state[$d3e987deabbb48c3$var$START_INDEX], endIndex));
}
const fragments = [];
messageFormatString.split('').forEach((char, ii)=>{
if (ii === 0) {
state = {
[$d3e987deabbb48c3$var$START_INDEX]: 0,
[$d3e987deabbb48c3$var$TYPE]: messageFormatString[0] === '\\' ? 0 : messageFormatString[0] === '$' ? 2 : 1
};
return;
}
let nextState;
switch(state[$d3e987deabbb48c3$var$TYPE]){
case 0:
nextState = {
[$d3e987deabbb48c3$var$START_INDEX]: ii,
[$d3e987deabbb48c3$var$TYPE]: 1
};
break;
case 1:
if (char === '\\') nextState = {
[$d3e987deabbb48c3$var$START_INDEX]: ii,
[$d3e987deabbb48c3$var$TYPE]: 0
};
else if (char === '$') nextState = {
[$d3e987deabbb48c3$var$START_INDEX]: ii,
[$d3e987deabbb48c3$var$TYPE]: 2
};
break;
case 2:
if (char === '\\') nextState = {
[$d3e987deabbb48c3$var$START_INDEX]: ii,
[$d3e987deabbb48c3$var$TYPE]: 0
};
else if (char === '$') nextState = {
[$d3e987deabbb48c3$var$START_INDEX]: ii,
[$d3e987deabbb48c3$var$TYPE]: 2
};
else if (!char.match(/\w/)) nextState = {
[$d3e987deabbb48c3$var$START_INDEX]: ii,
[$d3e987deabbb48c3$var$TYPE]: 1
};
break;
}
if (nextState) {
if (state !== nextState) commitStateUpTo(ii);
state = nextState;
}
});
commitStateUpTo();
return fragments.join('');
}
function $d3e987deabbb48c3$export$82f46aa4e6535a45(code, context = {}) {
if (process.env.NODE_ENV !== 'production') return $d3e987deabbb48c3$export$19d2f6f104531a75(code, context);
else {
let decodingAdviceMessage = `Wallet Standard error #${code}; Decode this error by running \`npx @wallet-standard/errors decode -- ${code}`;
if (Object.keys(context).length) /**
* DANGER: Be sure that the shell command is escaped in such a way that makes it
* impossible for someone to craft malicious context values that would result in
* an exploit against anyone who bindly copy/pastes it into their terminal.
*/ decodingAdviceMessage += ` '${(0, $a9fe8b2a0a510d92$export$718674e070bbe277)(context)}'`;
return `${decodingAdviceMessage}\``;
}
}
const $a177a3a21b521781$var$program = new (0, $3Sr93$Command)();
$a177a3a21b521781$var$program.name('@wallet-standard/errors').description('Decode Wallet Standard JavaScript errors thrown in production').version((0, $a2eff9e01820a9b9$exports.version));
$a177a3a21b521781$var$program.command('decode').description('Decode a `WalletStandardErrorCode` to a human-readable message').argument('<code>', 'numeric error code to decode', (rawCode)=>{
const code = parseInt(rawCode, 10);
if (isNaN(code) || `${code}` !== rawCode) throw new (0, $3Sr93$InvalidArgumentError)('It must be an integer');
if (!(code in (0, $07e15bc1b3e9ee4c$export$7349a4bcf219522a))) throw new (0, $3Sr93$InvalidArgumentError)('There exists no error with that code');
return code;
}).argument('[encodedContext]', 'encoded context to interpolate into the error message', (encodedContext)=>{
try {
return (0, $a9fe8b2a0a510d92$export$5cdc53290040c8ea)(encodedContext);
} catch (e) {
throw new (0, $3Sr93$InvalidArgumentError)('Encoded context malformed');
}
}).action((code, context)=>{
const message = (0, $d3e987deabbb48c3$export$19d2f6f104531a75)(code, context);
console.log(`
${(0, $3Sr93$chalk).bold((0, $3Sr93$chalk).rgb(154, 71, 255)('[') + (0, $3Sr93$chalk).rgb(144, 108, 244)('D') + (0, $3Sr93$chalk).rgb(134, 135, 233)('e') + (0, $3Sr93$chalk).rgb(122, 158, 221)('c') + (0, $3Sr93$chalk).rgb(110, 178, 209)('o') + (0, $3Sr93$chalk).rgb(95, 195, 196)('d') + (0, $3Sr93$chalk).rgb(79, 212, 181)('e') + (0, $3Sr93$chalk).rgb(57, 227, 166)('d') + (0, $3Sr93$chalk).rgb(19, 241, 149)(']')) + (0, $3Sr93$chalk).rgb(19, 241, 149)(' Wallet Standard error code #' + code)}
- ${message}`);
if (context) console.log(`
${(0, $3Sr93$chalk).yellowBright((0, $3Sr93$chalk).bold('[Context]'))}
${JSON.stringify(context, null, 4).split('\n').join('\n ')}`);
});
function $a177a3a21b521781$export$889ea624f2cb2c57(argv) {
$a177a3a21b521781$var$program.parse(argv);
}
export {$a177a3a21b521781$export$889ea624f2cb2c57 as run};

38
node_modules/@wallet-standard/errors/lib/esm/codes.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors/#adding-a-new-error
*
* WARNING:
* - Don't remove error codes
* - Don't change or reorder error codes.
*
* Good naming conventions:
* - Prefixing common errors — e.g. under the same package — can be a good way to namespace them. E.g. All codec-related errors start with `WALLET_STANDARD_ERROR__ACCOUNT__`.
* - Use consistent names — e.g. choose `PDA` or `PROGRAM_DERIVED_ADDRESS` and stick with it. Ensure your names are consistent with existing error codes. The decision might have been made for you.
* - Recommended prefixes and suffixes:
* - `MALFORMED_`: Some input was not constructed properly. E.g. `MALFORMED_BASE58_ENCODED_ADDRESS`.
* - `INVALID_`: Some input is invalid (other than because it was MALFORMED). E.g. `INVALID_NUMBER_OF_BYTES`.
* - `EXPECTED_`: Some input was different than expected, no need to specify the "GOT" part unless necessary. E.g. `EXPECTED_DECODED_ACCOUNT`.
* - `_CANNOT_`: Some operation cannot be performed or some input cannot be used due to some condition. E.g. `CANNOT_DECODE_EMPTY_BYTE_ARRAY` or `PDA_CANNOT_END_WITH_PDA_MARKER`.
* - `_MUST_BE_`: Some condition must be true. E.g. `NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE`.
* - `_FAILED_TO_`: Tried to perform some operation and failed. E.g. `FAILED_TO_DECODE_ACCOUNT`.
* - `_NOT_FOUND`: Some operation lead to not finding something. E.g. `ACCOUNT_NOT_FOUND`.
* - `_OUT_OF_RANGE`: Some value is out of range. E.g. `ENUM_DISCRIMINATOR_OUT_OF_RANGE`.
* - `_EXCEEDED`: Some limit was exceeded. E.g. `PDA_MAX_SEED_LENGTH_EXCEEDED`.
* - `_MISMATCH`: Some elements do not match. E.g. `ENCODER_DECODER_FIXED_SIZE_MISMATCH`.
* - `_MISSING`: Some required input is missing. E.g. `TRANSACTION_FEE_PAYER_MISSING`.
* - `_UNIMPLEMENTED`: Some required component is not available in the environment. E.g. `SUBTLE_CRYPTO_VERIFY_FUNCTION_UNIMPLEMENTED`.
*/
// Registry-related errors.
// Reserve error codes in the range [3834000-3834999].
export const WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND = 3834000;
export const WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND = 3834001;
// User-related errors.
// Reserve error codes in the range [4001000-4001999].
export const WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED = 4001000;
// Feature-related errors.
// Reserve error codes in the range [6160000-6160999].
export const WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED = 6160000;
export const WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED = 6160001;
export const WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED = 6160002;
//# sourceMappingURL=codes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../../src/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,2BAA2B;AAC3B,sDAAsD;AACtD,MAAM,CAAC,MAAM,iDAAiD,GAAG,OAAgB,CAAC;AAClF,MAAM,CAAC,MAAM,yDAAyD,GAAG,OAAgB,CAAC;AAE1F,uBAAuB;AACvB,sDAAsD;AACtD,MAAM,CAAC,MAAM,6CAA6C,GAAG,OAAgB,CAAC;AAE9E,0BAA0B;AAC1B,sDAAsD;AACtD,MAAM,CAAC,MAAM,iEAAiE,GAAG,OAAgB,CAAC;AAClG,MAAM,CAAC,MAAM,qEAAqE,GAAG,OAAgB,CAAC;AACtG,MAAM,CAAC,MAAM,6DAA6D,GAAG,OAAgB,CAAC"}

View File

@@ -0,0 +1,28 @@
export function decodeEncodedContext(encodedContext) {
const decodedUrlString = atob(encodedContext);
return Object.fromEntries(new URLSearchParams(decodedUrlString).entries());
}
function encodeValue(value) {
if (Array.isArray(value)) {
const commaSeparatedValues = value.map(encodeValue).join('%2C%20' /* ", " */);
return '%5B' /* "[" */ + commaSeparatedValues + /* "]" */ '%5D';
}
else if (typeof value === 'bigint') {
return `${value}n`;
}
else {
return encodeURIComponent(String(value != null && Object.getPrototypeOf(value) === null
? // Plain objects with no prototype don't have a `toString` method.
// Convert them before stringifying them.
{ ...value }
: value));
}
}
function encodeObjectContextEntry([key, value]) {
return `${key}=${encodeValue(value)}`;
}
export function encodeContextObject(context) {
const searchParamsString = Object.entries(context).map(encodeObjectContextEntry).join('&');
return btoa(searchParamsString);
}
//# sourceMappingURL=context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AA6CA,MAAM,UAAU,oBAAoB,CAAC,cAAsB;IACvD,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,eAAe,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,oBAAoB,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC9E,OAAO,KAAK,CAAC,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAAC,KAAK,CAAC;IACpE,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,GAAG,KAAK,GAAG,CAAC;IACvB,CAAC;SAAM,CAAC;QACJ,OAAO,kBAAkB,CACrB,MAAM,CACF,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI;YAClD,CAAC,CAAC,kEAAkE;gBAClE,yCAAyC;gBACzC,EAAE,GAAI,KAAgB,EAAE;YAC1B,CAAC,CAAC,KAAK,CACd,CACJ,CAAC;IACN,CAAC;AACL,CAAC;AAED,SAAS,wBAAwB,CAAC,CAAC,GAAG,EAAE,KAAK,CAAoB;IAC7D,OAAO,GAAG,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAC/C,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3F,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACpC,CAAC"}

37
node_modules/@wallet-standard/errors/lib/esm/error.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import { getErrorMessage } from './message-formatter.js';
export function isWalletStandardError(e, code) {
const isWalletStandardError = e instanceof Error && e.name === 'WalletStandardError';
if (isWalletStandardError) {
if (code !== undefined) {
return e.context.__code === code;
}
return true;
}
return false;
}
export class WalletStandardError extends Error {
constructor(...[code, contextAndErrorOptions]) {
let context;
let errorOptions;
if (contextAndErrorOptions) {
// If the `ErrorOptions` type ever changes, update this code.
const { cause, ...contextRest } = contextAndErrorOptions;
if (cause) {
errorOptions = { cause };
}
if (Object.keys(contextRest).length > 0) {
context = contextRest;
}
}
const message = getErrorMessage(code, context);
super(message, errorOptions);
this.context = {
__code: code,
...context,
};
// This is necessary so that `isWalletStandardError()` can identify a `WalletStandardError`
// without having to import the class for use in an `instanceof` check.
this.name = 'WalletStandardError';
}
}
//# sourceMappingURL=error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,qBAAqB,CACjC,CAAU,EACV,IAAiB;IAEjB,MAAM,qBAAqB,GAAG,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,qBAAqB,CAAC;IACrF,IAAI,qBAAqB,EAAE,CAAC;QACxB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAQ,CAAqC,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC;QAC1E,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAUD,MAAM,OAAO,mBAA0F,SAAQ,KAAK;IAEhH,YACI,GAAG,CAAC,IAAI,EAAE,sBAAsB,CAKzB;QAEP,IAAI,OAA2D,CAAC;QAChE,IAAI,YAAsC,CAAC;QAC3C,IAAI,sBAAsB,EAAE,CAAC;YACzB,6DAA6D;YAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,sBAAsB,CAAC;YACzD,IAAI,KAAK,EAAE,CAAC;gBACR,YAAY,GAAG,EAAE,KAAK,EAAE,CAAC;YAC7B,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtC,OAAO,GAAG,WAAqD,CAAC;YACpE,CAAC;QACL,CAAC;QACD,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG;YACX,MAAM,EAAE,IAAI;YACZ,GAAG,OAAO;SACkC,CAAC;QACjD,2FAA2F;QAC3F,uEAAuE;QACvE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACtC,CAAC;CACJ"}

View File

@@ -0,0 +1,4 @@
export * from './codes.js';
export * from './error.js';
export * from './stack-trace.js';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}

View File

@@ -0,0 +1,91 @@
import { encodeContextObject } from './context.js';
import { WalletStandardErrorMessages } from './messages.js';
var StateType;
(function (StateType) {
StateType[StateType["EscapeSequence"] = 0] = "EscapeSequence";
StateType[StateType["Text"] = 1] = "Text";
StateType[StateType["Variable"] = 2] = "Variable";
})(StateType || (StateType = {}));
const START_INDEX = 'i';
const TYPE = 't';
export function getHumanReadableErrorMessage(code, context = {}) {
const messageFormatString = WalletStandardErrorMessages[code];
if (messageFormatString.length === 0) {
return '';
}
let state;
function commitStateUpTo(endIndex) {
if (state[TYPE] === StateType.Variable) {
const variableName = messageFormatString.slice(state[START_INDEX] + 1, endIndex);
fragments.push(variableName in context ? `${context[variableName]}` : `$${variableName}`);
}
else if (state[TYPE] === StateType.Text) {
fragments.push(messageFormatString.slice(state[START_INDEX], endIndex));
}
}
const fragments = [];
messageFormatString.split('').forEach((char, ii) => {
if (ii === 0) {
state = {
[START_INDEX]: 0,
[TYPE]: messageFormatString[0] === '\\'
? StateType.EscapeSequence
: messageFormatString[0] === '$'
? StateType.Variable
: StateType.Text,
};
return;
}
let nextState;
switch (state[TYPE]) {
case StateType.EscapeSequence:
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Text };
break;
case StateType.Text:
if (char === '\\') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.EscapeSequence };
}
else if (char === '$') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Variable };
}
break;
case StateType.Variable:
if (char === '\\') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.EscapeSequence };
}
else if (char === '$') {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Variable };
}
else if (!char.match(/\w/)) {
nextState = { [START_INDEX]: ii, [TYPE]: StateType.Text };
}
break;
}
if (nextState) {
if (state !== nextState) {
commitStateUpTo(ii);
}
state = nextState;
}
});
commitStateUpTo();
return fragments.join('');
}
export function getErrorMessage(code, context = {}) {
if (process.env.NODE_ENV !== 'production') {
return getHumanReadableErrorMessage(code, context);
}
else {
let decodingAdviceMessage = `Wallet Standard error #${code}; Decode this error by running \`npx @wallet-standard/errors decode -- ${code}`;
if (Object.keys(context).length) {
/**
* DANGER: Be sure that the shell command is escaped in such a way that makes it
* impossible for someone to craft malicious context values that would result in
* an exploit against anyone who bindly copy/pastes it into their terminal.
*/
decodingAdviceMessage += ` '${encodeContextObject(context)}'`;
}
return `${decodingAdviceMessage}\``;
}
}
//# sourceMappingURL=message-formatter.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"message-formatter.js","sourceRoot":"","sources":["../../src/message-formatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAE5D,IAAW,SAIV;AAJD,WAAW,SAAS;IAChB,6DAAc,CAAA;IACd,yCAAI,CAAA;IACJ,iDAAQ,CAAA;AACZ,CAAC,EAJU,SAAS,KAAT,SAAS,QAInB;AAKD,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,MAAM,UAAU,4BAA4B,CACxC,IAAgB,EAChB,UAAkB,EAAE;IAEpB,MAAM,mBAAmB,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,mBAAmB,CAAC,MAA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gBACtB,eAAe,CAAC,EAAE,CAAC,CAAC;YACxB,CAAC;YACD,KAAK,GAAG,SAAS,CAAC;QACtB,CAAC;IACL,CAAC,CAAC,CAAC;IACH,eAAe,EAAE,CAAC;IAClB,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,eAAe,CAC3B,IAAgB,EAChB,UAAkB,EAAE;IAEpB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QACxC,OAAO,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACJ,IAAI,qBAAqB,GAAG,0BAA0B,IAAI,0EAA0E,IAAI,EAAE,CAAC;QAC3I,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;YAC9B;;;;eAIG;YACH,qBAAqB,IAAI,KAAK,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC;QAClE,CAAC;QACD,OAAO,GAAG,qBAAqB,IAAI,CAAC;IACxC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,18 @@
import { WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED, WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED, WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED, WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND, WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND, WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED, } from './codes.js';
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors#adding-a-new-error
*
* WARNING:
* - Don't change the meaning of an error message.
*/
export const WalletStandardErrorMessages = {
[WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED]: 'The wallet account $address does not support the chain `$chain`',
[WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED]: 'The wallet account $address does not support the `$featureName` feature',
[WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED]: "The wallet '$walletName' does not support the `$featureName` feature",
[WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND]: "No account with address $address could be found in the '$walletName' wallet",
[WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND]: 'No underlying Wallet Standard wallet could be found for this handle. This can happen if ' +
'the wallet associated with the handle has been unregistered.',
[WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED]: 'The user rejected the request',
};
//# sourceMappingURL=messages.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iEAAiE,EACjE,qEAAqE,EACrE,6DAA6D,EAC7D,yDAAyD,EACzD,iDAAiD,EACjD,6CAA6C,GAChD,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAInC;IACD,CAAC,iEAAiE,CAAC,EAC/D,iEAAiE;IACrE,CAAC,qEAAqE,CAAC,EACnE,yEAAyE;IAC7E,CAAC,6DAA6D,CAAC,EAC3D,sEAAsE;IAC1E,CAAC,yDAAyD,CAAC,EACvD,6EAA6E;IACjF,CAAC,iDAAiD,CAAC,EAC/C,0FAA0F;QAC1F,8DAA8D;IAClE,CAAC,6CAA6C,CAAC,EAAE,+BAA+B;CACnF,CAAC"}

View File

@@ -0,0 +1,6 @@
export function safeCaptureStackTrace(...args) {
if ('captureStackTrace' in Error && typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(...args);
}
}
//# sourceMappingURL=stack-trace.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"stack-trace.js","sourceRoot":"","sources":["../../src/stack-trace.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBAAqB,CAAC,GAAG,IAAgD;IACrF,IAAI,mBAAmB,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAChF,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1 @@
{"root":["../src/codes.ts","../src/context.ts","../src/error.ts","../src/index.ts","../src/message-formatter.ts","../src/messages.ts","../src/stack-trace.ts"],"version":"5.8.3"}

View File

@@ -0,0 +1 @@
{"root":["../src/codes.ts","../src/context.ts","../src/error.ts","../src/index.ts","../src/message-formatter.ts","../src/messages.ts","../src/stack-trace.ts"],"version":"5.8.3"}

View File

@@ -0,0 +1,49 @@
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors/#adding-a-new-error
*
* WARNING:
* - Don't remove error codes
* - Don't change or reorder error codes.
*
* Good naming conventions:
* - Prefixing common errors — e.g. under the same package — can be a good way to namespace them. E.g. All codec-related errors start with `WALLET_STANDARD_ERROR__ACCOUNT__`.
* - Use consistent names — e.g. choose `PDA` or `PROGRAM_DERIVED_ADDRESS` and stick with it. Ensure your names are consistent with existing error codes. The decision might have been made for you.
* - Recommended prefixes and suffixes:
* - `MALFORMED_`: Some input was not constructed properly. E.g. `MALFORMED_BASE58_ENCODED_ADDRESS`.
* - `INVALID_`: Some input is invalid (other than because it was MALFORMED). E.g. `INVALID_NUMBER_OF_BYTES`.
* - `EXPECTED_`: Some input was different than expected, no need to specify the "GOT" part unless necessary. E.g. `EXPECTED_DECODED_ACCOUNT`.
* - `_CANNOT_`: Some operation cannot be performed or some input cannot be used due to some condition. E.g. `CANNOT_DECODE_EMPTY_BYTE_ARRAY` or `PDA_CANNOT_END_WITH_PDA_MARKER`.
* - `_MUST_BE_`: Some condition must be true. E.g. `NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE`.
* - `_FAILED_TO_`: Tried to perform some operation and failed. E.g. `FAILED_TO_DECODE_ACCOUNT`.
* - `_NOT_FOUND`: Some operation lead to not finding something. E.g. `ACCOUNT_NOT_FOUND`.
* - `_OUT_OF_RANGE`: Some value is out of range. E.g. `ENUM_DISCRIMINATOR_OUT_OF_RANGE`.
* - `_EXCEEDED`: Some limit was exceeded. E.g. `PDA_MAX_SEED_LENGTH_EXCEEDED`.
* - `_MISMATCH`: Some elements do not match. E.g. `ENCODER_DECODER_FIXED_SIZE_MISMATCH`.
* - `_MISSING`: Some required input is missing. E.g. `TRANSACTION_FEE_PAYER_MISSING`.
* - `_UNIMPLEMENTED`: Some required component is not available in the environment. E.g. `SUBTLE_CRYPTO_VERIFY_FUNCTION_UNIMPLEMENTED`.
*/
export declare const WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND: 3834000;
export declare const WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND: 3834001;
export declare const WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED: 4001000;
export declare const WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED: 6160000;
export declare const WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED: 6160001;
export declare const WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED: 6160002;
/**
* A union of every Wallet Standard error code
*
* You might be wondering why this is not a TypeScript enum or const enum.
*
* One of the goals of this library is to enable people to use some or none of it without having to
* bundle all of it.
*
* If we made the set of error codes an enum then anyone who imported it (even if to only use a
* single error code) would be forced to bundle every code and its label.
*
* Const enums appear to solve this problem by letting the compiler inline only the codes that are
* actually used. Unfortunately exporting ambient (const) enums from a library like
* `@wallet-standard/errors` is not safe, for a variety of reasons covered here:
* https://stackoverflow.com/a/28818850
*/
export type WalletStandardErrorCode = typeof WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED | typeof WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED | typeof WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED | typeof WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND | typeof WALLET_STANDARD_ERROR__REGISTRY__WALLET_NOT_FOUND | typeof WALLET_STANDARD_ERROR__USER__REQUEST_REJECTED;
//# sourceMappingURL=codes.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,eAAO,MAAM,iDAAiD,EAAG,OAAgB,CAAC;AAClF,eAAO,MAAM,yDAAyD,EAAG,OAAgB,CAAC;AAI1F,eAAO,MAAM,6CAA6C,EAAG,OAAgB,CAAC;AAI9E,eAAO,MAAM,iEAAiE,EAAG,OAAgB,CAAC;AAClG,eAAO,MAAM,qEAAqE,EAAG,OAAgB,CAAC;AACtG,eAAO,MAAM,6DAA6D,EAAG,OAAgB,CAAC;AAE9F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,uBAAuB,GAC7B,OAAO,iEAAiE,GACxE,OAAO,qEAAqE,GAC5E,OAAO,6DAA6D,GACpE,OAAO,yDAAyD,GAChE,OAAO,iDAAiD,GACxD,OAAO,6CAA6C,CAAC"}

View File

@@ -0,0 +1,40 @@
import type { WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED, WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED, WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND, WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED, WalletStandardErrorCode } from './codes.js';
type DefaultUnspecifiedErrorContextToUndefined<T> = {
[P in WalletStandardErrorCode]: P extends keyof T ? T[P] : undefined;
};
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors/#adding-a-new-error
*
* WARNING:
* - Don't change or remove members of an error's context.
*/
export type WalletStandardErrorContext = DefaultUnspecifiedErrorContextToUndefined<{
[WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_CHAIN_UNSUPPORTED]: {
address: string;
chain: string;
featureName: string;
supportedChains: string[];
supportedFeatures: string[];
};
[WALLET_STANDARD_ERROR__FEATURES__WALLET_ACCOUNT_FEATURE_UNIMPLEMENTED]: {
address: string;
featureName: string;
supportedChains: string[];
supportedFeatures: string[];
};
[WALLET_STANDARD_ERROR__FEATURES__WALLET_FEATURE_UNIMPLEMENTED]: {
featureName: string;
supportedFeatures: string[];
supportedChains: string[];
walletName: string;
};
[WALLET_STANDARD_ERROR__REGISTRY__WALLET_ACCOUNT_NOT_FOUND]: {
address: string;
walletName: string;
};
}>;
export declare function decodeEncodedContext(encodedContext: string): object;
export declare function encodeContextObject(context: object): string;
export {};
//# sourceMappingURL=context.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,iEAAiE,EACjE,qEAAqE,EACrE,yDAAyD,EACzD,6DAA6D,EAC7D,uBAAuB,EAC1B,MAAM,YAAY,CAAC;AAEpB,KAAK,yCAAyC,CAAC,CAAC,IAAI;KAC/C,CAAC,IAAI,uBAAuB,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CACvE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;IAC/E,CAAC,iEAAiE,CAAC,EAAE;QACjE,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAC;KAC/B,CAAC;IACF,CAAC,qEAAqE,CAAC,EAAE;QACrE,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAC;KAC/B,CAAC;IACF,CAAC,6DAA6D,CAAC,EAAE;QAC7D,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;QAC5B,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,CAAC,yDAAyD,CAAC,EAAE;QACzD,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC,CAAC;AAEH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAGnE;AAyBD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3D"}

View File

@@ -0,0 +1,17 @@
import type { WalletStandardErrorCode } from './codes.js';
import type { WalletStandardErrorContext } from './context.js';
export declare function isWalletStandardError<TErrorCode extends WalletStandardErrorCode>(e: unknown, code?: TErrorCode): e is WalletStandardError<TErrorCode>;
type WalletStandardErrorCodedContext = Readonly<{
[P in WalletStandardErrorCode]: (WalletStandardErrorContext[P] extends undefined ? object : WalletStandardErrorContext[P]) & {
__code: P;
};
}>;
export declare class WalletStandardError<TErrorCode extends WalletStandardErrorCode = WalletStandardErrorCode> extends Error {
readonly context: WalletStandardErrorCodedContext[TErrorCode];
constructor(...[code, contextAndErrorOptions]: WalletStandardErrorContext[TErrorCode] extends undefined ? [code: TErrorCode, errorOptions?: ErrorOptions | undefined] : [
code: TErrorCode,
contextAndErrorOptions: WalletStandardErrorContext[TErrorCode] & (ErrorOptions | undefined)
]);
}
export {};
//# sourceMappingURL=error.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAG/D,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,uBAAuB,EAC5E,CAAC,EAAE,OAAO,EACV,IAAI,CAAC,EAAE,UAAU,GAClB,CAAC,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAStC;AAED,KAAK,+BAA+B,GAAG,QAAQ,CAAC;KAC3C,CAAC,IAAI,uBAAuB,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC,SAAS,SAAS,GAC1E,MAAM,GACN,0BAA0B,CAAC,CAAC,CAAC,CAAC,GAAG;QACnC,MAAM,EAAE,CAAC,CAAC;KACb;CACJ,CAAC,CAAC;AAEH,qBAAa,mBAAmB,CAAC,UAAU,SAAS,uBAAuB,GAAG,uBAAuB,CAAE,SAAQ,KAAK;IAChH,QAAQ,CAAC,OAAO,EAAE,+BAA+B,CAAC,UAAU,CAAC,CAAC;gBAE1D,GAAG,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,0BAA0B,CAAC,UAAU,CAAC,SAAS,SAAS,GACrF,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC,GAC3D;QACI,IAAI,EAAE,UAAU;QAChB,sBAAsB,EAAE,0BAA0B,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC;KAC9F;CAwBd"}

View File

@@ -0,0 +1,4 @@
export * from './codes.js';
export * from './error.js';
export * from './stack-trace.js';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}

View File

@@ -0,0 +1,4 @@
import type { WalletStandardErrorCode } from './codes.js';
export declare function getHumanReadableErrorMessage<TErrorCode extends WalletStandardErrorCode>(code: TErrorCode, context?: object): string;
export declare function getErrorMessage<TErrorCode extends WalletStandardErrorCode>(code: TErrorCode, context?: object): string;
//# sourceMappingURL=message-formatter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"message-formatter.d.ts","sourceRoot":"","sources":["../../src/message-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAgB1D,wBAAgB,4BAA4B,CAAC,UAAU,SAAS,uBAAuB,EACnF,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,MAAW,GACrB,MAAM,CA6DR;AAED,wBAAgB,eAAe,CAAC,UAAU,SAAS,uBAAuB,EACtE,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,MAAW,GACrB,MAAM,CAeR"}

View File

@@ -0,0 +1,12 @@
import type { WalletStandardErrorCode } from './codes.js';
/**
* To add a new error, follow the instructions at
* https://github.com/wallet-standard/wallet-standard/tree/master/packages/core/errors#adding-a-new-error
*
* WARNING:
* - Don't change the meaning of an error message.
*/
export declare const WalletStandardErrorMessages: Readonly<{
[P in WalletStandardErrorCode]: string;
}>;
//# sourceMappingURL=messages.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAU1D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC;KAG9C,CAAC,IAAI,uBAAuB,GAAG,MAAM;CACzC,CAaA,CAAC"}

View File

@@ -0,0 +1,2 @@
export declare function safeCaptureStackTrace(...args: Parameters<typeof Error.captureStackTrace>): void;
//# sourceMappingURL=stack-trace.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"stack-trace.d.ts","sourceRoot":"","sources":["../../src/stack-trace.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAI/F"}