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.
- package/dist/index.html +1 -1
- package/dist/{mainnet-2.7.34.js → mainnet-3.0.0-next.1.js} +728 -708
- package/dist/module/cache/MemoryCache.d.ts +0 -1
- package/dist/module/cache/MemoryCache.d.ts.map +1 -1
- package/dist/module/cache/MemoryCache.js +5 -7
- package/dist/module/cache/MemoryCache.js.map +1 -1
- package/dist/module/cache/index.d.ts +1 -0
- package/dist/module/cache/index.d.ts.map +1 -1
- package/dist/module/cache/index.js +1 -0
- package/dist/module/cache/index.js.map +1 -1
- package/dist/module/cache/walletCache.d.ts +45 -0
- package/dist/module/cache/walletCache.d.ts.map +1 -0
- package/dist/module/cache/walletCache.js +140 -0
- package/dist/module/cache/walletCache.js.map +1 -0
- package/dist/module/chain.d.ts +1 -1
- package/dist/module/chain.js +1 -1
- package/dist/module/chain.js.map +1 -1
- package/dist/module/constant.d.ts +1 -1
- package/dist/module/constant.d.ts.map +1 -1
- package/dist/module/constant.js +1 -1
- package/dist/module/constant.js.map +1 -1
- package/dist/module/enum.d.ts +1 -7
- package/dist/module/enum.d.ts.map +1 -1
- package/dist/module/enum.js +0 -6
- package/dist/module/enum.js.map +1 -1
- package/dist/module/history/{electrumTransformer.d.ts → getHistory.d.ts} +3 -3
- package/dist/module/history/getHistory.d.ts.map +1 -0
- package/dist/module/history/{electrumTransformer.js → getHistory.js} +17 -14
- package/dist/module/history/getHistory.js.map +1 -0
- package/dist/module/index.d.ts +3 -1
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +3 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/interface.d.ts +7 -2
- package/dist/module/interface.d.ts.map +1 -1
- package/dist/module/interface.js.map +1 -1
- package/dist/module/message/interface.d.ts +2 -2
- package/dist/module/message/interface.d.ts.map +1 -1
- package/dist/module/message/interface.js +0 -3
- package/dist/module/message/interface.js.map +1 -1
- package/dist/module/message/signed.d.ts +5 -5
- package/dist/module/message/signed.d.ts.map +1 -1
- package/dist/module/message/signed.js +8 -8
- package/dist/module/message/signed.js.map +1 -1
- package/dist/module/network/ElectrumNetworkProvider.d.ts +2 -2
- package/dist/module/network/ElectrumNetworkProvider.d.ts.map +1 -1
- package/dist/module/network/ElectrumNetworkProvider.js +3 -2
- package/dist/module/network/ElectrumNetworkProvider.js.map +1 -1
- package/dist/module/network/NetworkProvider.d.ts +2 -2
- package/dist/module/network/NetworkProvider.d.ts.map +1 -1
- package/dist/module/network/constant.js +4 -4
- package/dist/module/network/constant.js.map +1 -1
- package/dist/module/network/getRelayFeeCache.js +2 -2
- package/dist/module/network/getRelayFeeCache.js.map +1 -1
- package/dist/module/rate/ExchangeRate.d.ts +2 -1
- package/dist/module/rate/ExchangeRate.d.ts.map +1 -1
- package/dist/module/rate/ExchangeRate.js +4 -1
- package/dist/module/rate/ExchangeRate.js.map +1 -1
- package/dist/module/transaction/Wif.d.ts +25 -23
- package/dist/module/transaction/Wif.d.ts.map +1 -1
- package/dist/module/transaction/Wif.js +26 -25
- package/dist/module/transaction/Wif.js.map +1 -1
- package/dist/module/transaction/allocateFee.d.ts +3 -3
- package/dist/module/transaction/allocateFee.d.ts.map +1 -1
- package/dist/module/transaction/allocateFee.js +5 -6
- package/dist/module/transaction/allocateFee.js.map +1 -1
- package/dist/module/util/amountInSatoshi.d.ts +1 -1
- package/dist/module/util/amountInSatoshi.d.ts.map +1 -1
- package/dist/module/util/amountInSatoshi.js +3 -9
- package/dist/module/util/amountInSatoshi.js.map +1 -1
- package/dist/module/util/asSendRequestObject.d.ts.map +1 -1
- package/dist/module/util/asSendRequestObject.js +10 -7
- package/dist/module/util/asSendRequestObject.js.map +1 -1
- package/dist/module/util/checkUtxos.d.ts +2 -2
- package/dist/module/util/checkUtxos.d.ts.map +1 -1
- package/dist/module/util/checkUtxos.js +11 -12
- package/dist/module/util/checkUtxos.js.map +1 -1
- package/dist/module/util/convert.d.ts +3 -0
- package/dist/module/util/convert.d.ts.map +1 -1
- package/dist/module/util/convert.js +12 -0
- package/dist/module/util/convert.js.map +1 -1
- package/dist/module/util/deriveCashaddr.d.ts.map +1 -1
- package/dist/module/util/deriveCashaddr.js +6 -0
- package/dist/module/util/deriveCashaddr.js.map +1 -1
- package/dist/module/util/deriveNetwork.js +1 -1
- package/dist/module/util/deriveNetwork.js.map +1 -1
- package/dist/module/util/hd.d.ts +3 -0
- package/dist/module/util/hd.d.ts.map +1 -0
- package/dist/module/util/hd.js +11 -0
- package/dist/module/util/hd.js.map +1 -0
- package/dist/module/util/index.d.ts +3 -3
- package/dist/module/util/index.d.ts.map +1 -1
- package/dist/module/util/index.js +3 -3
- package/dist/module/util/index.js.map +1 -1
- package/dist/module/util/satoshiToAmount.d.ts +1 -1
- package/dist/module/util/satoshiToAmount.d.ts.map +1 -1
- package/dist/module/util/satoshiToAmount.js +3 -9
- package/dist/module/util/satoshiToAmount.js.map +1 -1
- package/dist/module/util/sumSendRequestAmounts.d.ts.map +1 -1
- package/dist/module/util/sumSendRequestAmounts.js +3 -4
- package/dist/module/util/sumSendRequestAmounts.js.map +1 -1
- package/dist/module/util/sumUtxoValue.d.ts +3 -3
- package/dist/module/util/sumUtxoValue.d.ts.map +1 -1
- package/dist/module/util/sumUtxoValue.js +2 -2
- package/dist/module/util/sumUtxoValue.js.map +1 -1
- package/dist/module/wallet/Base.d.ts +45 -103
- package/dist/module/wallet/Base.d.ts.map +1 -1
- package/dist/module/wallet/Base.js +99 -298
- package/dist/module/wallet/Base.js.map +1 -1
- package/dist/module/wallet/HDWallet.d.ts +164 -0
- package/dist/module/wallet/HDWallet.d.ts.map +1 -0
- package/dist/module/wallet/HDWallet.js +486 -0
- package/dist/module/wallet/HDWallet.js.map +1 -0
- package/dist/module/wallet/Util.js +1 -1
- package/dist/module/wallet/Util.js.map +1 -1
- package/dist/module/wallet/Watch.d.ts +151 -0
- package/dist/module/wallet/Watch.d.ts.map +1 -0
- package/dist/module/wallet/Watch.js +307 -0
- package/dist/module/wallet/Watch.js.map +1 -0
- package/dist/module/wallet/Wif.d.ts +23 -29
- package/dist/module/wallet/Wif.d.ts.map +1 -1
- package/dist/module/wallet/Wif.js +204 -267
- package/dist/module/wallet/Wif.js.map +1 -1
- package/dist/module/wallet/createWallet.d.ts +7 -1
- package/dist/module/wallet/createWallet.d.ts.map +1 -1
- package/dist/module/wallet/createWallet.js +26 -17
- package/dist/module/wallet/createWallet.js.map +1 -1
- package/dist/module/wallet/interface.d.ts +5 -6
- package/dist/module/wallet/interface.d.ts.map +1 -1
- package/dist/module/wallet/model.d.ts +15 -19
- package/dist/module/wallet/model.d.ts.map +1 -1
- package/dist/module/wallet/model.js +5 -25
- package/dist/module/wallet/model.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/cache/MemoryCache.ts +5 -5
- package/src/cache/index.ts +1 -0
- package/src/cache/walletCache.ts +239 -0
- package/src/chain.ts +1 -1
- package/src/constant.ts +1 -1
- package/src/enum.ts +0 -6
- package/src/history/{electrumTransformer.test.ts → getHistory.test.ts} +26 -53
- package/src/history/{electrumTransformer.ts → getHistory.ts} +31 -15
- package/src/index.ts +3 -1
- package/src/interface.ts +8 -2
- package/src/message/interface.ts +2 -28
- package/src/message/signed.test.ts +36 -48
- package/src/message/signed.ts +9 -12
- package/src/network/Connection.test.ts +3 -3
- package/src/network/ElectrumNetworkProvider.ts +5 -5
- package/src/network/NetworkProvider.ts +2 -2
- package/src/network/Rpc.test.ts +3 -4
- package/src/network/constant.ts +4 -4
- package/src/network/getRelayFeeCache.ts +2 -2
- package/src/rate/ExchangeRate.test.ts +2 -44
- package/src/rate/ExchangeRate.ts +5 -2
- package/src/transaction/Wif.ts +59 -52
- package/src/transaction/allocateFee.test.ts +110 -131
- package/src/transaction/allocateFee.ts +14 -15
- package/src/util/amountInSatoshi.test.ts +1 -9
- package/src/util/amountInSatoshi.ts +6 -10
- package/src/util/asSendRequestObject.ts +12 -7
- package/src/util/checkUtxos.ts +21 -26
- package/src/util/convert.ts +18 -0
- package/src/util/deriveCashaddr.ts +8 -0
- package/src/util/deriveNetwork.ts +1 -1
- package/src/util/derivePublicKeyHash.test.ts +0 -13
- package/src/util/hd.ts +16 -0
- package/src/util/index.ts +3 -7
- package/src/util/satoshiToAmount.test.ts +1 -1
- package/src/util/satoshiToAmount.ts +4 -10
- package/src/util/sumSendRequestAmounts.ts +3 -4
- package/src/util/sumUtxoValue.ts +7 -7
- package/src/wallet/Base.ts +147 -420
- package/src/wallet/Cashtokens.test.headless.js +11 -11
- package/src/wallet/Cashtokens.test.ts +36 -37
- package/src/wallet/HDWallet.test.ts +515 -0
- package/src/wallet/HDWallet.ts +764 -0
- package/src/wallet/Util.ts +1 -1
- package/src/wallet/Watch.ts +447 -0
- package/src/wallet/Wif.bip39.test.ts +1 -1
- package/src/wallet/Wif.test.ts +108 -133
- package/src/wallet/Wif.ts +258 -283
- package/src/wallet/createWallet.ts +28 -18
- package/src/wallet/interface.ts +5 -6
- package/src/wallet/model.test.ts +4 -7
- package/src/wallet/model.ts +19 -51
- package/dist/module/history/electrumTransformer.d.ts.map +0 -1
- package/dist/module/history/electrumTransformer.js.map +0 -1
- package/dist/module/util/balanceObjectFromSatoshi.d.ts +0 -8
- package/dist/module/util/balanceObjectFromSatoshi.d.ts.map +0 -1
- package/dist/module/util/balanceObjectFromSatoshi.js +0 -35
- package/dist/module/util/balanceObjectFromSatoshi.js.map +0 -1
- package/src/util/balanceObjectFromSatoshi.test.ts +0 -58
- 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:
|
|
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(
|
|
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:
|
|
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(
|
|
419
|
-
expect(bobUtxos[1].satoshis).toBe(
|
|
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:
|
|
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(
|
|
437
|
-
expect(bobUtxos[1].satoshis).toBe(
|
|
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:
|
|
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(
|
|
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:
|
|
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([
|
|
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
|
|
47
|
-
expect(await bob.getBalance(
|
|
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:
|
|
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(
|
|
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:
|
|
81
|
-
unit: "sat",
|
|
81
|
+
value: 1000n,
|
|
82
82
|
})
|
|
83
83
|
);
|
|
84
84
|
expect(await bob.getTokenBalance(tokenId)).toBe(25n);
|
|
85
|
-
expect(await bob.getBalance(
|
|
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(
|
|
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:
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
566
|
-
expect(bobUtxos[1].satoshis).toBe(
|
|
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:
|
|
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(
|
|
584
|
-
expect(bobUtxos[1].satoshis).toBe(
|
|
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:
|
|
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(
|
|
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:
|
|
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:
|
|
648
|
-
await alice.send({ cashaddr: bob.cashaddr!, value:
|
|
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:
|
|
680
|
-
await alice.send({ cashaddr: bob.cashaddr!, value:
|
|
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:
|
|
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:
|
|
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:
|
|
750
|
-
{ cashaddr: charlie.cashaddr!, value:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
1016
|
+
await alice.send({ cashaddr: bob.cashaddr!, value: 10000n });
|
|
1018
1017
|
|
|
1019
1018
|
const genesisResponse = await bob.tokenGenesis({
|
|
1020
1019
|
capability: "none",
|