createWallet
The createWallet
function initializes the embedded wallet and exposes web3 providers to the web page.
Example
import { createWallet } from '@passkeys/core';
const wallet = createWallet({
appId: '<YOUR_APP_ID>',
providers: {
bitcoin: true,
ethereum: true,
solana: true,
},
});
wallet.providers.ethereum.request(/* ... */);
Reference
appId
Identifier of your application. This allows your integration to have its unique settings.
This is only required for production. Reach out to us at [email protected] to obtain yours.
providers
List of web3 providers you want to expose to your dApp, with their optional configuration.
Ethereum & EVM-Compatible Chains
By default, an EIP-1193 (opens in a new tab) provider is returned.
Example
const wallet = createWallet({
providers: {
ethereum: true,
},
});
wallet.providers.ethereum.request(/* ... */);
Additionally, the provider is announced to the web page following EIP-6963 (opens in a new tab). If you want to disable this behavior, pass the eip6963
option.
Example
const wallet = createWallet({
providers: {
ethereum: {
eip6963: false,
},
},
});
If your dApp expects the provider to be available at window.ethereum
, you can also inject it there by passing the dangerouslyInjectWindow
option.
Example
const wallet = createWallet({
providers: {
ethereum: {
dangerouslyInjectWindow: true,
},
},
});
window.ethereum.request(/* ... */);
Solana
By default, a Phantom-like (opens in a new tab) provider is returned.
Example
const wallet = createWallet({
providers: {
solana: true,
},
});
wallet.providers.solana.connect();
Additionally, the provider is announced to the web page following Wallet Standard (opens in a new tab). If you want to disable this behavior, pass the walletStandard
option.
Example
const wallet = createWallet({
providers: {
solana: {
walletStandard: false,
},
},
});
If your dApp expects the provider to be available at window.solana
, you can also inject it there by passing the dangerouslyInjectWindow
option.
Example
const wallet = createWallet({
providers: {
solana: {
dangerouslyInjectWindow: true,
},
},
});
window.solana.connect();
Bitcoin
By default, a Sats Connect v1 (opens in a new tab) provider is returned.
Example
const wallet = createWallet({
providers: {
bitcoin: true,
},
});
wallet.providers.bitcoin.connect(/* ... */);
Additionally, the provider is announced to the web page following Wallet Standard (opens in a new tab). If you want to disable this behavior, pass the walletStandard
option.
Example
const wallet = createWallet({
providers: {
bitcoin: {
walletStandard: false,
},
},
});
If your dApp expects the provider to be available at window.BitcoinProvider
, you can also inject it there by passing the dangerouslyInjectWindow
option.
Example
const wallet = createWallet({
providers: {
bitcoin: {
dangerouslyInjectWindow: true,
},
},
});
window.BitcoinProvider.connect(/* ... */);