mainnet-js 2.7.34 → 3.0.0-next.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.
Files changed (195) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/{mainnet-2.7.34.js → mainnet-3.0.0-next.1.js} +728 -708
  3. package/dist/module/cache/MemoryCache.d.ts +0 -1
  4. package/dist/module/cache/MemoryCache.d.ts.map +1 -1
  5. package/dist/module/cache/MemoryCache.js +5 -7
  6. package/dist/module/cache/MemoryCache.js.map +1 -1
  7. package/dist/module/cache/index.d.ts +1 -0
  8. package/dist/module/cache/index.d.ts.map +1 -1
  9. package/dist/module/cache/index.js +1 -0
  10. package/dist/module/cache/index.js.map +1 -1
  11. package/dist/module/cache/walletCache.d.ts +45 -0
  12. package/dist/module/cache/walletCache.d.ts.map +1 -0
  13. package/dist/module/cache/walletCache.js +140 -0
  14. package/dist/module/cache/walletCache.js.map +1 -0
  15. package/dist/module/chain.d.ts +1 -1
  16. package/dist/module/chain.js +1 -1
  17. package/dist/module/chain.js.map +1 -1
  18. package/dist/module/constant.d.ts +1 -1
  19. package/dist/module/constant.d.ts.map +1 -1
  20. package/dist/module/constant.js +1 -1
  21. package/dist/module/constant.js.map +1 -1
  22. package/dist/module/enum.d.ts +1 -7
  23. package/dist/module/enum.d.ts.map +1 -1
  24. package/dist/module/enum.js +0 -6
  25. package/dist/module/enum.js.map +1 -1
  26. package/dist/module/history/{electrumTransformer.d.ts → getHistory.d.ts} +3 -3
  27. package/dist/module/history/getHistory.d.ts.map +1 -0
  28. package/dist/module/history/{electrumTransformer.js → getHistory.js} +17 -14
  29. package/dist/module/history/getHistory.js.map +1 -0
  30. package/dist/module/index.d.ts +3 -1
  31. package/dist/module/index.d.ts.map +1 -1
  32. package/dist/module/index.js +3 -1
  33. package/dist/module/index.js.map +1 -1
  34. package/dist/module/interface.d.ts +7 -2
  35. package/dist/module/interface.d.ts.map +1 -1
  36. package/dist/module/interface.js.map +1 -1
  37. package/dist/module/message/interface.d.ts +2 -2
  38. package/dist/module/message/interface.d.ts.map +1 -1
  39. package/dist/module/message/interface.js +0 -3
  40. package/dist/module/message/interface.js.map +1 -1
  41. package/dist/module/message/signed.d.ts +5 -5
  42. package/dist/module/message/signed.d.ts.map +1 -1
  43. package/dist/module/message/signed.js +8 -8
  44. package/dist/module/message/signed.js.map +1 -1
  45. package/dist/module/network/ElectrumNetworkProvider.d.ts +2 -2
  46. package/dist/module/network/ElectrumNetworkProvider.d.ts.map +1 -1
  47. package/dist/module/network/ElectrumNetworkProvider.js +3 -2
  48. package/dist/module/network/ElectrumNetworkProvider.js.map +1 -1
  49. package/dist/module/network/NetworkProvider.d.ts +2 -2
  50. package/dist/module/network/NetworkProvider.d.ts.map +1 -1
  51. package/dist/module/network/constant.js +4 -4
  52. package/dist/module/network/constant.js.map +1 -1
  53. package/dist/module/network/getRelayFeeCache.js +2 -2
  54. package/dist/module/network/getRelayFeeCache.js.map +1 -1
  55. package/dist/module/rate/ExchangeRate.d.ts +2 -1
  56. package/dist/module/rate/ExchangeRate.d.ts.map +1 -1
  57. package/dist/module/rate/ExchangeRate.js +4 -1
  58. package/dist/module/rate/ExchangeRate.js.map +1 -1
  59. package/dist/module/transaction/Wif.d.ts +25 -23
  60. package/dist/module/transaction/Wif.d.ts.map +1 -1
  61. package/dist/module/transaction/Wif.js +26 -25
  62. package/dist/module/transaction/Wif.js.map +1 -1
  63. package/dist/module/transaction/allocateFee.d.ts +3 -3
  64. package/dist/module/transaction/allocateFee.d.ts.map +1 -1
  65. package/dist/module/transaction/allocateFee.js +5 -6
  66. package/dist/module/transaction/allocateFee.js.map +1 -1
  67. package/dist/module/util/amountInSatoshi.d.ts +1 -1
  68. package/dist/module/util/amountInSatoshi.d.ts.map +1 -1
  69. package/dist/module/util/amountInSatoshi.js +3 -9
  70. package/dist/module/util/amountInSatoshi.js.map +1 -1
  71. package/dist/module/util/asSendRequestObject.d.ts.map +1 -1
  72. package/dist/module/util/asSendRequestObject.js +10 -7
  73. package/dist/module/util/asSendRequestObject.js.map +1 -1
  74. package/dist/module/util/checkUtxos.d.ts +2 -2
  75. package/dist/module/util/checkUtxos.d.ts.map +1 -1
  76. package/dist/module/util/checkUtxos.js +11 -12
  77. package/dist/module/util/checkUtxos.js.map +1 -1
  78. package/dist/module/util/convert.d.ts +3 -0
  79. package/dist/module/util/convert.d.ts.map +1 -1
  80. package/dist/module/util/convert.js +12 -0
  81. package/dist/module/util/convert.js.map +1 -1
  82. package/dist/module/util/deriveCashaddr.d.ts.map +1 -1
  83. package/dist/module/util/deriveCashaddr.js +6 -0
  84. package/dist/module/util/deriveCashaddr.js.map +1 -1
  85. package/dist/module/util/deriveNetwork.js +1 -1
  86. package/dist/module/util/deriveNetwork.js.map +1 -1
  87. package/dist/module/util/hd.d.ts +3 -0
  88. package/dist/module/util/hd.d.ts.map +1 -0
  89. package/dist/module/util/hd.js +11 -0
  90. package/dist/module/util/hd.js.map +1 -0
  91. package/dist/module/util/index.d.ts +3 -3
  92. package/dist/module/util/index.d.ts.map +1 -1
  93. package/dist/module/util/index.js +3 -3
  94. package/dist/module/util/index.js.map +1 -1
  95. package/dist/module/util/satoshiToAmount.d.ts +1 -1
  96. package/dist/module/util/satoshiToAmount.d.ts.map +1 -1
  97. package/dist/module/util/satoshiToAmount.js +3 -9
  98. package/dist/module/util/satoshiToAmount.js.map +1 -1
  99. package/dist/module/util/sumSendRequestAmounts.d.ts.map +1 -1
  100. package/dist/module/util/sumSendRequestAmounts.js +3 -4
  101. package/dist/module/util/sumSendRequestAmounts.js.map +1 -1
  102. package/dist/module/util/sumUtxoValue.d.ts +3 -3
  103. package/dist/module/util/sumUtxoValue.d.ts.map +1 -1
  104. package/dist/module/util/sumUtxoValue.js +2 -2
  105. package/dist/module/util/sumUtxoValue.js.map +1 -1
  106. package/dist/module/wallet/Base.d.ts +45 -103
  107. package/dist/module/wallet/Base.d.ts.map +1 -1
  108. package/dist/module/wallet/Base.js +99 -298
  109. package/dist/module/wallet/Base.js.map +1 -1
  110. package/dist/module/wallet/HDWallet.d.ts +164 -0
  111. package/dist/module/wallet/HDWallet.d.ts.map +1 -0
  112. package/dist/module/wallet/HDWallet.js +486 -0
  113. package/dist/module/wallet/HDWallet.js.map +1 -0
  114. package/dist/module/wallet/Util.js +1 -1
  115. package/dist/module/wallet/Util.js.map +1 -1
  116. package/dist/module/wallet/Watch.d.ts +151 -0
  117. package/dist/module/wallet/Watch.d.ts.map +1 -0
  118. package/dist/module/wallet/Watch.js +307 -0
  119. package/dist/module/wallet/Watch.js.map +1 -0
  120. package/dist/module/wallet/Wif.d.ts +23 -29
  121. package/dist/module/wallet/Wif.d.ts.map +1 -1
  122. package/dist/module/wallet/Wif.js +204 -267
  123. package/dist/module/wallet/Wif.js.map +1 -1
  124. package/dist/module/wallet/createWallet.d.ts +7 -1
  125. package/dist/module/wallet/createWallet.d.ts.map +1 -1
  126. package/dist/module/wallet/createWallet.js +26 -17
  127. package/dist/module/wallet/createWallet.js.map +1 -1
  128. package/dist/module/wallet/interface.d.ts +5 -6
  129. package/dist/module/wallet/interface.d.ts.map +1 -1
  130. package/dist/module/wallet/model.d.ts +15 -19
  131. package/dist/module/wallet/model.d.ts.map +1 -1
  132. package/dist/module/wallet/model.js +5 -25
  133. package/dist/module/wallet/model.js.map +1 -1
  134. package/dist/tsconfig.tsbuildinfo +1 -1
  135. package/package.json +1 -1
  136. package/src/cache/MemoryCache.ts +5 -5
  137. package/src/cache/index.ts +1 -0
  138. package/src/cache/walletCache.ts +239 -0
  139. package/src/chain.ts +1 -1
  140. package/src/constant.ts +1 -1
  141. package/src/enum.ts +0 -6
  142. package/src/history/{electrumTransformer.test.ts → getHistory.test.ts} +26 -53
  143. package/src/history/{electrumTransformer.ts → getHistory.ts} +31 -15
  144. package/src/index.ts +3 -1
  145. package/src/interface.ts +8 -2
  146. package/src/message/interface.ts +2 -28
  147. package/src/message/signed.test.ts +36 -48
  148. package/src/message/signed.ts +9 -12
  149. package/src/network/Connection.test.ts +3 -3
  150. package/src/network/ElectrumNetworkProvider.ts +5 -5
  151. package/src/network/NetworkProvider.ts +2 -2
  152. package/src/network/Rpc.test.ts +3 -4
  153. package/src/network/constant.ts +4 -4
  154. package/src/network/getRelayFeeCache.ts +2 -2
  155. package/src/rate/ExchangeRate.test.ts +2 -44
  156. package/src/rate/ExchangeRate.ts +5 -2
  157. package/src/transaction/Wif.ts +59 -52
  158. package/src/transaction/allocateFee.test.ts +110 -131
  159. package/src/transaction/allocateFee.ts +14 -15
  160. package/src/util/amountInSatoshi.test.ts +1 -9
  161. package/src/util/amountInSatoshi.ts +6 -10
  162. package/src/util/asSendRequestObject.ts +12 -7
  163. package/src/util/checkUtxos.ts +21 -26
  164. package/src/util/convert.ts +18 -0
  165. package/src/util/deriveCashaddr.ts +8 -0
  166. package/src/util/deriveNetwork.ts +1 -1
  167. package/src/util/derivePublicKeyHash.test.ts +0 -13
  168. package/src/util/hd.ts +16 -0
  169. package/src/util/index.ts +3 -7
  170. package/src/util/satoshiToAmount.test.ts +1 -1
  171. package/src/util/satoshiToAmount.ts +4 -10
  172. package/src/util/sumSendRequestAmounts.ts +3 -4
  173. package/src/util/sumUtxoValue.ts +7 -7
  174. package/src/wallet/Base.ts +147 -420
  175. package/src/wallet/Cashtokens.test.headless.js +11 -11
  176. package/src/wallet/Cashtokens.test.ts +36 -37
  177. package/src/wallet/HDWallet.test.ts +515 -0
  178. package/src/wallet/HDWallet.ts +764 -0
  179. package/src/wallet/Util.ts +1 -1
  180. package/src/wallet/Watch.ts +447 -0
  181. package/src/wallet/Wif.bip39.test.ts +1 -1
  182. package/src/wallet/Wif.test.ts +108 -133
  183. package/src/wallet/Wif.ts +258 -283
  184. package/src/wallet/createWallet.ts +28 -18
  185. package/src/wallet/interface.ts +5 -6
  186. package/src/wallet/model.test.ts +4 -7
  187. package/src/wallet/model.ts +19 -51
  188. package/dist/module/history/electrumTransformer.d.ts.map +0 -1
  189. package/dist/module/history/electrumTransformer.js.map +0 -1
  190. package/dist/module/util/balanceObjectFromSatoshi.d.ts +0 -8
  191. package/dist/module/util/balanceObjectFromSatoshi.d.ts.map +0 -1
  192. package/dist/module/util/balanceObjectFromSatoshi.js +0 -35
  193. package/dist/module/util/balanceObjectFromSatoshi.js.map +0 -1
  194. package/src/util/balanceObjectFromSatoshi.test.ts +0 -58
  195. package/src/util/balanceObjectFromSatoshi.ts +0 -52
@@ -389,7 +389,7 @@ describe(`Wallet should function in the browser`, () => {
389
389
  const bob = await RegTestWallet.newRandom();
390
390
  const genesisResponse = await alice.tokenGenesis({
391
391
  amount: 100,
392
- value: 7000,
392
+ value: 7000n,
393
393
  cashaddr: bob.cashaddr,
394
394
  });
395
395
 
@@ -398,7 +398,7 @@ describe(`Wallet should function in the browser`, () => {
398
398
  expect(tokenBalance).toBe(100n);
399
399
  const tokenUtxos = await bob.getTokenUtxos(tokenId);
400
400
  expect(tokenUtxos.length).toBe(1);
401
- expect(tokenUtxos[0].satoshis).toBe(7000);
401
+ expect(tokenUtxos[0].satoshis).toBe(7000n);
402
402
 
403
403
  // lower the token satoshi value
404
404
  const response = await bob.send([
@@ -406,7 +406,7 @@ describe(`Wallet should function in the browser`, () => {
406
406
  cashaddr: bob.cashaddr,
407
407
  amount: 100,
408
408
  tokenId: tokenId,
409
- value: 1500,
409
+ value: 1500n,
410
410
  }),
411
411
  ]);
412
412
  let newTokenUtxos = await bob.getTokenUtxos(tokenId);
@@ -415,8 +415,8 @@ describe(`Wallet should function in the browser`, () => {
415
415
 
416
416
  let bobUtxos = await bob.getAddressUtxos(bob.cashaddr);
417
417
  expect(bobUtxos.length).toBe(2);
418
- expect(bobUtxos[0].satoshis).toBe(1500);
419
- expect(bobUtxos[1].satoshis).toBe(5245);
418
+ expect(bobUtxos[0].satoshis).toBe(1500n);
419
+ expect(bobUtxos[1].satoshis).toBe(5245n);
420
420
 
421
421
  // raise the token satoshi value
422
422
  await bob.send([
@@ -424,7 +424,7 @@ describe(`Wallet should function in the browser`, () => {
424
424
  cashaddr: bob.cashaddr,
425
425
  amount: 100,
426
426
  tokenId: tokenId,
427
- value: 3000,
427
+ value: 3000n,
428
428
  }),
429
429
  ]);
430
430
  newTokenUtxos = await bob.getTokenUtxos(tokenId);
@@ -433,8 +433,8 @@ describe(`Wallet should function in the browser`, () => {
433
433
 
434
434
  bobUtxos = await bob.getAddressUtxos(bob.cashaddr);
435
435
  expect(bobUtxos.length).toBe(2);
436
- expect(bobUtxos[0].satoshis).toBe(3000);
437
- expect(bobUtxos[1].satoshis).toBe(3349);
436
+ expect(bobUtxos[0].satoshis).toBe(3000n);
437
+ expect(bobUtxos[1].satoshis).toBe(3349n);
438
438
  }, process.env.ALICE_ID);
439
439
  });
440
440
 
@@ -445,7 +445,7 @@ describe(`Wallet should function in the browser`, () => {
445
445
 
446
446
  const genesisResponse = await alice.tokenGenesis({
447
447
  amount: 100,
448
- value: 5000,
448
+ value: 5000n,
449
449
  capability: NFTCapability.minting,
450
450
  commitment: "test",
451
451
  cashaddr: alice.cashaddr,
@@ -456,7 +456,7 @@ describe(`Wallet should function in the browser`, () => {
456
456
  expect(tokenBalance).toBe(100n);
457
457
  const tokenUtxos = await alice.getTokenUtxos(tokenId);
458
458
  expect(tokenUtxos.length).toBe(1);
459
- expect(tokenUtxos[0].satoshis).toBe(5000);
459
+ expect(tokenUtxos[0].satoshis).toBe(5000n);
460
460
 
461
461
  let seenBalance = 0;
462
462
  setTimeout(
@@ -466,7 +466,7 @@ describe(`Wallet should function in the browser`, () => {
466
466
  cashaddr: bob.cashaddr,
467
467
  amount: 100,
468
468
  tokenId: tokenId,
469
- value: 1500,
469
+ value: 1500n,
470
470
  capability: NFTCapability.minting,
471
471
  commitment: "test",
472
472
  }),
@@ -14,7 +14,7 @@ import {
14
14
  hexToBin,
15
15
  utf8ToBin,
16
16
  } from "@bitauth/libauth";
17
- import { delay } from "../util";
17
+ import { convert, delay } from "../util";
18
18
  import { Config } from "../config";
19
19
  import json from "../test/json.test";
20
20
 
@@ -37,14 +37,16 @@ describe(`Test cashtokens`, () => {
37
37
  test("Test token genesis and max amount to send", async () => {
38
38
  const alice = await RegTestWallet.fromId(process.env.ALICE_ID!);
39
39
  const bob = await RegTestWallet.newRandom();
40
- await alice.send([[bob.cashaddr!, 0.101, "bch"]]);
40
+ await alice.send([
41
+ [bob.cashaddr!, BigInt(await convert(0.101, "bch", "sat"))],
42
+ ]);
41
43
  const genesisResponse = await bob.tokenGenesis({
42
44
  amount: 100n,
43
45
  });
44
46
 
45
47
  const maxAmountToSend = await bob.getMaxAmountToSend();
46
- await bob.send([[alice.cashaddr!, maxAmountToSend.sat!, "sat"]]);
47
- expect(await bob.getBalance("sat")).toBe(0);
48
+ await bob.send([[alice.cashaddr!, maxAmountToSend]]);
49
+ expect(await bob.getBalance()).toBe(0n);
48
50
  });
49
51
 
50
52
  test("Test tokens will not be burned when sending bch value", async () => {
@@ -62,8 +64,7 @@ describe(`Test cashtokens`, () => {
62
64
  await alice.send([
63
65
  new SendRequest({
64
66
  cashaddr: bob.cashaddr!,
65
- value: 5000,
66
- unit: "sat",
67
+ value: 5000n,
67
68
  }),
68
69
  new TokenSendRequest({
69
70
  cashaddr: bob.cashaddr!,
@@ -72,21 +73,20 @@ describe(`Test cashtokens`, () => {
72
73
  }),
73
74
  ]);
74
75
  expect(await bob.getTokenBalance(tokenId)).toBe(25n);
75
- expect(await bob.getBalance("sat")).toBe(5000);
76
+ expect(await bob.getBalance()).toBe(5000n);
76
77
 
77
78
  await bob.send(
78
79
  new SendRequest({
79
80
  cashaddr: alice.cashaddr!,
80
- value: 1000,
81
- unit: "sat",
81
+ value: 1000n,
82
82
  })
83
83
  );
84
84
  expect(await bob.getTokenBalance(tokenId)).toBe(25n);
85
- expect(await bob.getBalance("sat")).toBe(3780);
85
+ expect(await bob.getBalance()).toBe(3780n);
86
86
 
87
87
  await bob.sendMax(alice.cashaddr!);
88
88
  expect(await bob.getTokenBalance(tokenId)).toBe(25n);
89
- expect(await bob.getBalance("sat")).toBe(0);
89
+ expect(await bob.getBalance()).toBe(0n);
90
90
  });
91
91
 
92
92
  test("Test fungible cashtoken genesis and sending", async () => {
@@ -114,8 +114,7 @@ describe(`Test cashtokens`, () => {
114
114
  }),
115
115
  new SendRequest({
116
116
  cashaddr: bob.cashaddr!,
117
- value: 20000,
118
- unit: "sat",
117
+ value: 20000n,
119
118
  }),
120
119
  ]);
121
120
  const newTokenUtxos = await alice.getTokenUtxos(tokenId);
@@ -536,7 +535,7 @@ describe(`Test cashtokens`, () => {
536
535
  const bob = await RegTestWallet.newRandom();
537
536
  const genesisResponse = await alice.tokenGenesis({
538
537
  amount: 100n,
539
- value: 7000,
538
+ value: 7000n,
540
539
  cashaddr: bob.cashaddr!,
541
540
  });
542
541
 
@@ -545,7 +544,7 @@ describe(`Test cashtokens`, () => {
545
544
  expect(tokenBalance).toBe(100n);
546
545
  const tokenUtxos = await bob.getTokenUtxos(tokenId);
547
546
  expect(tokenUtxos.length).toBe(1);
548
- expect(tokenUtxos[0].satoshis).toBe(7000);
547
+ expect(tokenUtxos[0].satoshis).toBe(7000n);
549
548
 
550
549
  // lower the token satoshi value
551
550
  const response = await bob.send([
@@ -553,7 +552,7 @@ describe(`Test cashtokens`, () => {
553
552
  cashaddr: bob.cashaddr!,
554
553
  amount: 100n,
555
554
  tokenId: tokenId,
556
- value: 1500,
555
+ value: 1500n,
557
556
  }),
558
557
  ]);
559
558
  let newTokenUtxos = await bob.getTokenUtxos(tokenId);
@@ -562,8 +561,8 @@ describe(`Test cashtokens`, () => {
562
561
 
563
562
  let bobUtxos = await bob.getAddressUtxos(bob.cashaddr!);
564
563
  expect(bobUtxos.length).toBe(2);
565
- expect(bobUtxos[0].satoshis).toBe(1500);
566
- expect(bobUtxos[1].satoshis).toBe(5245);
564
+ expect(bobUtxos[0].satoshis).toBe(1500n);
565
+ expect(bobUtxos[1].satoshis).toBe(5245n);
567
566
 
568
567
  // raise the token satoshi value
569
568
  await bob.send([
@@ -571,7 +570,7 @@ describe(`Test cashtokens`, () => {
571
570
  cashaddr: bob.cashaddr!,
572
571
  amount: 100n,
573
572
  tokenId: tokenId,
574
- value: 3000,
573
+ value: 3000n,
575
574
  }),
576
575
  ]);
577
576
  newTokenUtxos = await bob.getTokenUtxos(tokenId);
@@ -580,8 +579,8 @@ describe(`Test cashtokens`, () => {
580
579
 
581
580
  bobUtxos = await bob.getAddressUtxos(bob.cashaddr!);
582
581
  expect(bobUtxos.length).toBe(2);
583
- expect(bobUtxos[0].satoshis).toBe(3000);
584
- expect(bobUtxos[1].satoshis).toBe(3349);
582
+ expect(bobUtxos[0].satoshis).toBe(3000n);
583
+ expect(bobUtxos[1].satoshis).toBe(3349n);
585
584
  });
586
585
 
587
586
  test("Test cashtoken waiting and watching", async () => {
@@ -590,7 +589,7 @@ describe(`Test cashtokens`, () => {
590
589
 
591
590
  const genesisResponse = await alice.tokenGenesis({
592
591
  amount: 100n,
593
- value: 5000,
592
+ value: 5000n,
594
593
  capability: NFTCapability.minting,
595
594
  commitment: "test",
596
595
  cashaddr: alice.cashaddr!,
@@ -601,7 +600,7 @@ describe(`Test cashtokens`, () => {
601
600
  expect(tokenBalance).toBe(100n);
602
601
  const tokenUtxos = await alice.getTokenUtxos(tokenId);
603
602
  expect(tokenUtxos.length).toBe(1);
604
- expect(tokenUtxos[0].satoshis).toBe(5000);
603
+ expect(tokenUtxos[0].satoshis).toBe(5000n);
605
604
 
606
605
  let seenBalance = 0n;
607
606
  let sendResponse: SendResponse = {};
@@ -612,7 +611,7 @@ describe(`Test cashtokens`, () => {
612
611
  cashaddr: bob.cashaddr!,
613
612
  amount: 100n,
614
613
  tokenId: tokenId,
615
- value: 1500,
614
+ value: 1500n,
616
615
  capability: NFTCapability.minting,
617
616
  commitment: "test",
618
617
  }),
@@ -644,8 +643,8 @@ describe(`Test cashtokens`, () => {
644
643
  const bob = await RegTestWallet.newRandom();
645
644
 
646
645
  // prepare inputs for two token geneses
647
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
648
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
646
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
647
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
649
648
 
650
649
  const genesisResponse = await bob.tokenGenesis({
651
650
  amount: 100n,
@@ -676,8 +675,8 @@ describe(`Test cashtokens`, () => {
676
675
  const bob = await RegTestWallet.newRandom();
677
676
 
678
677
  // prepare inputs for two token geneses
679
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
680
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
678
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
679
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
681
680
 
682
681
  const genesisResponse = await bob.tokenGenesis({
683
682
  amount: 100n,
@@ -719,7 +718,7 @@ describe(`Test cashtokens`, () => {
719
718
  const bob = await RegTestWallet.newRandom();
720
719
 
721
720
  // prepare inputs for two token geneses
722
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
721
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
723
722
 
724
723
  const genesisResponse = await bob.tokenGenesis({
725
724
  amount: 100n,
@@ -732,7 +731,7 @@ describe(`Test cashtokens`, () => {
732
731
  const tokenUtxos = await bob.getTokenUtxos(tokenId);
733
732
  expect(tokenUtxos.length).toBe(1);
734
733
 
735
- await bob.send({ cashaddr: alice.cashaddr!, value: 1000, unit: "sat" });
734
+ await bob.send({ cashaddr: alice.cashaddr!, value: 1000n });
736
735
 
737
736
  const tokenBalance2 = await bob.getTokenBalance(tokenId);
738
737
  expect(tokenBalance2).toBe(100n);
@@ -746,8 +745,8 @@ describe(`Test cashtokens`, () => {
746
745
  const charlie = await RegTestWallet.newRandom();
747
746
  // prepare inputs for two token geneses
748
747
  await alice.send([
749
- { cashaddr: bob.cashaddr!, value: 10000, unit: "sat" },
750
- { cashaddr: charlie.cashaddr!, value: 10000, unit: "sat" },
748
+ { cashaddr: bob.cashaddr!, value: 10000n },
749
+ { cashaddr: charlie.cashaddr!, value: 10000n },
751
750
  ]);
752
751
 
753
752
  const genesisResponse = await bob.tokenGenesis({
@@ -761,7 +760,7 @@ describe(`Test cashtokens`, () => {
761
760
  const tokenUtxos = await bob.getTokenUtxos(tokenId);
762
761
  expect(tokenUtxos.length).toBe(1);
763
762
 
764
- await bob.send({ cashaddr: alice.cashaddr!, value: 1000, unit: "sat" });
763
+ await bob.send({ cashaddr: alice.cashaddr!, value: 1000n });
765
764
 
766
765
  await bob.send([
767
766
  {
@@ -826,7 +825,7 @@ describe(`Test cashtokens`, () => {
826
825
  const charlie = await RegTestWallet.newRandom();
827
826
 
828
827
  // prepare inputs for two token geneses
829
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
828
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
830
829
 
831
830
  const genesisResponse = await bob.tokenGenesis({
832
831
  capability: "minting",
@@ -871,7 +870,7 @@ describe(`Test cashtokens`, () => {
871
870
  const charlie = await RegTestWallet.newRandom();
872
871
 
873
872
  // prepare inputs for two token geneses
874
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
873
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
875
874
 
876
875
  const genesisResponse = await bob.tokenGenesis({
877
876
  capability: "minting",
@@ -951,7 +950,7 @@ describe(`Test cashtokens`, () => {
951
950
  const charlie = await RegTestWallet.newRandom();
952
951
 
953
952
  // prepare inputs for two token geneses
954
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
953
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
955
954
 
956
955
  const genesisResponse = await bob.tokenGenesis({
957
956
  capability: "minting",
@@ -1014,7 +1013,7 @@ describe(`Test cashtokens`, () => {
1014
1013
  const alice = await RegTestWallet.fromId(process.env.ALICE_ID!);
1015
1014
  const bob = await RegTestWallet.newRandom();
1016
1015
 
1017
- await alice.send({ cashaddr: bob.cashaddr!, value: 10000, unit: "sat" });
1016
+ await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
1018
1017
 
1019
1018
  const genesisResponse = await bob.tokenGenesis({
1020
1019
  capability: "none",