Embed & Integrate

The Silk SDK is designed for ease of use by both seasoned Web3 devs and those new to self-custody wallets and cryptography.

1. Install

npm i @silk-wallet/silk-wallet-sdk

2. Use

Just getting started with Web3 development? You can easily embed Silk to your site following standard practices that minimizes bugs or performance issues. Silk exposes an EIP-1193-compliant interface, so you can use it just as you would use MetaMask, one of the most common Web3 wallet services. The only difference is that Silk must be initialized.

The following code initializes Silk, presents the login modal to the user, and gets the user's wallet addresses.

import { initSilk } from "@silk-wallet/silk-wallet-sdk"

// Initialize Silk
const silk = initSilk()

// Open the Silk login modal. silk.login() will throw if the user does not log in
try {
  await silk.login()
} catch (error) {
  console.log(error)
}

// Get the user's wallet addresses
const accounts = await silk.request({ method: 'eth_requestAccounts' })

If you want to give the user other wallet options in the Silk signup screen, use the loginSelector method instead of the login method. See the Methods section for details.

Questions or Trouble Integrating?

Reach out to us at silk@holonym.id or join our telegram group to ping the developer community with your question.

Last updated