@kaspacom/kcc20-tx-builder 0.8.0-fee.4 → 0.8.0-fee.5
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 +6 -0
- package/RELEASING.md +10 -0
- package/artifacts/KCC20FeePolicyV1.manifest.json +4 -4
- package/artifacts/KCC20WrapperFeeArgentV1.placeholder.json +1816 -360
- package/artifacts/KCC20WrapperFeeV1.placeholder.json +1818 -362
- package/dist/artifacts.d.ts +5 -5
- package/dist/artifacts.js +5 -5
- package/dist/cjs/artifacts.d.ts +5 -5
- package/dist/cjs/artifacts.js +5 -5
- package/dist/cjs/engine.js +2770 -0
- package/dist/cjs/engine.js.map +1 -1
- package/dist/cjs/escrow-market-artifacts.d.ts +90 -0
- package/dist/cjs/escrow-market-artifacts.js +128 -0
- package/dist/cjs/escrow-market-artifacts.js.map +1 -0
- package/dist/cjs/escrow-market-setup.d.ts +429 -0
- package/dist/cjs/escrow-market-setup.js +140 -0
- package/dist/cjs/escrow-market-setup.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/operations.d.ts +1 -1
- package/dist/cjs/operations.js +12 -0
- package/dist/cjs/operations.js.map +1 -1
- package/dist/cjs/sale-common.d.ts +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +2770 -0
- package/dist/engine.js.map +1 -1
- package/dist/escrow-market-artifacts.d.ts +91 -0
- package/dist/escrow-market-artifacts.d.ts.map +1 -0
- package/dist/escrow-market-artifacts.js +124 -0
- package/dist/escrow-market-artifacts.js.map +1 -0
- package/dist/escrow-market-setup.d.ts +430 -0
- package/dist/escrow-market-setup.d.ts.map +1 -0
- package/dist/escrow-market-setup.js +133 -0
- package/dist/escrow-market-setup.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -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 +12 -0
- package/dist/operations.js.map +1 -1
- package/dist/sale-common.d.ts +1 -1
- package/docs/COMPATIBILITY.json +1 -1
- package/package.json +3 -3
- package/src/artifacts.ts +5 -5
- package/src/engine.ts +2986 -0
- package/src/escrow-market-artifacts.ts +129 -0
- package/src/escrow-market-setup.ts +182 -0
- package/src/index.ts +2 -0
- package/src/operations.ts +12 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type Kcc20EscrowPolicy } from "./escrow-policy.js";
|
|
2
|
+
declare const PINS: {
|
|
3
|
+
readonly receipt: readonly ["KCC20FeeEscrowV1.placeholder.json", "KCC20FeeEscrowV1", "2ff79d6e8ca7176d6346ab7523c72b789f7238865cd9d3b056c83a8af1b5b2cd"];
|
|
4
|
+
readonly root: readonly ["KCC20OrderbookFeeRootV1.placeholder.json", "KCC20OrderbookFeeRootV1", "4f913975eebb0342272912573b9901f84551d9f421b80608c0b872a42479c011"];
|
|
5
|
+
readonly holder: readonly ["KCC20OrderbookFeeHolderV1.placeholder.json", "KCC20OrderbookFeeHolderV1", "78a3fe1ef7a4d7ae142ab78a3a71cef2c1a70ea638cd695e89ea891dd17eec67"];
|
|
6
|
+
readonly ask: readonly ["KCC20OrderbookFeeAskV1.placeholder.json", "KCC20OrderbookFeeAskV1", "b60465af84c75121820323aa83155b6ddcfaae4bff2c64b06740058f5ebc0f95"];
|
|
7
|
+
readonly bid: readonly ["KCC20OrderbookFeeBidV1.placeholder.json", "KCC20OrderbookFeeBidV1", "98d7c97319bbe1ca954c7f4f6a02467e90a7f3e84c14c91db650f8ef5887ee0e"];
|
|
8
|
+
readonly ticket: readonly ["KCC20FeeTicket.placeholder.json", "KCC20FeeTicket", "289f3f74914deb383d2cccc11128187a77e4bcea90e61c83e05d86c5c9d63bc5"];
|
|
9
|
+
readonly wrapper: readonly ["KCC20WrapperFeeV1.placeholder.json", "KCC20WrapperFeeV1", "84c3844493efd4bdf6b2e3435e1ac511f5b5a7f58b5b6c093c91e2edcae1a2e0"];
|
|
10
|
+
readonly argentWrapper: readonly ["KCC20WrapperFeeArgentV1.placeholder.json", "KCC20WrapperFeeArgentV1", "130f25462e070523821579d28809577fac6d010f8d5deabc66ad2de1c11d2c73"];
|
|
11
|
+
};
|
|
12
|
+
export type Kcc20FeeArtifactRole = keyof typeof PINS;
|
|
13
|
+
export type Kcc20FeeArtifactSet = {
|
|
14
|
+
[K in Kcc20FeeArtifactRole]: unknown;
|
|
15
|
+
};
|
|
16
|
+
/** Render a pinned versioned role with exact SilverScript runtime-state encoding. */
|
|
17
|
+
export declare function buildKcc20FeeMarketRoleScript(input: {
|
|
18
|
+
artifact: unknown;
|
|
19
|
+
role: "root" | "holder" | "ask" | "bid" | "wrapper" | "argentWrapper";
|
|
20
|
+
state: Record<string, unknown>;
|
|
21
|
+
}): {
|
|
22
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
23
|
+
scriptHash: string;
|
|
24
|
+
scriptPublicKey: {
|
|
25
|
+
version: 0;
|
|
26
|
+
scriptHex: string;
|
|
27
|
+
};
|
|
28
|
+
template: {
|
|
29
|
+
hash: string;
|
|
30
|
+
prefixLength: number;
|
|
31
|
+
suffixLength: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** Check the compiled programs and immutable policy before any fee-market PSKT is built. */
|
|
35
|
+
export declare function verifyKcc20FeeMarketArtifacts(input: {
|
|
36
|
+
policy: Kcc20EscrowPolicy;
|
|
37
|
+
artifacts: Kcc20FeeArtifactSet;
|
|
38
|
+
wrapperProfile: "native" | "argent";
|
|
39
|
+
}): {
|
|
40
|
+
wrapper: {
|
|
41
|
+
prefix: Uint8Array<ArrayBuffer>;
|
|
42
|
+
suffix: Uint8Array<ArrayBuffer>;
|
|
43
|
+
prefixLength: number;
|
|
44
|
+
suffixLength: number;
|
|
45
|
+
hash: Uint8Array<ArrayBufferLike>;
|
|
46
|
+
};
|
|
47
|
+
receipt: {
|
|
48
|
+
prefix: Uint8Array<ArrayBuffer>;
|
|
49
|
+
suffix: Uint8Array<ArrayBuffer>;
|
|
50
|
+
prefixLength: number;
|
|
51
|
+
suffixLength: number;
|
|
52
|
+
hash: Uint8Array<ArrayBufferLike>;
|
|
53
|
+
};
|
|
54
|
+
root: {
|
|
55
|
+
prefix: Uint8Array<ArrayBuffer>;
|
|
56
|
+
suffix: Uint8Array<ArrayBuffer>;
|
|
57
|
+
prefixLength: number;
|
|
58
|
+
suffixLength: number;
|
|
59
|
+
hash: Uint8Array<ArrayBufferLike>;
|
|
60
|
+
};
|
|
61
|
+
holder: {
|
|
62
|
+
prefix: Uint8Array<ArrayBuffer>;
|
|
63
|
+
suffix: Uint8Array<ArrayBuffer>;
|
|
64
|
+
prefixLength: number;
|
|
65
|
+
suffixLength: number;
|
|
66
|
+
hash: Uint8Array<ArrayBufferLike>;
|
|
67
|
+
};
|
|
68
|
+
ask: {
|
|
69
|
+
prefix: Uint8Array<ArrayBuffer>;
|
|
70
|
+
suffix: Uint8Array<ArrayBuffer>;
|
|
71
|
+
prefixLength: number;
|
|
72
|
+
suffixLength: number;
|
|
73
|
+
hash: Uint8Array<ArrayBufferLike>;
|
|
74
|
+
};
|
|
75
|
+
bid: {
|
|
76
|
+
prefix: Uint8Array<ArrayBuffer>;
|
|
77
|
+
suffix: Uint8Array<ArrayBuffer>;
|
|
78
|
+
prefixLength: number;
|
|
79
|
+
suffixLength: number;
|
|
80
|
+
hash: Uint8Array<ArrayBufferLike>;
|
|
81
|
+
};
|
|
82
|
+
ticket: {
|
|
83
|
+
prefix: Uint8Array<ArrayBuffer>;
|
|
84
|
+
suffix: Uint8Array<ArrayBuffer>;
|
|
85
|
+
prefixLength: number;
|
|
86
|
+
suffixLength: number;
|
|
87
|
+
hash: Uint8Array<ArrayBufferLike>;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildKcc20FeeMarketRoleScript = buildKcc20FeeMarketRoleScript;
|
|
4
|
+
exports.verifyKcc20FeeMarketArtifacts = verifyKcc20FeeMarketArtifacts;
|
|
5
|
+
const sha256_1 = require("@noble/hashes/sha256");
|
|
6
|
+
const blake2b_1 = require("@noble/hashes/blake2b");
|
|
7
|
+
const abi_js_1 = require("./abi.js");
|
|
8
|
+
const artifacts_js_1 = require("./artifacts.js");
|
|
9
|
+
const escrow_policy_js_1 = require("./escrow-policy.js");
|
|
10
|
+
const PINS = {
|
|
11
|
+
receipt: ["KCC20FeeEscrowV1.placeholder.json", "KCC20FeeEscrowV1", "2ff79d6e8ca7176d6346ab7523c72b789f7238865cd9d3b056c83a8af1b5b2cd"],
|
|
12
|
+
root: ["KCC20OrderbookFeeRootV1.placeholder.json", "KCC20OrderbookFeeRootV1", "4f913975eebb0342272912573b9901f84551d9f421b80608c0b872a42479c011"],
|
|
13
|
+
holder: ["KCC20OrderbookFeeHolderV1.placeholder.json", "KCC20OrderbookFeeHolderV1", "78a3fe1ef7a4d7ae142ab78a3a71cef2c1a70ea638cd695e89ea891dd17eec67"],
|
|
14
|
+
ask: ["KCC20OrderbookFeeAskV1.placeholder.json", "KCC20OrderbookFeeAskV1", "b60465af84c75121820323aa83155b6ddcfaae4bff2c64b06740058f5ebc0f95"],
|
|
15
|
+
bid: ["KCC20OrderbookFeeBidV1.placeholder.json", "KCC20OrderbookFeeBidV1", "98d7c97319bbe1ca954c7f4f6a02467e90a7f3e84c14c91db650f8ef5887ee0e"],
|
|
16
|
+
ticket: ["KCC20FeeTicket.placeholder.json", "KCC20FeeTicket", "289f3f74914deb383d2cccc11128187a77e4bcea90e61c83e05d86c5c9d63bc5"],
|
|
17
|
+
wrapper: ["KCC20WrapperFeeV1.placeholder.json", "KCC20WrapperFeeV1", "84c3844493efd4bdf6b2e3435e1ac511f5b5a7f58b5b6c093c91e2edcae1a2e0"],
|
|
18
|
+
argentWrapper: ["KCC20WrapperFeeArgentV1.placeholder.json", "KCC20WrapperFeeArgentV1", "130f25462e070523821579d28809577fac6d010f8d5deabc66ad2de1c11d2c73"],
|
|
19
|
+
};
|
|
20
|
+
const POLICY_ROLES = ["receipt", "root", "holder", "ask", "bid", "ticket"];
|
|
21
|
+
function hex(bytes) {
|
|
22
|
+
return Array.from(bytes, byte => byte.toString(16).padStart(2, "0")).join("");
|
|
23
|
+
}
|
|
24
|
+
function fixedBytes(value, width, field) {
|
|
25
|
+
if (typeof value !== "string" || !new RegExp(`^[0-9a-fA-F]{${width * 2}}$`).test(value)) {
|
|
26
|
+
throw new Error(`${field} must be ${width}-byte hex`);
|
|
27
|
+
}
|
|
28
|
+
return Uint8Array.from(value.match(/../g), part => Number.parseInt(part, 16));
|
|
29
|
+
}
|
|
30
|
+
/** Render a pinned versioned role with exact SilverScript runtime-state encoding. */
|
|
31
|
+
function buildKcc20FeeMarketRoleScript(input) {
|
|
32
|
+
const [key, name, metadataHash] = PINS[input.role];
|
|
33
|
+
const raw = input.artifact;
|
|
34
|
+
if (!raw || typeof raw !== "object" ||
|
|
35
|
+
hex((0, sha256_1.sha256)(new TextEncoder().encode(JSON.stringify(raw)))) !== metadataHash) {
|
|
36
|
+
throw new Error(`${input.role} fee-market artifact metadata mismatch`);
|
|
37
|
+
}
|
|
38
|
+
const artifact = (0, abi_js_1.normalizeSilverScriptArtifact)(raw);
|
|
39
|
+
if (artifact.contract_name !== name)
|
|
40
|
+
throw new Error(`${input.role} contract mismatch`);
|
|
41
|
+
(0, artifacts_js_1.assertKcc20ArtifactScriptHash)(key, artifact);
|
|
42
|
+
const fields = Object.values(raw.contracts ?? {})[0]?.runtime_state?.fields;
|
|
43
|
+
if (!fields || Object.keys(input.state).length !== fields.length ||
|
|
44
|
+
fields.some(field => !Object.hasOwn(input.state, field.name))) {
|
|
45
|
+
throw new Error(`${input.role} runtime state fields mismatch`);
|
|
46
|
+
}
|
|
47
|
+
const encoded = [];
|
|
48
|
+
for (const field of fields) {
|
|
49
|
+
const value = input.state[field.name];
|
|
50
|
+
const { kind, len } = field.type;
|
|
51
|
+
let bytes;
|
|
52
|
+
if (kind === "fixed_bytes" && Number.isInteger(len) && len > 0) {
|
|
53
|
+
bytes = fixedBytes(value, len, field.name);
|
|
54
|
+
}
|
|
55
|
+
else if (kind === "bool" && typeof value === "boolean") {
|
|
56
|
+
bytes = Uint8Array.of(value ? 1 : 0);
|
|
57
|
+
}
|
|
58
|
+
else if (kind === "byte" && Number.isInteger(value) && Number(value) >= 0 && Number(value) <= 255) {
|
|
59
|
+
bytes = Uint8Array.of(Number(value));
|
|
60
|
+
}
|
|
61
|
+
else if (kind === "int" && typeof value === "string" && /^(0|[1-9]\d*)$/.test(value) &&
|
|
62
|
+
BigInt(value) <= (1n << 63n) - 1n) {
|
|
63
|
+
bytes = new Uint8Array(8);
|
|
64
|
+
new DataView(bytes.buffer).setBigUint64(0, BigInt(value), true);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new Error(`invalid ${input.role} state field ${field.name}`);
|
|
68
|
+
}
|
|
69
|
+
if (bytes.length <= 75)
|
|
70
|
+
encoded.push(bytes.length, ...bytes);
|
|
71
|
+
else if (bytes.length <= 65535)
|
|
72
|
+
encoded.push(77, bytes.length & 255, bytes.length >> 8, ...bytes);
|
|
73
|
+
else
|
|
74
|
+
throw new Error(`${field.name} exceeds script push size`);
|
|
75
|
+
}
|
|
76
|
+
const layout = artifact.state_layout;
|
|
77
|
+
if (!layout || encoded.length !== layout.len)
|
|
78
|
+
throw new Error(`${input.role} state width mismatch`);
|
|
79
|
+
const parts = (0, abi_js_1.templateParts)(artifact);
|
|
80
|
+
const redeemScript = Uint8Array.from([...parts.prefix, ...encoded, ...parts.suffix]);
|
|
81
|
+
const scriptHash = hex((0, blake2b_1.blake2b)(redeemScript, { dkLen: 32 }));
|
|
82
|
+
return {
|
|
83
|
+
redeemScript,
|
|
84
|
+
scriptHash,
|
|
85
|
+
scriptPublicKey: { version: 0, scriptHex: `aa20${scriptHash}87` },
|
|
86
|
+
template: { hash: hex(parts.hash), prefixLength: parts.prefixLength, suffixLength: parts.suffixLength },
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** Check the compiled programs and immutable policy before any fee-market PSKT is built. */
|
|
90
|
+
function verifyKcc20FeeMarketArtifacts(input) {
|
|
91
|
+
if ((0, escrow_policy_js_1.encodeKcc20EscrowPolicy)(input.policy).length !== 361) {
|
|
92
|
+
throw new Error("invalid fee-market policy width");
|
|
93
|
+
}
|
|
94
|
+
const verified = {};
|
|
95
|
+
for (const role of [...POLICY_ROLES, input.wrapperProfile === "native" ? "wrapper" : "argentWrapper"]) {
|
|
96
|
+
const artifact = input.artifacts[role];
|
|
97
|
+
const [key, name, metadataHash] = PINS[role];
|
|
98
|
+
if (!artifact || typeof artifact !== "object")
|
|
99
|
+
throw new Error(`missing ${role} fee-market artifact`);
|
|
100
|
+
const actualMetadataHash = hex((0, sha256_1.sha256)(new TextEncoder().encode(JSON.stringify(artifact))));
|
|
101
|
+
if (actualMetadataHash !== metadataHash)
|
|
102
|
+
throw new Error(`${role} fee-market artifact metadata mismatch`);
|
|
103
|
+
const normalized = (0, abi_js_1.normalizeSilverScriptArtifact)(artifact);
|
|
104
|
+
if (normalized.contract_name !== name)
|
|
105
|
+
throw new Error(`${role} fee-market artifact contract mismatch`);
|
|
106
|
+
(0, artifacts_js_1.assertKcc20ArtifactScriptHash)(key, normalized);
|
|
107
|
+
verified[role] = (0, abi_js_1.templateParts)(normalized);
|
|
108
|
+
}
|
|
109
|
+
for (const role of POLICY_ROLES) {
|
|
110
|
+
const actual = verified[role];
|
|
111
|
+
const expected = input.policy[`${role}Template`];
|
|
112
|
+
if (hex(actual.hash) !== expected.hash.toLowerCase() ||
|
|
113
|
+
actual.prefixLength !== expected.prefixLength ||
|
|
114
|
+
actual.suffixLength !== expected.suffixLength) {
|
|
115
|
+
throw new Error(`${role} fee-market policy template mismatch`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
wrapper: input.wrapperProfile === "native" ? verified.wrapper : verified.argentWrapper,
|
|
120
|
+
receipt: verified.receipt,
|
|
121
|
+
root: verified.root,
|
|
122
|
+
holder: verified.holder,
|
|
123
|
+
ask: verified.ask,
|
|
124
|
+
bid: verified.bid,
|
|
125
|
+
ticket: verified.ticket,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=escrow-market-artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow-market-artifacts.js","sourceRoot":"","sources":["../../src/escrow-market-artifacts.ts"],"names":[],"mappings":";;AAiCA,sEAsDC;AAGD,sEAsCC;AAhID,iDAA8C;AAC9C,mDAAgD;AAChD,qCAAwE;AACxE,iDAA+D;AAC/D,yDAAqF;AAErF,MAAM,IAAI,GAAG;IACX,OAAO,EAAE,CAAC,mCAAmC,EAAE,kBAAkB,EAAE,kEAAkE,CAAC;IACtI,IAAI,EAAE,CAAC,0CAA0C,EAAE,yBAAyB,EAAE,kEAAkE,CAAC;IACjJ,MAAM,EAAE,CAAC,4CAA4C,EAAE,2BAA2B,EAAE,kEAAkE,CAAC;IACvJ,GAAG,EAAE,CAAC,yCAAyC,EAAE,wBAAwB,EAAE,kEAAkE,CAAC;IAC9I,GAAG,EAAE,CAAC,yCAAyC,EAAE,wBAAwB,EAAE,kEAAkE,CAAC;IAC9I,MAAM,EAAE,CAAC,iCAAiC,EAAE,gBAAgB,EAAE,kEAAkE,CAAC;IACjI,OAAO,EAAE,CAAC,oCAAoC,EAAE,mBAAmB,EAAE,kEAAkE,CAAC;IACxI,aAAa,EAAE,CAAC,0CAA0C,EAAE,yBAAyB,EAAE,kEAAkE,CAAC;CAClJ,CAAC;AAIX,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EA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,KAAK,QAAQ,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,sCAAsC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IACD,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa;QACtF,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { type Kcc20EscrowPolicy } from "./escrow-policy.js";
|
|
2
|
+
import { type Kcc20FeeArtifactSet } from "./escrow-market-artifacts.js";
|
|
3
|
+
export interface Kcc20FeeMarketGenesisInput {
|
|
4
|
+
tokenId: string;
|
|
5
|
+
feeTicketId: string;
|
|
6
|
+
priceScale: bigint;
|
|
7
|
+
policy: Kcc20EscrowPolicy;
|
|
8
|
+
wrapperProfile: "native" | "argent";
|
|
9
|
+
artifacts: Kcc20FeeArtifactSet;
|
|
10
|
+
}
|
|
11
|
+
/** Produce the only genesis role: an unbound wrapper with no orderbook root. */
|
|
12
|
+
export declare function prepareKcc20FeeMarketGenesis(input: Kcc20FeeMarketGenesisInput): {
|
|
13
|
+
tokenId: string;
|
|
14
|
+
feeTicketId: string;
|
|
15
|
+
policyId: string;
|
|
16
|
+
state: {
|
|
17
|
+
canonicalTokenId: string;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
priceScale: string;
|
|
20
|
+
feeTicketId: string;
|
|
21
|
+
feePolicy: string;
|
|
22
|
+
authenticatedMarketId: string;
|
|
23
|
+
};
|
|
24
|
+
wrapper: {
|
|
25
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
26
|
+
scriptHash: string;
|
|
27
|
+
scriptPublicKey: {
|
|
28
|
+
version: 0;
|
|
29
|
+
scriptHex: string;
|
|
30
|
+
};
|
|
31
|
+
template: {
|
|
32
|
+
hash: string;
|
|
33
|
+
prefixLength: number;
|
|
34
|
+
suffixLength: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/** Render both bound outputs after the accepted genesis has fixed market ID. */
|
|
39
|
+
export declare function prepareKcc20FeeMarketBinding(input: Kcc20FeeMarketGenesisInput & {
|
|
40
|
+
marketId: string;
|
|
41
|
+
rootOwner: string;
|
|
42
|
+
rootOwnerScheme: number;
|
|
43
|
+
rootPayoutScriptHash: string;
|
|
44
|
+
}): {
|
|
45
|
+
genesis: {
|
|
46
|
+
tokenId: string;
|
|
47
|
+
feeTicketId: string;
|
|
48
|
+
policyId: string;
|
|
49
|
+
state: {
|
|
50
|
+
canonicalTokenId: string;
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
priceScale: string;
|
|
53
|
+
feeTicketId: string;
|
|
54
|
+
feePolicy: string;
|
|
55
|
+
authenticatedMarketId: string;
|
|
56
|
+
};
|
|
57
|
+
wrapper: {
|
|
58
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
59
|
+
scriptHash: string;
|
|
60
|
+
scriptPublicKey: {
|
|
61
|
+
version: 0;
|
|
62
|
+
scriptHex: string;
|
|
63
|
+
};
|
|
64
|
+
template: {
|
|
65
|
+
hash: string;
|
|
66
|
+
prefixLength: number;
|
|
67
|
+
suffixLength: number;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
marketId: string;
|
|
72
|
+
wrapperState: {
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
authenticatedMarketId: string;
|
|
75
|
+
canonicalTokenId: string;
|
|
76
|
+
priceScale: string;
|
|
77
|
+
feeTicketId: string;
|
|
78
|
+
feePolicy: string;
|
|
79
|
+
};
|
|
80
|
+
wrapper: {
|
|
81
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
82
|
+
scriptHash: string;
|
|
83
|
+
scriptPublicKey: {
|
|
84
|
+
version: 0;
|
|
85
|
+
scriptHex: string;
|
|
86
|
+
};
|
|
87
|
+
template: {
|
|
88
|
+
hash: string;
|
|
89
|
+
prefixLength: number;
|
|
90
|
+
suffixLength: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
rootState: {
|
|
94
|
+
canonicalTokenId: string;
|
|
95
|
+
owner: string;
|
|
96
|
+
owner_scheme: number;
|
|
97
|
+
amount: string;
|
|
98
|
+
mode: string;
|
|
99
|
+
unitPrice: string;
|
|
100
|
+
feeTicketId: string;
|
|
101
|
+
priceScale: string;
|
|
102
|
+
feePolicy: string;
|
|
103
|
+
payout_script_hash: string;
|
|
104
|
+
wrapper_spk_hash: string;
|
|
105
|
+
};
|
|
106
|
+
root: {
|
|
107
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
108
|
+
scriptHash: string;
|
|
109
|
+
scriptPublicKey: {
|
|
110
|
+
version: 0;
|
|
111
|
+
scriptHex: string;
|
|
112
|
+
};
|
|
113
|
+
template: {
|
|
114
|
+
hash: string;
|
|
115
|
+
prefixLength: number;
|
|
116
|
+
suffixLength: number;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/** Render a wrapped holder against the exact enabled wrapper for this market. */
|
|
121
|
+
export declare function prepareKcc20FeeMarketWrappedHolder(input: Kcc20FeeMarketGenesisInput & {
|
|
122
|
+
marketId: string;
|
|
123
|
+
recipientOwner: string;
|
|
124
|
+
recipientOwnerScheme: number;
|
|
125
|
+
recipientPayoutScriptHash: string;
|
|
126
|
+
tokenAmount: bigint;
|
|
127
|
+
}): {
|
|
128
|
+
marketId: string;
|
|
129
|
+
wrapperState: {
|
|
130
|
+
enabled: boolean;
|
|
131
|
+
authenticatedMarketId: string;
|
|
132
|
+
canonicalTokenId: string;
|
|
133
|
+
priceScale: string;
|
|
134
|
+
feeTicketId: string;
|
|
135
|
+
feePolicy: string;
|
|
136
|
+
};
|
|
137
|
+
wrapper: {
|
|
138
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
139
|
+
scriptHash: string;
|
|
140
|
+
scriptPublicKey: {
|
|
141
|
+
version: 0;
|
|
142
|
+
scriptHex: string;
|
|
143
|
+
};
|
|
144
|
+
template: {
|
|
145
|
+
hash: string;
|
|
146
|
+
prefixLength: number;
|
|
147
|
+
suffixLength: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
holderState: {
|
|
151
|
+
canonicalTokenId: string;
|
|
152
|
+
owner: string;
|
|
153
|
+
owner_scheme: number;
|
|
154
|
+
amount: string;
|
|
155
|
+
mode: string;
|
|
156
|
+
unitPrice: string;
|
|
157
|
+
feeTicketId: string;
|
|
158
|
+
priceScale: string;
|
|
159
|
+
feePolicy: string;
|
|
160
|
+
payout_script_hash: string;
|
|
161
|
+
wrapper_spk_hash: string;
|
|
162
|
+
};
|
|
163
|
+
holder: {
|
|
164
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
165
|
+
scriptHash: string;
|
|
166
|
+
scriptPublicKey: {
|
|
167
|
+
version: 0;
|
|
168
|
+
scriptHex: string;
|
|
169
|
+
};
|
|
170
|
+
template: {
|
|
171
|
+
hash: string;
|
|
172
|
+
prefixLength: number;
|
|
173
|
+
suffixLength: number;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
/** Render an ask and any holder continuation against a pinned market policy. */
|
|
178
|
+
export declare function prepareKcc20FeeMarketAsk(input: Kcc20FeeMarketGenesisInput & {
|
|
179
|
+
marketId: string;
|
|
180
|
+
owner: string;
|
|
181
|
+
ownerScheme: number;
|
|
182
|
+
payoutScriptHash: string;
|
|
183
|
+
holderAmount: bigint;
|
|
184
|
+
askAmount: bigint;
|
|
185
|
+
askUnitPrice: bigint;
|
|
186
|
+
}): {
|
|
187
|
+
holder: {
|
|
188
|
+
marketId: string;
|
|
189
|
+
wrapperState: {
|
|
190
|
+
enabled: boolean;
|
|
191
|
+
authenticatedMarketId: string;
|
|
192
|
+
canonicalTokenId: string;
|
|
193
|
+
priceScale: string;
|
|
194
|
+
feeTicketId: string;
|
|
195
|
+
feePolicy: string;
|
|
196
|
+
};
|
|
197
|
+
wrapper: {
|
|
198
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
199
|
+
scriptHash: string;
|
|
200
|
+
scriptPublicKey: {
|
|
201
|
+
version: 0;
|
|
202
|
+
scriptHex: string;
|
|
203
|
+
};
|
|
204
|
+
template: {
|
|
205
|
+
hash: string;
|
|
206
|
+
prefixLength: number;
|
|
207
|
+
suffixLength: number;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
holderState: {
|
|
211
|
+
canonicalTokenId: string;
|
|
212
|
+
owner: string;
|
|
213
|
+
owner_scheme: number;
|
|
214
|
+
amount: string;
|
|
215
|
+
mode: string;
|
|
216
|
+
unitPrice: string;
|
|
217
|
+
feeTicketId: string;
|
|
218
|
+
priceScale: string;
|
|
219
|
+
feePolicy: string;
|
|
220
|
+
payout_script_hash: string;
|
|
221
|
+
wrapper_spk_hash: string;
|
|
222
|
+
};
|
|
223
|
+
holder: {
|
|
224
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
225
|
+
scriptHash: string;
|
|
226
|
+
scriptPublicKey: {
|
|
227
|
+
version: 0;
|
|
228
|
+
scriptHex: string;
|
|
229
|
+
};
|
|
230
|
+
template: {
|
|
231
|
+
hash: string;
|
|
232
|
+
prefixLength: number;
|
|
233
|
+
suffixLength: number;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
askState: {
|
|
238
|
+
amount: string;
|
|
239
|
+
mode: string;
|
|
240
|
+
unitPrice: string;
|
|
241
|
+
canonicalTokenId: string;
|
|
242
|
+
owner: string;
|
|
243
|
+
owner_scheme: number;
|
|
244
|
+
feeTicketId: string;
|
|
245
|
+
priceScale: string;
|
|
246
|
+
feePolicy: string;
|
|
247
|
+
payout_script_hash: string;
|
|
248
|
+
wrapper_spk_hash: string;
|
|
249
|
+
};
|
|
250
|
+
ask: {
|
|
251
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
252
|
+
scriptHash: string;
|
|
253
|
+
scriptPublicKey: {
|
|
254
|
+
version: 0;
|
|
255
|
+
scriptHex: string;
|
|
256
|
+
};
|
|
257
|
+
template: {
|
|
258
|
+
hash: string;
|
|
259
|
+
prefixLength: number;
|
|
260
|
+
suffixLength: number;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
remaining: bigint;
|
|
264
|
+
change: {
|
|
265
|
+
marketId: string;
|
|
266
|
+
wrapperState: {
|
|
267
|
+
enabled: boolean;
|
|
268
|
+
authenticatedMarketId: string;
|
|
269
|
+
canonicalTokenId: string;
|
|
270
|
+
priceScale: string;
|
|
271
|
+
feeTicketId: string;
|
|
272
|
+
feePolicy: string;
|
|
273
|
+
};
|
|
274
|
+
wrapper: {
|
|
275
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
276
|
+
scriptHash: string;
|
|
277
|
+
scriptPublicKey: {
|
|
278
|
+
version: 0;
|
|
279
|
+
scriptHex: string;
|
|
280
|
+
};
|
|
281
|
+
template: {
|
|
282
|
+
hash: string;
|
|
283
|
+
prefixLength: number;
|
|
284
|
+
suffixLength: number;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
holderState: {
|
|
288
|
+
canonicalTokenId: string;
|
|
289
|
+
owner: string;
|
|
290
|
+
owner_scheme: number;
|
|
291
|
+
amount: string;
|
|
292
|
+
mode: string;
|
|
293
|
+
unitPrice: string;
|
|
294
|
+
feeTicketId: string;
|
|
295
|
+
priceScale: string;
|
|
296
|
+
feePolicy: string;
|
|
297
|
+
payout_script_hash: string;
|
|
298
|
+
wrapper_spk_hash: string;
|
|
299
|
+
};
|
|
300
|
+
holder: {
|
|
301
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
302
|
+
scriptHash: string;
|
|
303
|
+
scriptPublicKey: {
|
|
304
|
+
version: 0;
|
|
305
|
+
scriptHex: string;
|
|
306
|
+
};
|
|
307
|
+
template: {
|
|
308
|
+
hash: string;
|
|
309
|
+
prefixLength: number;
|
|
310
|
+
suffixLength: number;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
} | null;
|
|
314
|
+
};
|
|
315
|
+
/** Render a bid while preserving the single market root unchanged. */
|
|
316
|
+
export declare function prepareKcc20FeeMarketBid(input: Kcc20FeeMarketGenesisInput & {
|
|
317
|
+
marketId: string;
|
|
318
|
+
rootOwner: string;
|
|
319
|
+
rootOwnerScheme: number;
|
|
320
|
+
rootPayoutScriptHash: string;
|
|
321
|
+
buyer: string;
|
|
322
|
+
buyerScheme: number;
|
|
323
|
+
buyerPayoutScriptHash: string;
|
|
324
|
+
bidAmount: bigint;
|
|
325
|
+
bidUnitPrice: bigint;
|
|
326
|
+
}): {
|
|
327
|
+
binding: {
|
|
328
|
+
genesis: {
|
|
329
|
+
tokenId: string;
|
|
330
|
+
feeTicketId: string;
|
|
331
|
+
policyId: string;
|
|
332
|
+
state: {
|
|
333
|
+
canonicalTokenId: string;
|
|
334
|
+
enabled: boolean;
|
|
335
|
+
priceScale: string;
|
|
336
|
+
feeTicketId: string;
|
|
337
|
+
feePolicy: string;
|
|
338
|
+
authenticatedMarketId: string;
|
|
339
|
+
};
|
|
340
|
+
wrapper: {
|
|
341
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
342
|
+
scriptHash: string;
|
|
343
|
+
scriptPublicKey: {
|
|
344
|
+
version: 0;
|
|
345
|
+
scriptHex: string;
|
|
346
|
+
};
|
|
347
|
+
template: {
|
|
348
|
+
hash: string;
|
|
349
|
+
prefixLength: number;
|
|
350
|
+
suffixLength: number;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
marketId: string;
|
|
355
|
+
wrapperState: {
|
|
356
|
+
enabled: boolean;
|
|
357
|
+
authenticatedMarketId: string;
|
|
358
|
+
canonicalTokenId: string;
|
|
359
|
+
priceScale: string;
|
|
360
|
+
feeTicketId: string;
|
|
361
|
+
feePolicy: string;
|
|
362
|
+
};
|
|
363
|
+
wrapper: {
|
|
364
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
365
|
+
scriptHash: string;
|
|
366
|
+
scriptPublicKey: {
|
|
367
|
+
version: 0;
|
|
368
|
+
scriptHex: string;
|
|
369
|
+
};
|
|
370
|
+
template: {
|
|
371
|
+
hash: string;
|
|
372
|
+
prefixLength: number;
|
|
373
|
+
suffixLength: number;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
rootState: {
|
|
377
|
+
canonicalTokenId: string;
|
|
378
|
+
owner: string;
|
|
379
|
+
owner_scheme: number;
|
|
380
|
+
amount: string;
|
|
381
|
+
mode: string;
|
|
382
|
+
unitPrice: string;
|
|
383
|
+
feeTicketId: string;
|
|
384
|
+
priceScale: string;
|
|
385
|
+
feePolicy: string;
|
|
386
|
+
payout_script_hash: string;
|
|
387
|
+
wrapper_spk_hash: string;
|
|
388
|
+
};
|
|
389
|
+
root: {
|
|
390
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
391
|
+
scriptHash: string;
|
|
392
|
+
scriptPublicKey: {
|
|
393
|
+
version: 0;
|
|
394
|
+
scriptHex: string;
|
|
395
|
+
};
|
|
396
|
+
template: {
|
|
397
|
+
hash: string;
|
|
398
|
+
prefixLength: number;
|
|
399
|
+
suffixLength: number;
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
bidState: {
|
|
404
|
+
owner: string;
|
|
405
|
+
owner_scheme: number;
|
|
406
|
+
amount: string;
|
|
407
|
+
mode: string;
|
|
408
|
+
unitPrice: string;
|
|
409
|
+
payout_script_hash: string;
|
|
410
|
+
canonicalTokenId: string;
|
|
411
|
+
feeTicketId: string;
|
|
412
|
+
priceScale: string;
|
|
413
|
+
feePolicy: string;
|
|
414
|
+
wrapper_spk_hash: string;
|
|
415
|
+
};
|
|
416
|
+
bid: {
|
|
417
|
+
redeemScript: Uint8Array<ArrayBuffer>;
|
|
418
|
+
scriptHash: string;
|
|
419
|
+
scriptPublicKey: {
|
|
420
|
+
version: 0;
|
|
421
|
+
scriptHex: string;
|
|
422
|
+
};
|
|
423
|
+
template: {
|
|
424
|
+
hash: string;
|
|
425
|
+
prefixLength: number;
|
|
426
|
+
suffixLength: number;
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
};
|