@kaspacom/kcc20-tx-builder 0.6.2 → 0.6.3
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/cjs/engine.js +22 -22
- package/dist/cjs/engine.js.map +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +22 -22
- package/dist/engine.js.map +1 -1
- package/package.json +2 -2
- package/src/engine.ts +42 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaspacom/kcc20-tx-builder",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Runtime-independent KCC20 covenant transaction and PSKT construction primitives.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "KaspaCom",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/write-cjs-package.mjs",
|
|
88
88
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
89
|
-
"test": "npm run typecheck && npm run build && node test/smoke.mjs && node test/cjs-smoke.cjs && node test/snapshot-plan.mjs && node test/token-profiles.mjs && node test/profile-transfer.mjs && node --test test/mint-availability-limit.mjs test/consolidation-profile.mjs test/consolidation-transaction.mjs",
|
|
89
|
+
"test": "npm run typecheck && npm run build && node test/smoke.mjs && node test/cjs-smoke.cjs && node test/snapshot-plan.mjs && node test/token-profiles.mjs && node test/profile-transfer.mjs && node --test test/mint-availability-limit.mjs test/consolidation-profile.mjs test/consolidation-transaction.mjs && node test/pinned-funding.mjs",
|
|
90
90
|
"prepack": "npm test",
|
|
91
91
|
"test:examples": "npm run verify:compatibility && node scripts/test-examples.mjs --browser",
|
|
92
92
|
"verify:compatibility": "node scripts/verify-compatibility.mjs",
|
package/src/engine.ts
CHANGED
|
@@ -703,6 +703,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
703
703
|
const fundingEntry = selectFundingEntry(
|
|
704
704
|
walletUtxos.entries,
|
|
705
705
|
priorityFee + 10_000n,
|
|
706
|
+
[],
|
|
707
|
+
request.params?.fundingOutpoint,
|
|
706
708
|
);
|
|
707
709
|
const fundingInputIndex = 1;
|
|
708
710
|
const fundingChangeOutputIndex = 1;
|
|
@@ -1026,6 +1028,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
1026
1028
|
const fundingEntry = selectFundingEntry(
|
|
1027
1029
|
walletUtxos.entries,
|
|
1028
1030
|
requiredFunding,
|
|
1031
|
+
[],
|
|
1032
|
+
request.params?.fundingOutpoint,
|
|
1029
1033
|
);
|
|
1030
1034
|
const fundingInputIndex = 2;
|
|
1031
1035
|
const change =
|
|
@@ -1284,6 +1288,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
1284
1288
|
const fundingEntry = selectFundingEntry(
|
|
1285
1289
|
walletUtxos.entries,
|
|
1286
1290
|
priorityFee + 10_000n,
|
|
1291
|
+
[],
|
|
1292
|
+
request.params?.fundingOutpoint,
|
|
1287
1293
|
);
|
|
1288
1294
|
const fundingInputIndex = entries.length;
|
|
1289
1295
|
const fundingChangeOutputIndex = outputs.length;
|
|
@@ -1529,6 +1535,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
1529
1535
|
const fundingEntry = selectFundingEntry(
|
|
1530
1536
|
walletUtxos.entries,
|
|
1531
1537
|
priorityFee + 10_000n,
|
|
1538
|
+
[],
|
|
1539
|
+
request.params?.fundingOutpoint,
|
|
1532
1540
|
);
|
|
1533
1541
|
const fundingInputIndex = entries.length;
|
|
1534
1542
|
const fundingChangeOutputIndex = outputs.length;
|
|
@@ -2772,6 +2780,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
2772
2780
|
const fundingEntry = selectFundingEntry(
|
|
2773
2781
|
utxos.entries,
|
|
2774
2782
|
deploySompi * 2n + priorityFee + 10_000_000n,
|
|
2783
|
+
[],
|
|
2784
|
+
request.params?.fundingOutpoint,
|
|
2775
2785
|
);
|
|
2776
2786
|
const fundingChangeOutputIndex = 2;
|
|
2777
2787
|
const change =
|
|
@@ -3256,6 +3266,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
3256
3266
|
const fundingEntry = selectFundingEntry(
|
|
3257
3267
|
walletUtxos.entries,
|
|
3258
3268
|
requiredFunding,
|
|
3269
|
+
[],
|
|
3270
|
+
request.params?.fundingOutpoint,
|
|
3259
3271
|
);
|
|
3260
3272
|
const fundingInputIndex = 2;
|
|
3261
3273
|
const change =
|
|
@@ -3707,6 +3719,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
3707
3719
|
const fundingEntry = selectFundingEntry(
|
|
3708
3720
|
walletUtxos.entries,
|
|
3709
3721
|
requiredFunding,
|
|
3722
|
+
[],
|
|
3723
|
+
request.params?.fundingOutpoint,
|
|
3710
3724
|
);
|
|
3711
3725
|
const fundingInputIndex = 3;
|
|
3712
3726
|
const change =
|
|
@@ -4099,6 +4113,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
4099
4113
|
const fundingEntry = selectFundingEntry(
|
|
4100
4114
|
walletUtxos.entries,
|
|
4101
4115
|
requiredFunding,
|
|
4116
|
+
[],
|
|
4117
|
+
request.params?.fundingOutpoint,
|
|
4102
4118
|
);
|
|
4103
4119
|
const fundingInputIndex = 1;
|
|
4104
4120
|
const change =
|
|
@@ -4513,6 +4529,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
4513
4529
|
const fundingEntry = selectFundingEntry(
|
|
4514
4530
|
walletUtxos.entries,
|
|
4515
4531
|
requiredFunding,
|
|
4532
|
+
[],
|
|
4533
|
+
request.params?.fundingOutpoint,
|
|
4516
4534
|
);
|
|
4517
4535
|
const ticketInputIndex = ticketEntry ? 1 : -1;
|
|
4518
4536
|
const fundingInputIndex = ticketEntry ? 2 : 1;
|
|
@@ -5055,6 +5073,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
5055
5073
|
const fundingEntry = selectFundingEntry(
|
|
5056
5074
|
walletUtxos.entries,
|
|
5057
5075
|
requiredFunding,
|
|
5076
|
+
[],
|
|
5077
|
+
request.params?.fundingOutpoint,
|
|
5058
5078
|
);
|
|
5059
5079
|
const ticketInputIndex = ticketEntry ? 2 : -1;
|
|
5060
5080
|
const fundingInputIndex = ticketEntry ? 3 : 2;
|
|
@@ -5601,6 +5621,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
5601
5621
|
const fundingEntry = selectFundingEntry(
|
|
5602
5622
|
walletUtxos.entries,
|
|
5603
5623
|
requiredFunding,
|
|
5624
|
+
[],
|
|
5625
|
+
request.params?.fundingOutpoint,
|
|
5604
5626
|
);
|
|
5605
5627
|
const fundingInputIndex =
|
|
5606
5628
|
resolvedLegs.length + (sharedTicketEntry ? 1 : 0);
|
|
@@ -6301,7 +6323,7 @@ export function createKcc20PsktBuilderEngine(
|
|
|
6301
6323
|
: priorityFee + 10_000n;
|
|
6302
6324
|
let fundingEntry;
|
|
6303
6325
|
try {
|
|
6304
|
-
fundingEntry = selectFundingEntry(walletUtxos.entries, requiredFunding);
|
|
6326
|
+
fundingEntry = selectFundingEntry(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
6305
6327
|
} catch (error) {
|
|
6306
6328
|
if (totalSellerFundedHolderTopUpSompi > 0n) {
|
|
6307
6329
|
throw kcc20PsktBuilderError(
|
|
@@ -7046,7 +7068,7 @@ export function createKcc20PsktBuilderEngine(
|
|
|
7046
7068
|
: priorityFee + 10_000n;
|
|
7047
7069
|
let fundingEntry;
|
|
7048
7070
|
try {
|
|
7049
|
-
fundingEntry = selectFundingEntry(walletUtxos.entries, requiredFunding);
|
|
7071
|
+
fundingEntry = selectFundingEntry(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
7050
7072
|
} catch (error) {
|
|
7051
7073
|
if (totalSellerFundedHolderTopUpSompi > 0n) {
|
|
7052
7074
|
throw kcc20PsktBuilderError(
|
|
@@ -7495,6 +7517,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
7495
7517
|
const fundingEntry = selectFundingEntry(
|
|
7496
7518
|
walletUtxos.entries,
|
|
7497
7519
|
requiredFunding,
|
|
7520
|
+
[],
|
|
7521
|
+
request.params?.fundingOutpoint,
|
|
7498
7522
|
);
|
|
7499
7523
|
const fundingInputIndex = entries.length;
|
|
7500
7524
|
const change = utxoAmountSompi(fundingEntry) - priorityFee;
|
|
@@ -8050,6 +8074,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
8050
8074
|
const fundingEntry = selectFundingEntry(
|
|
8051
8075
|
walletUtxos.entries,
|
|
8052
8076
|
requiredFunding,
|
|
8077
|
+
[],
|
|
8078
|
+
request.params?.fundingOutpoint,
|
|
8053
8079
|
);
|
|
8054
8080
|
const ticketInputIndex = ticketEntry ? 2 : -1;
|
|
8055
8081
|
const fundingInputIndex = ticketEntry ? 3 : 2;
|
|
@@ -8463,6 +8489,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
8463
8489
|
const fundingEntry = selectFundingEntry(
|
|
8464
8490
|
walletUtxos.entries,
|
|
8465
8491
|
requiredFunding,
|
|
8492
|
+
[],
|
|
8493
|
+
request.params?.fundingOutpoint,
|
|
8466
8494
|
);
|
|
8467
8495
|
const fundingInputIndex = 1;
|
|
8468
8496
|
const change =
|
|
@@ -8855,6 +8883,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
8855
8883
|
const fundingEntry = selectFundingEntry(
|
|
8856
8884
|
walletUtxos.entries,
|
|
8857
8885
|
requiredFunding,
|
|
8886
|
+
[],
|
|
8887
|
+
request.params?.fundingOutpoint,
|
|
8858
8888
|
);
|
|
8859
8889
|
const fundingInputIndex = 1;
|
|
8860
8890
|
const change =
|
|
@@ -9227,6 +9257,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
9227
9257
|
const fundingEntry = selectFundingEntry(
|
|
9228
9258
|
walletUtxos.entries,
|
|
9229
9259
|
priorityFee + 10_000n,
|
|
9260
|
+
[],
|
|
9261
|
+
request.params?.fundingOutpoint,
|
|
9230
9262
|
);
|
|
9231
9263
|
const fundingInputIndex = resolvedLanes.length;
|
|
9232
9264
|
const fundingChange = BigInt(fundingEntry.amount) - priorityFee;
|
|
@@ -9598,6 +9630,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
9598
9630
|
const fundingEntry = selectFundingEntry(
|
|
9599
9631
|
walletUtxos.entries,
|
|
9600
9632
|
requiredFunding,
|
|
9633
|
+
[],
|
|
9634
|
+
request.params?.fundingOutpoint,
|
|
9601
9635
|
);
|
|
9602
9636
|
const fundingInputIndex = entries.length;
|
|
9603
9637
|
const change = utxoAmountSompi(fundingEntry) - priorityFee;
|
|
@@ -9802,6 +9836,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
9802
9836
|
const fundingEntry = selectFundingEntry(
|
|
9803
9837
|
walletUtxos.entries,
|
|
9804
9838
|
requiredFunding,
|
|
9839
|
+
[],
|
|
9840
|
+
request.params?.fundingOutpoint,
|
|
9805
9841
|
);
|
|
9806
9842
|
const fundingInputIndex = 1;
|
|
9807
9843
|
const change = utxoAmountSompi(fundingEntry) - priorityFee;
|
|
@@ -10085,6 +10121,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
10085
10121
|
const fundingEntry = selectFundingEntry(
|
|
10086
10122
|
walletUtxos.entries,
|
|
10087
10123
|
requiredFunding,
|
|
10124
|
+
[],
|
|
10125
|
+
request.params?.fundingOutpoint,
|
|
10088
10126
|
);
|
|
10089
10127
|
const fundingInputIndex = 1;
|
|
10090
10128
|
const change =
|
|
@@ -10642,6 +10680,8 @@ export function createKcc20PsktBuilderEngine(
|
|
|
10642
10680
|
const fundingEntry = selectFundingEntry(
|
|
10643
10681
|
utxos.entries,
|
|
10644
10682
|
deploySompi + priorityFee + 10_000_000n,
|
|
10683
|
+
[],
|
|
10684
|
+
request.params?.fundingOutpoint,
|
|
10645
10685
|
);
|
|
10646
10686
|
const created = await createTransactions({
|
|
10647
10687
|
entries: [fundingEntry],
|