- [Wallet Book](#wallet-book) - [Updating Wallet Book](#updating-wallet-book) - [Adding First Party Wallet](#adding-first-party-wallet) - [Adding injected (browser extension) wallets](#adding-injected-browser-extension-wallets) - [If you n
npm install @dynamic-labs/wallet-book- Wallet Book
- Updating Wallet Book
- Adding First Party Wallet
- Adding injected (browser extension) wallets
- If you need to override any of the following functions: signMessage, getAddress, getSigner, isInstalledOnBrowser, etc...
- Things to remember when adding a new wallet
- Checklist before submitting the PR:
- Updating Wallet Connect Data
- Adding overrides to WalletConnect
- Compile \& Publish
Simply add an entry to firstPartyWalletsData in packages/wallet-book/src/build/sources/firstParty/index.ts and Compile & Publish
For example:
```
argentx: {
brand: {
alt: 'Argent Wallet',
primaryColor: '#FF875B',
spriteId: 'argentx',
},
desktop: {
chromeId: 'dlcobpjiigpikoobohmabehhmhfoodbb',
firefoxId: 'argent-x',
},
name: 'Argent X',
injectedConfig: [
{
chain: 'EVM',
extensionLocators:
}
]
},
Required fields:
- brandalt
- primaryColor
- spriteId
- - The id used in the iconic svgname
-
Refer to WalletRecordsSchema for more schema options
Similar to adding first party wallets, we add another key, injectedConfig to the wallet object.
``
...
injectedConfig: [
{
chain: 'EVM',
extensionLocators: [
{ flag: 'isOkxWallet', value: true },
{ flag: 'isOkexWallet', value: true }
],
windowLocations: ['okxwallet']
}
],
name: 'OKX'
#### If you need to override any of the following functions: signMessage, getAddress, getSigner, isInstalledOnBrowser, etc...
1. Create a file in the respective ethereum/src/injected/ or solana/src/injected/. The basic file should follow this form:
`ts
export class
override name = '
override walletConnectorFallback = true; // only specified on evm wallet connectors
constructor(props: EthereumWalletConnectorOpts) {
super(props);
this.wallet = findWalletBookWallet(this.walletBook, this.key);
}
// override the methods you need below
override async getAddress() {
...
}
}
`
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
#### Things to remember when adding a new wallet
- If the new wallet is also in walletconnect.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.windowLocations
- The value(s) in map to window.. 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.[{ flag: 'isOkxWallet', value: false }, ...]
- For every extension locator you add for the new wallet, add the negation to the extensionLocators under the metamask key in firstParty.walletconnect.json
- If the new wallet is wallet connect enabled (exists in ), 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.
#### Checklist before submitting the PR:
[ ]: 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
[ ]: 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
`shortName
myawesomenewwallet: {
...
injectedConfig: { ... },
shortName: 'My Awesome New Wallet', // maps down to the key if you lowercase and remove special characters and spaces
name: 'Awesome Wallet' // this will be displayed in the wallet list and can be changed as long as the normalizes to the key`
}
NOTE:
Refer to injectedConfigSchema for the schema options
- Download the data from : https://explorer-api.walletconnect.com/v3/wallets?projectId=XXXX replace
- Replace packages/wallet-book/src/build/sources/walletConnect/walletconnect.json
- Compile & Publish
- modify packages/wallet-book/src/build/sources/walletConnectOverrides/index.ts
- Compile & Publish
The compiled json is stored in packages/wallet-book/wallet-book.json. When the file is updated
and merged to main it will be published to S3 automatically.
Simply, make any changes that you need and:
1. Clean any cache of the wallet-book logic
``
npm run nuke
2. Compile
```
npx nx compile wallet-book