@arkade-os/sdk 0.5.13 → 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 +55 -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-Dhbe00Ya.d.ts → asyncStorageTaskQueue-B3umqlkb.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-Y4BlVm41.d.cts → asyncStorageTaskQueue-Dq6AJHNv.d.cts} +1 -1
- package/dist/{chunk-TYSUFG2K.cjs → chunk-35GRSVCZ.cjs} +11 -11
- package/dist/{chunk-TYSUFG2K.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-6WPP4UGN.cjs → chunk-CMFRCBZW.cjs} +1245 -658
- package/dist/chunk-CMFRCBZW.cjs.map +1 -0
- package/dist/{chunk-HS7TKVOZ.cjs → chunk-FKHUXSYW.cjs} +8 -4
- package/dist/chunk-FKHUXSYW.cjs.map +1 -0
- package/dist/{chunk-BP4NA7HK.js → chunk-HVUZKXB2.js} +4 -4
- package/dist/{chunk-BP4NA7HK.js.map → chunk-HVUZKXB2.js.map} +1 -1
- package/dist/{chunk-6XVTGWQK.cjs → chunk-INQAIZUO.cjs} +17 -17
- package/dist/{chunk-6XVTGWQK.cjs.map → chunk-INQAIZUO.cjs.map} +1 -1
- package/dist/{chunk-WFJPLXOE.cjs → chunk-JSYS2KX3.cjs} +18 -18
- package/dist/{chunk-WFJPLXOE.cjs.map → chunk-JSYS2KX3.cjs.map} +1 -1
- package/dist/{chunk-QSERJPTT.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-TD4PKK2I.cjs → chunk-VIQF74QJ.cjs} +38 -33
- package/dist/chunk-VIQF74QJ.cjs.map +1 -0
- package/dist/{chunk-D4QH6L54.js → chunk-XPZ7TMXH.js} +4 -4
- package/dist/{chunk-D4QH6L54.js.map → chunk-XPZ7TMXH.js.map} +1 -1
- package/dist/{chunk-BA36SQY2.js → chunk-YYSHQPCG.js} +3 -3
- package/dist/{chunk-BA36SQY2.js.map → chunk-YYSHQPCG.js.map} +1 -1
- package/dist/{chunk-LHLRG2BE.js → chunk-Z4LG3CZ4.js} +8 -5
- package/dist/chunk-Z4LG3CZ4.js.map +1 -0
- package/dist/{chunk-Y3AWLHQP.js → chunk-ZECZ2MKX.js} +730 -143
- 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 +10 -10
- package/dist/compiler.d.ts +10 -10
- 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 +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +3 -3
- package/dist/{index-BQwrHcOh.d.cts → index-Bi22mLsh.d.cts} +212 -43
- package/dist/{index-BapVvuoI.d.ts → index-CiLMmCHX.d.ts} +2 -2
- package/dist/{index-DuXylQrN.d.ts → index-DOdoDqvM.d.ts} +212 -43
- package/dist/{index-BaTItxPx.d.cts → index-DnKugm-h.d.cts} +2 -2
- package/dist/index.cjs +327 -327
- package/dist/index.d.cts +149 -114
- package/dist/index.d.ts +149 -114
- package/dist/index.js +5 -5
- package/dist/{program-DPzf5qsk.d.cts → program-ZWUAWy_9.d.cts} +1 -1
- package/dist/{program-38A2Twvj.d.ts → program-zdDO4cMt.d.ts} +1 -1
- 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-BxOmg-O6.d.ts → taskRunner-CoE4Xx9K.d.ts} +1 -1
- package/dist/{taskRunner-D2itCXf6.d.cts → taskRunner-DFG0BN_R.d.cts} +1 -1
- 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-6WPP4UGN.cjs.map +0 -1
- package/dist/chunk-ACIQZLWL.cjs.map +0 -1
- package/dist/chunk-HS7TKVOZ.cjs.map +0 -1
- package/dist/chunk-LHLRG2BE.js.map +0 -1
- package/dist/chunk-QSERJPTT.js.map +0 -1
- package/dist/chunk-TD4PKK2I.cjs.map +0 -1
- package/dist/chunk-X57WKONW.js.map +0 -1
- package/dist/chunk-Y3AWLHQP.js.map +0 -1
|
@@ -29,8 +29,9 @@ function _interopNamespace(e) {
|
|
|
29
29
|
var P__namespace = /*#__PURE__*/_interopNamespace(P);
|
|
30
30
|
|
|
31
31
|
var ARKADE_OP = {
|
|
32
|
-
// Merkle
|
|
32
|
+
// Merkle root (0xb3, repurposed NOP4). MERKLEBRANCHVERIFY is the rc.1 name; decoding uses the last.
|
|
33
33
|
MERKLEBRANCHVERIFY: 179,
|
|
34
|
+
MERKLEBRANCHROOT: 179,
|
|
34
35
|
PUT: 187,
|
|
35
36
|
// Digest (0xc3)
|
|
36
37
|
DIGEST: 195,
|
|
@@ -100,13 +101,11 @@ var ARKADE_OP = {
|
|
|
100
101
|
TUNNEL: 247,
|
|
101
102
|
INSPECTINTENTMESSAGE: 248
|
|
102
103
|
};
|
|
103
|
-
var ARKADE_OPCODES = Object.values(ARKADE_OP);
|
|
104
|
+
var ARKADE_OPCODES = [...new Set(Object.values(ARKADE_OP))];
|
|
104
105
|
var ARKADE_OPCODE_NAMES = Object.fromEntries(
|
|
105
106
|
Object.entries(ARKADE_OP).map(([name, value]) => [value, name])
|
|
106
107
|
);
|
|
107
|
-
var ARKADE_OPCODE_VALUES =
|
|
108
|
-
Object.entries(ARKADE_OPCODE_NAMES).map(([value, name]) => [name, Number(value)])
|
|
109
|
-
);
|
|
108
|
+
var ARKADE_OPCODE_VALUES = { ...ARKADE_OP };
|
|
110
109
|
function buildBitcoinOpcodeNames() {
|
|
111
110
|
const names = {};
|
|
112
111
|
for (const [key, value] of Object.entries(btcSigner.OP)) {
|
|
@@ -841,6 +840,15 @@ function deserializeArkadeContractParams(params) {
|
|
|
841
840
|
...params.emulatorKey ? { emulatorKey: base.hex.decode(params.emulatorKey) } : {}
|
|
842
841
|
};
|
|
843
842
|
}
|
|
843
|
+
var INSTANTIATED = /* @__PURE__ */ Symbol("instantiated contracts");
|
|
844
|
+
function instantiatedContracts(program) {
|
|
845
|
+
return program[INSTANTIATED] ?? {};
|
|
846
|
+
}
|
|
847
|
+
var ASSET_GROUP_RECORD = [
|
|
848
|
+
["type", "int"],
|
|
849
|
+
["index", "int"],
|
|
850
|
+
["amount", "int"]
|
|
851
|
+
];
|
|
844
852
|
var NATIVE_STRUCTS = {
|
|
845
853
|
AssetId: [
|
|
846
854
|
["txid", "bytes32"],
|
|
@@ -866,6 +874,8 @@ var NATIVE_STRUCTS = {
|
|
|
866
874
|
["amount", "int"],
|
|
867
875
|
["found", "bool"]
|
|
868
876
|
],
|
|
877
|
+
AssetGroupInput: ASSET_GROUP_RECORD,
|
|
878
|
+
AssetGroupOutput: ASSET_GROUP_RECORD,
|
|
869
879
|
G2Point: [
|
|
870
880
|
["xC1", "int"],
|
|
871
881
|
["xC0", "int"],
|
|
@@ -934,16 +944,16 @@ function argType(arkType) {
|
|
|
934
944
|
return arkType;
|
|
935
945
|
}
|
|
936
946
|
function arrayParts(type) {
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
return Number.isSafeInteger(length) && length > 0 && /^\d+$/.test(type.slice(open + 1, -1)) ? [type.slice(0, open), length] : [type, 0];
|
|
947
|
+
const [, base, size, inner] = /^([^[\]]+)\[(\d+)\]((?:\[\d+\])*)$/.exec(type) ?? [];
|
|
948
|
+
const length = Number(size);
|
|
949
|
+
return Number.isSafeInteger(length) && length > 0 ? [base + inner, length] : [type, 0];
|
|
941
950
|
}
|
|
942
951
|
var MAX_LAYOUT_CHARS = 1 << 18;
|
|
943
952
|
function flatten(param, structs, budget, stack = []) {
|
|
944
953
|
if (!isNamed(param)) fail("parameter needs a name and a type");
|
|
954
|
+
budget.left -= param.name.length + (param.type.includes("[") ? param.type.length : 0);
|
|
955
|
+
if (budget.left < 0) fail(`layouts exceed ${MAX_LAYOUT_CHARS} name characters`);
|
|
945
956
|
const [element, length] = arrayParts(param.type);
|
|
946
|
-
budget.left -= param.name.length;
|
|
947
957
|
if (budget.left < length) fail(`layouts exceed ${MAX_LAYOUT_CHARS} name characters`);
|
|
948
958
|
if (length > 0) {
|
|
949
959
|
return Array.from(
|
|
@@ -999,7 +1009,7 @@ function asmToken(token, instantiations) {
|
|
|
999
1009
|
if (inner.startsWith("VTXO:")) {
|
|
1000
1010
|
fail(`'${token}' is not a placeholder; the compiler emits <CONTRACT:\u2026>`);
|
|
1001
1011
|
}
|
|
1002
|
-
if (inner === "
|
|
1012
|
+
if (inner.startsWith("EMULATOR_KEY:") || inner === "OPERATOR_KEY" || inner.startsWith("OPERATOR_KEY:")) {
|
|
1003
1013
|
fail(`${token} is a signer role and cannot appear in a covenant`);
|
|
1004
1014
|
}
|
|
1005
1015
|
return `$${inner}`;
|
|
@@ -1011,6 +1021,66 @@ function asmToken(token, instantiations) {
|
|
|
1011
1021
|
fail(`unrecognized assembly token '${token}'`);
|
|
1012
1022
|
}
|
|
1013
1023
|
}
|
|
1024
|
+
function codeHash(artifact) {
|
|
1025
|
+
const { source, compiler, updatedAt, fingerprint, codeHash: codeHash2, ...scripts } = artifact;
|
|
1026
|
+
const text = JSON.stringify(scripts);
|
|
1027
|
+
return [`sha256:${base.hex.encode(utils_js$1.sha256(new TextEncoder().encode(text)))}`, JSON.parse(text)];
|
|
1028
|
+
}
|
|
1029
|
+
function instantiationArg(token, def, params) {
|
|
1030
|
+
if (token.startsWith("<") && token.endsWith(">")) {
|
|
1031
|
+
const name = token.slice(1, -1);
|
|
1032
|
+
if (!params.has(name)) {
|
|
1033
|
+
fail(`instantiation argument '${token}' is not a constructor parameter`);
|
|
1034
|
+
}
|
|
1035
|
+
return name;
|
|
1036
|
+
}
|
|
1037
|
+
const value = token.startsWith("0x") ? base.hex.decode(token.slice(2)) : token === "true" || token === "false" ? BigInt(token === "true") : /^\d+$/.test(token) ? BigInt(token) : fail(`computed instantiation argument '${token}'`);
|
|
1038
|
+
validateParamValue(def, value);
|
|
1039
|
+
return value;
|
|
1040
|
+
}
|
|
1041
|
+
var MAX_INSTANTIATIONS = 256;
|
|
1042
|
+
var MAX_INSTANTIATED_CHARS = 1 << 20;
|
|
1043
|
+
function link(parent, params, body, supplied, stack, tree) {
|
|
1044
|
+
const [, name, list] = body.match(/^([A-Za-z]\w*)\((.*)\)$/) ?? fail(`malformed '${body}'`);
|
|
1045
|
+
if (--tree.links < 0) {
|
|
1046
|
+
fail(`more than ${MAX_INSTANTIATIONS} instantiated contracts, counted once per path`);
|
|
1047
|
+
}
|
|
1048
|
+
const chain = [...stack, parent.contractName];
|
|
1049
|
+
if (chain.includes(name)) fail(`instantiation loop ${[...chain, name].join(" \u2192 ")}`);
|
|
1050
|
+
const pins = parent.contracts;
|
|
1051
|
+
const pin = isRecord(pins) && Object.hasOwn(pins, name) ? pins[name] : void 0;
|
|
1052
|
+
if (typeof pin !== "string") {
|
|
1053
|
+
fail(
|
|
1054
|
+
`${parent.contractName} pins no code hash for ${name}; recompile ${parent.contractName} with arkadec 0.1.0 or later`
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
const child = supplied.get(pin);
|
|
1058
|
+
if (child?.contractName !== name) {
|
|
1059
|
+
fail(
|
|
1060
|
+
[...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\``
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
const program = readArtifact(child, void 0, supplied, chain, tree);
|
|
1064
|
+
if ((tree.chars -= stringifyArtifact(program).length) < 0) {
|
|
1065
|
+
fail(
|
|
1066
|
+
`instantiated programs exceed ${MAX_INSTANTIATED_CHARS} characters, counted once per path`
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
const structs = new Map((child.structs ?? []).map((struct) => [struct.name, struct]));
|
|
1070
|
+
const layout = { left: MAX_LAYOUT_CHARS };
|
|
1071
|
+
const inputs = child.constructorInputs.flatMap((input) => flatten(input, structs, layout));
|
|
1072
|
+
const values = list === "" ? [] : list.split(",");
|
|
1073
|
+
if (values.length !== inputs.length) {
|
|
1074
|
+
fail(
|
|
1075
|
+
`${name} takes ${inputs.length} constructor argument(s); ${parent.contractName} passes ${values.length}`
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
const args = /* @__PURE__ */ Object.create(null);
|
|
1079
|
+
inputs.forEach((input, i) => {
|
|
1080
|
+
args[input.name] = instantiationArg(values[i], input, params);
|
|
1081
|
+
});
|
|
1082
|
+
return { program, args };
|
|
1083
|
+
}
|
|
1014
1084
|
function providedWitness(witness) {
|
|
1015
1085
|
if (witness === void 0) return [];
|
|
1016
1086
|
if (!Array.isArray(witness)) fail("leaf witness must be an array");
|
|
@@ -1036,8 +1106,15 @@ function csvTimelock(leafName, operand) {
|
|
|
1036
1106
|
}
|
|
1037
1107
|
return timelock;
|
|
1038
1108
|
}
|
|
1109
|
+
function legacyOperatorLeaf(asm) {
|
|
1110
|
+
const skipServer = asm.includes("OP_CHECKSEQUENCEVERIFY") || asm.includes("<OPERATOR_KEY>");
|
|
1111
|
+
const server = skipServer ? [] : ["<OPERATOR_KEY>", "OP_CHECKSIGVERIFY"];
|
|
1112
|
+
return asm.flatMap(
|
|
1113
|
+
(token) => token.startsWith("<OPERATOR_KEY:") ? [...server, token.replace("OPERATOR_KEY:", "EMULATOR_KEY:")] : [token]
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1039
1116
|
function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
1040
|
-
const asm = leaf.asm;
|
|
1117
|
+
const asm = legacyOperatorLeaf(leaf.asm);
|
|
1041
1118
|
let index = 0;
|
|
1042
1119
|
let condition;
|
|
1043
1120
|
const hashIndex = asm[0] === "OP_SIZE" && (asm[1] === "20" || asm[1] === "32") && asm[2] === "OP_EQUALVERIFY" ? 3 : 0;
|
|
@@ -1050,7 +1127,7 @@ function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
|
1050
1127
|
let csv;
|
|
1051
1128
|
let cltv;
|
|
1052
1129
|
if (asm.length >= index + 3 && asm[index + 2] === "OP_DROP") {
|
|
1053
|
-
const operand = asm[index].startsWith("<") && asm[index].endsWith(">") ? `$${asm[index].slice(1, -1)}` : BigInt(asm[index]);
|
|
1130
|
+
const operand = asm[index] === "<OPERATOR_EXIT_DELAY>" ? "$SERVER_EXIT_DELAY" : asm[index].startsWith("<") && asm[index].endsWith(">") ? `$${asm[index].slice(1, -1)}` : BigInt(asm[index]);
|
|
1054
1131
|
if (asm[index + 1] === "OP_CHECKSEQUENCEVERIFY") csv = csvTimelock(leaf.name, operand);
|
|
1055
1132
|
else if (asm[index + 1] === "OP_CHECKLOCKTIMEVERIFY") cltv = operand;
|
|
1056
1133
|
else fail(`leaf '${leaf.name}': unexpected timelock opcode ${asm[index + 1]}`);
|
|
@@ -1073,7 +1150,7 @@ function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
|
1073
1150
|
fail(`leaf '${leaf.name}': unsupported key operand '${key}'`);
|
|
1074
1151
|
}
|
|
1075
1152
|
const inner = key.slice(1, -1);
|
|
1076
|
-
if (inner === "
|
|
1153
|
+
if (inner === "OPERATOR_KEY") signers.push("$server");
|
|
1077
1154
|
else if (inner.startsWith("TWEAK:")) {
|
|
1078
1155
|
const [, base, fn] = inner.match(/^TWEAK:([^:]+):([^:]+)$/) ?? [];
|
|
1079
1156
|
if (!base || !fn) fail(`leaf '${leaf.name}': malformed tweak '${key}'`);
|
|
@@ -1107,7 +1184,19 @@ function parseLeaf(leaf, hasCovenant, instantiations, extras) {
|
|
|
1107
1184
|
} : {}
|
|
1108
1185
|
};
|
|
1109
1186
|
}
|
|
1110
|
-
function programFromArtifact(artifact,
|
|
1187
|
+
function programFromArtifact(artifact, options) {
|
|
1188
|
+
const { debug, contracts = [] } = options && "functions" in options ? { debug: options } : options ?? {};
|
|
1189
|
+
const supplied = /* @__PURE__ */ new Map();
|
|
1190
|
+
for (const child of contracts) {
|
|
1191
|
+
if (!isContractArtifact(child)) fail("each of `contracts` must be an arkadec artifact");
|
|
1192
|
+
supplied.set(...codeHash(child));
|
|
1193
|
+
}
|
|
1194
|
+
return readArtifact(artifact, debug, supplied, [], {
|
|
1195
|
+
links: MAX_INSTANTIATIONS,
|
|
1196
|
+
chars: MAX_INSTANTIATED_CHARS
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
function readArtifact(artifact, debug, supplied, stack, tree) {
|
|
1111
1200
|
if (!isContractArtifact(artifact)) {
|
|
1112
1201
|
fail(
|
|
1113
1202
|
"expected a complete arkadec artifact with contractName, constructorInputs, and non-empty functions"
|
|
@@ -1135,6 +1224,10 @@ function programFromArtifact(artifact, debug) {
|
|
|
1135
1224
|
}
|
|
1136
1225
|
const structsByName = new Map(structs.map((struct) => [struct.name, struct]));
|
|
1137
1226
|
const budget = { left: MAX_LAYOUT_CHARS };
|
|
1227
|
+
const serverRole = !artifact.constructorInputs.some(
|
|
1228
|
+
(input) => isNamed(input) && input.name === "SERVER_KEY"
|
|
1229
|
+
);
|
|
1230
|
+
const roles = (asm) => serverRole ? asm.map((token) => token === "<SERVER_KEY>" ? "<OPERATOR_KEY>" : token) : asm;
|
|
1138
1231
|
const instantiations = /* @__PURE__ */ new Map();
|
|
1139
1232
|
const functions = /* @__PURE__ */ Object.create(null);
|
|
1140
1233
|
const groups = /* @__PURE__ */ new Set();
|
|
@@ -1149,7 +1242,7 @@ function programFromArtifact(artifact, debug) {
|
|
|
1149
1242
|
);
|
|
1150
1243
|
const sourceMap = maps?.get(group.name);
|
|
1151
1244
|
const arkadeScript = group.arkade ? {
|
|
1152
|
-
asm: group.arkade.asm.map((token) => asmToken(token, instantiations)),
|
|
1245
|
+
asm: roles(group.arkade.asm).map((token) => asmToken(token, instantiations)),
|
|
1153
1246
|
...covenantInputs.length > 0 ? { inputs: covenantInputs } : {},
|
|
1154
1247
|
// Covenant witness is reverse declaration order.
|
|
1155
1248
|
witness: covenantInputs.map((field) => field.name).reverse(),
|
|
@@ -1173,7 +1266,12 @@ function programFromArtifact(artifact, debug) {
|
|
|
1173
1266
|
}
|
|
1174
1267
|
const witnessNames = /* @__PURE__ */ new Set();
|
|
1175
1268
|
for (const item of leaf.witness ?? []) claim(witnessNames, item.name, "leaf witness");
|
|
1176
|
-
const tapscript = parseLeaf(
|
|
1269
|
+
const tapscript = parseLeaf(
|
|
1270
|
+
{ ...leaf, asm: roles(leaf.asm) },
|
|
1271
|
+
group.arkade !== void 0,
|
|
1272
|
+
instantiations,
|
|
1273
|
+
extras
|
|
1274
|
+
);
|
|
1177
1275
|
if (tapscript.emulator !== void 0 && tapscript.emulator !== null && tapscript.emulator !== group.name) {
|
|
1178
1276
|
fail(
|
|
1179
1277
|
`leaf '${leaf.name}': emulator covenant '${tapscript.emulator}' must match group '${group.name}'`
|
|
@@ -1188,6 +1286,11 @@ function programFromArtifact(artifact, debug) {
|
|
|
1188
1286
|
};
|
|
1189
1287
|
}
|
|
1190
1288
|
}
|
|
1289
|
+
for (const input of artifact.constructorInputs) {
|
|
1290
|
+
if (isNamed(input) && (input.name === "server" || input.name === "SERVER_EXIT_DELAY")) {
|
|
1291
|
+
fail(`constructor input '${input.name}' is reserved by the SDK; rename it`);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1191
1294
|
const params = [
|
|
1192
1295
|
...artifact.constructorInputs.flatMap((input) => flatten(input, structsByName, budget)),
|
|
1193
1296
|
{ name: "server", type: "pubkey" },
|
|
@@ -1199,11 +1302,16 @@ function programFromArtifact(artifact, debug) {
|
|
|
1199
1302
|
];
|
|
1200
1303
|
const paramNames = /* @__PURE__ */ new Set();
|
|
1201
1304
|
for (const param of params) claim(paramNames, param.name, "program parameter");
|
|
1305
|
+
const linked = /* @__PURE__ */ Object.create(null);
|
|
1306
|
+
for (const [name, body] of instantiations) {
|
|
1307
|
+
linked[name] = link(artifact, paramNames, body, supplied, stack, tree);
|
|
1308
|
+
}
|
|
1202
1309
|
return {
|
|
1203
1310
|
version: SUPPORTED_PROGRAM_VERSION,
|
|
1204
1311
|
name: artifact.contractName,
|
|
1205
1312
|
params,
|
|
1206
|
-
functions
|
|
1313
|
+
functions,
|
|
1314
|
+
...instantiations.size > 0 ? { [INSTANTIATED]: linked } : {}
|
|
1207
1315
|
};
|
|
1208
1316
|
}
|
|
1209
1317
|
|
|
@@ -1228,6 +1336,7 @@ exports.deserializeArkadeContractParams = deserializeArkadeContractParams;
|
|
|
1228
1336
|
exports.fromASM = fromASM;
|
|
1229
1337
|
exports.getOpcodeName = getOpcodeName;
|
|
1230
1338
|
exports.getOpcodeValue = getOpcodeValue;
|
|
1339
|
+
exports.instantiatedContracts = instantiatedContracts;
|
|
1231
1340
|
exports.isContractArtifact = isContractArtifact;
|
|
1232
1341
|
exports.parseArtifact = parseArtifact;
|
|
1233
1342
|
exports.programFromArtifact = programFromArtifact;
|
|
@@ -1241,5 +1350,5 @@ exports.toASM = toASM;
|
|
|
1241
1350
|
exports.validateParamValue = validateParamValue;
|
|
1242
1351
|
exports.validateProgram = validateProgram;
|
|
1243
1352
|
exports.witnessRefToBytes = witnessRefToBytes;
|
|
1244
|
-
//# sourceMappingURL=chunk-
|
|
1245
|
-
//# sourceMappingURL=chunk-
|
|
1353
|
+
//# sourceMappingURL=chunk-UNLH3NNG.cjs.map
|
|
1354
|
+
//# sourceMappingURL=chunk-UNLH3NNG.cjs.map
|