zano_web3 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- **Local Storage Support**: Optionally store wallet credentials in local storage.
|
|
10
10
|
- **Customizable**: Offers hooks for various connection lifecycle events.
|
|
11
11
|
- **Error Handling**: Provides a structured way to handle errors during the connection process.
|
|
12
|
+
- **Alias Management**: Allows retrieving and creating aliases.
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
14
15
|
|
|
@@ -88,26 +89,78 @@ zanoWallet.setWalletCredentials({
|
|
|
88
89
|
});
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
### Retrieving Wallet Data
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
You can retrieve the wallet data using the `getWallet` method:
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
```typescript
|
|
97
|
+
const wallet = await zanoWallet.getWallet();
|
|
98
|
+
console.log('Wallet data:', wallet);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Getting Address by Alias
|
|
96
102
|
|
|
97
|
-
To
|
|
103
|
+
To get an address by alias, use the `getAddressByAlias` method:
|
|
98
104
|
|
|
99
105
|
```typescript
|
|
100
|
-
|
|
106
|
+
const address = await zanoWallet.getAddressByAlias('exampleAlias');
|
|
107
|
+
console.log('Address:', address);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Creating an Alias
|
|
111
|
+
|
|
112
|
+
To create a new alias, use the `createAlias` method:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const newAliasData = await zanoWallet.createAlias('newAlias');
|
|
116
|
+
console.log('Alias created:', newAliasData);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## Exported Types
|
|
101
121
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
122
|
+
The following TypeScript interfaces are exported by the `zano_web3` library.
|
|
123
|
+
You can import them directly from library:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { Wallet, Asset, Transfer, Transaction } from 'zano_web3';
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
export interface Asset {
|
|
131
|
+
name: string;
|
|
132
|
+
ticker: string;
|
|
133
|
+
assetId: string;
|
|
134
|
+
decimalPoint: number;
|
|
135
|
+
balance: string;
|
|
136
|
+
unlockedBalance: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface Transfer {
|
|
140
|
+
amount: string;
|
|
141
|
+
assetId: string;
|
|
142
|
+
incoming: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface Transaction {
|
|
146
|
+
isConfirmed: boolean;
|
|
147
|
+
txHash: string;
|
|
148
|
+
blobSize: number;
|
|
149
|
+
timestamp: number;
|
|
150
|
+
height: number;
|
|
151
|
+
paymentId: string;
|
|
152
|
+
comment: string;
|
|
153
|
+
fee: string;
|
|
154
|
+
isInitiator: boolean;
|
|
155
|
+
transfers: Transfer[];
|
|
156
|
+
}
|
|
107
157
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
158
|
+
export interface Wallet {
|
|
159
|
+
address: string;
|
|
160
|
+
alias: string;
|
|
161
|
+
balance: string;
|
|
162
|
+
assets: Asset[];
|
|
163
|
+
transactions: Transaction[];
|
|
111
164
|
}
|
|
112
165
|
```
|
|
113
166
|
|