Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 75e5288

Browse files
authored
allow passing storage to fromSigner and fromPrivateKey - this was missed when first implementing those functions (#471)
1 parent 217d7c7 commit 75e5288

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

docs/sdk.thirdwebsdk.fromprivatekey.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Get an instance of the thirdweb SDK based on a private key.
1212
<b>Signature:</b>
1313

1414
```typescript
15-
static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions): ThirdwebSDK;
15+
static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK;
1616
```
1717

1818
## Parameters
@@ -22,6 +22,7 @@ static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOpti
2222
| privateKey | string | the private key - \*\*DO NOT EXPOSE THIS TO THE PUBLIC\*\* |
2323
| network | ChainOrRpc | the network (chain) to connect to (e.g. "mainnet", "rinkeby", "polygon", "mumbai"...) or a fully formed RPC url |
2424
| options | [SDKOptions](./sdk.sdkoptions.md) | <i>(Optional)</i> the SDK options to use |
25+
| storage | [IStorage](./sdk.istorage.md) | <i>(Optional)</i> |
2526

2627
<b>Returns:</b>
2728

docs/sdk.thirdwebsdk.fromsigner.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Get an instance of the thirdweb SDK based on an existing ethers signer
1212
<b>Signature:</b>
1313

1414
```typescript
15-
static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions): ThirdwebSDK;
15+
static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK;
1616
```
1717

1818
## Parameters
@@ -22,6 +22,7 @@ static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions): T
2222
| signer | Signer | a ethers Signer to be used for transactions |
2323
| network | ChainOrRpc | <i>(Optional)</i> the network (chain) to connect to (e.g. "mainnet", "rinkeby", "polygon", "mumbai"...) or a fully formed RPC url |
2424
| options | [SDKOptions](./sdk.sdkoptions.md) | <i>(Optional)</i> the SDK options to use |
25+
| storage | [IStorage](./sdk.istorage.md) | <i>(Optional)</i> |
2526

2627
<b>Returns:</b>
2728

docs/sdk.thirdwebsdk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export declare class ThirdwebSDK extends RPCConnectionHandler
3131
3232
| Method | Modifiers | Description |
3333
| --- | --- | --- |
34-
| [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. |
35-
| [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 |
34+
| [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. |
35+
| [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 |
3636
| [getContract(address)](./sdk.thirdwebsdk.getcontract.md) | | <b><i>(BETA)</i></b> Get an instance of a Custom ThirdwebContract |
3737
| [getContractFromAbi(address, abi)](./sdk.thirdwebsdk.getcontractfromabi.md) | | <b><i>(BETA)</i></b> Get an instance of a Custom contract from a json ABI |
3838
| [getContractList(walletAddress)](./sdk.thirdwebsdk.getcontractlist.md) | | Return all the contracts deployed by the specified address |

etc/sdk.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4983,11 +4983,11 @@ export class ThirdwebSDK extends RPCConnectionHandler {
49834983
// Warning: (ae-incompatible-release-tags) The symbol "fromPrivateKey" is marked as @beta, but its signature references "ChainOrRpc" which is marked as @internal
49844984
//
49854985
// @beta
4986-
static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions): ThirdwebSDK;
4986+
static fromPrivateKey(privateKey: string, network: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK;
49874987
// Warning: (ae-incompatible-release-tags) The symbol "fromSigner" is marked as @beta, but its signature references "ChainOrRpc" which is marked as @internal
49884988
//
49894989
// @beta
4990-
static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions): ThirdwebSDK;
4990+
static fromSigner(signer: Signer, network?: ChainOrRpc, options?: SDKOptions, storage?: IStorage): ThirdwebSDK;
49914991
// @internal (undocumented)
49924992
getBuiltInContract<TContractType extends ContractType = ContractType>(address: string, contractType: TContractType): ContractForContractType<TContractType>;
49934993
// @beta

src/core/sdk.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ export class ThirdwebSDK extends RPCConnectionHandler {
6868
signer: Signer,
6969
network?: ChainOrRpc,
7070
options: SDKOptions = {},
71+
storage: IStorage = new IpfsStorage(),
7172
): ThirdwebSDK {
72-
const sdk = new ThirdwebSDK(network || signer, options);
73+
const sdk = new ThirdwebSDK(network || signer, options, storage);
7374
sdk.updateSignerOrProvider(signer);
7475
return sdk;
7576
}
@@ -97,6 +98,7 @@ export class ThirdwebSDK extends RPCConnectionHandler {
9798
privateKey: string,
9899
network: ChainOrRpc,
99100
options: SDKOptions = {},
101+
storage: IStorage = new IpfsStorage(),
100102
): ThirdwebSDK {
101103
const signerOrProvider = getProviderForNetwork(network);
102104
const provider = Signer.isSigner(signerOrProvider)
@@ -105,7 +107,7 @@ export class ThirdwebSDK extends RPCConnectionHandler {
105107
? getReadOnlyProvider(signerOrProvider)
106108
: signerOrProvider;
107109
const signer = new ethers.Wallet(privateKey, provider);
108-
return ThirdwebSDK.fromSigner(signer, network, options);
110+
return ThirdwebSDK.fromSigner(signer, network, options, storage);
109111
}
110112

111113
/**

0 commit comments

Comments
 (0)