@arkade-os/sdk 0.5.14 → 0.5.15
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/README.md +49 -1
- package/dist/adapters/expo.cjs +6 -6
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/artifact-DA5YHM2k.d.cts +87 -0
- package/dist/artifact-DacurepK.d.ts +87 -0
- package/dist/{asyncStorageTaskQueue-p7zeFhA3.d.ts → asyncStorageTaskQueue-B3umqlkb.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-DzO5SBcm.d.cts → asyncStorageTaskQueue-Dq6AJHNv.d.cts} +2 -2
- package/dist/{chunk-MEIE2AEU.cjs → chunk-35GRSVCZ.cjs} +11 -11
- package/dist/{chunk-MEIE2AEU.cjs.map → chunk-35GRSVCZ.cjs.map} +1 -1
- package/dist/{chunk-X57WKONW.js → chunk-43APGKWL.js} +130 -22
- package/dist/chunk-43APGKWL.js.map +1 -0
- package/dist/{chunk-LQH7DACV.cjs → chunk-CMFRCBZW.cjs} +866 -615
- package/dist/chunk-CMFRCBZW.cjs.map +1 -0
- package/dist/{chunk-6J4GABF7.cjs → chunk-FKHUXSYW.cjs} +3 -3
- package/dist/chunk-FKHUXSYW.cjs.map +1 -0
- package/dist/{chunk-AZHBGWVC.js → chunk-HVUZKXB2.js} +4 -4
- package/dist/{chunk-AZHBGWVC.js.map → chunk-HVUZKXB2.js.map} +1 -1
- package/dist/{chunk-EVVLVFY7.cjs → chunk-INQAIZUO.cjs} +17 -17
- package/dist/{chunk-EVVLVFY7.cjs.map → chunk-INQAIZUO.cjs.map} +1 -1
- package/dist/{chunk-7LPT6AYH.cjs → chunk-JSYS2KX3.cjs} +18 -18
- package/dist/{chunk-7LPT6AYH.cjs.map → chunk-JSYS2KX3.cjs.map} +1 -1
- package/dist/{chunk-4HZQSKWG.js → chunk-R37I633T.js} +22 -17
- package/dist/chunk-R37I633T.js.map +1 -0
- package/dist/{chunk-ACIQZLWL.cjs → chunk-UNLH3NNG.cjs} +129 -20
- package/dist/chunk-UNLH3NNG.cjs.map +1 -0
- package/dist/{chunk-XZHTYYW5.cjs → chunk-VIQF74QJ.cjs} +38 -33
- package/dist/chunk-VIQF74QJ.cjs.map +1 -0
- package/dist/{chunk-LCGRZ24T.js → chunk-XPZ7TMXH.js} +4 -4
- package/dist/{chunk-LCGRZ24T.js.map → chunk-XPZ7TMXH.js.map} +1 -1
- package/dist/{chunk-72EC3ASW.js → chunk-YYSHQPCG.js} +3 -3
- package/dist/{chunk-72EC3ASW.js.map → chunk-YYSHQPCG.js.map} +1 -1
- package/dist/{chunk-J2JZZTOE.js → chunk-Z4LG3CZ4.js} +3 -3
- package/dist/chunk-Z4LG3CZ4.js.map +1 -0
- package/dist/{chunk-HWWSLCQN.js → chunk-ZECZ2MKX.js} +344 -93
- package/dist/chunk-ZECZ2MKX.js.map +1 -0
- package/dist/compiler.cjs +5 -5
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +9 -9
- package/dist/compiler.d.ts +9 -9
- package/dist/compiler.js +5 -5
- package/dist/compiler.js.map +1 -1
- package/dist/contracts/handlers/index.cjs +11 -11
- package/dist/contracts/handlers/index.d.cts +2 -2
- package/dist/contracts/handlers/index.d.ts +2 -2
- package/dist/contracts/handlers/index.js +3 -3
- package/dist/{index-Cy57QdcL.d.cts → index-Bi22mLsh.d.cts} +147 -43
- package/dist/{index-CaOBA9Ev.d.ts → index-CiLMmCHX.d.ts} +1 -1
- package/dist/{index-Db5qzYRi.d.ts → index-DOdoDqvM.d.ts} +147 -43
- package/dist/{index-Lq_u0hqj.d.cts → index-DnKugm-h.d.cts} +1 -1
- package/dist/index.cjs +327 -327
- package/dist/index.d.cts +32 -66
- package/dist/index.d.ts +32 -66
- package/dist/index.js +5 -5
- package/dist/repositories/realm/index.cjs +38 -38
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +6 -6
- package/dist/repositories/sqlite/index.cjs +36 -36
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +6 -6
- package/dist/{taskRunner-amPuilMW.d.ts → taskRunner-CoE4Xx9K.d.ts} +2 -2
- package/dist/{taskRunner-DhZ-KQBW.d.cts → taskRunner-DFG0BN_R.d.cts} +2 -2
- package/dist/wallet/expo/background.cjs +15 -15
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +7 -7
- package/dist/wallet/expo/index.cjs +19 -16
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +3 -2
- package/dist/wallet/expo/index.d.ts +3 -2
- package/dist/wallet/expo/index.js +9 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/worker/expo/index.cjs +10 -10
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +6 -6
- package/package.json +3 -3
- package/dist/chunk-4HZQSKWG.js.map +0 -1
- package/dist/chunk-6J4GABF7.cjs.map +0 -1
- package/dist/chunk-ACIQZLWL.cjs.map +0 -1
- package/dist/chunk-HWWSLCQN.js.map +0 -1
- package/dist/chunk-J2JZZTOE.js.map +0 -1
- package/dist/chunk-LQH7DACV.cjs.map +0 -1
- package/dist/chunk-X57WKONW.js.map +0 -1
- package/dist/chunk-XZHTYYW5.cjs.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { __export, toXOnly, sequenceToCanonicalTimelock, VtxoScript, ConditionCSVMultisigTapscript, CSVMultisigTapscript, CLTVMultisigTapscript, ConditionMultisigTapscript, MultisigTapscript } from './chunk-GB67AGXG.js';
|
|
2
2
|
import { hex } from '@scure/base';
|
|
3
3
|
import { ScriptNum, OP } from '@scure/btc-signer';
|
|
4
|
-
import { equalBytes } from '@scure/btc-signer/utils.js';
|
|
4
|
+
import { equalBytes, sha256 } from '@scure/btc-signer/utils.js';
|
|
5
5
|
import * as P from 'micro-packed';
|
|
6
6
|
import { schnorr, secp256k1 } from '@noble/curves/secp256k1.js';
|
|
7
7
|
import { bytesToNumberBE } from '@noble/curves/utils.js';
|
|
8
8
|
|
|
9
9
|
var ARKADE_OP = {
|
|
10
|
-
// Merkle
|
|
10
|
+
// Merkle root (0xb3, repurposed NOP4). MERKLEBRANCHVERIFY is the rc.1 name; decoding uses the last.
|
|
11
11
|
MERKLEBRANCHVERIFY: 179,
|
|
12
|
+
MERKLEBRANCHROOT: 179,
|
|
12
13
|
PUT: 187,
|
|
13
14
|
// Digest (0xc3)
|
|
14
15
|
DIGEST: 195,
|
|
@@ -78,13 +79,11 @@ var ARKADE_OP = {
|
|
|
78
79
|
TUNNEL: 247,
|
|
79
80
|
INSPECTINTENTMESSAGE: 248
|
|
80
81
|
};
|
|
81
|
-
var ARKADE_OPCODES = Object.values(ARKADE_OP);
|
|
82
|
+
var ARKADE_OPCODES = [...new Set(Object.values(ARKADE_OP))];
|
|
82
83
|
var ARKADE_OPCODE_NAMES = Object.fromEntries(
|
|
83
84
|
Object.entries(ARKADE_OP).map(([name, value]) => [value, name])
|
|
84
85
|
);
|
|
85
|
-
var ARKADE_OPCODE_VALUES =
|
|
86
|
-
Object.entries(ARKADE_OPCODE_NAMES).map(([value, name]) => [name, Number(value)])
|
|
87
|
-
);
|
|
86
|
+
var ARKADE_OPCODE_VALUES = { ...ARKADE_OP };
|
|
88
87
|
function buildBitcoinOpcodeNames() {
|
|
89
88
|
const names = {};
|
|
90
89
|
for (const [key, value] of Object.entries(OP)) {
|
|
@@ -819,6 +818,15 @@ function deserializeArkadeContractParams(params) {
|
|
|
819
818
|
...params.emulatorKey ? { emulatorKey: hex.decode(params.emulatorKey) } : {}
|
|
820
819
|
};
|
|
821
820
|
}
|
|
821
|
+
var INSTANTIATED = /* @__PURE__ */ Symbol("instantiated contracts");
|
|
822
|
+
function instantiatedContracts(program) {
|
|
823
|
+
return program[INSTANTIATED] ?? {};
|
|
824
|
+
}
|
|
825
|
+
var ASSET_GROUP_RECORD = [
|
|
826
|
+
["type", "int"],
|
|
827
|
+
["index", "int"],
|
|
828
|
+
["amount", "int"]
|
|
829
|
+
];
|
|
822
830
|
var NATIVE_STRUCTS = {
|
|
823
831
|
AssetId: [
|
|
824
832
|
["txid", "bytes32"],
|
|
@@ -844,6 +852,8 @@ var NATIVE_STRUCTS = {
|
|
|
844
852
|
["amount", "int"],
|
|
845
853
|
["found", "bool"]
|
|
846
854
|
],
|
|
855
|
+
AssetGroupInput: ASSET_GROUP_RECORD,
|
|
856
|
+
AssetGroupOutput: ASSET_GROUP_RECORD,
|
|
847
857
|
G2Point: [
|
|
848
858
|
["xC1", "int"],
|
|
849
859
|
["xC0", "int"],
|
|
@@ -912,16 +922,16 @@ function argType(arkType) {
|
|
|
912
922
|
return arkType;
|
|
913
923
|
}
|
|
914
924
|
function arrayParts(type) {
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return Number.isSafeInteger(length) && length > 0 && /^\d+$/.test(type.slice(open + 1, -1)) ? [type.slice(0, open), length] : [type, 0];
|
|
925
|
+
const [, base, size, inner] = /^([^[\]]+)\[(\d+)\]((?:\[\d+\])*)$/.exec(type) ?? [];
|
|
926
|
+
const length = Number(size);
|
|
927
|
+
return Number.isSafeInteger(length) && length > 0 ? [base + inner, length] : [type, 0];
|
|
919
928
|
}
|
|
920
929
|
var MAX_LAYOUT_CHARS = 1 << 18;
|
|
921
930
|
function flatten(param, structs, budget, stack = []) {
|
|
922
931
|
if (!isNamed(param)) fail("parameter needs a name and a type");
|
|
932
|
+
budget.left -= param.name.length + (param.type.includes("[") ? param.type.length : 0);
|
|
933
|
+
if (budget.left < 0) fail(`layouts exceed ${MAX_LAYOUT_CHARS} name characters`);
|
|
923
934
|
const [element, length] = arrayParts(param.type);
|
|
924
|
-
budget.left -= param.name.length;
|
|
925
935
|
if (budget.left < length) fail(`layouts exceed ${MAX_LAYOUT_CHARS} name characters`);
|
|
926
936
|
if (length > 0) {
|
|
927
937
|
return Array.from(
|
|
@@ -977,7 +987,7 @@ function asmToken(token, instantiations) {
|
|
|
977
987
|
if (inner.startsWith("VTXO:")) {
|
|
978
988
|
fail(`'${token}' is not a placeholder; the compiler emits <CONTRACT:\u2026>`);
|
|
979
989
|
}
|
|
980
|
-
if (inner === "
|
|
990
|
+
if (inner.startsWith("EMULATOR_KEY:") || inner === "OPERATOR_KEY" || inner.startsWith("OPERATOR_KEY:")) {
|
|
981
991
|
fail(`${token} is a signer role and cannot appear in a covenant`);
|
|
982
992
|
}
|
|
983
993
|
return `$${inner}`;
|
|
@@ -989,6 +999,66 @@ function asmToken(token, instantiations) {
|
|
|
989
999
|
fail(`unrecognized assembly token '${token}'`);
|
|
990
1000
|
}
|
|
991
1001
|
}
|
|
1002
|
+
function codeHash(artifact) {
|
|
1003
|
+
const { source, compiler, updatedAt, fingerprint, codeHash: codeHash2, ...scripts } = artifact;
|
|
1004
|
+
const text = JSON.stringify(scripts);
|
|
1005
|
+
return [`sha256:${hex.encode(sha256(new TextEncoder().encode(text)))}`, JSON.parse(text)];
|
|
1006
|
+
}
|
|
1007
|
+
function instantiationArg(token, def, params) {
|
|
1008
|
+
if (token.startsWith("<") && token.endsWith(">")) {
|
|
1009
|
+
const name = token.slice(1, -1);
|
|
1010
|
+
if (!params.has(name)) {
|
|
1011
|
+
fail(`instantiation argument '${token}' is not a constructor parameter`);
|
|
1012
|
+
}
|
|
1013
|
+
return name;
|
|
1014
|
+
}
|
|
1015
|
+
const value = token.startsWith("0x") ? hex.decode(token.slice(2)) : token === "true" || token === "false" ? BigInt(token === "true") : /^\d+$/.test(token) ? BigInt(token) : fail(`computed instantiation argument '${token}'`);
|
|
1016
|
+
validateParamValue(def, value);
|
|
1017
|
+
return value;
|
|
1018
|
+
}
|
|
1019
|
+
var MAX_INSTANTIATIONS = 256;
|
|
1020
|
+
var MAX_INSTANTIATED_CHARS = 1 << 20;
|
|
1021
|
+
function link(parent, params, body, supplied, stack, tree) {
|
|
1022
|
+
const [, name, list] = body.match(/^([A-Za-z]\w*)\((.*)\)$/) ?? fail(`malformed '${body}'`);
|
|
1023
|
+
if (--tree.links < 0) {
|
|
1024
|
+
fail(`more than ${MAX_INSTANTIATIONS} instantiated contracts, counted once per path`);
|
|
1025
|
+
}
|
|
1026
|
+
const chain = [...stack, parent.contractName];
|
|
1027
|
+
if (chain.includes(name)) fail(`instantiation loop ${[...chain, name].join(" \u2192 ")}`);
|
|
1028
|
+
const pins = parent.contracts;
|
|
1029
|
+
const pin = isRecord(pins) && Object.hasOwn(pins, name) ? pins[name] : void 0;
|
|
1030
|
+
if (typeof pin !== "string") {
|
|
1031
|
+
fail(
|
|
1032
|
+
`${parent.contractName} pins no code hash for ${name}; recompile ${parent.contractName} with arkadec 0.1.0 or later`
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
const child = supplied.get(pin);
|
|
1036
|
+
if (child?.contractName !== name) {
|
|
1037
|
+
fail(
|
|
1038
|
+
[...supplied.values()].some((other) => other.contractName === name) ? `the ${name} artifact in \`contracts\` does not have the code hash ${parent.contractName} pins (${pin}); pass the build it was compiled against, unedited and in arkadec's field order` : `${parent.contractName} instantiates ${name}; pass its artifact in \`contracts\``
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
const program = readArtifact(child, void 0, supplied, chain, tree);
|
|
1042
|
+
if ((tree.chars -= stringifyArtifact(program).length) < 0) {
|
|
1043
|
+
fail(
|
|
1044
|
+
`instantiated programs exceed ${MAX_INSTANTIATED_CHARS} characters, counted once per path`
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
1047
|
+
const structs = new Map((child.structs ?? []).map((struct) => [struct.name, struct]));
|
|
1048
|
+
const layout = { left: MAX_LAYOUT_CHARS };
|
|
1049
|
+
const inputs = child.constructorInputs.flatMap((input) => flatten(input, structs, layout));
|
|
1050
|
+
const values = list === "" ? [] : list.split(",");
|
|
1051
|
+
if (values.length !== inputs.length) {
|
|
1052
|
+
fail(
|
|
1053
|
+
`${name} takes ${inputs.length} constructor argument(s); ${parent.contractName} passes ${values.length}`
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
const args = /* @__PURE__ */ Object.create(null);
|
|
1057
|
+
inputs.forEach((input, i) => {
|
|
1058
|
+
args[input.name] = instantiationArg(values[i], input, params);
|
|
1059
|
+
});
|
|
1060
|
+
return { program, args };
|
|
1061
|
+
}
|
|
992
1062
|
function providedWitness(witness) {
|
|
993
1063
|
if (witness === void 0) return [];
|
|
994
1064
|
if (!Array.isArray(witness)) fail("leaf witness must be an array");
|
|
@@ -1014,8 +1084,15 @@ function csvTimelock(leafName, operand) {
|
|
|
1014
1084
|
}
|
|
1015
1085
|
return timelock;
|
|
1016
1086
|
}
|
|
1087
|
+
function legacyOperatorLeaf(asm) {
|
|
1088
|
+
const skipServer = asm.includes("OP_CHECKSEQUENCEVERIFY") || asm.includes("<OPERATOR_KEY>");
|
|
1089
|
+
const server = skipServer ? [] : ["<OPERATOR_KEY>", "OP_CHECKSIGVERIFY"];
|
|
1090
|
+
return asm.flatMap(
|
|
1091
|
+
(token) => token.startsWith("<OPERATOR_KEY:") ? [...server, token.replace("OPERATOR_KEY:", "EMULATOR_KEY:")] : [token]
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1017
1094
|
function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
1018
|
-
const asm = leaf.asm;
|
|
1095
|
+
const asm = legacyOperatorLeaf(leaf.asm);
|
|
1019
1096
|
let index = 0;
|
|
1020
1097
|
let condition;
|
|
1021
1098
|
const hashIndex = asm[0] === "OP_SIZE" && (asm[1] === "20" || asm[1] === "32") && asm[2] === "OP_EQUALVERIFY" ? 3 : 0;
|
|
@@ -1028,7 +1105,7 @@ function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
|
1028
1105
|
let csv;
|
|
1029
1106
|
let cltv;
|
|
1030
1107
|
if (asm.length >= index + 3 && asm[index + 2] === "OP_DROP") {
|
|
1031
|
-
const operand = asm[index].startsWith("<") && asm[index].endsWith(">") ? `$${asm[index].slice(1, -1)}` : BigInt(asm[index]);
|
|
1108
|
+
const operand = asm[index] === "<OPERATOR_EXIT_DELAY>" ? "$SERVER_EXIT_DELAY" : asm[index].startsWith("<") && asm[index].endsWith(">") ? `$${asm[index].slice(1, -1)}` : BigInt(asm[index]);
|
|
1032
1109
|
if (asm[index + 1] === "OP_CHECKSEQUENCEVERIFY") csv = csvTimelock(leaf.name, operand);
|
|
1033
1110
|
else if (asm[index + 1] === "OP_CHECKLOCKTIMEVERIFY") cltv = operand;
|
|
1034
1111
|
else fail(`leaf '${leaf.name}': unexpected timelock opcode ${asm[index + 1]}`);
|
|
@@ -1051,7 +1128,7 @@ function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
|
1051
1128
|
fail(`leaf '${leaf.name}': unsupported key operand '${key}'`);
|
|
1052
1129
|
}
|
|
1053
1130
|
const inner = key.slice(1, -1);
|
|
1054
|
-
if (inner === "
|
|
1131
|
+
if (inner === "OPERATOR_KEY") signers.push("$server");
|
|
1055
1132
|
else if (inner.startsWith("TWEAK:")) {
|
|
1056
1133
|
const [, base, fn] = inner.match(/^TWEAK:([^:]+):([^:]+)$/) ?? [];
|
|
1057
1134
|
if (!base || !fn) fail(`leaf '${leaf.name}': malformed tweak '${key}'`);
|
|
@@ -1085,7 +1162,19 @@ function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
|
1085
1162
|
} : {}
|
|
1086
1163
|
};
|
|
1087
1164
|
}
|
|
1088
|
-
function programFromArtifact(artifact,
|
|
1165
|
+
function programFromArtifact(artifact, options) {
|
|
1166
|
+
const { debug, contracts = [] } = options && "functions" in options ? { debug: options } : options ?? {};
|
|
1167
|
+
const supplied = /* @__PURE__ */ new Map();
|
|
1168
|
+
for (const child of contracts) {
|
|
1169
|
+
if (!isContractArtifact(child)) fail("each of `contracts` must be an arkadec artifact");
|
|
1170
|
+
supplied.set(...codeHash(child));
|
|
1171
|
+
}
|
|
1172
|
+
return readArtifact(artifact, debug, supplied, [], {
|
|
1173
|
+
links: MAX_INSTANTIATIONS,
|
|
1174
|
+
chars: MAX_INSTANTIATED_CHARS
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
function readArtifact(artifact, debug, supplied, stack, tree) {
|
|
1089
1178
|
if (!isContractArtifact(artifact)) {
|
|
1090
1179
|
fail(
|
|
1091
1180
|
"expected a complete arkadec artifact with contractName, constructorInputs, and non-empty functions"
|
|
@@ -1113,6 +1202,10 @@ function programFromArtifact(artifact, debug) {
|
|
|
1113
1202
|
}
|
|
1114
1203
|
const structsByName = new Map(structs.map((struct) => [struct.name, struct]));
|
|
1115
1204
|
const budget = { left: MAX_LAYOUT_CHARS };
|
|
1205
|
+
const serverRole = !artifact.constructorInputs.some(
|
|
1206
|
+
(input) => isNamed(input) && input.name === "SERVER_KEY"
|
|
1207
|
+
);
|
|
1208
|
+
const roles = (asm) => serverRole ? asm.map((token) => token === "<SERVER_KEY>" ? "<OPERATOR_KEY>" : token) : asm;
|
|
1116
1209
|
const instantiations = /* @__PURE__ */ new Map();
|
|
1117
1210
|
const functions = /* @__PURE__ */ Object.create(null);
|
|
1118
1211
|
const groups = /* @__PURE__ */ new Set();
|
|
@@ -1127,7 +1220,7 @@ function programFromArtifact(artifact, debug) {
|
|
|
1127
1220
|
);
|
|
1128
1221
|
const sourceMap = maps?.get(group.name);
|
|
1129
1222
|
const arkadeScript = group.arkade ? {
|
|
1130
|
-
asm: group.arkade.asm.map((token) => asmToken(token, instantiations)),
|
|
1223
|
+
asm: roles(group.arkade.asm).map((token) => asmToken(token, instantiations)),
|
|
1131
1224
|
...covenantInputs.length > 0 ? { inputs: covenantInputs } : {},
|
|
1132
1225
|
// Covenant witness is reverse declaration order.
|
|
1133
1226
|
witness: covenantInputs.map((field) => field.name).reverse(),
|
|
@@ -1151,7 +1244,12 @@ function programFromArtifact(artifact, debug) {
|
|
|
1151
1244
|
}
|
|
1152
1245
|
const witnessNames = /* @__PURE__ */ new Set();
|
|
1153
1246
|
for (const item of leaf.witness ?? []) claim(witnessNames, item.name, "leaf witness");
|
|
1154
|
-
const tapscript = parseLeaf(
|
|
1247
|
+
const tapscript = parseLeaf(
|
|
1248
|
+
{ ...leaf, asm: roles(leaf.asm) },
|
|
1249
|
+
group.arkade !== void 0,
|
|
1250
|
+
instantiations,
|
|
1251
|
+
extras
|
|
1252
|
+
);
|
|
1155
1253
|
if (tapscript.emulator !== void 0 && tapscript.emulator !== null && tapscript.emulator !== group.name) {
|
|
1156
1254
|
fail(
|
|
1157
1255
|
`leaf '${leaf.name}': emulator covenant '${tapscript.emulator}' must match group '${group.name}'`
|
|
@@ -1166,6 +1264,11 @@ function programFromArtifact(artifact, debug) {
|
|
|
1166
1264
|
};
|
|
1167
1265
|
}
|
|
1168
1266
|
}
|
|
1267
|
+
for (const input of artifact.constructorInputs) {
|
|
1268
|
+
if (isNamed(input) && (input.name === "server" || input.name === "SERVER_EXIT_DELAY")) {
|
|
1269
|
+
fail(`constructor input '${input.name}' is reserved by the SDK; rename it`);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1169
1272
|
const params = [
|
|
1170
1273
|
...artifact.constructorInputs.flatMap((input) => flatten(input, structsByName, budget)),
|
|
1171
1274
|
{ name: "server", type: "pubkey" },
|
|
@@ -1177,14 +1280,19 @@ function programFromArtifact(artifact, debug) {
|
|
|
1177
1280
|
];
|
|
1178
1281
|
const paramNames = /* @__PURE__ */ new Set();
|
|
1179
1282
|
for (const param of params) claim(paramNames, param.name, "program parameter");
|
|
1283
|
+
const linked = /* @__PURE__ */ Object.create(null);
|
|
1284
|
+
for (const [name, body] of instantiations) {
|
|
1285
|
+
linked[name] = link(artifact, paramNames, body, supplied, stack, tree);
|
|
1286
|
+
}
|
|
1180
1287
|
return {
|
|
1181
1288
|
version: SUPPORTED_PROGRAM_VERSION,
|
|
1182
1289
|
name: artifact.contractName,
|
|
1183
1290
|
params,
|
|
1184
|
-
functions
|
|
1291
|
+
functions,
|
|
1292
|
+
...instantiations.size > 0 ? { [INSTANTIATED]: linked } : {}
|
|
1185
1293
|
};
|
|
1186
1294
|
}
|
|
1187
1295
|
|
|
1188
|
-
export { ARKADE_OP, ARKADE_OPCODES, ARKADE_OPCODE_NAMES, ARKADE_OPCODE_VALUES, ARKADE_OPS, ArkadeProgramScript, ArkadeScript, OPCODE_NAMES, OPCODE_VALUES, SUPPORTED_PROGRAM_VERSION, UnsupportedProgramVersionError, arkadeScriptHash, arkadeWitnessHash, asmToBytes, bignum_exports, bytesToASM, computeArkadeScriptPublicKey, deserializeArkadeContractParams, fromASM, getOpcodeName, getOpcodeValue, isContractArtifact, parseArtifact, programFromArtifact, resolveAsm, resolveCsvTimelock, resolveTimelockValue, serializeArkadeContractParams, staticWitness, stringifyArtifact, toASM, validateParamValue, validateProgram, witnessRefToBytes };
|
|
1189
|
-
//# sourceMappingURL=chunk-
|
|
1190
|
-
//# sourceMappingURL=chunk-
|
|
1296
|
+
export { ARKADE_OP, ARKADE_OPCODES, ARKADE_OPCODE_NAMES, ARKADE_OPCODE_VALUES, ARKADE_OPS, ArkadeProgramScript, ArkadeScript, OPCODE_NAMES, OPCODE_VALUES, SUPPORTED_PROGRAM_VERSION, UnsupportedProgramVersionError, arkadeScriptHash, arkadeWitnessHash, asmToBytes, bignum_exports, bytesToASM, computeArkadeScriptPublicKey, deserializeArkadeContractParams, fromASM, getOpcodeName, getOpcodeValue, instantiatedContracts, isContractArtifact, parseArtifact, programFromArtifact, resolveAsm, resolveCsvTimelock, resolveTimelockValue, serializeArkadeContractParams, staticWitness, stringifyArtifact, toASM, validateParamValue, validateProgram, witnessRefToBytes };
|
|
1297
|
+
//# sourceMappingURL=chunk-43APGKWL.js.map
|
|
1298
|
+
//# sourceMappingURL=chunk-43APGKWL.js.map
|