turing-wallet-provider 1.3.12 → 1.4.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 CHANGED
@@ -52,7 +52,7 @@ const { tbcAddress } = await wallet.getAddress(); //tbcAddress为string类型
52
52
  ```ts
53
53
  const wallet = useTuringWallet();
54
54
  const {name,platform,version} = await wallet.getInfo();
55
- {Turing,android,1.0.0}示例的返回值
55
+ {Turing,android,1.0.0}//示例的返回值
56
56
  ```
57
57
 
58
58
  ## signMessage
@@ -213,6 +213,7 @@ interface RequestParam = {
213
213
  domain?:string; // 设置构建及广播交易使用的节点和api服务 只支持https 不提供默认值是api.turingbitchain.io
214
214
  isLockTime?: boolean;//是否具备锁仓功能
215
215
  lockTime?: number;//锁仓至lockTime区块高度
216
+ broadcastEnabled?:boolean;//决定是否通过钱包进行广播,默认为true,选择false则钱包返回txraw而不是txid
216
217
  };
217
218
 
218
219
  const params = [param:RequestParam] //目前参数里只能放一个对象,有批量发送需求再扩展
@@ -226,10 +227,13 @@ const params = [
226
227
  flag: "P2PKH",
227
228
  satoshis: 1000,
228
229
  address: "",
230
+ broadcastEnabled?:true,//默认为true
229
231
  domain?: "",
230
232
  },
231
233
  ];
232
- const { txid } = await wallet.sendTransaction(params);
234
+ const { txid } = await wallet.sendTransaction(params);//broadcastEnabled为true
235
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
236
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
233
237
  ```
234
238
 
235
239
  ### COLLECTION_CREATE
@@ -239,10 +243,13 @@ const params = [
239
243
  {
240
244
  flag: "COLLECTION_CREATE",
241
245
  collection_data: "",
246
+ broadcastEnabled?:true,//默认为true
242
247
  domain?: "",
243
248
  },
244
249
  ];
245
250
  const { txid } = await wallet.sendTransaction(params);
251
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
252
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
246
253
  ```
247
254
 
248
255
  ### NFT_CREATE
@@ -253,10 +260,13 @@ const params = [
253
260
  flag: "NFT_CREATE",
254
261
  nft_data: "",
255
262
  collection_id: "",
263
+ broadcastEnabled?:true,
256
264
  domain?: "",
257
265
  },
258
266
  ];
259
267
  const { txid } = await wallet.sendTransaction(params);
268
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
269
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
260
270
  ```
261
271
 
262
272
  ### NFT_TRANSFER
@@ -267,10 +277,13 @@ const params = [
267
277
  flag: "NFT_TRANSFER",
268
278
  nft_contract_address: "",
269
279
  address: "",
280
+ broadcastEnabled?:true,
270
281
  domain?: "",
271
282
  },
272
283
  ];
273
284
  const { txid } = await wallet.sendTransaction(params);
285
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
286
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
274
287
  ```
275
288
 
276
289
  ### FT_MINT
@@ -280,10 +293,13 @@ const params = [
280
293
  {
281
294
  flag: "FT_MINT",
282
295
  ft_data: "",
296
+ broadcastEnabled?:true,
283
297
  domain?: "",
284
298
  },
285
299
  ];
286
300
  const { txid } = await wallet.sendTransaction(params);
301
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
302
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
287
303
  ```
288
304
 
289
305
  ### FT_TRANSFER
@@ -294,12 +310,15 @@ const params = [
294
310
  flag: "FT_TRANSFER",
295
311
  ft_contract_address: "",
296
312
  ft_amount: 0.1,
297
- tbc_amount?: 1, //同时转ft和tbc时候可提供参数
298
313
  address: "",
314
+ tbc_amount?: 1, //同时转ft和tbc时候可提供参数
315
+ broadcastEnabled?:true,
299
316
  domain?: "",
300
317
  },
301
318
  ];
302
319
  const { txid } = await wallet.sendTransaction(params);
320
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
321
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
303
322
  ```
304
323
 
305
324
  ### POOLNFT_MINT
@@ -318,41 +337,54 @@ const params = [
318
337
  lpCostAmount?: 5, //设置添加流动性扣款TBC数量
319
338
  lpPlan?: 1, //默认值为1
320
339
  isLockTime?: false, //是否具备锁仓功能 默认为false
340
+ broadcastEnabled?:true,
321
341
  domain?: "",
322
342
  },
323
343
  ];
324
344
  const { txid } = await wallet.sendTransaction(params);
345
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
346
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
325
347
  ```
326
348
 
327
349
  ### POOLNFT_INIT
328
350
 
329
351
  ```ts
330
- const params = [{
331
- flag:"POOLNFT_INIT",
332
- nft_contract_address:"",
333
- address:"",
334
- tbc_amount:30,
335
- ft_amount:1000,
352
+ const params = [
353
+ {
354
+ flag: "POOLNFT_INIT",
355
+ nft_contract_address: "",
356
+ address: "",
357
+ tbc_amount: 30,
358
+ ft_amount: 1000,
336
359
  poolNFT_version?: 2,
337
- lockTime?: 900000,锁仓至指定区块高度
360
+ lockTime?: 900000, //锁仓至指定区块高度
361
+ broadcastEnabled?:true,
338
362
  domain?: "",
339
- }];
363
+ },
364
+ ];
340
365
  const { txid } = await wallet.sendTransaction(params);
366
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
367
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
341
368
  ```
342
369
 
343
370
  ### POOLNFT_LP_INCREASE
344
371
 
345
372
  ```ts
346
- const params = [{
347
- flag:"POOLNFT_LP_INCREASE",
348
- nft_contract_address:"",
349
- address:"",
350
- tbc_amount:3,
373
+ const params = [
374
+ {
375
+ flag: "POOLNFT_LP_INCREASE",
376
+ nft_contract_address: "",
377
+ address: "",
378
+ tbc_amount: 3,
351
379
  poolNFT_version?: 2,
352
- lockTime?: 900000,锁仓至指定区块高度
380
+ lockTime?: 900000, //锁仓至指定区块高度
381
+ broadcastEnabled?:true,
353
382
  domain?: "",
354
- }];
383
+ },
384
+ ];
355
385
  const { txid } = await wallet.sendTransaction(params);
386
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
387
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
356
388
  ```
357
389
 
358
390
  ### POOLNFT_LP_CONSUME
@@ -365,10 +397,14 @@ const params = [
365
397
  address: "",
366
398
  ft_amount: 100,
367
399
  poolNFT_version?: 2,
400
+ lockTime?: 900000, //用于手动设置解锁参数,设置为可解锁的最大高度。若不带此参数情况下若带有锁仓,会自动设置解锁参数为 (当前区块高度 - 2)
401
+ broadcastEnabled?:true,
368
402
  domain?: "",
369
403
  },
370
404
  ];
371
405
  const { txid } = await wallet.sendTransaction(params);
406
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
407
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
372
408
  ```
373
409
 
374
410
  ### POOLNFT_LP_BURN
@@ -378,11 +414,14 @@ const params = [
378
414
  {
379
415
  flag: "POOLNFT_LP_BURN",
380
416
  nft_contract_address: "",
381
- poolNFT_version?: 2,//默认为2.且仅支持版本2
417
+ poolNFT_version?: 2, //默认为2.且仅支持版本2
418
+ broadcastEnabled?:true,
382
419
  domain?: "",
383
420
  },
384
421
  ];
385
422
  const { txid } = await wallet.sendTransaction(params);
423
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
424
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
386
425
  ```
387
426
 
388
427
  ### POOLNFT_SWAP_TO_TOKEN
@@ -396,10 +435,13 @@ const params = [
396
435
  tbc_amount: 10,
397
436
  poolNFT_version?: 2,
398
437
  lpPlan?: 1, //默认值为1
438
+ broadcastEnabled?:true,
399
439
  domain?: "",
400
440
  },
401
441
  ];
402
442
  const { txid } = await wallet.sendTransaction(params);
443
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
444
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
403
445
  ```
404
446
 
405
447
  ### POOLNFT_SWAP_TO_TBC
@@ -412,9 +454,12 @@ const params = [{
412
454
  ft_amount:10,
413
455
  poolNFT_version?: 2,
414
456
  lpPlan?:1 //默认值为1,
457
+ broadcastEnabled?:true,
415
458
  domain?: "",
416
459
  }];
417
460
  const { txid } = await wallet.sendTransaction(params);
461
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
462
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
418
463
  ```
419
464
 
420
465
  ### POOLNFT_MERGE
@@ -426,10 +471,13 @@ const params = [
426
471
  nft_contract_address: "",
427
472
  poolNFT_version?: 2,
428
473
  merge_times?: 10, //1-10次 默认为10次 不足10次会提前终止
474
+ broadcastEnabled?:true,
429
475
  domain?: "",
430
476
  },
431
477
  ];
432
478
  const { txid } = await wallet.sendTransaction(params);
479
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
480
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
433
481
  ```
434
482
 
435
483
  ### FTLP_MERGE
@@ -440,8 +488,12 @@ const params = [
440
488
  flag: "FTLP_MERGE",
441
489
  nft_contract_address: "",
442
490
  poolNFT_version?: 2,
491
+ lockTime?: 900000, //用于手动设置解锁参数,设置为可解锁的最大高度。若不带此参数情况下若带有锁仓,会自动设置解锁参数为 (当前区块高度 - 2)
492
+ broadcastEnabled?:true,
443
493
  domain?: "",
444
494
  },
445
495
  ];
446
496
  const { txid } = await wallet.sendTransaction(params);
497
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
498
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
447
499
  ```
@@ -53,11 +53,13 @@ export type SendTransaction = {
53
53
  lpPlan?: number;
54
54
  domain?: string;
55
55
  isLockTime?: boolean;
56
- locktime?: number;
56
+ lockTime?: number;
57
+ broadcastEnabled?:boolean;
57
58
  };
58
59
 
59
60
  export type SendTransactionResponse = {
60
61
  txid?: string;
62
+ txraw?: string;
61
63
  error?: string;
62
64
  };
63
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turing-wallet-provider",
3
- "version": "1.3.12",
3
+ "version": "1.4.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [