@arkade-os/sdk 0.5.4 → 0.5.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.
Files changed (112) hide show
  1. package/README.md +103 -17
  2. package/dist/adapters/expo.cjs +7 -6
  3. package/dist/adapters/expo.d.cts +4 -3
  4. package/dist/adapters/expo.d.ts +4 -3
  5. package/dist/adapters/expo.js +4 -3
  6. package/dist/{asyncStorageTaskQueue-DTBa8EH7.d.cts → asyncStorageTaskQueue-BbH-THYJ.d.cts} +1 -1
  7. package/dist/{asyncStorageTaskQueue-DHMIxY04.d.ts → asyncStorageTaskQueue-BlvkJyTa.d.ts} +1 -1
  8. package/dist/base-C-Y5t_0F.d.cts +359 -0
  9. package/dist/base-C-Y5t_0F.d.ts +359 -0
  10. package/dist/{chunk-AG4TFD6F.js → chunk-4I53THL6.js} +79 -884
  11. package/dist/chunk-4I53THL6.js.map +1 -0
  12. package/dist/{chunk-B6VNKGIH.cjs → chunk-5SYUEVJH.cjs} +10 -10
  13. package/dist/{chunk-B6VNKGIH.cjs.map → chunk-5SYUEVJH.cjs.map} +1 -1
  14. package/dist/{chunk-BTRCN4JJ.js → chunk-7GIKLFHC.js} +64 -4
  15. package/dist/chunk-7GIKLFHC.js.map +1 -0
  16. package/dist/{chunk-E6OOJEHL.cjs → chunk-AMH7Q3DF.cjs} +60 -934
  17. package/dist/chunk-AMH7Q3DF.cjs.map +1 -0
  18. package/dist/{chunk-6CUP6ZIF.js → chunk-BCA6D255.js} +17 -841
  19. package/dist/chunk-BCA6D255.js.map +1 -0
  20. package/dist/{chunk-TUOLZBNC.js → chunk-CE46RS6L.js} +5 -4
  21. package/dist/chunk-CE46RS6L.js.map +1 -0
  22. package/dist/chunk-DNFTHG73.js +829 -0
  23. package/dist/chunk-DNFTHG73.js.map +1 -0
  24. package/dist/chunk-FDJ734CH.js +882 -0
  25. package/dist/chunk-FDJ734CH.js.map +1 -0
  26. package/dist/chunk-FLPWNMX3.cjs +930 -0
  27. package/dist/chunk-FLPWNMX3.cjs.map +1 -0
  28. package/dist/{chunk-MWVAWFX6.js → chunk-FVVXCDNE.js} +4 -4
  29. package/dist/{chunk-MWVAWFX6.js.map → chunk-FVVXCDNE.js.map} +1 -1
  30. package/dist/{chunk-DNITZVNG.cjs → chunk-HQQ4NRXI.cjs} +18 -17
  31. package/dist/chunk-HQQ4NRXI.cjs.map +1 -0
  32. package/dist/chunk-JFJNB7ZH.cjs +884 -0
  33. package/dist/chunk-JFJNB7ZH.cjs.map +1 -0
  34. package/dist/{chunk-GHUUT54D.cjs → chunk-KCL5AVML.cjs} +89 -933
  35. package/dist/chunk-KCL5AVML.cjs.map +1 -0
  36. package/dist/{chunk-ZJHLLDBP.js → chunk-OO2KEK64.js} +2624 -1277
  37. package/dist/chunk-OO2KEK64.js.map +1 -0
  38. package/dist/{chunk-F3FAE7VJ.cjs → chunk-T254PXSN.cjs} +3115 -1752
  39. package/dist/chunk-T254PXSN.cjs.map +1 -0
  40. package/dist/chunk-V3ZLL5VY.js +380 -0
  41. package/dist/chunk-V3ZLL5VY.js.map +1 -0
  42. package/dist/chunk-X6ZI53DZ.cjs +383 -0
  43. package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
  44. package/dist/{chunk-WXNSISXK.cjs → chunk-XWUCNMPN.cjs} +79 -18
  45. package/dist/chunk-XWUCNMPN.cjs.map +1 -0
  46. package/dist/compiler.cjs +50 -0
  47. package/dist/compiler.cjs.map +1 -0
  48. package/dist/compiler.d.cts +38 -0
  49. package/dist/compiler.d.ts +38 -0
  50. package/dist/compiler.js +47 -0
  51. package/dist/compiler.js.map +1 -0
  52. package/dist/contracts/handlers/index.cjs +11 -9
  53. package/dist/contracts/handlers/index.d.cts +6 -4
  54. package/dist/contracts/handlers/index.d.ts +6 -4
  55. package/dist/contracts/handlers/index.js +4 -2
  56. package/dist/{delegate-xrSBNybC.d.ts → delegate-gGkUnYpi.d.cts} +1 -1
  57. package/dist/{delegate-f4_t864Z.d.cts → delegate-iyDum4fw.d.ts} +1 -1
  58. package/dist/{index-BJDz15ms.d.ts → index-BWwVnJhU.d.cts} +5 -270
  59. package/dist/{index-BjiVGtp8.d.cts → index-Bx-iArDs.d.ts} +5 -270
  60. package/dist/{index-DRwe0UDN.d.ts → index-DCml4QJn.d.ts} +1593 -1711
  61. package/dist/{index-DRwe0UDN.d.cts → index-DkyzIzKL.d.cts} +1593 -1711
  62. package/dist/index.cjs +457 -378
  63. package/dist/index.d.cts +633 -378
  64. package/dist/index.d.ts +633 -378
  65. package/dist/index.js +7 -4
  66. package/dist/{wallet-jVBDQl6R.d.cts → keyringDescriptorProvider-CS4w4PWd.d.ts} +412 -361
  67. package/dist/{wallet-Oc3Wd5gv.d.ts → keyringDescriptorProvider-CmHXrIXd.d.cts} +412 -361
  68. package/dist/program-BARSNg3X.d.ts +286 -0
  69. package/dist/program-znrWkxE4.d.cts +286 -0
  70. package/dist/repositories/realm/index.cjs +71 -51
  71. package/dist/repositories/realm/index.cjs.map +1 -1
  72. package/dist/repositories/realm/index.d.cts +20 -9
  73. package/dist/repositories/realm/index.d.ts +20 -9
  74. package/dist/repositories/realm/index.js +42 -23
  75. package/dist/repositories/realm/index.js.map +1 -1
  76. package/dist/repositories/sqlite/index.cjs +81 -56
  77. package/dist/repositories/sqlite/index.cjs.map +1 -1
  78. package/dist/repositories/sqlite/index.d.cts +17 -8
  79. package/dist/repositories/sqlite/index.d.ts +17 -8
  80. package/dist/repositories/sqlite/index.js +55 -31
  81. package/dist/repositories/sqlite/index.js.map +1 -1
  82. package/dist/{taskRunner-CDlNeth0.d.ts → taskRunner-DgMLSk_O.d.ts} +1 -1
  83. package/dist/{taskRunner-BPPU-YHG.d.cts → taskRunner-buh6aFpG.d.cts} +1 -1
  84. package/dist/wallet/expo/background.cjs +17 -14
  85. package/dist/wallet/expo/background.cjs.map +1 -1
  86. package/dist/wallet/expo/background.d.cts +5 -4
  87. package/dist/wallet/expo/background.d.ts +5 -4
  88. package/dist/wallet/expo/background.js +9 -6
  89. package/dist/wallet/expo/background.js.map +1 -1
  90. package/dist/wallet/expo/index.cjs +29 -16
  91. package/dist/wallet/expo/index.cjs.map +1 -1
  92. package/dist/wallet/expo/index.d.cts +12 -7
  93. package/dist/wallet/expo/index.d.ts +12 -7
  94. package/dist/wallet/expo/index.js +19 -6
  95. package/dist/wallet/expo/index.js.map +1 -1
  96. package/dist/worker/expo/index.cjs +12 -9
  97. package/dist/worker/expo/index.cjs.map +1 -1
  98. package/dist/worker/expo/index.d.cts +6 -5
  99. package/dist/worker/expo/index.d.ts +6 -5
  100. package/dist/worker/expo/index.js +8 -5
  101. package/dist/worker/expo/index.js.map +1 -1
  102. package/package.json +16 -1
  103. package/dist/chunk-6CUP6ZIF.js.map +0 -1
  104. package/dist/chunk-AG4TFD6F.js.map +0 -1
  105. package/dist/chunk-BTRCN4JJ.js.map +0 -1
  106. package/dist/chunk-DNITZVNG.cjs.map +0 -1
  107. package/dist/chunk-E6OOJEHL.cjs.map +0 -1
  108. package/dist/chunk-F3FAE7VJ.cjs.map +0 -1
  109. package/dist/chunk-GHUUT54D.cjs.map +0 -1
  110. package/dist/chunk-TUOLZBNC.js.map +0 -1
  111. package/dist/chunk-WXNSISXK.cjs.map +0 -1
  112. package/dist/chunk-ZJHLLDBP.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ var chunkX6ZI53DZ_cjs = require('./chunk-X6ZI53DZ.cjs');
4
+ require('./chunk-JFJNB7ZH.cjs');
5
+ require('./chunk-FLPWNMX3.cjs');
6
+
7
+ // src/compiler.ts
8
+ var CompileError = class extends Error {
9
+ constructor(diagnostics) {
10
+ super(
11
+ diagnostics.filter((d) => d.severity === "error").map(
12
+ (d) => `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : ""}: ${d.message}`
13
+ ).join("\n") || "compilation failed"
14
+ );
15
+ this.diagnostics = diagnostics;
16
+ }
17
+ diagnostics;
18
+ name = "CompileError";
19
+ };
20
+ var PEER = "@arkade-os/compiler";
21
+ async function compile(input, options) {
22
+ let compiler;
23
+ try {
24
+ compiler = await import('@arkade-os/compiler');
25
+ } catch (error) {
26
+ const code = error?.code;
27
+ if ((code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND") && String(error.message).includes(`'${PEER}'`)) {
28
+ throw new Error(
29
+ `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,
30
+ { cause: error }
31
+ );
32
+ }
33
+ throw error;
34
+ }
35
+ const { debug = true, ...compilerOptions } = options ?? {};
36
+ const result = await compiler.compile(input, compilerOptions);
37
+ if (result.artifact === null) throw new CompileError(result.diagnostics);
38
+ const kept = debug ? result.debug : void 0;
39
+ return {
40
+ program: chunkX6ZI53DZ_cjs.programFromArtifact(result.artifact, kept),
41
+ artifact: result.artifact,
42
+ ...kept ? { debug: kept } : {},
43
+ diagnostics: result.diagnostics
44
+ };
45
+ }
46
+
47
+ exports.CompileError = CompileError;
48
+ exports.compile = compile;
49
+ //# sourceMappingURL=compiler.cjs.map
50
+ //# sourceMappingURL=compiler.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/compiler.ts"],"names":["programFromArtifact"],"mappings":";;;;;;;AAoCO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAEpC,YAAqB,WAAA,EAA2B;AAC5C,IAAA,KAAA;AAAA,MACI,YACK,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,QAAA,KAAa,OAAO,CAAA,CACpC,GAAA;AAAA,QACG,CAAC,MACG,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,EAAG,CAAA,CAAE,QAAQ,CAAA,CAAA,EAAI,CAAA,CAAE,MAAM,IAAI,CAAA,CAAA,EAAI,EAAE,KAAA,CAAM,MAAM,KAAK,EAAE,CAAA,EAAA,EAAK,EAAE,OAAO,CAAA;AAAA,OACrF,CACC,IAAA,CAAK,IAAI,CAAA,IAAK;AAAA,KACvB;AATiB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EAUrB;AAAA,EAVqB,WAAA;AAAA,EADH,IAAA,GAAO,cAAA;AAY7B;AAEA,IAAM,IAAA,GAAO,qBAAA;AAGb,eAAsB,OAAA,CAClB,OACA,OAAA,EACsB;AACtB,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACA,IAAA,QAAA,GAAW,MAAM,OAAO,qBAAqB,CAAA;AAAA,EACjD,SAAS,KAAA,EAAO;AAEZ,IAAA,MAAM,OAAQ,KAAA,EAAqC,IAAA;AACnD,IAAA,IAAA,CACK,IAAA,KAAS,sBAAA,IAA0B,IAAA,KAAS,kBAAA,KAC7C,MAAA,CAAQ,KAAA,CAAgB,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,CAAG,CAAA,EACvD;AACE,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,CAAA,gDAAA,EAAmD,IAAI,CAAA,2BAAA,EAA8B,IAAI,CAAA,CAAA;AAAA,QACzF,EAAE,OAAO,KAAA;AAAM,OACnB;AAAA,IACJ;AACA,IAAA,MAAM,KAAA;AAAA,EACV;AACA,EAAA,MAAM,EAAE,KAAA,GAAQ,IAAA,EAAM,GAAG,eAAA,EAAgB,GAAI,WAAW,EAAC;AACzD,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,OAAA,CAAQ,OAAO,eAAe,CAAA;AAC5D,EAAA,IAAI,OAAO,QAAA,KAAa,IAAA,QAAY,IAAI,YAAA,CAAa,OAAO,WAAW,CAAA;AAGvE,EAAA,MAAM,IAAA,GAAO,KAAA,GAAQ,MAAA,CAAO,KAAA,GAAQ,MAAA;AACpC,EAAA,OAAO;AAAA,IACH,OAAA,EAASA,qCAAA,CAAoB,MAAA,CAAO,QAAA,EAAU,IAAI,CAAA;AAAA,IAClD,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,GAAI,IAAA,GAAO,EAAE,KAAA,EAAO,IAAA,KAAS,EAAC;AAAA,IAC9B,aAAa,MAAA,CAAO;AAAA,GACxB;AACJ","file":"compiler.cjs","sourcesContent":["/**\n * Compile Arkade source into an SDK {@link Program}. Needs the optional peer\n * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.\n *\n * @module compiler\n */\n\nimport type {\n CompileInput,\n CompileOptions as CompilerOptions,\n CompilerArtifact,\n DebugInfo,\n Diagnostic,\n} from \"@arkade-os/compiler\";\n\nimport { programFromArtifact } from \"./arkade/artifact\";\nimport type { Program } from \"./arkade/program\";\n\nexport type { CompileInput, CompilerArtifact, DebugInfo, Diagnostic };\n\nexport interface CompileOptions extends CompilerOptions {\n /** Return the debug file and put its source maps on `program`. Defaults to `true`. */\n debug?: boolean;\n}\n\nexport interface CompileOutput {\n program: Program;\n /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */\n artifact: CompilerArtifact;\n /** The debug file: each covenant's source map. Absent with `debug: false`. */\n debug?: DebugInfo;\n /** Warnings; errors reject with {@link CompileError}. */\n diagnostics: Diagnostic[];\n}\n\n/** The source did not compile. `diagnostics` lists every error and warning. */\nexport class CompileError extends Error {\n override readonly name = \"CompileError\";\n constructor(readonly diagnostics: Diagnostic[]) {\n super(\n diagnostics\n .filter((d) => d.severity === \"error\")\n .map(\n (d) =>\n `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : \"\"}: ${d.message}`,\n )\n .join(\"\\n\") || \"compilation failed\",\n );\n }\n}\n\nconst PEER = \"@arkade-os/compiler\";\n\n/** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */\nexport async function compile(\n input: CompileInput,\n options?: CompileOptions,\n): Promise<CompileOutput> {\n let compiler: typeof import(\"@arkade-os/compiler\");\n try {\n compiler = await import(\"@arkade-os/compiler\");\n } catch (error) {\n // Only a missing peer gets the install hint; anything else keeps its own error.\n const code = (error as { code?: unknown } | null)?.code;\n if (\n (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") &&\n String((error as Error).message).includes(`'${PEER}'`)\n ) {\n throw new Error(\n `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,\n { cause: error },\n );\n }\n throw error;\n }\n const { debug = true, ...compilerOptions } = options ?? {};\n const result = await compiler.compile(input, compilerOptions);\n if (result.artifact === null) throw new CompileError(result.diagnostics);\n // ponytail: the compiler always builds the debug file; it will take an option to skip it soon,\n // until then `debug: false` only drops it.\n const kept = debug ? result.debug : undefined;\n return {\n program: programFromArtifact(result.artifact, kept),\n artifact: result.artifact,\n ...(kept ? { debug: kept } : {}),\n diagnostics: result.diagnostics,\n };\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import { Diagnostic, CompileOptions as CompileOptions$1, CompilerArtifact, DebugInfo, CompileInput } from '@arkade-os/compiler';
2
+ export { CompileInput, CompilerArtifact, DebugInfo, Diagnostic } from '@arkade-os/compiler';
3
+ import { P as Program } from './program-znrWkxE4.cjs';
4
+ import './base-C-Y5t_0F.cjs';
5
+ import '@scure/btc-signer';
6
+ import '@scure/btc-signer/psbt.js';
7
+ import '@scure/btc-signer/utils.js';
8
+
9
+ /**
10
+ * Compile Arkade source into an SDK {@link Program}. Needs the optional peer
11
+ * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.
12
+ *
13
+ * @module compiler
14
+ */
15
+
16
+ interface CompileOptions extends CompileOptions$1 {
17
+ /** Return the debug file and put its source maps on `program`. Defaults to `true`. */
18
+ debug?: boolean;
19
+ }
20
+ interface CompileOutput {
21
+ program: Program;
22
+ /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */
23
+ artifact: CompilerArtifact;
24
+ /** The debug file: each covenant's source map. Absent with `debug: false`. */
25
+ debug?: DebugInfo;
26
+ /** Warnings; errors reject with {@link CompileError}. */
27
+ diagnostics: Diagnostic[];
28
+ }
29
+ /** The source did not compile. `diagnostics` lists every error and warning. */
30
+ declare class CompileError extends Error {
31
+ readonly diagnostics: Diagnostic[];
32
+ readonly name = "CompileError";
33
+ constructor(diagnostics: Diagnostic[]);
34
+ }
35
+ /** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */
36
+ declare function compile(input: CompileInput, options?: CompileOptions): Promise<CompileOutput>;
37
+
38
+ export { CompileError, type CompileOptions, type CompileOutput, compile };
@@ -0,0 +1,38 @@
1
+ import { Diagnostic, CompileOptions as CompileOptions$1, CompilerArtifact, DebugInfo, CompileInput } from '@arkade-os/compiler';
2
+ export { CompileInput, CompilerArtifact, DebugInfo, Diagnostic } from '@arkade-os/compiler';
3
+ import { P as Program } from './program-BARSNg3X.js';
4
+ import './base-C-Y5t_0F.js';
5
+ import '@scure/btc-signer';
6
+ import '@scure/btc-signer/psbt.js';
7
+ import '@scure/btc-signer/utils.js';
8
+
9
+ /**
10
+ * Compile Arkade source into an SDK {@link Program}. Needs the optional peer
11
+ * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.
12
+ *
13
+ * @module compiler
14
+ */
15
+
16
+ interface CompileOptions extends CompileOptions$1 {
17
+ /** Return the debug file and put its source maps on `program`. Defaults to `true`. */
18
+ debug?: boolean;
19
+ }
20
+ interface CompileOutput {
21
+ program: Program;
22
+ /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */
23
+ artifact: CompilerArtifact;
24
+ /** The debug file: each covenant's source map. Absent with `debug: false`. */
25
+ debug?: DebugInfo;
26
+ /** Warnings; errors reject with {@link CompileError}. */
27
+ diagnostics: Diagnostic[];
28
+ }
29
+ /** The source did not compile. `diagnostics` lists every error and warning. */
30
+ declare class CompileError extends Error {
31
+ readonly diagnostics: Diagnostic[];
32
+ readonly name = "CompileError";
33
+ constructor(diagnostics: Diagnostic[]);
34
+ }
35
+ /** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */
36
+ declare function compile(input: CompileInput, options?: CompileOptions): Promise<CompileOutput>;
37
+
38
+ export { CompileError, type CompileOptions, type CompileOutput, compile };
@@ -0,0 +1,47 @@
1
+ import { programFromArtifact } from './chunk-V3ZLL5VY.js';
2
+ import './chunk-DNFTHG73.js';
3
+ import './chunk-FDJ734CH.js';
4
+
5
+ // src/compiler.ts
6
+ var CompileError = class extends Error {
7
+ constructor(diagnostics) {
8
+ super(
9
+ diagnostics.filter((d) => d.severity === "error").map(
10
+ (d) => `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : ""}: ${d.message}`
11
+ ).join("\n") || "compilation failed"
12
+ );
13
+ this.diagnostics = diagnostics;
14
+ }
15
+ diagnostics;
16
+ name = "CompileError";
17
+ };
18
+ var PEER = "@arkade-os/compiler";
19
+ async function compile(input, options) {
20
+ let compiler;
21
+ try {
22
+ compiler = await import('@arkade-os/compiler');
23
+ } catch (error) {
24
+ const code = error?.code;
25
+ if ((code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND") && String(error.message).includes(`'${PEER}'`)) {
26
+ throw new Error(
27
+ `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,
28
+ { cause: error }
29
+ );
30
+ }
31
+ throw error;
32
+ }
33
+ const { debug = true, ...compilerOptions } = options ?? {};
34
+ const result = await compiler.compile(input, compilerOptions);
35
+ if (result.artifact === null) throw new CompileError(result.diagnostics);
36
+ const kept = debug ? result.debug : void 0;
37
+ return {
38
+ program: programFromArtifact(result.artifact, kept),
39
+ artifact: result.artifact,
40
+ ...kept ? { debug: kept } : {},
41
+ diagnostics: result.diagnostics
42
+ };
43
+ }
44
+
45
+ export { CompileError, compile };
46
+ //# sourceMappingURL=compiler.js.map
47
+ //# sourceMappingURL=compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/compiler.ts"],"names":[],"mappings":";;;;;AAoCO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAEpC,YAAqB,WAAA,EAA2B;AAC5C,IAAA,KAAA;AAAA,MACI,YACK,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,QAAA,KAAa,OAAO,CAAA,CACpC,GAAA;AAAA,QACG,CAAC,MACG,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,EAAG,CAAA,CAAE,QAAQ,CAAA,CAAA,EAAI,CAAA,CAAE,MAAM,IAAI,CAAA,CAAA,EAAI,EAAE,KAAA,CAAM,MAAM,KAAK,EAAE,CAAA,EAAA,EAAK,EAAE,OAAO,CAAA;AAAA,OACrF,CACC,IAAA,CAAK,IAAI,CAAA,IAAK;AAAA,KACvB;AATiB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EAUrB;AAAA,EAVqB,WAAA;AAAA,EADH,IAAA,GAAO,cAAA;AAY7B;AAEA,IAAM,IAAA,GAAO,qBAAA;AAGb,eAAsB,OAAA,CAClB,OACA,OAAA,EACsB;AACtB,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACA,IAAA,QAAA,GAAW,MAAM,OAAO,qBAAqB,CAAA;AAAA,EACjD,SAAS,KAAA,EAAO;AAEZ,IAAA,MAAM,OAAQ,KAAA,EAAqC,IAAA;AACnD,IAAA,IAAA,CACK,IAAA,KAAS,sBAAA,IAA0B,IAAA,KAAS,kBAAA,KAC7C,MAAA,CAAQ,KAAA,CAAgB,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,CAAG,CAAA,EACvD;AACE,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,CAAA,gDAAA,EAAmD,IAAI,CAAA,2BAAA,EAA8B,IAAI,CAAA,CAAA;AAAA,QACzF,EAAE,OAAO,KAAA;AAAM,OACnB;AAAA,IACJ;AACA,IAAA,MAAM,KAAA;AAAA,EACV;AACA,EAAA,MAAM,EAAE,KAAA,GAAQ,IAAA,EAAM,GAAG,eAAA,EAAgB,GAAI,WAAW,EAAC;AACzD,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,OAAA,CAAQ,OAAO,eAAe,CAAA;AAC5D,EAAA,IAAI,OAAO,QAAA,KAAa,IAAA,QAAY,IAAI,YAAA,CAAa,OAAO,WAAW,CAAA;AAGvE,EAAA,MAAM,IAAA,GAAO,KAAA,GAAQ,MAAA,CAAO,KAAA,GAAQ,MAAA;AACpC,EAAA,OAAO;AAAA,IACH,OAAA,EAAS,mBAAA,CAAoB,MAAA,CAAO,QAAA,EAAU,IAAI,CAAA;AAAA,IAClD,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,GAAI,IAAA,GAAO,EAAE,KAAA,EAAO,IAAA,KAAS,EAAC;AAAA,IAC9B,aAAa,MAAA,CAAO;AAAA,GACxB;AACJ","file":"compiler.js","sourcesContent":["/**\n * Compile Arkade source into an SDK {@link Program}. Needs the optional peer\n * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.\n *\n * @module compiler\n */\n\nimport type {\n CompileInput,\n CompileOptions as CompilerOptions,\n CompilerArtifact,\n DebugInfo,\n Diagnostic,\n} from \"@arkade-os/compiler\";\n\nimport { programFromArtifact } from \"./arkade/artifact\";\nimport type { Program } from \"./arkade/program\";\n\nexport type { CompileInput, CompilerArtifact, DebugInfo, Diagnostic };\n\nexport interface CompileOptions extends CompilerOptions {\n /** Return the debug file and put its source maps on `program`. Defaults to `true`. */\n debug?: boolean;\n}\n\nexport interface CompileOutput {\n program: Program;\n /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */\n artifact: CompilerArtifact;\n /** The debug file: each covenant's source map. Absent with `debug: false`. */\n debug?: DebugInfo;\n /** Warnings; errors reject with {@link CompileError}. */\n diagnostics: Diagnostic[];\n}\n\n/** The source did not compile. `diagnostics` lists every error and warning. */\nexport class CompileError extends Error {\n override readonly name = \"CompileError\";\n constructor(readonly diagnostics: Diagnostic[]) {\n super(\n diagnostics\n .filter((d) => d.severity === \"error\")\n .map(\n (d) =>\n `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : \"\"}: ${d.message}`,\n )\n .join(\"\\n\") || \"compilation failed\",\n );\n }\n}\n\nconst PEER = \"@arkade-os/compiler\";\n\n/** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */\nexport async function compile(\n input: CompileInput,\n options?: CompileOptions,\n): Promise<CompileOutput> {\n let compiler: typeof import(\"@arkade-os/compiler\");\n try {\n compiler = await import(\"@arkade-os/compiler\");\n } catch (error) {\n // Only a missing peer gets the install hint; anything else keeps its own error.\n const code = (error as { code?: unknown } | null)?.code;\n if (\n (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") &&\n String((error as Error).message).includes(`'${PEER}'`)\n ) {\n throw new Error(\n `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,\n { cause: error },\n );\n }\n throw error;\n }\n const { debug = true, ...compilerOptions } = options ?? {};\n const result = await compiler.compile(input, compilerOptions);\n if (result.artifact === null) throw new CompileError(result.diagnostics);\n // ponytail: the compiler always builds the debug file; it will take an option to skip it soon,\n // until then `debug: false` only drops it.\n const kept = debug ? result.debug : undefined;\n return {\n program: programFromArtifact(result.artifact, kept),\n artifact: result.artifact,\n ...(kept ? { debug: kept } : {}),\n diagnostics: result.diagnostics,\n };\n}\n"]}
@@ -1,37 +1,39 @@
1
1
  'use strict';
2
2
 
3
- var chunkE6OOJEHL_cjs = require('../../chunk-E6OOJEHL.cjs');
4
- require('../../chunk-GHUUT54D.cjs');
3
+ var chunkAMH7Q3DF_cjs = require('../../chunk-AMH7Q3DF.cjs');
4
+ require('../../chunk-JFJNB7ZH.cjs');
5
+ require('../../chunk-KCL5AVML.cjs');
6
+ require('../../chunk-FLPWNMX3.cjs');
5
7
 
6
8
 
7
9
 
8
10
  Object.defineProperty(exports, "ArkadeContractHandler", {
9
11
  enumerable: true,
10
- get: function () { return chunkE6OOJEHL_cjs.ArkadeContractHandler; }
12
+ get: function () { return chunkAMH7Q3DF_cjs.ArkadeContractHandler; }
11
13
  });
12
14
  Object.defineProperty(exports, "BoardingContractHandler", {
13
15
  enumerable: true,
14
- get: function () { return chunkE6OOJEHL_cjs.BoardingContractHandler; }
16
+ get: function () { return chunkAMH7Q3DF_cjs.BoardingContractHandler; }
15
17
  });
16
18
  Object.defineProperty(exports, "DefaultContractHandler", {
17
19
  enumerable: true,
18
- get: function () { return chunkE6OOJEHL_cjs.DefaultContractHandler; }
20
+ get: function () { return chunkAMH7Q3DF_cjs.DefaultContractHandler; }
19
21
  });
20
22
  Object.defineProperty(exports, "DelegateContractHandler", {
21
23
  enumerable: true,
22
- get: function () { return chunkE6OOJEHL_cjs.DelegateContractHandler; }
24
+ get: function () { return chunkAMH7Q3DF_cjs.DelegateContractHandler; }
23
25
  });
24
26
  Object.defineProperty(exports, "VHTLCContractHandler", {
25
27
  enumerable: true,
26
- get: function () { return chunkE6OOJEHL_cjs.VHTLCContractHandler; }
28
+ get: function () { return chunkAMH7Q3DF_cjs.VHTLCContractHandler; }
27
29
  });
28
30
  Object.defineProperty(exports, "VHTLCV2ContractHandler", {
29
31
  enumerable: true,
30
- get: function () { return chunkE6OOJEHL_cjs.VHTLCV2ContractHandler; }
32
+ get: function () { return chunkAMH7Q3DF_cjs.VHTLCV2ContractHandler; }
31
33
  });
32
34
  Object.defineProperty(exports, "contractHandlers", {
33
35
  enumerable: true,
34
- get: function () { return chunkE6OOJEHL_cjs.contractHandlers; }
36
+ get: function () { return chunkAMH7Q3DF_cjs.contractHandlers; }
35
37
  });
36
38
  //# sourceMappingURL=index.cjs.map
37
39
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,9 @@
1
- export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-BjiVGtp8.cjs';
2
- import '../../index-DRwe0UDN.cjs';
1
+ export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from '../../index-BWwVnJhU.cjs';
2
+ import '../../index-DkyzIzKL.cjs';
3
3
  import '@scure/btc-signer/utils.js';
4
- import '@scure/btc-signer/psbt.js';
5
4
  import '@scure/btc-signer';
5
+ import '@scure/btc-signer/psbt.js';
6
+ import '../../base-C-Y5t_0F.cjs';
6
7
  import '@scure/btc-signer/transaction.js';
7
- import '../../delegate-f4_t864Z.cjs';
8
+ import '../../delegate-gGkUnYpi.cjs';
9
+ import '../../program-znrWkxE4.cjs';
@@ -1,7 +1,9 @@
1
- export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-BJDz15ms.js';
2
- import '../../index-DRwe0UDN.js';
1
+ export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from '../../index-Bx-iArDs.js';
2
+ import '../../index-DCml4QJn.js';
3
3
  import '@scure/btc-signer/utils.js';
4
- import '@scure/btc-signer/psbt.js';
5
4
  import '@scure/btc-signer';
5
+ import '@scure/btc-signer/psbt.js';
6
+ import '../../base-C-Y5t_0F.js';
6
7
  import '@scure/btc-signer/transaction.js';
7
- import '../../delegate-xrSBNybC.js';
8
+ import '../../delegate-iyDum4fw.js';
9
+ import '../../program-BARSNg3X.js';
@@ -1,4 +1,6 @@
1
- export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-6CUP6ZIF.js';
2
- import '../../chunk-AG4TFD6F.js';
1
+ export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-BCA6D255.js';
2
+ import '../../chunk-DNFTHG73.js';
3
+ import '../../chunk-4I53THL6.js';
4
+ import '../../chunk-FDJ734CH.js';
3
5
  //# sourceMappingURL=index.js.map
4
6
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { x as RelativeTimelock, V as VtxoScript, y as TapLeafScript } from './index-DRwe0UDN.js';
2
+ import { R as RelativeTimelock, V as VtxoScript, T as TapLeafScript } from './base-C-Y5t_0F.cjs';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { x as RelativeTimelock, V as VtxoScript, y as TapLeafScript } from './index-DRwe0UDN.cjs';
2
+ import { R as RelativeTimelock, V as VtxoScript, T as TapLeafScript } from './base-C-Y5t_0F.js';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -1,6 +1,8 @@
1
- import { bK as ContractHandler, x as RelativeTimelock, bW as Discoverable, V as VtxoScript, y as TapLeafScript, dR as TapscriptDeriving } from './index-DRwe0UDN.js';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-xrSBNybC.js';
1
+ import { bH as ContractHandler, bU as Discoverable, dS as TapscriptDeriving } from './index-DkyzIzKL.cjs';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-gGkUnYpi.cjs';
3
+ import { R as RelativeTimelock, V as VtxoScript, T as TapLeafScript } from './base-C-Y5t_0F.cjs';
3
4
  import { Bytes } from '@scure/btc-signer/utils.js';
5
+ import { g as ArkadeContractParams, a as ArkadeProgramScript } from './program-znrWkxE4.cjs';
4
6
 
5
7
  /**
6
8
  * Registry for contract handlers.
@@ -363,273 +365,6 @@ type BoardingContractParams = DefaultContractParams;
363
365
  */
364
366
  declare const BoardingContractHandler: ContractHandler<BoardingContractParams, DefaultVtxo.Script> & Discoverable;
365
367
 
366
- /**
367
- * Arkade Program model & compiler.
368
- *
369
- * A {@link Program} is the normalized SDK model: named functions, each
370
- * split into a `tapscript` segment enforced
371
- * on-chain and an optional `arkadeScript` segment emulated by the co-signing
372
- * service. This module owns everything that is *pure data → script*:
373
- *
374
- * - the Program/segment/token types,
375
- * - `$param` resolution ({@link resolveAsm}), witness and timelock resolution,
376
- * - program validation ({@link validateProgram}) — every referenced constructor
377
- * parameter must be declared and bound,
378
- * - {@link ArkadeProgramScript} — a {@link VtxoScript} compiled from a
379
- * program, its constructor args and the signer keys,
380
- * - artifact JSON (de)serialization ({@link parseArtifact} /
381
- * {@link stringifyArtifact}) and the string-keyed contract params used to
382
- * persist a program contract through the `src/contracts` pipeline.
383
- *
384
- * Keeping this free of provider/transaction imports lets the generic
385
- * `arkade` contract handler (src/contracts/handlers/arkade.ts) and the
386
- * high-level `ArkadeContract` client share one compilation path.
387
- *
388
- * @module arkade/program
389
- */
390
-
391
- /** A token in an `asm` array: an opcode name, a number/bigint push, raw bytes, or a `$param` placeholder. */
392
- type AsmToken = string | number | bigint | Uint8Array;
393
- /** A constructor argument or resolved value. */
394
- type ArkadeParamValue = Uint8Array | bigint | number;
395
- /** A function call argument (function input). */
396
- type ArkadeArgValue = Uint8Array | bigint | number;
397
- /** Native scalar types and their compiler witness encodings. */
398
- declare const ARKADE_TYPE_ENCODINGS: {
399
- readonly pubkey: "raw";
400
- readonly signature: "schnorr-64";
401
- readonly bytes: "raw";
402
- readonly bytes20: "raw-20";
403
- readonly bytes32: "raw-32";
404
- readonly asset: "raw-32";
405
- readonly int: "scriptnum";
406
- readonly bool: "scriptnum";
407
- readonly AssetGroup: "scriptnum";
408
- };
409
- /** A native Arkade scalar type for a constructor parameter or call input. */
410
- type ArkadeArgType = keyof typeof ARKADE_TYPE_ENCODINGS;
411
- /**
412
- * Maps an {@link ArkadeArgType} to its TypeScript argument type.
413
- * @internal
414
- */
415
- interface ArkadeValueType {
416
- bytes: Uint8Array;
417
- pubkey: Uint8Array;
418
- signature: Uint8Array;
419
- bytes20: Uint8Array;
420
- bytes32: Uint8Array;
421
- asset: Uint8Array;
422
- int: bigint | number;
423
- bool: bigint | number;
424
- AssetGroup: bigint | number;
425
- }
426
- /** A typed function input or constructor param: a name plus its {@link ArkadeArgType}. */
427
- interface InputDef {
428
- name: string;
429
- type: ArkadeArgType;
430
- }
431
- /** A typed function input or constructor parameter. */
432
- type InputRef = InputDef;
433
- /** Constructor pubkey `$param` tweaked by `fn`'s covenant. */
434
- interface TweakedSigner {
435
- tweak: string;
436
- fn: string;
437
- }
438
- /** A `"$param"` reference, literal x-only bytes, or a {@link TweakedSigner}. */
439
- type SignerRef = string | Uint8Array | TweakedSigner;
440
- /** A witness-stack item: a function-input name, a `"$param"`, a literal number/bigint (minimal script-num), or raw bytes. */
441
- type WitnessRef = string | number | bigint | Uint8Array;
442
- /** Bitcoin Script segment of a spending path — enforced on-chain. */
443
- interface TapscriptSegment {
444
- /**
445
- * Required signers. A path with `arkadeScript` also inserts the emulator
446
- * co-signer at `emulatorIndex` (last by default), unless `emulator` is `null`.
447
- */
448
- signers: SignerRef[];
449
- /** Caller signature ABI; satisfied through PSBT signing, never ConditionWitness. */
450
- signatures?: InputDef[];
451
- /**
452
- * Covenant named by `<EMULATOR_KEY:fn>`. `null` when this leaf belongs to a
453
- * covenant but signs with a constructor-key tweak instead. Omitted on
454
- * hand-written programs, which still append the co-signer.
455
- */
456
- emulator?: string | null;
457
- /** Emulator's position in the full signer list; omitted to append it. */
458
- emulatorIndex?: number;
459
- /**
460
- * Optional standard-opcode condition (e.g. a hashlock), encoded into a
461
- * ConditionMultisig leaf — or ConditionCSVMultisig when combined with `csv`.
462
- */
463
- asm?: AsmToken[];
464
- /**
465
- * Relative timelock (CSV). The value is a literal or a `"$param"` reference
466
- * resolved against the constructor args (same convention as {@link SignerRef}).
467
- * `"blocks"` and `"seconds"` are counts; `"sequence"` is a raw BIP68
468
- * sequence, which is what an `arkadec` CSV operand holds.
469
- * Combinable with `asm` (condition + CSV); mutually exclusive with `cltv`.
470
- */
471
- csv?: {
472
- type: "blocks" | "seconds" | "sequence";
473
- value: bigint | string;
474
- };
475
- /**
476
- * Absolute timelock (CLTV): a literal or a `"$param"` reference.
477
- * Mutually exclusive with `csv`/`asm`.
478
- */
479
- cltv?: bigint | string;
480
- /** Items satisfying the condition (e.g. an HTLC preimage); set via the ConditionWitness PSBT field. */
481
- witness?: WitnessRef[];
482
- }
483
- /** Arkade Script segment of a spending path — emulated, bound via the key tweak. */
484
- interface ArkadeSegment {
485
- /** Raw Arkade opcodes with `$param` placeholders. */
486
- asm: AsmToken[];
487
- /** The arkade-script witness stack (e.g. an output index). */
488
- witness?: WitnessRef[];
489
- }
490
- /** One named spending path. */
491
- interface ArkadeFunction {
492
- /** Compiler spend group, used to resolve named covenant commitments. */
493
- group?: string;
494
- /** Ordered typed call arguments; absent for nullary paths. */
495
- inputs?: readonly InputDef[];
496
- tapscript: TapscriptSegment;
497
- /** Present for covenant paths; absent for pure-tapscript paths (cancel/exit). */
498
- arkadeScript?: ArkadeSegment;
499
- }
500
- /** Supported normalized Program version. */
501
- declare const SUPPORTED_PROGRAM_VERSION = 1;
502
- /**
503
- * A Program written for a version this SDK cannot read. Typed so a stored row in that format is
504
- * reported as unsupported rather than broken: its script stays unknown until it is recovered with
505
- * an SDK that reads that version, or re-created from fresh params.
506
- */
507
- declare class UnsupportedProgramVersionError extends Error {
508
- readonly version: unknown;
509
- readonly name = "UnsupportedProgramVersionError";
510
- constructor(version: unknown, context: string);
511
- }
512
- /** An Arkade contract program (hand-written or compiler-emitted). */
513
- interface Program {
514
- version: number;
515
- /**
516
- * Optional program name — metadata only: round-tripped through the
517
- * artifact JSON, never used in compilation or the taproot tree.
518
- */
519
- name?: string;
520
- /** Ordered typed constructor parameters. */
521
- params?: readonly InputDef[];
522
- functions: Record<string, ArkadeFunction>;
523
- }
524
- /**
525
- * Resolve an `asm` array to bytes: substitute `$param` placeholders from `bind`,
526
- * pass everything else (opcode names, numbers, raw byte pushes) through to the
527
- * Arkade script encoder. The SDK does not interpret opcodes — this is pure
528
- * substitution + encoding. To embed a signer key (server, user, or any
529
- * other), pass it as a `$param` in the constructor args. Compiler `<...>`
530
- * placeholders are normalized by {@link programFromArtifact} before this step.
531
- */
532
- declare function resolveAsm(asm: AsmToken[], bind: Record<string, ArkadeParamValue>): Uint8Array;
533
- /**
534
- * Resolve one witness-stack item to bytes.
535
- *
536
- * - raw bytes pass through;
537
- * - numbers/bigints encode as minimal script-nums;
538
- * - `"$param"` strings resolve against the program's constructor args;
539
- * - any other string is a function-input name and resolves against `callArgs`
540
- * (throws when the input is unbound — e.g. outside a function call).
541
- */
542
- declare function witnessRefToBytes(ref: WitnessRef, callArgs: Record<string, ArkadeArgValue>, programArgs: Record<string, ArkadeParamValue>): Uint8Array;
543
- /** Validate declared constructor values and reject undeclared references. */
544
- declare function validateProgram(program: Program, args: Record<string, ArkadeParamValue>): void;
545
- /** The signer keys a program is compiled against. */
546
- interface ProgramKeys {
547
- /** The Arkade Service signer key (x-only) — used for address derivation and collaborative-path detection, not for `$param` resolution. */
548
- serverKey: Uint8Array;
549
- /** The wallet's x-only key — identifies which inputs the wallet signs. */
550
- userKey?: Uint8Array;
551
- /** The co-signer (emulator) key — required only for covenant (`arkadeScript`) functions. */
552
- emulatorKey?: Uint8Array;
553
- }
554
- /**
555
- * A single spending path, fully resolved at compilation: its definition, the
556
- * committed leaf body, the per-path arkade-script bytes (covenant paths only),
557
- * and the {@link TapLeafScript} (control block) for spending it.
558
- */
559
- interface CompiledProgramFunction {
560
- name: string;
561
- def: ArkadeFunction;
562
- /** The committed leaf script (body). */
563
- leafScript: Uint8Array;
564
- /** Resolved arkade-script bytes; undefined for pure-tapscript paths. */
565
- arkadeScript?: Uint8Array;
566
- /** Resolved signer keys (x-only), in the declared `signers` order. */
567
- signerKeys: Uint8Array[];
568
- /** Resolved once — the taproot leaf + control block for this path. */
569
- tapLeafScript: TapLeafScript;
570
- }
571
- /**
572
- * A {@link VtxoScript} compiled from an Arkade {@link Program}, its
573
- * constructor args and the signer keys.
574
- *
575
- * This is the single compilation path shared by the high-level
576
- * `ArkadeContract` client and the `"arkade"` contract handler: both produce
577
- * byte-identical taproot trees for the same (program, args, keys), so a
578
- * contract registered through the `src/contracts` pipeline re-derives the
579
- * exact script it was created with.
580
- */
581
- declare class ArkadeProgramScript extends VtxoScript {
582
- readonly program: Program;
583
- readonly args: Record<string, ArkadeParamValue>;
584
- readonly keys: ProgramKeys;
585
- /** Spending paths in declaration order. */
586
- readonly compiled: CompiledProgramFunction[];
587
- constructor(program: Program, args: Record<string, ArkadeParamValue>, keys: ProgramKeys);
588
- /** The compiled spending path with the given function name, if any. */
589
- functionByName(name: string): CompiledProgramFunction | undefined;
590
- }
591
- /**
592
- * Convert a Program JSON artifact into a {@link Program}. Byte values are
593
- * encoded as `0x`-prefixed hex strings in `asm`/`witness`/`signers`; opcode names,
594
- * `$param` placeholders and numbers pass through unchanged.
595
- *
596
- * This is *not* the JSON `arkadec` writes. That artifact lists spend groups in
597
- * an array and uses `<param>` placeholders and raw leaf assembly; pass it to
598
- * {@link programFromArtifact} instead.
599
- */
600
- declare function parseArtifact(artifact: {
601
- version?: number;
602
- name?: string;
603
- params?: readonly InputDef[];
604
- functions: unknown;
605
- }): Program;
606
- /**
607
- * Serialize a {@link Program} to normalized Program JSON — the inverse of
608
- * {@link parseArtifact}: bytes become `0x`-hex strings; bigint tokens become
609
- * plain numbers (or, above `Number.MAX_SAFE_INTEGER`, `0x`-hex of their
610
- * minimal script-num bytes, which the script encoder pushes identically);
611
- * literal timelock values serialize as decimal strings while `"$param"`
612
- * timelock references are emitted as-is.
613
- */
614
- declare function stringifyArtifact(program: Program): string;
615
- /**
616
- * Typed parameters of an `"arkade"` contract as persisted through the
617
- * `src/contracts` pipeline. The program serializes as artifact JSON, args as
618
- * a JSON map (`0x`-hex bytes, decimal-string bigints), keys as hex — so a
619
- * stored contract row re-derives its script fully offline.
620
- */
621
- interface ArkadeContractParams {
622
- program: Program;
623
- args: Record<string, ArkadeParamValue>;
624
- serverKey: Uint8Array;
625
- userKey?: Uint8Array;
626
- emulatorKey?: Uint8Array;
627
- }
628
- /** Serialize {@link ArkadeContractParams} to the string map `Contract.params` requires. */
629
- declare function serializeArkadeContractParams(typed: ArkadeContractParams): Record<string, string>;
630
- /** Parse the string map persisted in `Contract.params` back into typed params. */
631
- declare function deserializeArkadeContractParams(params: Record<string, string>): ArkadeContractParams;
632
-
633
368
  /**
634
369
  * Generic handler for artifact/program-based Arkade contracts.
635
370
  *
@@ -642,4 +377,4 @@ declare function deserializeArkadeContractParams(params: Record<string, string>)
642
377
  */
643
378
  declare const ArkadeContractHandler: ContractHandler<ArkadeContractParams, ArkadeProgramScript> & TapscriptDeriving<ArkadeProgramScript>;
644
379
 
645
- export { type ArkadeArgValue as A, BoardingContractHandler as B, type CompiledProgramFunction as C, DefaultContractHandler as D, VHTLCV2ContractHandler as E, type VHTLCV2ContractParams as F, contractHandlers as G, type InputDef as I, type Program as P, SUPPORTED_PROGRAM_VERSION as S, type TapscriptSegment as T, UnsupportedProgramVersionError as U, VHTLC as V, type WitnessRef as W, ArkadeProgramScript as a, type ProgramKeys as b, type ArkadeParamValue as c, type ArkadeFunction as d, type ArkadeValueType as e, type ArkadeArgType as f, type ArkadeContractParams as g, type ArkadeSegment as h, type AsmToken as i, type InputRef as j, type SignerRef as k, type TweakedSigner as l, deserializeArkadeContractParams as m, stringifyArtifact as n, ArkadeContractHandler as o, parseArtifact as p, type BoardingContractParams as q, resolveAsm as r, serializeArkadeContractParams as s, type DefaultContractParams as t, DelegateContractHandler as u, validateProgram as v, witnessRefToBytes as w, type DelegateContractParams as x, VHTLCContractHandler as y, type VHTLCContractParams as z };
380
+ export { ArkadeContractHandler as A, BoardingContractHandler as B, DefaultContractHandler as D, VHTLC as V, type BoardingContractParams as a, type DefaultContractParams as b, DelegateContractHandler as c, type DelegateContractParams as d, VHTLCContractHandler as e, type VHTLCContractParams as f, VHTLCV2ContractHandler as g, type VHTLCV2ContractParams as h, contractHandlers as i };