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

202
node_modules/@wallet-standard/app/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
node_modules/@wallet-standard/app/README.md generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# `@wallet-standard/app`
This package defines functions to help apps support Wallets that implement the Wallet Standard.
This package contains TypeScript types and executable JavaScript code.

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

@@ -0,0 +1,18 @@
"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("./wallets.js"), exports);
//# sourceMappingURL=index.js.map

View File

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

View File

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

172
node_modules/@wallet-standard/app/lib/cjs/wallets.js generated vendored Normal file
View File

@@ -0,0 +1,172 @@
"use strict";
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _AppReadyEvent_detail;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEPRECATED_getWallets = exports.getWallets = void 0;
let wallets = undefined;
const registeredWalletsSet = new Set();
function addRegisteredWallet(wallet) {
cachedWalletsArray = undefined;
registeredWalletsSet.add(wallet);
}
function removeRegisteredWallet(wallet) {
cachedWalletsArray = undefined;
registeredWalletsSet.delete(wallet);
}
const listeners = {};
/**
* Get an API for {@link Wallets.get | getting}, {@link Wallets.on | listening for}, and
* {@link Wallets.register | registering} {@link "@wallet-standard/base".Wallet | Wallets}.
*
* When called for the first time --
*
* This dispatches a {@link "@wallet-standard/base".WindowAppReadyEvent} to notify each Wallet that the app is ready
* to register it.
*
* This also adds a listener for {@link "@wallet-standard/base".WindowRegisterWalletEvent} to listen for a notification
* from each Wallet that the Wallet is ready to be registered by the app.
*
* This combination of event dispatch and listener guarantees that each Wallet will be registered synchronously as soon
* as the app is ready whether the app loads before or after each Wallet.
*
* @return API for getting, listening for, and registering Wallets.
*
* @group App
*/
function getWallets() {
if (wallets)
return wallets;
wallets = Object.freeze({ register, get, on });
if (typeof window === 'undefined')
return wallets;
const api = Object.freeze({ register });
try {
window.addEventListener('wallet-standard:register-wallet', ({ detail: callback }) => callback(api));
}
catch (error) {
console.error('wallet-standard:register-wallet event listener could not be added\n', error);
}
try {
window.dispatchEvent(new AppReadyEvent(api));
}
catch (error) {
console.error('wallet-standard:app-ready event could not be dispatched\n', error);
}
return wallets;
}
exports.getWallets = getWallets;
function register(...wallets) {
var _a;
// Filter out wallets that have already been registered.
// This prevents the same wallet from being registered twice, but it also prevents wallets from being
// unregistered by reusing a reference to the wallet to obtain the unregister function for it.
wallets = wallets.filter((wallet) => !registeredWalletsSet.has(wallet));
// If there are no new wallets to register, just return a no-op unregister function.
// eslint-disable-next-line @typescript-eslint/no-empty-function
if (!wallets.length)
return () => { };
wallets.forEach((wallet) => addRegisteredWallet(wallet));
(_a = listeners['register']) === null || _a === void 0 ? void 0 : _a.forEach((listener) => guard(() => listener(...wallets)));
// Return a function that unregisters the registered wallets.
return function unregister() {
var _a;
wallets.forEach((wallet) => removeRegisteredWallet(wallet));
(_a = listeners['unregister']) === null || _a === void 0 ? void 0 : _a.forEach((listener) => guard(() => listener(...wallets)));
};
}
let cachedWalletsArray;
function get() {
if (!cachedWalletsArray) {
cachedWalletsArray = [...registeredWalletsSet];
}
return cachedWalletsArray;
}
function on(event, listener) {
var _a;
((_a = listeners[event]) === null || _a === void 0 ? void 0 : _a.push(listener)) || (listeners[event] = [listener]);
// Return a function that removes the event listener.
return function off() {
var _a;
listeners[event] = (_a = listeners[event]) === null || _a === void 0 ? void 0 : _a.filter((existingListener) => listener !== existingListener);
};
}
function guard(callback) {
try {
callback();
}
catch (error) {
console.error(error);
}
}
class AppReadyEvent extends Event {
get detail() {
return __classPrivateFieldGet(this, _AppReadyEvent_detail, "f");
}
get type() {
return 'wallet-standard:app-ready';
}
constructor(api) {
super('wallet-standard:app-ready', {
bubbles: false,
cancelable: false,
composed: false,
});
_AppReadyEvent_detail.set(this, void 0);
__classPrivateFieldSet(this, _AppReadyEvent_detail, api, "f");
}
/** @deprecated */
preventDefault() {
throw new Error('preventDefault cannot be called');
}
/** @deprecated */
stopImmediatePropagation() {
throw new Error('stopImmediatePropagation cannot be called');
}
/** @deprecated */
stopPropagation() {
throw new Error('stopPropagation cannot be called');
}
}
_AppReadyEvent_detail = new WeakMap();
/**
* @deprecated Use {@link getWallets} instead.
*
* @group Deprecated
*/
function DEPRECATED_getWallets() {
if (wallets)
return wallets;
wallets = getWallets();
if (typeof window === 'undefined')
return wallets;
const callbacks = window.navigator.wallets || [];
if (!Array.isArray(callbacks)) {
console.error('window.navigator.wallets is not an array');
return wallets;
}
const { register } = wallets;
const push = (...callbacks) => callbacks.forEach((callback) => guard(() => callback({ register })));
try {
Object.defineProperty(window.navigator, 'wallets', {
value: Object.freeze({ push }),
});
}
catch (error) {
console.error('window.navigator.wallets could not be set');
return wallets;
}
push(...callbacks);
return wallets;
}
exports.DEPRECATED_getWallets = DEPRECATED_getWallets;
//# sourceMappingURL=wallets.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"wallets.js","sourceRoot":"","sources":["../../src/wallets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AASA,IAAI,OAAO,GAAwB,SAAS,CAAC;AAC7C,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;AAC/C,SAAS,mBAAmB,CAAC,MAAc;IACvC,kBAAkB,GAAG,SAAS,CAAC;IAC/B,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AACD,SAAS,sBAAsB,CAAC,MAAc;IAC1C,kBAAkB,GAAG,SAAS,CAAC;IAC/B,oBAAoB,CAAC,MAAM,CAAC,M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,EAAE,GAAG,OAAO,CAAC;IAC7B,MAAM,IAAI,GAAG,CAAC,GAAG,SAAuC,EAAQ,EAAE,CAC9D,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC;QACD,MAAM,CAAC,cAAc,CAAE,MAAmC,CAAC,SAAS,EAAE,SAAS,EAAE;YAC7E,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC;SACjC,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC3D,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IACnB,OAAO,OAAO,CAAC;AACnB,CAAC;AAzBD,sDAyBC"}

2
node_modules/@wallet-standard/app/lib/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export * from './wallets.js';
//# sourceMappingURL=index.js.map

View File

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

163
node_modules/@wallet-standard/app/lib/esm/wallets.js generated vendored Normal file
View File

@@ -0,0 +1,163 @@
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _AppReadyEvent_detail;
let wallets = undefined;
const registeredWalletsSet = new Set();
function addRegisteredWallet(wallet) {
cachedWalletsArray = undefined;
registeredWalletsSet.add(wallet);
}
function removeRegisteredWallet(wallet) {
cachedWalletsArray = undefined;
registeredWalletsSet.delete(wallet);
}
const listeners = {};
/**
* Get an API for {@link Wallets.get | getting}, {@link Wallets.on | listening for}, and
* {@link Wallets.register | registering} {@link "@wallet-standard/base".Wallet | Wallets}.
*
* When called for the first time --
*
* This dispatches a {@link "@wallet-standard/base".WindowAppReadyEvent} to notify each Wallet that the app is ready
* to register it.
*
* This also adds a listener for {@link "@wallet-standard/base".WindowRegisterWalletEvent} to listen for a notification
* from each Wallet that the Wallet is ready to be registered by the app.
*
* This combination of event dispatch and listener guarantees that each Wallet will be registered synchronously as soon
* as the app is ready whether the app loads before or after each Wallet.
*
* @return API for getting, listening for, and registering Wallets.
*
* @group App
*/
export function getWallets() {
if (wallets)
return wallets;
wallets = Object.freeze({ register, get, on });
if (typeof window === 'undefined')
return wallets;
const api = Object.freeze({ register });
try {
window.addEventListener('wallet-standard:register-wallet', ({ detail: callback }) => callback(api));
}
catch (error) {
console.error('wallet-standard:register-wallet event listener could not be added\n', error);
}
try {
window.dispatchEvent(new AppReadyEvent(api));
}
catch (error) {
console.error('wallet-standard:app-ready event could not be dispatched\n', error);
}
return wallets;
}
function register(...wallets) {
// Filter out wallets that have already been registered.
// This prevents the same wallet from being registered twice, but it also prevents wallets from being
// unregistered by reusing a reference to the wallet to obtain the unregister function for it.
wallets = wallets.filter((wallet) => !registeredWalletsSet.has(wallet));
// If there are no new wallets to register, just return a no-op unregister function.
// eslint-disable-next-line @typescript-eslint/no-empty-function
if (!wallets.length)
return () => { };
wallets.forEach((wallet) => addRegisteredWallet(wallet));
listeners['register']?.forEach((listener) => guard(() => listener(...wallets)));
// Return a function that unregisters the registered wallets.
return function unregister() {
wallets.forEach((wallet) => removeRegisteredWallet(wallet));
listeners['unregister']?.forEach((listener) => guard(() => listener(...wallets)));
};
}
let cachedWalletsArray;
function get() {
if (!cachedWalletsArray) {
cachedWalletsArray = [...registeredWalletsSet];
}
return cachedWalletsArray;
}
function on(event, listener) {
listeners[event]?.push(listener) || (listeners[event] = [listener]);
// Return a function that removes the event listener.
return function off() {
listeners[event] = listeners[event]?.filter((existingListener) => listener !== existingListener);
};
}
function guard(callback) {
try {
callback();
}
catch (error) {
console.error(error);
}
}
class AppReadyEvent extends Event {
get detail() {
return __classPrivateFieldGet(this, _AppReadyEvent_detail, "f");
}
get type() {
return 'wallet-standard:app-ready';
}
constructor(api) {
super('wallet-standard:app-ready', {
bubbles: false,
cancelable: false,
composed: false,
});
_AppReadyEvent_detail.set(this, void 0);
__classPrivateFieldSet(this, _AppReadyEvent_detail, api, "f");
}
/** @deprecated */
preventDefault() {
throw new Error('preventDefault cannot be called');
}
/** @deprecated */
stopImmediatePropagation() {
throw new Error('stopImmediatePropagation cannot be called');
}
/** @deprecated */
stopPropagation() {
throw new Error('stopPropagation cannot be called');
}
}
_AppReadyEvent_detail = new WeakMap();
/**
* @deprecated Use {@link getWallets} instead.
*
* @group Deprecated
*/
export function DEPRECATED_getWallets() {
if (wallets)
return wallets;
wallets = getWallets();
if (typeof window === 'undefined')
return wallets;
const callbacks = window.navigator.wallets || [];
if (!Array.isArray(callbacks)) {
console.error('window.navigator.wallets is not an array');
return wallets;
}
const { register } = wallets;
const push = (...callbacks) => callbacks.forEach((callback) => guard(() => callback({ register })));
try {
Object.defineProperty(window.navigator, 'wallets', {
value: Object.freeze({ push }),
});
}
catch (error) {
console.error('window.navigator.wallets could not be set');
return wallets;
}
push(...callbacks);
return wallets;
}
//# sourceMappingURL=wallets.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"wallets.js","sourceRoot":"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,CAAC;IACvB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,OAAO,CAAC;IAElD,MAAM,SAAS,GAAI,MAAmC,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC;IAC/E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC1D,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,MAAM,IAAI,GAAG,CAAC,GAAG,SAAuC,EAAQ,EAAE,CAC9D,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC;QACD,MAAM,CAAC,cAAc,CAAE,MAAmC,CAAC,SAAS,EAAE,SAAS,EAAE;YAC7E,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC;SACjC,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC3D,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IACnB,OAAO,OAAO,CAAC;AACnB,CAAC"}

View File

@@ -0,0 +1,2 @@
export * from './wallets.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,cAAc,CAAC"}

View File

@@ -0,0 +1,101 @@
import type { Wallet } from '@wallet-standard/base';
/**
* Get an API for {@link Wallets.get | getting}, {@link Wallets.on | listening for}, and
* {@link Wallets.register | registering} {@link "@wallet-standard/base".Wallet | Wallets}.
*
* When called for the first time --
*
* This dispatches a {@link "@wallet-standard/base".WindowAppReadyEvent} to notify each Wallet that the app is ready
* to register it.
*
* This also adds a listener for {@link "@wallet-standard/base".WindowRegisterWalletEvent} to listen for a notification
* from each Wallet that the Wallet is ready to be registered by the app.
*
* This combination of event dispatch and listener guarantees that each Wallet will be registered synchronously as soon
* as the app is ready whether the app loads before or after each Wallet.
*
* @return API for getting, listening for, and registering Wallets.
*
* @group App
*/
export declare function getWallets(): Wallets;
/**
* API for {@link Wallets.get | getting}, {@link Wallets.on | listening for}, and
* {@link Wallets.register | registering} {@link "@wallet-standard/base".Wallet | Wallets}.
*
* @group App
*/
export interface Wallets {
/**
* Get all Wallets that have been registered.
*
* @return Registered Wallets.
*/
get(): readonly Wallet[];
/**
* Add an event listener and subscribe to events for Wallets that are
* {@link WalletsEventsListeners.register | registered} and
* {@link WalletsEventsListeners.unregister | unregistered}.
*
* @param event Event type to listen for. {@link WalletsEventsListeners.register | `register`} and
* {@link WalletsEventsListeners.unregister | `unregister`} are the only event types.
* @param listener Function that will be called when an event of the type is emitted.
*
* @return
* `off` function which may be called to remove the event listener and unsubscribe from events.
*
* As with all event listeners, be careful to avoid memory leaks.
*/
on<E extends WalletsEventNames>(event: E, listener: WalletsEventsListeners[E]): () => void;
/**
* Register Wallets. This can be used to programmatically wrap non-standard wallets as Standard Wallets.
*
* Apps generally do not need to, and should not, call this.
*
* @param wallets Wallets to register.
*
* @return
* `unregister` function which may be called to programmatically unregister the registered Wallets.
*
* Apps generally do not need to, and should not, call this.
*/
register(...wallets: Wallet[]): () => void;
}
/**
* Types of event listeners of the {@link Wallets} API.
*
* @group App
*/
export interface WalletsEventsListeners {
/**
* Emitted when Wallets are registered.
*
* @param wallets Wallets that were registered.
*/
register(...wallets: Wallet[]): void;
/**
* Emitted when Wallets are unregistered.
*
* @param wallets Wallets that were unregistered.
*/
unregister(...wallets: Wallet[]): void;
}
/**
* Names of {@link WalletsEventsListeners} that can be listened for.
*
* @group App
*/
export type WalletsEventNames = keyof WalletsEventsListeners;
/**
* @deprecated Use {@link WalletsEventsListeners} instead.
*
* @group Deprecated
*/
export type WalletsEvents = WalletsEventsListeners;
/**
* @deprecated Use {@link getWallets} instead.
*
* @group Deprecated
*/
export declare function DEPRECATED_getWallets(): Wallets;
//# sourceMappingURL=wallets.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGR,MAAM,EAIT,MAAM,uBAAuB,CAAC;AAc/B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAoBpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACpB;;;;OAIG;IACH,GAAG,IAAI,SAAS,MAAM,EAAE,CAAC;IAEzB;;;;;;;;;;;;;OAaG;IACH,EAAE,CAAC,CAAC,SAAS,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;IAE3F;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC;CAC9C;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAErC;;;;OAIG;IACH,UAAU,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,sBAAsB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAgFnD;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAyB/C"}

38
node_modules/@wallet-standard/app/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "@wallet-standard/app",
"version": "1.1.0",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/wallet-standard/wallet-standard",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=16"
},
"type": "module",
"sideEffects": false,
"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"
},
"dependencies": {
"@wallet-standard/base": "^1.1.0"
},
"devDependencies": {
"shx": "^0.3.4"
},
"scripts": {
"clean": "shx mkdir -p lib && shx rm -rf lib",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
}
}

1
node_modules/@wallet-standard/app/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './wallets.js';

251
node_modules/@wallet-standard/app/src/wallets.ts generated vendored Normal file
View File

@@ -0,0 +1,251 @@
import type {
DEPRECATED_WalletsCallback,
DEPRECATED_WalletsWindow,
Wallet,
WalletEventsWindow,
WindowAppReadyEvent,
WindowAppReadyEventAPI,
} from '@wallet-standard/base';
let wallets: Wallets | undefined = undefined;
const registeredWalletsSet = new Set<Wallet>();
function addRegisteredWallet(wallet: Wallet) {
cachedWalletsArray = undefined;
registeredWalletsSet.add(wallet);
}
function removeRegisteredWallet(wallet: Wallet) {
cachedWalletsArray = undefined;
registeredWalletsSet.delete(wallet);
}
const listeners: { [E in WalletsEventNames]?: WalletsEventsListeners[E][] } = {};
/**
* Get an API for {@link Wallets.get | getting}, {@link Wallets.on | listening for}, and
* {@link Wallets.register | registering} {@link "@wallet-standard/base".Wallet | Wallets}.
*
* When called for the first time --
*
* This dispatches a {@link "@wallet-standard/base".WindowAppReadyEvent} to notify each Wallet that the app is ready
* to register it.
*
* This also adds a listener for {@link "@wallet-standard/base".WindowRegisterWalletEvent} to listen for a notification
* from each Wallet that the Wallet is ready to be registered by the app.
*
* This combination of event dispatch and listener guarantees that each Wallet will be registered synchronously as soon
* as the app is ready whether the app loads before or after each Wallet.
*
* @return API for getting, listening for, and registering Wallets.
*
* @group App
*/
export function getWallets(): Wallets {
if (wallets) return wallets;
wallets = Object.freeze({ register, get, on });
if (typeof window === 'undefined') return wallets;
const api = Object.freeze({ register });
try {
(window as WalletEventsWindow).addEventListener('wallet-standard:register-wallet', ({ detail: callback }) =>
callback(api)
);
} catch (error) {
console.error('wallet-standard:register-wallet event listener could not be added\n', error);
}
try {
(window as WalletEventsWindow).dispatchEvent(new AppReadyEvent(api));
} catch (error) {
console.error('wallet-standard:app-ready event could not be dispatched\n', error);
}
return wallets;
}
/**
* API for {@link Wallets.get | getting}, {@link Wallets.on | listening for}, and
* {@link Wallets.register | registering} {@link "@wallet-standard/base".Wallet | Wallets}.
*
* @group App
*/
export interface Wallets {
/**
* Get all Wallets that have been registered.
*
* @return Registered Wallets.
*/
get(): readonly Wallet[];
/**
* Add an event listener and subscribe to events for Wallets that are
* {@link WalletsEventsListeners.register | registered} and
* {@link WalletsEventsListeners.unregister | unregistered}.
*
* @param event Event type to listen for. {@link WalletsEventsListeners.register | `register`} and
* {@link WalletsEventsListeners.unregister | `unregister`} are the only event types.
* @param listener Function that will be called when an event of the type is emitted.
*
* @return
* `off` function which may be called to remove the event listener and unsubscribe from events.
*
* As with all event listeners, be careful to avoid memory leaks.
*/
on<E extends WalletsEventNames>(event: E, listener: WalletsEventsListeners[E]): () => void;
/**
* Register Wallets. This can be used to programmatically wrap non-standard wallets as Standard Wallets.
*
* Apps generally do not need to, and should not, call this.
*
* @param wallets Wallets to register.
*
* @return
* `unregister` function which may be called to programmatically unregister the registered Wallets.
*
* Apps generally do not need to, and should not, call this.
*/
register(...wallets: Wallet[]): () => void;
}
/**
* Types of event listeners of the {@link Wallets} API.
*
* @group App
*/
export interface WalletsEventsListeners {
/**
* Emitted when Wallets are registered.
*
* @param wallets Wallets that were registered.
*/
register(...wallets: Wallet[]): void;
/**
* Emitted when Wallets are unregistered.
*
* @param wallets Wallets that were unregistered.
*/
unregister(...wallets: Wallet[]): void;
}
/**
* Names of {@link WalletsEventsListeners} that can be listened for.
*
* @group App
*/
export type WalletsEventNames = keyof WalletsEventsListeners;
/**
* @deprecated Use {@link WalletsEventsListeners} instead.
*
* @group Deprecated
*/
export type WalletsEvents = WalletsEventsListeners;
function register(...wallets: Wallet[]): () => void {
// Filter out wallets that have already been registered.
// This prevents the same wallet from being registered twice, but it also prevents wallets from being
// unregistered by reusing a reference to the wallet to obtain the unregister function for it.
wallets = wallets.filter((wallet) => !registeredWalletsSet.has(wallet));
// If there are no new wallets to register, just return a no-op unregister function.
// eslint-disable-next-line @typescript-eslint/no-empty-function
if (!wallets.length) return () => {};
wallets.forEach((wallet) => addRegisteredWallet(wallet));
listeners['register']?.forEach((listener) => guard(() => listener(...wallets)));
// Return a function that unregisters the registered wallets.
return function unregister(): void {
wallets.forEach((wallet) => removeRegisteredWallet(wallet));
listeners['unregister']?.forEach((listener) => guard(() => listener(...wallets)));
};
}
let cachedWalletsArray: readonly Wallet[] | undefined;
function get(): readonly Wallet[] {
if (!cachedWalletsArray) {
cachedWalletsArray = [...registeredWalletsSet];
}
return cachedWalletsArray;
}
function on<E extends WalletsEventNames>(event: E, listener: WalletsEventsListeners[E]): () => void {
listeners[event]?.push(listener) || (listeners[event] = [listener]);
// Return a function that removes the event listener.
return function off(): void {
listeners[event] = listeners[event]?.filter((existingListener) => listener !== existingListener);
};
}
function guard(callback: () => void) {
try {
callback();
} catch (error) {
console.error(error);
}
}
class AppReadyEvent extends Event implements WindowAppReadyEvent {
readonly #detail: WindowAppReadyEventAPI;
get detail() {
return this.#detail;
}
get type() {
return 'wallet-standard:app-ready' as const;
}
constructor(api: WindowAppReadyEventAPI) {
super('wallet-standard:app-ready', {
bubbles: false,
cancelable: false,
composed: false,
});
this.#detail = api;
}
/** @deprecated */
preventDefault(): never {
throw new Error('preventDefault cannot be called');
}
/** @deprecated */
stopImmediatePropagation(): never {
throw new Error('stopImmediatePropagation cannot be called');
}
/** @deprecated */
stopPropagation(): never {
throw new Error('stopPropagation cannot be called');
}
}
/**
* @deprecated Use {@link getWallets} instead.
*
* @group Deprecated
*/
export function DEPRECATED_getWallets(): Wallets {
if (wallets) return wallets;
wallets = getWallets();
if (typeof window === 'undefined') return wallets;
const callbacks = (window as DEPRECATED_WalletsWindow).navigator.wallets || [];
if (!Array.isArray(callbacks)) {
console.error('window.navigator.wallets is not an array');
return wallets;
}
const { register } = wallets;
const push = (...callbacks: DEPRECATED_WalletsCallback[]): void =>
callbacks.forEach((callback) => guard(() => callback({ register })));
try {
Object.defineProperty((window as DEPRECATED_WalletsWindow).navigator, 'wallets', {
value: Object.freeze({ push }),
});
} catch (error) {
console.error('window.navigator.wallets could not be set');
return wallets;
}
push(...callbacks);
return wallets;
}

202
node_modules/@wallet-standard/base/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

9
node_modules/@wallet-standard/base/README.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
# `@wallet-standard/base`
This package defines the foundational TypeScript types of the Wallet Standard, and so provides a practical specification
of the Wallet Standard until a formal specification may be completed.
A wallet that implements the Wallet Standard is referred to as a **Standard Wallet**, or simply a **Wallet**. An account
within a Wallet is referred to as a **WalletAccount** or simply an **Account**.
This package contains only TypeScript types. There is no executable JavaScript code.

3
node_modules/@wallet-standard/base/lib/cjs/bytes.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=bytes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=identifier.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../src/identifier.ts"],"names":[],"mappings":""}

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

@@ -0,0 +1,21 @@
"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("./bytes.js"), exports);
__exportStar(require("./identifier.js"), exports);
__exportStar(require("./wallet.js"), exports);
__exportStar(require("./window.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,kDAAgC;AAChC,8CAA4B;AAC5B,8CAA4B"}

View File

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

3
node_modules/@wallet-standard/base/lib/cjs/wallet.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=wallet.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/wallet.ts"],"names":[],"mappings":""}

3
node_modules/@wallet-standard/base/lib/cjs/window.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=window.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/window.ts"],"names":[],"mappings":""}

2
node_modules/@wallet-standard/base/lib/esm/bytes.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=bytes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=identifier.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../src/identifier.ts"],"names":[],"mappings":""}

5
node_modules/@wallet-standard/base/lib/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export * from './bytes.js';
export * from './identifier.js';
export * from './wallet.js';
export * from './window.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,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}

2
node_modules/@wallet-standard/base/lib/esm/wallet.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=wallet.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/wallet.ts"],"names":[],"mappings":""}

2
node_modules/@wallet-standard/base/lib/esm/window.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=window.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/window.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,6 @@
type TypedArrayMutableProperties = 'copyWithin' | 'fill' | 'reverse' | 'set' | 'sort';
export interface ReadonlyUint8Array extends Omit<Uint8Array, TypedArrayMutableProperties> {
readonly [n: number]: number;
}
export {};
//# sourceMappingURL=bytes.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":"AAAA,KAAK,2BAA2B,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AACtF,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACrF,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC;AAED,OAAO,EAAE,CAAC"}

View File

@@ -0,0 +1,26 @@
/**
* A namespaced identifier in the format `${namespace}:${reference}`.
*
* Used by {@link IdentifierArray} and {@link IdentifierRecord}.
*
* @group Identifier
*/
export type IdentifierString = `${string}:${string}`;
/**
* A read-only array of namespaced identifiers in the format `${namespace}:${reference}`.
*
* Used by {@link Wallet.chains | Wallet::chains}, {@link WalletAccount.chains | WalletAccount::chains}, and
* {@link WalletAccount.features | WalletAccount::features}.
*
* @group Identifier
*/
export type IdentifierArray = readonly IdentifierString[];
/**
* A read-only object with keys of namespaced identifiers in the format `${namespace}:${reference}`.
*
* Used by {@link Wallet.features | Wallet::features}.
*
* @group Identifier
*/
export type IdentifierRecord<T> = Readonly<Record<IdentifierString, T>>;
//# sourceMappingURL=identifier.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../src/identifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,gBAAgB,EAAE,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,5 @@
export * from './bytes.js';
export * from './identifier.js';
export * from './wallet.js';
export * from './window.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,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}

View File

@@ -0,0 +1,152 @@
import type { ReadonlyUint8Array } from './bytes.js';
import type { IdentifierArray, IdentifierRecord } from './identifier.js';
/**
* Version of the Wallet Standard implemented by a {@link Wallet}.
*
* Used by {@link Wallet.version | Wallet::version}.
*
* Note that this is _NOT_ a version of the Wallet, but a version of the Wallet Standard itself that the Wallet
* supports.
*
* This may be used by the app to determine compatibility and feature detect.
*
* @group Wallet
*/
export type WalletVersion = '1.0.0';
/**
* A data URI containing a base64-encoded SVG, WebP, PNG, or GIF image.
*
* Used by {@link Wallet.icon | Wallet::icon} and {@link WalletAccount.icon | WalletAccount::icon}.
*
* @group Wallet
*/
export type WalletIcon = `data:image/${'svg+xml' | 'webp' | 'png' | 'gif'};base64,${string}`;
/**
* Interface of a **Wallet**, also referred to as a **Standard Wallet**.
*
* A Standard Wallet implements and adheres to the Wallet Standard.
*
* @group Wallet
*/
export interface Wallet {
/**
* {@link WalletVersion | Version} of the Wallet Standard implemented by the Wallet.
*
* Must be read-only, static, and canonically defined by the Wallet Standard.
*/
readonly version: WalletVersion;
/**
* Name of the Wallet. This may be displayed by the app.
*
* Must be read-only, static, descriptive, unique, and canonically defined by the wallet extension or application.
*/
readonly name: string;
/**
* {@link WalletIcon | Icon} of the Wallet. This may be displayed by the app.
*
* Must be read-only, static, and canonically defined by the wallet extension or application.
*/
readonly icon: WalletIcon;
/**
* Chains supported by the Wallet.
*
* A **chain** is an {@link IdentifierString} which identifies a blockchain in a canonical, human-readable format.
* [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) chain IDs are compatible with this,
* but are not required to be used.
*
* Each blockchain should define its own **chains** by extension of the Wallet Standard, using its own namespace.
* The `standard` and `experimental` namespaces are reserved by the Wallet Standard.
*
* The {@link "@wallet-standard/features".EventsFeature | `standard:events` feature} should be used to notify the
* app if the value changes.
*/
readonly chains: IdentifierArray;
/**
* Features supported by the Wallet.
*
* A **feature name** is an {@link IdentifierString} which identifies a **feature** in a canonical, human-readable
* format.
*
* Each blockchain should define its own features by extension of the Wallet Standard.
*
* The `standard` and `experimental` namespaces are reserved by the Wallet Standard.
*
* A **feature** may have any type. It may be a single method or value, or a collection of them.
*
* A **conventional feature** has the following structure:
*
* ```ts
* export type ExperimentalEncryptFeature = {
* // Name of the feature.
* 'experimental:encrypt': {
* // Version of the feature.
* version: '1.0.0';
* // Properties of the feature.
* ciphers: readonly 'x25519-xsalsa20-poly1305'[];
* // Methods of the feature.
* encrypt (data: Uint8Array): Promise<Uint8Array>;
* };
* };
* ```
*
* The {@link "@wallet-standard/features".EventsFeature | `standard:events` feature} should be used to notify the
* app if the value changes.
*/
readonly features: IdentifierRecord<unknown>;
/**
* {@link WalletAccount | Accounts} that the app is authorized to use.
*
* This can be set by the Wallet so the app can use authorized accounts on the initial page load.
*
* The {@link "@wallet-standard/features".ConnectFeature | `standard:connect` feature} should be used to obtain
* authorization to the accounts.
*
* The {@link "@wallet-standard/features".EventsFeature | `standard:events` feature} should be used to notify the
* app if the value changes.
*/
readonly accounts: readonly WalletAccount[];
}
/**
* Interface of a **WalletAccount**, also referred to as an **Account**.
*
* An account is a _read-only data object_ that is provided from the Wallet to the app, authorizing the app to use it.
*
* The app can use an account to display and query information from a chain.
*
* The app can also act using an account by passing it to {@link Wallet.features | features} of the Wallet.
*
* Wallets may use or extend {@link "@wallet-standard/wallet".ReadonlyWalletAccount} which implements this interface.
*
* @group Wallet
*/
export interface WalletAccount {
/** Address of the account, corresponding with a public key. */
readonly address: string;
/** Public key of the account, corresponding with a secret key to use. */
readonly publicKey: ReadonlyUint8Array;
/**
* Chains supported by the account.
*
* This must be a subset of the {@link Wallet.chains | chains} of the Wallet.
*/
readonly chains: IdentifierArray;
/**
* Feature names supported by the account.
*
* This must be a subset of the names of {@link Wallet.features | features} of the Wallet.
*/
readonly features: IdentifierArray;
/** Optional user-friendly descriptive label or name for the account. This may be displayed by the app. */
readonly label?: string;
/** Optional user-friendly icon for the account. This may be displayed by the app. */
readonly icon?: WalletIcon;
}
/**
* Helper type for defining a {@link Wallet} with a union or intersection of {@link Wallet.features | features}.
*
* @group Wallet
*/
export type WalletWithFeatures<Features extends Wallet['features']> = Omit<Wallet, 'features'> & {
features: Features;
};
//# sourceMappingURL=wallet.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAoB,MAAM,iBAAiB,CAAC;AAE3F;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,WAAW,MAAM,EAAE,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACnB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE7C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;CAC/C;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEnC,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB,qFAAqF;IACrF,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,QAAQ,SAAS,MAAM,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG;IAC7F,QAAQ,EAAE,QAAQ,CAAC;CACtB,CAAC"}

View File

@@ -0,0 +1,136 @@
import type { Wallet } from './wallet.js';
/**
* Global `window` type for dispatching and listening for {@link WindowAppReadyEvent} and {@link WindowRegisterWalletEvent}.
*
* ```ts
* import { WalletEventsWindow } from '@wallet-standard/base';
*
* declare const window: WalletEventsWindow;
* // OR
* (window as WalletEventsWindow)
* ```
*
* @group Window
*/
export interface WalletEventsWindow extends Omit<Window, 'addEventListener' | 'dispatchEvent'> {
/** Add a listener for {@link WindowAppReadyEvent}. */
addEventListener(type: WindowAppReadyEventType, listener: (event: WindowAppReadyEvent) => void): void;
/** Add a listener for {@link WindowRegisterWalletEvent}. */
addEventListener(type: WindowRegisterWalletEventType, listener: (event: WindowRegisterWalletEvent) => void): void;
/** Dispatch a {@link WindowAppReadyEvent}. */
dispatchEvent(event: WindowAppReadyEvent): void;
/** Dispatch a {@link WindowRegisterWalletEvent}. */
dispatchEvent(event: WindowRegisterWalletEvent): void;
}
/**
* Type of {@link WindowAppReadyEvent}.
*
* @group App Ready Event
*/
export type WindowAppReadyEventType = 'wallet-standard:app-ready';
/** Interface that will be provided to {@link Wallet | Wallets} by the app when the app calls the
* {@link WindowRegisterWalletEventCallback} provided by Wallets.
*
* Wallets must call the {@link WindowAppReadyEventAPI.register | register} method to register themselves.
*
* @group App Ready Event
*/
export interface WindowAppReadyEventAPI {
/**
* Register a {@link Wallet} with the app.
*
* @return
* `unregister` function to programmatically unregister the Wallet.
*
* Wallets generally do not need to, and should not, call this.
*/
register(wallet: Wallet): () => void;
}
/**
* Event that will be dispatched by the app on the `window` when the app is ready to register {@link Wallet | Wallets}.
*
* Wallets must listen for this event, and {@link WindowAppReadyEventAPI.register register} themselves when the event is
* dispatched.
*
* @group App Ready Event
*/
export type WindowAppReadyEvent = UnstoppableCustomEvent<WindowAppReadyEventType, WindowAppReadyEventAPI>;
/**
* Type of {@link WindowRegisterWalletEvent}.
*
* @group Register Wallet Event
*/
export type WindowRegisterWalletEventType = 'wallet-standard:register-wallet';
/**
* Callback function provided by {@link Wallet | Wallets} to be called by the app when the app is ready to register
* Wallets.
*
* @group Register Wallet Event
*/
export type WindowRegisterWalletEventCallback = (api: WindowAppReadyEventAPI) => void;
/**
* Event that will be dispatched on the `window` by each {@link Wallet | Wallet} when the Wallet is ready to be
* registered by the app.
*
* The app must listen for this event, and register Wallets when the event is dispatched.
*
* @group Register Wallet Event
*/
export type WindowRegisterWalletEvent = UnstoppableCustomEvent<WindowRegisterWalletEventType, WindowRegisterWalletEventCallback>;
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export interface DEPRECATED_WalletsWindow extends Window {
navigator: DEPRECATED_WalletsNavigator;
}
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export interface DEPRECATED_WalletsNavigator extends Navigator {
wallets?: DEPRECATED_Wallets;
}
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export interface DEPRECATED_Wallets {
push(...callbacks: DEPRECATED_WalletsCallback[]): void;
}
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export type DEPRECATED_WalletsCallback = (wallets: {
register(...wallets: Wallet[]): () => void;
}) => void;
/**
* @internal
*
* A custom event that cannot have its default behavior prevented or its propagation stopped.
*
* This is an internal type, extended by {@link WindowAppReadyEvent} and {@link WindowRegisterWalletEvent}.
*
* [`window.CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent) is not used because
* Node.js doesn't have it, but this interface is compatible with it.
*
* @group Internal
*/
export interface UnstoppableCustomEvent<T extends string, D> extends Event {
/** Type of the event. */
readonly type: T;
/** Data attached to the event. */
readonly detail: D;
/** @deprecated Does nothing and throws an error if called. */
preventDefault(): never;
/** @deprecated Does nothing and throws an error if called. */
stopImmediatePropagation(): never;
/** @deprecated Does nothing and throws an error if called. */
stopPropagation(): never;
}
//# sourceMappingURL=window.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,MAAM,EAAE,kBAAkB,GAAG,eAAe,CAAC;IAC1F,sDAAsD;IACtD,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI,CAAC;IACtG,4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MAAM,EAAE,GAAG,MAAM,IAAI,CAAA;CAAE,KAAK,IAAI,CAAC;AAE3G;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,CAAE,SAAQ,KAAK;IACtE,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,8DAA8D;IAC9D,cAAc,IAAI,KAAK,CAAC;IACxB,8DAA8D;IAC9D,wBAAwB,IAAI,KAAK,CAAC;IAClC,8DAA8D;IAC9D,eAAe,IAAI,KAAK,CAAC;CAC5B"}

35
node_modules/@wallet-standard/base/package.json generated vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "@wallet-standard/base",
"version": "1.1.0",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/wallet-standard/wallet-standard",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=16"
},
"type": "module",
"sideEffects": false,
"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"
},
"devDependencies": {
"shx": "^0.3.4"
},
"scripts": {
"clean": "shx mkdir -p lib && shx rm -rf lib",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
}
}

6
node_modules/@wallet-standard/base/src/bytes.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
type TypedArrayMutableProperties = 'copyWithin' | 'fill' | 'reverse' | 'set' | 'sort';
export interface ReadonlyUint8Array extends Omit<Uint8Array, TypedArrayMutableProperties> {
readonly [n: number]: number;
}
export {};

27
node_modules/@wallet-standard/base/src/identifier.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* A namespaced identifier in the format `${namespace}:${reference}`.
*
* Used by {@link IdentifierArray} and {@link IdentifierRecord}.
*
* @group Identifier
*/
export type IdentifierString = `${string}:${string}`;
/**
* A read-only array of namespaced identifiers in the format `${namespace}:${reference}`.
*
* Used by {@link Wallet.chains | Wallet::chains}, {@link WalletAccount.chains | WalletAccount::chains}, and
* {@link WalletAccount.features | WalletAccount::features}.
*
* @group Identifier
*/
export type IdentifierArray = readonly IdentifierString[];
/**
* A read-only object with keys of namespaced identifiers in the format `${namespace}:${reference}`.
*
* Used by {@link Wallet.features | Wallet::features}.
*
* @group Identifier
*/
export type IdentifierRecord<T> = Readonly<Record<IdentifierString, T>>;

4
node_modules/@wallet-standard/base/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from './bytes.js';
export * from './identifier.js';
export * from './wallet.js';
export * from './window.js';

166
node_modules/@wallet-standard/base/src/wallet.ts generated vendored Normal file
View File

@@ -0,0 +1,166 @@
import type { ReadonlyUint8Array } from './bytes.js';
import type { IdentifierArray, IdentifierRecord, IdentifierString } from './identifier.js';
/**
* Version of the Wallet Standard implemented by a {@link Wallet}.
*
* Used by {@link Wallet.version | Wallet::version}.
*
* Note that this is _NOT_ a version of the Wallet, but a version of the Wallet Standard itself that the Wallet
* supports.
*
* This may be used by the app to determine compatibility and feature detect.
*
* @group Wallet
*/
export type WalletVersion = '1.0.0';
/**
* A data URI containing a base64-encoded SVG, WebP, PNG, or GIF image.
*
* Used by {@link Wallet.icon | Wallet::icon} and {@link WalletAccount.icon | WalletAccount::icon}.
*
* @group Wallet
*/
export type WalletIcon = `data:image/${'svg+xml' | 'webp' | 'png' | 'gif'};base64,${string}`;
/**
* Interface of a **Wallet**, also referred to as a **Standard Wallet**.
*
* A Standard Wallet implements and adheres to the Wallet Standard.
*
* @group Wallet
*/
export interface Wallet {
/**
* {@link WalletVersion | Version} of the Wallet Standard implemented by the Wallet.
*
* Must be read-only, static, and canonically defined by the Wallet Standard.
*/
readonly version: WalletVersion;
/**
* Name of the Wallet. This may be displayed by the app.
*
* Must be read-only, static, descriptive, unique, and canonically defined by the wallet extension or application.
*/
readonly name: string;
/**
* {@link WalletIcon | Icon} of the Wallet. This may be displayed by the app.
*
* Must be read-only, static, and canonically defined by the wallet extension or application.
*/
readonly icon: WalletIcon;
/**
* Chains supported by the Wallet.
*
* A **chain** is an {@link IdentifierString} which identifies a blockchain in a canonical, human-readable format.
* [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) chain IDs are compatible with this,
* but are not required to be used.
*
* Each blockchain should define its own **chains** by extension of the Wallet Standard, using its own namespace.
* The `standard` and `experimental` namespaces are reserved by the Wallet Standard.
*
* The {@link "@wallet-standard/features".EventsFeature | `standard:events` feature} should be used to notify the
* app if the value changes.
*/
readonly chains: IdentifierArray;
/**
* Features supported by the Wallet.
*
* A **feature name** is an {@link IdentifierString} which identifies a **feature** in a canonical, human-readable
* format.
*
* Each blockchain should define its own features by extension of the Wallet Standard.
*
* The `standard` and `experimental` namespaces are reserved by the Wallet Standard.
*
* A **feature** may have any type. It may be a single method or value, or a collection of them.
*
* A **conventional feature** has the following structure:
*
* ```ts
* export type ExperimentalEncryptFeature = {
* // Name of the feature.
* 'experimental:encrypt': {
* // Version of the feature.
* version: '1.0.0';
* // Properties of the feature.
* ciphers: readonly 'x25519-xsalsa20-poly1305'[];
* // Methods of the feature.
* encrypt (data: Uint8Array): Promise<Uint8Array>;
* };
* };
* ```
*
* The {@link "@wallet-standard/features".EventsFeature | `standard:events` feature} should be used to notify the
* app if the value changes.
*/
readonly features: IdentifierRecord<unknown>;
/**
* {@link WalletAccount | Accounts} that the app is authorized to use.
*
* This can be set by the Wallet so the app can use authorized accounts on the initial page load.
*
* The {@link "@wallet-standard/features".ConnectFeature | `standard:connect` feature} should be used to obtain
* authorization to the accounts.
*
* The {@link "@wallet-standard/features".EventsFeature | `standard:events` feature} should be used to notify the
* app if the value changes.
*/
readonly accounts: readonly WalletAccount[];
}
/**
* Interface of a **WalletAccount**, also referred to as an **Account**.
*
* An account is a _read-only data object_ that is provided from the Wallet to the app, authorizing the app to use it.
*
* The app can use an account to display and query information from a chain.
*
* The app can also act using an account by passing it to {@link Wallet.features | features} of the Wallet.
*
* Wallets may use or extend {@link "@wallet-standard/wallet".ReadonlyWalletAccount} which implements this interface.
*
* @group Wallet
*/
export interface WalletAccount {
/** Address of the account, corresponding with a public key. */
readonly address: string;
/** Public key of the account, corresponding with a secret key to use. */
readonly publicKey: ReadonlyUint8Array;
/**
* Chains supported by the account.
*
* This must be a subset of the {@link Wallet.chains | chains} of the Wallet.
*/
readonly chains: IdentifierArray;
/**
* Feature names supported by the account.
*
* This must be a subset of the names of {@link Wallet.features | features} of the Wallet.
*/
readonly features: IdentifierArray;
/** Optional user-friendly descriptive label or name for the account. This may be displayed by the app. */
readonly label?: string;
/** Optional user-friendly icon for the account. This may be displayed by the app. */
readonly icon?: WalletIcon;
}
/**
* Helper type for defining a {@link Wallet} with a union or intersection of {@link Wallet.features | features}.
*
* @group Wallet
*/
export type WalletWithFeatures<Features extends Wallet['features']> = Omit<Wallet, 'features'> & {
features: Features;
};

148
node_modules/@wallet-standard/base/src/window.ts generated vendored Normal file
View File

@@ -0,0 +1,148 @@
import type { Wallet } from './wallet.js';
/**
* Global `window` type for dispatching and listening for {@link WindowAppReadyEvent} and {@link WindowRegisterWalletEvent}.
*
* ```ts
* import { WalletEventsWindow } from '@wallet-standard/base';
*
* declare const window: WalletEventsWindow;
* // OR
* (window as WalletEventsWindow)
* ```
*
* @group Window
*/
export interface WalletEventsWindow extends Omit<Window, 'addEventListener' | 'dispatchEvent'> {
/** Add a listener for {@link WindowAppReadyEvent}. */
addEventListener(type: WindowAppReadyEventType, listener: (event: WindowAppReadyEvent) => void): void;
/** Add a listener for {@link WindowRegisterWalletEvent}. */
addEventListener(type: WindowRegisterWalletEventType, listener: (event: WindowRegisterWalletEvent) => void): void;
/** Dispatch a {@link WindowAppReadyEvent}. */
dispatchEvent(event: WindowAppReadyEvent): void;
/** Dispatch a {@link WindowRegisterWalletEvent}. */
dispatchEvent(event: WindowRegisterWalletEvent): void;
}
/**
* Type of {@link WindowAppReadyEvent}.
*
* @group App Ready Event
*/
export type WindowAppReadyEventType = 'wallet-standard:app-ready';
/** Interface that will be provided to {@link Wallet | Wallets} by the app when the app calls the
* {@link WindowRegisterWalletEventCallback} provided by Wallets.
*
* Wallets must call the {@link WindowAppReadyEventAPI.register | register} method to register themselves.
*
* @group App Ready Event
*/
export interface WindowAppReadyEventAPI {
/**
* Register a {@link Wallet} with the app.
*
* @return
* `unregister` function to programmatically unregister the Wallet.
*
* Wallets generally do not need to, and should not, call this.
*/
register(wallet: Wallet): () => void;
}
/**
* Event that will be dispatched by the app on the `window` when the app is ready to register {@link Wallet | Wallets}.
*
* Wallets must listen for this event, and {@link WindowAppReadyEventAPI.register register} themselves when the event is
* dispatched.
*
* @group App Ready Event
*/
export type WindowAppReadyEvent = UnstoppableCustomEvent<WindowAppReadyEventType, WindowAppReadyEventAPI>;
/**
* Type of {@link WindowRegisterWalletEvent}.
*
* @group Register Wallet Event
*/
export type WindowRegisterWalletEventType = 'wallet-standard:register-wallet';
/**
* Callback function provided by {@link Wallet | Wallets} to be called by the app when the app is ready to register
* Wallets.
*
* @group Register Wallet Event
*/
export type WindowRegisterWalletEventCallback = (api: WindowAppReadyEventAPI) => void;
/**
* Event that will be dispatched on the `window` by each {@link Wallet | Wallet} when the Wallet is ready to be
* registered by the app.
*
* The app must listen for this event, and register Wallets when the event is dispatched.
*
* @group Register Wallet Event
*/
export type WindowRegisterWalletEvent = UnstoppableCustomEvent<
WindowRegisterWalletEventType,
WindowRegisterWalletEventCallback
>;
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export interface DEPRECATED_WalletsWindow extends Window {
navigator: DEPRECATED_WalletsNavigator;
}
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export interface DEPRECATED_WalletsNavigator extends Navigator {
wallets?: DEPRECATED_Wallets;
}
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export interface DEPRECATED_Wallets {
push(...callbacks: DEPRECATED_WalletsCallback[]): void;
}
/**
* @deprecated Use {@link WalletEventsWindow} instead.
*
* @group Deprecated
*/
export type DEPRECATED_WalletsCallback = (wallets: { register(...wallets: Wallet[]): () => void }) => void;
/**
* @internal
*
* A custom event that cannot have its default behavior prevented or its propagation stopped.
*
* This is an internal type, extended by {@link WindowAppReadyEvent} and {@link WindowRegisterWalletEvent}.
*
* [`window.CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent) is not used because
* Node.js doesn't have it, but this interface is compatible with it.
*
* @group Internal
*/
export interface UnstoppableCustomEvent<T extends string, D> extends Event {
/** Type of the event. */
readonly type: T;
/** Data attached to the event. */
readonly detail: D;
/** @deprecated Does nothing and throws an error if called. */
preventDefault(): never;
/** @deprecated Does nothing and throws an error if called. */
stopImmediatePropagation(): never;
/** @deprecated Does nothing and throws an error if called. */
stopPropagation(): never;
}

202
node_modules/@wallet-standard/core/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

0
node_modules/@wallet-standard/core/README.md generated vendored Normal file
View File

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

@@ -0,0 +1,22 @@
"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("@wallet-standard/app"), exports);
__exportStar(require("@wallet-standard/base"), exports);
__exportStar(require("@wallet-standard/errors"), exports);
__exportStar(require("@wallet-standard/features"), exports);
__exportStar(require("@wallet-standard/wallet"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,wDAAsC;AACtC,0DAAwC;AACxC,4DAA0C;AAC1C,0DAAwC"}

View File

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

View File

@@ -0,0 +1 @@
{"root":["../../src/index.ts"],"version":"5.8.3"}

6
node_modules/@wallet-standard/core/lib/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export * from '@wallet-standard/app';
export * from '@wallet-standard/base';
export * from '@wallet-standard/errors';
export * from '@wallet-standard/features';
export * from '@wallet-standard/wallet';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}

View File

@@ -0,0 +1 @@
{"root":["../../src/index.ts"],"version":"5.8.3"}

View File

@@ -0,0 +1,6 @@
export * from '@wallet-standard/app';
export * from '@wallet-standard/base';
export * from '@wallet-standard/errors';
export * from '@wallet-standard/features';
export * from '@wallet-standard/wallet';
//# 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,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}

42
node_modules/@wallet-standard/core/package.json generated vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"name": "@wallet-standard/core",
"version": "1.1.1",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/wallet-standard/wallet-standard",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=16"
},
"type": "module",
"sideEffects": false,
"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"
},
"dependencies": {
"@wallet-standard/app": "^1.1.0",
"@wallet-standard/base": "^1.1.0",
"@wallet-standard/errors": "^0.1.1",
"@wallet-standard/features": "^1.1.0",
"@wallet-standard/wallet": "^1.1.0"
},
"devDependencies": {
"shx": "^0.4.0"
},
"scripts": {
"clean": "shx mkdir -p lib && shx rm -rf lib",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
}
}

5
node_modules/@wallet-standard/core/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export * from '@wallet-standard/app';
export * from '@wallet-standard/base';
export * from '@wallet-standard/errors';
export * from '@wallet-standard/features';
export * from '@wallet-standard/wallet';

202
node_modules/@wallet-standard/errors/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

73
node_modules/@wallet-standard/errors/README.md generated vendored Normal file
View File

@@ -0,0 +1,73 @@
# `@wallet-standard/errors`
This package brings together every error message across all Wallet Standard JavaScript modules.
## Reading error messages
### In development mode
When your bundler sets the environment variable `NODE_ENV` to `development`, every error message will be included in the bundle. As such, you will be able to read them in plain language wherever they appear.
> [!WARNING]
> The size of your JavaScript bundle will increase significantly with the inclusion of every error message in development mode. Be sure to build your bundle with `NODE_ENV` set to `production` when you go to production.
### In production mode
When your bundler sets the environment variable `NODE_ENV` to anything other than `development`, error messages will be stripped from the bundle to save space. Only the error code will appear when an error is encountered. Follow the instructions in the error message to convert the error code back to the human-readable error message.
For instance, to recover the error text for the error with code `123`:
```shell
npx @wallet-standard/errors decode -- 123
```
## Adding a new error
1. Add a new exported error code constant to `src/codes.ts`.
2. Add that new constant to the `WalletStandardErrorCode` union in `src/codes.ts`.
3. If you would like the new error to encapsulate context about the error itself (eg. the public keys for which a transaction is missing signatures) define the shape of that context in `src/context.ts`.
4. Add the error's message to `src/messages.ts`. Any context values that you defined above will be interpolated into the message wherever you write `$key`, where `key` is the index of a value in the context (eg. ``'Missing a signature for account `$address`'``).
5. Publish a new version of `@wallet-standard/errors`.
6. Bump the version of `@wallet-standard/errors` in the package from which the error is thrown.
## Removing an error message
- Don't remove errors.
- Don't change the meaning of an error message.
- Don't change or reorder error codes.
- Don't change or remove members of an error's context.
When an older client throws an error, we want to make sure that they can always decode the error. If you make any of the changes above, old clients will, by definition, not have received your changes. This could make the errors that they throw impossible to decode going forward.
## Catching errors
When you catch a `WalletStandardError` and assert its error code using `isWalletStandardError()`, TypeScript will refine the error's context to the type associated with that error code. You can use that context to render useful error messages, or to make context-aware decisions that help your application to recover from the error.
```tsx
import { WALLET_STANDARD_ERROR__ACCOUNT__FEATURE_NOT_SUPPORTED, isWalletStandardError } from '@wallet-standard/errors';
function MyComponent(props) {
return (
<ErrorBoundary FallbackComponent={ErrorComponent}>
<SignMessageForm account={props.account} />
</ErrorBoundary>
);
}
function ErrorComponent({ error }) {
if (
isWalletStandardError(error, WALLET_STANDARD_ERROR__ACCOUNT__FEATURE_NOT_SUPPORTED) &&
error.context.featureName === 'solana:signMessage'
) {
return (
<span>
The account <AccountLink account={error.account} /> does not support signing messages. Please choose
another account.
</span>
);
} else if (error && typeof error === 'object' && 'message' in error) {
return <span>{String(error.message)}</span>;
} else {
return <span>Something went wrong</span>;
}
}
```

7
node_modules/@wallet-standard/errors/bin/cli.mjs generated vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env -S node
import process from 'node:process';
import { run } from '../lib/cli.mjs';
run(process.argv);

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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GAAG,EAAE,CAAC;oBACtB,SAAS,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC;gBAClE,CAAC;qBAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC3B,SAAS,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;gBAC9D,CAAC;gBACD,MAAM;QACd,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACZ,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,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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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T_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

Some files were not shown because too many files have changed in this diff Show More