LocalWallet
LocalWalletCore.constructor
Initialize the LocalWallet
with the given options
function constructor(
The options
object contains the following properties:
clientId or secretKey (recommended)
Provide clientId
or secretKey
to use the thirdweb RPCs for given chains
If you are using the LocalWallet
in a in frontend - provide a clientId
, If you are using the LocalWallet
in backend - you can provide a secretKey
.
You can create a clientId
/ secretKey
from thirdweb dashboard .
chain (optional)
Must be a Chain
object, from the @thirdweb-dev/chains
package.
Defaults to Ethereum
.
chains (optional)
Provide an array of chains you want to support.
Must be an array of Chain
objects, from the @thirdweb-dev/chains
package.
Defaults to our default chains .
storage (optional)
This is the default storage for storing the private key, mnemonic or encrypted JSON. This can be implemented in any way you want, as long as it conforms to the AsyncStorage
interface:
If omitted, defaults to browser local storage.
import { LocalWallet } from "@thirdweb-dev/wallets"; const customStorage = { getItem: (key) => { // Implement your own storage logic here }, removeItem: (key) => { // Implement your own storage logic here }, setItem: (key, value) => { // Implement your own storage logic here },}; const walletWithOptions = new LocalWallet({ storage: customStorage,});
function getMeta(): { iconURL: string; name: string };
LocalWalletCore.addListener
event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
LocalWalletCore.emit
Calls each of the listeners registered for a given event.
event: T,): boolean;
LocalWalletCore.eventNames
Return an array listing the events for which the emitter has registered listeners.
LocalWalletCore.listenerCount
Return the number of listeners listening to a given event.
LocalWalletCore.listeners
Return the listeners registered for a given event.
event: T,): Array< ( ) => void>;
let returnType: Array< ( ) => void>;
LocalWalletCore.off
event: T, fn?: ( ) => void, context?: any, once?: boolean,): this;
let fn: () => void;
LocalWalletCore.on
Add a listener for a given event.
event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
LocalWalletCore.once
Add a one-time listener for a given event.
event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
LocalWalletCore.removeListener
Remove the listeners of a given event.
event: T, fn?: ( ) => void, context?: any, once?: boolean,): this;
let fn: () => void;
let prefixed: string | boolean;