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/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,4DAA4D;IAC5D,gBAAgB,CAAC,IAAI,EAAE,6BAA6B,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,GAAG,IAAI,CAAC;IAClH,8CAA8C;IAC9C,aAAa,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAChD,oDAAoD;IACpD,aAAa,CAAC,KAAK,EAAE,yBAAyB,GAAG,IAAI,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAC;AAE1G;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,iCAAiC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,GAAG,EAAE,sBAAsB,KAAK,IAAI,CAAC;AAEtF;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAC1D,6BAA6B,EAC7B,iCAAiC,CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,MAAM;IACpD,SAAS,EAAE,2BAA2B,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC1D,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,CAAC,GAAG,SAAS,EAAE,0BAA0B,EAAE,GAAG,IAAI,CAAC;CAC1D;AAED;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,GAAG,OAAO,EAAE,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;
}