diff --git a/docs/sdk.thirdwebsdk.fromprivatekey.md b/docs/sdk.thirdwebsdk.fromprivatekey.md index 6276aa909..1ccae97f4 100644 --- a/docs/sdk.thirdwebsdk.fromprivatekey.md +++ b/docs/sdk.thirdwebsdk.fromprivatekey.md @@ -12,7 +12,7 @@ Get an instance of the thirdweb SDK based on a private key. Signature: ```typescript -static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions): ThirdwebSDK; +static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK; ``` ## Parameters @@ -22,6 +22,7 @@ static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOpti | privateKey | string | the private key - \*\*DO NOT EXPOSE THIS TO THE PUBLIC\*\* | | network | ChainOrRpc | the network (chain) to connect to (e.g. "mainnet", "rinkeby", "polygon", "mumbai"...) or a fully formed RPC url | | options | [SDKOptions](./sdk.sdkoptions.md) | (Optional) the SDK options to use | +| storage | [IStorage](./sdk.istorage.md) | (Optional) | Returns: diff --git a/docs/sdk.thirdwebsdk.fromsigner.md b/docs/sdk.thirdwebsdk.fromsigner.md index 35c090dc5..6923c4dc7 100644 --- a/docs/sdk.thirdwebsdk.fromsigner.md +++ b/docs/sdk.thirdwebsdk.fromsigner.md @@ -12,7 +12,7 @@ Get an instance of the thirdweb SDK based on an existing ethers signer Signature: ```typescript -static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions): ThirdwebSDK; +static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK; ``` ## Parameters @@ -22,6 +22,7 @@ static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions): T | 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](./sdk.sdkoptions.md) | (Optional) the SDK options to use | +| storage | [IStorage](./sdk.istorage.md) | (Optional) | Returns: diff --git a/docs/sdk.thirdwebsdk.md b/docs/sdk.thirdwebsdk.md index 6294c7f0c..c27f0f464 100644 --- a/docs/sdk.thirdwebsdk.md +++ b/docs/sdk.thirdwebsdk.md @@ -31,8 +31,8 @@ export declare class ThirdwebSDK extends RPCConnectionHandler | Method | Modifiers | Description | | --- | --- | --- | -| [fromPrivateKey(privateKey, network, options)](./sdk.thirdwebsdk.fromprivatekey.md) | static | (BETA) Get an instance of the thirdweb SDK based on a private key. | -| [fromSigner(signer, network, options)](./sdk.thirdwebsdk.fromsigner.md) | static | (BETA) Get an instance of the thirdweb SDK based on an existing ethers signer | +| [fromPrivateKey(privateKey, network, options, storage)](./sdk.thirdwebsdk.fromprivatekey.md) | static | (BETA) Get an instance of the thirdweb SDK based on a private key. | +| [fromSigner(signer, network, options, storage)](./sdk.thirdwebsdk.fromsigner.md) | static | (BETA) Get an instance of the thirdweb SDK based on an existing ethers signer | | [getContract(address)](./sdk.thirdwebsdk.getcontract.md) | | (BETA) Get an instance of a Custom ThirdwebContract | | [getContractFromAbi(address, abi)](./sdk.thirdwebsdk.getcontractfromabi.md) | | (BETA) Get an instance of a Custom contract from a json ABI | | [getContractList(walletAddress)](./sdk.thirdwebsdk.getcontractlist.md) | | Return all the contracts deployed by the specified address | diff --git a/etc/sdk.api.md b/etc/sdk.api.md index 71768c5cf..e9f4d0e6e 100644 --- a/etc/sdk.api.md +++ b/etc/sdk.api.md @@ -4983,11 +4983,11 @@ export class ThirdwebSDK extends RPCConnectionHandler { // Warning: (ae-incompatible-release-tags) The symbol "fromPrivateKey" is marked as @beta, but its signature references "ChainOrRpc" which is marked as @internal // // @beta - static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions): ThirdwebSDK; + static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK; // Warning: (ae-incompatible-release-tags) The symbol "fromSigner" is marked as @beta, but its signature references "ChainOrRpc" which is marked as @internal // // @beta - static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions): ThirdwebSDK; + static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK; // @internal (undocumented) getBuiltInContract(address: string, contractType: TContractType): ContractForContractType; // @beta diff --git a/src/core/sdk.ts b/src/core/sdk.ts index 81f5110da..191be86df 100644 --- a/src/core/sdk.ts +++ b/src/core/sdk.ts @@ -68,8 +68,9 @@ export class ThirdwebSDK extends RPCConnectionHandler { signer: Signer, network?: ChainOrRpc, options: SDKOptions = {}, + storage: IStorage = new IpfsStorage(), ): ThirdwebSDK { - const sdk = new ThirdwebSDK(network || signer, options); + const sdk = new ThirdwebSDK(network || signer, options, storage); sdk.updateSignerOrProvider(signer); return sdk; } @@ -97,6 +98,7 @@ export class ThirdwebSDK extends RPCConnectionHandler { privateKey: string, network: ChainOrRpc, options: SDKOptions = {}, + storage: IStorage = new IpfsStorage(), ): ThirdwebSDK { const signerOrProvider = getProviderForNetwork(network); const provider = Signer.isSigner(signerOrProvider) @@ -105,7 +107,7 @@ export class ThirdwebSDK extends RPCConnectionHandler { ? getReadOnlyProvider(signerOrProvider) : signerOrProvider; const signer = new ethers.Wallet(privateKey, provider); - return ThirdwebSDK.fromSigner(signer, network, options); + return ThirdwebSDK.fromSigner(signer, network, options, storage); } /**