Methods

How to use Silk as a developer

// --- Methods exported from "@silk-wallet/silk-wallet-sdk" ---
initSilk(): SilkProvider

// --- Methods on SilkProvider ---
interface SilkProvider {
 /**
  * Open the Silk login modal (without other wallet options). 
  * Returns null if the user logs in. 
  * Throws an error if the user exits without logging in.
  */
 login(): Promise<null>
 /**
  * Open the Silk login modal (with other wallet options). 
  * Returns a string denoting the wallet selected by the user. 
  * Throws an error if the user exits without logging in.
  * @param [injectedProvider] - window.ethereum. The text for the button for the 
  * injected wallet in the login modal changes based on which wallet this is.
  */
 loginSelector(injectedProvider?: EthereumProvider): Promise<'silk' | 'injected' | 'walletconnect'>
 /**
  * Request the user's email address.
  */
 requestEmail(): Promise<string>
 /**
  * This function is implemented as described in EIP-1193 
  * (https://eips.ethereum.org/EIPS/eip-1193#request).
  */
 request(args: { method: string, params?: unknown[] | object }): Promise<unknown>
}

CodeSandbox

We created a CodeSandbox so you can easily see how these methods behave.

Click here to go to the sandbox.

Last updated