@kontor/kontor-sdk 1.0.0-alpha.13 → 1.0.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/dist/cjs/sdk/actions/kontor/public/{build-compose-call.js → build-compose-query.js} +8 -9
  2. package/dist/cjs/sdk/actions/kontor/public/build-compose-query.js.map +1 -0
  3. package/dist/cjs/sdk/actions/kontor/public/{build-instruction.js → build-instruction-query.js} +11 -16
  4. package/dist/cjs/sdk/actions/kontor/public/build-instruction-query.js.map +1 -0
  5. package/dist/cjs/sdk/actions/kontor/public/{call-proc.js → call-compose.js} +7 -9
  6. package/dist/cjs/sdk/actions/kontor/public/call-compose.js.map +1 -0
  7. package/dist/cjs/sdk/actions/kontor/public/proc-contract.js +8 -5
  8. package/dist/cjs/sdk/actions/kontor/public/proc-contract.js.map +1 -1
  9. package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js +1 -1
  10. package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  11. package/dist/cjs/sdk/clients/decorators/kontor/public.js +6 -6
  12. package/dist/cjs/sdk/clients/decorators/kontor/public.js.map +1 -1
  13. package/dist/cjs/sdk/contracts/wits.js.map +1 -1
  14. package/dist/cjs/sdk/types/kontor.js +28 -0
  15. package/dist/cjs/sdk/types/kontor.js.map +1 -1
  16. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  17. package/dist/{src/sdk/actions/kontor/public/build-compose-call.js → esm/sdk/actions/kontor/public/build-compose-query.js} +2 -2
  18. package/dist/esm/sdk/actions/kontor/public/build-compose-query.js.map +1 -0
  19. package/dist/{src/sdk/actions/kontor/public/build-instruction.js → esm/sdk/actions/kontor/public/build-instruction-query.js} +1 -2
  20. package/dist/esm/sdk/actions/kontor/public/build-instruction-query.js.map +1 -0
  21. package/dist/esm/sdk/actions/kontor/public/{call-proc.js → call-compose.js} +7 -8
  22. package/dist/esm/sdk/actions/kontor/public/call-compose.js.map +1 -0
  23. package/dist/esm/sdk/actions/kontor/public/proc-contract.js +8 -5
  24. package/dist/esm/sdk/actions/kontor/public/proc-contract.js.map +1 -1
  25. package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js +4 -6
  26. package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  27. package/dist/esm/sdk/clients/decorators/kontor/public.js +6 -6
  28. package/dist/esm/sdk/clients/decorators/kontor/public.js.map +1 -1
  29. package/dist/esm/sdk/contracts/wits.js.map +1 -1
  30. package/dist/esm/sdk/types/kontor.js +27 -1
  31. package/dist/esm/sdk/types/kontor.js.map +1 -1
  32. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  33. package/dist/src/exports/index.test.js +10 -0
  34. package/dist/src/exports/index.test.js.map +1 -0
  35. package/dist/src/sdk/accounts/hd-key-to-account.js +20 -0
  36. package/dist/src/sdk/accounts/hd-key-to-account.js.map +1 -0
  37. package/dist/src/sdk/accounts/mnemonic-to-account.js +16 -0
  38. package/dist/src/sdk/accounts/mnemonic-to-account.js.map +1 -0
  39. package/dist/src/sdk/accounts/mnemonic-to-account.test.js +96 -0
  40. package/dist/src/sdk/accounts/mnemonic-to-account.test.js.map +1 -0
  41. package/dist/src/sdk/accounts/to-local-account.js +28 -0
  42. package/dist/src/sdk/accounts/to-local-account.js.map +1 -0
  43. package/dist/src/sdk/accounts/types.js +2 -0
  44. package/dist/src/sdk/accounts/types.js.map +1 -0
  45. package/dist/src/sdk/accounts/utils/parse-account.js +10 -0
  46. package/dist/src/sdk/accounts/utils/parse-account.js.map +1 -0
  47. package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js +14 -0
  48. package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js.map +1 -0
  49. package/dist/src/sdk/accounts/utils/sign-psbt.js +17 -0
  50. package/dist/src/sdk/accounts/utils/sign-psbt.js.map +1 -0
  51. package/dist/src/sdk/actions/kontor/wallet/sign-commit.js +34 -0
  52. package/dist/src/sdk/actions/kontor/wallet/sign-commit.js.map +1 -0
  53. package/dist/src/sdk/actions/public/send-raw-transaction.js +7 -0
  54. package/dist/src/sdk/actions/public/send-raw-transaction.js.map +1 -0
  55. package/dist/src/sdk/actions/public/test-mempool-accept.js +20 -0
  56. package/dist/src/sdk/actions/public/test-mempool-accept.js.map +1 -0
  57. package/dist/src/sdk/chains/definitions/index.js +2 -0
  58. package/dist/src/sdk/chains/definitions/index.js.map +1 -0
  59. package/dist/src/sdk/chains/definitions/signet.js +36 -0
  60. package/dist/src/sdk/chains/definitions/signet.js.map +1 -0
  61. package/dist/src/sdk/clients/base/create-rpc-client.test.js +145 -0
  62. package/dist/src/sdk/clients/base/create-rpc-client.test.js.map +1 -0
  63. package/dist/src/sdk/clients/create-public-client.test.js +113 -0
  64. package/dist/src/sdk/clients/create-public-client.test.js.map +1 -0
  65. package/dist/src/sdk/clients/decorators/kontor/wallet.js +13 -0
  66. package/dist/src/sdk/clients/decorators/kontor/wallet.js.map +1 -0
  67. package/dist/src/sdk/clients/decorators/public.js +9 -0
  68. package/dist/src/sdk/clients/decorators/public.js.map +1 -0
  69. package/dist/src/sdk/clients/decorators/wallet.js +9 -0
  70. package/dist/src/sdk/clients/decorators/wallet.js.map +1 -0
  71. package/dist/src/sdk/clients/kontor/create-public-client.test.js +44 -0
  72. package/dist/src/sdk/clients/kontor/create-public-client.test.js.map +1 -0
  73. package/dist/src/sdk/clients/kontor/create-wallet-client.js +14 -0
  74. package/dist/src/sdk/clients/kontor/create-wallet-client.js.map +1 -0
  75. package/dist/src/sdk/clients/transports/create-http-transport.js +25 -0
  76. package/dist/src/sdk/clients/transports/create-http-transport.js.map +1 -0
  77. package/dist/src/sdk/clients/transports/create-rpc-transport.test.js +58 -0
  78. package/dist/src/sdk/clients/transports/create-rpc-transport.test.js.map +1 -0
  79. package/dist/src/sdk/clients/transports/custom.js +14 -0
  80. package/dist/src/sdk/clients/transports/custom.js.map +1 -0
  81. package/dist/src/sdk/clients/transports/http-rpc.js +84 -0
  82. package/dist/src/sdk/clients/transports/http-rpc.js.map +1 -0
  83. package/dist/src/sdk/clients/transports/http-rpc.test.js +147 -0
  84. package/dist/src/sdk/clients/transports/http-rpc.test.js.map +1 -0
  85. package/dist/src/sdk/clients/transports/http.js +45 -0
  86. package/dist/src/sdk/clients/transports/http.js.map +1 -0
  87. package/dist/src/sdk/errors/address.js +13 -0
  88. package/dist/src/sdk/errors/address.js.map +1 -0
  89. package/dist/src/sdk/errors/base.js +92 -0
  90. package/dist/src/sdk/errors/base.js.map +1 -0
  91. package/dist/src/sdk/errors/request.js +100 -0
  92. package/dist/src/sdk/errors/request.js.map +1 -0
  93. package/dist/src/sdk/errors/rpc.js +30 -0
  94. package/dist/src/sdk/errors/rpc.js.map +1 -0
  95. package/dist/src/sdk/errors/transport.js +10 -0
  96. package/dist/src/sdk/errors/transport.js.map +1 -0
  97. package/dist/src/sdk/errors/utils.js +2 -0
  98. package/dist/src/sdk/errors/utils.js.map +1 -0
  99. package/dist/src/sdk/errors/version.js +2 -0
  100. package/dist/src/sdk/errors/version.js.map +1 -0
  101. package/dist/src/sdk/errors/wit.js +19 -0
  102. package/dist/src/sdk/errors/wit.js.map +1 -0
  103. package/dist/src/sdk/types/account.js +2 -0
  104. package/dist/src/sdk/types/account.js.map +1 -0
  105. package/dist/src/sdk/types/btc-rpc.js +2 -0
  106. package/dist/src/sdk/types/btc-rpc.js.map +1 -0
  107. package/dist/src/sdk/types/contract.test-d.js +35 -0
  108. package/dist/src/sdk/types/contract.test-d.js.map +1 -0
  109. package/dist/src/sdk/types/http-schema.test-d.js +133 -0
  110. package/dist/src/sdk/types/http-schema.test-d.js.map +1 -0
  111. package/dist/src/sdk/types/misc.js +2 -0
  112. package/dist/src/sdk/types/misc.js.map +1 -0
  113. package/dist/src/sdk/types/rpc.js +19 -0
  114. package/dist/src/sdk/types/rpc.js.map +1 -0
  115. package/dist/src/sdk/types/utils.js +2 -0
  116. package/dist/src/sdk/types/utils.js.map +1 -0
  117. package/dist/src/sdk/types/wbip001.js +3 -0
  118. package/dist/src/sdk/types/wbip001.js.map +1 -0
  119. package/dist/src/sdk/utils/build-http-request.js +55 -0
  120. package/dist/src/sdk/utils/build-http-request.js.map +1 -0
  121. package/dist/src/sdk/utils/build-request.js +35 -0
  122. package/dist/src/sdk/utils/build-request.js.map +1 -0
  123. package/dist/src/sdk/utils/build-rpc-request.js +84 -0
  124. package/dist/src/sdk/utils/build-rpc-request.js.map +1 -0
  125. package/dist/src/sdk/utils/encoding/to-hex.js +23 -0
  126. package/dist/src/sdk/utils/encoding/to-hex.js.map +1 -0
  127. package/dist/src/sdk/utils/get-action.js +27 -0
  128. package/dist/src/sdk/utils/get-action.js.map +1 -0
  129. package/dist/src/sdk/utils/http.js +137 -0
  130. package/dist/src/sdk/utils/http.js.map +1 -0
  131. package/dist/src/sdk/utils/lru.js +35 -0
  132. package/dist/src/sdk/utils/lru.js.map +1 -0
  133. package/dist/src/sdk/utils/promise/create-batch-scheduler.js +49 -0
  134. package/dist/src/sdk/utils/promise/create-batch-scheduler.js.map +1 -0
  135. package/dist/src/sdk/utils/promise/with-dedupe.js +14 -0
  136. package/dist/src/sdk/utils/promise/with-dedupe.js.map +1 -0
  137. package/dist/src/sdk/utils/promise/with-resolvers.js +10 -0
  138. package/dist/src/sdk/utils/promise/with-resolvers.js.map +1 -0
  139. package/dist/src/sdk/utils/promise/with-retry.js +25 -0
  140. package/dist/src/sdk/utils/promise/with-retry.js.map +1 -0
  141. package/dist/src/sdk/utils/promise/with-timeout.js +30 -0
  142. package/dist/src/sdk/utils/promise/with-timeout.js.map +1 -0
  143. package/dist/src/sdk/utils/rpc/http.js +86 -0
  144. package/dist/src/sdk/utils/rpc/http.js.map +1 -0
  145. package/dist/src/sdk/utils/rpc/id.js +13 -0
  146. package/dist/src/sdk/utils/rpc/id.js.map +1 -0
  147. package/dist/src/sdk/utils/stringify.js +5 -0
  148. package/dist/src/sdk/utils/stringify.js.map +1 -0
  149. package/dist/src/sdk/utils/uid.js +14 -0
  150. package/dist/src/sdk/utils/uid.js.map +1 -0
  151. package/dist/src/sdk/utils/wait.js +4 -0
  152. package/dist/src/sdk/utils/wait.js.map +1 -0
  153. package/dist/src/sdk/utils/wit/codecs/decimal.js +165 -0
  154. package/dist/src/sdk/utils/wit/codecs/decimal.js.map +1 -0
  155. package/dist/src/sdk/utils/wit/codecs/enum.js +104 -0
  156. package/dist/src/sdk/utils/wit/codecs/enum.js.map +1 -0
  157. package/dist/src/sdk/utils/wit/codecs/integer.js +167 -0
  158. package/dist/src/sdk/utils/wit/codecs/integer.js.map +1 -0
  159. package/dist/src/sdk/utils/wit/codecs/list.js +117 -0
  160. package/dist/src/sdk/utils/wit/codecs/list.js.map +1 -0
  161. package/dist/src/sdk/utils/wit/codecs/option.js +91 -0
  162. package/dist/src/sdk/utils/wit/codecs/option.js.map +1 -0
  163. package/dist/src/sdk/utils/wit/codecs/string.js +27 -0
  164. package/dist/src/sdk/utils/wit/codecs/string.js.map +1 -0
  165. package/dist/src/sdk/utils/wit/codecs/types.js +45 -0
  166. package/dist/src/sdk/utils/wit/codecs/types.js.map +1 -0
  167. package/dist/src/sdk/utils/wit/codecs/unit.js +22 -0
  168. package/dist/src/sdk/utils/wit/codecs/unit.js.map +1 -0
  169. package/dist/src/sdk/utils/wit/decode-function-result.js +36 -0
  170. package/dist/src/sdk/utils/wit/decode-function-result.js.map +1 -0
  171. package/dist/src/sdk/utils/wit/decode-wit-parameter.js +286 -0
  172. package/dist/src/sdk/utils/wit/decode-wit-parameter.js.map +1 -0
  173. package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js +75 -0
  174. package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js.map +1 -0
  175. package/dist/src/sdk/utils/wit/encode-function-data.js +17 -0
  176. package/dist/src/sdk/utils/wit/encode-function-data.js.map +1 -0
  177. package/dist/src/sdk/utils/wit/encode-function-data.test-d.js +21 -0
  178. package/dist/src/sdk/utils/wit/encode-function-data.test-d.js.map +1 -0
  179. package/dist/src/sdk/utils/wit/encode-function-data.test.js +91 -0
  180. package/dist/src/sdk/utils/wit/encode-function-data.test.js.map +1 -0
  181. package/dist/src/sdk/utils/wit/encode-wit-parameters.js +250 -0
  182. package/dist/src/sdk/utils/wit/encode-wit-parameters.js.map +1 -0
  183. package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js +62 -0
  184. package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js.map +1 -0
  185. package/dist/src/sdk/utils/wit/get-wit-item.js +15 -0
  186. package/dist/src/sdk/utils/wit/get-wit-item.js.map +1 -0
  187. package/dist/src/sdk/utils/wit/get-wit-item.test.js +118 -0
  188. package/dist/src/sdk/utils/wit/get-wit-item.test.js.map +1 -0
  189. package/dist/src/sdk/utils/wit/prepare-encode-function-data.js +24 -0
  190. package/dist/src/sdk/utils/wit/prepare-encode-function-data.js.map +1 -0
  191. package/dist/src/wit/error.js +59 -0
  192. package/dist/src/wit/error.js.map +1 -0
  193. package/dist/src/wit/narrow.js +14 -0
  194. package/dist/src/wit/narrow.js.map +1 -0
  195. package/dist/src/wit/regex.js +6 -0
  196. package/dist/src/wit/regex.js.map +1 -0
  197. package/dist/src/wit/register.js +2 -0
  198. package/dist/src/wit/register.js.map +1 -0
  199. package/dist/src/wit/type-utils.js +2 -0
  200. package/dist/src/wit/type-utils.js.map +1 -0
  201. package/dist/src/wit/utils.js +2 -0
  202. package/dist/src/wit/utils.js.map +1 -0
  203. package/dist/src/wit/utils.test-d.js +16 -0
  204. package/dist/src/wit/utils.test-d.js.map +1 -0
  205. package/dist/src/wit/version.js +2 -0
  206. package/dist/src/wit/version.js.map +1 -0
  207. package/dist/src/wit/wit-parser/core/errors/signature.js +42 -0
  208. package/dist/src/wit/wit-parser/core/errors/signature.js.map +1 -0
  209. package/dist/src/wit/wit-parser/core/errors/splitParameters.js +18 -0
  210. package/dist/src/wit/wit-parser/core/errors/splitParameters.js.map +1 -0
  211. package/dist/src/wit/wit-parser/core/errors/wit-parameter.js +29 -0
  212. package/dist/src/wit/wit-parser/core/errors/wit-parameter.js.map +1 -0
  213. package/dist/src/wit/wit-parser/core/records.js +73 -0
  214. package/dist/src/wit/wit-parser/core/records.js.map +1 -0
  215. package/dist/src/wit/wit-parser/core/records.test.js +53 -0
  216. package/dist/src/wit/wit-parser/core/records.test.js.map +1 -0
  217. package/dist/src/wit/wit-parser/core/signatures.js +32 -0
  218. package/dist/src/wit/wit-parser/core/signatures.js.map +1 -0
  219. package/dist/src/wit/wit-parser/core/signatures.test.js +54 -0
  220. package/dist/src/wit/wit-parser/core/signatures.test.js.map +1 -0
  221. package/dist/src/wit/wit-parser/core/types/records.js +2 -0
  222. package/dist/src/wit/wit-parser/core/types/records.js.map +1 -0
  223. package/dist/src/wit/wit-parser/core/types/records.test-d.js +19 -0
  224. package/dist/src/wit/wit-parser/core/types/records.test-d.js.map +1 -0
  225. package/dist/src/wit/wit-parser/core/types/signatures.js +3 -0
  226. package/dist/src/wit/wit-parser/core/types/signatures.js.map +1 -0
  227. package/dist/src/wit/wit-parser/core/types/signatures.test-d.js +18 -0
  228. package/dist/src/wit/wit-parser/core/types/signatures.test-d.js.map +1 -0
  229. package/dist/src/wit/wit-parser/core/types/utils.js +2 -0
  230. package/dist/src/wit/wit-parser/core/types/utils.js.map +1 -0
  231. package/dist/src/wit/wit-parser/core/types/utils.test-d.js +138 -0
  232. package/dist/src/wit/wit-parser/core/types/utils.test-d.js.map +1 -0
  233. package/dist/src/wit/wit-parser/core/utils.js +212 -0
  234. package/dist/src/wit/wit-parser/core/utils.js.map +1 -0
  235. package/dist/src/wit/wit-parser/core/utils.test.js +302 -0
  236. package/dist/src/wit/wit-parser/core/utils.test.js.map +1 -0
  237. package/dist/src/wit/wit-parser/parse-wit-parameter.js +26 -0
  238. package/dist/src/wit/wit-parser/parse-wit-parameter.js.map +1 -0
  239. package/dist/src/wit/wit-parser/parse-wit-parameter.test.js +77 -0
  240. package/dist/src/wit/wit-parser/parse-wit-parameter.test.js.map +1 -0
  241. package/dist/src/wit/wit-parser/parse-wit.js +16 -0
  242. package/dist/src/wit/wit-parser/parse-wit.js.map +1 -0
  243. package/dist/src/wit/wit-parser/parse-wit.test.js +78 -0
  244. package/dist/src/wit/wit-parser/parse-wit.test.js.map +1 -0
  245. package/dist/src/wit/wit.js +2 -0
  246. package/dist/src/wit/wit.js.map +1 -0
  247. package/dist/src/wit/wit.test.js +6 -0
  248. package/dist/src/wit/wit.test.js.map +1 -0
  249. package/dist/test/globalSetup.js +14 -0
  250. package/dist/test/globalSetup.js.map +1 -0
  251. package/dist/test/src/wits.js +21 -0
  252. package/dist/test/src/wits.js.map +1 -0
  253. package/dist/tsconfig.tsbuildinfo +1 -1
  254. package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts +16 -0
  255. package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts.map +1 -0
  256. package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts +25 -0
  257. package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts.map +1 -0
  258. package/dist/types/sdk/actions/kontor/public/call-compose.d.ts +20 -0
  259. package/dist/types/sdk/actions/kontor/public/call-compose.d.ts.map +1 -0
  260. package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts +2 -2
  261. package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts.map +1 -1
  262. package/dist/types/sdk/actions/kontor/wallet/sign-reveal.d.ts.map +1 -1
  263. package/dist/types/sdk/clients/decorators/kontor/public.d.ts +6 -6
  264. package/dist/types/sdk/clients/decorators/kontor/public.d.ts.map +1 -1
  265. package/dist/types/sdk/contracts/wits.d.ts +6 -5
  266. package/dist/types/sdk/contracts/wits.d.ts.map +1 -1
  267. package/dist/types/sdk/types/kontor.d.ts +15 -1
  268. package/dist/types/sdk/types/kontor.d.ts.map +1 -1
  269. package/package.json +1 -1
  270. package/src/sdk/actions/kontor/public/build-compose-query.ts +1 -1
  271. package/dist/cjs/sdk/actions/kontor/public/build-compose-call.js.map +0 -1
  272. package/dist/cjs/sdk/actions/kontor/public/build-instruction.js.map +0 -1
  273. package/dist/cjs/sdk/actions/kontor/public/call-proc.js.map +0 -1
  274. package/dist/esm/sdk/actions/kontor/public/build-compose-call.js +0 -31
  275. package/dist/esm/sdk/actions/kontor/public/build-compose-call.js.map +0 -1
  276. package/dist/esm/sdk/actions/kontor/public/build-instruction.js +0 -49
  277. package/dist/esm/sdk/actions/kontor/public/build-instruction.js.map +0 -1
  278. package/dist/esm/sdk/actions/kontor/public/call-proc.js.map +0 -1
  279. package/dist/src/sdk/actions/kontor/public/build-compose-call.js.map +0 -1
  280. package/dist/src/sdk/actions/kontor/public/build-instruction.js.map +0 -1
  281. package/dist/src/sdk/actions/kontor/public/call-proc.js +0 -43
  282. package/dist/src/sdk/actions/kontor/public/call-proc.js.map +0 -1
  283. package/dist/types/sdk/actions/kontor/public/build-compose-call.d.ts +0 -21
  284. package/dist/types/sdk/actions/kontor/public/build-compose-call.d.ts.map +0 -1
  285. package/dist/types/sdk/actions/kontor/public/build-instruction.d.ts +0 -17
  286. package/dist/types/sdk/actions/kontor/public/build-instruction.d.ts.map +0 -1
  287. package/dist/types/sdk/actions/kontor/public/call-proc.d.ts +0 -23
  288. package/dist/types/sdk/actions/kontor/public/call-proc.d.ts.map +0 -1
@@ -0,0 +1,10 @@
1
+ import { expect, it } from "vitest";
2
+ import * as Exports from "./index.js";
3
+ it("exports", () => {
4
+ expect(Object.keys(Exports)).toMatchInlineSnapshot(`
5
+ [
6
+ "one",
7
+ ]
8
+ `);
9
+ });
10
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/exports/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACjB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;GAIlD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { toHex } from "../utils/encoding/to-hex.js";
2
+ import { privateKeyToAccount, } from "./private-key-to-account.js";
3
+ /**
4
+ * @description Creates an Account from a HD Key.
5
+ *
6
+ * @returns A HD Account.
7
+ */
8
+ export function hdKeyToAccount(hdKey_, { coinType = 0, // 0 = mainnet, 1 =
9
+ accountIndex = 0, addressIndex = 0, changeIndex = 0, path, ...options } = {}) {
10
+ // https://bips.dev/86/
11
+ const hdKey = hdKey_.derive(path ||
12
+ `m/86'/${coinType}'/${accountIndex}'/${changeIndex}/${addressIndex}`);
13
+ const account = privateKeyToAccount(toHex(hdKey.privateKey), options);
14
+ return {
15
+ ...account,
16
+ getHdKey: () => hdKey,
17
+ source: "hd",
18
+ };
19
+ }
20
+ //# sourceMappingURL=hd-key-to-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hd-key-to-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/hd-key-to-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAGL,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAWrC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAa,EACb,EACE,QAAQ,GAAG,CAAC,EAAE,mBAAmB;AACjC,YAAY,GAAG,CAAC,EAChB,YAAY,GAAG,CAAC,EAChB,WAAW,GAAG,CAAC,EACf,IAAI,EACJ,GAAG,OAAO,KACe,EAAE;IAE7B,uBAAuB;IACvB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,IAAI;QACF,SAAS,QAAQ,KAAK,YAAY,KAAK,WAAW,IAAI,YAAY,EAAE,CACvE,CAAC;IACF,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,UAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IACvE,OAAO;QACL,GAAG,OAAO;QACV,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;QACrB,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { HDKey } from "@scure/bip32";
2
+ import { mnemonicToSeedSync } from "@scure/bip39";
3
+ import { hdKeyToAccount, } from "./hd-key-to-account.js";
4
+ /**
5
+ * @description Creates an Account from a mnemonic phrase.
6
+ *
7
+ * @returns A HD Account.
8
+ */
9
+ export function mnemonicToAccount(mnemonic, _opts = {}) {
10
+ const seed = mnemonicToSeedSync(mnemonic);
11
+ return hdKeyToAccount(HDKey.fromMasterSeed(seed), {
12
+ // TODO: this should not be hardcoded
13
+ coinType: 1,
14
+ });
15
+ }
16
+ //# sourceMappingURL=mnemonic-to-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mnemonic-to-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/mnemonic-to-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAGL,cAAc,GACf,MAAM,wBAAwB,CAAC;AAOhC;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,QAAkC,EAAE;IAEpC,MAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;QAChD,qCAAqC;QACrC,QAAQ,EAAE,CAAC;KACZ,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { expect, test } from "vitest";
2
+ import { mnemonicToAccount } from "./mnemonic-to-account.js";
3
+ const mnemonic = "test test test test test test test test test test test junk";
4
+ // TODO: should take a network argument
5
+ test("default", () => {
6
+ expect(mnemonicToAccount(mnemonic)).toMatchInlineSnapshot(`
7
+ {
8
+ "address": "tb1pfewlxm8meyyvgjydfu7v8j4ej64symj6ut8sf66h9germp94qgzsgnnjhk",
9
+ "getHdKey": [Function],
10
+ "signMessage": [Function],
11
+ "signPsbt": [Function],
12
+ "source": "hd",
13
+ "type": "local",
14
+ "xOnlyPubKey": "8c7fc6552af4384a13791e63bac79ff2bcfeedf143a88d6dc4b6080a8829cdc1",
15
+ }
16
+ `);
17
+ });
18
+ // describe('args: addressIndex', () => {
19
+ // Array.from({ length: 10 }).forEach((_, index) => {
20
+ // test(`addressIndex: ${index}`, () => {
21
+ // const account = mnemonicToAccount(mnemonic, {
22
+ // addressIndex: index,
23
+ // })
24
+ // expect(account.address).toEqual(getAddress(accounts[index].address))
25
+ // })
26
+ // })
27
+ // })
28
+ //
29
+ // describe('args: path', () => {
30
+ // Array.from({ length: 10 }).forEach((_, index) => {
31
+ // test(`path: m/44'/60'/0'/0/${index}`, () => {
32
+ // const account = mnemonicToAccount(mnemonic, {
33
+ // path: `m/44'/60'/0'/0/${index}`,
34
+ // })
35
+ // expect(account.address).toEqual(getAddress(accounts[index].address))
36
+ // })
37
+ // })
38
+ // })
39
+ //
40
+ // test('args: accountIndex', () => {
41
+ // expect(
42
+ // mnemonicToAccount(mnemonic, { accountIndex: 1 }).address,
43
+ // ).toMatchInlineSnapshot('"0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650"')
44
+ // expect(
45
+ // mnemonicToAccount(mnemonic, { accountIndex: 2 }).address,
46
+ // ).toMatchInlineSnapshot('"0x98e503f35D0a019cB0a251aD243a4cCFCF371F46"')
47
+ // expect(
48
+ // mnemonicToAccount(mnemonic, { accountIndex: 3 }).address,
49
+ // ).toMatchInlineSnapshot('"0xCB9fA1eA9b8A3bf422a8639f23Df77ea66020eC2"')
50
+ // })
51
+ //
52
+ // test('args: changeIndex', () => {
53
+ // expect(
54
+ // mnemonicToAccount(mnemonic, { changeIndex: 1 }).address,
55
+ // ).toMatchInlineSnapshot('"0x4b39F7b0624b9dB86AD293686bc38B903142dbBc"')
56
+ // expect(
57
+ // mnemonicToAccount(mnemonic, { changeIndex: 2 }).address,
58
+ // ).toMatchInlineSnapshot('"0xe0Ff44FDb999d485DCFe6B0840f0d14EEA8a08A0"')
59
+ // expect(
60
+ // mnemonicToAccount(mnemonic, { changeIndex: 3 }).address,
61
+ // ).toMatchInlineSnapshot('"0x4E0eBc370cAdc5d152505EA4FEbcf839E7E2D3F8"')
62
+ // })
63
+ //
64
+ // test('sign message', async () => {
65
+ // const account = mnemonicToAccount(mnemonic)
66
+ // expect(
67
+ // await account.signMessage({ message: 'hello world' }),
68
+ // ).toMatchInlineSnapshot(
69
+ // '"0xa461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b"',
70
+ // )
71
+ // })
72
+ //
73
+ // test('sign transaction', async () => {
74
+ // const account = mnemonicToAccount(mnemonic)
75
+ // expect(
76
+ // await account.signTransaction({
77
+ // chainId: 1,
78
+ // maxFeePerGas: parseGwei('20'),
79
+ // gas: 21000n,
80
+ // to: accounts[1].address,
81
+ // value: parseEther('1'),
82
+ // }),
83
+ // ).toMatchInlineSnapshot(
84
+ // '"0x02f86f0180808504a817c8008252089470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c001a0f40a2d2ae9638056cafbe9083c7125edc8555e0e715db0984dd859a5c6dfac57a020f36fd0b32bef4d6d75c62f220e59c5fb60c244ca3b361e750985ee5c3a0931"',
85
+ // )
86
+ // })
87
+ //
88
+ // test('sign typed data', async () => {
89
+ // const account = mnemonicToAccount(mnemonic)
90
+ // expect(
91
+ // await account.signTypedData({ ...typedData.basic, primaryType: 'Mail' }),
92
+ // ).toMatchInlineSnapshot(
93
+ // '"0x32f3d5975ba38d6c2fba9b95d5cbed1febaa68003d3d588d51f2de522ad54117760cfc249470a75232552e43991f53953a3d74edf6944553c6bef2469bb9e5921b"',
94
+ // )
95
+ // })
96
+ //# sourceMappingURL=mnemonic-to-account.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mnemonic-to-account.test.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/mnemonic-to-account.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,QAAQ,GAAG,6DAA6D,CAAC;AAE/E,uCAAuC;AACvC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;IACnB,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;YAUhD,CAAC,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,yCAAyC;AACzC,uDAAuD;AACvD,6CAA6C;AAC7C,sDAAsD;AACtD,+BAA+B;AAC/B,WAAW;AACX,6EAA6E;AAC7E,SAAS;AACT,OAAO;AACP,KAAK;AACL,EAAE;AACF,iCAAiC;AACjC,uDAAuD;AACvD,oDAAoD;AACpD,sDAAsD;AACtD,2CAA2C;AAC3C,WAAW;AACX,6EAA6E;AAC7E,SAAS;AACT,OAAO;AACP,KAAK;AACL,EAAE;AACF,qCAAqC;AACrC,YAAY;AACZ,gEAAgE;AAChE,4EAA4E;AAC5E,YAAY;AACZ,gEAAgE;AAChE,4EAA4E;AAC5E,YAAY;AACZ,gEAAgE;AAChE,4EAA4E;AAC5E,KAAK;AACL,EAAE;AACF,oCAAoC;AACpC,YAAY;AACZ,+DAA+D;AAC/D,4EAA4E;AAC5E,YAAY;AACZ,+DAA+D;AAC/D,4EAA4E;AAC5E,YAAY;AACZ,+DAA+D;AAC/D,4EAA4E;AAC5E,KAAK;AACL,EAAE;AACF,qCAAqC;AACrC,gDAAgD;AAChD,YAAY;AACZ,6DAA6D;AAC7D,6BAA6B;AAC7B,gJAAgJ;AAChJ,MAAM;AACN,KAAK;AACL,EAAE;AACF,yCAAyC;AACzC,gDAAgD;AAChD,YAAY;AACZ,sCAAsC;AACtC,oBAAoB;AACpB,uCAAuC;AACvC,qBAAqB;AACrB,iCAAiC;AACjC,gCAAgC;AAChC,UAAU;AACV,6BAA6B;AAC7B,kPAAkP;AAClP,MAAM;AACN,KAAK;AACL,EAAE;AACF,wCAAwC;AACxC,gDAAgD;AAChD,YAAY;AACZ,gFAAgF;AAChF,6BAA6B;AAC7B,gJAAgJ;AAChJ,MAAM;AACN,KAAK"}
@@ -0,0 +1,28 @@
1
+ import { InvalidAddressError, } from "../errors/address.js";
2
+ const isAddress = (_, __) => true;
3
+ /**
4
+ * @description Creates an Account from a custom signing implementation.
5
+ *
6
+ * @returns A Local Account.
7
+ */
8
+ export function toLocalAccount(source) {
9
+ if (typeof source === "string") {
10
+ if (!isAddress(source, { strict: false }))
11
+ throw new InvalidAddressError({ address: source });
12
+ return {
13
+ address: source,
14
+ type: "json-rpc",
15
+ };
16
+ }
17
+ if (!isAddress(source.address, { strict: false }))
18
+ throw new InvalidAddressError({ address: source.address });
19
+ return {
20
+ address: source.address,
21
+ xOnlyPubKey: source.xOnlyPubKey,
22
+ signMessage: source.signMessage,
23
+ signPsbt: source.signPsbt,
24
+ source: "custom",
25
+ type: "local",
26
+ };
27
+ }
28
+ //# sourceMappingURL=to-local-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-local-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/to-local-account.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,GAEpB,MAAM,sBAAsB,CAAC;AAiB9B,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AAW9C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAqB;IAErB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YACvC,MAAM,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,UAAU;SACsB,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC/C,MAAM,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,OAAO;KACyB,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export function parseAccount(account) {
2
+ if (Array.isArray(account))
3
+ return {
4
+ address: account[0],
5
+ xOnlyPubKey: account[1],
6
+ type: "json-rpc",
7
+ };
8
+ return account;
9
+ }
10
+ //# sourceMappingURL=parse-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-account.js","sourceRoot":"","sources":["../../../../../src/sdk/accounts/utils/parse-account.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,YAAY,CAG1B,OAAyB;IAIzB,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YACnB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,UAAU;SACV,CAAC;IACX,OAAO,OAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { p2tr } from "@scure/btc-signer";
2
+ import { hex } from "@scure/base";
3
+ const ecdsaPublicKeyLength = 33;
4
+ function ecdsaPublicKeyToSchnorr(pubKey) {
5
+ if (pubKey.byteLength !== ecdsaPublicKeyLength)
6
+ throw new Error(`Invalid public key length. \nExpected ${ecdsaPublicKeyLength} bytes. \nGot ${pubKey.length} `);
7
+ return pubKey.slice(1);
8
+ }
9
+ export function publicKeyToP2TRPayment(publicKey, network) {
10
+ const pubKey = hex.decode(publicKey);
11
+ console.log("pubkey length:", pubKey.length);
12
+ return p2tr(ecdsaPublicKeyToSchnorr(pubKey), undefined, network);
13
+ }
14
+ //# sourceMappingURL=public-key-to-p2tr-payment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-key-to-p2tr-payment.js","sourceRoot":"","sources":["../../../../../src/sdk/accounts/utils/public-key-to-p2tr-payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAOlC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAS,uBAAuB,CAAC,MAAkB;IACjD,IAAI,MAAM,CAAC,UAAU,KAAK,oBAAoB;QAC5C,MAAM,IAAI,KAAK,CACb,yCAAyC,oBAAoB,iBAAiB,MAAM,CAAC,MAAM,GAAG,CAC/F,CAAC;IACJ,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAc,EAAE,OAAoB;IACzE,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAErC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { hex } from "@scure/base";
2
+ import { SigHash, Transaction } from "@scure/btc-signer";
3
+ export async function signPsbt(params) {
4
+ const { privateKey, signInputs, psbt } = params;
5
+ const privKey = hex.decode(privateKey);
6
+ const tx = Transaction.fromPSBT(hex.decode(psbt));
7
+ for (const input of signInputs) {
8
+ if (typeof input == "number") {
9
+ tx.signIdx(privKey, input);
10
+ }
11
+ else {
12
+ tx.signIdx(privKey, input.index, input.allowedSighash);
13
+ }
14
+ }
15
+ return { txid: tx.id, psbt: hex.encode(tx.toPSBT()) };
16
+ }
17
+ //# sourceMappingURL=sign-psbt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-psbt.js","sourceRoot":"","sources":["../../../../../src/sdk/accounts/utils/sign-psbt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAwBzD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAA+B;IAE/B,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAEhD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAElD,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC/B,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { Transaction } from "@scure/btc-signer";
2
+ import { hex } from "@scure/base";
3
+ import { getAction } from "../../..//utils/get-action.js";
4
+ import { signPsbt } from "../../wallet/sign-psbt.js";
5
+ import { parseAccount } from "../../../accounts/utils/parse-account.js";
6
+ export async function signCommit(client, parameters) {
7
+ const { account: account_ = client.account, chain = client.chain, ...params } = parameters;
8
+ if (!account_)
9
+ throw new Error("AccountNotFoundError");
10
+ const account = parseAccount(account_);
11
+ // TODO: assertRequest(account, paramatetrs )
12
+ // TODO: assertCurrentChain(chanId, chain)
13
+ const tx = Transaction.fromPSBT(hex.decode(params.psbt));
14
+ const signInputs = Array.from({
15
+ length: tx.inputsLength,
16
+ }, (_, i) => i);
17
+ let signed = account.signPsbt
18
+ ? await account.signPsbt({
19
+ psbt: params.psbt,
20
+ signInputs,
21
+ broadcast: false,
22
+ })
23
+ : await getAction(client, signPsbt, "signPsbt")({
24
+ account: account,
25
+ chain: chain,
26
+ psbt: params.psbt,
27
+ signInputs: signInputs,
28
+ broadcast: false,
29
+ });
30
+ const signedTx = Transaction.fromPSBT(hex.decode(signed.psbt));
31
+ signedTx.finalize();
32
+ return signedTx;
33
+ }
34
+ //# sourceMappingURL=sign-commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-commit.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/wallet/sign-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAMlC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAWxE,MAAM,CAAC,KAAK,UAAU,UAAU,CAK9B,MAAwD,EACxD,UAAgD;IAEhD,MAAM,EACJ,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,MAAM,EACV,GAAG,UAAU,CAAC;IAEf,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEvD,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAEvC,6CAA6C;IAC7C,0CAA0C;IAE1C,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAC3B;QACE,MAAM,EAAE,EAAE,CAAC,YAAY;KACxB,EACD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CACZ,CAAC;IAEF,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ;QAC3B,CAAC,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU;YACV,SAAS,EAAE,KAAK;SACjB,CAAC;QACJ,CAAC,CAAC,MAAM,SAAS,CACb,MAAM,EACN,QAAQ,EACR,UAAU,CACX,CAAC;YACA,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAc,CAAC,CAAC,CAAC;IAEzE,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEpB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export async function sendRawTransaction(client, { hex, maxFeeRate }) {
2
+ return client.request({
3
+ method: "sendrawtransaction",
4
+ params: maxFeeRate ? [hex, maxFeeRate] : [hex],
5
+ });
6
+ }
7
+ //# sourceMappingURL=send-raw-transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-raw-transaction.js","sourceRoot":"","sources":["../../../../../src/sdk/actions/public/send-raw-transaction.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAItC,MAAkD,EAClD,EAAE,GAAG,EAAE,UAAU,EAA4B;IAE7C,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,oBAAoB;QAC5B,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,20 @@
1
+ export async function testMempoolAccept(client, { rawtx, options = {} }) {
2
+ const txs = Array.isArray(rawtx) ? rawtx : [rawtx];
3
+ const params = options.maxfeerate !== undefined ? [txs, options] : [txs];
4
+ return client.request({
5
+ method: "testmempoolaccept",
6
+ params: params,
7
+ });
8
+ }
9
+ // export async function testMempoolAccept(
10
+ // rawtx: string | string[],
11
+ // options: TestMempoolAcceptOptions = {}
12
+ // ): Promise<TestMempoolAcceptResult[]> {
13
+ // const txs = Array.isArray(rawtx) ? rawtx : [rawtx];
14
+ //
15
+ // const params =
16
+ // options.maxfeerate !== undefined ? [txs, { maxfeerate: options.maxfeerate }] : [txs];
17
+ //
18
+ // return rpcCall<TestMempoolAcceptResult[]>("testmempoolaccept", params);
19
+ // }
20
+ //# sourceMappingURL=test-mempool-accept.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-mempool-accept.js","sourceRoot":"","sources":["../../../../../src/sdk/actions/public/test-mempool-accept.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAIrC,MAAkD,EAClD,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,EAA2B;IAEhD,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAEzE,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE,MAAa;KACtB,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,8BAA8B;AAC9B,2CAA2C;AAC3C,0CAA0C;AAC1C,wDAAwD;AACxD,EAAE;AACF,mBAAmB;AACnB,4FAA4F;AAC5F,EAAE;AACF,4EAA4E;AAC5E,IAAI"}
@@ -0,0 +1,2 @@
1
+ export { signet } from "./signet.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/sdk/chains/definitions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { defineChain } from "../../utils/chain/defineChain.js";
2
+ export const signet = defineChain({
3
+ id: 0,
4
+ name: "signet",
5
+ nativeCurrency: { name: "Kontor", symbol: "KOR", decimals: 18 },
6
+ blockTime: 1_000 * 60 * 10,
7
+ urls: {
8
+ default: {
9
+ http: ["https://signet-staging.kontor.network:35000/api"],
10
+ webSocket: ["wss://signet-staging.kontor.network:35000/ws"],
11
+ // TODO: maybe need to add auth
12
+ bitcoinRpc: ["https://signet-staging.kontor.network:38332"],
13
+ },
14
+ },
15
+ blockExplorers: {
16
+ default: {
17
+ name: "mempool.space",
18
+ url: "https://mempool.space/signet",
19
+ apiUrl: "https://mempool.space/signet/api",
20
+ },
21
+ },
22
+ contracts: {
23
+ nativeToken: {
24
+ name: "token",
25
+ blockHeight: 0,
26
+ txIndex: 0,
27
+ },
28
+ },
29
+ networkConfig: {
30
+ bech32: "tb",
31
+ pubKeyHash: 0x6f, // 111 in decimal
32
+ scriptHash: 0xc4, // 196 in decimal
33
+ wif: 0xef, // 239 in decimal
34
+ },
35
+ });
36
+ //# sourceMappingURL=signet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signet.js","sourceRoot":"","sources":["../../../../../src/sdk/chains/definitions/signet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAAC;IAChC,EAAE,EAAE,CAAC;IACL,IAAI,EAAE,QAAQ;IACd,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/D,SAAS,EAAE,KAAK,GAAG,EAAE,GAAG,EAAE;IAC1B,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,iDAAiD,CAAC;YACzD,SAAS,EAAE,CAAC,8CAA8C,CAAC;YAC3D,+BAA+B;YAC/B,UAAU,EAAE,CAAC,6CAA6C,CAAC;SAC5D;KACF;IACD,cAAc,EAAE;QACd,OAAO,EAAE;YACP,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,8BAA8B;YACnC,MAAM,EAAE,kCAAkC;SAC3C;KACF;IACD,SAAS,EAAE;QACT,WAAW,EAAE;YACX,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,CAAC;YACd,OAAO,EAAE,CAAC;SACX;KACF;IACD,aAAa,EAAE;QACb,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,IAAI,EAAE,iBAAiB;QACnC,UAAU,EAAE,IAAI,EAAE,iBAAiB;QACnC,GAAG,EAAE,IAAI,EAAE,iBAAiB;KAC7B;CACF,CAAC,CAAC"}
@@ -0,0 +1,145 @@
1
+ import { assertType, describe, expect, test, vi } from "vitest";
2
+ import { signet } from "../../chains/definitions/signet.js";
3
+ import { createRpcTransport } from "../transports/create-rpc-transport.js";
4
+ import { createRpcClient } from "./create-rpc-client.js";
5
+ import { httpRpc } from "../transports/http-rpc.js";
6
+ import { custom } from "../transports/custom.js";
7
+ test("creates", () => {
8
+ const mockTransport = () => createRpcTransport({
9
+ key: "mock",
10
+ name: "Mock Transport",
11
+ request: vi.fn(async () => null),
12
+ type: "mock",
13
+ });
14
+ const { uid, ...client } = createRpcClient({
15
+ transport: mockTransport,
16
+ });
17
+ assertType(client.request);
18
+ expect(uid).toBeDefined();
19
+ expect(client).toMatchInlineSnapshot(`
20
+ {
21
+ "account": undefined,
22
+ "cacheTime": 4000,
23
+ "chain": undefined,
24
+ "extend": [Function],
25
+ "key": "base",
26
+ "name": "Base Client",
27
+ "pollingInterval": 4000,
28
+ "request": [Function],
29
+ "transport": {
30
+ "key": "mock",
31
+ "methods": undefined,
32
+ "name": "Mock Transport",
33
+ "request": [MockFunction],
34
+ "retryCount": 3,
35
+ "retryDelay": 150,
36
+ "timeout": undefined,
37
+ "type": "mock",
38
+ },
39
+ "type": "base",
40
+ }
41
+ `);
42
+ });
43
+ describe("transports", () => {
44
+ test("http", () => {
45
+ const { uid, ...client } = createRpcClient({
46
+ chain: signet,
47
+ transport: httpRpc(),
48
+ });
49
+ expect(uid).toBeDefined();
50
+ expect(client).toMatchInlineSnapshot(`
51
+ {
52
+ "account": undefined,
53
+ "cacheTime": 4000,
54
+ "chain": {
55
+ "blockExplorers": {
56
+ "default": {
57
+ "apiUrl": "https://mempool.space/signet/api",
58
+ "name": "mempool.space",
59
+ "url": "https://mempool.space/signet",
60
+ },
61
+ },
62
+ "blockTime": 600000,
63
+ "contracts": {
64
+ "nativeToken": {
65
+ "blockHeight": 0,
66
+ "name": "token",
67
+ "txIndex": 0,
68
+ },
69
+ },
70
+ "fees": undefined,
71
+ "formatters": undefined,
72
+ "id": 0,
73
+ "name": "signet",
74
+ "nativeCurrency": {
75
+ "decimals": 18,
76
+ "name": "Kontor",
77
+ "symbol": "KOR",
78
+ },
79
+ "serializers": undefined,
80
+ "urls": {
81
+ "default": {
82
+ "bitcoinRpc": [
83
+ "https://signet.kontor.network:38332",
84
+ ],
85
+ "http": [
86
+ "https://signet.kontor.network:35000/api",
87
+ ],
88
+ "webSocket": [
89
+ "wss://signet.kontor.network:35000/ws",
90
+ ],
91
+ },
92
+ },
93
+ },
94
+ "extend": [Function],
95
+ "key": "base",
96
+ "name": "Base Client",
97
+ "pollingInterval": 4000,
98
+ "request": [Function],
99
+ "transport": {
100
+ "fetchOptions": undefined,
101
+ "key": "http",
102
+ "methods": undefined,
103
+ "name": "HTTP JSON-RPC",
104
+ "request": [Function],
105
+ "retryCount": 3,
106
+ "retryDelay": 150,
107
+ "timeout": 10000,
108
+ "type": "http-rpc",
109
+ "url": "https://signet.kontor.network:38332",
110
+ },
111
+ "type": "base",
112
+ }
113
+ `);
114
+ });
115
+ });
116
+ test("custom", () => {
117
+ const { uid, ...client } = createRpcClient({
118
+ transport: custom({ request: async () => null }),
119
+ });
120
+ expect(uid).toBeDefined();
121
+ expect(client).toMatchInlineSnapshot(`
122
+ {
123
+ "account": undefined,
124
+ "cacheTime": 4000,
125
+ "chain": undefined,
126
+ "extend": [Function],
127
+ "key": "base",
128
+ "name": "Base Client",
129
+ "pollingInterval": 4000,
130
+ "request": [Function],
131
+ "transport": {
132
+ "key": "custom",
133
+ "methods": undefined,
134
+ "name": "Custom Provider",
135
+ "request": [Function],
136
+ "retryCount": 3,
137
+ "retryDelay": 150,
138
+ "timeout": undefined,
139
+ "type": "custom",
140
+ },
141
+ "type": "base",
142
+ }
143
+ `);
144
+ });
145
+ //# sourceMappingURL=create-rpc-client.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-rpc-client.test.js","sourceRoot":"","sources":["../../../../../src/sdk/clients/base/create-rpc-client.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;IACnB,MAAM,aAAa,GAAG,GAAG,EAAE,CACzB,kBAAkB,CAAC;QACjB,GAAG,EAAE,MAAM;QACX,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAuC;QACtE,IAAI,EAAE,MAAM;KACb,CAAC,CAAC;IACL,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,eAAe,CAAC;QACzC,SAAS,EAAE,aAAa;KACzB,CAAC,CAAC;IAEH,UAAU,CAA0B,MAAM,CAAC,OAAO,CAAC,CAAC;IAEpD,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1B,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;GAsBpC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;QAChB,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,eAAe,CAAC;YACzC,KAAK,EAAE,MAAM;YAEb,SAAS,EAAE,OAAO,EAAa;SAChC,CAAC,CAAC;QAEH,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+DpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;IAClB,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,eAAe,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;KACjD,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1B,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;KAsBlC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}