@sundaeswap/sprinkles 0.6.1 → 0.8.0

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 (197) hide show
  1. package/README.md +178 -181
  2. package/dist/cjs/Sprinkle/__tests__/action-integration.test.js +590 -0
  3. package/dist/cjs/Sprinkle/__tests__/action-integration.test.js.map +1 -0
  4. package/dist/cjs/Sprinkle/__tests__/action-registry.test.js +193 -0
  5. package/dist/cjs/Sprinkle/__tests__/action-registry.test.js.map +1 -0
  6. package/dist/cjs/Sprinkle/__tests__/action-runner.test.js +304 -0
  7. package/dist/cjs/Sprinkle/__tests__/action-runner.test.js.map +1 -0
  8. package/dist/cjs/Sprinkle/__tests__/builtin-actions.test.js +1110 -0
  9. package/dist/cjs/Sprinkle/__tests__/builtin-actions.test.js.map +1 -0
  10. package/dist/cjs/Sprinkle/__tests__/cli-adapter.test.js +744 -0
  11. package/dist/cjs/Sprinkle/__tests__/cli-adapter.test.js.map +1 -0
  12. package/dist/cjs/Sprinkle/__tests__/fill-in-struct.test.js +15 -1
  13. package/dist/cjs/Sprinkle/__tests__/fill-in-struct.test.js.map +1 -1
  14. package/dist/cjs/Sprinkle/__tests__/mcp-adapter.test.js +711 -0
  15. package/dist/cjs/Sprinkle/__tests__/mcp-adapter.test.js.map +1 -0
  16. package/dist/cjs/Sprinkle/__tests__/native-script.test.js +390 -0
  17. package/dist/cjs/Sprinkle/__tests__/native-script.test.js.map +1 -0
  18. package/dist/cjs/Sprinkle/__tests__/tui-helpers.test.js +334 -0
  19. package/dist/cjs/Sprinkle/__tests__/tui-helpers.test.js.map +1 -0
  20. package/dist/cjs/Sprinkle/__tests__/utility-actions.test.js +367 -0
  21. package/dist/cjs/Sprinkle/__tests__/utility-actions.test.js.map +1 -0
  22. package/dist/cjs/Sprinkle/__tests__/wallet-transaction-actions.test.js +749 -0
  23. package/dist/cjs/Sprinkle/__tests__/wallet-transaction-actions.test.js.map +1 -0
  24. package/dist/cjs/Sprinkle/actions/builtin/addressbook-actions.js +164 -0
  25. package/dist/cjs/Sprinkle/actions/builtin/addressbook-actions.js.map +1 -0
  26. package/dist/cjs/Sprinkle/actions/builtin/blaze-helper.js +61 -0
  27. package/dist/cjs/Sprinkle/actions/builtin/blaze-helper.js.map +1 -0
  28. package/dist/cjs/Sprinkle/actions/builtin/index.js +174 -0
  29. package/dist/cjs/Sprinkle/actions/builtin/index.js.map +1 -0
  30. package/dist/cjs/Sprinkle/actions/builtin/native-script.js +139 -0
  31. package/dist/cjs/Sprinkle/actions/builtin/native-script.js.map +1 -0
  32. package/dist/cjs/Sprinkle/actions/builtin/profile-actions.js +202 -0
  33. package/dist/cjs/Sprinkle/actions/builtin/profile-actions.js.map +1 -0
  34. package/dist/cjs/Sprinkle/actions/builtin/settings-actions.js +87 -0
  35. package/dist/cjs/Sprinkle/actions/builtin/settings-actions.js.map +1 -0
  36. package/dist/cjs/Sprinkle/actions/builtin/transaction-actions.js +345 -0
  37. package/dist/cjs/Sprinkle/actions/builtin/transaction-actions.js.map +1 -0
  38. package/dist/cjs/Sprinkle/actions/builtin/utility-actions.js +218 -0
  39. package/dist/cjs/Sprinkle/actions/builtin/utility-actions.js.map +1 -0
  40. package/dist/cjs/Sprinkle/actions/builtin/wallet-actions.js +212 -0
  41. package/dist/cjs/Sprinkle/actions/builtin/wallet-actions.js.map +1 -0
  42. package/dist/cjs/Sprinkle/actions/cli-adapter.js +390 -0
  43. package/dist/cjs/Sprinkle/actions/cli-adapter.js.map +1 -0
  44. package/dist/cjs/Sprinkle/actions/index.js +139 -0
  45. package/dist/cjs/Sprinkle/actions/index.js.map +1 -0
  46. package/dist/cjs/Sprinkle/actions/mcp-adapter.js +557 -0
  47. package/dist/cjs/Sprinkle/actions/mcp-adapter.js.map +1 -0
  48. package/dist/cjs/Sprinkle/actions/registry.js +92 -0
  49. package/dist/cjs/Sprinkle/actions/registry.js.map +1 -0
  50. package/dist/cjs/Sprinkle/actions/runner.js +190 -0
  51. package/dist/cjs/Sprinkle/actions/runner.js.map +1 -0
  52. package/dist/cjs/Sprinkle/actions/tui-helpers.js +96 -0
  53. package/dist/cjs/Sprinkle/actions/tui-helpers.js.map +1 -0
  54. package/dist/cjs/Sprinkle/actions/types.js +68 -0
  55. package/dist/cjs/Sprinkle/actions/types.js.map +1 -0
  56. package/dist/cjs/Sprinkle/index.js +678 -5
  57. package/dist/cjs/Sprinkle/index.js.map +1 -1
  58. package/dist/cjs/Sprinkle/prompts.js +12 -7
  59. package/dist/cjs/Sprinkle/prompts.js.map +1 -1
  60. package/dist/cjs/Sprinkle/schemas.js +17 -1
  61. package/dist/cjs/Sprinkle/schemas.js.map +1 -1
  62. package/dist/cjs/Sprinkle/type-guards.js +7 -1
  63. package/dist/cjs/Sprinkle/type-guards.js.map +1 -1
  64. package/dist/esm/Sprinkle/__tests__/action-integration.test.js +588 -0
  65. package/dist/esm/Sprinkle/__tests__/action-integration.test.js.map +1 -0
  66. package/dist/esm/Sprinkle/__tests__/action-registry.test.js +192 -0
  67. package/dist/esm/Sprinkle/__tests__/action-registry.test.js.map +1 -0
  68. package/dist/esm/Sprinkle/__tests__/action-runner.test.js +302 -0
  69. package/dist/esm/Sprinkle/__tests__/action-runner.test.js.map +1 -0
  70. package/dist/esm/Sprinkle/__tests__/builtin-actions.test.js +1107 -0
  71. package/dist/esm/Sprinkle/__tests__/builtin-actions.test.js.map +1 -0
  72. package/dist/esm/Sprinkle/__tests__/cli-adapter.test.js +742 -0
  73. package/dist/esm/Sprinkle/__tests__/cli-adapter.test.js.map +1 -0
  74. package/dist/esm/Sprinkle/__tests__/fill-in-struct.test.js +15 -1
  75. package/dist/esm/Sprinkle/__tests__/fill-in-struct.test.js.map +1 -1
  76. package/dist/esm/Sprinkle/__tests__/mcp-adapter.test.js +710 -0
  77. package/dist/esm/Sprinkle/__tests__/mcp-adapter.test.js.map +1 -0
  78. package/dist/esm/Sprinkle/__tests__/native-script.test.js +388 -0
  79. package/dist/esm/Sprinkle/__tests__/native-script.test.js.map +1 -0
  80. package/dist/esm/Sprinkle/__tests__/tui-helpers.test.js +332 -0
  81. package/dist/esm/Sprinkle/__tests__/tui-helpers.test.js.map +1 -0
  82. package/dist/esm/Sprinkle/__tests__/utility-actions.test.js +365 -0
  83. package/dist/esm/Sprinkle/__tests__/utility-actions.test.js.map +1 -0
  84. package/dist/esm/Sprinkle/__tests__/wallet-transaction-actions.test.js +747 -0
  85. package/dist/esm/Sprinkle/__tests__/wallet-transaction-actions.test.js.map +1 -0
  86. package/dist/esm/Sprinkle/actions/builtin/addressbook-actions.js +159 -0
  87. package/dist/esm/Sprinkle/actions/builtin/addressbook-actions.js.map +1 -0
  88. package/dist/esm/Sprinkle/actions/builtin/blaze-helper.js +55 -0
  89. package/dist/esm/Sprinkle/actions/builtin/blaze-helper.js.map +1 -0
  90. package/dist/esm/Sprinkle/actions/builtin/index.js +37 -0
  91. package/dist/esm/Sprinkle/actions/builtin/index.js.map +1 -0
  92. package/dist/esm/Sprinkle/actions/builtin/native-script.js +133 -0
  93. package/dist/esm/Sprinkle/actions/builtin/native-script.js.map +1 -0
  94. package/dist/esm/Sprinkle/actions/builtin/profile-actions.js +197 -0
  95. package/dist/esm/Sprinkle/actions/builtin/profile-actions.js.map +1 -0
  96. package/dist/esm/Sprinkle/actions/builtin/settings-actions.js +81 -0
  97. package/dist/esm/Sprinkle/actions/builtin/settings-actions.js.map +1 -0
  98. package/dist/esm/Sprinkle/actions/builtin/transaction-actions.js +340 -0
  99. package/dist/esm/Sprinkle/actions/builtin/transaction-actions.js.map +1 -0
  100. package/dist/esm/Sprinkle/actions/builtin/utility-actions.js +213 -0
  101. package/dist/esm/Sprinkle/actions/builtin/utility-actions.js.map +1 -0
  102. package/dist/esm/Sprinkle/actions/builtin/wallet-actions.js +207 -0
  103. package/dist/esm/Sprinkle/actions/builtin/wallet-actions.js.map +1 -0
  104. package/dist/esm/Sprinkle/actions/cli-adapter.js +379 -0
  105. package/dist/esm/Sprinkle/actions/cli-adapter.js.map +1 -0
  106. package/dist/esm/Sprinkle/actions/index.js +12 -0
  107. package/dist/esm/Sprinkle/actions/index.js.map +1 -0
  108. package/dist/esm/Sprinkle/actions/mcp-adapter.js +547 -0
  109. package/dist/esm/Sprinkle/actions/mcp-adapter.js.map +1 -0
  110. package/dist/esm/Sprinkle/actions/registry.js +85 -0
  111. package/dist/esm/Sprinkle/actions/registry.js.map +1 -0
  112. package/dist/esm/Sprinkle/actions/runner.js +182 -0
  113. package/dist/esm/Sprinkle/actions/runner.js.map +1 -0
  114. package/dist/esm/Sprinkle/actions/tui-helpers.js +91 -0
  115. package/dist/esm/Sprinkle/actions/tui-helpers.js.map +1 -0
  116. package/dist/esm/Sprinkle/actions/types.js +61 -0
  117. package/dist/esm/Sprinkle/actions/types.js.map +1 -0
  118. package/dist/esm/Sprinkle/index.js +517 -7
  119. package/dist/esm/Sprinkle/index.js.map +1 -1
  120. package/dist/esm/Sprinkle/prompts.js +12 -7
  121. package/dist/esm/Sprinkle/prompts.js.map +1 -1
  122. package/dist/esm/Sprinkle/schemas.js +16 -0
  123. package/dist/esm/Sprinkle/schemas.js.map +1 -1
  124. package/dist/esm/Sprinkle/type-guards.js +3 -0
  125. package/dist/esm/Sprinkle/type-guards.js.map +1 -1
  126. package/dist/types/Sprinkle/actions/builtin/addressbook-actions.d.ts +50 -0
  127. package/dist/types/Sprinkle/actions/builtin/addressbook-actions.d.ts.map +1 -0
  128. package/dist/types/Sprinkle/actions/builtin/blaze-helper.d.ts +39 -0
  129. package/dist/types/Sprinkle/actions/builtin/blaze-helper.d.ts.map +1 -0
  130. package/dist/types/Sprinkle/actions/builtin/index.d.ts +30 -0
  131. package/dist/types/Sprinkle/actions/builtin/index.d.ts.map +1 -0
  132. package/dist/types/Sprinkle/actions/builtin/native-script.d.ts +27 -0
  133. package/dist/types/Sprinkle/actions/builtin/native-script.d.ts.map +1 -0
  134. package/dist/types/Sprinkle/actions/builtin/profile-actions.d.ts +55 -0
  135. package/dist/types/Sprinkle/actions/builtin/profile-actions.d.ts.map +1 -0
  136. package/dist/types/Sprinkle/actions/builtin/settings-actions.d.ts +32 -0
  137. package/dist/types/Sprinkle/actions/builtin/settings-actions.d.ts.map +1 -0
  138. package/dist/types/Sprinkle/actions/builtin/transaction-actions.d.ts +70 -0
  139. package/dist/types/Sprinkle/actions/builtin/transaction-actions.d.ts.map +1 -0
  140. package/dist/types/Sprinkle/actions/builtin/utility-actions.d.ts +48 -0
  141. package/dist/types/Sprinkle/actions/builtin/utility-actions.d.ts.map +1 -0
  142. package/dist/types/Sprinkle/actions/builtin/wallet-actions.d.ts +50 -0
  143. package/dist/types/Sprinkle/actions/builtin/wallet-actions.d.ts.map +1 -0
  144. package/dist/types/Sprinkle/actions/cli-adapter.d.ts +104 -0
  145. package/dist/types/Sprinkle/actions/cli-adapter.d.ts.map +1 -0
  146. package/dist/types/Sprinkle/actions/index.d.ts +13 -0
  147. package/dist/types/Sprinkle/actions/index.d.ts.map +1 -0
  148. package/dist/types/Sprinkle/actions/mcp-adapter.d.ts +116 -0
  149. package/dist/types/Sprinkle/actions/mcp-adapter.d.ts.map +1 -0
  150. package/dist/types/Sprinkle/actions/registry.d.ts +42 -0
  151. package/dist/types/Sprinkle/actions/registry.d.ts.map +1 -0
  152. package/dist/types/Sprinkle/actions/runner.d.ts +45 -0
  153. package/dist/types/Sprinkle/actions/runner.d.ts.map +1 -0
  154. package/dist/types/Sprinkle/actions/tui-helpers.d.ts +53 -0
  155. package/dist/types/Sprinkle/actions/tui-helpers.d.ts.map +1 -0
  156. package/dist/types/Sprinkle/actions/types.d.ts +76 -0
  157. package/dist/types/Sprinkle/actions/types.d.ts.map +1 -0
  158. package/dist/types/Sprinkle/index.d.ts +84 -2
  159. package/dist/types/Sprinkle/index.d.ts.map +1 -1
  160. package/dist/types/Sprinkle/prompts.d.ts.map +1 -1
  161. package/dist/types/Sprinkle/schemas.d.ts +72 -0
  162. package/dist/types/Sprinkle/schemas.d.ts.map +1 -1
  163. package/dist/types/Sprinkle/type-guards.d.ts +4 -1
  164. package/dist/types/Sprinkle/type-guards.d.ts.map +1 -1
  165. package/dist/types/tsconfig.build.tsbuildinfo +1 -1
  166. package/package.json +9 -2
  167. package/src/Sprinkle/__tests__/action-integration.test.ts +558 -0
  168. package/src/Sprinkle/__tests__/action-registry.test.ts +187 -0
  169. package/src/Sprinkle/__tests__/action-runner.test.ts +324 -0
  170. package/src/Sprinkle/__tests__/builtin-actions.test.ts +1022 -0
  171. package/src/Sprinkle/__tests__/cli-adapter.test.ts +736 -0
  172. package/src/Sprinkle/__tests__/fill-in-struct.test.ts +23 -1
  173. package/src/Sprinkle/__tests__/mcp-adapter.test.ts +720 -0
  174. package/src/Sprinkle/__tests__/native-script.test.ts +341 -0
  175. package/src/Sprinkle/__tests__/tui-helpers.test.ts +325 -0
  176. package/src/Sprinkle/__tests__/utility-actions.test.ts +348 -0
  177. package/src/Sprinkle/__tests__/wallet-transaction-actions.test.ts +695 -0
  178. package/src/Sprinkle/actions/builtin/addressbook-actions.ts +168 -0
  179. package/src/Sprinkle/actions/builtin/blaze-helper.ts +89 -0
  180. package/src/Sprinkle/actions/builtin/index.ts +125 -0
  181. package/src/Sprinkle/actions/builtin/native-script.ts +165 -0
  182. package/src/Sprinkle/actions/builtin/profile-actions.ts +229 -0
  183. package/src/Sprinkle/actions/builtin/settings-actions.ts +99 -0
  184. package/src/Sprinkle/actions/builtin/transaction-actions.ts +381 -0
  185. package/src/Sprinkle/actions/builtin/utility-actions.ts +285 -0
  186. package/src/Sprinkle/actions/builtin/wallet-actions.ts +233 -0
  187. package/src/Sprinkle/actions/cli-adapter.ts +446 -0
  188. package/src/Sprinkle/actions/index.ts +33 -0
  189. package/src/Sprinkle/actions/mcp-adapter.ts +638 -0
  190. package/src/Sprinkle/actions/registry.ts +97 -0
  191. package/src/Sprinkle/actions/runner.ts +200 -0
  192. package/src/Sprinkle/actions/tui-helpers.ts +114 -0
  193. package/src/Sprinkle/actions/types.ts +91 -0
  194. package/src/Sprinkle/index.ts +612 -3
  195. package/src/Sprinkle/prompts.ts +118 -72
  196. package/src/Sprinkle/schemas.ts +20 -0
  197. package/src/Sprinkle/type-guards.ts +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-transaction-actions.test.js","names":["describe","expect","test","mock","beforeEach","ActionError","makeAddress","bech32","toBech32","makeAssetId","policyId","assetName","makeUtxo","opts","tokenEntries","tokens","map","t","quantity","input","transactionId","toString","txHash","index","BigInt","output","amount","coin","lovelace","multiasset","length","entries","undefined","mockBlaze","mockIsHot","mockBlazeError","module","getBlazeFromContext","isHotWallet","Core","AssetId","getPolicyId","assetId","slice","getAssetName","Transaction","fromCbor","cbor","mockTxFromCbor","TxCBOR","s","Blaze","HotWallet","body","hash","inputs","values","outputs","address","fee","requiredSigners","witnessSet","vkeys","toCbor","getWalletAddress","getWalletBalance","getWalletUtxos","signTransaction","submitTransaction","signAndSubmit","decodeTransaction","makeContext","settingsOverrides","sprinkle","settings","network","provider","type","apiKey","wallet","mnemonic","getChangeAddress","ctx","result","execute","toBe","missingFields","rejects","toMatchObject","code","Error","name","category","inputSchema","toBeDefined","outputSchema","getUnspentOutputs","ada","toEqual","repeat","toHaveLength","total","utxos","outputIndex","Array","from","_","i","limit","size","txCbor","signedTxCbor","signatureCount","submitted","waitForConfirmation","confirmed","toBeUndefined","err","details","toBytes"],"sources":["../../../../src/Sprinkle/__tests__/wallet-transaction-actions.test.ts"],"sourcesContent":["import { describe, expect, test, mock, beforeEach } from \"bun:test\";\nimport { Type } from \"@sinclair/typebox\";\nimport { ActionError } from \"../actions/types.js\";\n\n// ---------------------------------------------------------------------------\n// Mocks\n// ---------------------------------------------------------------------------\n\n// Mock wallet/UTxO data factories\nfunction makeAddress(bech32 = \"addr_test1qz...mock\") {\n return { toBech32: () => bech32 };\n}\n\nfunction makeAssetId(policyId: string, assetName: string) {\n return `${policyId}${assetName}`;\n}\n\nfunction makeUtxo(opts: {\n txHash: string;\n index: number;\n lovelace: bigint;\n tokens?: Array<{ policyId: string; assetName: string; quantity: bigint }>;\n}) {\n const tokenEntries = (opts.tokens ?? []).map((t) => [\n makeAssetId(t.policyId, t.assetName),\n t.quantity,\n ]);\n\n return {\n input: () => ({\n transactionId: () => ({ toString: () => opts.txHash }),\n index: () => BigInt(opts.index),\n }),\n output: () => ({\n amount: () => ({\n coin: () => opts.lovelace,\n multiasset: () =>\n tokenEntries.length > 0\n ? { entries: () => tokenEntries }\n : undefined,\n }),\n }),\n };\n}\n\n// Controllable mock state\nlet mockBlaze: any = {};\nlet mockIsHot = true;\nlet mockBlazeError: Error | null = null;\n\nmock.module(\"../actions/builtin/blaze-helper.js\", () => ({\n getBlazeFromContext: async () => {\n if (mockBlazeError) throw mockBlazeError;\n return mockBlaze;\n },\n isHotWallet: () => mockIsHot,\n}));\n\n// Mock Core.AssetId static methods used by wallet/transaction actions\nmock.module(\"@blaze-cardano/sdk\", () => ({\n Core: {\n AssetId: {\n getPolicyId: (assetId: string) => assetId.slice(0, 56),\n getAssetName: (assetId: string) => assetId.slice(56),\n },\n Transaction: {\n fromCbor: (cbor: string) => mockTxFromCbor(cbor),\n },\n TxCBOR: (s: string) => s,\n },\n Blaze: class {},\n HotWallet: class {},\n}));\n\n// Controllable mock transaction from CBOR\n// These mock objects are compatible with the real countSignatures/getRequiredSigners\n// from tx-dialog.ts, so we don't need to mock that module (which would leak globally).\nlet mockTxFromCbor: (cbor: string) => any = () => ({\n body: () => ({\n hash: () => ({ toString: () => \"abc123txhash\" }),\n inputs: () => ({\n values: () => [\n {\n transactionId: () => ({ toString: () => \"input-tx-hash-1\" }),\n index: () => 0n,\n },\n ],\n }),\n outputs: () => [\n {\n address: () => ({ toBech32: () => \"addr_test1output...\" }),\n amount: () => ({\n coin: () => 2_000_000n,\n multiasset: () => undefined,\n }),\n },\n ],\n fee: () => 200_000n,\n requiredSigners: () => null,\n }),\n witnessSet: () => ({\n vkeys: () => null,\n }),\n toCbor: () => \"signed-cbor-hex\",\n});\n\n// Now import the actions (after mocks are set up)\nconst { getWalletAddress, getWalletBalance, getWalletUtxos } = await import(\n \"../actions/builtin/wallet-actions.js\"\n);\nconst {\n signTransaction,\n submitTransaction,\n signAndSubmit,\n decodeTransaction,\n} = await import(\"../actions/builtin/transaction-actions.js\");\n\n// Minimal context factory\nfunction makeContext(settingsOverrides: Record<string, unknown> = {}) {\n return {\n sprinkle: {} as any,\n settings: {\n network: \"preview\",\n provider: { type: \"blockfrost\", apiKey: \"test\" },\n wallet: { type: \"hot\", mnemonic: \"test words\" },\n ...settingsOverrides,\n } as any,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Wallet Actions\n// ---------------------------------------------------------------------------\n\ndescribe(\"get-wallet-address\", () => {\n beforeEach(() => {\n mockBlazeError = null;\n mockIsHot = true;\n });\n\n test(\"returns bech32 address and network\", async () => {\n mockBlaze = {\n wallet: {\n getChangeAddress: async () => makeAddress(\"addr_test1qzabc123\"),\n },\n };\n const ctx = makeContext();\n const result = await getWalletAddress.execute({}, ctx);\n expect(result.address).toBe(\"addr_test1qzabc123\");\n expect(result.network).toBe(\"preview\");\n });\n\n test(\"returns 'unknown' network when not in settings\", async () => {\n mockBlaze = {\n wallet: {\n getChangeAddress: async () => makeAddress(\"addr1mainnet\"),\n },\n };\n const ctx = makeContext({ network: undefined });\n const result = await getWalletAddress.execute({}, ctx);\n expect(result.network).toBe(\"unknown\");\n });\n\n test(\"throws WALLET_NOT_CONFIGURED when getBlazeFromContext fails\", async () => {\n mockBlazeError = new ActionError(\"Missing settings\", \"WALLET_NOT_CONFIGURED\", {\n missingFields: [\"wallet\"],\n });\n const ctx = makeContext();\n await expect(getWalletAddress.execute({}, ctx)).rejects.toMatchObject({\n code: \"WALLET_NOT_CONFIGURED\",\n });\n });\n\n test(\"throws NO_ADDRESS when wallet returns no address\", async () => {\n mockBlaze = {\n wallet: {\n getChangeAddress: async () => {\n throw new Error(\"no address available\");\n },\n },\n };\n const ctx = makeContext();\n await expect(getWalletAddress.execute({}, ctx)).rejects.toMatchObject({\n code: \"NO_ADDRESS\",\n });\n });\n\n test(\"has correct metadata\", () => {\n expect(getWalletAddress.name).toBe(\"get-wallet-address\");\n expect(getWalletAddress.category).toBe(\"wallet\");\n expect(getWalletAddress.inputSchema).toBeDefined();\n expect(getWalletAddress.outputSchema).toBeDefined();\n });\n});\n\ndescribe(\"get-wallet-balance\", () => {\n beforeEach(() => {\n mockBlazeError = null;\n });\n\n test(\"returns lovelace, ada, and empty tokens for ADA-only wallet\", async () => {\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () => [\n makeUtxo({ txHash: \"tx1\", index: 0, lovelace: 5_000_000n }),\n makeUtxo({ txHash: \"tx2\", index: 1, lovelace: 3_000_000n }),\n ],\n },\n };\n const result = await getWalletBalance.execute({}, makeContext());\n expect(result.lovelace).toBe(\"8000000\");\n expect(result.ada).toBe(\"8.000000\");\n expect(result.tokens).toEqual([]);\n });\n\n test(\"aggregates tokens across UTxOs\", async () => {\n const policyId = \"a\".repeat(56);\n const assetName = \"token1\";\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () => [\n makeUtxo({\n txHash: \"tx1\",\n index: 0,\n lovelace: 2_000_000n,\n tokens: [{ policyId, assetName, quantity: 100n }],\n }),\n makeUtxo({\n txHash: \"tx2\",\n index: 0,\n lovelace: 1_000_000n,\n tokens: [{ policyId, assetName, quantity: 50n }],\n }),\n ],\n },\n };\n const result = await getWalletBalance.execute({}, makeContext());\n expect(result.lovelace).toBe(\"3000000\");\n expect(result.tokens).toHaveLength(1);\n expect(result.tokens[0].quantity).toBe(\"150\");\n expect(result.tokens[0].policyId).toBe(policyId);\n });\n\n test(\"handles fractional ADA correctly\", async () => {\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () => [\n makeUtxo({ txHash: \"tx1\", index: 0, lovelace: 1_500_123n }),\n ],\n },\n };\n const result = await getWalletBalance.execute({}, makeContext());\n expect(result.ada).toBe(\"1.500123\");\n });\n\n test(\"handles zero balance\", async () => {\n mockBlaze = {\n wallet: { getUnspentOutputs: async () => [] },\n };\n const result = await getWalletBalance.execute({}, makeContext());\n expect(result.lovelace).toBe(\"0\");\n expect(result.ada).toBe(\"0.000000\");\n expect(result.tokens).toEqual([]);\n });\n\n test(\"throws PROVIDER_ERROR on UTxO fetch failure\", async () => {\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () => {\n throw new Error(\"connection timeout\");\n },\n },\n };\n await expect(getWalletBalance.execute({}, makeContext())).rejects.toMatchObject({\n code: \"PROVIDER_ERROR\",\n });\n });\n});\n\ndescribe(\"get-wallet-utxos\", () => {\n beforeEach(() => {\n mockBlazeError = null;\n });\n\n test(\"returns UTxOs with correct structure\", async () => {\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () => [\n makeUtxo({ txHash: \"txhash1\", index: 0, lovelace: 5_000_000n }),\n makeUtxo({ txHash: \"txhash2\", index: 1, lovelace: 3_000_000n }),\n ],\n },\n };\n const result = await getWalletUtxos.execute({}, makeContext());\n expect(result.total).toBe(2);\n expect(result.utxos).toHaveLength(2);\n expect(result.utxos[0].txHash).toBe(\"txhash1\");\n expect(result.utxos[0].outputIndex).toBe(0);\n expect(result.utxos[0].lovelace).toBe(\"5000000\");\n expect(result.utxos[0].tokens).toEqual([]);\n });\n\n test(\"respects limit parameter\", async () => {\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () =>\n Array.from({ length: 10 }, (_, i) =>\n makeUtxo({ txHash: `tx${i}`, index: 0, lovelace: 1_000_000n }),\n ),\n },\n };\n const result = await getWalletUtxos.execute({ limit: 3 }, makeContext());\n expect(result.utxos).toHaveLength(3);\n expect(result.total).toBe(10);\n });\n\n test(\"defaults to limit of 100\", async () => {\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () =>\n Array.from({ length: 150 }, (_, i) =>\n makeUtxo({ txHash: `tx${i}`, index: 0, lovelace: 1_000_000n }),\n ),\n },\n };\n const result = await getWalletUtxos.execute({}, makeContext());\n expect(result.utxos).toHaveLength(100);\n expect(result.total).toBe(150);\n });\n\n test(\"includes tokens on UTxOs\", async () => {\n const policyId = \"b\".repeat(56);\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () => [\n makeUtxo({\n txHash: \"tx1\",\n index: 0,\n lovelace: 2_000_000n,\n tokens: [{ policyId, assetName: \"mytoken\", quantity: 42n }],\n }),\n ],\n },\n };\n const result = await getWalletUtxos.execute({}, makeContext());\n expect(result.utxos[0].tokens).toHaveLength(1);\n expect(result.utxos[0].tokens[0].quantity).toBe(\"42\");\n });\n\n test(\"throws PROVIDER_ERROR on fetch failure\", async () => {\n mockBlaze = {\n wallet: {\n getUnspentOutputs: async () => {\n throw new Error(\"provider down\");\n },\n },\n };\n await expect(getWalletUtxos.execute({}, makeContext())).rejects.toMatchObject({\n code: \"PROVIDER_ERROR\",\n });\n });\n});\n\n// ---------------------------------------------------------------------------\n// Transaction Actions\n// ---------------------------------------------------------------------------\n\ndescribe(\"sign-transaction\", () => {\n beforeEach(() => {\n mockBlazeError = null;\n mockIsHot = true;\n });\n\n test(\"signs a transaction and returns signed CBOR, hash, and signature count\", async () => {\n mockBlaze = {\n wallet: {},\n signTransaction: async () => ({\n toCbor: () => \"signed-tx-cbor\",\n body: () => ({\n hash: () => ({ toString: () => \"signed-tx-hash\" }),\n }),\n witnessSet: () => ({ vkeys: () => ({ size: () => 1 }) }),\n }),\n };\n const result = await signTransaction.execute(\n { txCbor: \"valid-cbor\" },\n makeContext(),\n );\n expect(result.signedTxCbor).toBe(\"signed-tx-cbor\");\n expect(result.txHash).toBe(\"signed-tx-hash\");\n expect(result.signatureCount).toBe(1);\n });\n\n test(\"throws COLD_WALLET for cold wallets\", async () => {\n mockIsHot = false;\n mockBlaze = { wallet: {} };\n await expect(\n signTransaction.execute({ txCbor: \"some-cbor\" }, makeContext()),\n ).rejects.toMatchObject({ code: \"COLD_WALLET\" });\n });\n\n test(\"throws INVALID_CBOR for bad CBOR input\", async () => {\n mockTxFromCbor = () => {\n throw new Error(\"invalid cbor\");\n };\n mockBlaze = { wallet: {} };\n await expect(\n signTransaction.execute({ txCbor: \"bad-cbor\" }, makeContext()),\n ).rejects.toMatchObject({ code: \"INVALID_CBOR\" });\n\n // Restore default mock\n mockTxFromCbor = () => ({\n body: () => ({\n hash: () => ({ toString: () => \"abc123txhash\" }),\n inputs: () => ({ values: () => [] }),\n outputs: () => [],\n fee: () => 200_000n,\n requiredSigners: () => null,\n }),\n witnessSet: () => ({ vkeys: () => null }),\n toCbor: () => \"signed-cbor-hex\",\n });\n });\n\n test(\"throws SIGN_ERROR when signing fails\", async () => {\n mockBlaze = {\n wallet: {},\n signTransaction: async () => {\n throw new Error(\"hardware wallet disconnected\");\n },\n };\n await expect(\n signTransaction.execute({ txCbor: \"valid-cbor\" }, makeContext()),\n ).rejects.toMatchObject({ code: \"SIGN_ERROR\" });\n });\n\n test(\"has correct metadata\", () => {\n expect(signTransaction.name).toBe(\"sign-transaction\");\n expect(signTransaction.category).toBe(\"wallet\");\n });\n});\n\ndescribe(\"submit-transaction\", () => {\n beforeEach(() => {\n mockBlazeError = null;\n });\n\n test(\"submits a transaction and returns hash\", async () => {\n mockBlaze = {\n wallet: {},\n submitTransaction: async () => ({\n toString: () => \"submitted-tx-hash\",\n }),\n };\n const result = await submitTransaction.execute(\n { txCbor: \"valid-signed-cbor\" },\n makeContext(),\n );\n expect(result.txHash).toBe(\"submitted-tx-hash\");\n expect(result.submitted).toBe(true);\n });\n\n test(\"throws SUBMISSION_ERROR on failure\", async () => {\n mockBlaze = {\n wallet: {},\n submitTransaction: async () => {\n throw new Error(\"tx already submitted\");\n },\n };\n await expect(\n submitTransaction.execute({ txCbor: \"some-cbor\" }, makeContext()),\n ).rejects.toMatchObject({ code: \"SUBMISSION_ERROR\" });\n });\n\n test(\"has correct metadata\", () => {\n expect(submitTransaction.name).toBe(\"submit-transaction\");\n expect(submitTransaction.category).toBe(\"wallet\");\n });\n});\n\ndescribe(\"sign-and-submit\", () => {\n beforeEach(() => {\n mockBlazeError = null;\n mockIsHot = true;\n });\n\n test(\"signs and submits without waiting for confirmation\", async () => {\n mockBlaze = {\n wallet: {},\n signTransaction: async () => ({\n toCbor: () => \"signed-cbor\",\n body: () => ({\n hash: () => ({ toString: () => \"tx-hash\" }),\n }),\n witnessSet: () => ({ vkeys: () => ({ size: () => 1 }) }),\n }),\n submitTransaction: async () => ({\n toString: () => \"tx-hash\",\n }),\n };\n const result = await signAndSubmit.execute(\n { txCbor: \"valid-cbor\", waitForConfirmation: false },\n makeContext(),\n );\n expect(result.txHash).toBe(\"tx-hash\");\n expect(result.submitted).toBe(true);\n expect(result.signedTxCbor).toBe(\"signed-cbor\");\n expect(result.confirmed).toBeUndefined();\n });\n\n test(\"throws COLD_WALLET for cold wallets\", async () => {\n mockIsHot = false;\n mockBlaze = { wallet: {} };\n await expect(\n signAndSubmit.execute({ txCbor: \"cbor\" }, makeContext()),\n ).rejects.toMatchObject({ code: \"COLD_WALLET\" });\n });\n\n test(\"throws SUBMISSION_ERROR when submit fails (includes signedTxCbor in details)\", async () => {\n mockBlaze = {\n wallet: {},\n signTransaction: async () => ({\n toCbor: () => \"signed-but-failed\",\n body: () => ({\n hash: () => ({ toString: () => \"hash\" }),\n }),\n witnessSet: () => ({ vkeys: () => null }),\n }),\n submitTransaction: async () => {\n throw new Error(\"node rejected\");\n },\n };\n try {\n await signAndSubmit.execute({ txCbor: \"valid-cbor\" }, makeContext());\n expect(true).toBe(false); // should not reach\n } catch (err: any) {\n expect(err.code).toBe(\"SUBMISSION_ERROR\");\n expect(err.details.signedTxCbor).toBe(\"signed-but-failed\");\n }\n });\n\n test(\"has correct metadata\", () => {\n expect(signAndSubmit.name).toBe(\"sign-and-submit\");\n expect(signAndSubmit.category).toBe(\"wallet\");\n });\n});\n\ndescribe(\"decode-transaction\", () => {\n beforeEach(() => {\n mockBlazeError = null;\n\n // Set up a rich mock transaction for decode tests\n mockTxFromCbor = () => ({\n body: () => ({\n hash: () => ({ toString: () => \"decoded-tx-hash\" }),\n inputs: () => ({\n values: () => [\n {\n transactionId: () => ({ toString: () => \"input-hash-1\" }),\n index: () => 0n,\n },\n {\n transactionId: () => ({ toString: () => \"input-hash-2\" }),\n index: () => 1n,\n },\n ],\n }),\n outputs: () => [\n {\n address: () => ({ toBech32: () => \"addr_test1output1\" }),\n amount: () => ({\n coin: () => 5_000_000n,\n multiasset: () => undefined,\n }),\n },\n {\n address: () => ({ toBech32: () => \"addr_test1output2\" }),\n amount: () => ({\n coin: () => 2_000_000n,\n multiasset: () => undefined,\n }),\n },\n ],\n fee: () => 180_000n,\n requiredSigners: () => ({\n values: () => [\n { toString: () => \"signer-hash-1\" },\n { toString: () => \"signer-hash-2\" },\n ],\n }),\n }),\n witnessSet: () => ({\n vkeys: () => ({ size: () => 2 }),\n }),\n });\n });\n\n test(\"decodes a transaction and returns all fields\", async () => {\n const result = await decodeTransaction.execute(\n { txCbor: \"valid-cbor-hex\" },\n makeContext(),\n );\n expect(result.txHash).toBe(\"decoded-tx-hash\");\n expect(result.inputs).toHaveLength(2);\n expect(result.inputs[0]).toEqual({ txHash: \"input-hash-1\", outputIndex: 0 });\n expect(result.inputs[1]).toEqual({ txHash: \"input-hash-2\", outputIndex: 1 });\n expect(result.outputs).toHaveLength(2);\n expect(result.outputs[0].address).toBe(\"addr_test1output1\");\n expect(result.outputs[0].lovelace).toBe(\"5000000\");\n expect(result.fee).toBe(\"180000\");\n expect(result.signatureCount).toBe(2);\n expect(result.requiredSigners).toEqual([\"signer-hash-1\", \"signer-hash-2\"]);\n });\n\n test(\"falls back to hex address when bech32 fails\", async () => {\n mockTxFromCbor = () => ({\n body: () => ({\n hash: () => ({ toString: () => \"tx-hash\" }),\n inputs: () => ({ values: () => [] }),\n outputs: () => [\n {\n address: () => ({\n toBech32: () => {\n throw new Error(\"cannot convert to bech32\");\n },\n toBytes: () => \"deadbeef\",\n }),\n amount: () => ({\n coin: () => 1_000_000n,\n multiasset: () => undefined,\n }),\n },\n ],\n fee: () => 100_000n,\n requiredSigners: () => null,\n }),\n witnessSet: () => ({ vkeys: () => null }),\n });\n\n const result = await decodeTransaction.execute(\n { txCbor: \"cbor-with-script-address\" },\n makeContext(),\n );\n expect(result.outputs[0].address).toBe(\"deadbeef\");\n });\n\n test(\"handles transaction with tokens in outputs\", async () => {\n const policyId = \"c\".repeat(56);\n const assetName = \"mytoken\";\n const assetId = `${policyId}${assetName}`;\n\n mockTxFromCbor = () => ({\n body: () => ({\n hash: () => ({ toString: () => \"tx-hash\" }),\n inputs: () => ({ values: () => [] }),\n outputs: () => [\n {\n address: () => ({ toBech32: () => \"addr_test1...\" }),\n amount: () => ({\n coin: () => 2_000_000n,\n multiasset: () => ({\n entries: () => [[assetId, 500n]],\n }),\n }),\n },\n ],\n fee: () => 200_000n,\n requiredSigners: () => null,\n }),\n witnessSet: () => ({ vkeys: () => null }),\n });\n\n const result = await decodeTransaction.execute(\n { txCbor: \"cbor-with-tokens\" },\n makeContext(),\n );\n expect(result.outputs[0].tokens).toHaveLength(1);\n expect(result.outputs[0].tokens[0].policyId).toBe(policyId);\n expect(result.outputs[0].tokens[0].quantity).toBe(\"500\");\n });\n\n test(\"throws INVALID_CBOR for bad input\", async () => {\n mockTxFromCbor = () => {\n throw new Error(\"bad cbor\");\n };\n await expect(\n decodeTransaction.execute({ txCbor: \"garbage\" }, makeContext()),\n ).rejects.toMatchObject({ code: \"INVALID_CBOR\" });\n });\n\n test(\"does not require a wallet (category is 'transaction')\", () => {\n expect(decodeTransaction.name).toBe(\"decode-transaction\");\n expect(decodeTransaction.category).toBe(\"transaction\");\n });\n});\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,UAAU;AAEnE,SAASC,WAAW,QAAQ,qBAAqB;;AAEjD;AACA;AACA;;AAEA;AACA,SAASC,WAAWA,CAACC,MAAM,GAAG,qBAAqB,EAAE;EACnD,OAAO;IAAEC,QAAQ,EAAEA,CAAA,KAAMD;EAAO,CA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,CAACC,aAAa,CAAC;MAAEC,IAAI,EAAE;IAAe,CAAC,CAAC;EACnD,CAAC,CAAC;EAEFvF,IAAI,CAAC,uDAAuD,EAAE,MAAM;IAClED,MAAM,CAACqE,iBAAiB,CAACqB,IAAI,CAAC,CAACN,IAAI,CAAC,oBAAoB,CAAC;IACzDpF,MAAM,CAACqE,iBAAiB,CAACsB,QAAQ,CAAC,CAACP,IAAI,CAAC,aAAa,CAAC;EACxD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Built-in addressbook actions for managing named native scripts.
3
+ *
4
+ * The addressbook stores MultisigScript entries by name in the profile,
5
+ * allowing them to be reused across actions and automatically resolved
6
+ * by script hash during transaction building.
7
+ */
8
+
9
+ import { Type } from "@sinclair/typebox";
10
+ import { MultisigScript } from "../../schemas.js";
11
+ import { ActionError } from "../types.js";
12
+ import { toNativeScript } from "./native-script.js";
13
+
14
+ /**
15
+ * `list-addressbook` -- List all entries in the addressbook.
16
+ */
17
+ export const listAddressbook = {
18
+ name: "list-addressbook",
19
+ description: "List all named native scripts in the addressbook.",
20
+ category: "addressbook",
21
+ inputSchema: Type.Object({}),
22
+ outputSchema: Type.Object({
23
+ entries: Type.Array(Type.Object({
24
+ name: Type.String(),
25
+ scriptHash: Type.String(),
26
+ script: MultisigScript
27
+ }))
28
+ }),
29
+ execute: async (_input, context) => {
30
+ const addressbook = context.sprinkle.addressbook ?? {};
31
+ const entries = [];
32
+ for (const [name, ms] of Object.entries(addressbook)) {
33
+ try {
34
+ const script = toNativeScript(ms);
35
+ entries.push({
36
+ name,
37
+ scriptHash: script.hash(),
38
+ script: ms
39
+ });
40
+ } catch {
41
+ // Include entries even if hash computation fails
42
+ entries.push({
43
+ name,
44
+ scriptHash: "unknown",
45
+ script: ms
46
+ });
47
+ }
48
+ }
49
+ return {
50
+ entries
51
+ };
52
+ }
53
+ };
54
+
55
+ /**
56
+ * `set-addressbook-entry` -- Add or update a named native script in the addressbook.
57
+ */
58
+ export const setAddressbookEntry = {
59
+ name: "set-addressbook-entry",
60
+ description: "Add or update a named native script in the addressbook. Accepts a MultisigScript JSON structure.",
61
+ category: "addressbook",
62
+ inputSchema: Type.Object({
63
+ name: Type.String({
64
+ minLength: 1,
65
+ description: "Name for this addressbook entry"
66
+ }),
67
+ script: MultisigScript
68
+ }),
69
+ outputSchema: Type.Object({
70
+ name: Type.String(),
71
+ scriptHash: Type.String({
72
+ description: "Computed script hash"
73
+ })
74
+ }),
75
+ execute: async (input, context) => {
76
+ // Validate the script can be converted
77
+ const blazeScript = toNativeScript(input.script);
78
+ const scriptHash = blazeScript.hash();
79
+ context.sprinkle.addressbook[input.name] = input.script;
80
+ context.sprinkle.saveSettings();
81
+ return {
82
+ name: input.name,
83
+ scriptHash
84
+ };
85
+ }
86
+ };
87
+
88
+ /**
89
+ * `delete-addressbook-entry` -- Remove a named native script from the addressbook.
90
+ */
91
+ export const deleteAddressbookEntry = {
92
+ name: "delete-addressbook-entry",
93
+ description: "Remove a named native script from the addressbook.",
94
+ category: "addressbook",
95
+ inputSchema: Type.Object({
96
+ name: Type.String({
97
+ minLength: 1,
98
+ description: "Name of the addressbook entry to delete"
99
+ })
100
+ }),
101
+ outputSchema: Type.Object({
102
+ deleted: Type.Boolean(),
103
+ name: Type.String()
104
+ }),
105
+ execute: async (input, context) => {
106
+ if (!(input.name in context.sprinkle.addressbook)) {
107
+ throw new ActionError(`Addressbook entry "${input.name}" not found.`, "NOT_FOUND", {
108
+ name: input.name
109
+ });
110
+ }
111
+ delete context.sprinkle.addressbook[input.name];
112
+ context.sprinkle.saveSettings();
113
+ return {
114
+ deleted: true,
115
+ name: input.name
116
+ };
117
+ }
118
+ };
119
+
120
+ /**
121
+ * `get-addressbook-entry` -- Get a specific named native script from the addressbook.
122
+ */
123
+ export const getAddressbookEntry = {
124
+ name: "get-addressbook-entry",
125
+ description: "Get a specific named native script from the addressbook.",
126
+ category: "addressbook",
127
+ inputSchema: Type.Object({
128
+ name: Type.String({
129
+ minLength: 1,
130
+ description: "Name of the addressbook entry to retrieve"
131
+ })
132
+ }),
133
+ outputSchema: Type.Object({
134
+ name: Type.String(),
135
+ scriptHash: Type.String(),
136
+ script: MultisigScript
137
+ }),
138
+ execute: async (input, context) => {
139
+ const ms = context.sprinkle.addressbook[input.name];
140
+ if (!ms) {
141
+ throw new ActionError(`Addressbook entry "${input.name}" not found.`, "NOT_FOUND", {
142
+ name: input.name
143
+ });
144
+ }
145
+ let scriptHash = "unknown";
146
+ try {
147
+ const blazeScript = toNativeScript(ms);
148
+ scriptHash = blazeScript.hash();
149
+ } catch {
150
+ // Return entry even if hash computation fails
151
+ }
152
+ return {
153
+ name: input.name,
154
+ scriptHash,
155
+ script: ms
156
+ };
157
+ }
158
+ };
159
+ //# sourceMappingURL=addressbook-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressbook-actions.js","names":["Type","MultisigScript","ActionError","toNativeScript","listAddressbook","name","description","category","inputSchema","Object","outputSchema","entries","Array","String","scriptHash","script","execute","_input","context","addressbook","sprinkle","ms","push","hash","setAddressbookEntry","minLength","input","blazeScript","saveSettings","deleteAddressbookEntry","deleted","Boolean","getAddressbookEntry"],"sources":["../../../../../src/Sprinkle/actions/builtin/addressbook-actions.ts"],"sourcesContent":["/**\n * Built-in addressbook actions for managing named native scripts.\n *\n * The addressbook stores MultisigScript entries by name in the profile,\n * allowing them to be reused across actions and automatically resolved\n * by script hash during transaction building.\n */\n\nimport { Type } from \"@sinclair/typebox\";\nimport type { TSchema } from \"@sinclair/typebox\";\nimport { MultisigScript } from \"../../schemas.js\";\nimport type { TMultisigScript } from \"../../schemas.js\";\nimport { ActionError } from \"../types.js\";\nimport type { IAction } from \"../types.js\";\nimport { toNativeScript } from \"./native-script.js\";\n\n/**\n * `list-addressbook` -- List all entries in the addressbook.\n */\nexport const listAddressbook: IAction<\n Record<string, never>,\n { entries: Array<{ name: string; scriptHash: string; script: TMultisigScript }> },\n TSchema\n> = {\n name: \"list-addressbook\",\n description: \"List all named native scripts in the addressbook.\",\n category: \"addressbook\",\n inputSchema: Type.Object({}),\n outputSchema: Type.Object({\n entries: Type.Array(\n Type.Object({\n name: Type.String(),\n scriptHash: Type.String(),\n script: MultisigScript,\n }),\n ),\n }),\n execute: async (_input, context) => {\n const addressbook = context.sprinkle.addressbook ?? {};\n const entries = [];\n for (const [name, ms] of Object.entries(addressbook)) {\n try {\n const script = toNativeScript(ms);\n entries.push({ name, scriptHash: script.hash(), script: ms });\n } catch {\n // Include entries even if hash computation fails\n entries.push({ name, scriptHash: \"unknown\", script: ms });\n }\n }\n return { entries };\n },\n};\n\n/**\n * `set-addressbook-entry` -- Add or update a named native script in the addressbook.\n */\nexport const setAddressbookEntry: IAction<\n { name: string; script: TMultisigScript },\n { name: string; scriptHash: string },\n TSchema\n> = {\n name: \"set-addressbook-entry\",\n description:\n \"Add or update a named native script in the addressbook. Accepts a MultisigScript JSON structure.\",\n category: \"addressbook\",\n inputSchema: Type.Object({\n name: Type.String({\n minLength: 1,\n description: \"Name for this addressbook entry\",\n }),\n script: MultisigScript,\n }),\n outputSchema: Type.Object({\n name: Type.String(),\n scriptHash: Type.String({ description: \"Computed script hash\" }),\n }),\n execute: async (input, context) => {\n // Validate the script can be converted\n const blazeScript = toNativeScript(input.script);\n const scriptHash = blazeScript.hash();\n\n context.sprinkle.addressbook[input.name] = input.script;\n context.sprinkle.saveSettings();\n\n return { name: input.name, scriptHash };\n },\n};\n\n/**\n * `delete-addressbook-entry` -- Remove a named native script from the addressbook.\n */\nexport const deleteAddressbookEntry: IAction<\n { name: string },\n { deleted: boolean; name: string },\n TSchema\n> = {\n name: \"delete-addressbook-entry\",\n description: \"Remove a named native script from the addressbook.\",\n category: \"addressbook\",\n inputSchema: Type.Object({\n name: Type.String({\n minLength: 1,\n description: \"Name of the addressbook entry to delete\",\n }),\n }),\n outputSchema: Type.Object({\n deleted: Type.Boolean(),\n name: Type.String(),\n }),\n execute: async (input, context) => {\n if (!(input.name in context.sprinkle.addressbook)) {\n throw new ActionError(\n `Addressbook entry \"${input.name}\" not found.`,\n \"NOT_FOUND\",\n { name: input.name },\n );\n }\n\n delete context.sprinkle.addressbook[input.name];\n context.sprinkle.saveSettings();\n\n return { deleted: true, name: input.name };\n },\n};\n\n/**\n * `get-addressbook-entry` -- Get a specific named native script from the addressbook.\n */\nexport const getAddressbookEntry: IAction<\n { name: string },\n { name: string; scriptHash: string; script: TMultisigScript },\n TSchema\n> = {\n name: \"get-addressbook-entry\",\n description: \"Get a specific named native script from the addressbook.\",\n category: \"addressbook\",\n inputSchema: Type.Object({\n name: Type.String({\n minLength: 1,\n description: \"Name of the addressbook entry to retrieve\",\n }),\n }),\n outputSchema: Type.Object({\n name: Type.String(),\n scriptHash: Type.String(),\n script: MultisigScript,\n }),\n execute: async (input, context) => {\n const ms = context.sprinkle.addressbook[input.name];\n if (!ms) {\n throw new ActionError(\n `Addressbook entry \"${input.name}\" not found.`,\n \"NOT_FOUND\",\n { name: input.name },\n );\n }\n\n let scriptHash = \"unknown\";\n try {\n const blazeScript = toNativeScript(ms);\n scriptHash = blazeScript.hash();\n } catch {\n // Return entry even if hash computation fails\n }\n\n return { name: input.name, scriptHash, script: ms };\n },\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,mBAAmB;AAExC,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,cAAc,QAAQ,oBAAoB;;AAEnD;AACA;AACA;AACA,OAAO,MAAMC,eAIZ,GAAG;EACFC,IAAI,EAAE,kBAAkB;EACxBC,WAAW,EAAE,mDAAmD;EAChEC,QAAQ,EAAE,aAAa;EACvBC,WAAW,EAAER,IAAI,CAACS,MAAM,CAAC,CAAC,CAAC,CAAC;EAC5BC,YAAY,EAAEV,IAAI,CAACS,MAAM,CAAC;IACxBE,OAAO,EAAEX,IAAI,CAACY,KAAK,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AAC;IACjC,CAAC,CAAC,MAAM;MACN;IAAA;IAGF,OAAO;MAAElB,IAAI,EAAEqB,KAAK,CAACrB,IAAI;MAAES,UAAU;MAAEC,MAAM,EAAEM;IAAG,CAAC;EACrD;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Shared helper utilities for wallet and transaction actions.
3
+ * Provides Blaze instance creation from action context settings.
4
+ */
5
+
6
+ import { HotWallet } from "@blaze-cardano/sdk";
7
+ import { GetBlaze } from "../../wallet.js";
8
+ import { ActionError } from "../types.js";
9
+
10
+ /** Settings shape expected on context.settings for wallet access */
11
+
12
+ /** Optional overrides for Blaze initialization, in case field names differ */
13
+
14
+ /**
15
+ * Creates a Blaze instance from action context settings.
16
+ *
17
+ * Falls back to `context.settings.network`, `context.settings.provider`,
18
+ * and `context.settings.wallet` when overrides are not provided.
19
+ *
20
+ * @throws `ActionError("WALLET_NOT_CONFIGURED")` if required settings are missing
21
+ * @throws `ActionError("BLAZE_INIT_ERROR")` if Blaze fails to initialize
22
+ */
23
+ export async function getBlazeFromContext(context, overrides) {
24
+ const settings = context.settings;
25
+ const network = overrides?.network ?? settings.network;
26
+ const provider = overrides?.provider ?? settings.provider;
27
+ const wallet = overrides?.wallet ?? settings.wallet;
28
+
29
+ // Validate required fields and collect missing ones for a helpful error message
30
+ const missing = [];
31
+ if (!network) missing.push("network");
32
+ if (!provider) missing.push("provider");
33
+ if (!wallet) missing.push("wallet");
34
+ if (missing.length > 0) {
35
+ throw new ActionError(`Wallet is not configured. Missing settings: ${missing.join(", ")}. ` + `Set these fields in your profile settings before using wallet actions.`, "WALLET_NOT_CONFIGURED", {
36
+ missingFields: missing
37
+ });
38
+ }
39
+ try {
40
+ return await GetBlaze(network, provider, wallet);
41
+ } catch (err) {
42
+ throw new ActionError(`Failed to initialize Blaze wallet: ${err instanceof Error ? err.message : String(err)}`, "BLAZE_INIT_ERROR", {
43
+ error: err instanceof Error ? err.message : String(err)
44
+ });
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Checks whether the wallet in a Blaze instance is a hot wallet.
50
+ * Cold wallets cannot sign transactions.
51
+ */
52
+ export function isHotWallet(blaze) {
53
+ return blaze.wallet instanceof HotWallet;
54
+ }
55
+ //# sourceMappingURL=blaze-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blaze-helper.js","names":["HotWallet","GetBlaze","ActionError","getBlazeFromContext","context","overrides","settings","network","provider","wallet","missing","push","length","join","missingFields","err","Error","message","String","error","isHotWallet","blaze"],"sources":["../../../../../src/Sprinkle/actions/builtin/blaze-helper.ts"],"sourcesContent":["/**\n * Shared helper utilities for wallet and transaction actions.\n * Provides Blaze instance creation from action context settings.\n */\n\nimport type { TSchema } from \"@sinclair/typebox\";\nimport { Blaze, HotWallet } from \"@blaze-cardano/sdk\";\nimport type { Provider } from \"@blaze-cardano/query\";\nimport type { Wallet } from \"@blaze-cardano/sdk\";\nimport { GetBlaze } from \"../../wallet.js\";\nimport { ActionError } from \"../types.js\";\nimport type { IActionContext } from \"../types.js\";\nimport type {\n NetworkSchema,\n ProviderSettingsSchema,\n WalletSettingsSchema,\n} from \"../../schemas.js\";\nimport type { TExact } from \"../../types.js\";\n\n/** Settings shape expected on context.settings for wallet access */\nexport interface IWalletSettings {\n network?: TExact<typeof NetworkSchema>;\n provider?: TExact<typeof ProviderSettingsSchema>;\n wallet?: TExact<typeof WalletSettingsSchema>;\n}\n\n/** Optional overrides for Blaze initialization, in case field names differ */\nexport interface IBlazeOverrides {\n network?: TExact<typeof NetworkSchema>;\n provider?: TExact<typeof ProviderSettingsSchema>;\n wallet?: TExact<typeof WalletSettingsSchema>;\n}\n\n/**\n * Creates a Blaze instance from action context settings.\n *\n * Falls back to `context.settings.network`, `context.settings.provider`,\n * and `context.settings.wallet` when overrides are not provided.\n *\n * @throws `ActionError(\"WALLET_NOT_CONFIGURED\")` if required settings are missing\n * @throws `ActionError(\"BLAZE_INIT_ERROR\")` if Blaze fails to initialize\n */\nexport async function getBlazeFromContext<S extends TSchema>(\n context: IActionContext<S>,\n overrides?: IBlazeOverrides,\n): Promise<Blaze<Provider, Wallet>> {\n const settings = context.settings as unknown as IWalletSettings;\n\n const network = overrides?.network ?? settings.network;\n const provider = overrides?.provider ?? settings.provider;\n const wallet = overrides?.wallet ?? settings.wallet;\n\n // Validate required fields and collect missing ones for a helpful error message\n const missing: string[] = [];\n if (!network) missing.push(\"network\");\n if (!provider) missing.push(\"provider\");\n if (!wallet) missing.push(\"wallet\");\n\n if (missing.length > 0) {\n throw new ActionError(\n `Wallet is not configured. Missing settings: ${missing.join(\", \")}. ` +\n `Set these fields in your profile settings before using wallet actions.`,\n \"WALLET_NOT_CONFIGURED\",\n { missingFields: missing },\n );\n }\n\n try {\n return await GetBlaze(\n network as TExact<typeof NetworkSchema>,\n provider as TExact<typeof ProviderSettingsSchema>,\n wallet as TExact<typeof WalletSettingsSchema>,\n );\n } catch (err) {\n throw new ActionError(\n `Failed to initialize Blaze wallet: ${err instanceof Error ? err.message : String(err)}`,\n \"BLAZE_INIT_ERROR\",\n { error: err instanceof Error ? err.message : String(err) },\n );\n }\n}\n\n/**\n * Checks whether the wallet in a Blaze instance is a hot wallet.\n * Cold wallets cannot sign transactions.\n */\nexport function isHotWallet(blaze: Blaze<Provider, Wallet>): boolean {\n return blaze.wallet instanceof HotWallet;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA,SAAgBA,SAAS,QAAQ,oBAAoB;AAGrD,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,WAAW,QAAQ,aAAa;;AASzC;;AAOA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,mBAAmBA,CACvCC,OAA0B,EAC1BC,SAA2B,EACO;EAClC,MAAMC,QAAQ,GAAGF,OAAO,CAACE,QAAsC;EAE/D,MAAMC,OAAO,GAAGF,SAAS,EAAEE,OAAO,IAAID,QAAQ,CAACC,OAAO;EACtD,MAAMC,QAAQ,GAAGH,SAAS,EAAEG,QAAQ,IAAIF,QAAQ,CAACE,QAAQ;EACzD,MAAMC,MAAM,GAAGJ,SAAS,EAAEI,MAAM,IAAIH,QAAQ,CAACG,MAAM;;EAEnD;EACA,MAAMC,OAAiB,GAAG,EAAE;EAC5B,IAAI,CAACH,OAAO,EAAEG,OAAO,CAACC,IAAI,CAAC,SAAS,CAAC;EACrC,IAAI,CAACH,QAAQ,EAAEE,OAAO,CAACC,IAAI,CAAC,UAAU,CAAC;EACvC,IAAI,CAACF,MAAM,EAAEC,OAAO,CAACC,IAAI,CAAC,QAAQ,CAAC;EAEnC,IAAID,OAAO,CAACE,MAAM,GAAG,CAAC,EAAE;IACtB,MAAM,IAAIV,WAAW,CACnB,+CAA+CQ,OAAO,CAACG,IAAI,CAAC,IAAI,CAAC,IAAI,GACnE,wEAAwE,EAC1E,uBAAuB,EACvB;MAAEC,aAAa,EAAEJ;IAAQ,CAC3B,CAAC;EACH;EAEA,IAAI;IACF,OAAO,MAAMT,QAAQ,CACnBM,OAAO,EACPC,QAAQ,EACRC,MACF,CAAC;EACH,CAAC,CAAC,OAAOM,GAAG,EAAE;IACZ,MAAM,IAAIb,WAAW,CACnB,sCAAsCa,GAAG,YAAYC,KAAK,GAAGD,GAAG,CAACE,OAAO,GAAGC,MAAM,CAACH,GAAG,CAAC,EAAE,EACxF,kBAAkB,EAClB;MAAEI,KAAK,EAAEJ,GAAG,YAAYC,KAAK,GAAGD,GAAG,CAACE,OAAO,GAAGC,MAAM,CAACH,GAAG;IAAE,CAC5D,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,WAAWA,CAACC,KAA8B,EAAW;EACnE,OAAOA,KAAK,CAACZ,MAAM,YAAYT,SAAS;AAC1C","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Barrel export for built-in Sprinkle actions.
3
+ *
4
+ * Provides a `getBuiltinActions()` factory that returns all 17 built-in actions
5
+ * ready for registration on an ActionRegistry.
6
+ */
7
+
8
+ export { listProfiles, getProfile, setProfile, createProfile, deleteProfile } from "./profile-actions.js";
9
+ export { getSettings, updateSettings } from "./settings-actions.js";
10
+ export { getWalletAddress, getWalletBalance, getWalletUtxos } from "./wallet-actions.js";
11
+ export { signTransaction, submitTransaction, signAndSubmit, decodeTransaction } from "./transaction-actions.js";
12
+ export { mintToken, simpleSend, registerStakeScript } from "./utility-actions.js";
13
+ export { toNativeScript, completeWithScripts } from "./native-script.js";
14
+ export { listAddressbook, getAddressbookEntry, setAddressbookEntry, deleteAddressbookEntry } from "./addressbook-actions.js";
15
+ import { listProfiles, getProfile, setProfile, createProfile, deleteProfile } from "./profile-actions.js";
16
+ import { getSettings, updateSettings } from "./settings-actions.js";
17
+ import { getWalletAddress, getWalletBalance, getWalletUtxos } from "./wallet-actions.js";
18
+ import { signTransaction, submitTransaction, signAndSubmit, decodeTransaction } from "./transaction-actions.js";
19
+ import { mintToken, simpleSend, registerStakeScript } from "./utility-actions.js";
20
+ import { listAddressbook, getAddressbookEntry, setAddressbookEntry, deleteAddressbookEntry } from "./addressbook-actions.js";
21
+
22
+ /**
23
+ * Returns all built-in Sprinkle actions.
24
+ * Register them on your ActionRegistry or pass them to `Sprinkle.run()`.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const sprinkle = new Sprinkle(MySchema, storagePath);
29
+ * for (const action of getBuiltinActions()) {
30
+ * sprinkle.registerAction(action);
31
+ * }
32
+ * ```
33
+ */
34
+ export function getBuiltinActions() {
35
+ return [listProfiles, getProfile, setProfile, createProfile, deleteProfile, getSettings, updateSettings, getWalletAddress, getWalletBalance, getWalletUtxos, signTransaction, submitTransaction, signAndSubmit, decodeTransaction, mintToken, simpleSend, registerStakeScript, listAddressbook, getAddressbookEntry, setAddressbookEntry, deleteAddressbookEntry];
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["listProfiles","getProfile","setProfile","createProfile","deleteProfile","getSettings","updateSettings","getWalletAddress","getWalletBalance","getWalletUtxos","signTransaction","submitTransaction","signAndSubmit","decodeTransaction","mintToken","simpleSend","registerStakeScript","toNativeScript","completeWithScripts","listAddressbook","getAddressbookEntry","setAddressbookEntry","deleteAddressbookEntry","getBuiltinActions"],"sources":["../../../../../src/Sprinkle/actions/builtin/index.ts"],"sourcesContent":["/**\n * Barrel export for built-in Sprinkle actions.\n *\n * Provides a `getBuiltinActions()` factory that returns all 17 built-in actions\n * ready for registration on an ActionRegistry.\n */\n\nimport type { TSchema } from \"@sinclair/typebox\";\nimport type { AnyAction } from \"../types.js\";\n\nexport {\n listProfiles,\n getProfile,\n setProfile,\n createProfile,\n deleteProfile,\n} from \"./profile-actions.js\";\n\nexport { getSettings, updateSettings } from \"./settings-actions.js\";\n\nexport {\n getWalletAddress,\n getWalletBalance,\n getWalletUtxos,\n} from \"./wallet-actions.js\";\n\nexport {\n signTransaction,\n submitTransaction,\n signAndSubmit,\n decodeTransaction,\n} from \"./transaction-actions.js\";\n\nexport {\n mintToken,\n simpleSend,\n registerStakeScript,\n} from \"./utility-actions.js\";\n\nexport {\n toNativeScript,\n completeWithScripts,\n} from \"./native-script.js\";\nexport type { NativeScriptInput } from \"./native-script.js\";\n\nexport {\n listAddressbook,\n getAddressbookEntry,\n setAddressbookEntry,\n deleteAddressbookEntry,\n} from \"./addressbook-actions.js\";\n\nimport {\n listProfiles,\n getProfile,\n setProfile,\n createProfile,\n deleteProfile,\n} from \"./profile-actions.js\";\n\nimport { getSettings, updateSettings } from \"./settings-actions.js\";\n\nimport {\n getWalletAddress,\n getWalletBalance,\n getWalletUtxos,\n} from \"./wallet-actions.js\";\n\nimport {\n signTransaction,\n submitTransaction,\n signAndSubmit,\n decodeTransaction,\n} from \"./transaction-actions.js\";\n\nimport {\n mintToken,\n simpleSend,\n registerStakeScript,\n} from \"./utility-actions.js\";\n\nimport {\n listAddressbook,\n getAddressbookEntry,\n setAddressbookEntry,\n deleteAddressbookEntry,\n} from \"./addressbook-actions.js\";\n\n/**\n * Returns all built-in Sprinkle actions.\n * Register them on your ActionRegistry or pass them to `Sprinkle.run()`.\n *\n * @example\n * ```ts\n * const sprinkle = new Sprinkle(MySchema, storagePath);\n * for (const action of getBuiltinActions()) {\n * sprinkle.registerAction(action);\n * }\n * ```\n */\nexport function getBuiltinActions<S extends TSchema>(): AnyAction<S>[] {\n return [\n listProfiles,\n getProfile,\n setProfile,\n createProfile,\n deleteProfile,\n getSettings,\n updateSettings,\n getWalletAddress,\n getWalletBalance,\n getWalletUtxos,\n signTransaction,\n submitTransaction,\n signAndSubmit,\n decodeTransaction,\n mintToken,\n simpleSend,\n registerStakeScript,\n listAddressbook,\n getAddressbookEntry,\n setAddressbookEntry,\n deleteAddressbookEntry,\n ] as unknown as AnyAction<S>[];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAKA,SACEA,YAAY,EACZC,UAAU,EACVC,UAAU,EACVC,aAAa,EACbC,aAAa,QACR,sBAAsB;AAE7B,SAASC,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;AAEnE,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,QACT,qBAAqB;AAE5B,SACEC,eAAe,EACfC,iBAAiB,EACjBC,aAAa,EACbC,iBAAiB,QACZ,0BAA0B;AAEjC,SACEC,SAAS,EACTC,UAAU,EACVC,mBAAmB,QACd,sBAAsB;AAE7B,SACEC,cAAc,EACdC,mBAAmB,QACd,oBAAoB;AAG3B,SACEC,eAAe,EACfC,mBAAmB,EACnBC,mBAAmB,EACnBC,sBAAsB,QACjB,0BAA0B;AAEjC,SACEtB,YAAY,EACZC,UAAU,EACVC,UAAU,EACVC,aAAa,EACbC,aAAa,QACR,sBAAsB;AAE7B,SAASC,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;AAEnE,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,QACT,qBAAqB;AAE5B,SACEC,eAAe,EACfC,iBAAiB,EACjBC,aAAa,EACbC,iBAAiB,QACZ,0BAA0B;AAEjC,SACEC,SAAS,EACTC,UAAU,EACVC,mBAAmB,QACd,sBAAsB;AAE7B,SACEG,eAAe,EACfC,mBAAmB,EACnBC,mBAAmB,EACnBC,sBAAsB,QACjB,0BAA0B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAsC;EACrE,OAAO,CACLvB,YAAY,EACZC,UAAU,EACVC,UAAU,EACVC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,eAAe,EACfC,iBAAiB,EACjBC,aAAa,EACbC,iBAAiB,EACjBC,SAAS,EACTC,UAAU,EACVC,mBAAmB,EACnBG,eAAe,EACfC,mBAAmB,EACnBC,mBAAmB,EACnBC,sBAAsB,CACvB;AACH","ignoreList":[]}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Native script utilities for Sprinkle actions.
3
+ *
4
+ * Provides conversion from user-friendly input formats (CBOR hex or structured JSON)
5
+ * to Blaze NativeScript objects, and a helper to attach scripts during tx completion.
6
+ */
7
+
8
+ import { Core } from "@blaze-cardano/sdk";
9
+ import { ActionError } from "../types.js";
10
+
11
+ /** Input type: either a CBOR hex string or a MultisigScript JSON structure */
12
+
13
+ /**
14
+ * Converts a MultisigScript JSON structure to a Blaze NativeScript.
15
+ * Handles the recursive structure (AllOf, AnyOf, AtLeast contain nested scripts).
16
+ */
17
+ function multisigToNativeScript(ms) {
18
+ if ("Signature" in ms) {
19
+ const hash = Core.Ed25519KeyHashHex(ms.Signature.key_hash);
20
+ return Core.NativeScript.newScriptPubkey(new Core.ScriptPubkey(hash));
21
+ }
22
+ if ("AllOf" in ms) {
23
+ const scripts = ms.AllOf.scripts.map(multisigToNativeScript);
24
+ return Core.NativeScript.newScriptAll(new Core.ScriptAll(scripts));
25
+ }
26
+ if ("AnyOf" in ms) {
27
+ const scripts = ms.AnyOf.scripts.map(multisigToNativeScript);
28
+ return Core.NativeScript.newScriptAny(new Core.ScriptAny(scripts));
29
+ }
30
+ if ("AtLeast" in ms) {
31
+ const scripts = ms.AtLeast.scripts.map(multisigToNativeScript);
32
+ return Core.NativeScript.newScriptNOfK(new Core.ScriptNOfK(scripts, Number(ms.AtLeast.required)));
33
+ }
34
+ if ("Before" in ms) {
35
+ return Core.NativeScript.newTimelockExpiry(new Core.TimelockExpiry(Core.Slot(Number(ms.Before.time))));
36
+ }
37
+ if ("After" in ms) {
38
+ return Core.NativeScript.newTimelockStart(new Core.TimelockStart(Core.Slot(Number(ms.After.time))));
39
+ }
40
+ if ("Script" in ms) {
41
+ // Script variant references a script by hash — this is a ScriptPubkey
42
+ // but using the script hash directly as a key hash reference
43
+ const hash = Core.Ed25519KeyHashHex(ms.Script.script_hash);
44
+ return Core.NativeScript.newScriptPubkey(new Core.ScriptPubkey(hash));
45
+ }
46
+ throw new ActionError("Unrecognized MultisigScript variant", "INVALID_NATIVE_SCRIPT", {
47
+ input: ms
48
+ });
49
+ }
50
+
51
+ /**
52
+ * Converts a native script input (CBOR hex string or MultisigScript JSON)
53
+ * to a Blaze Script object suitable for `provideScript()`.
54
+ */
55
+ export function toNativeScript(input) {
56
+ if (typeof input === "string") {
57
+ try {
58
+ const nativeScript = Core.NativeScript.fromCbor(Core.HexBlob(input));
59
+ return Core.Script.newNativeScript(nativeScript);
60
+ } catch (err) {
61
+ throw new ActionError(`Invalid native script CBOR: ${err instanceof Error ? err.message : String(err)}`, "INVALID_NATIVE_SCRIPT", {
62
+ error: err instanceof Error ? err.message : String(err)
63
+ });
64
+ }
65
+ }
66
+ try {
67
+ const nativeScript = multisigToNativeScript(input);
68
+ return Core.Script.newNativeScript(nativeScript);
69
+ } catch (err) {
70
+ if (err instanceof ActionError) throw err;
71
+ throw new ActionError(`Failed to convert MultisigScript to native script: ${err instanceof Error ? err.message : String(err)}`, "INVALID_NATIVE_SCRIPT", {
72
+ error: err instanceof Error ? err.message : String(err)
73
+ });
74
+ }
75
+ }
76
+
77
+ /** Regex to extract a script hash from Blaze's "Could not resolve script hash" error */
78
+ const MISSING_SCRIPT_HASH_RE = /complete: Could not resolve script hash[: ]*([0-9a-fA-F]+)/;
79
+
80
+ /**
81
+ * Builds a hash → Script lookup from the addressbook in the sprinkle context.
82
+ * Returns an empty map if there's no addressbook.
83
+ */
84
+ function buildAddressbookIndex(addressbook) {
85
+ const index = new Map();
86
+ if (!addressbook) return index;
87
+ for (const [, ms] of Object.entries(addressbook)) {
88
+ try {
89
+ const script = toNativeScript(ms);
90
+ index.set(script.hash(), script);
91
+ } catch {
92
+ // Skip invalid addressbook entries
93
+ }
94
+ }
95
+ return index;
96
+ }
97
+
98
+ /**
99
+ * Attaches optional native scripts to a transaction builder and completes it.
100
+ *
101
+ * If completion fails because Blaze cannot resolve a required native script hash,
102
+ * and a context with an addressbook is provided, it will look up the missing script
103
+ * by hash in the addressbook and retry once.
104
+ */
105
+ export async function completeWithScripts(txBuilder, nativeScripts, context) {
106
+ if (nativeScripts?.length) {
107
+ for (const input of nativeScripts) {
108
+ txBuilder.provideScript(toNativeScript(input));
109
+ }
110
+ }
111
+ try {
112
+ return await txBuilder.complete();
113
+ } catch (err) {
114
+ const message = err instanceof Error ? err.message : String(err);
115
+ const match = message.match(MISSING_SCRIPT_HASH_RE);
116
+ if (!match || !context?.sprinkle?.addressbook) {
117
+ throw err;
118
+ }
119
+
120
+ // Build hash index from addressbook and try to resolve the missing script
121
+ const addressbookIndex = buildAddressbookIndex(context.sprinkle.addressbook);
122
+ const missingHash = match[1];
123
+ const script = addressbookIndex.get(missingHash);
124
+ if (!script) {
125
+ throw err;
126
+ }
127
+
128
+ // Attach the found script and retry
129
+ txBuilder.provideScript(script);
130
+ return txBuilder.complete();
131
+ }
132
+ }
133
+ //# sourceMappingURL=native-script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-script.js","names":["Core","ActionError","multisigToNativeScript","ms","hash","Ed25519KeyHashHex","Signature","key_hash","NativeScript","newScriptPubkey","ScriptPubkey","scripts","AllOf","map","newScriptAll","ScriptAll","AnyOf","newScriptAny","ScriptAny","AtLeast","newScriptNOfK","ScriptNOfK","Number","required","newTimelockExpiry","TimelockExpiry","Slot","Before","time","newTimelockStart","TimelockStart","After","Script","script_hash","input","toNativeScript","nativeScript","fromCbor","HexBlob","newNativeScript","err","Error","message","String","error","MISSING_SCRIPT_HASH_RE","buildAddressbookIndex","addressbook","index","Map","Object","entries","script","set","completeWithScripts","txBuilder","nativeScripts","context","length","provideScript","complete","match","sprinkle","addressbookIndex","missingHash","get"],"sources":["../../../../../src/Sprinkle/actions/builtin/native-script.ts"],"sourcesContent":["/**\n * Native script utilities for Sprinkle actions.\n *\n * Provides conversion from user-friendly input formats (CBOR hex or structured JSON)\n * to Blaze NativeScript objects, and a helper to attach scripts during tx completion.\n */\n\nimport { Core } from \"@blaze-cardano/sdk\";\nimport type { TxBuilder } from \"@blaze-cardano/tx\";\nimport type { TSchema } from \"@sinclair/typebox\";\nimport type { TMultisigScript } from \"../../schemas.js\";\nimport { ActionError } from \"../types.js\";\nimport type { IActionContext } from \"../types.js\";\n\n/** Input type: either a CBOR hex string or a MultisigScript JSON structure */\nexport type NativeScriptInput = string | TMultisigScript;\n\n/**\n * Converts a MultisigScript JSON structure to a Blaze NativeScript.\n * Handles the recursive structure (AllOf, AnyOf, AtLeast contain nested scripts).\n */\nfunction multisigToNativeScript(ms: TMultisigScript): Core.NativeScript {\n if (\"Signature\" in ms) {\n const hash = Core.Ed25519KeyHashHex(ms.Signature.key_hash);\n return Core.NativeScript.newScriptPubkey(new Core.ScriptPubkey(hash));\n }\n if (\"AllOf\" in ms) {\n const scripts = ms.AllOf.scripts.map(multisigToNativeScript);\n return Core.NativeScript.newScriptAll(new Core.ScriptAll(scripts));\n }\n if (\"AnyOf\" in ms) {\n const scripts = ms.AnyOf.scripts.map(multisigToNativeScript);\n return Core.NativeScript.newScriptAny(new Core.ScriptAny(scripts));\n }\n if (\"AtLeast\" in ms) {\n const scripts = ms.AtLeast.scripts.map(multisigToNativeScript);\n return Core.NativeScript.newScriptNOfK(\n new Core.ScriptNOfK(scripts, Number(ms.AtLeast.required)),\n );\n }\n if (\"Before\" in ms) {\n return Core.NativeScript.newTimelockExpiry(\n new Core.TimelockExpiry(Core.Slot(Number(ms.Before.time))),\n );\n }\n if (\"After\" in ms) {\n return Core.NativeScript.newTimelockStart(\n new Core.TimelockStart(Core.Slot(Number(ms.After.time))),\n );\n }\n if (\"Script\" in ms) {\n // Script variant references a script by hash — this is a ScriptPubkey\n // but using the script hash directly as a key hash reference\n const hash = Core.Ed25519KeyHashHex(ms.Script.script_hash);\n return Core.NativeScript.newScriptPubkey(new Core.ScriptPubkey(hash));\n }\n\n throw new ActionError(\n \"Unrecognized MultisigScript variant\",\n \"INVALID_NATIVE_SCRIPT\",\n { input: ms },\n );\n}\n\n/**\n * Converts a native script input (CBOR hex string or MultisigScript JSON)\n * to a Blaze Script object suitable for `provideScript()`.\n */\nexport function toNativeScript(input: NativeScriptInput): Core.Script {\n if (typeof input === \"string\") {\n try {\n const nativeScript = Core.NativeScript.fromCbor(\n Core.HexBlob(input),\n );\n return Core.Script.newNativeScript(nativeScript);\n } catch (err) {\n throw new ActionError(\n `Invalid native script CBOR: ${err instanceof Error ? err.message : String(err)}`,\n \"INVALID_NATIVE_SCRIPT\",\n { error: err instanceof Error ? err.message : String(err) },\n );\n }\n }\n\n try {\n const nativeScript = multisigToNativeScript(input);\n return Core.Script.newNativeScript(nativeScript);\n } catch (err) {\n if (err instanceof ActionError) throw err;\n throw new ActionError(\n `Failed to convert MultisigScript to native script: ${err instanceof Error ? err.message : String(err)}`,\n \"INVALID_NATIVE_SCRIPT\",\n { error: err instanceof Error ? err.message : String(err) },\n );\n }\n}\n\n/** Regex to extract a script hash from Blaze's \"Could not resolve script hash\" error */\nconst MISSING_SCRIPT_HASH_RE =\n /complete: Could not resolve script hash[: ]*([0-9a-fA-F]+)/;\n\n/**\n * Builds a hash → Script lookup from the addressbook in the sprinkle context.\n * Returns an empty map if there's no addressbook.\n */\nfunction buildAddressbookIndex(\n addressbook: Record<string, TMultisigScript> | undefined,\n): Map<string, Core.Script> {\n const index = new Map<string, Core.Script>();\n if (!addressbook) return index;\n for (const [, ms] of Object.entries(addressbook)) {\n try {\n const script = toNativeScript(ms);\n index.set(script.hash(), script);\n } catch {\n // Skip invalid addressbook entries\n }\n }\n return index;\n}\n\n/**\n * Attaches optional native scripts to a transaction builder and completes it.\n *\n * If completion fails because Blaze cannot resolve a required native script hash,\n * and a context with an addressbook is provided, it will look up the missing script\n * by hash in the addressbook and retry once.\n */\nexport async function completeWithScripts<S extends TSchema>(\n txBuilder: TxBuilder,\n nativeScripts?: NativeScriptInput[],\n context?: IActionContext<S>,\n): Promise<Core.Transaction> {\n if (nativeScripts?.length) {\n for (const input of nativeScripts) {\n txBuilder.provideScript(toNativeScript(input));\n }\n }\n\n try {\n return await txBuilder.complete();\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n const match = message.match(MISSING_SCRIPT_HASH_RE);\n\n if (!match || !context?.sprinkle?.addressbook) {\n throw err;\n }\n\n // Build hash index from addressbook and try to resolve the missing script\n const addressbookIndex = buildAddressbookIndex(\n context.sprinkle.addressbook,\n );\n const missingHash = match[1];\n const script = addressbookIndex.get(missingHash);\n\n if (!script) {\n throw err;\n }\n\n // Attach the found script and retry\n txBuilder.provideScript(script);\n return txBuilder.complete();\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,oBAAoB;AAIzC,SAASC,WAAW,QAAQ,aAAa;;AAGzC;;AAGA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAACC,EAAmB,EAAqB;EACtE,IAAI,WAAW,IAAIA,EAAE,EAAE;IACrB,MAAMC,IAAI,GAAGJ,IAAI,CAACK,iBAAiB,CAACF,EAAE,CAACG,SAAS,CAACC,QAAQ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