Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/sdk.thirdwebsdk.fromprivatekey.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Get an instance of the thirdweb SDK based on a private key.
<b>Signature:</b>

```typescript
static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions): ThirdwebSDK;
static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK;
```

## Parameters
Expand All @@ -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) | <i>(Optional)</i> the SDK options to use |
| storage | [IStorage](./sdk.istorage.md) | <i>(Optional)</i> |

<b>Returns:</b>

Expand Down
3 changes: 2 additions & 1 deletion docs/sdk.thirdwebsdk.fromsigner.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Get an instance of the thirdweb SDK based on an existing ethers signer
<b>Signature:</b>

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

## Parameters
Expand All @@ -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 | <i>(Optional)</i> the network (chain) to connect to (e.g. "mainnet", "rinkeby", "polygon", "mumbai"...) or a fully formed RPC url |
| options | [SDKOptions](./sdk.sdkoptions.md) | <i>(Optional)</i> the SDK options to use |
| storage | [IStorage](./sdk.istorage.md) | <i>(Optional)</i> |

<b>Returns:</b>

Expand Down
4 changes: 2 additions & 2 deletions docs/sdk.thirdwebsdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export declare class ThirdwebSDK extends RPCConnectionHandler

| Method | Modifiers | Description |
| --- | --- | --- |
| [fromPrivateKey(privateKey, network, options)](./sdk.thirdwebsdk.fromprivatekey.md) | <code>static</code> | <b><i>(BETA)</i></b> Get an instance of the thirdweb SDK based on a private key. |
| [fromSigner(signer, network, options)](./sdk.thirdwebsdk.fromsigner.md) | <code>static</code> | <b><i>(BETA)</i></b> Get an instance of the thirdweb SDK based on an existing ethers signer |
| [fromPrivateKey(privateKey, network, options, storage)](./sdk.thirdwebsdk.fromprivatekey.md) | <code>static</code> | <b><i>(BETA)</i></b> Get an instance of the thirdweb SDK based on a private key. |
| [fromSigner(signer, network, options, storage)](./sdk.thirdwebsdk.fromsigner.md) | <code>static</code> | <b><i>(BETA)</i></b> Get an instance of the thirdweb SDK based on an existing ethers signer |
| [getContract(address)](./sdk.thirdwebsdk.getcontract.md) | | <b><i>(BETA)</i></b> Get an instance of a Custom ThirdwebContract |
| [getContractFromAbi(address, abi)](./sdk.thirdwebsdk.getcontractfromabi.md) | | <b><i>(BETA)</i></b> 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 |
Expand Down
4 changes: 2 additions & 2 deletions etc/sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<TContractType extends ContractType = ContractType>(address: string, contractType: TContractType): ContractForContractType<TContractType>;
// @beta
Expand Down
6 changes: 4 additions & 2 deletions src/core/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}

/**
Expand Down