@kaspacom/kcc20-tx-builder 0.8.0-fee.1 → 0.8.0-fee.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/CHANGELOG.md +13 -0
- package/RELEASING.md +8 -7
- package/dist/cjs/engine.js +252 -0
- package/dist/cjs/engine.js.map +1 -1
- package/dist/cjs/escrow-account-setup.d.ts +53 -0
- package/dist/cjs/escrow-account-setup.js +103 -0
- package/dist/cjs/escrow-account-setup.js.map +1 -0
- package/dist/cjs/escrow-claim-plan.d.ts +74 -0
- package/dist/cjs/escrow-claim-plan.js +98 -0
- package/dist/cjs/escrow-claim-plan.js.map +1 -0
- package/dist/cjs/escrow-receipt.d.ts +103 -0
- package/dist/cjs/escrow-receipt.js +293 -0
- package/dist/cjs/escrow-receipt.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/operations.d.ts +1 -1
- package/dist/cjs/operations.js +2 -0
- package/dist/cjs/operations.js.map +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +252 -0
- package/dist/engine.js.map +1 -1
- package/dist/escrow-account-setup.d.ts +54 -0
- package/dist/escrow-account-setup.d.ts.map +1 -0
- package/dist/escrow-account-setup.js +99 -0
- package/dist/escrow-account-setup.js.map +1 -0
- package/dist/escrow-claim-plan.d.ts +75 -0
- package/dist/escrow-claim-plan.d.ts.map +1 -0
- package/dist/escrow-claim-plan.js +95 -0
- package/dist/escrow-claim-plan.js.map +1 -0
- package/dist/escrow-receipt.d.ts +104 -0
- package/dist/escrow-receipt.d.ts.map +1 -0
- package/dist/escrow-receipt.js +287 -0
- package/dist/escrow-receipt.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/operations.d.ts +1 -1
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +2 -0
- package/dist/operations.js.map +1 -1
- package/docs/COMPATIBILITY.json +1 -1
- package/docs/escrow-fees.md +47 -3
- package/package.json +3 -3
- package/src/engine.ts +292 -0
- package/src/escrow-account-setup.ts +124 -0
- package/src/escrow-claim-plan.ts +130 -0
- package/src/escrow-receipt.ts +333 -0
- package/src/index.ts +3 -0
- package/src/operations.ts +2 -0
package/dist/engine.js
CHANGED
|
@@ -7,6 +7,7 @@ import { BUNDLED_TOKEN_PROFILES, BUNDLED_TOKEN_PROFILE_DIGEST, } from "./token-p
|
|
|
7
7
|
import { DEFAULT_COMPUTE_BUDGET, DEFAULT_KCC20_FEE_BPS, DEFAULT_KCC20_MIN_PROTOCOL_FEE_SOMPI, DEFAULT_KCC20_PRICE_SCALE, DEFAULT_TOKEN_OUTPUT_SOMPI, KCC20_ORDERBOOK_EXPANDED_SWEEP_OUTPUT_SOMPI, KCC20_ORDERBOOK_MAX_SWEEP_BID_LEGS, KCC20_ORDERBOOK_MAX_EXPANDED_SWEEP_BID_LEGS, KCC20_PLATFORM_PROTOCOL_FEE_RECIPIENT, KCC20_ORDERBOOK_PROTOCOL_FEE_RECIPIENT, SUBNETWORK_ID_NATIVE, SOMPI_PER_TKAS, asciiToBytes32, buildKcc20FeeTicketScriptForState, buildNativeKcc20ScriptForState, buildKcc20WrapperScriptForState, buildKcc20OrderbookScriptForState, buildKcc20V3CreateBidSigScript, buildKcc20V3SellIntoBidSigScript, buildKcc20OrderbookFillBidFromSellerSweepSigScript, buildKcc20OrderbookFillAskSigScript, buildKcc20OrderbookFillBidSigScript, buildKcc20OrderbookSellIntoBidsSigScript, buildKcc20OrderbookSellIntoBids10SigScript, buildKcc20OrderbookCrossAskSigScript, buildKcc20OrderbookCrossAskLegacySigScript, buildKcc20OrderbookCrossBidSigScript, buildKcc20OrderbookCrossBidLegacySigScript, bytesToHex, calculateFeeSplit, findOutputIndex, hexToBytes, kcc20PsktBuilderError, mintPolicyName, normalizeSignature, p2pkScriptPubKey, p2shScriptHashHex, parseMintPolicy, requireHex32, selectFundingEntry, setVersionOneInputMassFields, stateToReceiptFields, utxoAmountSompi, ZERO_HASH, } from "./sale-common.js";
|
|
8
8
|
import { buildKcc20BurnSigScript, buildKcc20MintByOwnerSigScript, buildKcc20MintPublicSigScript, buildKcc20ScriptForState, buildKcc20SetPublicMintActiveSigScript, buildKcc20TransferSigScript, dispatchTagFor, templateHash, encodeKcc20StateRecordArrays, holderExtensionCommitment, mintExtensionCommitment, normalizeSilverScriptArtifact, ownerAuthorizationWitness, } from "./abi.js";
|
|
9
9
|
import { KCC20_BUILDER_KEYS } from "./operations.js";
|
|
10
|
+
import { buildKcc20InitialFeeAccount, planKcc20FeeAccountBinding } from "./escrow-account-setup.js";
|
|
10
11
|
import { createKcc20SnapshotPsktBuilder } from "./snapshot-operation.js";
|
|
11
12
|
import { splitKcc20MintSupply } from "./protocol.js";
|
|
12
13
|
import { buildKcc20DeployIntentOutputs } from "./deploy-receipt.js";
|
|
@@ -332,6 +333,8 @@ export function createKcc20PsktBuilderEngine(options) {
|
|
|
332
333
|
"fee-ticket.create-from-utility-burn": buildFeeTicketCreatePskt,
|
|
333
334
|
"fee-ticket.burn": buildFeeTicketBurnPskt,
|
|
334
335
|
"fee-ticket.transfer": buildFeeTicketTransferPskt,
|
|
336
|
+
"kcc20fee.create-account": buildFeeAccountCreatePskt,
|
|
337
|
+
"kcc20fee.bind-account": buildFeeAccountBindPskt,
|
|
335
338
|
"kcc20wrapper.deploy-market": buildWrapperMarketDeployPskt,
|
|
336
339
|
"kcc20wrapper.wrap": buildWrapperWrapPskt,
|
|
337
340
|
"kcc20wrapper.unwrap": buildWrapperUnwrapPskt,
|
|
@@ -369,6 +372,255 @@ export function createKcc20PsktBuilderEngine(options) {
|
|
|
369
372
|
}
|
|
370
373
|
return builder(input);
|
|
371
374
|
}
|
|
375
|
+
async function buildFeeAccountCreatePskt(input) {
|
|
376
|
+
const request = input.request || {};
|
|
377
|
+
const params = request.params || {};
|
|
378
|
+
const tokenId = requireHex32(params.tokenId, "fee account token id");
|
|
379
|
+
const owner = requireHex32(request.owner?.kcc20Owner, "fee account owner");
|
|
380
|
+
const principalSompi = parseU64(params.principalSompi, "fee account principal");
|
|
381
|
+
const network = request.network || env.KASPA_NETWORK || "testnet-10";
|
|
382
|
+
const walletAddress = requireKaspaAddress(request.owner?.walletAddress);
|
|
383
|
+
const priorityFee = parseU64(env.KCC20_FEE_ACCOUNT_PRIORITY_FEE_SOMPI || DEFAULT_PRIORITY_FEE.toString(), "priorityFee");
|
|
384
|
+
const artifactKey = "KCC20FeeEscrowV1.placeholder.json";
|
|
385
|
+
const supplied = options.artifacts?.[artifactKey] ?? await options.artifactProvider?.(artifactKey);
|
|
386
|
+
const artifact = supplied?.artifact ?? supplied;
|
|
387
|
+
if (!artifact)
|
|
388
|
+
throw new Error("missing pinned fee escrow artifact");
|
|
389
|
+
const initial = buildKcc20InitialFeeAccount({
|
|
390
|
+
artifact, tokenId, ownerSchnorrPublicKey: owner, principalSompi,
|
|
391
|
+
});
|
|
392
|
+
const kw = kaspaWasm;
|
|
393
|
+
const { Encoding, GenesisCovenantGroup, RpcClient, Transaction, TransactionOutput, covenantId, payToAddressScript, payToScriptHashScript } = kw;
|
|
394
|
+
const rpc = new RpcClient({
|
|
395
|
+
url: env.KASPA_WRPC_URL || DEFAULT_WRPC_URL,
|
|
396
|
+
encoding: Encoding.Borsh,
|
|
397
|
+
networkId: network,
|
|
398
|
+
});
|
|
399
|
+
await rpc.connect();
|
|
400
|
+
try {
|
|
401
|
+
const walletUtxos = await getUtxosByAddresses(rpc, [walletAddress]);
|
|
402
|
+
const fundingEntry = selectFundingEntry(walletUtxos.entries, principalSompi + priorityFee + 10000n, [], params.fundingOutpoint);
|
|
403
|
+
const fundingAmount = utxoAmountSompi(fundingEntry);
|
|
404
|
+
const change = fundingAmount - principalSompi - priorityFee;
|
|
405
|
+
if (change <= 10000n)
|
|
406
|
+
throw new Error("fee account creation funding change is too small");
|
|
407
|
+
const transaction = new Transaction({
|
|
408
|
+
version: 1,
|
|
409
|
+
lockTime: 0n,
|
|
410
|
+
inputs: [{ previousOutpoint: fundingEntry.outpoint, utxo: fundingEntry,
|
|
411
|
+
sequence: 0n, sigOpCount: 0, computeBudget: 30 }],
|
|
412
|
+
outputs: [
|
|
413
|
+
new TransactionOutput(principalSompi, payToScriptHashScript(initial.redeemScript)),
|
|
414
|
+
new TransactionOutput(change, payToAddressScript(walletAddress)),
|
|
415
|
+
],
|
|
416
|
+
subnetworkId: SUBNETWORK_ID_NATIVE,
|
|
417
|
+
gas: 0n,
|
|
418
|
+
payload: "",
|
|
419
|
+
});
|
|
420
|
+
setVersionOneInputMassFields(transaction, 30);
|
|
421
|
+
transaction.populateGenesisCovenants([new GenesisCovenantGroup(0, [0])]);
|
|
422
|
+
transaction.finalize();
|
|
423
|
+
const accountId = transaction.outputs[0]?.covenant?.covenantId?.toString();
|
|
424
|
+
if (!accountId)
|
|
425
|
+
throw new Error("fee account genesis covenant id is missing");
|
|
426
|
+
const expectedId = covenantId(fundingEntry.outpoint, [
|
|
427
|
+
{ index: 0, output: transaction.outputs[0] },
|
|
428
|
+
]).toString();
|
|
429
|
+
if (accountId !== expectedId)
|
|
430
|
+
throw new Error("fee account genesis covenant id mismatch");
|
|
431
|
+
const feeResult = transactionWithPredictedSignedFeeChange(kw, transaction, 1, network, "fee account creation", candidate => {
|
|
432
|
+
const predicted = cloneTransactionForMassPreflight(kw, candidate, "fee account creation");
|
|
433
|
+
predicted.inputs[0].signatureScript = encodeP2pkSignatureScript(bytesToHex(dummySignatureBytes()));
|
|
434
|
+
return predicted;
|
|
435
|
+
});
|
|
436
|
+
const nonContextualMass = calculateToccataV1NonContextualMass(feeResult.predictedTransaction, "fee account creation").transactionMass;
|
|
437
|
+
const storageMass = calculateToccataStorageMass(feeResult.predictedTransaction, "fee account creation");
|
|
438
|
+
if (nonContextualMass > CONSOLIDATION_TARGET_TRANSACTION_MASS ||
|
|
439
|
+
storageMass > CONSOLIDATION_TARGET_TRANSACTION_MASS) {
|
|
440
|
+
throw kcc20PsktBuilderError("fee account creation exceeds the signed transaction mass target", "TRANSACTION_MASS_EXCEEDED", { nonContextualMass, storageMass, targetMass: CONSOLIDATION_TARGET_TRANSACTION_MASS });
|
|
441
|
+
}
|
|
442
|
+
const finalAccountId = covenantId(fundingEntry.outpoint, [
|
|
443
|
+
{ index: 0, output: feeResult.transaction.outputs[0] },
|
|
444
|
+
]).toString();
|
|
445
|
+
if (finalAccountId !== accountId)
|
|
446
|
+
throw new Error("fee account genesis id changed after fee calculation");
|
|
447
|
+
const psktTransactionJson = feeResult.transaction.serializeToSafeJSON();
|
|
448
|
+
if (typeof psktTransactionJson !== "string")
|
|
449
|
+
throw new Error("fee account creation PSKT serialization failed");
|
|
450
|
+
return {
|
|
451
|
+
schema: OUTPUT_SCHEMA,
|
|
452
|
+
psktTransactionJson,
|
|
453
|
+
signInputs: [{ index: 0, sighashType: 1 }],
|
|
454
|
+
scripts: [],
|
|
455
|
+
submitTransactionSupported: true,
|
|
456
|
+
metadata: {
|
|
457
|
+
builderKey: "kcc20fee.create-account",
|
|
458
|
+
operation: "create-fee-account",
|
|
459
|
+
action: "genesis",
|
|
460
|
+
contract: "KCC20FeeEscrowV1",
|
|
461
|
+
network, walletAddress, tokenId, owner, accountId,
|
|
462
|
+
accountPrincipalSompi: principalSompi.toString(),
|
|
463
|
+
// Attach the broadcast txid to this hint before binding. The first
|
|
464
|
+
// spend reveals the script; until then the indexer sees only P2SH.
|
|
465
|
+
accountGenesisHint: {
|
|
466
|
+
vout: 0,
|
|
467
|
+
address: kw.addressFromScriptPublicKey(payToScriptHashScript(initial.redeemScript), network).toString(),
|
|
468
|
+
covenantIdHex: accountId,
|
|
469
|
+
scriptHashHex: initial.scriptHash,
|
|
470
|
+
amountSompiExact: principalSompi.toString(),
|
|
471
|
+
state: { ...initial.state, roleName: "account" },
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
finally {
|
|
477
|
+
await rpc.disconnect();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
async function buildFeeAccountBindPskt(input) {
|
|
481
|
+
const request = input.request || {};
|
|
482
|
+
const params = request.params || {};
|
|
483
|
+
// A genesis output has no revealed script yet. The caller keeps the
|
|
484
|
+
// creation hint, adds its accepted txid, then we check the live UTXO.
|
|
485
|
+
const indexed = params.accountGenesisHint
|
|
486
|
+
? { ...params.accountGenesisHint, status: "active", spentByTxidHex: null }
|
|
487
|
+
: params.activeAccountUtxo;
|
|
488
|
+
if (!indexed || !indexed.address)
|
|
489
|
+
throw new Error("active unbound fee account UTXO and address are required");
|
|
490
|
+
const tokenId = requireHex32(params.tokenId, "fee account token id");
|
|
491
|
+
const accountId = requireHex32(params.accountId, "fee account id");
|
|
492
|
+
const marketId = requireHex32(params.marketId, "fee account market id");
|
|
493
|
+
const policyId = requireHex32(params.policyId, "fee account policy id");
|
|
494
|
+
const owner = requireHex32(request.owner?.kcc20Owner, "fee account owner");
|
|
495
|
+
if (String(indexed.state?.owner || "").toLowerCase() !== owner) {
|
|
496
|
+
throw new Error("fee account owner does not match connected wallet");
|
|
497
|
+
}
|
|
498
|
+
const network = request.network || env.KASPA_NETWORK || "testnet-10";
|
|
499
|
+
const walletAddress = requireKaspaAddress(request.owner?.walletAddress);
|
|
500
|
+
const accountAddress = requireKaspaAddress(indexed.address);
|
|
501
|
+
const priorityFee = parseU64(env.KCC20_FEE_ACCOUNT_PRIORITY_FEE_SOMPI || DEFAULT_PRIORITY_FEE.toString(), "priorityFee");
|
|
502
|
+
const computeBudget = parsePositiveNumber(env.KCC20_FEE_ACCOUNT_COMPUTE_BUDGET || 500, "computeBudget");
|
|
503
|
+
const artifactKey = "KCC20FeeEscrowV1.placeholder.json";
|
|
504
|
+
const supplied = options.artifacts?.[artifactKey] ?? await options.artifactProvider?.(artifactKey);
|
|
505
|
+
const artifact = supplied?.artifact ?? supplied;
|
|
506
|
+
if (!artifact)
|
|
507
|
+
throw new Error("missing pinned fee escrow artifact");
|
|
508
|
+
const kw = kaspaWasm;
|
|
509
|
+
const { CovenantBinding, Encoding, Hash, RpcClient, Transaction, TransactionOutput, payToAddressScript, payToScriptHashScript } = kw;
|
|
510
|
+
const rpc = new RpcClient({
|
|
511
|
+
url: env.KASPA_WRPC_URL || DEFAULT_WRPC_URL,
|
|
512
|
+
encoding: Encoding.Borsh,
|
|
513
|
+
networkId: network,
|
|
514
|
+
});
|
|
515
|
+
await rpc.connect();
|
|
516
|
+
try {
|
|
517
|
+
const [accountUtxos, walletUtxos] = await Promise.all([
|
|
518
|
+
getUtxosByAddresses(rpc, [accountAddress]),
|
|
519
|
+
getUtxosByAddresses(rpc, [walletAddress]),
|
|
520
|
+
]);
|
|
521
|
+
const txid = requireHex32(indexed.txidHex, "fee account txid");
|
|
522
|
+
const vout = parseVout(indexed.vout, "fee account vout");
|
|
523
|
+
const accountEntry = findUtxoEntry(accountUtxos.entries, txid, vout);
|
|
524
|
+
if (!accountEntry)
|
|
525
|
+
throw new Error("unbound fee account UTXO is spent or unavailable");
|
|
526
|
+
requireMatchingCovenantId(accountEntry, accountId, "unbound fee account");
|
|
527
|
+
const spk = accountEntry.scriptPublicKey ??
|
|
528
|
+
accountEntry.entry?.scriptPublicKey ?? accountEntry.utxoEntry?.scriptPublicKey;
|
|
529
|
+
const scriptBytes = spk?.script;
|
|
530
|
+
if (!spk || !scriptBytes)
|
|
531
|
+
throw new Error("unbound fee account has no script public key");
|
|
532
|
+
const scriptHex = typeof scriptBytes === "string" ? scriptBytes : bytesToHex(scriptBytes);
|
|
533
|
+
const plan = planKcc20FeeAccountBinding({
|
|
534
|
+
artifact,
|
|
535
|
+
indexed,
|
|
536
|
+
live: {
|
|
537
|
+
outpoint: { transactionId: txid, index: vout },
|
|
538
|
+
amountSompi: utxoAmountSompi(accountEntry),
|
|
539
|
+
covenantIdHex: accountId,
|
|
540
|
+
scriptPublicKey: { version: Number(spk.version), scriptHex },
|
|
541
|
+
},
|
|
542
|
+
tokenId, accountId, marketId, policyId,
|
|
543
|
+
});
|
|
544
|
+
assertScriptAddress(kw, plan.currentRedeemScript, accountAddress, network, "unbound fee account address");
|
|
545
|
+
const fundingEntry = selectFundingEntry(walletUtxos.entries, priorityFee + 10000n, [], params.fundingOutpoint);
|
|
546
|
+
const fundingAmount = utxoAmountSompi(fundingEntry);
|
|
547
|
+
if (fundingAmount <= priorityFee + 10000n)
|
|
548
|
+
throw new Error("fee account binding funding change is too small");
|
|
549
|
+
const unsignedTx = new Transaction({
|
|
550
|
+
version: 1,
|
|
551
|
+
lockTime: 0n,
|
|
552
|
+
inputs: [
|
|
553
|
+
{ previousOutpoint: accountEntry.outpoint, utxo: accountEntry,
|
|
554
|
+
sequence: 0n, sigOpCount: 0, computeBudget },
|
|
555
|
+
{ previousOutpoint: fundingEntry.outpoint, utxo: fundingEntry,
|
|
556
|
+
sequence: 0n, sigOpCount: 0, computeBudget: 30 },
|
|
557
|
+
],
|
|
558
|
+
outputs: [
|
|
559
|
+
new TransactionOutput(plan.successorAmountSompi, payToScriptHashScript(plan.successorRedeemScript), new CovenantBinding(0, new Hash(accountId))),
|
|
560
|
+
new TransactionOutput(fundingAmount - priorityFee, payToAddressScript(walletAddress)),
|
|
561
|
+
],
|
|
562
|
+
subnetworkId: SUBNETWORK_ID_NATIVE,
|
|
563
|
+
gas: 0n,
|
|
564
|
+
payload: "",
|
|
565
|
+
});
|
|
566
|
+
setVersionOneInputMassFields(unsignedTx, computeBudget);
|
|
567
|
+
unsignedTx.inputs[1].computeBudget = 30;
|
|
568
|
+
const scripts = [{
|
|
569
|
+
inputIndex: 0,
|
|
570
|
+
scriptHex: bytesToHex(plan.currentRedeemScript),
|
|
571
|
+
signType: 1,
|
|
572
|
+
signatureScript: {
|
|
573
|
+
mode: "ordered-args",
|
|
574
|
+
args: [
|
|
575
|
+
dataTemplateArg(hexToBytes(marketId)),
|
|
576
|
+
dataTemplateArg(hexToBytes(policyId)),
|
|
577
|
+
{ type: "signature" },
|
|
578
|
+
i64TemplateArg(0),
|
|
579
|
+
dataTemplateArg(dispatchTagFor(artifact, "bindMarket")),
|
|
580
|
+
],
|
|
581
|
+
},
|
|
582
|
+
}];
|
|
583
|
+
const feeResult = transactionWithPredictedSignedFeeChange(kw, unsignedTx, 1, network, "fee account binding", candidate => {
|
|
584
|
+
const serialized = candidate.serializeToSafeJSON();
|
|
585
|
+
if (typeof serialized !== "string")
|
|
586
|
+
throw new Error("fee account mass preflight serialization failed");
|
|
587
|
+
const predictedJson = transactionJsonWithScriptHints(kw, JSON.parse(serialized), scripts);
|
|
588
|
+
predictedJson.inputs[1].signatureScript = encodeP2pkSignatureScript(bytesToHex(dummySignatureBytes()));
|
|
589
|
+
return typeof kw.Transaction.deserializeFromSafeJSON === "function"
|
|
590
|
+
? kw.Transaction.deserializeFromSafeJSON(JSON.stringify(predictedJson))
|
|
591
|
+
: kw.Transaction.deserializeFromJSON(JSON.stringify(predictedJson));
|
|
592
|
+
});
|
|
593
|
+
const nonContextualMass = calculateToccataV1NonContextualMass(feeResult.predictedTransaction, "fee account binding").transactionMass;
|
|
594
|
+
const storageMass = calculateToccataStorageMass(feeResult.predictedTransaction, "fee account binding");
|
|
595
|
+
if (nonContextualMass > CONSOLIDATION_TARGET_TRANSACTION_MASS ||
|
|
596
|
+
storageMass > CONSOLIDATION_TARGET_TRANSACTION_MASS) {
|
|
597
|
+
throw kcc20PsktBuilderError("fee account binding exceeds the signed transaction mass target", "TRANSACTION_MASS_EXCEEDED", { nonContextualMass, storageMass, targetMass: CONSOLIDATION_TARGET_TRANSACTION_MASS });
|
|
598
|
+
}
|
|
599
|
+
const transaction = feeResult.transaction;
|
|
600
|
+
const psktTransactionJson = transaction.serializeToSafeJSON();
|
|
601
|
+
if (typeof psktTransactionJson !== "string")
|
|
602
|
+
throw new Error("fee account binding PSKT serialization failed");
|
|
603
|
+
return {
|
|
604
|
+
schema: OUTPUT_SCHEMA,
|
|
605
|
+
psktTransactionJson,
|
|
606
|
+
signInputs: [{ index: 1, sighashType: 1 }],
|
|
607
|
+
scripts,
|
|
608
|
+
submitTransactionSupported: true,
|
|
609
|
+
metadata: {
|
|
610
|
+
builderKey: "kcc20fee.bind-account",
|
|
611
|
+
operation: "bind-fee-account",
|
|
612
|
+
action: "bindMarket",
|
|
613
|
+
contract: "KCC20FeeEscrowV1",
|
|
614
|
+
network, walletAddress, tokenId, accountId, marketId, policyId,
|
|
615
|
+
accountInput: `${txid}:${vout}`,
|
|
616
|
+
accountPrincipalSompi: plan.successorAmountSompi.toString(),
|
|
617
|
+
},
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
finally {
|
|
621
|
+
await rpc.disconnect();
|
|
622
|
+
}
|
|
623
|
+
}
|
|
372
624
|
async function buildFeeTicketRootUpdatePskt(input) {
|
|
373
625
|
const request = input.request || {};
|
|
374
626
|
const params = request.params || {};
|