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?: IStorage): ThirdwebSDK;
Parameters
Parameter | Type | Description |
---|---|---|
signer | Signer | a ethers Signer to be used for transactions |
network | ChainOrRpc | (Optional) the network (chain) to connect to (e.g. "mainnet", "rinkeby", "polygon", "mumbai"...) or a fully formed RPC url |
options | SDKOptions | (Optional) the SDK options to use |
storage | IStorage | (Optional) |
Returns:
an instance of the SDK