@dynamic-labs/wallet-book 0.0.0-exp20240808.0
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/CHANGELOG.md +3746 -0
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/_virtual/_tslib.cjs +49 -0
- package/_virtual/_tslib.js +44 -0
- package/package.json +38 -0
- package/src/build/index.d.ts +76 -0
- package/src/build/sources/firstParty/index.d.ts +2 -0
- package/src/build/sources/index.d.ts +4 -0
- package/src/build/sources/walletConnect/index.d.ts +128 -0
- package/src/build/sources/walletConnect/preprocessors.d.ts +14 -0
- package/src/build/sources/walletConnectOverrides/index.d.ts +197 -0
- package/src/build/sources/walletGroups/index.d.ts +2 -0
- package/src/components/BrandIcon.cjs +27 -0
- package/src/components/BrandIcon.d.ts +8 -0
- package/src/components/BrandIcon.js +23 -0
- package/src/components/WalletBookContext.cjs +14 -0
- package/src/components/WalletBookContext.d.ts +9 -0
- package/src/components/WalletBookContext.js +9 -0
- package/src/components/WalletIcon.cjs +34 -0
- package/src/components/WalletIcon.d.ts +8 -0
- package/src/components/WalletIcon.js +30 -0
- package/src/components/index.d.ts +3 -0
- package/src/helpers/findWalletBookWallet.cjs +18 -0
- package/src/helpers/findWalletBookWallet.d.ts +70 -0
- package/src/helpers/findWalletBookWallet.js +14 -0
- package/src/helpers/findWalletGroup.cjs +19 -0
- package/src/helpers/findWalletGroup.d.ts +18 -0
- package/src/helpers/findWalletGroup.js +15 -0
- package/src/helpers/findWalletGroupOverride.cjs +14 -0
- package/src/helpers/findWalletGroupOverride.d.ts +3 -0
- package/src/helpers/findWalletGroupOverride.js +10 -0
- package/src/helpers/getBrandIconUrl.cjs +15 -0
- package/src/helpers/getBrandIconUrl.d.ts +2 -0
- package/src/helpers/getBrandIconUrl.js +11 -0
- package/src/helpers/getWalletBookCdnUrl.cjs +14 -0
- package/src/helpers/getWalletBookCdnUrl.d.ts +1 -0
- package/src/helpers/getWalletBookCdnUrl.js +10 -0
- package/src/helpers/getWalletBookWallet.cjs +17 -0
- package/src/helpers/getWalletBookWallet.d.ts +2 -0
- package/src/helpers/getWalletBookWallet.js +13 -0
- package/src/helpers/getWalletGroup.cjs +13 -0
- package/src/helpers/getWalletGroup.d.ts +3 -0
- package/src/helpers/getWalletGroup.js +9 -0
- package/src/helpers/getWalletIconUrl.cjs +34 -0
- package/src/helpers/getWalletIconUrl.d.ts +3 -0
- package/src/helpers/getWalletIconUrl.js +29 -0
- package/src/helpers/getWalletLinks.cjs +34 -0
- package/src/helpers/getWalletLinks.d.ts +10 -0
- package/src/helpers/getWalletLinks.js +30 -0
- package/src/helpers/getWalletPrimaryColor.cjs +14 -0
- package/src/helpers/getWalletPrimaryColor.d.ts +2 -0
- package/src/helpers/getWalletPrimaryColor.js +10 -0
- package/src/helpers/index.d.ts +14 -0
- package/src/helpers/isWalletEventSupported.cjs +8 -0
- package/src/helpers/isWalletEventSupported.d.ts +2 -0
- package/src/helpers/isWalletEventSupported.js +4 -0
- package/src/helpers/isWalletMethodSupported.cjs +8 -0
- package/src/helpers/isWalletMethodSupported.d.ts +2 -0
- package/src/helpers/isWalletMethodSupported.js +4 -0
- package/src/helpers/logger.cjs +10 -0
- package/src/helpers/logger.d.ts +2 -0
- package/src/helpers/logger.js +6 -0
- package/src/helpers/renderTemplate.cjs +23 -0
- package/src/helpers/renderTemplate.d.ts +12 -0
- package/src/helpers/renderTemplate.js +19 -0
- package/src/hooks/index.d.ts +2 -0
- package/src/hooks/useWalletBookCdn.cjs +51 -0
- package/src/hooks/useWalletBookCdn.d.ts +88 -0
- package/src/hooks/useWalletBookCdn.js +47 -0
- package/src/hooks/useWalletBookContext.cjs +24 -0
- package/src/hooks/useWalletBookContext.d.ts +1 -0
- package/src/hooks/useWalletBookContext.js +20 -0
- package/src/index.cjs +44 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +20 -0
- package/src/schemas/index.d.ts +3 -0
- package/src/schemas/utils/filterEmptyObject.cjs +13 -0
- package/src/schemas/utils/filterEmptyObject.d.ts +6 -0
- package/src/schemas/utils/filterEmptyObject.js +9 -0
- package/src/schemas/utils/nonEmptyString.cjs +13 -0
- package/src/schemas/utils/nonEmptyString.d.ts +5 -0
- package/src/schemas/utils/nonEmptyString.js +9 -0
- package/src/schemas/utils/nonEmptyStringArray.cjs +13 -0
- package/src/schemas/utils/nonEmptyStringArray.d.ts +5 -0
- package/src/schemas/utils/nonEmptyStringArray.js +9 -0
- package/src/schemas/utils/processWalletConnectNativeUrl.d.ts +1 -0
- package/src/schemas/utils/sortKeys.d.ts +5 -0
- package/src/schemas/utils/transformAndroidId.cjs +24 -0
- package/src/schemas/utils/transformAndroidId.d.ts +1 -0
- package/src/schemas/utils/transformAndroidId.js +20 -0
- package/src/schemas/utils/transformChromeExtensionId.cjs +21 -0
- package/src/schemas/utils/transformChromeExtensionId.d.ts +1 -0
- package/src/schemas/utils/transformChromeExtensionId.js +17 -0
- package/src/schemas/utils/transformEdgeExtensionId.cjs +21 -0
- package/src/schemas/utils/transformEdgeExtensionId.d.ts +1 -0
- package/src/schemas/utils/transformEdgeExtensionId.js +17 -0
- package/src/schemas/utils/transformFirefoxExtensionId.cjs +21 -0
- package/src/schemas/utils/transformFirefoxExtensionId.d.ts +1 -0
- package/src/schemas/utils/transformFirefoxExtensionId.js +17 -0
- package/src/schemas/utils/transformIosId.cjs +28 -0
- package/src/schemas/utils/transformIosId.d.ts +1 -0
- package/src/schemas/utils/transformIosId.js +24 -0
- package/src/schemas/walletBookSchema.cjs +17 -0
- package/src/schemas/walletBookSchema.d.ts +1369 -0
- package/src/schemas/walletBookSchema.js +13 -0
- package/src/schemas/walletConnectSourceSchema.cjs +78 -0
- package/src/schemas/walletConnectSourceSchema.d.ts +516 -0
- package/src/schemas/walletConnectSourceSchema.js +74 -0
- package/src/schemas/walletGroup.cjs +27 -0
- package/src/schemas/walletGroup.d.ts +113 -0
- package/src/schemas/walletGroup.js +23 -0
- package/src/schemas/walletSchema.cjs +141 -0
- package/src/schemas/walletSchema.d.ts +614 -0
- package/src/schemas/walletSchema.js +136 -0
- package/wallet-book-fallbacks.cjs +1082 -0
- package/wallet-book-fallbacks.js +1076 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Dynamic Labs, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Wallet Book
|
|
2
|
+
|
|
3
|
+
## Updating Wallet Book
|
|
4
|
+
|
|
5
|
+
- [Wallet Book](#wallet-book)
|
|
6
|
+
- [Updating Wallet Book](#updating-wallet-book)
|
|
7
|
+
- [Adding First Party Wallet](#adding-first-party-wallet)
|
|
8
|
+
- [Adding injected (browser extension) wallets](#adding-injected-browser-extension-wallets)
|
|
9
|
+
- [If you need to override any of the following functions: signMessage, getAddress, getSigner, isInstalledOnBrowser, etc...](#if-you-need-to-override-any-of-the-following-functions-signmessage-fetchpublicaddress-getsigner-isinstalledonbrowser-etc)
|
|
10
|
+
- [Things to remember when adding a new wallet](#things-to-remember-when-adding-a-new-wallet)
|
|
11
|
+
- [**Checklist before submitting the PR**:](#checklist-before-submitting-the-pr)
|
|
12
|
+
- [Updating Wallet Connect Data](#updating-wallet-connect-data)
|
|
13
|
+
- [Adding overrides to WalletConnect](#adding-overrides-to-walletconnect)
|
|
14
|
+
- [Compile \& Publish](#compile--publish)
|
|
15
|
+
|
|
16
|
+
### Adding First Party Wallet
|
|
17
|
+
|
|
18
|
+
Simply add an entry to `firstPartyWalletsData` in `packages/wallet-book/src/build/sources/firstParty/index.ts` and [Compile & Publish](#compile--publish)
|
|
19
|
+
|
|
20
|
+
For example:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
argentx: {
|
|
24
|
+
brand: {
|
|
25
|
+
alt: 'Argent Wallet',
|
|
26
|
+
primaryColor: '#FF875B',
|
|
27
|
+
spriteId: 'argentx',
|
|
28
|
+
},
|
|
29
|
+
desktop: {
|
|
30
|
+
chromeId: 'dlcobpjiigpikoobohmabehhmhfoodbb',
|
|
31
|
+
firefoxId: 'argent-x',
|
|
32
|
+
},
|
|
33
|
+
name: 'Argent X',
|
|
34
|
+
injectedConfig: [
|
|
35
|
+
{
|
|
36
|
+
chain: 'EVM',
|
|
37
|
+
extensionLocators:
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Required fields:
|
|
44
|
+
|
|
45
|
+
- `brand`
|
|
46
|
+
- `alt`
|
|
47
|
+
- `primaryColor`
|
|
48
|
+
- `spriteId` - The id used in the iconic svg
|
|
49
|
+
- `name`
|
|
50
|
+
|
|
51
|
+
Refer to `WalletRecordsSchema` for more schema options
|
|
52
|
+
|
|
53
|
+
### Adding injected (browser extension) wallets
|
|
54
|
+
|
|
55
|
+
Similar to [adding first party wallets](#adding-first-party-wallet), we add another key, `injectedConfig` to the wallet object.
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
...
|
|
59
|
+
injectedConfig: [
|
|
60
|
+
{
|
|
61
|
+
chain: 'EVM',
|
|
62
|
+
extensionLocators: [
|
|
63
|
+
{ flag: 'isOkxWallet', value: true },
|
|
64
|
+
{ flag: 'isOkexWallet', value: true }
|
|
65
|
+
],
|
|
66
|
+
windowLocations: ['okxwallet']
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
name: 'OKX'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### If you need to override any of the following functions: signMessage, getAddress, getSigner, isInstalledOnBrowser, etc...
|
|
73
|
+
|
|
74
|
+
1. Create a file in the respective `ethereum/src/injected/` or `solana/src/injected/`. The basic file should follow this form:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
export class <NameOfConnector> extends InjectedWalletBase {
|
|
78
|
+
override name = '<Name Here>';
|
|
79
|
+
override walletConnectorFallback = true; // only specified on evm wallet connectors
|
|
80
|
+
|
|
81
|
+
constructor(props: EthWalletConnectorOpts) {
|
|
82
|
+
super(props);
|
|
83
|
+
|
|
84
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// override the methods you need below
|
|
88
|
+
override async getAddress() {
|
|
89
|
+
...
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
2. Open `fetchInjectedWalletConnectors.ts` for the respective network package (`etherem/solana/...`) and add the new InjectedWalletBase class to `injectedWalletOverrides` and the key (normalized name) to the `filterInjectedWalletKeyOverrides`
|
|
95
|
+
|
|
96
|
+
#### Things to remember when adding a new wallet
|
|
97
|
+
|
|
98
|
+
- `IF the new wallet is also in wallletconnect.json`: make sure that the key used in `firstParty/index.ts` is the `same` as the value from `walletconnect.json` as to inherit the properties from that wallet definition.
|
|
99
|
+
- The value(s) in `windowLocations` map to `window.<value from windowLocations>`. i.e. `okxwallet` means `window.okxwallet`. The values can be a nested path that is dot delimited. If the wallet lives under `window.ethereum` or `window.ethereum.providers`, those window locations are imported by default.
|
|
100
|
+
- For every extension locator you add for the new wallet, add the negation `[{ flag: 'isOkxWallet', value: false }, ...]` to the extensionLocators under the `metamask` key in firstParty.
|
|
101
|
+
- If the new wallet is wallet connect enabled (exists in `walletconnect.json`), make sure to add: `filterFromWalletConnect: true` as a sibling to `injectedConfig` which will filter the wallet from the wallet connect connectors list and use wallet connect as fallback.
|
|
102
|
+
|
|
103
|
+
#### **Checklist before submitting the PR**:
|
|
104
|
+
|
|
105
|
+
[ ]: If this change adds a new file to the injected folder, add the wallet key to the `walletBookFallbackList` in `packages/wallet-book/src/build/index.ts`
|
|
106
|
+
|
|
107
|
+
[ ]: If the name is changing in walletbook, make sure that if there is no new file in the `injected/` folder, you make sure at least the `shortName` normalizes down to the wallet key
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
myawesomenewwallet: {
|
|
111
|
+
...
|
|
112
|
+
injectedConfig: { ... },
|
|
113
|
+
shortName: 'My Awesome New Wallet', // maps down to the key if you lowercase and remove special characters and spaces
|
|
114
|
+
name: 'Awesome Wallet' // this will be displayed in the wallet list and can be changed as long as the `shortName` normalizes to the key
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**NOTE:**
|
|
119
|
+
|
|
120
|
+
Refer to `injectedConfigSchema` for the schema options
|
|
121
|
+
|
|
122
|
+
### Updating Wallet Connect Data
|
|
123
|
+
|
|
124
|
+
- Download the data from : https://explorer-api.walletconnect.com/v3/wallets?projectId=XXXX replace
|
|
125
|
+
- Replace packages/wallet-book/src/build/sources/walletConnect/walletconnect.json
|
|
126
|
+
- [Compile & Publish](#compile--publish)
|
|
127
|
+
|
|
128
|
+
### Adding overrides to WalletConnect
|
|
129
|
+
|
|
130
|
+
- modify packages/wallet-book/src/build/sources/walletConnectOverrides/index.ts
|
|
131
|
+
- [Compile & Publish](#compile--publish)
|
|
132
|
+
|
|
133
|
+
### Compile & Publish
|
|
134
|
+
|
|
135
|
+
The compiled json is stored in `packages/wallet-book/wallet-book.json`. When the file is updated
|
|
136
|
+
and merged to main it will be published to S3 automatically.
|
|
137
|
+
|
|
138
|
+
Simply, make any changes that you need and:
|
|
139
|
+
|
|
140
|
+
- run `npx nx compile wallet-book`
|
|
141
|
+
- commit `wallet-book.json`
|
|
142
|
+
- Open PR with changes and merge
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
Copyright (c) Microsoft Corporation.
|
|
8
|
+
|
|
9
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
+
purpose with or without fee is hereby granted.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
+
***************************************************************************** */
|
|
20
|
+
|
|
21
|
+
function __rest(s, e) {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
+
t[p] = s[p];
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
+
t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
34
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
37
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
38
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
44
|
+
var e = new Error(message);
|
|
45
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.__awaiter = __awaiter;
|
|
49
|
+
exports.__rest = __rest;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/******************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */
|
|
16
|
+
|
|
17
|
+
function __rest(s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
+
t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
30
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
31
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
32
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
33
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
34
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
35
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
40
|
+
var e = new Error(message);
|
|
41
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { __awaiter, __rest };
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dynamic-labs/wallet-book",
|
|
3
|
+
"version": "0.0.0-exp20240808.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
7
|
+
"directory": "packages/wallet-book"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/dynamic-labs/DynamicAuth/issues"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/dynamic-labs/DynamicAuth#readme",
|
|
13
|
+
"author": "Dynamic Labs, Inc.",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"main": "./src/index.cjs",
|
|
16
|
+
"module": "./src/index.js",
|
|
17
|
+
"types": "./src/index.d.ts",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./src/index.d.ts",
|
|
22
|
+
"import": "./src/index.js",
|
|
23
|
+
"require": "./src/index.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"zod": "3.22.4",
|
|
29
|
+
"@dynamic-labs/iconic": "0.0.0-exp20240808.0",
|
|
30
|
+
"@dynamic-labs/logger": "0.0.0-exp20240808.0",
|
|
31
|
+
"@dynamic-labs/utils": "0.0.0-exp20240808.0",
|
|
32
|
+
"util": "0.12.5"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": "^18.0.0",
|
|
36
|
+
"react-dom": "^18.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { WalletRecordsSchema } from '../schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Create a fallback wallet book with only the wallets that are in the fallback list.
|
|
4
|
+
* They must exist in the main wallet book
|
|
5
|
+
* @param wallets
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const generateWalletFallbacks: (wallets: WalletRecordsSchema) => Record<string, {
|
|
9
|
+
name: string;
|
|
10
|
+
brand?: {
|
|
11
|
+
alt?: string | undefined;
|
|
12
|
+
primaryColor?: string | undefined;
|
|
13
|
+
spriteId?: string | undefined;
|
|
14
|
+
} | undefined;
|
|
15
|
+
chainGroup?: string | undefined;
|
|
16
|
+
chains?: string[] | undefined;
|
|
17
|
+
desktop?: {
|
|
18
|
+
chromeId?: string | undefined;
|
|
19
|
+
edgeId?: string | undefined;
|
|
20
|
+
firefoxId?: string | undefined;
|
|
21
|
+
native?: string | undefined;
|
|
22
|
+
operaId?: string | undefined;
|
|
23
|
+
safariId?: string | undefined;
|
|
24
|
+
universal?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
eip6963Config?: {
|
|
27
|
+
rdns: string;
|
|
28
|
+
} | undefined;
|
|
29
|
+
filterFromWalletConnect?: boolean | undefined;
|
|
30
|
+
group?: string | undefined;
|
|
31
|
+
hardwareWallets?: string[] | undefined;
|
|
32
|
+
injectedConfig?: {
|
|
33
|
+
chain: string;
|
|
34
|
+
extensionLocators: {
|
|
35
|
+
value: boolean;
|
|
36
|
+
flag: string;
|
|
37
|
+
}[];
|
|
38
|
+
providerInterface?: string | undefined;
|
|
39
|
+
walletStandard?: {
|
|
40
|
+
name: string;
|
|
41
|
+
features: string[];
|
|
42
|
+
} | undefined;
|
|
43
|
+
walletStandardLocators?: {
|
|
44
|
+
name: string;
|
|
45
|
+
locator: string;
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
windowLocations?: string[] | undefined;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
mobile?: {
|
|
50
|
+
android?: string | null | undefined;
|
|
51
|
+
androidId?: string | undefined;
|
|
52
|
+
inAppBrowser?: string | null | undefined;
|
|
53
|
+
ios?: string | null | undefined;
|
|
54
|
+
iosId?: string | undefined;
|
|
55
|
+
native?: string | undefined;
|
|
56
|
+
universal?: string | undefined;
|
|
57
|
+
} | undefined;
|
|
58
|
+
mobileExperience?: "in-app-browser" | "redirect" | undefined;
|
|
59
|
+
shortName?: string | undefined;
|
|
60
|
+
showOnlyIfInstalled?: boolean | undefined;
|
|
61
|
+
switchNetworkOnlyFromWallet?: boolean | undefined;
|
|
62
|
+
walletConnect?: {
|
|
63
|
+
sdks?: string[] | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
walletGroup?: string | undefined;
|
|
66
|
+
walletLimitations?: {
|
|
67
|
+
browserExtension?: {
|
|
68
|
+
unsupportedEvents?: string[] | undefined;
|
|
69
|
+
unsupportedMethods?: string[] | undefined;
|
|
70
|
+
} | undefined;
|
|
71
|
+
mobile?: {
|
|
72
|
+
unsupportedEvents?: string[] | undefined;
|
|
73
|
+
unsupportedMethods?: string[] | undefined;
|
|
74
|
+
} | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
}>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export declare const walletConnectSourceData: Record<string, {
|
|
2
|
+
id: string;
|
|
3
|
+
metadata: {
|
|
4
|
+
shortName: string | null;
|
|
5
|
+
colors: {
|
|
6
|
+
primary: string | null;
|
|
7
|
+
secondary: string | null;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
name: string;
|
|
11
|
+
chains: string[];
|
|
12
|
+
desktop: {
|
|
13
|
+
native: string | null;
|
|
14
|
+
universal: string | null;
|
|
15
|
+
};
|
|
16
|
+
rdns: string | null;
|
|
17
|
+
mobile: {
|
|
18
|
+
native: string | null;
|
|
19
|
+
universal: string | null;
|
|
20
|
+
};
|
|
21
|
+
sdks: string[];
|
|
22
|
+
app: {
|
|
23
|
+
android: string | null;
|
|
24
|
+
ios: string | null;
|
|
25
|
+
opera: string | null;
|
|
26
|
+
browser: string | null;
|
|
27
|
+
chrome: string | null;
|
|
28
|
+
edge: string | null;
|
|
29
|
+
firefox: string | null;
|
|
30
|
+
linux: string | null;
|
|
31
|
+
mac: string | null;
|
|
32
|
+
safari: string | null;
|
|
33
|
+
windows: string | null;
|
|
34
|
+
};
|
|
35
|
+
app_type: string;
|
|
36
|
+
category: string | null;
|
|
37
|
+
description: string | null;
|
|
38
|
+
homepage: string;
|
|
39
|
+
image_id: string;
|
|
40
|
+
image_url: {
|
|
41
|
+
lg: string;
|
|
42
|
+
md: string;
|
|
43
|
+
sm: string;
|
|
44
|
+
};
|
|
45
|
+
injected: {
|
|
46
|
+
injected_id: string;
|
|
47
|
+
namespace: string;
|
|
48
|
+
}[] | null;
|
|
49
|
+
slug: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
versions: string[];
|
|
52
|
+
supported_standards?: {
|
|
53
|
+
id: string;
|
|
54
|
+
title: string;
|
|
55
|
+
url: string;
|
|
56
|
+
standard_id: number;
|
|
57
|
+
standard_prefix: string;
|
|
58
|
+
}[] | undefined;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const walletConnectTransformedData: Promise<Record<string, {
|
|
61
|
+
name: string;
|
|
62
|
+
brand?: {
|
|
63
|
+
alt?: string | undefined;
|
|
64
|
+
primaryColor?: string | undefined;
|
|
65
|
+
spriteId?: string | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
chainGroup?: string | undefined;
|
|
68
|
+
chains?: string[] | undefined;
|
|
69
|
+
desktop?: {
|
|
70
|
+
chromeId?: string | undefined;
|
|
71
|
+
edgeId?: string | undefined;
|
|
72
|
+
firefoxId?: string | undefined;
|
|
73
|
+
native?: string | undefined;
|
|
74
|
+
operaId?: string | undefined;
|
|
75
|
+
safariId?: string | undefined;
|
|
76
|
+
universal?: string | undefined;
|
|
77
|
+
} | undefined;
|
|
78
|
+
eip6963Config?: {
|
|
79
|
+
rdns: string;
|
|
80
|
+
} | undefined;
|
|
81
|
+
filterFromWalletConnect?: boolean | undefined;
|
|
82
|
+
group?: string | undefined;
|
|
83
|
+
hardwareWallets?: string[] | undefined;
|
|
84
|
+
injectedConfig?: {
|
|
85
|
+
chain: string;
|
|
86
|
+
extensionLocators: {
|
|
87
|
+
value: boolean;
|
|
88
|
+
flag: string;
|
|
89
|
+
}[];
|
|
90
|
+
providerInterface?: string | undefined;
|
|
91
|
+
walletStandard?: {
|
|
92
|
+
name: string;
|
|
93
|
+
features: string[];
|
|
94
|
+
} | undefined;
|
|
95
|
+
walletStandardLocators?: {
|
|
96
|
+
name: string;
|
|
97
|
+
locator: string;
|
|
98
|
+
}[] | undefined;
|
|
99
|
+
windowLocations?: string[] | undefined;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
mobile?: {
|
|
102
|
+
android?: string | null | undefined;
|
|
103
|
+
androidId?: string | undefined;
|
|
104
|
+
inAppBrowser?: string | null | undefined;
|
|
105
|
+
ios?: string | null | undefined;
|
|
106
|
+
iosId?: string | undefined;
|
|
107
|
+
native?: string | undefined;
|
|
108
|
+
universal?: string | undefined;
|
|
109
|
+
} | undefined;
|
|
110
|
+
mobileExperience?: "in-app-browser" | "redirect" | undefined;
|
|
111
|
+
shortName?: string | undefined;
|
|
112
|
+
showOnlyIfInstalled?: boolean | undefined;
|
|
113
|
+
switchNetworkOnlyFromWallet?: boolean | undefined;
|
|
114
|
+
walletConnect?: {
|
|
115
|
+
sdks?: string[] | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
walletGroup?: string | undefined;
|
|
118
|
+
walletLimitations?: {
|
|
119
|
+
browserExtension?: {
|
|
120
|
+
unsupportedEvents?: string[] | undefined;
|
|
121
|
+
unsupportedMethods?: string[] | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
mobile?: {
|
|
124
|
+
unsupportedEvents?: string[] | undefined;
|
|
125
|
+
unsupportedMethods?: string[] | undefined;
|
|
126
|
+
} | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
}>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const preprocessFilterWCWallets: (sourceData: any) => void;
|
|
2
|
+
export declare const preprocessBrand: (sourceData: any) => void;
|
|
3
|
+
export declare const preprocessDesktop: (sourceData: any) => void;
|
|
4
|
+
export declare const preprocessMobile: (sourceData: any) => void;
|
|
5
|
+
export declare const preprocessSdks: (sourceData: any) => void;
|
|
6
|
+
export declare const preprocessRdns: (sourceData: any) => void;
|
|
7
|
+
export declare const preprocessUniversal: (data: any) => Promise<void>;
|
|
8
|
+
export declare const preprocessNative: (data: any) => void;
|
|
9
|
+
/**
|
|
10
|
+
* 1. Convert the name to lowercase
|
|
11
|
+
* 2. Replace all spaces with empty string
|
|
12
|
+
* 3. Use the new name as the key
|
|
13
|
+
*/
|
|
14
|
+
export declare const preprocessRenameKey: (sourceData: any) => void;
|