@1sat/actions 0.0.203 → 0.0.204

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 (205) hide show
  1. package/dist/action-registry.d.ts +1 -1
  2. package/dist/action-registry.d.ts.map +1 -1
  3. package/dist/addresses/index.d.ts +1 -1
  4. package/dist/addresses/index.d.ts.map +1 -1
  5. package/dist/apply/applyIntent.js +7 -7
  6. package/dist/apply/applyIntent.js.map +1 -1
  7. package/dist/apply/index.d.ts +8 -8
  8. package/dist/apply/index.d.ts.map +1 -1
  9. package/dist/apply/index.js +7 -7
  10. package/dist/apply/index.js.map +1 -1
  11. package/dist/apply/inscribeSigma.d.ts.map +1 -1
  12. package/dist/apply/inscribeSigma.js +3 -3
  13. package/dist/apply/inscribeSigma.js.map +1 -1
  14. package/dist/apply/prepare.d.ts +1 -1
  15. package/dist/apply/prepare.d.ts.map +1 -1
  16. package/dist/apply/registry.js +1 -1
  17. package/dist/apply/registry.js.map +1 -1
  18. package/dist/collections/index.d.ts +1 -1
  19. package/dist/collections/index.d.ts.map +1 -1
  20. package/dist/collections/index.js +5 -5
  21. package/dist/collections/index.js.map +1 -1
  22. package/dist/constants.d.ts +1 -1
  23. package/dist/constants.d.ts.map +1 -1
  24. package/dist/constants.js +1 -1
  25. package/dist/constants.js.map +1 -1
  26. package/dist/cosign/buildDestination.d.ts +1 -1
  27. package/dist/cosign/buildDestination.d.ts.map +1 -1
  28. package/dist/cosign/buildDestination.js +1 -1
  29. package/dist/cosign/buildDestination.js.map +1 -1
  30. package/dist/cosign/finalize.d.ts +1 -1
  31. package/dist/cosign/finalize.d.ts.map +1 -1
  32. package/dist/cosign/finalize.js +1 -1
  33. package/dist/cosign/finalize.js.map +1 -1
  34. package/dist/cosign/index.d.ts +4 -4
  35. package/dist/cosign/index.d.ts.map +1 -1
  36. package/dist/cosign/index.js +4 -4
  37. package/dist/cosign/index.js.map +1 -1
  38. package/dist/cosign/prepare.d.ts +2 -2
  39. package/dist/cosign/prepare.d.ts.map +1 -1
  40. package/dist/cosign/prepare.js +1 -1
  41. package/dist/cosign/prepare.js.map +1 -1
  42. package/dist/cosign/types.d.ts.map +1 -1
  43. package/dist/cosign/types.js.map +1 -1
  44. package/dist/identity/index.d.ts +1 -1
  45. package/dist/identity/index.d.ts.map +1 -1
  46. package/dist/identity/index.js +4 -4
  47. package/dist/identity/index.js.map +1 -1
  48. package/dist/index.d.ts +38 -37
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +54 -50
  51. package/dist/index.js.map +1 -1
  52. package/dist/inscriptions/index.d.ts +1 -1
  53. package/dist/inscriptions/index.d.ts.map +1 -1
  54. package/dist/inscriptions/index.js +7 -7
  55. package/dist/inscriptions/index.js.map +1 -1
  56. package/dist/locks/index.d.ts +1 -1
  57. package/dist/locks/index.d.ts.map +1 -1
  58. package/dist/locks/index.js +9 -5
  59. package/dist/locks/index.js.map +1 -1
  60. package/dist/mnee/index.d.ts +1 -1
  61. package/dist/mnee/index.d.ts.map +1 -1
  62. package/dist/opns/index.d.ts +1 -1
  63. package/dist/opns/index.d.ts.map +1 -1
  64. package/dist/opns/index.js +28 -30
  65. package/dist/opns/index.js.map +1 -1
  66. package/dist/ordfs/index.d.ts +116 -0
  67. package/dist/ordfs/index.d.ts.map +1 -0
  68. package/dist/ordfs/index.js +244 -0
  69. package/dist/ordfs/index.js.map +1 -0
  70. package/dist/ordfs/manifest.d.ts +119 -0
  71. package/dist/ordfs/manifest.d.ts.map +1 -0
  72. package/dist/ordfs/manifest.js +137 -0
  73. package/dist/ordfs/manifest.js.map +1 -0
  74. package/dist/ordfs/outputs.d.ts +139 -0
  75. package/dist/ordfs/outputs.d.ts.map +1 -0
  76. package/dist/ordfs/outputs.js +177 -0
  77. package/dist/ordfs/outputs.js.map +1 -0
  78. package/dist/ordinals/index.d.ts +1 -1
  79. package/dist/ordinals/index.d.ts.map +1 -1
  80. package/dist/ordinals/index.js +8 -8
  81. package/dist/ordinals/index.js.map +1 -1
  82. package/dist/payments/index.d.ts +1 -1
  83. package/dist/payments/index.d.ts.map +1 -1
  84. package/dist/payments/index.js +1 -1
  85. package/dist/payments/index.js.map +1 -1
  86. package/dist/pipeline/index.d.ts +3 -3
  87. package/dist/pipeline/index.d.ts.map +1 -1
  88. package/dist/pipeline/index.js +3 -3
  89. package/dist/pipeline/index.js.map +1 -1
  90. package/dist/pipeline/runPipeline.d.ts +2 -2
  91. package/dist/pipeline/runPipeline.d.ts.map +1 -1
  92. package/dist/pipeline/runPipeline.js +4 -4
  93. package/dist/pipeline/runPipeline.js.map +1 -1
  94. package/dist/pipeline/spendTargets.d.ts.map +1 -1
  95. package/dist/pipeline/spendTargets.js +1 -3
  96. package/dist/pipeline/spendTargets.js.map +1 -1
  97. package/dist/pipeline/unlockInput.d.ts +1 -1
  98. package/dist/pipeline/unlockInput.d.ts.map +1 -1
  99. package/dist/pipeline/unlockInput.js +3 -3
  100. package/dist/pipeline/unlockInput.js.map +1 -1
  101. package/dist/registry/constants.test.js +1 -1
  102. package/dist/registry/constants.test.js.map +1 -1
  103. package/dist/registry/index.d.ts +4 -5
  104. package/dist/registry/index.d.ts.map +1 -1
  105. package/dist/registry/index.js +3 -4
  106. package/dist/registry/index.js.map +1 -1
  107. package/dist/registry/package-tx.d.ts +1 -1
  108. package/dist/registry/package-tx.d.ts.map +1 -1
  109. package/dist/registry/package-tx.js +14 -40
  110. package/dist/registry/package-tx.js.map +1 -1
  111. package/dist/registry/types.d.ts +2 -2
  112. package/dist/registry/types.d.ts.map +1 -1
  113. package/dist/signing/aip.d.ts +1 -1
  114. package/dist/signing/aip.d.ts.map +1 -1
  115. package/dist/signing/aip.js +1 -1
  116. package/dist/signing/aip.js.map +1 -1
  117. package/dist/signing/authToken.d.ts +1 -1
  118. package/dist/signing/authToken.d.ts.map +1 -1
  119. package/dist/signing/bap.d.ts +1 -1
  120. package/dist/signing/bap.d.ts.map +1 -1
  121. package/dist/signing/bap.js +3 -3
  122. package/dist/signing/bap.js.map +1 -1
  123. package/dist/signing/counterpartyCrypto.d.ts +1 -1
  124. package/dist/signing/counterpartyCrypto.d.ts.map +1 -1
  125. package/dist/signing/friendPubKey.d.ts +1 -1
  126. package/dist/signing/friendPubKey.d.ts.map +1 -1
  127. package/dist/signing/index.d.ts +8 -8
  128. package/dist/signing/index.d.ts.map +1 -1
  129. package/dist/signing/index.js +10 -10
  130. package/dist/signing/index.js.map +1 -1
  131. package/dist/signing/sigma.d.ts +1 -1
  132. package/dist/signing/sigma.d.ts.map +1 -1
  133. package/dist/signing/sigma.js +3 -3
  134. package/dist/signing/sigma.js.map +1 -1
  135. package/dist/social/index.d.ts +1 -1
  136. package/dist/social/index.d.ts.map +1 -1
  137. package/dist/social/index.js +3 -3
  138. package/dist/social/index.js.map +1 -1
  139. package/dist/sweep/index.d.ts +7 -7
  140. package/dist/sweep/index.d.ts.map +1 -1
  141. package/dist/sweep/index.js +8 -8
  142. package/dist/sweep/index.js.map +1 -1
  143. package/dist/sweep/scan.d.ts +1 -1
  144. package/dist/sweep/scan.d.ts.map +1 -1
  145. package/dist/sweep/sweepDeposit.d.ts +1 -1
  146. package/dist/sweep/sweepDeposit.d.ts.map +1 -1
  147. package/dist/sweep/sweepDeposit.js +2 -2
  148. package/dist/sweep/sweepDeposit.js.map +1 -1
  149. package/dist/sweep/transfer.d.ts +2 -2
  150. package/dist/sweep/transfer.d.ts.map +1 -1
  151. package/dist/sync/ProcessedTxStoreIdb.d.ts +1 -1
  152. package/dist/sync/ProcessedTxStoreIdb.d.ts.map +1 -1
  153. package/dist/sync/ProcessedTxStoreSqlite.d.ts +1 -1
  154. package/dist/sync/ProcessedTxStoreSqlite.d.ts.map +1 -1
  155. package/dist/sync/index.d.ts +9 -9
  156. package/dist/sync/index.d.ts.map +1 -1
  157. package/dist/sync/index.js +18 -11
  158. package/dist/sync/index.js.map +1 -1
  159. package/dist/sync/syncCosignDeliveries.d.ts +1 -1
  160. package/dist/sync/syncCosignDeliveries.d.ts.map +1 -1
  161. package/dist/sync/syncCosignDeliveries.js +2 -2
  162. package/dist/sync/syncCosignDeliveries.js.map +1 -1
  163. package/dist/sync/syncMessages.d.ts +1 -1
  164. package/dist/sync/syncMessages.d.ts.map +1 -1
  165. package/dist/tokens/index.d.ts +1 -1
  166. package/dist/tokens/index.d.ts.map +1 -1
  167. package/dist/tokens/index.js +19 -17
  168. package/dist/tokens/index.js.map +1 -1
  169. package/dist/tokens/mintBsv21.test.js +1 -1
  170. package/dist/tokens/mintBsv21.test.js.map +1 -1
  171. package/dist/types.d.ts +1 -1
  172. package/dist/types.d.ts.map +1 -1
  173. package/dist/utils/bsv21Remittance.test.js +2 -2
  174. package/dist/utils/bsv21Remittance.test.js.map +1 -1
  175. package/dist/utils/createTrackedAction.d.ts +3 -3
  176. package/dist/utils/createTrackedAction.d.ts.map +1 -1
  177. package/dist/utils/createTrackedAction.js +4 -4
  178. package/dist/utils/createTrackedAction.js.map +1 -1
  179. package/dist/utils/internalizeBeef.d.ts.map +1 -1
  180. package/dist/utils/internalizeBeef.js +4 -4
  181. package/dist/utils/internalizeBeef.js.map +1 -1
  182. package/dist/utils/loadBasketOutput.js +1 -1
  183. package/dist/utils/loadBasketOutput.js.map +1 -1
  184. package/dist/utils/moveBasket.d.ts.map +1 -1
  185. package/dist/utils/moveBasket.js +4 -1
  186. package/dist/utils/moveBasket.js.map +1 -1
  187. package/dist/utils/ordinalRemittance.d.ts.map +1 -1
  188. package/dist/utils/ordinalRemittance.js.map +1 -1
  189. package/dist/utils/ordinalSeedTags.d.ts.map +1 -1
  190. package/dist/utils/ordinalSeedTags.js +3 -1
  191. package/dist/utils/ordinalSeedTags.js.map +1 -1
  192. package/dist/utils/resolveDestination.d.ts +1 -1
  193. package/dist/utils/resolveDestination.d.ts.map +1 -1
  194. package/dist/utils/signOrdinalInput.d.ts +1 -1
  195. package/dist/utils/signOrdinalInput.d.ts.map +1 -1
  196. package/dist/utils/signOrdinalInput.js +1 -1
  197. package/dist/utils/signOrdinalInput.js.map +1 -1
  198. package/dist/utils/signP2PKH.d.ts +1 -1
  199. package/dist/utils/signP2PKH.d.ts.map +1 -1
  200. package/dist/utils/stampBsv21OutputCi.d.ts.map +1 -1
  201. package/dist/utils/stampBsv21OutputCi.js +5 -5
  202. package/dist/utils/stampBsv21OutputCi.js.map +1 -1
  203. package/dist/utils/stampOrdinalOutputCi.js +3 -3
  204. package/dist/utils/stampOrdinalOutputCi.js.map +1 -1
  205. package/package.json +7 -7
@@ -0,0 +1,119 @@
1
+ /**
2
+ * ord-fs/json directory tree builder.
3
+ *
4
+ * Pure, key-agnostic logic that lays out a set of relative file paths into the
5
+ * ord-fs directory structure used by ORDFS: a root manifest, one manifest per
6
+ * subdirectory, and a mapping from each file to the transaction vout that will
7
+ * carry its inscription.
8
+ *
9
+ * ORDFS manifests are JSON objects whose values are `_N` relative-vout
10
+ * references — `_3` points at output index 3 in the same transaction. A
11
+ * directory manifest therefore maps each child name (file or subdirectory) to
12
+ * the vout of the inscription that holds that child's content (for files) or
13
+ * that child's own manifest (for subdirectories).
14
+ *
15
+ * Vout layout produced here:
16
+ * [0..F-1] one inscription per file, in caller order
17
+ * [F..F+D-1] one inscription per subdirectory manifest, in first-seen order
18
+ * [F+D] the root manifest inscription (always last)
19
+ *
20
+ * This module computes the layout only. It does not build scripts, derive
21
+ * keys, or create inscriptions — see `buildOrdFsDirOutputs` for that.
22
+ *
23
+ * Nesting is bounded by the ordfs server's own traversal limit: 1sat-stack's
24
+ * `resolveDirectoryPath` (pkg/ordfs/routes.go) recurses into a child manifest
25
+ * one path segment at a time and rejects requests past `maxDirectoryDepth`
26
+ * (8). {@link MAX_ORDFS_DIRECTORY_DEPTH} mirrors that limit so a too-deep
27
+ * tree fails here, at build time, instead of producing a manifest tree the
28
+ * server will refuse to resolve.
29
+ */
30
+ /**
31
+ * Maximum number of directory levels a file path may nest under, mirroring
32
+ * 1sat-stack's `maxDirectoryDepth` (pkg/ordfs/routes.go). A path with more
33
+ * directory segments than this would require more manifest hops than the
34
+ * ordfs server's `resolveDirectoryPath` will traverse.
35
+ */
36
+ export declare const MAX_ORDFS_DIRECTORY_DEPTH = 8;
37
+ /**
38
+ * A subdirectory manifest in the ord-fs tree — one per directory at any depth.
39
+ */
40
+ export interface OrdfsSubdirManifest {
41
+ /**
42
+ * Full directory path from the root (e.g. `"refs"` or `"refs/v1"`). The
43
+ * parent manifest references this directory by its last segment.
44
+ */
45
+ path: string;
46
+ /**
47
+ * The manifest object: maps each child's single-segment name to its `_N`
48
+ * relative-vout reference — a file's inscription vout, or a nested
49
+ * subdirectory manifest's vout. Keys never contain `/`; each directory level
50
+ * is its own manifest, matching how the ordfs server resolves a path one
51
+ * segment at a time.
52
+ */
53
+ manifest: Record<string, string>;
54
+ /**
55
+ * The output index this subdirectory manifest's inscription occupies in
56
+ * the transaction. Referenced from the parent manifest as `_<vout>`.
57
+ */
58
+ vout: number;
59
+ }
60
+ /**
61
+ * The full ord-fs directory tree layout for a set of file paths.
62
+ */
63
+ export interface OrdfsDirManifest {
64
+ /**
65
+ * The root manifest object: maps each root-level file name and each
66
+ * top-level subdirectory name to its `_N` relative-vout reference. This is
67
+ * the object that becomes the tradeable directory inscription.
68
+ */
69
+ root: Record<string, string>;
70
+ /**
71
+ * One entry per subdirectory at any depth, each with its own manifest and
72
+ * vout. A nested directory `a/b` produces two entries (`a` and `a/b`), with
73
+ * `a`'s manifest pointing at `a/b`'s vout.
74
+ */
75
+ subdirs: OrdfsSubdirManifest[];
76
+ /**
77
+ * Per-file output layout, parallel to the input `files` array (same order,
78
+ * same length). `vout` is the output index of that file's inscription.
79
+ */
80
+ files: Array<{
81
+ path: string;
82
+ vout: number;
83
+ }>;
84
+ /**
85
+ * The output index the root manifest inscription occupies — always the
86
+ * last output (`files.length + subdirs.length`).
87
+ */
88
+ manifestVout: number;
89
+ /**
90
+ * Content type for every manifest inscription (root and subdirectories):
91
+ * `ord-fs/json`. Exposed so callers building outputs do not need to import
92
+ * the registry constant separately.
93
+ */
94
+ manifestContentType: string;
95
+ }
96
+ /**
97
+ * Build the ord-fs/json directory tree for a set of relative file paths.
98
+ *
99
+ * Each input path may contain `/` to denote subdirectories. Every directory
100
+ * level — root and each nested directory — gets its own manifest, and a parent
101
+ * references a child directory by the child's single-segment name. This matches
102
+ * how the ordfs server resolves a path: one segment at a time, recursing into a
103
+ * child manifest when the segment points at another `ord-fs/json` inscription.
104
+ *
105
+ * Pure layout computation — no keys, scripts, or inscriptions. The returned
106
+ * `vout` indices assume file inscriptions occupy outputs `0..F-1` in `files`
107
+ * order, then the subdirectory manifests, then the root manifest last.
108
+ *
109
+ * @param files - Relative file paths in the order their inscriptions will be
110
+ * created. Paths use `/` as the directory separator (e.g. `"SKILL.md"`,
111
+ * `"refs/api.md"`). Order is significant: file `i` is assigned vout `i`.
112
+ * @returns The directory tree layout — root manifest, the per-directory
113
+ * subdirectory manifests, per-file vout assignments, the root manifest's
114
+ * vout, and the manifest content type.
115
+ */
116
+ export declare function buildOrdfsDirManifest(files: Array<{
117
+ path: string;
118
+ }>): OrdfsDirManifest;
119
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/ordfs/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B;;;;OAIG;IACH,OAAO,EAAE,mBAAmB,EAAE,CAAA;IAC9B;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5C;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAC5B,gBAAgB,CA2FlB"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * ord-fs/json directory tree builder.
3
+ *
4
+ * Pure, key-agnostic logic that lays out a set of relative file paths into the
5
+ * ord-fs directory structure used by ORDFS: a root manifest, one manifest per
6
+ * subdirectory, and a mapping from each file to the transaction vout that will
7
+ * carry its inscription.
8
+ *
9
+ * ORDFS manifests are JSON objects whose values are `_N` relative-vout
10
+ * references — `_3` points at output index 3 in the same transaction. A
11
+ * directory manifest therefore maps each child name (file or subdirectory) to
12
+ * the vout of the inscription that holds that child's content (for files) or
13
+ * that child's own manifest (for subdirectories).
14
+ *
15
+ * Vout layout produced here:
16
+ * [0..F-1] one inscription per file, in caller order
17
+ * [F..F+D-1] one inscription per subdirectory manifest, in first-seen order
18
+ * [F+D] the root manifest inscription (always last)
19
+ *
20
+ * This module computes the layout only. It does not build scripts, derive
21
+ * keys, or create inscriptions — see `buildOrdFsDirOutputs` for that.
22
+ *
23
+ * Nesting is bounded by the ordfs server's own traversal limit: 1sat-stack's
24
+ * `resolveDirectoryPath` (pkg/ordfs/routes.go) recurses into a child manifest
25
+ * one path segment at a time and rejects requests past `maxDirectoryDepth`
26
+ * (8). {@link MAX_ORDFS_DIRECTORY_DEPTH} mirrors that limit so a too-deep
27
+ * tree fails here, at build time, instead of producing a manifest tree the
28
+ * server will refuse to resolve.
29
+ */
30
+ import { MANIFEST_CONTENT_TYPE } from '../registry/constants.js';
31
+ /**
32
+ * Maximum number of directory levels a file path may nest under, mirroring
33
+ * 1sat-stack's `maxDirectoryDepth` (pkg/ordfs/routes.go). A path with more
34
+ * directory segments than this would require more manifest hops than the
35
+ * ordfs server's `resolveDirectoryPath` will traverse.
36
+ */
37
+ export const MAX_ORDFS_DIRECTORY_DEPTH = 8;
38
+ /**
39
+ * Build the ord-fs/json directory tree for a set of relative file paths.
40
+ *
41
+ * Each input path may contain `/` to denote subdirectories. Every directory
42
+ * level — root and each nested directory — gets its own manifest, and a parent
43
+ * references a child directory by the child's single-segment name. This matches
44
+ * how the ordfs server resolves a path: one segment at a time, recursing into a
45
+ * child manifest when the segment points at another `ord-fs/json` inscription.
46
+ *
47
+ * Pure layout computation — no keys, scripts, or inscriptions. The returned
48
+ * `vout` indices assume file inscriptions occupy outputs `0..F-1` in `files`
49
+ * order, then the subdirectory manifests, then the root manifest last.
50
+ *
51
+ * @param files - Relative file paths in the order their inscriptions will be
52
+ * created. Paths use `/` as the directory separator (e.g. `"SKILL.md"`,
53
+ * `"refs/api.md"`). Order is significant: file `i` is assigned vout `i`.
54
+ * @returns The directory tree layout — root manifest, the per-directory
55
+ * subdirectory manifests, per-file vout assignments, the root manifest's
56
+ * vout, and the manifest content type.
57
+ */
58
+ export function buildOrdfsDirManifest(files) {
59
+ const fileLayout = files.map((file, i) => ({ path: file.path, vout: i }));
60
+ const rootNode = new Map();
61
+ const collide = (key, scope) => {
62
+ throw new Error(`ord-fs directory path collision: "${key}" conflicts with an existing entry in ${scope}`);
63
+ };
64
+ for (const { path, vout } of fileLayout) {
65
+ const parts = path.split('/');
66
+ const depth = parts.length - 1; // directory levels above this file
67
+ if (depth >= MAX_ORDFS_DIRECTORY_DEPTH) {
68
+ throw new Error(`ord-fs directory path too deep: "${path}" nests ${depth} directory levels; the ordfs server resolves at most ${MAX_ORDFS_DIRECTORY_DEPTH} (see 1sat-stack pkg/ordfs/routes.go maxDirectoryDepth)`);
69
+ }
70
+ let node = rootNode;
71
+ let walked = '';
72
+ for (let i = 0; i < parts.length - 1; i++) {
73
+ const seg = parts[i];
74
+ const existing = node.get(seg);
75
+ if (existing === undefined) {
76
+ const child = new Map();
77
+ node.set(seg, child);
78
+ node = child;
79
+ }
80
+ else if (existing instanceof Map) {
81
+ node = existing;
82
+ }
83
+ else {
84
+ collide(seg, walked ? `directory "${walked}/"` : 'the root directory');
85
+ }
86
+ walked = walked ? `${walked}/${seg}` : seg;
87
+ }
88
+ const name = parts[parts.length - 1];
89
+ if (node.has(name)) {
90
+ collide(name, walked ? `directory "${walked}/"` : 'the root directory');
91
+ }
92
+ node.set(name, vout);
93
+ }
94
+ // Assign each subdirectory manifest a vout after the file inscriptions, in
95
+ // depth-first order; the root manifest is always last.
96
+ const dirPaths = [];
97
+ const collect = (node, path) => {
98
+ for (const [name, child] of node) {
99
+ if (child instanceof Map) {
100
+ const childPath = path ? `${path}/${name}` : name;
101
+ dirPaths.push({ path: childPath, node: child });
102
+ collect(child, childPath);
103
+ }
104
+ }
105
+ };
106
+ collect(rootNode, '');
107
+ const voutByPath = new Map();
108
+ let nextVout = files.length;
109
+ for (const { path } of dirPaths)
110
+ voutByPath.set(path, nextVout++);
111
+ const manifestVout = nextVout; // root manifest last
112
+ // Build a manifest object: file children → their vout, directory children →
113
+ // the child manifest's vout. Keys stay single-segment.
114
+ const manifestFor = (node, path) => {
115
+ const manifest = {};
116
+ for (const [name, child] of node) {
117
+ const vout = child instanceof Map
118
+ ? voutByPath.get(path ? `${path}/${name}` : name)
119
+ : child;
120
+ manifest[name] = `_${vout}`;
121
+ }
122
+ return manifest;
123
+ };
124
+ const subdirs = dirPaths.map(({ path, node }) => ({
125
+ path,
126
+ manifest: manifestFor(node, path),
127
+ vout: voutByPath.get(path),
128
+ }));
129
+ return {
130
+ root: manifestFor(rootNode, ''),
131
+ subdirs,
132
+ files: fileLayout,
133
+ manifestVout,
134
+ manifestContentType: MANIFEST_CONTEN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,MAAM,OAAO,GAA0B,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI;QACJ,QAAQ,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;QACjC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,CAAW;KACpC,CAAC,CAAC,CAAA;IAEH,OAAO;QACN,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC/B,OAAO;QACP,KAAK,EAAE,UAAU;QACjB,YAAY;QACZ,mBAAmB,EAAE,qBAAqB;KAC1C,CAAA;AACF,CAAC"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Builds the outputs for an ord-fs/json directory: one per file, one per
3
+ * subdirectory manifest, and the root manifest last. The root manifest is the
4
+ * directory's identity and the only output that carries MAP or a signature.
5
+ *
6
+ * Outputs are written in one of three layouts, chosen by
7
+ * `writeMode` (see {@link OrdfsDirWriteMode}):
8
+ * - `'mixed'` — 0-sat B leaves and one 1-sat root inscription. This is the
9
+ * default: the directory has one ownable token without a UTXO per file.
10
+ * - `'inscription'` — a 1-sat ord envelope, built on the shared
11
+ * `Inscription` template. Ownable/transferable/updatable; holds a UTXO.
12
+ * - `'b'` — a 0-sat B protocol (bitcom `B://`) output, built on the shared
13
+ * `B` template (composed with `MAP` via `BitCom` when metadata is
14
+ * supplied, rather than reimplementing multi-protocol script layout).
15
+ * Plain on-chain data; nothing is owned or held as a UTXO.
16
+ *
17
+ * Locking is pluggable (an address or a per-vout resolver) and applies to
18
+ * ordinal outputs — `'b'` outputs are OP_RETURN and provably
19
+ * unspendable, so there is nothing to lock. MAP is whatever the caller
20
+ * passes. Signing is deliberately NOT policy-enforced here: this builder
21
+ * accepts any `aip` signer regardless of `writeMode` (it is the pure, "dumb"
22
+ * primitive). It's `deployOrdfsDir` (the publishing action) that enforces the
23
+ * real policy — SIGMA for an ordinal root, AIP for an all-B tree — since
24
+ * SIGMA needs a spending input that only exists during transaction building.
25
+ */
26
+ import { type LockingScript, Script } from '@bsv/sdk';
27
+ import type { OneSatContext } from '../types.js';
28
+ import { type OrdfsDirManifest } from './manifest.js';
29
+ /**
30
+ * A file to include in an ord-fs directory inscription.
31
+ *
32
+ * Structurally identical to the registry's `PackageFile`, redeclared here so
33
+ * the ordfs primitives carry no dependency on the registry module's types.
34
+ */
35
+ export interface OrdfsDirFile {
36
+ /** Relative path within the directory (e.g. `"SKILL.md"`, `"refs/api.md"`). */
37
+ path: string;
38
+ /** File content as raw bytes. */
39
+ content: Uint8Array;
40
+ /** MIME content type for the file inscription (e.g. `"text/markdown"`). */
41
+ contentType: string;
42
+ }
43
+ /**
44
+ * How an ord-fs directory publish is written on-chain.
45
+ *
46
+ * - `'mixed'` (default) — 0-sat B leaves and a 1-sat ordinal root.
47
+ * - `'inscription'` — a 1-sat ord envelope per output. Ownable,
48
+ * transferable, and updatable; holds a UTXO on chain until explicitly
49
+ * spent. `locking` controls who can spend it.
50
+ * - `'b'` — a 0-sat B protocol (bitcom `B://`) output per output. Plain
51
+ * on-chain data, not an ordinal: no UTXO is held, nothing is
52
+ * ownable/transferable, and `locking` is ignored — OP_RETURN outputs are
53
+ * provably unspendable.
54
+ */
55
+ export type OrdfsDirWriteMode = 'mixed' | 'inscription' | 'b';
56
+ /**
57
+ * An address applied to every output, or a resolver that returns the locking
58
+ * script per vout. The resolver lets callers vary the lock per output without
59
+ * exposing a raw private key here. Used by every ordinal output, including
60
+ * the root of a `mixed` layout.
61
+ */
62
+ export type OrdfsLocking = {
63
+ address: string;
64
+ } | {
65
+ resolve: (vout: number) => LockingScript;
66
+ };
67
+ /**
68
+ * Options for {@link buildOrdFsDirOutputs}.
69
+ */
70
+ export interface BuildOrdFsDirOutputsOptions {
71
+ /**
72
+ * Output layout. Defaults to `'mixed'` (B leaves, ordinal root).
73
+ */
74
+ writeMode?: OrdfsDirWriteMode;
75
+ /**
76
+ * Locking applied to ordinal outputs, so the caller controls who can spend
77
+ * them. Required for `mixed` and `inscription`; ignored for `b`.
78
+ */
79
+ locking?: OrdfsLocking;
80
+ /**
81
+ * MAP fields for the root manifest only, composed with the manifest's
82
+ * content via the shared `MAP`/`BitCom` templates. Written as given —
83
+ * nothing added or rewritten.
84
+ */
85
+ map?: Record<string, string>;
86
+ /**
87
+ * AIP signer for the root manifest. Receives the manifest script (with any
88
+ * MAP suffix) and returns it with an AIP suffix. This builder does not
89
+ * tie `aip` to a particular `writeMode` — see the module doc comment for
90
+ * why that policy lives in the publishing action instead.
91
+ */
92
+ aip?: (ctx: OneSatContext, manifestScript: Script) => Promise<Script>;
93
+ }
94
+ /**
95
+ * A single output in an ord-fs directory publish transaction.
96
+ */
97
+ export interface OrdfsDirOutput {
98
+ /** Hex-encoded locking script (inscription envelope or B protocol, plus any suffix). */
99
+ lockingScriptHex: string;
100
+ /** Satoshi amount: 1 for ordinal outputs, 0 for B outputs. */
101
+ satoshis: number;
102
+ /** Human-readable description of what this output carries. */
103
+ description: string;
104
+ /** Whether this is the root manifest output (the directory's identity). */
105
+ isManifest: boolean;
106
+ }
107
+ /**
108
+ * Result of {@link buildOrdFsDirOutputs}.
109
+ */
110
+ export interface BuildOrdFsDirOutputsResult {
111
+ /**
112
+ * All outputs in transaction order: file inscriptions, then subdirectory
113
+ * manifests, then the root manifest (last).
114
+ */
115
+ outputs: OrdfsDirOutput[];
116
+ /** Output index of the root manifest — equals `outputs.length - 1`. */
117
+ manifestVout: number;
118
+ /** The root manifest's locking script (with MAP/AIP suffix), for signing. */
119
+ manifestScript: Script;
120
+ /** The computed directory tree layout, for callers that need the `_N` map. */
121
+ tree: OrdfsDirManifest;
122
+ }
123
+ /**
124
+ * Build the outputs that publish an ord-fs/json directory.
125
+ *
126
+ * Layout (matching {@link buildOrdfsDirManifest}):
127
+ * [0..F-1] one output per file, in `files` order
128
+ * [F..F+D-1] one output per subdirectory manifest
129
+ * [F+D] the root manifest output (MAP + AIP suffix, if supplied)
130
+ *
131
+ * @param files - Files to publish, in the order their outputs are created.
132
+ * Paths use `/` for subdirectories (e.g. `"refs/api.md"`).
133
+ * @param opts - Write mode, locking strategy (for ordinal outputs), plus
134
+ * optional MAP and AIP signer for the root manifest.
135
+ * @param ctx - Forwarded to the AIP signer; may be omitted when none is given.
136
+ * @returns The outputs, the root manifest's vout and script, and the tree.
137
+ */
138
+ export declare function buildOrdFsDirOutputs(files: OrdfsDirFile[], opts: BuildOrdFsDirOutputsOptions, ctx?: OneSatContext): Promise<BuildOrdFsDirOutputsResult>;
139
+ //# sourceMappingURL=outputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputs.d.ts","sourceRoot":"","sources":["../../src/ordfs/outputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAYH,OAAO,EAAE,KAAK,aAAa,EAAS,MAAM,EAAS,MAAM,UAAU,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,KAAK,gBAAgB,EAAyB,MAAM,eAAe,CAAA;AAE5E;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC5B,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,OAAO,EAAE,UAAU,CAAA;IACnB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,aAAa,GAAG,GAAG,CAAA;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACrB;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB;IAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,CAAA;CAAE,CAAA;AAE/C;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;OAEG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACrE;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,wFAAwF;IACxF,gBAAgB,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAA;IACnB,2EAA2E;IAC3E,UAAU,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAA;IACpB,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAA;IACtB,8EAA8E;IAC9E,IAAI,EAAE,gBAAgB,CAAA;CACtB;AAqGD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACzC,KAAK,EAAE,YAAY,EAAE,EACrB,IAAI,EAAE,2BAA2B,EACjC,GAAG,CAAC,EAAE,aAAa,GACjB,OAAO,CAAC,0BAA0B,CAAC,CA2FrC"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Builds the outputs for an ord-fs/json directory: one per file, one per
3
+ * subdirectory manifest, and the root manifest last. The root manifest is the
4
+ * directory's identity and the only output that carries MAP or a signature.
5
+ *
6
+ * Outputs are written in one of three layouts, chosen by
7
+ * `writeMode` (see {@link OrdfsDirWriteMode}):
8
+ * - `'mixed'` — 0-sat B leaves and one 1-sat root inscription. This is the
9
+ * default: the directory has one ownable token without a UTXO per file.
10
+ * - `'inscription'` — a 1-sat ord envelope, built on the shared
11
+ * `Inscription` template. Ownable/transferable/updatable; holds a UTXO.
12
+ * - `'b'` — a 0-sat B protocol (bitcom `B://`) output, built on the shared
13
+ * `B` template (composed with `MAP` via `BitCom` when metadata is
14
+ * supplied, rather than reimplementing multi-protocol script layout).
15
+ * Plain on-chain data; nothing is owned or held as a UTXO.
16
+ *
17
+ * Locking is pluggable (an address or a per-vout resolver) and applies to
18
+ * ordinal outputs — `'b'` outputs are OP_RETURN and provably
19
+ * unspendable, so there is nothing to lock. MAP is whatever the caller
20
+ * passes. Signing is deliberately NOT policy-enforced here: this builder
21
+ * accepts any `aip` signer regardless of `writeMode` (it is the pure, "dumb"
22
+ * primitive). It's `deployOrdfsDir` (the publishing action) that enforces the
23
+ * real policy — SIGMA for an ordinal root, AIP for an all-B tree — since
24
+ * SIGMA needs a spending input that only exists during transaction building.
25
+ */
26
+ import { B, B_PREFIX, BitCom, Encoding, Inscription, MAP, MAP_PREFIX, } from '@1sat/templates';
27
+ import { P2PKH, Script, Utils } from '@bsv/sdk';
28
+ import { buildOrdfsDirManifest } from './manifest.js';
29
+ /**
30
+ * Resolve the locking script for a given output index from the strategy.
31
+ */
32
+ function lockFor(locking, vout) {
33
+ if ('address' in locking) {
34
+ return new P2PKH().lock(locking.address);
35
+ }
36
+ return locking.resolve(vout);
37
+ }
38
+ /**
39
+ * Slice a single-protocol BitCom-locked script (e.g. from `B.lock()`,
40
+ * `MAP.set()`) down to its bare protocol descriptor — stripping the leading
41
+ * OP_RETURN and protocol-prefix pushdata chunks — so it can be recomposed
42
+ * with other protocols into one combined OP_RETURN via {@link BitCom}. This
43
+ * reuses the same multi-protocol layout `BitCom.lock()` already implements,
44
+ * rather than hand-assembling pipe-delimited OP_RETURN chunks again.
45
+ */
46
+ function toProtocol(prefix, locked) {
47
+ return {
48
+ protocol: prefix,
49
+ script: new Script(locked.chunks.slice(2)).toBinary(),
50
+ pos: 0,
51
+ };
52
+ }
53
+ /**
54
+ * Build a single output's content script for the given write mode.
55
+ *
56
+ * `'inscription'` requires `locking` (there's a UTXO to protect); `'b'` never
57
+ * touches `locking` (there's nothing to own).
58
+ */
59
+ function buildLeafScript(writeMode, content, contentType, locking, vout) {
60
+ if (writeMode === 'b') {
61
+ return new Script(B.lock(content, contentType, Encoding.Binary).chunks);
62
+ }
63
+ if (!locking) {
64
+ throw new Error("buildOrdFsDirOutputs: 'locking' is required for ordinal outputs — it controls who can spend the UTXO");
65
+ }
66
+ const inscription = Inscription.create(content, contentType, {
67
+ scriptPrefix: lockFor(locking, vout),
68
+ });
69
+ return new Script(inscription.lock().chunks);
70
+ }
71
+ /**
72
+ * Build the root manifest's content script, with the optional MAP suffix
73
+ * composed for the given write mode.
74
+ *
75
+ * `'inscription'`: MAP is appended as a scriptSuffix after the ord envelope
76
+ * (the envelope itself carries no OP_RETURN, so MAP's own is the first and
77
+ * only one). `'b'`: the manifest's B protocol output already contains an
78
+ * OP_RETURN, so MAP must be recomposed into the *same* OP_RETURN via
79
+ * {@link BitCom} — appending a second OP_RETURN-prefixed script would produce
80
+ * a malformed BitCom multi-protocol layout.
81
+ */
82
+ function buildManifestScript(writeMode, manifestBytes, contentType, locking, vout, map) {
83
+ const hasMap = map != null && Object.keys(map).length > 0;
84
+ if (writeMode === 'b') {
85
+ const protocols = [
86
+ toProtocol(B_PREFIX, B.lock(manifestBytes, contentType, Encoding.Binary)),
87
+ ];
88
+ if (hasMap) {
89
+ protocols.push(toProtocol(MAP_PREFIX, MAP.set(map)));
90
+ }
91
+ return new Script(new BitCom(protocols).lock().chunks);
92
+ }
93
+ if (!locking) {
94
+ throw new Error("buildOrdFsDirOutputs: 'locking' is required for the ordinal root — it controls who can spend the UTXO");
95
+ }
96
+ const suffix = hasMap ? MAP.set(map) : undefined;
97
+ const manifestInscription = Inscription.create(manifestBytes, contentType, {
98
+ scriptPrefix: lockFor(locking, vout),
99
+ ...(suffix ? { scriptSuffix: suffix } : {}),
100
+ });
101
+ return new Script(manifestInscription.lock().chunks);
102
+ }
103
+ /**
104
+ * Build the outputs that publish an ord-fs/json directory.
105
+ *
106
+ * Layout (matching {@link buildOrdfsDirManifest}):
107
+ * [0..F-1] one output per file, in `files` order
108
+ * [F..F+D-1] one output per subdirectory manifest
109
+ * [F+D] the root manifest output (MAP + AIP suffix, if supplied)
110
+ *
111
+ * @param files - Files to publish, in the order their outputs are created.
112
+ * Paths use `/` for subdirectories (e.g. `"refs/api.md"`).
113
+ * @param opts - Write mode, locking strategy (for ordinal outputs), plus
114
+ * optional MAP and AIP signer for the root manifest.
115
+ * @param ctx - Forwarded to the AIP signer; may be omitted when none is given.
116
+ * @returns The outputs, the root manifest's vout and script, and the tree.
117
+ */
118
+ export async function buildOrdFsDirOutputs(files, opts, ctx) {
119
+ const writeMode = opts.writeMode ?? 'mixed';
120
+ const leafWriteMode = writeMode === 'mixed' ? 'b' : writeMode;
121
+ const manifestWriteMode = writeMode === 'mixed' ? 'inscription' : writeMode;
122
+ const leafSatoshis = leafWriteMode === 'b' ? 0 : 1;
123
+ const manifestSatoshis = manifestWriteMode === 'b' ? 0 : 1;
124
+ const tree = buildOrdfsDirManifest(files);
125
+ const outputs = [];
126
+ // -------------------------------------------------------------------
127
+ // 1. File outputs (vouts 0..F-1)
128
+ // -------------------------------------------------------------------
129
+ for (let i = 0; i < files.length; i++) {
130
+ const file = files[i];
131
+ const script = buildLeafScript(leafWriteMode, file.content, file.contentType, opts.locking, i);
132
+ outputs.push({
133
+ lockingScriptHex: Utils.toHex(script.toBinary()),
134
+ satoshis: leafSatoshis,
135
+ description: `file: ${file.path}`,
136
+ isManifest: false,
137
+ });
138
+ }
139
+ // -------------------------------------------------------------------
140
+ // 2. Subdirectory manifest outputs (vouts F..F+D-1)
141
+ // -------------------------------------------------------------------
142
+ for (const subdir of tree.subdirs) {
143
+ const subdirBytes = new Uint8Array(Utils.toArray(JSON.stringify(subdir.manifest), 'utf8'));
144
+ const script = buildLeafScript(leafWriteMode, subdirBytes, tree.manifestContentType, opts.locking, subdir.vout);
145
+ outputs.push({
146
+ lockingScriptHex: Utils.toHex(script.toBinary()),
147
+ satoshis: leafSatoshis,
148
+ description: `dir: ${subdir.path}/`,
149
+ isManifest: false,
150
+ });
151
+ }
152
+ // -------------------------------------------------------------------
153
+ // 3. Root manifest output (last). MAP is composed into it; AIP is
154
+ // applied afterward, since it signs over the MAP data too.
155
+ // -------------------------------------------------------------------
156
+ const manifestBytes = new Uint8Array(Utils.toArray(JSON.stringify(tree.root), 'utf8'));
157
+ let manifestScript = buildManifestScript(manifestWriteMode, manifestBytes, tree.manifestContentType, opts.locking, tree.manifestVout, opts.map);
158
+ if (opts.aip) {
159
+ if (!ctx) {
160
+ throw new Error('buildOrdFsDirOutputs: an AIP signer was supplied but no context was provided');
161
+ }
162
+ manifestScript = await opts.aip(ctx, manifestScript);
163
+ }
164
+ outputs.push({
165
+ lockingScriptHex: Utils.toHex(manifestScript.toBinary()),
166
+ satoshis: manifestSatoshis,
167
+ description: 'manifest (ord-fs/json)',
168
+ isManifest: true,
169
+ });
170
+ return {
171
+ outputs,
172
+ manifestVout: tree.manifestVout,
173
+ manifestScript,
174
+ tree,
175
+ };
176
+ }
177
+ //# sourceMappingURL=outputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/ordfs/outputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACN,CAAC,EACD,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,GAAG,EACH,UAAU,GACV,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAsB,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEnE,OAAO,EAAyB,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAoG5E;;GAEG;AACH,SAAS,OAAO,CAAC,OAAqB,EAAE,IAAY;IACnD,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;QAC1B,OAAO,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,O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AA;AACF,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * Returns WalletOutput[] directly from the SDK - no custom mapping needed.
6
6
  */
7
7
  import { type BEEF, type CreateActionArgs, Script, type WalletOutput } from '@bsv/sdk';
8
- import type { Action, ActionOptions, OneSatContext } from '../types';
8
+ import type { Action, ActionOptions, OneSatContext } from '../types.js';
9
9
  /**
10
10
  * Resolve ordinal tags (type, origin, name) and basket for a self-spend output.
11
11
  * Fetches missing data from ORDFS when services are available.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ordinals/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EACN,KAAK,IAAI,EAGT,KAAK,gBAAgB,EAKrB,MAAM,EAKN,KAAK,YAAY,EACjB,MAAM,UAAU,CAAA;AAUjB,OAAO,KAAK,EACX,MAAM,EAEN,aAAa,EACb,aAAa,EACb,MAAM,UAAU,CAAA;AAYjB;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACvC,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE;IACR,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACb,GACC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAyE5D;AAMD,KAAK,SAAS,GAAG,MAAM,CAAA;AAEvB,MAAM,WAAW,YAAY;IAC5B,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAA;IACV,kDAAkD;IAClD,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,GAAG,CAAC,EAAE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AAE,MAAM,CAAA;CACf;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAsDtE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAChC,uBAAuB,EACvB,wBAAwB,CA8KxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,kBAAkB,EAAE,wBAAwB,CAgG3E,CAAA;AAEF,4CAA4C;AAC5C,MAAM,WAAW,yBAA0B,SAAQ,aAAa;IAC/D,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAA;CACV;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACxC,yBAAyB,EACzB,wBAAwB,CA2IxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,iBAAiB,EAAE,wBAAwB,CA0M1E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAChC,mBAAmB,EACnB,wBAAwB,CA8ExB,CAAA;AAMD,wCAAwC;AACxC,eAAO,MAAM,eAAe,oRAO3B,CAAA"}
@@ -9,14 +9,14 @@ import { OrdLock } from '@1sat/templates';
9
9
  import { buildInputAssetLabel, displayNameForCi, nameFromMap, ordinalTagsFromMetadata, readAssetIdTag, } from '@1sat/types';
10
10
  import { parseOutpoint } from '@1sat/utils';
11
11
  import { Beef, BigNumber, LockingScript, OP, P2PKH, PublicKey, Script, TransactionSignature, UnlockingScript, Utils, } from '@bsv/sdk';
12
- import { prepareP1SatArgs } from '../apply';
13
- import { MAX_INSCRIPTION_BYTES, OPNS_BASKET, ORDINALS_BASKET, ORD_LOCK_PREFIX, ORD_LOCK_SUFFIX, P1SAT_PROTOCOL, } from '../constants';
14
- import { appendSigmaPlaceholder } from '../signing/sigma';
15
- import { executeTrackedAction } from '../utils/createTrackedAction';
16
- import { loadBasketOutputBeef } from '../utils/loadBasketOutput';
17
- import { buildOrdinalCustomInstructions } from '../utils/ordinalRemittance';
18
- import { ordinalSeedTags } from '../utils/ordinalSeedTags';
19
- import { unlockingScriptLengthForInstructions } from '../utils/signOrdinalInput';
12
+ import { prepareP1SatArgs } from '../apply/index.js';
13
+ import { MAX_INSCRIPTION_BYTES, OPNS_BASKET, ORDINALS_BASKET, ORD_LOCK_PREFIX, ORD_LOCK_SUFFIX, P1SAT_PROTOCOL, } from '../constants.js';
14
+ import { appendSigmaPlaceholder } from '../signing/sigma.js';
15
+ import { executeTrackedAction } from '../utils/createTrackedAction.js';
16
+ import { loadBasketOutputBeef } from '../utils/loadBasketOutput.js';
17
+ import { buildOrdinalCustomInstructions } from '../utils/ordinalRemittance.js';
18
+ import { ordinalSeedTags } from '../utils/ordinalSeedTags.js';
19
+ import { unlockingScriptLengthForInstructions } from '../utils/signOrdinalInput.js';
20
20
  // ============================================================================
21
21
  // Helpers
22
22
  // ============================================================================