turing-wallet-provider 1.3.12 → 1.4.1

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
@@ -294,12 +307,15 @@ const params = [
294
307
  flag: "FT_TRANSFER",
295
308
  ft_contract_address: "",
296
309
  ft_amount: 0.1,
297
- tbc_amount?: 1, //同时转ft和tbc时候可提供参数
298
310
  address: "",
311
+ tbc_amount?: 1, //同时转ft和tbc时候可提供参数
312
+ broadcastEnabled?:true,
299
313
  domain?: "",
300
314
  },
301
315
  ];
302
316
  const { txid } = await wallet.sendTransaction(params);
317
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
318
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
303
319
  ```
304
320
 
305
321
  ### POOLNFT_MINT
@@ -327,32 +343,42 @@ const { txid } = await wallet.sendTransaction(params);
327
343
  ### POOLNFT_INIT
328
344
 
329
345
  ```ts
330
- const params = [{
331
- flag:"POOLNFT_INIT",
332
- nft_contract_address:"",
333
- address:"",
334
- tbc_amount:30,
335
- ft_amount:1000,
346
+ const params = [
347
+ {
348
+ flag: "POOLNFT_INIT",
349
+ nft_contract_address: "",
350
+ address: "",
351
+ tbc_amount: 30,
352
+ ft_amount: 1000,
336
353
  poolNFT_version?: 2,
337
- lockTime?: 900000,锁仓至指定区块高度
354
+ lockTime?: 900000, //锁仓至指定区块高度
355
+ broadcastEnabled?:true,
338
356
  domain?: "",
339
- }];
357
+ },
358
+ ];
340
359
  const { txid } = await wallet.sendTransaction(params);
360
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
361
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
341
362
  ```
342
363
 
343
364
  ### POOLNFT_LP_INCREASE
344
365
 
345
366
  ```ts
346
- const params = [{
347
- flag:"POOLNFT_LP_INCREASE",
348
- nft_contract_address:"",
349
- address:"",
350
- tbc_amount:3,
367
+ const params = [
368
+ {
369
+ flag: "POOLNFT_LP_INCREASE",
370
+ nft_contract_address: "",
371
+ address: "",
372
+ tbc_amount: 3,
351
373
  poolNFT_version?: 2,
352
- lockTime?: 900000,锁仓至指定区块高度
374
+ lockTime?: 900000, //锁仓至指定区块高度
375
+ broadcastEnabled?:true,
353
376
  domain?: "",
354
- }];
377
+ },
378
+ ];
355
379
  const { txid } = await wallet.sendTransaction(params);
380
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
381
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
356
382
  ```
357
383
 
358
384
  ### POOLNFT_LP_CONSUME
@@ -365,10 +391,14 @@ const params = [
365
391
  address: "",
366
392
  ft_amount: 100,
367
393
  poolNFT_version?: 2,
394
+ lockTime?: 900000, //用于手动设置解锁参数,设置为可解锁的最大高度。若不带此参数情况下若带有锁仓,会自动设置解锁参数为 (当前区块高度 - 2)
395
+ broadcastEnabled?:true,
368
396
  domain?: "",
369
397
  },
370
398
  ];
371
399
  const { txid } = await wallet.sendTransaction(params);
400
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
401
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
372
402
  ```
373
403
 
374
404
  ### POOLNFT_LP_BURN
@@ -378,11 +408,14 @@ const params = [
378
408
  {
379
409
  flag: "POOLNFT_LP_BURN",
380
410
  nft_contract_address: "",
381
- poolNFT_version?: 2,//默认为2.且仅支持版本2
411
+ poolNFT_version?: 2, //默认为2.且仅支持版本2
412
+ broadcastEnabled?:true,
382
413
  domain?: "",
383
414
  },
384
415
  ];
385
416
  const { txid } = await wallet.sendTransaction(params);
417
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
418
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
386
419
  ```
387
420
 
388
421
  ### POOLNFT_SWAP_TO_TOKEN
@@ -396,10 +429,13 @@ const params = [
396
429
  tbc_amount: 10,
397
430
  poolNFT_version?: 2,
398
431
  lpPlan?: 1, //默认值为1
432
+ broadcastEnabled?:true,
399
433
  domain?: "",
400
434
  },
401
435
  ];
402
436
  const { txid } = await wallet.sendTransaction(params);
437
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
438
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
403
439
  ```
404
440
 
405
441
  ### POOLNFT_SWAP_TO_TBC
@@ -412,9 +448,12 @@ const params = [{
412
448
  ft_amount:10,
413
449
  poolNFT_version?: 2,
414
450
  lpPlan?:1 //默认值为1,
451
+ broadcastEnabled?:true,
415
452
  domain?: "",
416
453
  }];
417
454
  const { txid } = await wallet.sendTransaction(params);
455
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
456
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
418
457
  ```
419
458
 
420
459
  ### POOLNFT_MERGE
@@ -430,6 +469,8 @@ const params = [
430
469
  },
431
470
  ];
432
471
  const { txid } = await wallet.sendTransaction(params);
472
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
473
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
433
474
  ```
434
475
 
435
476
  ### FTLP_MERGE
@@ -440,8 +481,11 @@ const params = [
440
481
  flag: "FTLP_MERGE",
441
482
  nft_contract_address: "",
442
483
  poolNFT_version?: 2,
484
+ lockTime?: 900000, //用于手动设置解锁参数,设置为可解锁的最大高度。若不带此参数情况下若带有锁仓,会自动设置解锁参数为 (当前区块高度 - 2)
443
485
  domain?: "",
444
486
  },
445
487
  ];
446
488
  const { txid } = await wallet.sendTransaction(params);
489
+ //const { txraw } = await wallet.sendTransaction(params);broadcastEnabled为false
490
+ //const { error } = await wallet.sendTransaction(params);构建或广播交易时出现错误
447
491
  ```
@@ -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.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [