@reclack/walletkit 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +392 -2
- package/assets/backpack.webp +0 -0
- package/assets/berasig.webp +0 -0
- package/assets/bestwallet.webp +0 -0
- package/assets/bifrostwallet.webp +0 -0
- package/assets/binance.webp +0 -0
- package/assets/bitcoincom.webp +0 -0
- package/assets/bitget.webp +0 -0
- package/assets/bitpay.webp +0 -0
- package/assets/bitski.webp +0 -0
- package/assets/bitverse.webp +0 -0
- package/assets/blockchaincom.webp +0 -0
- package/assets/brave.webp +0 -0
- package/assets/bybit.webp +0 -0
- package/assets/clv.webp +0 -0
- package/assets/coin98.webp +0 -0
- package/assets/coinbase.webp +0 -0
- package/assets/compass.webp +0 -0
- package/assets/core.webp +0 -0
- package/assets/crypto_com.webp +0 -0
- package/assets/ctrl.webp +0 -0
- package/assets/dawn.webp +0 -0
- package/assets/desig.webp +0 -0
- package/assets/enkrypt.webp +0 -0
- package/assets/exodus.webp +0 -0
- package/assets/foxwallet.webp +0 -0
- package/assets/frame.webp +0 -0
- package/assets/frontier.webp +0 -0
- package/assets/gate.webp +0 -0
- package/assets/gemini.webp +0 -0
- package/assets/imtoken.webp +0 -0
- package/assets/iopay.webp +0 -0
- package/assets/kaia.webp +0 -0
- package/assets/kaikas.webp +0 -0
- package/assets/kraken.webp +0 -0
- package/assets/kresuswallet.webp +0 -0
- package/assets/ledger.webp +0 -0
- package/assets/magiceden.webp +0 -0
- package/assets/meco.webp +0 -0
- package/assets/metamask.webp +0 -0
- package/assets/mew.webp +0 -0
- package/assets/nest.webp +0 -0
- package/assets/nova.webp +0 -0
- package/assets/okto.webp +0 -0
- package/assets/okx.webp +0 -0
- package/assets/oneinch.webp +0 -0
- package/assets/onekey.webp +0 -0
- package/assets/phantom.webp +0 -0
- package/assets/rabby.webp +0 -0
- package/assets/rainbow.webp +0 -0
- package/assets/ramper.webp +0 -0
- package/assets/ready.webp +0 -0
- package/assets/ronin.webp +0 -0
- package/assets/safe.webp +0 -0
- package/assets/safepal.webp +0 -0
- package/assets/solflare.webp +0 -0
- package/assets/subwallet.webp +0 -0
- package/assets/taho.webp +0 -0
- package/assets/talisman.webp +0 -0
- package/assets/tokenary.webp +0 -0
- package/assets/tokenpocket.webp +0 -0
- package/assets/trust-wallet.webp +0 -0
- package/assets/uniswap.webp +0 -0
- package/assets/universalprofiles.webp +0 -0
- package/assets/valora.webp +0 -0
- package/assets/wigwam.webp +0 -0
- package/assets/xportal.webp +0 -0
- package/assets/zeal.webp +0 -0
- package/assets/zerion.webp +0 -0
- package/custom-elements.json +207 -0
- package/dist/abi.d.ts +21 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +50 -0
- package/dist/abi.js.map +1 -0
- package/dist/address.d.ts +15 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +25 -0
- package/dist/address.js.map +1 -0
- package/dist/balance.d.ts +78 -0
- package/dist/balance.d.ts.map +1 -0
- package/dist/balance.js +146 -0
- package/dist/balance.js.map +1 -0
- package/dist/base58.d.ts +15 -0
- package/dist/base58.d.ts.map +1 -0
- package/dist/base58.js +52 -0
- package/dist/base58.js.map +1 -0
- package/dist/catalog-fetch.d.ts +18 -0
- package/dist/catalog-fetch.d.ts.map +1 -0
- package/dist/catalog-fetch.js +85 -0
- package/dist/catalog-fetch.js.map +1 -0
- package/dist/catalog.d.ts +57 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +80 -0
- package/dist/catalog.js.map +1 -0
- package/dist/chains.d.ts +32 -0
- package/dist/chains.d.ts.map +1 -0
- package/dist/chains.js +103 -0
- package/dist/chains.js.map +1 -0
- package/dist/config.d.ts +40 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +44 -0
- package/dist/config.js.map +1 -0
- package/dist/deep-links.d.ts +22 -0
- package/dist/deep-links.d.ts.map +1 -0
- package/dist/deep-links.js +201 -0
- package/dist/deep-links.js.map +1 -0
- package/dist/device.d.ts +23 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/device.js +59 -0
- package/dist/device.js.map +1 -0
- package/dist/element/attributes.d.ts +48 -0
- package/dist/element/element.d.ts +92 -0
- package/dist/element/index.d.ts +4 -0
- package/dist/element/props.d.ts +67 -0
- package/dist/element/ui/app.d.ts +22 -0
- package/dist/element/ui/assets.d.ts +7 -0
- package/dist/element/ui/qr.d.ts +16 -0
- package/dist/element/ui/use-handheld.d.ts +8 -0
- package/dist/element/ui/wallet-connect-panel.d.ts +26 -0
- package/dist/element/ui/wallet-dialog.d.ts +37 -0
- package/dist/element/ui/wallet-list.d.ts +26 -0
- package/dist/element/ui/wallet-mark.d.ts +15 -0
- package/dist/element.js +2079 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +64 -0
- package/dist/errors.js.map +1 -0
- package/dist/evm.d.ts +49 -0
- package/dist/evm.d.ts.map +1 -0
- package/dist/evm.js +217 -0
- package/dist/evm.js.map +1 -0
- package/dist/icons.d.ts +22 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +98 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/intent.d.ts +60 -0
- package/dist/intent.d.ts.map +1 -0
- package/dist/intent.js +2 -0
- package/dist/intent.js.map +1 -0
- package/dist/kit.d.ts +124 -0
- package/dist/kit.d.ts.map +1 -0
- package/dist/kit.js +362 -0
- package/dist/kit.js.map +1 -0
- package/dist/svm.d.ts +45 -0
- package/dist/svm.d.ts.map +1 -0
- package/dist/svm.js +201 -0
- package/dist/svm.js.map +1 -0
- package/dist/theme.d.ts +101 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +217 -0
- package/dist/theme.js.map +1 -0
- package/dist/types.d.ts +144 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/wallet-standard.d.ts +77 -0
- package/dist/wallet-standard.d.ts.map +1 -0
- package/dist/wallet-standard.js +89 -0
- package/dist/wallet-standard.js.map +1 -0
- package/dist/walletconnect.d.ts +74 -0
- package/dist/walletconnect.d.ts.map +1 -0
- package/dist/walletconnect.js +133 -0
- package/dist/walletconnect.js.map +1 -0
- package/package.json +71 -3
- package/vscode.html-custom-data.json +55 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WalletEntry } from './catalog.js';
|
|
2
|
+
/**
|
|
3
|
+
* The wallets Reclack can name, read from public configuration.
|
|
4
|
+
*
|
|
5
|
+
* Configuration rather than a list in a bundle, because four places kept
|
|
6
|
+
* their own copy and they drifted: the hosted checkout, the dashboard, the
|
|
7
|
+
* marketing site, and a second list inside the checkout itself. This is the
|
|
8
|
+
* one reader they all now share.
|
|
9
|
+
*
|
|
10
|
+
* Never throws, and an empty catalogue is a working page rather than a broken
|
|
11
|
+
* one. Wallets that announce themselves, over EIP-6963 or the Wallet
|
|
12
|
+
* Standard, carry their own name and icon and still connect; what is lost is
|
|
13
|
+
* the install list and the ordering. So this never blocks rendering: somebody
|
|
14
|
+
* with a wallet installed can always get through.
|
|
15
|
+
*/
|
|
16
|
+
export declare function fetchWalletCatalog(url: string): Promise<WalletEntry[]>;
|
|
17
|
+
/** The configuration endpoint the catalogue is a row of. */
|
|
18
|
+
export declare function walletCatalogUrl(apiUrl: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-fetch.d.ts","sourceRoot":"","sources":["../src/catalog-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,cAAc,CAAA;AAE7D;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAyB7E;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wallets Reclack can name, read from public configuration.
|
|
3
|
+
*
|
|
4
|
+
* Configuration rather than a list in a bundle, because four places kept
|
|
5
|
+
* their own copy and they drifted: the hosted checkout, the dashboard, the
|
|
6
|
+
* marketing site, and a second list inside the checkout itself. This is the
|
|
7
|
+
* one reader they all now share.
|
|
8
|
+
*
|
|
9
|
+
* Never throws, and an empty catalogue is a working page rather than a broken
|
|
10
|
+
* one. Wallets that announce themselves, over EIP-6963 or the Wallet
|
|
11
|
+
* Standard, carry their own name and icon and still connect; what is lost is
|
|
12
|
+
* the install list and the ordering. So this never blocks rendering: somebody
|
|
13
|
+
* with a wallet installed can always get through.
|
|
14
|
+
*/
|
|
15
|
+
export async function fetchWalletCatalog(url) {
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(url, {
|
|
18
|
+
// Public configuration. Sending credentials would make this a
|
|
19
|
+
// cross-origin request that needs them back, for a row that is
|
|
20
|
+
// the same for everybody.
|
|
21
|
+
credentials: 'omit',
|
|
22
|
+
headers: { Accept: 'application/json' },
|
|
23
|
+
});
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const rows = (await response.json());
|
|
28
|
+
const row = Array.isArray(rows)
|
|
29
|
+
? rows.find((entry) => entry.name === 'wallets')
|
|
30
|
+
: undefined;
|
|
31
|
+
if (!Array.isArray(row?.value)) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return row.value
|
|
35
|
+
.map(toWalletEntry)
|
|
36
|
+
.filter((entry) => entry !== undefined);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** The configuration endpoint the catalogue is a row of. */
|
|
43
|
+
export function walletCatalogUrl(apiUrl) {
|
|
44
|
+
return `${apiUrl.replace(/\/$/, '')}/v1/configurations?name=wallets`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* rdns as a list, whatever the configuration row holds.
|
|
48
|
+
*
|
|
49
|
+
* It was a single string until the catalogue learned that one wallet
|
|
50
|
+
* announces itself under several ids, and a row written before that is still
|
|
51
|
+
* a string until the migration reaches it. The declared type says list, so
|
|
52
|
+
* nothing downstream would think to check.
|
|
53
|
+
*/
|
|
54
|
+
function withRdnsList(engine) {
|
|
55
|
+
const rdns = engine.rdns;
|
|
56
|
+
if (rdns === undefined || Array.isArray(rdns)) {
|
|
57
|
+
return engine;
|
|
58
|
+
}
|
|
59
|
+
return { ...engine, rdns: typeof rdns === 'string' ? [rdns] : undefined };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One catalogue row, read rather than cast.
|
|
63
|
+
*
|
|
64
|
+
* The API sends install_url; this package reads installUrl. A cast renames
|
|
65
|
+
* nothing at runtime, so the install link was an anchor with no href and
|
|
66
|
+
* clicking it did nothing. Engine fields keep their wire names, so they pass
|
|
67
|
+
* through as they came, bar the one shape that changed under them.
|
|
68
|
+
*/
|
|
69
|
+
function toWalletEntry(value) {
|
|
70
|
+
const row = value;
|
|
71
|
+
if (typeof row?.id !== 'string' || typeof row.name !== 'string') {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
id: row.id,
|
|
76
|
+
name: row.name,
|
|
77
|
+
// Empty when the catalogue has none: the panel offers no install link
|
|
78
|
+
// rather than one that goes nowhere.
|
|
79
|
+
installUrl: typeof row.install_url === 'string' ? row.install_url : '',
|
|
80
|
+
browser: row.browser === true,
|
|
81
|
+
engines: (Array.isArray(row.engines) ? row.engines : [])
|
|
82
|
+
.map(withRdnsList),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=catalog-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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;IAC1C,MAAM,IAAI,GAAY,MAAM,CAAC,IAAI,CAAA;IACjC,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAA;IACd,CAAC;IACD,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;AAC1E,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,aAAa,CAAE,KAAc;IACrC,MAAM,GAAG,GAAG,KAAuC,CAAA;IACnD,IAAI,OAAO,GAAG,EAAE,EAAE,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjE,OAAO,SAAS,CAAA;IACjB,CAAC;IACD,OAAO;QACN,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,sEAAsE;QACtE,qCAAqC;QACrC,UAAU,EAAE,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QACtE,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI;QAC7B,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,OAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;aAC1E,GAAG,CAAC,YAAY,CAAC;KACnB,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ChainFamily, WalletOption } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* One chain engine a wallet signs for, and how to recognise it there.
|
|
4
|
+
*
|
|
5
|
+
* Every field below `id` is a parameter to a check this file already knows
|
|
6
|
+
* how to run, and all are optional: a wallet that announces itself needs none
|
|
7
|
+
* of them. Nothing here is executable, because reading a path off `window` is
|
|
8
|
+
* not something a configuration row can do.
|
|
9
|
+
*
|
|
10
|
+
* An engine a wallet does not sign for is simply absent, which is why this is
|
|
11
|
+
* a list and there is no separate set of names beside it: the engine's own id
|
|
12
|
+
* says which family it serves, and two facts could disagree.
|
|
13
|
+
*/
|
|
14
|
+
export interface WalletEngine {
|
|
15
|
+
/** The engine, which is also the chain family it serves. */
|
|
16
|
+
id: ChainFamily;
|
|
17
|
+
/**
|
|
18
|
+
* The reverse-DNS ids a wallet announces itself under, over EIP-6963.
|
|
19
|
+
*
|
|
20
|
+
* Several, because one wallet is several builds: MetaMask's extension,
|
|
21
|
+
* its phone browser and Flask each announce their own.
|
|
22
|
+
*/
|
|
23
|
+
rdns?: string[];
|
|
24
|
+
/** Paths into `window` to try in order, such as ["phantom","ethereum"]. */
|
|
25
|
+
globals?: string[][];
|
|
26
|
+
/** Properties identifying an injected provider; ANY is a match. */
|
|
27
|
+
flags?: string[];
|
|
28
|
+
/** Properties that rule one out: several wallets set another's flag. */
|
|
29
|
+
not_flags?: string[];
|
|
30
|
+
}
|
|
31
|
+
/** One wallet Reclack can name, as the API describes it. */
|
|
32
|
+
export interface WalletEntry extends WalletOption {
|
|
33
|
+
engines: WalletEngine[];
|
|
34
|
+
}
|
|
35
|
+
/** How to recognise a wallet on one engine, or nothing if it does not sign there. */
|
|
36
|
+
export declare function engineOf(wallet: WalletEntry, engine: ChainFamily): WalletEngine | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The wallets to offer for an engine, in the order the API listed them.
|
|
39
|
+
*
|
|
40
|
+
* Order is the API's so the list is stable rather than dependent on which
|
|
41
|
+
* wallet answered first, which is the same reason it used to be a literal
|
|
42
|
+
* here.
|
|
43
|
+
*/
|
|
44
|
+
export declare function walletsFor(catalog: WalletEntry[], engine: ChainFamily): WalletEntry[];
|
|
45
|
+
/**
|
|
46
|
+
* Runs a wallet's detection against this window.
|
|
47
|
+
*
|
|
48
|
+
* Globals first, each one being that wallet's own namespace, then the flags
|
|
49
|
+
* on whatever claimed `window.ethereum`. Never the generic global by itself:
|
|
50
|
+
* it belongs to whichever extension got there, and trusting it names the
|
|
51
|
+
* wrong wallet.
|
|
52
|
+
*
|
|
53
|
+
* A namespace is checked against the exclusions too, not only the flags. One
|
|
54
|
+
* wallet injects another's namespace as a compatibility shim, so finding
|
|
55
|
+
* window.phantom is not proof that Phantom is installed.
|
|
56
|
+
*/
|
|
57
|
+
export declare function detect(win: Window, detection: WalletEngine | undefined): unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAmB,YAAY,EAAE,MAAM,YAAY,CAAA;AAE5E;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC5B,4DAA4D;IAC5D,EAAE,EAAE,WAAW,CAAA;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,CAAA;IACpB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,WAAY,SAAQ,YAAY;IAChD,OAAO,EAAE,YAAY,EAAE,CAAA;CACvB;AAED,qFAAqF;AACrF,wBAAgB,QAAQ,CACvB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,GACjB,YAAY,GAAG,SAAS,CAE1B;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,WAAW,EAAE,EACtB,MAAM,EAAE,WAAW,GACjB,WAAW,EAAE,CAEf;AAqDD;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CACrB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,YAAY,GAAG,SAAS,GACjC,OAAO,CAWT"}
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** How to recognise a wallet on one engine, or nothing if it does not sign there. */
|
|
2
|
+
export function engineOf(wallet, engine) {
|
|
3
|
+
return wallet.engines?.find((entry) => entry.id === engine);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The wallets to offer for an engine, in the order the API listed them.
|
|
7
|
+
*
|
|
8
|
+
* Order is the API's so the list is stable rather than dependent on which
|
|
9
|
+
* wallet answered first, which is the same reason it used to be a literal
|
|
10
|
+
* here.
|
|
11
|
+
*/
|
|
12
|
+
export function walletsFor(catalog, engine) {
|
|
13
|
+
return catalog.filter((wallet) => Boolean(engineOf(wallet, engine)));
|
|
14
|
+
}
|
|
15
|
+
/** Follows a path into the window, returning whatever provider is there. */
|
|
16
|
+
function atPath(win, path) {
|
|
17
|
+
let current = win;
|
|
18
|
+
for (const key of path) {
|
|
19
|
+
if (!current || typeof current !== 'object') {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
current = current[key];
|
|
23
|
+
}
|
|
24
|
+
return current;
|
|
25
|
+
}
|
|
26
|
+
/** Whether a provider carries a flag that rules this wallet out. */
|
|
27
|
+
function impostor(provider, detection) {
|
|
28
|
+
const flags = provider;
|
|
29
|
+
return Boolean(detection.not_flags?.some((flag) => Boolean(flags[flag])));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Finds a provider among the several a browser may have injected.
|
|
33
|
+
*
|
|
34
|
+
* Several wallets installed at once expose a `providers` array; the bare
|
|
35
|
+
* object is whichever one won the global.
|
|
36
|
+
*/
|
|
37
|
+
function matchInjected(win, detection) {
|
|
38
|
+
if (!detection.flags?.length) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const root = win.ethereum;
|
|
42
|
+
if (!root) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const candidates = Array.isArray(root.providers)
|
|
46
|
+
? root.providers
|
|
47
|
+
: [root];
|
|
48
|
+
return candidates.find((provider) => {
|
|
49
|
+
// Any flag is a match: a wallet may set more than one across
|
|
50
|
+
// versions. None of the exclusions may be set, because a flag alone
|
|
51
|
+
// names the wrong wallet when another sets it on purpose.
|
|
52
|
+
const claims = detection.flags?.some((flag) => Boolean(provider[flag]));
|
|
53
|
+
return Boolean(claims) && !impostor(provider, detection);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Runs a wallet's detection against this window.
|
|
58
|
+
*
|
|
59
|
+
* Globals first, each one being that wallet's own namespace, then the flags
|
|
60
|
+
* on whatever claimed `window.ethereum`. Never the generic global by itself:
|
|
61
|
+
* it belongs to whichever extension got there, and trusting it names the
|
|
62
|
+
* wrong wallet.
|
|
63
|
+
*
|
|
64
|
+
* A namespace is checked against the exclusions too, not only the flags. One
|
|
65
|
+
* wallet injects another's namespace as a compatibility shim, so finding
|
|
66
|
+
* window.phantom is not proof that Phantom is installed.
|
|
67
|
+
*/
|
|
68
|
+
export function detect(win, detection) {
|
|
69
|
+
if (!detection) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
for (const path of detection.globals ?? []) {
|
|
73
|
+
const found = atPath(win, path);
|
|
74
|
+
if (found && typeof found === 'object' && !impostor(found, detection)) {
|
|
75
|
+
return found;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return matchInjected(win, detection);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAqCA,qFAAqF;AACrF,MAAM,UAAU,QAAQ,CACvB,MAAmB,EACnB,MAAmB;IAEnB,OAAO,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CA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AC,CAAE,IAAI,CAAC,SAAwC;QAChD,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACT,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACnC,6DAA6D;QAC7D,oEAAoE;QACpE,0DAA0D;QAC1D,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACvE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CACrB,GAAW,EACX,SAAmC;IAEnC,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,OAAO,SAAS,CAAA;IACjB,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAC/B,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;YACvE,OAAO,KAAK,CAAA;QACb,CAAC;IACF,CAAC;IACD,OAAO,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;AACrC,CAAC"}
|
package/dist/chains.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain metadata for `wallet_addEthereumChain`.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately a client-side registry rather than something the API sends.
|
|
5
|
+
* Adding a chain hands the wallet an RPC endpoint that will then see the
|
|
6
|
+
* payer's traffic, so the list of endpoints a payment page can propose is
|
|
7
|
+
* pinned in the bundle where it can be reviewed, not taken from a response
|
|
8
|
+
* body. A chain missing here simply cannot be auto-added.
|
|
9
|
+
*/
|
|
10
|
+
export interface ChainMetadata {
|
|
11
|
+
chainId: number;
|
|
12
|
+
chainName: string;
|
|
13
|
+
nativeCurrency: {
|
|
14
|
+
name: string;
|
|
15
|
+
symbol: string;
|
|
16
|
+
decimals: number;
|
|
17
|
+
};
|
|
18
|
+
rpcUrls: string[];
|
|
19
|
+
blockExplorerUrls: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare const CHAINS: Record<number, ChainMetadata>;
|
|
22
|
+
/**
|
|
23
|
+
* The link a payer follows to see their own transaction.
|
|
24
|
+
*
|
|
25
|
+
* Takes the network as well as the chain id so it can answer for either
|
|
26
|
+
* family. Returns nothing for a chain with no explorer configured, and the
|
|
27
|
+
* caller shows no link rather than a broken one.
|
|
28
|
+
*/
|
|
29
|
+
export declare function explorerTxUrl(chainId: number, hash: string, network?: string): string | undefined;
|
|
30
|
+
/** "sepolia.basescan.org": names the destination before the payer clicks. */
|
|
31
|
+
export declare function explorerHost(chainId: number, network?: string): string | undefined;
|
|
32
|
+
export declare function chainMetadata(chainId: number): ChainMetadata | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAClE,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC3B;AAID,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CA2ChD,CAAA;AA0BD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CASpB;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWnF;AAED,wBAAgB,aAAa,CAAE,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEzE"}
|
package/dist/chains.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const ETH = { name: 'Ether', symbol: 'ETH', decimals: 18 };
|
|
2
|
+
export const CHAINS = {
|
|
3
|
+
1: {
|
|
4
|
+
chainId: 1,
|
|
5
|
+
chainName: 'Ethereum',
|
|
6
|
+
nativeCurrency: ETH,
|
|
7
|
+
rpcUrls: ['https://ethereum-rpc.publicnode.com'],
|
|
8
|
+
blockExplorerUrls: ['https://etherscan.io'],
|
|
9
|
+
},
|
|
10
|
+
11155111: {
|
|
11
|
+
chainId: 11155111,
|
|
12
|
+
chainName: 'Ethereum Sepolia',
|
|
13
|
+
nativeCurrency: ETH,
|
|
14
|
+
rpcUrls: ['https://ethereum-sepolia-rpc.publicnode.com'],
|
|
15
|
+
blockExplorerUrls: ['https://sepolia.etherscan.io'],
|
|
16
|
+
},
|
|
17
|
+
8453: {
|
|
18
|
+
chainId: 8453,
|
|
19
|
+
chainName: 'Base',
|
|
20
|
+
nativeCurrency: ETH,
|
|
21
|
+
rpcUrls: ['https://mainnet.base.org'],
|
|
22
|
+
blockExplorerUrls: ['https://basescan.org'],
|
|
23
|
+
},
|
|
24
|
+
84532: {
|
|
25
|
+
chainId: 84532,
|
|
26
|
+
chainName: 'Base Sepolia',
|
|
27
|
+
nativeCurrency: ETH,
|
|
28
|
+
rpcUrls: ['https://sepolia.base.org'],
|
|
29
|
+
blockExplorerUrls: ['https://sepolia.basescan.org'],
|
|
30
|
+
},
|
|
31
|
+
137: {
|
|
32
|
+
chainId: 137,
|
|
33
|
+
chainName: 'Polygon',
|
|
34
|
+
nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 },
|
|
35
|
+
rpcUrls: ['https://polygon-bor-rpc.publicnode.com'],
|
|
36
|
+
blockExplorerUrls: ['https://polygonscan.com'],
|
|
37
|
+
},
|
|
38
|
+
80002: {
|
|
39
|
+
chainId: 80002,
|
|
40
|
+
chainName: 'Polygon Amoy',
|
|
41
|
+
nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 },
|
|
42
|
+
rpcUrls: ['https://polygon-amoy-bor-rpc.publicnode.com'],
|
|
43
|
+
blockExplorerUrls: ['https://amoy.polygonscan.com'],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* A link to one transaction on the chain's own explorer.
|
|
48
|
+
*
|
|
49
|
+
* Derived from the same pinned registry the wallet is offered, so the link
|
|
50
|
+
* always matches the chain actually paid on: a testnet payment opens the
|
|
51
|
+
* testnet explorer. A mainnet link would 404 on a hash that only exists on a
|
|
52
|
+
* testnet, which to a payer looks like the payment vanished.
|
|
53
|
+
*
|
|
54
|
+
* Undefined for a chain with no explorer, so the caller can show the bare hash
|
|
55
|
+
* rather than a dead link.
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* Solana explorers, keyed by network name.
|
|
59
|
+
*
|
|
60
|
+
* By name and not by chain id, because every non-EVM chain carries zero:
|
|
61
|
+
* Solana and its devnet would otherwise be the same key, and a devnet payer
|
|
62
|
+
* would be sent to a mainnet explorer that has never heard of their
|
|
63
|
+
* transaction. The cluster is part of the URL for the same reason.
|
|
64
|
+
*/
|
|
65
|
+
const SVM_EXPLORERS = {
|
|
66
|
+
solana: 'https://solscan.io',
|
|
67
|
+
'solana-devnet': 'https://solscan.io?cluster=devnet',
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The link a payer follows to see their own transaction.
|
|
71
|
+
*
|
|
72
|
+
* Takes the network as well as the chain id so it can answer for either
|
|
73
|
+
* family. Returns nothing for a chain with no explorer configured, and the
|
|
74
|
+
* caller shows no link rather than a broken one.
|
|
75
|
+
*/
|
|
76
|
+
export function explorerTxUrl(chainId, hash, network) {
|
|
77
|
+
const solana = network ? SVM_EXPLORERS[network] : undefined;
|
|
78
|
+
if (solana) {
|
|
79
|
+
// The cluster rides in the query string, so the path goes before it.
|
|
80
|
+
const [base, cluster] = solana.split('?');
|
|
81
|
+
return cluster ? `${base}/tx/${hash}?${cluster}` : `${base}/tx/${hash}`;
|
|
82
|
+
}
|
|
83
|
+
const base = CHAINS[chainId]?.blockExplorerUrls[0];
|
|
84
|
+
return base ? `${base}/tx/${hash}` : undefined;
|
|
85
|
+
}
|
|
86
|
+
/** "sepolia.basescan.org": names the destination before the payer clicks. */
|
|
87
|
+
export function explorerHost(chainId, network) {
|
|
88
|
+
const base = (network ? SVM_EXPLORERS[network] : undefined)
|
|
89
|
+
?? CHAINS[chainId]?.blockExplorerUrls[0];
|
|
90
|
+
if (!base) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
return new URL(base).hostname.replace(/^www\./, '');
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export function chainMetadata(chainId) {
|
|
101
|
+
return CHAINS[chainId];
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=chains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAiBA,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AAE1D,MAAM,CAAC,MAAM,MAAM,GAAkC;IACpD,CAAC,EAAE;QACF,OAAO,EAAE,CAAC;QACV,SAAS,EAAE,UAAU;QACrB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OAAe;IAC7C,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;AACvB,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where this kit talks to Reclack, and with what.
|
|
3
|
+
*
|
|
4
|
+
* Defaults rather than required options. None of this is a decision a page
|
|
5
|
+
* embedding a wallet picker should have to make: it is Reclack's own
|
|
6
|
+
* infrastructure, and a host that had to supply it would be configuring our
|
|
7
|
+
* deployment on our behalf. Every value here can still be overridden, for a
|
|
8
|
+
* sandbox, a private endpoint, or a partner running the kit under its own
|
|
9
|
+
* name.
|
|
10
|
+
*/
|
|
11
|
+
/** The API the wallet catalogue is a configuration row of. */
|
|
12
|
+
export declare const DEFAULT_API_URL = "https://api.reclack.com";
|
|
13
|
+
/**
|
|
14
|
+
* Reclack's Reown project id, used only to pair with a wallet that injects
|
|
15
|
+
* nothing into the page: Safe, Kraken, BitPay, Bitcoin.com and Blockchain.com
|
|
16
|
+
* reach an app over WalletConnect and cannot be seen any other way.
|
|
17
|
+
*
|
|
18
|
+
* Public by design. It identifies the page to the relay and carries no
|
|
19
|
+
* authority, which is why it ships here rather than being asked of every
|
|
20
|
+
* host. It is already in the bundle every Reclack checkout serves.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_WALLETCONNECT_PROJECT_ID = "9bb122bca7ef21f2c2110494ad9ad559";
|
|
23
|
+
/**
|
|
24
|
+
* Where Solana balances are read from.
|
|
25
|
+
*
|
|
26
|
+
* Solana wallets sign; they do not answer questions about the chain, so there
|
|
27
|
+
* is no provider to fall back on the way there is on EVM. The public endpoint
|
|
28
|
+
* is rate-limited and fine for one balance on a page; anything heavier should
|
|
29
|
+
* pass its own.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_SVM_RPC_URL = "https://api.mainnet-beta.solana.com";
|
|
32
|
+
/**
|
|
33
|
+
* The read endpoint for an EVM chain, from the registry already pinned in
|
|
34
|
+
* this package.
|
|
35
|
+
*
|
|
36
|
+
* The same endpoints the kit would propose to a wallet when adding a chain,
|
|
37
|
+
* reused rather than listed twice: the reason they are pinned in the bundle
|
|
38
|
+
* at all is that they are reviewed, and a second list would not be.
|
|
39
|
+
*/
|
|
40
|
+
export declare function defaultRpcUrl(chainId: number): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,eAAe,4BAA4B,CAAA;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,qCAAqC,CAAA;AAElF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,wCAAwC,CAAA;AAExE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElE"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { chainMetadata } from './chains.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where this kit talks to Reclack, and with what.
|
|
4
|
+
*
|
|
5
|
+
* Defaults rather than required options. None of this is a decision a page
|
|
6
|
+
* embedding a wallet picker should have to make: it is Reclack's own
|
|
7
|
+
* infrastructure, and a host that had to supply it would be configuring our
|
|
8
|
+
* deployment on our behalf. Every value here can still be overridden, for a
|
|
9
|
+
* sandbox, a private endpoint, or a partner running the kit under its own
|
|
10
|
+
* name.
|
|
11
|
+
*/
|
|
12
|
+
/** The API the wallet catalogue is a configuration row of. */
|
|
13
|
+
export const DEFAULT_API_URL = 'https://api.reclack.com';
|
|
14
|
+
/**
|
|
15
|
+
* Reclack's Reown project id, used only to pair with a wallet that injects
|
|
16
|
+
* nothing into the page: Safe, Kraken, BitPay, Bitcoin.com and Blockchain.com
|
|
17
|
+
* reach an app over WalletConnect and cannot be seen any other way.
|
|
18
|
+
*
|
|
19
|
+
* Public by design. It identifies the page to the relay and carries no
|
|
20
|
+
* authority, which is why it ships here rather than being asked of every
|
|
21
|
+
* host. It is already in the bundle every Reclack checkout serves.
|
|
22
|
+
*/
|
|
23
|
+
export const DEFAULT_WALLETCONNECT_PROJECT_ID = '9bb122bca7ef21f2c2110494ad9ad559';
|
|
24
|
+
/**
|
|
25
|
+
* Where Solana balances are read from.
|
|
26
|
+
*
|
|
27
|
+
* Solana wallets sign; they do not answer questions about the chain, so there
|
|
28
|
+
* is no provider to fall back on the way there is on EVM. The public endpoint
|
|
29
|
+
* is rate-limited and fine for one balance on a page; anything heavier should
|
|
30
|
+
* pass its own.
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_SVM_RPC_URL = 'https://api.mainnet-beta.solana.com';
|
|
33
|
+
/**
|
|
34
|
+
* The read endpoint for an EVM chain, from the registry already pinned in
|
|
35
|
+
* this package.
|
|
36
|
+
*
|
|
37
|
+
* The same endpoints the kit would propose to a wallet when adding a chain,
|
|
38
|
+
* reused rather than listed twice: the reason they are pinned in the bundle
|
|
39
|
+
* at all is that they are reviewed, and a second list would not be.
|
|
40
|
+
*/
|
|
41
|
+
export function defaultRpcUrl(chainId) {
|
|
42
|
+
return chainMetadata(chainId)?.rpcUrls[0];
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C;;;;;;;;;GASG;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,yBAAyB,CAAA;AAExD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,kCAAkC,CAAA;AAElF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,qCAAqC,CAAA;AAExE;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAE,OAAe;IAC7C,OAAO,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type MobileOS } from './device.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether this wallet has a phone application that can read a pairing code.
|
|
4
|
+
*
|
|
5
|
+
* Read off the table above rather than kept as a second list of its own. Every
|
|
6
|
+
* entry there is a mobile link the wallet published to the WalletConnect
|
|
7
|
+
* registry, and a wallet with no phone application publishes none.
|
|
8
|
+
*
|
|
9
|
+
* Asked by a desktop checkout, where a code can only be scanned. On a phone it
|
|
10
|
+
* can be pasted instead, so one is offered there whatever this says.
|
|
11
|
+
*/
|
|
12
|
+
export declare function walletScans(id: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The link that hands this pairing string to one named wallet, or nothing
|
|
15
|
+
* where that wallet publishes no way to be reached.
|
|
16
|
+
*/
|
|
17
|
+
export declare function walletPairingLink(id: string, uri: string): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The link that opens this checkout in one wallet, or nothing if that wallet
|
|
20
|
+
* has no known one.
|
|
21
|
+
*/
|
|
22
|
+
export declare function walletDeepLink(id: string, url: string, platform?: MobileOS | undefined): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-links.d.ts","sourceRoot":"","sources":["../src/deep-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AA0MrD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAU9E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC7B,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,QAAQ,GAAG,SAAsB,GACzC,MAAM,GAAG,SAAS,CAWpB"}
|