@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/dist/cjs/engine.js
CHANGED
|
@@ -427,7 +427,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
427
427
|
}
|
|
428
428
|
requireMatchingCovenantId(rootEntry, rootId, "active FeeTicket root UTXO");
|
|
429
429
|
const rootOutputIndex = 0;
|
|
430
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n);
|
|
430
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n, [], request.params?.fundingOutpoint);
|
|
431
431
|
const fundingInputIndex = 1;
|
|
432
432
|
const fundingChangeOutputIndex = 1;
|
|
433
433
|
const fundingChange = (0, sale_common_js_1.utxoAmountSompi)(fundingEntry) - priorityFee;
|
|
@@ -619,7 +619,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
619
619
|
utilityInputSompi +
|
|
620
620
|
10000n
|
|
621
621
|
: priorityFee + 10000n;
|
|
622
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
622
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
623
623
|
const fundingInputIndex = 2;
|
|
624
624
|
const change = rootInputSompi +
|
|
625
625
|
utilityInputSompi +
|
|
@@ -797,7 +797,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
797
797
|
return entry;
|
|
798
798
|
});
|
|
799
799
|
const outputs = entries.map((entry, index) => new TransactionOutput((0, sale_common_js_1.utxoAmountSompi)(entry), (0, sale_common_js_1.p2pkScriptPubKey)(kw, (0, sale_common_js_1.bytesToHex)(states[index].ownerIdentifier))));
|
|
800
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n);
|
|
800
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n, [], request.params?.fundingOutpoint);
|
|
801
801
|
const fundingInputIndex = entries.length;
|
|
802
802
|
const fundingChangeOutputIndex = outputs.length;
|
|
803
803
|
const fundingChange = (0, sale_common_js_1.utxoAmountSompi)(fundingEntry) - priorityFee;
|
|
@@ -947,7 +947,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
947
947
|
ownerIdentifier: (0, sale_common_js_1.hexToBytes)(recipientOwner),
|
|
948
948
|
}));
|
|
949
949
|
const outputs = entries.map((entry, index) => new TransactionOutput((0, sale_common_js_1.utxoAmountSompi)(entry), payToScriptHashScript((0, sale_common_js_1.buildKcc20FeeTicketScriptForState)(artifactInfos[index].artifact.script, recipientStates[index])), new CovenantBinding(index, new Hash(ticketId))));
|
|
950
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n);
|
|
950
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n, [], request.params?.fundingOutpoint);
|
|
951
951
|
const fundingInputIndex = entries.length;
|
|
952
952
|
const fundingChangeOutputIndex = outputs.length;
|
|
953
953
|
const fundingChange = (0, sale_common_js_1.utxoAmountSompi)(fundingEntry) - priorityFee;
|
|
@@ -1749,7 +1749,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
1749
1749
|
evidence.address)
|
|
1750
1750
|
throw new Error("token evidence script does not match RPC");
|
|
1751
1751
|
const utxos = await getUtxosByAddresses(rpc, [walletAddress]);
|
|
1752
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(utxos.entries, deploySompi * 2n + priorityFee + 10000000n);
|
|
1752
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(utxos.entries, deploySompi * 2n + priorityFee + 10000000n, [], request.params?.fundingOutpoint);
|
|
1753
1753
|
const fundingChangeOutputIndex = 2;
|
|
1754
1754
|
const change = (0, sale_common_js_1.utxoAmountSompi)(fundingEntry) - deploySompi * 2n - priorityFee;
|
|
1755
1755
|
if (change <= 10000n) {
|
|
@@ -2037,7 +2037,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
2037
2037
|
const requiredFunding = outputSompi + priorityFee > covenantInputSompi
|
|
2038
2038
|
? outputSompi + priorityFee - covenantInputSompi + 10000n
|
|
2039
2039
|
: priorityFee + 10000n;
|
|
2040
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
2040
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
2041
2041
|
const fundingInputIndex = 2;
|
|
2042
2042
|
const change = covenantInputSompi +
|
|
2043
2043
|
(0, sale_common_js_1.utxoAmountSompi)(fundingEntry) -
|
|
@@ -2332,7 +2332,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
2332
2332
|
const requiredFunding = outputSompi + priorityFee > covenantInputSompi
|
|
2333
2333
|
? outputSompi + priorityFee - covenantInputSompi + 10000n
|
|
2334
2334
|
: priorityFee + 10000n;
|
|
2335
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
2335
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
2336
2336
|
const fundingInputIndex = 3;
|
|
2337
2337
|
const change = covenantInputSompi +
|
|
2338
2338
|
(0, sale_common_js_1.utxoAmountSompi)(fundingEntry) -
|
|
@@ -2608,7 +2608,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
2608
2608
|
const requiredFunding = outputSompi + priorityFee > covenantInputSompi
|
|
2609
2609
|
? outputSompi + priorityFee - covenantInputSompi + 10000n
|
|
2610
2610
|
: priorityFee + 10000n;
|
|
2611
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
2611
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
2612
2612
|
const fundingInputIndex = 1;
|
|
2613
2613
|
const change = covenantInputSompi +
|
|
2614
2614
|
(0, sale_common_js_1.utxoAmountSompi)(fundingEntry) -
|
|
@@ -2890,7 +2890,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
2890
2890
|
const requiredFunding = outputSompi + priorityFee > covenantInputSompi
|
|
2891
2891
|
? outputSompi + priorityFee - covenantInputSompi + 10000n
|
|
2892
2892
|
: priorityFee + 10000n;
|
|
2893
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
2893
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
2894
2894
|
const ticketInputIndex = ticketEntry ? 1 : -1;
|
|
2895
2895
|
const fundingInputIndex = ticketEntry ? 2 : 1;
|
|
2896
2896
|
const change = covenantInputSompi +
|
|
@@ -3247,7 +3247,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
3247
3247
|
const requiredFunding = outputSompi + priorityFee > covenantInputSompi
|
|
3248
3248
|
? outputSompi + priorityFee - covenantInputSompi + 10000n
|
|
3249
3249
|
: priorityFee + 10000n;
|
|
3250
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
3250
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
3251
3251
|
const ticketInputIndex = ticketEntry ? 2 : -1;
|
|
3252
3252
|
const fundingInputIndex = ticketEntry ? 3 : 2;
|
|
3253
3253
|
const change = covenantInputSompi +
|
|
@@ -3628,7 +3628,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
3628
3628
|
covenantInputSompi +
|
|
3629
3629
|
MIN_FUNDING_CHANGE_SOMPI
|
|
3630
3630
|
: priorityFee + MIN_FUNDING_CHANGE_SOMPI;
|
|
3631
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
3631
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
3632
3632
|
const fundingInputIndex = resolvedLegs.length + (sharedTicketEntry ? 1 : 0);
|
|
3633
3633
|
const change = covenantInputSompi +
|
|
3634
3634
|
(0, sale_common_js_1.utxoAmountSompi)(fundingEntry) -
|
|
@@ -4082,7 +4082,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
4082
4082
|
: priorityFee + 10000n;
|
|
4083
4083
|
let fundingEntry;
|
|
4084
4084
|
try {
|
|
4085
|
-
fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
4085
|
+
fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
4086
4086
|
}
|
|
4087
4087
|
catch (error) {
|
|
4088
4088
|
if (totalSellerFundedHolderTopUpSompi > 0n) {
|
|
@@ -4568,7 +4568,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
4568
4568
|
: priorityFee + 10000n;
|
|
4569
4569
|
let fundingEntry;
|
|
4570
4570
|
try {
|
|
4571
|
-
fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
4571
|
+
fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
4572
4572
|
}
|
|
4573
4573
|
catch (error) {
|
|
4574
4574
|
if (totalSellerFundedHolderTopUpSompi > 0n) {
|
|
@@ -4891,7 +4891,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
4891
4891
|
new TransactionOutput(refundSompi, payToAddressScript(walletAddress)),
|
|
4892
4892
|
];
|
|
4893
4893
|
const requiredFunding = priorityFee + MIN_FUNDING_CHANGE_SOMPI;
|
|
4894
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
4894
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
4895
4895
|
const fundingInputIndex = entries.length;
|
|
4896
4896
|
const change = (0, sale_common_js_1.utxoAmountSompi)(fundingEntry) - priorityFee;
|
|
4897
4897
|
let fundingChangeOutputIndex = -1;
|
|
@@ -5267,7 +5267,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
5267
5267
|
const requiredFunding = outputSompi + transactionFeeReserve > covenantInputSompi
|
|
5268
5268
|
? outputSompi + transactionFeeReserve - covenantInputSompi + 10000n
|
|
5269
5269
|
: transactionFeeReserve + 10000n;
|
|
5270
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
5270
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
5271
5271
|
const ticketInputIndex = ticketEntry ? 2 : -1;
|
|
5272
5272
|
const fundingInputIndex = ticketEntry ? 3 : 2;
|
|
5273
5273
|
const change = covenantInputSompi +
|
|
@@ -5546,7 +5546,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
5546
5546
|
const requiredFunding = outputSompi + priorityFee > covenantInputSompi
|
|
5547
5547
|
? outputSompi + priorityFee - covenantInputSompi + 10000n
|
|
5548
5548
|
: priorityFee + 10000n;
|
|
5549
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
5549
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
5550
5550
|
const fundingInputIndex = 1;
|
|
5551
5551
|
const change = covenantInputSompi +
|
|
5552
5552
|
(0, sale_common_js_1.utxoAmountSompi)(fundingEntry) -
|
|
@@ -5789,7 +5789,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
5789
5789
|
const requiredFunding = outputSompi + priorityFee > minterInputSompi
|
|
5790
5790
|
? outputSompi + priorityFee - minterInputSompi + 10000n
|
|
5791
5791
|
: priorityFee + 10000n;
|
|
5792
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
5792
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
5793
5793
|
const fundingInputIndex = 1;
|
|
5794
5794
|
const change = minterInputSompi +
|
|
5795
5795
|
BigInt(fundingEntry.amount) -
|
|
@@ -6064,7 +6064,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
6064
6064
|
minterInputSompi: BigInt(minterEntry.amount),
|
|
6065
6065
|
};
|
|
6066
6066
|
});
|
|
6067
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n);
|
|
6067
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, priorityFee + 10000n, [], request.params?.fundingOutpoint);
|
|
6068
6068
|
const fundingInputIndex = resolvedLanes.length;
|
|
6069
6069
|
const fundingChange = BigInt(fundingEntry.amount) - priorityFee;
|
|
6070
6070
|
const outputs = resolvedLanes.map((lane, laneIndex) => tokenOutput(kaspaWasm, lane.resolvedArtifact.artifact, lane.outputState, lane.minterInputSompi, lane.spendCovenantId, laneIndex));
|
|
@@ -6299,7 +6299,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
6299
6299
|
new TransactionOutput(refundSompi, payToAddressScript(walletAddress)),
|
|
6300
6300
|
];
|
|
6301
6301
|
const requiredFunding = priorityFee + MIN_FUNDING_CHANGE_SOMPI;
|
|
6302
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
6302
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
6303
6303
|
const fundingInputIndex = entries.length;
|
|
6304
6304
|
const change = (0, sale_common_js_1.utxoAmountSompi)(fundingEntry) - priorityFee;
|
|
6305
6305
|
let fundingChangeOutputIndex = -1;
|
|
@@ -6440,7 +6440,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
6440
6440
|
tokenOutput(kw, artifact, inputState, tokenOutputSompi, spendCovenantId, 0),
|
|
6441
6441
|
];
|
|
6442
6442
|
const requiredFunding = priorityFee + 10000n;
|
|
6443
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
6443
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
6444
6444
|
const fundingInputIndex = 1;
|
|
6445
6445
|
const change = (0, sale_common_js_1.utxoAmountSompi)(fundingEntry) - priorityFee;
|
|
6446
6446
|
let fundingChangeOutputIndex = -1;
|
|
@@ -6631,7 +6631,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
6631
6631
|
const requiredFunding = outputSompi + priorityFee > tokenInputSompi
|
|
6632
6632
|
? outputSompi + priorityFee - tokenInputSompi + 10000n
|
|
6633
6633
|
: priorityFee + 10000n;
|
|
6634
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding);
|
|
6634
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(walletUtxos.entries, requiredFunding, [], request.params?.fundingOutpoint);
|
|
6635
6635
|
const fundingInputIndex = 1;
|
|
6636
6636
|
const change = tokenInputSompi +
|
|
6637
6637
|
(0, sale_common_js_1.utxoAmountSompi)(fundingEntry) -
|
|
@@ -7026,7 +7026,7 @@ function createKcc20PsktBuilderEngine(options) {
|
|
|
7026
7026
|
await rpc.connect();
|
|
7027
7027
|
try {
|
|
7028
7028
|
const utxos = await getUtxosByAddresses(rpc, [walletAddress]);
|
|
7029
|
-
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(utxos.entries, deploySompi + priorityFee + 10000000n);
|
|
7029
|
+
const fundingEntry = (0, sale_common_js_1.selectFundingEntry)(utxos.entries, deploySompi + priorityFee + 10000000n, [], request.params?.fundingOutpoint);
|
|
7030
7030
|
const created = await createTransactions({
|
|
7031
7031
|
entries: [fundingEntry],
|
|
7032
7032
|
outputs: [{ address: contractAddress, amount: deploySompi }],
|