This repository was archived by the owner on Aug 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +15
-18
lines changed Expand file tree Collapse file tree 6 files changed +15
-18
lines changed Original file line number Diff line number Diff line change 1
1
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
3
- [ Home] ( ./index.md ) > ; [ @thirdweb-dev/sdk ] ( ./sdk.md ) > ; [ UserWallet] ( ./sdk.userwallet.md ) > ; [ address ] ( ./sdk.userwallet.address .md )
3
+ [ Home] ( ./index.md ) > ; [ @thirdweb-dev/sdk ] ( ./sdk.md ) > ; [ UserWallet] ( ./sdk.userwallet.md ) > ; [ getAddress ] ( ./sdk.userwallet.getaddress .md )
4
4
5
- ## UserWallet.address () method
5
+ ## UserWallet.getAddress () method
6
6
7
7
Get the currently connected address
8
8
9
9
<b >Signature:</b >
10
10
11
11
``` typescript
12
- address (): Promise < string > ;
12
+ getAddress (): Promise < string > ;
13
13
```
14
14
<b >Returns:</b >
15
15
@@ -19,6 +19,6 @@ Promise<string>
19
19
20
20
21
21
``` javascript
22
- const address = await sdk .wallet .address ();
22
+ const address = await sdk .wallet .getAddress ();
23
23
```
24
24
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ const balance = await sdk.wallet.balance();
29
29
30
30
| Method | Modifiers | Description |
31
31
| --- | --- | --- |
32
- | [address ()](./sdk .userwallet .address .md ) | | Get the currently connected address |
33
32
| [balance (currencyAddress )](./sdk .userwallet .balance .md ) | | Fetch the native or ERC20 token balance of this wallet |
33
+ | [getAddress ()](./sdk .userwallet .getaddress .md ) | | Get the currently connected address |
34
34
| [onNetworkUpdated (network )](./sdk .userwallet .onnetworkupdated .md ) | | |
35
35
| [sendRawTransaction (transactionRequest )](./sdk .userwallet .sendrawtransaction .md ) | | Send a raw transaction to the blockchain from the connected wallet |
36
36
| [sign (message )](./sdk .userwallet .sign .md ) | | Sign any message with the connected wallet private key |
Original file line number Diff line number Diff line change @@ -5313,8 +5313,8 @@ export type UploadResult = {
5313
5313
// @public
5314
5314
export class UserWallet {
5315
5315
constructor (network : NetworkOrSignerOrProvider , options : SDKOptions );
5316
- address(): Promise <string >;
5317
5316
balance(currencyAddress ? : string ): Promise <CurrencyValue >;
5317
+ getAddress(): Promise <string >;
5318
5318
// (undocumented)
5319
5319
onNetworkUpdated(network : NetworkOrSignerOrProvider ): void ;
5320
5320
sendRawTransaction(transactionRequest : providers .TransactionRequest ): Promise <TransactionResult >;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @thirdweb-dev/sdk" ,
3
- "version" : " 2.3.4 " ,
3
+ "version" : " 2.3.5-0 " ,
4
4
"description" : " The main thirdweb SDK." ,
5
5
"repository" : {
6
6
"type" : " git" ,
Original file line number Diff line number Diff line change @@ -105,29 +105,26 @@ export class UserWallet {
105
105
) : Promise < CurrencyValue > {
106
106
const signer = this . connection . getSigner ( ) ;
107
107
invariant ( signer , "Wallet not connected" ) ;
108
+ const provider = this . connection . getProvider ( ) ;
108
109
let balance : BigNumber ;
109
110
if ( isNativeToken ( currencyAddress ) ) {
110
- balance = await signer . getBalance ( ) ;
111
+ balance = await provider . getBalance ( await this . getAddress ( ) ) ;
111
112
} else {
112
113
balance = await this . createErc20 ( currencyAddress ) . readContract . balanceOf (
113
- await this . address ( ) ,
114
+ await this . getAddress ( ) ,
114
115
) ;
115
116
}
116
- return await fetchCurrencyValue (
117
- this . connection . getProvider ( ) ,
118
- currencyAddress ,
119
- balance ,
120
- ) ;
117
+ return await fetchCurrencyValue ( provider , currencyAddress , balance ) ;
121
118
}
122
119
123
120
/**
124
121
* Get the currently connected address
125
122
* @example
126
123
* ```javascript
127
- * const address = await sdk.wallet.address ();
124
+ * const address = await sdk.wallet.getAddress ();
128
125
* ```
129
126
*/
130
- async address ( ) : Promise < string > {
127
+ async getAddress ( ) : Promise < string > {
131
128
return await this . connectedWallet ( ) . getAddress ( ) ;
132
129
}
133
130
Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ describe("Wallet", async () => {
44
44
45
45
it ( "should fetch addresses" , async ( ) => {
46
46
sdk . updateSignerOrProvider ( adminWallet ) ;
47
- expect ( await sdk . wallet . address ( ) ) . to . eq ( adminWallet . address ) ;
47
+ expect ( await sdk . wallet . getAddress ( ) ) . to . eq ( adminWallet . address ) ;
48
48
sdk . updateSignerOrProvider ( samWallet ) ;
49
- expect ( await sdk . wallet . address ( ) ) . to . eq ( samWallet . address ) ;
49
+ expect ( await sdk . wallet . getAddress ( ) ) . to . eq ( samWallet . address ) ;
50
50
} ) ;
51
51
} ) ;
You can’t perform that action at this time.
0 commit comments