npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dynamic-labs/wallet-book

v3.7.0

Published

## Updating Wallet Book

Downloads

65,968

Readme

Wallet Book

Updating Wallet Book

Adding First Party Wallet

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:

  • brand
    • alt
    • primaryColor
    • spriteId - The id used in the iconic svg
    • name

Refer to WalletRecordsSchema for more schema options

Adding injected (browser extension) wallets

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:
export class <NameOfConnector> extends InjectedWalletBase {
  override name = '<Name Here>';
  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() {
    ...
  }
}
  1. 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 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.
  • 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.
  • 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.
  • 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.

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

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 `shortName` normalizes to the key
}

NOTE:

Refer to injectedConfigSchema for the schema options

Updating Wallet Connect Data

  • 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

Adding overrides to WalletConnect

  • modify packages/wallet-book/src/build/sources/walletConnectOverrides/index.ts
  • Compile & Publish

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:

  • run npm run nuke - to clean any cache of the wallet-book logic
  • run npx nx compile wallet-book
  • commit wallet-book.json
  • Open PR with changes and merge