@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.
Files changed (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/RELEASING.md +8 -7
  3. package/dist/cjs/engine.js +252 -0
  4. package/dist/cjs/engine.js.map +1 -1
  5. package/dist/cjs/escrow-account-setup.d.ts +53 -0
  6. package/dist/cjs/escrow-account-setup.js +103 -0
  7. package/dist/cjs/escrow-account-setup.js.map +1 -0
  8. package/dist/cjs/escrow-claim-plan.d.ts +74 -0
  9. package/dist/cjs/escrow-claim-plan.js +98 -0
  10. package/dist/cjs/escrow-claim-plan.js.map +1 -0
  11. package/dist/cjs/escrow-receipt.d.ts +103 -0
  12. package/dist/cjs/escrow-receipt.js +293 -0
  13. package/dist/cjs/escrow-receipt.js.map +1 -0
  14. package/dist/cjs/index.d.ts +3 -0
  15. package/dist/cjs/index.js +3 -0
  16. package/dist/cjs/index.js.map +1 -1
  17. package/dist/cjs/operations.d.ts +1 -1
  18. package/dist/cjs/operations.js +2 -0
  19. package/dist/cjs/operations.js.map +1 -1
  20. package/dist/engine.d.ts.map +1 -1
  21. package/dist/engine.js +252 -0
  22. package/dist/engine.js.map +1 -1
  23. package/dist/escrow-account-setup.d.ts +54 -0
  24. package/dist/escrow-account-setup.d.ts.map +1 -0
  25. package/dist/escrow-account-setup.js +99 -0
  26. package/dist/escrow-account-setup.js.map +1 -0
  27. package/dist/escrow-claim-plan.d.ts +75 -0
  28. package/dist/escrow-claim-plan.d.ts.map +1 -0
  29. package/dist/escrow-claim-plan.js +95 -0
  30. package/dist/escrow-claim-plan.js.map +1 -0
  31. package/dist/escrow-receipt.d.ts +104 -0
  32. package/dist/escrow-receipt.d.ts.map +1 -0
  33. package/dist/escrow-receipt.js +287 -0
  34. package/dist/escrow-receipt.js.map +1 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +3 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/operations.d.ts +1 -1
  40. package/dist/operations.d.ts.map +1 -1
  41. package/dist/operations.js +2 -0
  42. package/dist/operations.js.map +1 -1
  43. package/docs/COMPATIBILITY.json +1 -1
  44. package/docs/escrow-fees.md +47 -3
  45. package/package.json +3 -3
  46. package/src/engine.ts +292 -0
  47. package/src/escrow-account-setup.ts +124 -0
  48. package/src/escrow-claim-plan.ts +130 -0
  49. package/src/escrow-receipt.ts +333 -0
  50. package/src/index.ts +3 -0
  51. package/src/operations.ts +2 -0
@@ -0,0 +1,287 @@
1
+ import { blake2b } from "@noble/hashes/blake2b";
2
+ import { sha256 } from "@noble/hashes/sha256";
3
+ import { assertKcc20ArtifactScriptHash } from "./artifacts.js";
4
+ import { normalizeSilverScriptArtifact, templateHash } from "./abi.js";
5
+ import { KCC20_ESCROW_MAX_INT, KCC20_ESCROW_MIN_FEE_SOMPI } from "./escrow-fee.js";
6
+ const ARTIFACT_KEY = "KCC20FeeEscrowV1.placeholder.json";
7
+ // SHA-256 of JSON.stringify(JSON.parse(the packaged artifact)). This pins the
8
+ // ABI and runtime-state layout as well as both copies of the compiled script.
9
+ const ARTIFACT_CANONICAL_SHA256 = "2ff79d6e8ca7176d6346ab7523c72b789f7238865cd9d3b056c83a8af1b5b2cd";
10
+ const STATE_START = 1;
11
+ const STATE_LENGTH = 362;
12
+ const ZERO = "00".repeat(32);
13
+ const FIELDS = [
14
+ ["role", "int"], ["token", "bytes32"], ["market", "bytes32"],
15
+ ["policy", "bytes32"], ["protocol_account", "bytes32"],
16
+ ["creator_account", "bytes32"], ["protocol_amount", "int"],
17
+ ["creator_amount", "int"], ["owner", "bytes32"],
18
+ ["owner_scheme", "byte"], ["guard_template", "bytes32"],
19
+ ["guard_prefix", "int"], ["guard_suffix", "int"],
20
+ ["action_hash", "bytes32"], ["self_template", "bytes32"],
21
+ ["self_prefix", "int"], ["self_suffix", "int"],
22
+ ];
23
+ function hex32(value, name) {
24
+ if (typeof value !== "string" || !/^[0-9a-f]{64}$/i.test(value))
25
+ throw new Error(`${name} must be 32-byte hex`);
26
+ return value.toLowerCase();
27
+ }
28
+ function natural(value, name) {
29
+ if (typeof value !== "string" || !/^(0|[1-9]\d*)$/.test(value))
30
+ throw new Error(`${name} must be a canonical decimal string`);
31
+ const result = BigInt(value);
32
+ if (result > KCC20_ESCROW_MAX_INT)
33
+ throw new Error(`${name} exceeds the contract range`);
34
+ return result;
35
+ }
36
+ function bytes(value, name) {
37
+ const text = hex32(value, name);
38
+ return Uint8Array.from(text.match(/../g).map(part => Number.parseInt(part, 16)));
39
+ }
40
+ function encodeState(state) {
41
+ const encoded = [];
42
+ for (const [name, kind] of FIELDS) {
43
+ let field;
44
+ if (kind === "bytes32")
45
+ field = bytes(state[name], name);
46
+ else if (kind === "byte") {
47
+ const value = state[name];
48
+ if (!Number.isInteger(value) || value < 0 || value > 255)
49
+ throw new Error(`${name} must be a byte`);
50
+ field = Uint8Array.of(value);
51
+ }
52
+ else {
53
+ const value = natural(state[name], name);
54
+ field = new Uint8Array(8);
55
+ new DataView(field.buffer).setBigUint64(0, value, true);
56
+ }
57
+ encoded.push(field.length, ...field);
58
+ }
59
+ if (encoded.length !== STATE_LENGTH)
60
+ throw new Error("fee receipt state width mismatch");
61
+ return Uint8Array.from(encoded);
62
+ }
63
+ /** Render an escrow state using only the packaged, pinned v1 program. */
64
+ export function buildKcc20FeeEscrowScript(artifactInput, state) {
65
+ const artifactHash = Array.from(sha256(new TextEncoder().encode(JSON.stringify(artifactInput))), byte => byte.toString(16).padStart(2, "0")).join("");
66
+ if (artifactHash !== ARTIFACT_CANONICAL_SHA256)
67
+ throw new Error("fee escrow artifact metadata mismatch");
68
+ const artifact = normalizeSilverScriptArtifact(artifactInput);
69
+ assertKcc20ArtifactScriptHash(ARTIFACT_KEY, artifact);
70
+ if (artifact.contract_name !== "KCC20FeeEscrowV1" ||
71
+ artifact.state_layout?.start !== STATE_START || artifact.state_layout?.len !== STATE_LENGTH) {
72
+ throw new Error("unsupported fee escrow artifact layout");
73
+ }
74
+ const base = Uint8Array.from(artifact.script);
75
+ const prefix = base.slice(0, STATE_START);
76
+ const suffix = base.slice(STATE_START + STATE_LENGTH);
77
+ const hash = Array.from(templateHash(prefix, suffix), byte => byte.toString(16).padStart(2, "0")).join("");
78
+ if (hex32(state.self_template, "self_template") !== hash ||
79
+ natural(state.self_prefix, "self_prefix") !== BigInt(prefix.length) ||
80
+ natural(state.self_suffix, "self_suffix") !== BigInt(suffix.length)) {
81
+ throw new Error("fee escrow self-template mismatch");
82
+ }
83
+ const redeemScript = new Uint8Array(prefix.length + STATE_LENGTH + suffix.length);
84
+ redeemScript.set(prefix);
85
+ redeemScript.set(encodeState(state), prefix.length);
86
+ redeemScript.set(suffix, prefix.length + STATE_LENGTH);
87
+ const scriptHash = Array.from(blake2b(redeemScript, { dkLen: 32 }), byte => byte.toString(16).padStart(2, "0")).join("");
88
+ return {
89
+ redeemScript,
90
+ scriptHash,
91
+ scriptPublicKey: { version: 0, scriptHex: `aa20${scriptHash}87` },
92
+ escrowTemplate: { hash, prefixLength: prefix.length, suffixLength: suffix.length },
93
+ };
94
+ }
95
+ /**
96
+ * Check a receipt hint against the pinned program and a fresh node UTXO.
97
+ * The caller must fetch `live` from a qualified canonical node, authenticate
98
+ * the market root/policy, and refresh the UTXO again before signing.
99
+ */
100
+ export function verifyKcc20FeeReceiptForClaim(input) {
101
+ const artifactHash = Array.from(sha256(new TextEncoder().encode(JSON.stringify(input.artifact))), byte => byte.toString(16).padStart(2, "0")).join("");
102
+ if (artifactHash !== ARTIFACT_CANONICAL_SHA256)
103
+ throw new Error("fee receipt artifact metadata mismatch");
104
+ const artifact = normalizeSilverScriptArtifact(input.artifact);
105
+ assertKcc20ArtifactScriptHash(ARTIFACT_KEY, artifact);
106
+ if (artifact.contract_name !== "KCC20FeeEscrowV1" ||
107
+ artifact.state_layout?.start !== STATE_START || artifact.state_layout?.len !== STATE_LENGTH) {
108
+ throw new Error("unsupported fee receipt artifact layout");
109
+ }
110
+ const base = Uint8Array.from(artifact.script);
111
+ const prefix = base.slice(0, STATE_START);
112
+ const suffix = base.slice(STATE_START + STATE_LENGTH);
113
+ const state = input.indexed.state;
114
+ if (!state || Array.isArray(state) || typeof state !== "object")
115
+ throw new Error("missing indexed fee receipt state");
116
+ const expected = input.expected;
117
+ const tokenId = hex32(expected.tokenId, "expected token");
118
+ const marketId = hex32(expected.marketId, "expected market");
119
+ const policyId = hex32(expected.policyId, "expected policy");
120
+ const protocolAccountId = hex32(expected.protocolAccountId, "expected protocol account");
121
+ const creatorAccountId = hex32(expected.creatorAccountId, "expected creator account");
122
+ if ([tokenId, marketId, policyId, protocolAccountId].includes(ZERO) ||
123
+ protocolAccountId === creatorAccountId)
124
+ throw new Error("invalid fee receipt identity");
125
+ for (const [name, value] of [
126
+ ["token", tokenId], ["market", marketId], ["policy", policyId],
127
+ ["protocol_account", protocolAccountId], ["creator_account", creatorAccountId],
128
+ ]) {
129
+ if (hex32(state[name], name) !== hex32(value, `expected ${name}`))
130
+ throw new Error(`fee receipt ${name} mismatch`);
131
+ }
132
+ if (state.role !== "0" || state.roleName !== "receipt" || state.owner_scheme !== 0 ||
133
+ state.owner !== ZERO || state.guard_template !== ZERO ||
134
+ state.guard_prefix !== "0" || state.guard_suffix !== "0") {
135
+ throw new Error("invalid fee receipt role or owner state");
136
+ }
137
+ const selfHash = Array.from(templateHash(prefix, suffix), byte => byte.toString(16).padStart(2, "0")).join("");
138
+ if (state.self_template !== selfHash || state.self_prefix !== String(prefix.length) ||
139
+ state.self_suffix !== String(suffix.length)) {
140
+ throw new Error("fee receipt self-template mismatch");
141
+ }
142
+ const protocol = natural(state.protocol_amount, "protocol_amount");
143
+ const creator = natural(state.creator_amount, "creator_amount");
144
+ const total = protocol + creator;
145
+ if (total === 0n || total > KCC20_ESCROW_MAX_INT ||
146
+ (protocol > 0n && protocol < KCC20_ESCROW_MIN_FEE_SOMPI) ||
147
+ (creator > 0n && creator < KCC20_ESCROW_MIN_FEE_SOMPI) ||
148
+ (creatorAccountId === ZERO && creator !== 0n)) {
149
+ throw new Error("invalid fee receipt entitlements");
150
+ }
151
+ if (input.indexed.status !== "active" || input.indexed.spentByTxidHex)
152
+ throw new Error("fee receipt is not active");
153
+ const txid = hex32(input.indexed.txidHex, "indexed txid");
154
+ if (!Number.isInteger(input.indexed.vout) || input.indexed.vout < 0 || input.indexed.vout > 0xffffffff ||
155
+ txid !== hex32(input.live.outpoint.transactionId, "live txid") || input.indexed.vout !== input.live.outpoint.index) {
156
+ throw new Error("fee receipt outpoint mismatch");
157
+ }
158
+ if (hex32(input.indexed.covenantIdHex, "indexed covenant") !== hex32(expected.marketId, "expected market") ||
159
+ hex32(input.live.covenantIdHex, "live covenant") !== hex32(expected.marketId, "expected market")) {
160
+ throw new Error("fee receipt covenant lineage mismatch");
161
+ }
162
+ if (natural(input.indexed.amountSompiExact, "indexed amount") !== total || input.live.amountSompi !== total) {
163
+ throw new Error("fee receipt amount mismatch");
164
+ }
165
+ const stateBytes = encodeState(state);
166
+ const redeemScript = new Uint8Array(prefix.length + stateBytes.length + suffix.length);
167
+ redeemScript.set(prefix);
168
+ redeemScript.set(stateBytes, prefix.length);
169
+ redeemScript.set(suffix, prefix.length + stateBytes.length);
170
+ const scriptHash = Array.from(blake2b(redeemScript, { dkLen: 32 }), byte => byte.toString(16).padStart(2, "0")).join("");
171
+ if (hex32(input.indexed.scriptHashHex, "indexed script hash") !== scriptHash ||
172
+ input.live.scriptPublicKey.version !== 0 ||
173
+ input.live.scriptPublicKey.scriptHex.toLowerCase() !== `aa20${scriptHash}87`) {
174
+ throw new Error("fee receipt script hash mismatch");
175
+ }
176
+ return {
177
+ receipt: {
178
+ outpoint: { transactionId: txid, index: input.indexed.vout },
179
+ tokenId, marketId, policyId, protocolAccountId, creatorAccountId,
180
+ valueSompi: total, protocolSompi: protocol, creatorSompi: creator,
181
+ },
182
+ redeemScript,
183
+ escrowTemplate: { hash: selfHash, prefixLength: prefix.length, suffixLength: suffix.length },
184
+ };
185
+ }
186
+ /** Authenticate a fee-account hint against the pinned escrow artifact and a fresh node UTXO. */
187
+ export function verifyKcc20FeeAccountForClaim(input) {
188
+ return verifyFeeAccount(input, false);
189
+ }
190
+ /** Verify an unbound account before its one-time market binding. */
191
+ export function verifyKcc20UnboundFeeAccountForBinding(input) {
192
+ return verifyFeeAccount({
193
+ ...input,
194
+ expected: { ...input.expected, marketId: ZERO, policyId: ZERO },
195
+ }, true);
196
+ }
197
+ function verifyFeeAccount(input, requireUnbound) {
198
+ const artifactHash = Array.from(sha256(new TextEncoder().encode(JSON.stringify(input.artifact))), byte => byte.toString(16).padStart(2, "0")).join("");
199
+ if (artifactHash !== ARTIFACT_CANONICAL_SHA256)
200
+ throw new Error("fee account artifact metadata mismatch");
201
+ const artifact = normalizeSilverScriptArtifact(input.artifact);
202
+ assertKcc20ArtifactScriptHash(ARTIFACT_KEY, artifact);
203
+ if (artifact.contract_name !== "KCC20FeeEscrowV1" ||
204
+ artifact.state_layout?.start !== STATE_START || artifact.state_layout?.len !== STATE_LENGTH) {
205
+ throw new Error("unsupported fee account artifact layout");
206
+ }
207
+ const base = Uint8Array.from(artifact.script);
208
+ const prefix = base.slice(0, STATE_START);
209
+ const suffix = base.slice(STATE_START + STATE_LENGTH);
210
+ const state = input.indexed.state;
211
+ if (!state || Array.isArray(state) || typeof state !== "object")
212
+ throw new Error("missing indexed fee account state");
213
+ const tokenId = hex32(input.expected.tokenId, "expected token");
214
+ const marketId = hex32(input.expected.marketId, "expected market");
215
+ const policyId = hex32(input.expected.policyId, "expected policy");
216
+ const accountId = hex32(input.expected.accountId, "expected account");
217
+ if (tokenId === ZERO || accountId === ZERO ||
218
+ (requireUnbound ? (marketId !== ZERO || policyId !== ZERO) : (marketId === ZERO || policyId === ZERO))) {
219
+ throw new Error("invalid fee account identity");
220
+ }
221
+ for (const [name, expected] of [["token", tokenId], ["market", marketId], ["policy", policyId]]) {
222
+ if (hex32(state[name], name) !== expected)
223
+ throw new Error(`fee account ${name} mismatch`);
224
+ }
225
+ if (state.role !== "1" || state.roleName !== "account" ||
226
+ hex32(state.protocol_account, "protocol_account") !== ZERO ||
227
+ hex32(state.creator_account, "creator_account") !== ZERO ||
228
+ natural(state.protocol_amount, "protocol_amount") !== 0n ||
229
+ natural(state.creator_amount, "creator_amount") !== 0n ||
230
+ hex32(state.owner, "owner") === ZERO ||
231
+ !Number.isInteger(state.owner_scheme) || state.owner_scheme < 0 ||
232
+ state.owner_scheme > 4) {
233
+ throw new Error("invalid fee account role or owner state");
234
+ }
235
+ const guard = hex32(state.guard_template, "guard_template");
236
+ const guardPrefix = natural(state.guard_prefix, "guard_prefix");
237
+ const guardSuffix = natural(state.guard_suffix, "guard_suffix");
238
+ const scheme = state.owner_scheme;
239
+ if ((scheme <= 2 && (guard !== ZERO || guardPrefix !== 0n || guardSuffix !== 0n)) ||
240
+ (scheme === 3 && (guard === ZERO || guardPrefix !== 0n || guardSuffix !== 0n)) ||
241
+ (scheme === 4 && (guard === ZERO || guardPrefix === 0n || guardSuffix === 0n))) {
242
+ throw new Error("invalid fee account guard state");
243
+ }
244
+ hex32(state.action_hash, "action_hash");
245
+ if (requireUnbound && (scheme !== 0 || state.action_hash !== ZERO)) {
246
+ throw new Error("unbound fee account must have its initial owner and action state");
247
+ }
248
+ const selfHash = Array.from(templateHash(prefix, suffix), byte => byte.toString(16).padStart(2, "0")).join("");
249
+ if (hex32(state.self_template, "self_template") !== selfHash ||
250
+ natural(state.self_prefix, "self_prefix") !== BigInt(prefix.length) ||
251
+ natural(state.self_suffix, "self_suffix") !== BigInt(suffix.length)) {
252
+ throw new Error("fee account self-template mismatch");
253
+ }
254
+ if (input.indexed.status !== "active" || input.indexed.spentByTxidHex)
255
+ throw new Error("fee account is not active");
256
+ const txid = hex32(input.indexed.txidHex, "indexed txid");
257
+ if (!Number.isInteger(input.indexed.vout) || input.indexed.vout < 0 || input.indexed.vout > 0xffffffff ||
258
+ txid !== hex32(input.live.outpoint.transactionId, "live txid") || input.indexed.vout !== input.live.outpoint.index ||
259
+ hex32(input.indexed.covenantIdHex, "indexed covenant") !== accountId ||
260
+ hex32(input.live.covenantIdHex, "live covenant") !== accountId) {
261
+ throw new Error("fee account outpoint or lineage mismatch");
262
+ }
263
+ const principal = natural(input.indexed.amountSompiExact, "account principal");
264
+ if (principal === 0n || input.live.amountSompi !== principal)
265
+ throw new Error("fee account principal mismatch");
266
+ const stateBytes = encodeState(state);
267
+ const redeemScript = new Uint8Array(prefix.length + stateBytes.length + suffix.length);
268
+ redeemScript.set(prefix);
269
+ redeemScript.set(stateBytes, prefix.length);
270
+ redeemScript.set(suffix, prefix.length + stateBytes.length);
271
+ const scriptHash = Array.from(blake2b(redeemScript, { dkLen: 32 }), byte => byte.toString(16).padStart(2, "0")).join("");
272
+ if (hex32(input.indexed.scriptHashHex, "indexed script hash") !== scriptHash ||
273
+ input.live.scriptPublicKey.version !== 0 ||
274
+ input.live.scriptPublicKey.scriptHex.toLowerCase() !== `aa20${scriptHash}87`) {
275
+ throw new Error("fee account script hash mismatch");
276
+ }
277
+ return {
278
+ account: {
279
+ outpoint: { transactionId: txid, index: input.indexed.vout },
280
+ covenantId: accountId, principalSompi: principal,
281
+ state: state,
282
+ },
283
+ redeemScript,
284
+ escrowTemplate: { hash: selfHash, prefixLength: prefix.length, suffixLength: suffix.length },
285
+ };
286
+ }
287
+ //# sourceMappingURL=escrow-receipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escrow-receipt.js","sourceRoot":"","sources":["../src/escrow-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,UAA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CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,OAAO,UAAU,IAAI,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO;QACL,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;YAC5D,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS;YAChD,KAAK,EAAE,KAAwC;SAChD;QACD,YAAY;QACZ,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;KAC7F,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -21,6 +21,9 @@ export * from "./trade-fee.js";
21
21
  export * from "./escrow-fee.js";
22
22
  export * from "./escrow-policy.js";
23
23
  export * from "./escrow-group.js";
24
+ export * from "./escrow-receipt.js";
25
+ export * from "./escrow-claim-plan.js";
26
+ export * from "./escrow-account-setup.js";
24
27
  export * from "./trading-operation.js";
25
28
  export * from "./protocol.js";
26
29
  export * from "./runtime.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;A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,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,oBAAoB,MAAM,uCAAuC,CAAC;AAC9E,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -21,6 +21,9 @@ export * from "./trade-fee.js";
21
21
  export * from "./escrow-fee.js";
22
22
  export * from "./escrow-policy.js";
23
23
  export * from "./escrow-group.js";
24
+ export * from "./escrow-receipt.js";
25
+ export * from "./escrow-claim-plan.js";
26
+ export * from "./escrow-account-setup.js";
24
27
  export * from "./trading-operation.js";
25
28
  export * from "./protocol.js";
26
29
  export * from "./runtime.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"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A0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare const KCC20_BUILDER_KEYS: readonly ["kcc20.deploy-token", "kcc20.mint", "kcc20.set-public-mint-active", "kcc20.transfer", "kcc20.consolidate-holders", "kcc20.reveal-token", "kcc20wrapper.deploy-market", "kcc20wrapper.wrap", "kcc20wrapper.unwrap", "kcc20orderbook.create-bid", "kcc20orderbook.create-ask", "kcc20orderbook.fill-ask", "kcc20orderbook.fill-bid", "kcc20orderbook.sweep-asks", "kcc20orderbook.sweep-bids", "kcc20orderbook.consolidate-holders", "kcc20orderbook.cancel-ask", "kcc20orderbook.cancel-bid", "fee-ticket.deploy-root", "fee-ticket.update-denomination", "fee-ticket.create-from-utility-burn", "fee-ticket.burn", "fee-ticket.transfer", "kcc20-snapshot.deploy-bootstrap", "kcc20-snapshot.deploy-controller", "kcc20-snapshot.start", "kcc20-snapshot.claim"];
1
+ export declare const KCC20_BUILDER_KEYS: readonly ["kcc20.deploy-token", "kcc20.mint", "kcc20.set-public-mint-active", "kcc20.transfer", "kcc20.consolidate-holders", "kcc20.reveal-token", "kcc20wrapper.deploy-market", "kcc20wrapper.wrap", "kcc20wrapper.unwrap", "kcc20orderbook.create-bid", "kcc20orderbook.create-ask", "kcc20orderbook.fill-ask", "kcc20orderbook.fill-bid", "kcc20orderbook.sweep-asks", "kcc20orderbook.sweep-bids", "kcc20orderbook.consolidate-holders", "kcc20orderbook.cancel-ask", "kcc20orderbook.cancel-bid", "fee-ticket.deploy-root", "fee-ticket.update-denomination", "fee-ticket.create-from-utility-burn", "fee-ticket.burn", "fee-ticket.transfer", "kcc20fee.create-account", "kcc20fee.bind-account", "kcc20-snapshot.deploy-bootstrap", "kcc20-snapshot.deploy-controller", "kcc20-snapshot.start", "kcc20-snapshot.claim"];
2
2
  export type Kcc20BuilderKey = (typeof KCC20_BUILDER_KEYS)[number];
3
3
  export declare function isKcc20BuilderKey(value: string): value is Kcc20BuilderKey;
4
4
  export declare const BACKEND_ONLY_BUILDER_KEYS: readonly ["kcc20orderbook.matcher-settle-crossed"];
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,4uBA4BrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAED,eAAO,MAAM,yBAAyB,oDAE5B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAKhC"}
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,gyBA8BrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAED,eAAO,MAAM,yBAAyB,oDAE5B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAKhC"}
@@ -22,6 +22,8 @@ export const KCC20_BUILDER_KEYS = [
22
22
  "fee-ticket.create-from-utility-burn",
23
23
  "fee-ticket.burn",
24
24
  "fee-ticket.transfer",
25
+ "kcc20fee.create-account",
26
+ "kcc20fee.bind-account",
25
27
  "kcc20-snapshot.deploy-bootstrap",
26
28
  "kcc20-snapshot.deploy-controller",
27
29
  "kcc20-snapshot.start",
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,YAAY;IACZ,8BAA8B;IAC9B,gBAAgB;IAChB,2BAA2B;IAC3B,oBAAoB;IACpB,4BAA4B;IAC5B,mBAAmB;IACnB,qBAAqB;IACrB,2BAA2B;IAC3B,2BAA2B;IAC3B,yBAAyB;IACzB,yBAAyB;IACzB,2BAA2B;IAC3B,2BAA2B;IAC3B,oCAAoC;IACpC,2BAA2B;IAC3B,2BAA2B;IAC3B,wBAAwB;IACxB,gCAAgC;IAChC,qCAAqC;IACrC,iBAAiB;IACjB,qBAAqB;IACrB,iCAAiC;IACjC,kCAAkC;IAClC,sBAAsB;IACtB,sBAAsB;CACd,CAAC;AAIX,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAQ,kBAAwC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,uCAAuC;CAC/B,CAAC;AAIX,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACxB,yBAA+C,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,YAAY;IACZ,8BAA8B;IAC9B,gBAAgB;IAChB,2BAA2B;IAC3B,oBAAoB;IACpB,4BAA4B;IAC5B,mBAAmB;IACnB,qBAAqB;IACrB,2BAA2B;IAC3B,2BAA2B;IAC3B,yBAAyB;IACzB,yBAAyB;IACzB,2BAA2B;IAC3B,2BAA2B;IAC3B,oCAAoC;IACpC,2BAA2B;IAC3B,2BAA2B;IAC3B,wBAAwB;IACxB,gCAAgC;IAChC,qCAAqC;IACrC,iBAAiB;IACjB,qBAAqB;IACrB,yBAAyB;IACzB,uBAAuB;IACvB,iCAAiC;IACjC,kCAAkC;IAClC,sBAAsB;IACtB,sBAAsB;CACd,CAAC;AAIX,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAQ,kBAAwC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,uCAAuC;CAC/B,CAAC;AAIX,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACxB,yBAA+C,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjE,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "kcc20-example-compatibility/v1",
3
- "packageVersion": "0.8.0-fee.1",
3
+ "packageVersion": "0.8.0-fee.3",
4
4
  "contractsRepository": "https://github.com/KASPACOM/kaspa-covenants",
5
5
  "contractsCommit": "5deb1769e69142595576ef7c573af9f433a48a3c",
6
6
  "compiler": {
@@ -1,8 +1,33 @@
1
1
  # Experimental fee escrow primitives
2
2
 
3
- These exports support the new DEV fee-market contracts. Existing transaction
4
- construction still uses the legacy fee version. These functions do not build,
5
- authorize or submit escrow spends, and this change does not publish a package.
3
+ These exports support the new DEV fee-market contracts. Existing trading
4
+ transactions still use the legacy fee version. New fee-market creation remains
5
+ disabled, and this change does not publish a package.
6
+
7
+ ## Fee account setup
8
+
9
+ `kcc20fee.create-account` builds a version 1 PSKT with one unbound fee-account
10
+ genesis output and a separate wallet change output. The caller supplies the
11
+ native token ID and account principal in sompi. The connected wallet's Schnorr
12
+ public key controls the account. The builder pins the escrow artifact, checks
13
+ the key, computes the account covenant ID, and checks the signed transaction's
14
+ fee and mass before returning the PSKT. The wallet signs the funding input.
15
+
16
+ The creation result includes `metadata.accountGenesisHint`. Save it with the
17
+ broadcast result and add the accepted transaction ID as `txidHex`. An unspent
18
+ P2SH genesis output does not reveal its account state to the indexer.
19
+
20
+ `kcc20fee.bind-account` accepts that saved `accountGenesisHint`, or an
21
+ equivalent active account record, plus the token, account, market and policy
22
+ IDs. It fetches the current account UTXO from the node and checks its script,
23
+ lineage, outpoint and principal against the pinned artifact. The wallet signs
24
+ the account input and a separate funding input. The bound output keeps the
25
+ same account ID and exact principal. Binding is a one-time operation; later
26
+ authority changes use the contract's rotation path.
27
+
28
+ These operations prepare wallet-signable transactions. They do not broadcast
29
+ or establish funded TN10 execution. Account creation and binding are only the
30
+ first setup steps; trading, claims and rotation still need signed builders.
6
31
 
7
32
  `calculateKcc20EscrowFees` implements the fixed 1% protocol fee and optional
8
33
  0–5% creator fee. Each nonzero share has a 0.5 KAS minimum, applied per fill.
@@ -30,6 +55,25 @@ claim and retained amounts. This does not establish that the receipts exist,
30
55
  are unspent or have authenticated scripts. Construction must revalidate all
31
56
  inputs against current chain state and the approved artifacts.
32
57
 
58
+ `verifyKcc20FeeReceiptForClaim` reconstructs an indexed receipt from the
59
+ pinned escrow artifact and compares its exact script, covenant lineage,
60
+ outpoint and value with a UTXO supplied from the canonical node. The caller
61
+ must authenticate the market policy, obtain a fresh node result and check the
62
+ UTXO again immediately before signing. This helper does not build or authorize
63
+ a claim.
64
+
65
+ `verifyKcc20FeeAccountForClaim` makes the equivalent check for the fee account,
66
+ including its owner scheme, guard, principal and exact script. Pass the pinned
67
+ receipt template to the claim planner and preserve the selected receipts' order
68
+ as the transaction's covenant input order. Both helpers trust the caller to
69
+ obtain canonical fresh UTXOs; they cannot establish source quality themselves.
70
+
71
+ `planKcc20FeeClaimTransition` calculates the claimant payout, unchanged
72
+ account principal, account continuation and any receipt left for the other
73
+ party. Its inputs still require live UTXO checks and account authorization.
74
+ The plan does not select funding, sign or estimate transaction mass. It rejects
75
+ an account whose program template differs from the verified receipt template.
76
+
33
77
  `encodeKcc20EscrowPolicy` and `decodeKcc20EscrowPolicy` implement the fixed
34
78
  361-byte role policy, with receipt, root, holder, ask, bid and FeeTicket
35
79
  template tuples in that order. They reject unsupported versions, noncanonical
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaspacom/kcc20-tx-builder",
3
- "version": "0.8.0-fee.1",
3
+ "version": "0.8.0-fee.3",
4
4
  "description": "Runtime-independent KCC20 covenant transaction and PSKT construction primitives.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "KaspaCom",
@@ -88,8 +88,8 @@
88
88
  "scripts": {
89
89
  "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/write-cjs-package.mjs",
90
90
  "typecheck": "tsc -p tsconfig.json --noEmit",
91
- "test:escrow-fee": "npm run build && node --test test/escrow-fee.mjs test/escrow-policy.mjs test/escrow-group.mjs",
92
- "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 test/escrow-fee.mjs test/escrow-policy.mjs test/escrow-group.mjs && node test/pinned-funding.mjs",
91
+ "test:escrow-fee": "npm run build && node --test test/escrow-fee.mjs test/escrow-policy.mjs test/escrow-group.mjs test/escrow-receipt.mjs test/escrow-claim-plan.mjs test/escrow-account-setup.mjs test/escrow-account-bind-pskt.mjs",
92
+ "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 test/escrow-fee.mjs test/escrow-policy.mjs test/escrow-group.mjs test/escrow-receipt.mjs test/escrow-claim-plan.mjs test/escrow-account-setup.mjs test/escrow-account-bind-pskt.mjs && node test/pinned-funding.mjs",
93
93
  "prepack": "npm test",
94
94
  "test:examples": "npm run verify:compatibility && node scripts/test-examples.mjs --browser",
95
95
  "verify:compatibility": "node scripts/verify-compatibility.mjs",