Skip to main content

ThirdwebSDK.fromSigner() method

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Get an instance of the thirdweb SDK based on an existing ethers signer

Example

// get a signer from somewhere (createRandom is being used purely for example purposes)
const signer = ethers.Wallet.createRandom();

// get an instance of the SDK with the signer already setup
const sdk = ThirdwebSDK.fromSigner(signer, "mainnet");

Signature:

static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions, storage?: ThirdwebStorage): ThirdwebSDK;

Parameters

ParameterTypeDescription
signerSignera ethers Signer to be used for transactions
networkChainOrRpc(Optional) the network (chain) to connect to (e.g. "mainnet", "rinkeby", "polygon", "mumbai"...) or a fully formed RPC url
optionsSDKOptions(Optional) the SDK options to use
storageThirdwebStorage(Optional) optional storage implementation to use

Returns:

ThirdwebSDK

an instance of the SDK