@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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Kcc20FeeAccountState } from "./escrow-claim-plan.js";
|
|
2
|
+
import { type Kcc20IndexedFeeReceipt, type Kcc20LiveFeeReceiptUtxo } from "./escrow-receipt.js";
|
|
3
|
+
/**
|
|
4
|
+
* Construct the initial account output. Its covenant lineage is assigned by
|
|
5
|
+
* the transaction; the market can bind that lineage only after it is known.
|
|
6
|
+
* This function does not select funding, sign, or estimate transaction mass.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildKcc20InitialFeeAccount(input: {
|
|
9
|
+
artifact: unknown;
|
|
10
|
+
tokenId: string;
|
|
11
|
+
ownerSchnorrPublicKey: string;
|
|
12
|
+
principalSompi: bigint;
|
|
13
|
+
}): {
|
|
14
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
15
|
+
scriptHash: string;
|
|
16
|
+
scriptPublicKey: {
|
|
17
|
+
version: 0;
|
|
18
|
+
scriptHex: string;
|
|
19
|
+
};
|
|
20
|
+
escrowTemplate: {
|
|
21
|
+
hash: string;
|
|
22
|
+
prefixLength: number;
|
|
23
|
+
suffixLength: number;
|
|
24
|
+
};
|
|
25
|
+
state: Kcc20FeeAccountState;
|
|
26
|
+
amountSompi: bigint;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Verify the current unbound account output and plan the exact continuation.
|
|
30
|
+
* The owner signs bindMarket once; later claims use the account's authority.
|
|
31
|
+
*/
|
|
32
|
+
export declare function planKcc20FeeAccountBinding(input: {
|
|
33
|
+
artifact: unknown;
|
|
34
|
+
indexed: Kcc20IndexedFeeReceipt;
|
|
35
|
+
live: Kcc20LiveFeeReceiptUtxo;
|
|
36
|
+
tokenId: string;
|
|
37
|
+
accountId: string;
|
|
38
|
+
marketId: string;
|
|
39
|
+
policyId: string;
|
|
40
|
+
}): {
|
|
41
|
+
entrypoint: "bindMarket";
|
|
42
|
+
account: import("./escrow-claim-plan.js").Kcc20FeeClaimAccount;
|
|
43
|
+
currentRedeemScript: Uint8Array<ArrayBufferLike>;
|
|
44
|
+
successorState: Kcc20FeeAccountState;
|
|
45
|
+
successorRedeemScript: Uint8Array<ArrayBuffer>;
|
|
46
|
+
successorScriptPublicKey: {
|
|
47
|
+
version: 0;
|
|
48
|
+
scriptHex: string;
|
|
49
|
+
};
|
|
50
|
+
successorAmountSompi: bigint;
|
|
51
|
+
requiresOwnerSchnorrSignature: true;
|
|
52
|
+
requiresSeparateNetworkFunding: true;
|
|
53
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildKcc20InitialFeeAccount = buildKcc20InitialFeeAccount;
|
|
4
|
+
exports.planKcc20FeeAccountBinding = planKcc20FeeAccountBinding;
|
|
5
|
+
const abi_js_1 = require("./abi.js");
|
|
6
|
+
const escrow_fee_js_1 = require("./escrow-fee.js");
|
|
7
|
+
const escrow_receipt_js_1 = require("./escrow-receipt.js");
|
|
8
|
+
const ZERO = "00".repeat(32);
|
|
9
|
+
const SECP256K1_FIELD = (1n << 256n) - (1n << 32n) - 977n;
|
|
10
|
+
function hex32(value, label) {
|
|
11
|
+
if (typeof value !== "string" || !/^[0-9a-f]{64}$/i.test(value)) {
|
|
12
|
+
throw new Error(`${label} must be 32-byte hex`);
|
|
13
|
+
}
|
|
14
|
+
return value.toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
function principal(value) {
|
|
17
|
+
if (typeof value !== "bigint" || value <= 0n || value > escrow_fee_js_1.KCC20_ESCROW_MAX_INT) {
|
|
18
|
+
throw new Error("fee account principal must be a positive contract-range bigint");
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function modPow(base, exponent) {
|
|
23
|
+
let result = 1n;
|
|
24
|
+
let factor = base % SECP256K1_FIELD;
|
|
25
|
+
for (let remaining = exponent; remaining > 0n; remaining >>= 1n) {
|
|
26
|
+
if (remaining & 1n)
|
|
27
|
+
result = (result * factor) % SECP256K1_FIELD;
|
|
28
|
+
factor = (factor * factor) % SECP256K1_FIELD;
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
/** BIP340 keys encode an x-coordinate that must lift to a secp256k1 point. */
|
|
33
|
+
function requireSchnorrXOnlyPublicKey(value) {
|
|
34
|
+
const key = hex32(value, "owner Schnorr public key");
|
|
35
|
+
const x = BigInt(`0x${key}`);
|
|
36
|
+
if (x >= SECP256K1_FIELD)
|
|
37
|
+
throw new Error("owner Schnorr public key is not a curve point");
|
|
38
|
+
const square = (x * x % SECP256K1_FIELD * x + 7n) % SECP256K1_FIELD;
|
|
39
|
+
const y = modPow(square, (SECP256K1_FIELD + 1n) / 4n);
|
|
40
|
+
if (y * y % SECP256K1_FIELD !== square) {
|
|
41
|
+
throw new Error("owner Schnorr public key is not a curve point");
|
|
42
|
+
}
|
|
43
|
+
return key;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Construct the initial account output. Its covenant lineage is assigned by
|
|
47
|
+
* the transaction; the market can bind that lineage only after it is known.
|
|
48
|
+
* This function does not select funding, sign, or estimate transaction mass.
|
|
49
|
+
*/
|
|
50
|
+
function buildKcc20InitialFeeAccount(input) {
|
|
51
|
+
const token = hex32(input.tokenId, "token");
|
|
52
|
+
const owner = requireSchnorrXOnlyPublicKey(input.ownerSchnorrPublicKey);
|
|
53
|
+
if (token === ZERO || owner === ZERO)
|
|
54
|
+
throw new Error("fee account token and owner must be nonzero");
|
|
55
|
+
const amountSompi = principal(input.principalSompi);
|
|
56
|
+
const template = (0, abi_js_1.templateParts)((0, abi_js_1.normalizeSilverScriptArtifact)(input.artifact));
|
|
57
|
+
const state = {
|
|
58
|
+
role: "1", token, market: ZERO, policy: ZERO,
|
|
59
|
+
protocol_account: ZERO, creator_account: ZERO,
|
|
60
|
+
protocol_amount: "0", creator_amount: "0", owner,
|
|
61
|
+
owner_scheme: 0, guard_template: ZERO, guard_prefix: "0", guard_suffix: "0",
|
|
62
|
+
action_hash: ZERO,
|
|
63
|
+
self_template: toHex(template.hash),
|
|
64
|
+
self_prefix: String(template.prefixLength), self_suffix: String(template.suffixLength),
|
|
65
|
+
};
|
|
66
|
+
return { state, amountSompi, ...(0, escrow_receipt_js_1.buildKcc20FeeEscrowScript)(input.artifact, state) };
|
|
67
|
+
}
|
|
68
|
+
function toHex(bytes) {
|
|
69
|
+
return Array.from(bytes, byte => byte.toString(16).padStart(2, "0")).join("");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Verify the current unbound account output and plan the exact continuation.
|
|
73
|
+
* The owner signs bindMarket once; later claims use the account's authority.
|
|
74
|
+
*/
|
|
75
|
+
function planKcc20FeeAccountBinding(input) {
|
|
76
|
+
const market = hex32(input.marketId, "market");
|
|
77
|
+
const policy = hex32(input.policyId, "policy");
|
|
78
|
+
if (market === ZERO || policy === ZERO)
|
|
79
|
+
throw new Error("fee account binding requires a market and policy");
|
|
80
|
+
const verified = (0, escrow_receipt_js_1.verifyKcc20UnboundFeeAccountForBinding)({
|
|
81
|
+
artifact: input.artifact,
|
|
82
|
+
indexed: input.indexed,
|
|
83
|
+
live: input.live,
|
|
84
|
+
expected: { tokenId: input.tokenId, accountId: input.accountId },
|
|
85
|
+
});
|
|
86
|
+
const successorState = {
|
|
87
|
+
...verified.account.state,
|
|
88
|
+
market, policy,
|
|
89
|
+
};
|
|
90
|
+
const successor = (0, escrow_receipt_js_1.buildKcc20FeeEscrowScript)(input.artifact, successorState);
|
|
91
|
+
return {
|
|
92
|
+
entrypoint: "bindMarket",
|
|
93
|
+
account: verified.account,
|
|
94
|
+
currentRedeemScript: verified.redeemScript,
|
|
95
|
+
successorState,
|
|
96
|
+
successorRedeemScript: successor.redeemScript,
|
|
97
|
+
successorScriptPublicKey: successor.scriptPublicKey,
|
|
98
|
+
successorAmountSompi: verified.account.principalSompi,
|
|
99
|
+
requiresOwnerSchnorrSignature: true,
|
|
100
|
+
requiresSeparateNetworkFunding: true,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=escrow-account-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow-account-setup.js","sourceRoot":"","sources":["../../src/escrow-account-setup.ts"],"names":[],"mappings":";;AAuDA,kEAqBC;AAUD,gEAqCC;AA3HD,qCAAwE;AACxE,mDAAuD;AAEvD,2DAK6B;AAE7B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC7B,MAAM,eAAe,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC;AAE1D,SAAS,KAAK,CAAC,KAAa,EAAE,KAAa;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,sBAAsB,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,oCAAoB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,QAAgB;I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7
|
+
protocol_account: string;
|
|
8
|
+
creator_account: string;
|
|
9
|
+
protocol_amount: string;
|
|
10
|
+
creator_amount: string;
|
|
11
|
+
owner: string;
|
|
12
|
+
owner_scheme: number;
|
|
13
|
+
guard_template: string;
|
|
14
|
+
guard_prefix: string;
|
|
15
|
+
guard_suffix: string;
|
|
16
|
+
action_hash: string;
|
|
17
|
+
self_template: string;
|
|
18
|
+
self_prefix: string;
|
|
19
|
+
self_suffix: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Kcc20FeeClaimAccount {
|
|
22
|
+
outpoint: {
|
|
23
|
+
transactionId: string;
|
|
24
|
+
index: number;
|
|
25
|
+
};
|
|
26
|
+
covenantId: string;
|
|
27
|
+
principalSompi: bigint;
|
|
28
|
+
state: Kcc20FeeAccountState;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Derive the exact claim amounts and covenant successor states. Inputs must
|
|
32
|
+
* already be authenticated against current node UTXOs. This plan does not
|
|
33
|
+
* authorize account ownership, sign, estimate mass or select network funding.
|
|
34
|
+
*/
|
|
35
|
+
export declare function planKcc20FeeClaimTransition(input: {
|
|
36
|
+
receipts: readonly Kcc20FeeReceiptAmounts[];
|
|
37
|
+
party: "protocol" | "creator";
|
|
38
|
+
account: Kcc20FeeClaimAccount;
|
|
39
|
+
/** Supplied by a successful pinned receipt verification, not by an indexer hint alone. */
|
|
40
|
+
escrowTemplate: {
|
|
41
|
+
hash: string;
|
|
42
|
+
prefixLength: number;
|
|
43
|
+
suffixLength: number;
|
|
44
|
+
};
|
|
45
|
+
/** Serialized ScriptPublicKey including its two-byte little-endian version. */
|
|
46
|
+
payoutScriptPublicKey: Uint8Array;
|
|
47
|
+
}): {
|
|
48
|
+
party: "protocol" | "creator";
|
|
49
|
+
claimSompi: bigint;
|
|
50
|
+
accountPrincipalSompi: bigint;
|
|
51
|
+
remainderSompi: bigint;
|
|
52
|
+
commitment: string;
|
|
53
|
+
successorAccountState: Kcc20FeeAccountState;
|
|
54
|
+
remainderReceiptState: {
|
|
55
|
+
role: string;
|
|
56
|
+
token: string;
|
|
57
|
+
market: string;
|
|
58
|
+
policy: string;
|
|
59
|
+
protocol_account: string;
|
|
60
|
+
creator_account: string;
|
|
61
|
+
protocol_amount: string;
|
|
62
|
+
creator_amount: string;
|
|
63
|
+
owner: string;
|
|
64
|
+
owner_scheme: number;
|
|
65
|
+
guard_template: string;
|
|
66
|
+
guard_prefix: string;
|
|
67
|
+
guard_suffix: string;
|
|
68
|
+
action_hash: string;
|
|
69
|
+
self_template: string;
|
|
70
|
+
self_prefix: string;
|
|
71
|
+
self_suffix: string;
|
|
72
|
+
} | null;
|
|
73
|
+
requiresSeparateNetworkFunding: true;
|
|
74
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.planKcc20FeeClaimTransition = planKcc20FeeClaimTransition;
|
|
4
|
+
const escrow_fee_js_1 = require("./escrow-fee.js");
|
|
5
|
+
const escrow_policy_js_1 = require("./escrow-policy.js");
|
|
6
|
+
const ZERO = "00".repeat(32);
|
|
7
|
+
const HEX_32 = /^[0-9a-f]{64}$/i;
|
|
8
|
+
function hex32(value, label) {
|
|
9
|
+
if (typeof value !== "string" || !HEX_32.test(value))
|
|
10
|
+
throw new Error(`${label} must be 32-byte hex`);
|
|
11
|
+
return value.toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
function natural(value, label) {
|
|
14
|
+
if (typeof value !== "string" || !/^(0|[1-9]\d*)$/.test(value))
|
|
15
|
+
throw new Error(`${label} must be canonical decimal`);
|
|
16
|
+
const result = BigInt(value);
|
|
17
|
+
if (result > escrow_fee_js_1.KCC20_ESCROW_MAX_INT)
|
|
18
|
+
throw new Error(`${label} exceeds the contract range`);
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Derive the exact claim amounts and covenant successor states. Inputs must
|
|
23
|
+
* already be authenticated against current node UTXOs. This plan does not
|
|
24
|
+
* authorize account ownership, sign, estimate mass or select network funding.
|
|
25
|
+
*/
|
|
26
|
+
function planKcc20FeeClaimTransition(input) {
|
|
27
|
+
const amounts = (0, escrow_fee_js_1.calculateKcc20FeeClaim)(input.receipts, input.party);
|
|
28
|
+
const first = input.receipts[0];
|
|
29
|
+
const account = input.account;
|
|
30
|
+
const state = account.state;
|
|
31
|
+
const targetAccount = input.party === "protocol" ? first.protocolAccountId : first.creatorAccountId;
|
|
32
|
+
if (hex32(targetAccount, "target account") === ZERO ||
|
|
33
|
+
hex32(account.covenantId, "account covenant") !== hex32(targetAccount, "target account")) {
|
|
34
|
+
throw new Error("claim uses the wrong fee account lineage");
|
|
35
|
+
}
|
|
36
|
+
if (!Number.isInteger(account.outpoint.index) || account.outpoint.index < 0 || account.outpoint.index > 0xffffffff ||
|
|
37
|
+
hex32(account.outpoint.transactionId, "account txid") === ZERO ||
|
|
38
|
+
typeof account.principalSompi !== "bigint" || account.principalSompi <= 0n ||
|
|
39
|
+
account.principalSompi > escrow_fee_js_1.KCC20_ESCROW_MAX_INT) {
|
|
40
|
+
throw new Error("invalid fee account outpoint or principal");
|
|
41
|
+
}
|
|
42
|
+
if (state.role !== "1" || hex32(state.token, "account token") !== hex32(first.tokenId, "receipt token") ||
|
|
43
|
+
hex32(state.market, "account market") !== hex32(first.marketId, "receipt market") ||
|
|
44
|
+
hex32(state.policy, "account policy") !== hex32(first.policyId, "receipt policy") ||
|
|
45
|
+
[state.protocol_account, state.creator_account, state.owner].some(value => !HEX_32.test(value)) ||
|
|
46
|
+
state.protocol_account.toLowerCase() !== ZERO || state.creator_account.toLowerCase() !== ZERO ||
|
|
47
|
+
state.owner.toLowerCase() === ZERO || state.protocol_amount !== "0" || state.creator_amount !== "0") {
|
|
48
|
+
throw new Error("invalid fee account state");
|
|
49
|
+
}
|
|
50
|
+
if (!Number.isInteger(state.owner_scheme) || state.owner_scheme < 0 || state.owner_scheme > 4 ||
|
|
51
|
+
!HEX_32.test(state.guard_template) || !HEX_32.test(state.action_hash) || !HEX_32.test(state.self_template)) {
|
|
52
|
+
throw new Error("unsupported fee account authority state");
|
|
53
|
+
}
|
|
54
|
+
const guardPrefix = natural(state.guard_prefix, "guard prefix");
|
|
55
|
+
const guardSuffix = natural(state.guard_suffix, "guard suffix");
|
|
56
|
+
const selfPrefix = natural(state.self_prefix, "self prefix");
|
|
57
|
+
const selfSuffix = natural(state.self_suffix, "self suffix");
|
|
58
|
+
if (!Number.isSafeInteger(input.escrowTemplate.prefixLength) ||
|
|
59
|
+
!Number.isSafeInteger(input.escrowTemplate.suffixLength) ||
|
|
60
|
+
input.escrowTemplate.prefixLength <= 0 || input.escrowTemplate.suffixLength <= 0 ||
|
|
61
|
+
state.self_template.toLowerCase() !== hex32(input.escrowTemplate.hash, "escrow template") ||
|
|
62
|
+
selfPrefix !== BigInt(input.escrowTemplate.prefixLength) ||
|
|
63
|
+
selfSuffix !== BigInt(input.escrowTemplate.suffixLength) ||
|
|
64
|
+
(state.owner_scheme === 3 && (state.guard_template.toLowerCase() === ZERO || guardPrefix !== 0n || guardSuffix !== 0n)) ||
|
|
65
|
+
(state.owner_scheme === 4 && (state.guard_template.toLowerCase() === ZERO || guardPrefix === 0n || guardSuffix === 0n)) ||
|
|
66
|
+
(state.owner_scheme <= 2 && (state.guard_template.toLowerCase() !== ZERO || guardPrefix !== 0n || guardSuffix !== 0n))) {
|
|
67
|
+
throw new Error("invalid fee account guard state");
|
|
68
|
+
}
|
|
69
|
+
const commitment = (0, escrow_policy_js_1.kcc20FeeClaimCommitment)({
|
|
70
|
+
receipts: input.receipts,
|
|
71
|
+
party: input.party,
|
|
72
|
+
accountOutpoint: account.outpoint,
|
|
73
|
+
payoutScriptPublicKey: input.payoutScriptPublicKey,
|
|
74
|
+
});
|
|
75
|
+
const successorAccountState = { ...state, action_hash: commitment };
|
|
76
|
+
const remainderReceiptState = amounts.remainderSompi > 0n ? {
|
|
77
|
+
role: "0", token: first.tokenId, market: first.marketId, policy: first.policyId,
|
|
78
|
+
protocol_account: first.protocolAccountId, creator_account: first.creatorAccountId,
|
|
79
|
+
protocol_amount: amounts.remainingProtocolSompi.toString(),
|
|
80
|
+
creator_amount: amounts.remainingCreatorSompi.toString(),
|
|
81
|
+
owner: ZERO, owner_scheme: 0, guard_template: ZERO,
|
|
82
|
+
guard_prefix: "0", guard_suffix: "0", action_hash: ZERO,
|
|
83
|
+
self_template: input.escrowTemplate.hash.toLowerCase(),
|
|
84
|
+
self_prefix: String(input.escrowTemplate.prefixLength),
|
|
85
|
+
self_suffix: String(input.escrowTemplate.suffixLength),
|
|
86
|
+
} : null;
|
|
87
|
+
return {
|
|
88
|
+
party: input.party,
|
|
89
|
+
claimSompi: amounts.claimSompi,
|
|
90
|
+
accountPrincipalSompi: account.principalSompi,
|
|
91
|
+
remainderSompi: amounts.remainderSompi,
|
|
92
|
+
commitment,
|
|
93
|
+
successorAccountState,
|
|
94
|
+
remainderReceiptState,
|
|
95
|
+
requiresSeparateNetworkFunding: true,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=escrow-claim-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow-claim-plan.js","sourceRoot":"","sources":["../../src/escrow-claim-plan.ts"],"names":[],"mappings":";;AAkDA,kEA+EC;AAjID,mDAA4G;AAC5G,yDAA6D;AAE7D,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC7B,MAAM,MAAM,GAAG,iBAAiB,CAAC;AA6BjC,SAAS,KAAK,CAAC,KAAa,EAAE,KAAa;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,sBAAsB,CAAC,CAAC;IACtG,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC;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IAAI;QAClD,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI;QACvD,aAAa,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE;QACtD,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC;QACtD,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC;KACvD,CAAC,CAAC,CAAC,IAAI,CAAC;IACT,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,qBAAqB,EAAE,OAAO,CAAC,cAAc;QAC7C,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,UAAU;QACV,qBAAqB;QACrB,qBAAqB;QACrB,8BAA8B,EAAE,IAAa;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type Kcc20FeeReceiptAmounts } from "./escrow-fee.js";
|
|
2
|
+
import type { Kcc20FeeClaimAccount } from "./escrow-claim-plan.js";
|
|
3
|
+
export interface Kcc20IndexedFeeReceipt {
|
|
4
|
+
txidHex: string;
|
|
5
|
+
vout: number;
|
|
6
|
+
covenantIdHex: string;
|
|
7
|
+
scriptHashHex: string;
|
|
8
|
+
amountSompiExact: string;
|
|
9
|
+
status: string;
|
|
10
|
+
spentByTxidHex?: string | null;
|
|
11
|
+
state: Record<string, unknown> | null;
|
|
12
|
+
}
|
|
13
|
+
/** Obtain this UTXO from the canonical node immediately before construction. */
|
|
14
|
+
export interface Kcc20LiveFeeReceiptUtxo {
|
|
15
|
+
outpoint: {
|
|
16
|
+
transactionId: string;
|
|
17
|
+
index: number;
|
|
18
|
+
};
|
|
19
|
+
amountSompi: bigint;
|
|
20
|
+
covenantIdHex: string;
|
|
21
|
+
scriptPublicKey: {
|
|
22
|
+
version: number;
|
|
23
|
+
scriptHex: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface Kcc20FeeReceiptIdentity {
|
|
27
|
+
tokenId: string;
|
|
28
|
+
marketId: string;
|
|
29
|
+
policyId: string;
|
|
30
|
+
protocolAccountId: string;
|
|
31
|
+
creatorAccountId: string;
|
|
32
|
+
}
|
|
33
|
+
/** Render an escrow state using only the packaged, pinned v1 program. */
|
|
34
|
+
export declare function buildKcc20FeeEscrowScript(artifactInput: unknown, state: Record<string, unknown>): {
|
|
35
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
36
|
+
scriptHash: string;
|
|
37
|
+
scriptPublicKey: {
|
|
38
|
+
version: 0;
|
|
39
|
+
scriptHex: string;
|
|
40
|
+
};
|
|
41
|
+
escrowTemplate: {
|
|
42
|
+
hash: string;
|
|
43
|
+
prefixLength: number;
|
|
44
|
+
suffixLength: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Check a receipt hint against the pinned program and a fresh node UTXO.
|
|
49
|
+
* The caller must fetch `live` from a qualified canonical node, authenticate
|
|
50
|
+
* the market root/policy, and refresh the UTXO again before signing.
|
|
51
|
+
*/
|
|
52
|
+
export declare function verifyKcc20FeeReceiptForClaim(input: {
|
|
53
|
+
artifact: unknown;
|
|
54
|
+
indexed: Kcc20IndexedFeeReceipt;
|
|
55
|
+
live: Kcc20LiveFeeReceiptUtxo;
|
|
56
|
+
expected: Kcc20FeeReceiptIdentity;
|
|
57
|
+
}): {
|
|
58
|
+
receipt: Kcc20FeeReceiptAmounts;
|
|
59
|
+
redeemScript: Uint8Array;
|
|
60
|
+
escrowTemplate: {
|
|
61
|
+
hash: string;
|
|
62
|
+
prefixLength: number;
|
|
63
|
+
suffixLength: number;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** Authenticate a fee-account hint against the pinned escrow artifact and a fresh node UTXO. */
|
|
67
|
+
export declare function verifyKcc20FeeAccountForClaim(input: {
|
|
68
|
+
artifact: unknown;
|
|
69
|
+
indexed: Kcc20IndexedFeeReceipt;
|
|
70
|
+
live: Kcc20LiveFeeReceiptUtxo;
|
|
71
|
+
expected: {
|
|
72
|
+
tokenId: string;
|
|
73
|
+
marketId: string;
|
|
74
|
+
policyId: string;
|
|
75
|
+
accountId: string;
|
|
76
|
+
};
|
|
77
|
+
}): {
|
|
78
|
+
account: Kcc20FeeClaimAccount;
|
|
79
|
+
redeemScript: Uint8Array;
|
|
80
|
+
escrowTemplate: {
|
|
81
|
+
hash: string;
|
|
82
|
+
prefixLength: number;
|
|
83
|
+
suffixLength: number;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/** Verify an unbound account before its one-time market binding. */
|
|
87
|
+
export declare function verifyKcc20UnboundFeeAccountForBinding(input: {
|
|
88
|
+
artifact: unknown;
|
|
89
|
+
indexed: Kcc20IndexedFeeReceipt;
|
|
90
|
+
live: Kcc20LiveFeeReceiptUtxo;
|
|
91
|
+
expected: {
|
|
92
|
+
tokenId: string;
|
|
93
|
+
accountId: string;
|
|
94
|
+
};
|
|
95
|
+
}): {
|
|
96
|
+
account: Kcc20FeeClaimAccount;
|
|
97
|
+
redeemScript: Uint8Array;
|
|
98
|
+
escrowTemplate: {
|
|
99
|
+
hash: string;
|
|
100
|
+
prefixLength: number;
|
|
101
|
+
suffixLength: number;
|
|
102
|
+
};
|
|
103
|
+
};
|