turing-wallet-provider 1.2.8 → 1.2.9
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 +388 -382
- package/dist/context/TuringWalletContext.d.ts +8 -8
- package/dist/context/TuringWalletContext.js +24 -24
- package/dist/hook/useTuringWallet.d.ts +1 -1
- package/dist/hook/useTuringWallet.js +13 -13
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -19
- package/dist/types/providerTypes.d.ts +114 -111
- package/dist/types/providerTypes.js +9 -9
- package/package.json +26 -26
package/README.md
CHANGED
|
@@ -1,382 +1,388 @@
|
|
|
1
|
-
# connect
|
|
2
|
-
|
|
3
|
-
```tsx
|
|
4
|
-
npm install turing-wallet-provider@latest
|
|
5
|
-
|
|
6
|
-
import { TuringProvider } from "turing-wallet-provider";
|
|
7
|
-
|
|
8
|
-
root.render(
|
|
9
|
-
<TuringProvider>
|
|
10
|
-
<App />
|
|
11
|
-
</TuringProvider>
|
|
12
|
-
);
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import { useTuringsWallet } from "turing-wallet-provider";
|
|
17
|
-
|
|
18
|
-
const wallet = useTuringsWallet();
|
|
19
|
-
await wallet.connect();
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## disconnect
|
|
23
|
-
|
|
24
|
-
```tsx
|
|
25
|
-
const wallet = useTuringsWallet();
|
|
26
|
-
await wallet.disconnect();
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## isConnected
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
const wallet = useTuringsWallet();
|
|
33
|
-
const ture/false = await wallet.isConnected();
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## getPubKey
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
const wallet = useTuringsWallet();
|
|
40
|
-
const { tbcPubKey } = await wallet.getPubKey(); //tbcPubKey为string类型
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## getAddress
|
|
44
|
-
|
|
45
|
-
```tsx
|
|
46
|
-
const wallet = useTuringsWallet();
|
|
47
|
-
const { tbcAddress } = await wallet.getAddress(); //tbcAddress为string类型
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## getBalance
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
const wallet = useTuringsWallet();
|
|
54
|
-
const { tbc } = await wallet.getBalance(); //tbc为number类型,单位为tbc
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## getInfo
|
|
58
|
-
|
|
59
|
-
```tsx
|
|
60
|
-
const wallet = useTuringsWallet();
|
|
61
|
-
const {name,platform,version} = await wallet.getInfo();
|
|
62
|
-
{Turing,android,1.0.0}示例的返回值
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## getPaymentUtxos
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
const wallet = useTuringsWallet();
|
|
69
|
-
try {
|
|
70
|
-
const utxos = await wallet.getPaymentUtxos();
|
|
71
|
-
console.log(utxos);
|
|
72
|
-
} catch (err) {
|
|
73
|
-
console.log(err);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
[
|
|
77
|
-
{
|
|
78
|
-
satoshis: 205551
|
|
79
|
-
script: "76a914b681d8032b448405d44e82807fab2c8894eed57788ac"
|
|
80
|
-
txid: "c58e8b0dd25e56af0696b026c1961dccd0cab3fe42fb2f3ac934ebdc3accbb40"
|
|
81
|
-
vout: 0
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
satoshis: 19909
|
|
85
|
-
script: "76a914b681d8032b448405d44e82807fab2c8894eed57788ac"
|
|
86
|
-
txid: "4c52add57a2c9cda29501a810a1312eaee9423d28440a09acbf5d9d8d0467382"
|
|
87
|
-
vout: 0
|
|
88
|
-
}
|
|
89
|
-
]//模拟的输出
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## signMessage
|
|
93
|
-
|
|
94
|
-
```tsx
|
|
95
|
-
const wallet = useTuringsWallet();
|
|
96
|
-
try{
|
|
97
|
-
const { address, pubKey, sig, message } = await wallet.signMessage({ message: "hello world", encoding: "base64" });//encoding可为utf-8,base64,hex
|
|
98
|
-
}catch(error){
|
|
99
|
-
console.log(error);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//本地验证签名
|
|
103
|
-
import * as tbc from "tbc-lib-js"
|
|
104
|
-
|
|
105
|
-
const msg_buf = Buffer.from(message,encoding);
|
|
106
|
-
const true/false = tbc.Message.verify(msg_buf,address,sig);
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## encrypt
|
|
110
|
-
|
|
111
|
-
```tsx
|
|
112
|
-
const wallet = useTuringsWallet();
|
|
113
|
-
try {
|
|
114
|
-
const encryptedMessage = await wallet.encrypt(message);
|
|
115
|
-
if (encryptedMessage) {
|
|
116
|
-
console.log(encryptedMessage);
|
|
117
|
-
}
|
|
118
|
-
} catch (error) {
|
|
119
|
-
console.log(error);
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## decrypt
|
|
124
|
-
|
|
125
|
-
```ts
|
|
126
|
-
const wallet = useTuringsWallet();
|
|
127
|
-
try {
|
|
128
|
-
const decryptedMessage = await wallet.decrypt(message);
|
|
129
|
-
if (decryptedMessage) {
|
|
130
|
-
console.log(decryptedMessage);
|
|
131
|
-
}
|
|
132
|
-
} catch (error) {
|
|
133
|
-
console.log(error);
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## sendTransaction
|
|
138
|
-
|
|
139
|
-
```tsx
|
|
140
|
-
interface FTData {
|
|
141
|
-
name:string;
|
|
142
|
-
symbol :string;
|
|
143
|
-
decimal :number;
|
|
144
|
-
amount :number;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
interface CollectionData {
|
|
148
|
-
collectionName: string;
|
|
149
|
-
description: string;
|
|
150
|
-
supply: number;
|
|
151
|
-
file: string;//file为图片base64编码后数据
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
interface NFTData {
|
|
155
|
-
nftName: string;
|
|
156
|
-
symbol: string;
|
|
157
|
-
description: string;
|
|
158
|
-
attributes: string;
|
|
159
|
-
file?: string;//file为图片base64编码后数据,若无则为引用合集图片
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
interface RequestParam = {
|
|
163
|
-
flag: "P2PKH" | "COLLECTION_CREATE" | "NFT_CREATE" | "NFT_TRANSFER" | "FT_MINT" | "FT_TRANSFER" | "POOLNFT_MINT" | "POOLNFT_INIT" | "POOLNFT_LP_INCREASE" |"POOLNFT_LP_CONSUME"| "POOLNFT_SWAP_TO_TOKEN" | "POOLNFT_SWAP_TO_TBC" | "POOLNFT_MERGE"|"FTLP_MERGE";
|
|
164
|
-
addres?: string;//交易接收者地址
|
|
165
|
-
satoshis?: number;//单位为satoshis
|
|
166
|
-
collection_data?: string; //json格式传
|
|
167
|
-
ft_data?: string; //json格式传
|
|
168
|
-
nft_data?: string; //json格式传
|
|
169
|
-
collection_id?: string;
|
|
170
|
-
nft_contract_address?: string;
|
|
171
|
-
ft_contract_address?: string;
|
|
172
|
-
tbc_amount?: number;
|
|
173
|
-
ft_amount?: number;
|
|
174
|
-
merge_times?:number; //可选字段 不提供默认为10
|
|
175
|
-
with_lock? boolean;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const
|
|
382
|
-
|
|
1
|
+
# connect
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
npm install turing-wallet-provider@latest
|
|
5
|
+
|
|
6
|
+
import { TuringProvider } from "turing-wallet-provider";
|
|
7
|
+
|
|
8
|
+
root.render(
|
|
9
|
+
<TuringProvider>
|
|
10
|
+
<App />
|
|
11
|
+
</TuringProvider>
|
|
12
|
+
);
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useTuringsWallet } from "turing-wallet-provider";
|
|
17
|
+
|
|
18
|
+
const wallet = useTuringsWallet();
|
|
19
|
+
await wallet.connect();
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## disconnect
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
const wallet = useTuringsWallet();
|
|
26
|
+
await wallet.disconnect();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## isConnected
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
const wallet = useTuringsWallet();
|
|
33
|
+
const ture/false = await wallet.isConnected();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## getPubKey
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
const wallet = useTuringsWallet();
|
|
40
|
+
const { tbcPubKey } = await wallet.getPubKey(); //tbcPubKey为string类型
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## getAddress
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
const wallet = useTuringsWallet();
|
|
47
|
+
const { tbcAddress } = await wallet.getAddress(); //tbcAddress为string类型
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## getBalance
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
const wallet = useTuringsWallet();
|
|
54
|
+
const { tbc } = await wallet.getBalance(); //tbc为number类型,单位为tbc
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## getInfo
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
const wallet = useTuringsWallet();
|
|
61
|
+
const {name,platform,version} = await wallet.getInfo();
|
|
62
|
+
{Turing,android,1.0.0}示例的返回值
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## getPaymentUtxos
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
const wallet = useTuringsWallet();
|
|
69
|
+
try {
|
|
70
|
+
const utxos = await wallet.getPaymentUtxos();
|
|
71
|
+
console.log(utxos);
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.log(err);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
satoshis: 205551
|
|
79
|
+
script: "76a914b681d8032b448405d44e82807fab2c8894eed57788ac"
|
|
80
|
+
txid: "c58e8b0dd25e56af0696b026c1961dccd0cab3fe42fb2f3ac934ebdc3accbb40"
|
|
81
|
+
vout: 0
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
satoshis: 19909
|
|
85
|
+
script: "76a914b681d8032b448405d44e82807fab2c8894eed57788ac"
|
|
86
|
+
txid: "4c52add57a2c9cda29501a810a1312eaee9423d28440a09acbf5d9d8d0467382"
|
|
87
|
+
vout: 0
|
|
88
|
+
}
|
|
89
|
+
]//模拟的输出
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## signMessage
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
const wallet = useTuringsWallet();
|
|
96
|
+
try{
|
|
97
|
+
const { address, pubKey, sig, message } = await wallet.signMessage({ message: "hello world", encoding: "base64" });//encoding可为utf-8,base64,hex
|
|
98
|
+
}catch(error){
|
|
99
|
+
console.log(error);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//本地验证签名
|
|
103
|
+
import * as tbc from "tbc-lib-js"
|
|
104
|
+
|
|
105
|
+
const msg_buf = Buffer.from(message,encoding);
|
|
106
|
+
const true/false = tbc.Message.verify(msg_buf,address,sig);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## encrypt
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
const wallet = useTuringsWallet();
|
|
113
|
+
try {
|
|
114
|
+
const encryptedMessage = await wallet.encrypt(message);
|
|
115
|
+
if (encryptedMessage) {
|
|
116
|
+
console.log(encryptedMessage);
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.log(error);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## decrypt
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
const wallet = useTuringsWallet();
|
|
127
|
+
try {
|
|
128
|
+
const decryptedMessage = await wallet.decrypt(message);
|
|
129
|
+
if (decryptedMessage) {
|
|
130
|
+
console.log(decryptedMessage);
|
|
131
|
+
}
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.log(error);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## sendTransaction
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
interface FTData {
|
|
141
|
+
name:string;
|
|
142
|
+
symbol :string;
|
|
143
|
+
decimal :number;
|
|
144
|
+
amount :number;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
interface CollectionData {
|
|
148
|
+
collectionName: string;
|
|
149
|
+
description: string;
|
|
150
|
+
supply: number;
|
|
151
|
+
file: string;//file为图片base64编码后数据
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
interface NFTData {
|
|
155
|
+
nftName: string;
|
|
156
|
+
symbol: string;
|
|
157
|
+
description: string;
|
|
158
|
+
attributes: string;
|
|
159
|
+
file?: string;//file为图片base64编码后数据,若无则为引用合集图片
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
interface RequestParam = {
|
|
163
|
+
flag: "P2PKH" | "COLLECTION_CREATE" | "NFT_CREATE" | "NFT_TRANSFER" | "FT_MINT" | "FT_TRANSFER" | "POOLNFT_MINT" | "POOLNFT_INIT" | "POOLNFT_LP_INCREASE" |"POOLNFT_LP_CONSUME"| "POOLNFT_SWAP_TO_TOKEN" | "POOLNFT_SWAP_TO_TBC" | "POOLNFT_MERGE"|"FTLP_MERGE";
|
|
164
|
+
addres?: string;//交易接收者地址
|
|
165
|
+
satoshis?: number;//单位为satoshis
|
|
166
|
+
collection_data?: string; //json格式传
|
|
167
|
+
ft_data?: string; //json格式传
|
|
168
|
+
nft_data?: string; //json格式传
|
|
169
|
+
collection_id?: string;
|
|
170
|
+
nft_contract_address?: string;
|
|
171
|
+
ft_contract_address?: string;
|
|
172
|
+
tbc_amount?: number;
|
|
173
|
+
ft_amount?: number;
|
|
174
|
+
merge_times?:number; //可选字段 不提供默认为10
|
|
175
|
+
with_lock? boolean;
|
|
176
|
+
lpCostAddress?: string;//设置添加流动性扣款地址
|
|
177
|
+
lpCostAmount?: number;//设置添加流动性扣款TBC数量
|
|
178
|
+
pubKeyLock?: string[];
|
|
179
|
+
poolNFT_version?: number; // 1或2 不提供默认为2
|
|
180
|
+
serviceFeeRate?: number; // 0-100 poolNFT_version为2有效 不提供默认为25
|
|
181
|
+
serverProvider_tag?:string; //poolNFT_version为2时为必需字段 poolNFT_version为1无效
|
|
182
|
+
lpPlan?:number //1或2 不提供默认为1 lp手续费方案, 方案1: LP 0.25% swap服务商 0.09% 协议0.01%; 方案2: LP 0.05% swap服务商 0.29% 协议0.01%
|
|
183
|
+
domain?:string // 设置构建及广播交易使用的节点和api服务 只支持https 不提供默认值是turingwallet.xyz 具体结构为https://${domain}/v1/tbc/main
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const params = [param:RequestParam] //目前参数里只能放一个对象,有批量发送需求再扩展
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### P2PKH
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
const params = [
|
|
193
|
+
{
|
|
194
|
+
flag: "P2PKH",
|
|
195
|
+
satoshis: 1000,
|
|
196
|
+
address: "",
|
|
197
|
+
domain: "",
|
|
198
|
+
},
|
|
199
|
+
];
|
|
200
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### COLLECTION_CREATE
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
const params = [
|
|
207
|
+
{
|
|
208
|
+
flag: "COLLECTION_CREATE",
|
|
209
|
+
collection_data: "",
|
|
210
|
+
domain: "",
|
|
211
|
+
},
|
|
212
|
+
];
|
|
213
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### NFT_CREATE
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
const params = [
|
|
220
|
+
{
|
|
221
|
+
flag: "NFT_CREATE",
|
|
222
|
+
nft_data: "",
|
|
223
|
+
collection_id: "",
|
|
224
|
+
domain: "",
|
|
225
|
+
},
|
|
226
|
+
];
|
|
227
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### NFT_TRANSFER
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
const params = [
|
|
234
|
+
{
|
|
235
|
+
flag: "NFT_TRANSFER",
|
|
236
|
+
nft_contract_address: "",
|
|
237
|
+
address: "",
|
|
238
|
+
domain: "",
|
|
239
|
+
},
|
|
240
|
+
];
|
|
241
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### FT_MINT
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
const params = [
|
|
248
|
+
{
|
|
249
|
+
flag: "FT_MINT",
|
|
250
|
+
ft_data: "",
|
|
251
|
+
domain: "",
|
|
252
|
+
},
|
|
253
|
+
];
|
|
254
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### FT_TRANSFER
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
const params = [
|
|
261
|
+
{
|
|
262
|
+
flag: "FT_TRANSFER",
|
|
263
|
+
ft_contract_address: "",
|
|
264
|
+
ft_amount: 0.1,
|
|
265
|
+
tbc_amount: 1, //同时转ft和tbc时候可提供参数
|
|
266
|
+
address: "",
|
|
267
|
+
domain: "",
|
|
268
|
+
},
|
|
269
|
+
];
|
|
270
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### POOLNFT_MINT
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
const params = [{
|
|
277
|
+
flag:"POOLNFT_MINT",
|
|
278
|
+
ft_contract_address:"",
|
|
279
|
+
poolNFT_version?:2,
|
|
280
|
+
serverProvider_tag?:"",
|
|
281
|
+
serviceFeeRate?:25, // poolNFT_version为2时此参数有效,默认为25
|
|
282
|
+
with_lock?:false //默认值为false,为true则创建带哈希锁的poolNFT
|
|
283
|
+
pubKeyLock?:["pubkey1","pubkey2"];
|
|
284
|
+
lpCostAddress?:"";//设置添加流动性扣款地址
|
|
285
|
+
lpCostTBC?:5;//设置添加流动性扣款TBC数量
|
|
286
|
+
lpPlan?:1 //默认值为1
|
|
287
|
+
domain?: "",
|
|
288
|
+
}];
|
|
289
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### POOLNFT_INIT
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
const params = [{
|
|
296
|
+
flag:"POOLNFT_INIT",
|
|
297
|
+
nft_contract_address:"",
|
|
298
|
+
address:"",
|
|
299
|
+
tbc_amount:30,
|
|
300
|
+
ft_amount:1000,
|
|
301
|
+
poolNFT_version?:2,
|
|
302
|
+
domain?: "",
|
|
303
|
+
}];
|
|
304
|
+
const { txid, rawtx } = await wallet.sendTransaction(params);
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### POOLNFT_LP_INCREASE
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
const params = [{
|
|
311
|
+
flag:"POOLNFT_LP_INCREASE",
|
|
312
|
+
nft_contract_address:"",
|
|
313
|
+
address:"",
|
|
314
|
+
tbc_amount:3,
|
|
315
|
+
poolNFT_version?:2,
|
|
316
|
+
domain?: "",
|
|
317
|
+
}];
|
|
318
|
+
const { txid, rawtx } = await wallet.sendTransaction(params);
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### POOLNFT_LP_CONSUME
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
const params = [{
|
|
325
|
+
flag:"POOLNFT_LP_CONSUME",
|
|
326
|
+
nft_contract_address:"",
|
|
327
|
+
address:"",
|
|
328
|
+
ft_amount:100,
|
|
329
|
+
poolNFT_version?:2,
|
|
330
|
+
domain?: "",
|
|
331
|
+
}];
|
|
332
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### POOLNFT_SWAP_TO_TOKEN
|
|
336
|
+
|
|
337
|
+
```ts
|
|
338
|
+
const params = [{
|
|
339
|
+
flag:"POOLNFT_SWAP_TO_TOKEN",
|
|
340
|
+
nft_contract_address:"",
|
|
341
|
+
address:"",
|
|
342
|
+
tbc_amount:10,
|
|
343
|
+
poolNFT_version?:2
|
|
344
|
+
lpPlan?:1 //默认值为1,
|
|
345
|
+
domain?: "",
|
|
346
|
+
}];
|
|
347
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### POOLNFT_SWAP_TO_TBC
|
|
351
|
+
|
|
352
|
+
```ts
|
|
353
|
+
const params = [{
|
|
354
|
+
flag:"POOLNFT_SWAP_TO_TBC",
|
|
355
|
+
nft_contract_address:"",
|
|
356
|
+
address:"",
|
|
357
|
+
ft_amount:10,
|
|
358
|
+
poolNFT_version?:2
|
|
359
|
+
lpPlan?:1 //默认值为1,
|
|
360
|
+
domain?: "",
|
|
361
|
+
}];
|
|
362
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### POOLNFT_MERGE
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
const params = [{
|
|
369
|
+
flag:"POOLNFT_MERGE",
|
|
370
|
+
nft_contract_address:"",
|
|
371
|
+
poolNFT_version?:2,
|
|
372
|
+
merge_times?:1, //1-10次 默认为10次 不足10次会提前终止
|
|
373
|
+
domain?: "",
|
|
374
|
+
}];
|
|
375
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### FTLP_MERGE
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
const params = [{
|
|
382
|
+
flag:"FTLP_MERGE",
|
|
383
|
+
nft_contract_address:"",
|
|
384
|
+
poolNFT_version?:2,
|
|
385
|
+
domain?: "",
|
|
386
|
+
}];
|
|
387
|
+
const { txid } = await wallet.sendTransaction(params);
|
|
388
|
+
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { TuringProviderType } from "../types/providerTypes"
|
|
3
|
-
export declare const TuringContext: import("react").Context<TuringProviderType | undefined>;
|
|
4
|
-
interface TuringProviderProps {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const TuringProvider: (props: TuringProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export { };
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { TuringProviderType } from "../types/providerTypes"
|
|
3
|
+
export declare const TuringContext: import("react").Context<TuringProviderType | undefined>;
|
|
4
|
+
interface TuringProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const TuringProvider: (props: TuringProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TuringProvider = exports.TuringContext = void 0;
|
|
4
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
exports.TuringContext = (0, react_1.createContext)(undefined);
|
|
7
|
-
var TuringProvider = function (props) {
|
|
8
|
-
var children = props.children;
|
|
9
|
-
// It takes a moment for the Turing wallet to get injected into the DOM. To use context we need an initial state;
|
|
10
|
-
var _a = (0, react_1.useState)({ isReady: false }), TuringWallet = _a[0], setTuringWallet = _a[1];
|
|
11
|
-
(0, react_1.useEffect)(function () {
|
|
12
|
-
var checkTuringWallet = function () {
|
|
13
|
-
var _a;
|
|
14
|
-
if ("Turing" in window && ((_a = window.Turing) === null || _a === void 0 ? void 0 : _a.isReady)) {
|
|
15
|
-
setTuringWallet(window.Turing);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
checkTuringWallet();
|
|
19
|
-
var intervalId = setInterval(checkTuringWallet, 1000);
|
|
20
|
-
return function () { return clearInterval(intervalId); };
|
|
21
|
-
}, []);
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(exports.TuringContext.Provider, { value: TuringWallet, children: children }));
|
|
23
|
-
};
|
|
24
|
-
exports.TuringProvider = TuringProvider;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TuringProvider = exports.TuringContext = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
exports.TuringContext = (0, react_1.createContext)(undefined);
|
|
7
|
+
var TuringProvider = function (props) {
|
|
8
|
+
var children = props.children;
|
|
9
|
+
// It takes a moment for the Turing wallet to get injected into the DOM. To use context we need an initial state;
|
|
10
|
+
var _a = (0, react_1.useState)({ isReady: false }), TuringWallet = _a[0], setTuringWallet = _a[1];
|
|
11
|
+
(0, react_1.useEffect)(function () {
|
|
12
|
+
var checkTuringWallet = function () {
|
|
13
|
+
var _a;
|
|
14
|
+
if ("Turing" in window && ((_a = window.Turing) === null || _a === void 0 ? void 0 : _a.isReady)) {
|
|
15
|
+
setTuringWallet(window.Turing);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
checkTuringWallet();
|
|
19
|
+
var intervalId = setInterval(checkTuringWallet, 1000);
|
|
20
|
+
return function () { return clearInterval(intervalId); };
|
|
21
|
+
}, []);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(exports.TuringContext.Provider, { value: TuringWallet, children: children }));
|
|
23
|
+
};
|
|
24
|
+
exports.TuringProvider = TuringProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useTuringWallet: () => import("..").TuringProviderType;
|
|
1
|
+
export declare const useTuringWallet: () => import("..").TuringProviderType;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTuringWallet = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var TuringWalletContext_1 = require("../context/TuringWalletContext");
|
|
6
|
-
var useTuringWallet = function () {
|
|
7
|
-
var context = (0, react_1.useContext)(TuringWalletContext_1.TuringContext);
|
|
8
|
-
if (!context) {
|
|
9
|
-
throw new Error("useTuringWallet must be used within a TuringProvider");
|
|
10
|
-
}
|
|
11
|
-
return context;
|
|
12
|
-
};
|
|
13
|
-
exports.useTuringWallet = useTuringWallet;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTuringWallet = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var TuringWalletContext_1 = require("../context/TuringWalletContext");
|
|
6
|
+
var useTuringWallet = function () {
|
|
7
|
+
var context = (0, react_1.useContext)(TuringWalletContext_1.TuringContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error("useTuringWallet must be used within a TuringProvider");
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
};
|
|
13
|
+
exports.useTuringWallet = useTuringWallet;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./context/TuringWalletContext";
|
|
2
|
-
export * from "./hook/useTuringWallet";
|
|
3
|
-
export * from "./types/providerTypes";
|
|
1
|
+
export * from "./context/TuringWalletContext";
|
|
2
|
+
export * from "./hook/useTuringWallet";
|
|
3
|
+
export * from "./types/providerTypes";
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./context/TuringWalletContext"), exports);
|
|
18
|
-
__exportStar(require("./hook/useTuringWallet"), exports);
|
|
19
|
-
__exportStar(require("./types/providerTypes"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./context/TuringWalletContext"), exports);
|
|
18
|
+
__exportStar(require("./hook/useTuringWallet"), exports);
|
|
19
|
+
__exportStar(require("./types/providerTypes"), exports);
|
|
@@ -1,111 +1,114 @@
|
|
|
1
|
-
export type PubKey = {
|
|
2
|
-
tbcPubKey: string;
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
export type Address = {
|
|
6
|
-
tbcAddress: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type Balance = {
|
|
10
|
-
tbc: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type Info = {
|
|
14
|
-
name: string;
|
|
15
|
-
platform: string;
|
|
16
|
-
version: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type SignedMessage = {
|
|
20
|
-
address: string;
|
|
21
|
-
pubKey: string;
|
|
22
|
-
sig: string;
|
|
23
|
-
message: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type TransactionFlag =
|
|
27
|
-
| "P2PKH"
|
|
28
|
-
| "COLLECTION_CREATE"
|
|
29
|
-
| "NFT_CREATE"
|
|
30
|
-
| "NFT_TRANSFER"
|
|
31
|
-
| "FT_MINT"
|
|
32
|
-
| "FT_TRANSFER"
|
|
33
|
-
| "POOLNFT_MINT"
|
|
34
|
-
| "POOLNFT_INIT"
|
|
35
|
-
| "POOLNFT_LP_INCREASE"
|
|
36
|
-
| "POOLNFT_LP_CONSUME"
|
|
37
|
-
| "POOLNFT_SWAP_TO_TOKEN"
|
|
38
|
-
| "POOLNFT_SWAP_TO_TBC"
|
|
39
|
-
| "POOLNFT_MERGE"
|
|
40
|
-
| "FTLP_MERGE";
|
|
41
|
-
|
|
42
|
-
export type SendTransaction = {
|
|
43
|
-
flag: TransactionFlag;
|
|
44
|
-
satoshis?: number;
|
|
45
|
-
address?: string;
|
|
46
|
-
collection_data?: string;
|
|
47
|
-
ft_data?: string;
|
|
48
|
-
nft_data?: string;
|
|
49
|
-
collection_id?: string;
|
|
50
|
-
nft_contract_address?: string;
|
|
51
|
-
ft_contract_address?: string;
|
|
52
|
-
tbc_amount?: number;
|
|
53
|
-
ft_amount?: number;
|
|
54
|
-
merge_times?: number;
|
|
55
|
-
with_lock?: boolean;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
) => Promise<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
export type PubKey = {
|
|
2
|
+
tbcPubKey: string;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export type Address = {
|
|
6
|
+
tbcAddress: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type Balance = {
|
|
10
|
+
tbc: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type Info = {
|
|
14
|
+
name: string;
|
|
15
|
+
platform: string;
|
|
16
|
+
version: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type SignedMessage = {
|
|
20
|
+
address: string;
|
|
21
|
+
pubKey: string;
|
|
22
|
+
sig: string;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type TransactionFlag =
|
|
27
|
+
| "P2PKH"
|
|
28
|
+
| "COLLECTION_CREATE"
|
|
29
|
+
| "NFT_CREATE"
|
|
30
|
+
| "NFT_TRANSFER"
|
|
31
|
+
| "FT_MINT"
|
|
32
|
+
| "FT_TRANSFER"
|
|
33
|
+
| "POOLNFT_MINT"
|
|
34
|
+
| "POOLNFT_INIT"
|
|
35
|
+
| "POOLNFT_LP_INCREASE"
|
|
36
|
+
| "POOLNFT_LP_CONSUME"
|
|
37
|
+
| "POOLNFT_SWAP_TO_TOKEN"
|
|
38
|
+
| "POOLNFT_SWAP_TO_TBC"
|
|
39
|
+
| "POOLNFT_MERGE"
|
|
40
|
+
| "FTLP_MERGE";
|
|
41
|
+
|
|
42
|
+
export type SendTransaction = {
|
|
43
|
+
flag: TransactionFlag;
|
|
44
|
+
satoshis?: number;
|
|
45
|
+
address?: string;
|
|
46
|
+
collection_data?: string;
|
|
47
|
+
ft_data?: string;
|
|
48
|
+
nft_data?: string;
|
|
49
|
+
collection_id?: string;
|
|
50
|
+
nft_contract_address?: string;
|
|
51
|
+
ft_contract_address?: string;
|
|
52
|
+
tbc_amount?: number;
|
|
53
|
+
ft_amount?: number;
|
|
54
|
+
merge_times?: number;
|
|
55
|
+
with_lock?: boolean;
|
|
56
|
+
lpCostAddress?: string;
|
|
57
|
+
lpCostAmount?: number;
|
|
58
|
+
pubKeyLock?: string[];
|
|
59
|
+
poolNFT_version?: number;
|
|
60
|
+
serviceFeeRate?: number;
|
|
61
|
+
serviceProvider_flag?: string;
|
|
62
|
+
lpPlan?: number;
|
|
63
|
+
domain?: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type SignMessage = {
|
|
67
|
+
message: string;
|
|
68
|
+
encoding?: "utf8" | "hex" | "base64";
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type Utxos = {
|
|
72
|
+
satoshis: number;
|
|
73
|
+
script: string;
|
|
74
|
+
txid: string;
|
|
75
|
+
vout: number;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type SendTransactionResponse = {
|
|
79
|
+
txid: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type Encrypt = {
|
|
83
|
+
message: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type Decrypt = {
|
|
87
|
+
message: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type EncryptResponse = {
|
|
91
|
+
encryptedMessage: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type DecryptResponse = {
|
|
95
|
+
decryptedMessage: string;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type TuringProviderType = {
|
|
99
|
+
isReady: boolean;
|
|
100
|
+
connect: () => Promise<string | undefined>;
|
|
101
|
+
disconnect: () => Promise<boolean>;
|
|
102
|
+
isConnected: () => Promise<boolean>;
|
|
103
|
+
getPubKey: () => Promise<PubKey | undefined>;
|
|
104
|
+
getAddress: () => Promise<Address | undefined>;
|
|
105
|
+
getBalance: () => Promise<Balance | undefined>;
|
|
106
|
+
getInfo: () => Promise<Info | undefined>;
|
|
107
|
+
sendTransaction: (
|
|
108
|
+
params: SendTransaction[]
|
|
109
|
+
) => Promise<SendTransactionResponse | undefined>;
|
|
110
|
+
signMessage: (params: SignMessage) => Promise<SignedMessage | undefined>;
|
|
111
|
+
getPaymentUtxos: () => Promise<Utxos[] | undefined>;
|
|
112
|
+
encrypt: (params: Encrypt) => Promise<EncryptResponse | undefined>;
|
|
113
|
+
decrypt: (params: Decrypt) => Promise<DecryptResponse | undefined>;
|
|
114
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Tbc20Status = void 0;
|
|
4
|
-
var Tbc20Status;
|
|
5
|
-
(function (Tbc20Status) {
|
|
6
|
-
Tbc20Status[Tbc20Status["Invalid"] = -1] = "Invalid";
|
|
7
|
-
Tbc20Status[Tbc20Status["Pending"] = 0] = "Pending";
|
|
8
|
-
Tbc20Status[Tbc20Status["Valid"] = 1] = "Valid";
|
|
9
|
-
})(Tbc20Status || (exports.Tbc20Status = Tbc20Status = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tbc20Status = void 0;
|
|
4
|
+
var Tbc20Status;
|
|
5
|
+
(function (Tbc20Status) {
|
|
6
|
+
Tbc20Status[Tbc20Status["Invalid"] = -1] = "Invalid";
|
|
7
|
+
Tbc20Status[Tbc20Status["Pending"] = 0] = "Pending";
|
|
8
|
+
Tbc20Status[Tbc20Status["Valid"] = 1] = "Valid";
|
|
9
|
+
})(Tbc20Status || (exports.Tbc20Status = Tbc20Status = {}));
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "turing-wallet-provider",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsc"
|
|
11
|
-
},
|
|
12
|
-
"peerDependencies": {
|
|
13
|
-
"react": ">=17.0.0",
|
|
14
|
-
"react-dom": ">=17.0.0"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"typescript": "^4.5.0",
|
|
18
|
-
"@types/react": "^17.0.0",
|
|
19
|
-
"@types/react-dom": "^17.0.0"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"wallet",
|
|
23
|
-
"tbc",
|
|
24
|
-
"turing wallet"
|
|
25
|
-
],
|
|
26
|
-
"description": "A provider help to connect Turing Wallet."
|
|
1
|
+
{
|
|
2
|
+
"name": "turing-wallet-provider",
|
|
3
|
+
"version": "1.2.9",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"react": ">=17.0.0",
|
|
14
|
+
"react-dom": ">=17.0.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "^4.5.0",
|
|
18
|
+
"@types/react": "^17.0.0",
|
|
19
|
+
"@types/react-dom": "^17.0.0"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"wallet",
|
|
23
|
+
"tbc",
|
|
24
|
+
"turing wallet"
|
|
25
|
+
],
|
|
26
|
+
"description": "A provider help to connect Turing Wallet."
|
|
27
27
|
}
|