@kontor/kontor-sdk 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (286) hide show
  1. package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js +10 -14
  2. package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  3. package/dist/cjs/sdk/actions/public/test-mempool-accept.js +10 -0
  4. package/dist/cjs/sdk/actions/public/test-mempool-accept.js.map +1 -1
  5. package/dist/cjs/sdk/clients/decorators/public.js +2 -0
  6. package/dist/cjs/sdk/clients/decorators/public.js.map +1 -1
  7. package/dist/cjs/sdk/clients/transports/custom.js.map +1 -1
  8. package/dist/cjs/sdk/utils/build-rpc-request.js +1 -0
  9. package/dist/cjs/sdk/utils/build-rpc-request.js.map +1 -1
  10. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  11. package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js +37 -23
  12. package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  13. package/dist/esm/sdk/actions/public/test-mempool-accept.js +8 -32
  14. package/dist/esm/sdk/actions/public/test-mempool-accept.js.map +1 -1
  15. package/dist/esm/sdk/clients/decorators/public.js +2 -0
  16. package/dist/esm/sdk/clients/decorators/public.js.map +1 -1
  17. package/dist/esm/sdk/clients/transports/custom.js.map +1 -1
  18. package/dist/esm/sdk/utils/build-rpc-request.js +1 -0
  19. package/dist/esm/sdk/utils/build-rpc-request.js.map +1 -1
  20. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  21. package/dist/src/sdk/actions/kontor/public/build-compose-call.js +5 -6
  22. package/dist/src/sdk/actions/kontor/public/build-compose-call.js.map +1 -1
  23. package/dist/src/sdk/actions/kontor/public/build-compose-query.js +30 -0
  24. package/dist/src/sdk/actions/kontor/public/build-compose-query.js.map +1 -0
  25. package/dist/src/sdk/actions/kontor/public/build-instruction-query.js +45 -0
  26. package/dist/src/sdk/actions/kontor/public/build-instruction-query.js.map +1 -0
  27. package/dist/src/sdk/actions/kontor/public/build-instruction.js +13 -16
  28. package/dist/src/sdk/actions/kontor/public/build-instruction.js.map +1 -1
  29. package/dist/src/sdk/actions/kontor/public/call-compose.js +38 -0
  30. package/dist/src/sdk/actions/kontor/public/call-compose.js.map +1 -0
  31. package/dist/src/sdk/actions/kontor/public/call-proc.js +6 -2
  32. package/dist/src/sdk/actions/kontor/public/call-proc.js.map +1 -1
  33. package/dist/src/sdk/actions/kontor/public/proc-contract.js +8 -5
  34. package/dist/src/sdk/actions/kontor/public/proc-contract.js.map +1 -1
  35. package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js +37 -25
  36. package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  37. package/dist/src/sdk/clients/decorators/kontor/public.js +6 -6
  38. package/dist/src/sdk/clients/decorators/kontor/public.js.map +1 -1
  39. package/dist/src/sdk/types/kontor.js +27 -1
  40. package/dist/src/sdk/types/kontor.js.map +1 -1
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/dist/types/sdk/actions/kontor/wallet/sign-reveal.d.ts.map +1 -1
  43. package/dist/types/sdk/actions/public/test-mempool-accept.d.ts +14 -1
  44. package/dist/types/sdk/actions/public/test-mempool-accept.d.ts.map +1 -1
  45. package/dist/types/sdk/clients/decorators/public.d.ts +2 -0
  46. package/dist/types/sdk/clients/decorators/public.d.ts.map +1 -1
  47. package/dist/types/sdk/clients/transports/custom.d.ts.map +1 -1
  48. package/dist/types/sdk/types/btc-rpc.d.ts +9 -1
  49. package/dist/types/sdk/types/btc-rpc.d.ts.map +1 -1
  50. package/dist/types/sdk/utils/build-rpc-request.d.ts.map +1 -1
  51. package/package.json +6 -2
  52. package/src/sdk/actions/kontor/public/{build-compose-call.ts → build-compose-query.ts} +15 -25
  53. package/src/sdk/actions/kontor/public/{build-instruction.ts → build-instruction-query.ts} +35 -29
  54. package/src/sdk/actions/kontor/public/{call-proc.ts → call-compose.ts} +16 -19
  55. package/src/sdk/actions/kontor/public/proc-contract.ts +9 -6
  56. package/src/sdk/actions/kontor/wallet/sign-reveal.ts +49 -28
  57. package/src/sdk/actions/public/test-mempool-accept.ts +34 -31
  58. package/src/sdk/clients/decorators/kontor/public.ts +23 -23
  59. package/src/sdk/clients/decorators/public.ts +11 -0
  60. package/src/sdk/test/e2e.test.ts +193 -15
  61. package/src/sdk/types/btc-rpc.ts +12 -11
  62. package/src/sdk/types/kontor.ts +38 -0
  63. package/dist/src/exports/index.test.js +0 -10
  64. package/dist/src/exports/index.test.js.map +0 -1
  65. package/dist/src/sdk/accounts/hd-key-to-account.js +0 -20
  66. package/dist/src/sdk/accounts/hd-key-to-account.js.map +0 -1
  67. package/dist/src/sdk/accounts/mnemonic-to-account.js +0 -16
  68. package/dist/src/sdk/accounts/mnemonic-to-account.js.map +0 -1
  69. package/dist/src/sdk/accounts/mnemonic-to-account.test.js +0 -96
  70. package/dist/src/sdk/accounts/mnemonic-to-account.test.js.map +0 -1
  71. package/dist/src/sdk/accounts/to-local-account.js +0 -28
  72. package/dist/src/sdk/accounts/to-local-account.js.map +0 -1
  73. package/dist/src/sdk/accounts/types.js +0 -2
  74. package/dist/src/sdk/accounts/types.js.map +0 -1
  75. package/dist/src/sdk/accounts/utils/parse-account.js +0 -10
  76. package/dist/src/sdk/accounts/utils/parse-account.js.map +0 -1
  77. package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js +0 -14
  78. package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js.map +0 -1
  79. package/dist/src/sdk/accounts/utils/sign-psbt.js +0 -17
  80. package/dist/src/sdk/accounts/utils/sign-psbt.js.map +0 -1
  81. package/dist/src/sdk/actions/kontor/wallet/sign-commit.js +0 -34
  82. package/dist/src/sdk/actions/kontor/wallet/sign-commit.js.map +0 -1
  83. package/dist/src/sdk/actions/public/send-raw-transaction.js +0 -7
  84. package/dist/src/sdk/actions/public/send-raw-transaction.js.map +0 -1
  85. package/dist/src/sdk/actions/public/test-mempool-accept.js +0 -44
  86. package/dist/src/sdk/actions/public/test-mempool-accept.js.map +0 -1
  87. package/dist/src/sdk/chains/definitions/index.js +0 -2
  88. package/dist/src/sdk/chains/definitions/index.js.map +0 -1
  89. package/dist/src/sdk/chains/definitions/signet.js +0 -36
  90. package/dist/src/sdk/chains/definitions/signet.js.map +0 -1
  91. package/dist/src/sdk/clients/base/create-rpc-client.test.js +0 -145
  92. package/dist/src/sdk/clients/base/create-rpc-client.test.js.map +0 -1
  93. package/dist/src/sdk/clients/create-public-client.test.js +0 -113
  94. package/dist/src/sdk/clients/create-public-client.test.js.map +0 -1
  95. package/dist/src/sdk/clients/decorators/kontor/wallet.js +0 -13
  96. package/dist/src/sdk/clients/decorators/kontor/wallet.js.map +0 -1
  97. package/dist/src/sdk/clients/decorators/public.js +0 -7
  98. package/dist/src/sdk/clients/decorators/public.js.map +0 -1
  99. package/dist/src/sdk/clients/decorators/wallet.js +0 -9
  100. package/dist/src/sdk/clients/decorators/wallet.js.map +0 -1
  101. package/dist/src/sdk/clients/kontor/create-public-client.test.js +0 -44
  102. package/dist/src/sdk/clients/kontor/create-public-client.test.js.map +0 -1
  103. package/dist/src/sdk/clients/kontor/create-wallet-client.js +0 -14
  104. package/dist/src/sdk/clients/kontor/create-wallet-client.js.map +0 -1
  105. package/dist/src/sdk/clients/transports/create-http-transport.js +0 -25
  106. package/dist/src/sdk/clients/transports/create-http-transport.js.map +0 -1
  107. package/dist/src/sdk/clients/transports/create-rpc-transport.test.js +0 -58
  108. package/dist/src/sdk/clients/transports/create-rpc-transport.test.js.map +0 -1
  109. package/dist/src/sdk/clients/transports/custom.js +0 -14
  110. package/dist/src/sdk/clients/transports/custom.js.map +0 -1
  111. package/dist/src/sdk/clients/transports/http-rpc.js +0 -84
  112. package/dist/src/sdk/clients/transports/http-rpc.js.map +0 -1
  113. package/dist/src/sdk/clients/transports/http-rpc.test.js +0 -147
  114. package/dist/src/sdk/clients/transports/http-rpc.test.js.map +0 -1
  115. package/dist/src/sdk/clients/transports/http.js +0 -45
  116. package/dist/src/sdk/clients/transports/http.js.map +0 -1
  117. package/dist/src/sdk/contracts/wits.js +0 -26
  118. package/dist/src/sdk/contracts/wits.js.map +0 -1
  119. package/dist/src/sdk/errors/address.js +0 -13
  120. package/dist/src/sdk/errors/address.js.map +0 -1
  121. package/dist/src/sdk/errors/base.js +0 -92
  122. package/dist/src/sdk/errors/base.js.map +0 -1
  123. package/dist/src/sdk/errors/request.js +0 -100
  124. package/dist/src/sdk/errors/request.js.map +0 -1
  125. package/dist/src/sdk/errors/rpc.js +0 -30
  126. package/dist/src/sdk/errors/rpc.js.map +0 -1
  127. package/dist/src/sdk/errors/transport.js +0 -10
  128. package/dist/src/sdk/errors/transport.js.map +0 -1
  129. package/dist/src/sdk/errors/utils.js +0 -2
  130. package/dist/src/sdk/errors/utils.js.map +0 -1
  131. package/dist/src/sdk/errors/version.js +0 -2
  132. package/dist/src/sdk/errors/version.js.map +0 -1
  133. package/dist/src/sdk/errors/wit.js +0 -19
  134. package/dist/src/sdk/errors/wit.js.map +0 -1
  135. package/dist/src/sdk/test/e2e.test.js +0 -75
  136. package/dist/src/sdk/test/e2e.test.js.map +0 -1
  137. package/dist/src/sdk/types/account.js +0 -2
  138. package/dist/src/sdk/types/account.js.map +0 -1
  139. package/dist/src/sdk/types/btc-rpc.js +0 -2
  140. package/dist/src/sdk/types/btc-rpc.js.map +0 -1
  141. package/dist/src/sdk/types/contract.test-d.js +0 -35
  142. package/dist/src/sdk/types/contract.test-d.js.map +0 -1
  143. package/dist/src/sdk/types/http-schema.test-d.js +0 -133
  144. package/dist/src/sdk/types/http-schema.test-d.js.map +0 -1
  145. package/dist/src/sdk/types/misc.js +0 -2
  146. package/dist/src/sdk/types/misc.js.map +0 -1
  147. package/dist/src/sdk/types/rpc.js +0 -19
  148. package/dist/src/sdk/types/rpc.js.map +0 -1
  149. package/dist/src/sdk/types/utils.js +0 -2
  150. package/dist/src/sdk/types/utils.js.map +0 -1
  151. package/dist/src/sdk/types/wbip001.js +0 -3
  152. package/dist/src/sdk/types/wbip001.js.map +0 -1
  153. package/dist/src/sdk/utils/build-http-request.js +0 -55
  154. package/dist/src/sdk/utils/build-http-request.js.map +0 -1
  155. package/dist/src/sdk/utils/build-request.js +0 -35
  156. package/dist/src/sdk/utils/build-request.js.map +0 -1
  157. package/dist/src/sdk/utils/build-rpc-request.js +0 -84
  158. package/dist/src/sdk/utils/build-rpc-request.js.map +0 -1
  159. package/dist/src/sdk/utils/encoding/to-hex.js +0 -23
  160. package/dist/src/sdk/utils/encoding/to-hex.js.map +0 -1
  161. package/dist/src/sdk/utils/get-action.js +0 -27
  162. package/dist/src/sdk/utils/get-action.js.map +0 -1
  163. package/dist/src/sdk/utils/http.js +0 -137
  164. package/dist/src/sdk/utils/http.js.map +0 -1
  165. package/dist/src/sdk/utils/lru.js +0 -35
  166. package/dist/src/sdk/utils/lru.js.map +0 -1
  167. package/dist/src/sdk/utils/promise/create-batch-scheduler.js +0 -49
  168. package/dist/src/sdk/utils/promise/create-batch-scheduler.js.map +0 -1
  169. package/dist/src/sdk/utils/promise/with-dedupe.js +0 -14
  170. package/dist/src/sdk/utils/promise/with-dedupe.js.map +0 -1
  171. package/dist/src/sdk/utils/promise/with-resolvers.js +0 -10
  172. package/dist/src/sdk/utils/promise/with-resolvers.js.map +0 -1
  173. package/dist/src/sdk/utils/promise/with-retry.js +0 -25
  174. package/dist/src/sdk/utils/promise/with-retry.js.map +0 -1
  175. package/dist/src/sdk/utils/promise/with-timeout.js +0 -30
  176. package/dist/src/sdk/utils/promise/with-timeout.js.map +0 -1
  177. package/dist/src/sdk/utils/rpc/http.js +0 -86
  178. package/dist/src/sdk/utils/rpc/http.js.map +0 -1
  179. package/dist/src/sdk/utils/rpc/id.js +0 -13
  180. package/dist/src/sdk/utils/rpc/id.js.map +0 -1
  181. package/dist/src/sdk/utils/stringify.js +0 -5
  182. package/dist/src/sdk/utils/stringify.js.map +0 -1
  183. package/dist/src/sdk/utils/uid.js +0 -14
  184. package/dist/src/sdk/utils/uid.js.map +0 -1
  185. package/dist/src/sdk/utils/wait.js +0 -4
  186. package/dist/src/sdk/utils/wait.js.map +0 -1
  187. package/dist/src/sdk/utils/wit/codecs/decimal.js +0 -165
  188. package/dist/src/sdk/utils/wit/codecs/decimal.js.map +0 -1
  189. package/dist/src/sdk/utils/wit/codecs/enum.js +0 -104
  190. package/dist/src/sdk/utils/wit/codecs/enum.js.map +0 -1
  191. package/dist/src/sdk/utils/wit/codecs/integer.js +0 -167
  192. package/dist/src/sdk/utils/wit/codecs/integer.js.map +0 -1
  193. package/dist/src/sdk/utils/wit/codecs/list.js +0 -117
  194. package/dist/src/sdk/utils/wit/codecs/list.js.map +0 -1
  195. package/dist/src/sdk/utils/wit/codecs/option.js +0 -91
  196. package/dist/src/sdk/utils/wit/codecs/option.js.map +0 -1
  197. package/dist/src/sdk/utils/wit/codecs/string.js +0 -27
  198. package/dist/src/sdk/utils/wit/codecs/string.js.map +0 -1
  199. package/dist/src/sdk/utils/wit/codecs/types.js +0 -45
  200. package/dist/src/sdk/utils/wit/codecs/types.js.map +0 -1
  201. package/dist/src/sdk/utils/wit/codecs/unit.js +0 -22
  202. package/dist/src/sdk/utils/wit/codecs/unit.js.map +0 -1
  203. package/dist/src/sdk/utils/wit/decode-function-result.js +0 -36
  204. package/dist/src/sdk/utils/wit/decode-function-result.js.map +0 -1
  205. package/dist/src/sdk/utils/wit/decode-wit-parameter.js +0 -286
  206. package/dist/src/sdk/utils/wit/decode-wit-parameter.js.map +0 -1
  207. package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js +0 -75
  208. package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js.map +0 -1
  209. package/dist/src/sdk/utils/wit/encode-function-data.js +0 -17
  210. package/dist/src/sdk/utils/wit/encode-function-data.js.map +0 -1
  211. package/dist/src/sdk/utils/wit/encode-function-data.test-d.js +0 -21
  212. package/dist/src/sdk/utils/wit/encode-function-data.test-d.js.map +0 -1
  213. package/dist/src/sdk/utils/wit/encode-function-data.test.js +0 -91
  214. package/dist/src/sdk/utils/wit/encode-function-data.test.js.map +0 -1
  215. package/dist/src/sdk/utils/wit/encode-wit-parameters.js +0 -250
  216. package/dist/src/sdk/utils/wit/encode-wit-parameters.js.map +0 -1
  217. package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js +0 -62
  218. package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js.map +0 -1
  219. package/dist/src/sdk/utils/wit/get-wit-item.js +0 -15
  220. package/dist/src/sdk/utils/wit/get-wit-item.js.map +0 -1
  221. package/dist/src/sdk/utils/wit/get-wit-item.test.js +0 -118
  222. package/dist/src/sdk/utils/wit/get-wit-item.test.js.map +0 -1
  223. package/dist/src/sdk/utils/wit/prepare-encode-function-data.js +0 -24
  224. package/dist/src/sdk/utils/wit/prepare-encode-function-data.js.map +0 -1
  225. package/dist/src/wit/error.js +0 -59
  226. package/dist/src/wit/error.js.map +0 -1
  227. package/dist/src/wit/narrow.js +0 -14
  228. package/dist/src/wit/narrow.js.map +0 -1
  229. package/dist/src/wit/regex.js +0 -6
  230. package/dist/src/wit/regex.js.map +0 -1
  231. package/dist/src/wit/register.js +0 -2
  232. package/dist/src/wit/register.js.map +0 -1
  233. package/dist/src/wit/type-utils.js +0 -2
  234. package/dist/src/wit/type-utils.js.map +0 -1
  235. package/dist/src/wit/utils.js +0 -2
  236. package/dist/src/wit/utils.js.map +0 -1
  237. package/dist/src/wit/utils.test-d.js +0 -16
  238. package/dist/src/wit/utils.test-d.js.map +0 -1
  239. package/dist/src/wit/version.js +0 -2
  240. package/dist/src/wit/version.js.map +0 -1
  241. package/dist/src/wit/wit-parser/core/errors/signature.js +0 -42
  242. package/dist/src/wit/wit-parser/core/errors/signature.js.map +0 -1
  243. package/dist/src/wit/wit-parser/core/errors/splitParameters.js +0 -18
  244. package/dist/src/wit/wit-parser/core/errors/splitParameters.js.map +0 -1
  245. package/dist/src/wit/wit-parser/core/errors/wit-parameter.js +0 -29
  246. package/dist/src/wit/wit-parser/core/errors/wit-parameter.js.map +0 -1
  247. package/dist/src/wit/wit-parser/core/records.js +0 -73
  248. package/dist/src/wit/wit-parser/core/records.js.map +0 -1
  249. package/dist/src/wit/wit-parser/core/records.test.js +0 -53
  250. package/dist/src/wit/wit-parser/core/records.test.js.map +0 -1
  251. package/dist/src/wit/wit-parser/core/signatures.js +0 -32
  252. package/dist/src/wit/wit-parser/core/signatures.js.map +0 -1
  253. package/dist/src/wit/wit-parser/core/signatures.test.js +0 -54
  254. package/dist/src/wit/wit-parser/core/signatures.test.js.map +0 -1
  255. package/dist/src/wit/wit-parser/core/types/records.js +0 -2
  256. package/dist/src/wit/wit-parser/core/types/records.js.map +0 -1
  257. package/dist/src/wit/wit-parser/core/types/records.test-d.js +0 -19
  258. package/dist/src/wit/wit-parser/core/types/records.test-d.js.map +0 -1
  259. package/dist/src/wit/wit-parser/core/types/signatures.js +0 -3
  260. package/dist/src/wit/wit-parser/core/types/signatures.js.map +0 -1
  261. package/dist/src/wit/wit-parser/core/types/signatures.test-d.js +0 -18
  262. package/dist/src/wit/wit-parser/core/types/signatures.test-d.js.map +0 -1
  263. package/dist/src/wit/wit-parser/core/types/utils.js +0 -2
  264. package/dist/src/wit/wit-parser/core/types/utils.js.map +0 -1
  265. package/dist/src/wit/wit-parser/core/types/utils.test-d.js +0 -138
  266. package/dist/src/wit/wit-parser/core/types/utils.test-d.js.map +0 -1
  267. package/dist/src/wit/wit-parser/core/utils.js +0 -212
  268. package/dist/src/wit/wit-parser/core/utils.js.map +0 -1
  269. package/dist/src/wit/wit-parser/core/utils.test.js +0 -302
  270. package/dist/src/wit/wit-parser/core/utils.test.js.map +0 -1
  271. package/dist/src/wit/wit-parser/parse-wit-parameter.js +0 -26
  272. package/dist/src/wit/wit-parser/parse-wit-parameter.js.map +0 -1
  273. package/dist/src/wit/wit-parser/parse-wit-parameter.test.js +0 -77
  274. package/dist/src/wit/wit-parser/parse-wit-parameter.test.js.map +0 -1
  275. package/dist/src/wit/wit-parser/parse-wit.js +0 -16
  276. package/dist/src/wit/wit-parser/parse-wit.js.map +0 -1
  277. package/dist/src/wit/wit-parser/parse-wit.test.js +0 -78
  278. package/dist/src/wit/wit-parser/parse-wit.test.js.map +0 -1
  279. package/dist/src/wit/wit.js +0 -2
  280. package/dist/src/wit/wit.js.map +0 -1
  281. package/dist/src/wit/wit.test.js +0 -6
  282. package/dist/src/wit/wit.test.js.map +0 -1
  283. package/dist/test/globalSetup.js +0 -14
  284. package/dist/test/globalSetup.js.map +0 -1
  285. package/dist/test/src/wits.js +0 -21
  286. package/dist/test/src/wits.js.map +0 -1
@@ -19,22 +19,22 @@ import {
19
19
  } from "../../../actions/kontor/public/call-view.js";
20
20
 
21
21
  import {
22
- callProc,
23
- type CallProcParameters,
24
- type CallProcReturnType,
25
- } from "../../../actions/kontor/public/call-proc.js";
22
+ callCompose,
23
+ type CallComposeParameters,
24
+ type CallComposeReturnType,
25
+ } from "../../../actions/kontor/public/call-compose.js";
26
26
 
27
27
  import {
28
- buildInstruction,
29
- type BuildInstructionParameters,
30
- type BuildInstructionReturnType,
31
- } from "../../../actions/kontor/public/build-instruction.js";
28
+ buildInstructionQuery,
29
+ type BuildInstructionQueryParameters,
30
+ type BuildInstructionQueryReturnType,
31
+ } from "../../../actions/kontor/public/build-instruction-query.js";
32
32
 
33
33
  import {
34
- buildComposeCall,
35
- type BuildComposeCallParameters,
36
- type BuildComposeCallReturnType,
37
- } from "../../../actions/kontor/public/build-compose-call.js";
34
+ buildComposeQuery,
35
+ type BuildComposeQueryParameters,
36
+ type BuildComposeQueryReturnType,
37
+ } from "../../../actions/kontor/public/build-compose-query.js";
38
38
 
39
39
  import {
40
40
  inspect,
@@ -75,17 +75,17 @@ export type KontorPublicActions<
75
75
  args: CallViewParameters<chain>,
76
76
  ) => Promise<CallViewReturnType>;
77
77
 
78
- buildInstruction: <chain extends Chain | undefined>(
79
- args: BuildInstructionParameters<chain>,
80
- ) => Promise<BuildInstructionReturnType>;
78
+ buildInstructionQuery: <chain extends Chain | undefined>(
79
+ args: BuildInstructionQueryParameters<chain>,
80
+ ) => Promise<BuildInstructionQueryReturnType>;
81
81
 
82
- buildComposeCall: <chain extends Chain | undefined>(
83
- args: BuildComposeCallParameters<chain>,
84
- ) => Promise<BuildComposeCallReturnType>;
82
+ buildComposeQuery: <chain extends Chain | undefined>(
83
+ args: BuildComposeQueryParameters<chain>,
84
+ ) => Promise<BuildComposeQueryReturnType>;
85
85
 
86
86
  callProc: <chain extends Chain | undefined>(
87
- args: CallProcParameters<chain>,
88
- ) => Promise<CallProcReturnType>;
87
+ args: CallComposeParameters<chain>,
88
+ ) => Promise<CallComposeReturnType>;
89
89
  inspect: <_chain extends Chain | undefined>(
90
90
  args: InspectParameters,
91
91
  ) => Promise<InspectReturnType>;
@@ -102,9 +102,9 @@ export function kontorPublicActions<
102
102
  viewContract: (args) => viewContract(client, args),
103
103
  procContract: (args) => procContract(client, args),
104
104
  callView: (args) => callView(client, args),
105
- callProc: (args) => callProc(client, args),
106
- buildInstruction: (args) => buildInstruction(client, args),
107
- buildComposeCall: (args) => buildComposeCall(client, args),
105
+ callProc: (args) => callCompose(client, args),
106
+ buildInstructionQuery: (args) => buildInstructionQuery(client, args),
107
+ buildComposeQuery: (args) => buildComposeQuery(client, args),
108
108
  inspect: (args) => inspect(client, args),
109
109
  };
110
110
  }
@@ -8,6 +8,13 @@ import {
8
8
  type SendRawTransactionReturnType,
9
9
  sendRawTransaction,
10
10
  } from "../../actions/public/send-raw-transaction.js";
11
+
12
+ import {
13
+ type TestMempoolAcceptParams,
14
+ type TestMempoolAcceptReturnType,
15
+ testMempoolAccept,
16
+ } from "../../actions/public/test-mempool-accept.js";
17
+
11
18
  import type { PublicClient as PublicClient } from "../create-public-client.js";
12
19
 
13
20
  export type PublicActions<
@@ -20,6 +27,9 @@ export type PublicActions<
20
27
  sendRawTransaction: (
21
28
  parameters: SendRawTransactionParams,
22
29
  ) => Promise<SendRawTransactionReturnType>;
30
+ testMempoolAccept: (
31
+ parameters: TestMempoolAcceptParams,
32
+ ) => Promise<TestMempoolAcceptReturnType>;
23
33
  };
24
34
 
25
35
  export function publicActions<
@@ -31,5 +41,6 @@ export function publicActions<
31
41
  ): PublicActions<chain, account> {
32
42
  return {
33
43
  sendRawTransaction: (args) => sendRawTransaction(client, args),
44
+ testMempoolAccept: (args) => testMempoolAccept(client, args),
34
45
  };
35
46
  }
@@ -5,6 +5,7 @@ import { createPublicClient as createKontorPublicClient } from "../clients/konto
5
5
  import { http } from "../clients/transports/http.js";
6
6
  import { mnemonicToAccount } from "../accounts/mnemonic-to-account.js";
7
7
  import { createWalletClient as createKontorWalletClient } from "../clients/kontor/create-wallet-client.js";
8
+
8
9
  import { custom } from "../clients/transports/custom.js";
9
10
  import { Transaction } from "@scure/btc-signer";
10
11
  import { hex } from "@scure/base";
@@ -32,12 +33,168 @@ export const nativeTokenRaw = [
32
33
 
33
34
  export const wit = parseWit(nativeTokenRaw);
34
35
 
36
+ // test("e2e kontor wallet client", async () => {
37
+ // const account = mnemonicToAccount(process.env.TEST_MNEMONIC!);
38
+ //
39
+ // const kontorPublicClient = createKontorPublicClient({
40
+ // transport: http("https://signet-staging.kontor.network:35000/api"),
41
+ // account,
42
+ // chain: signet,
43
+ // });
44
+ //
45
+ // const kontorWalletClient = createKontorWalletClient({
46
+ // account,
47
+ // // TODO: transport is not used for local account.
48
+ // transport: custom({
49
+ // request: async (_args: any) => null,
50
+ // }),
51
+ // });
52
+ //
53
+ // const res = await kontorPublicClient.procContract({
54
+ // wit: wit,
55
+ // // TODO: add optional account override
56
+ //
57
+ // functionName: "mint", // functin name is only valid if it's got a proc-context
58
+ // contractAddress: "token_0_0",
59
+ // args: [[7n, 18]],
60
+ // satsPerVByte: 1,
61
+ // utxos: [
62
+ // "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
63
+ // ],
64
+ // gas: 10n,
65
+ // });
66
+ //
67
+ // const commit: Transaction = await kontorWalletClient.signCommit({
68
+ // account: account,
69
+ // chain: signet,
70
+ // psbt: res.result.commit_psbt_hex,
71
+ // });
72
+ //
73
+ // const reveal: Transaction = await kontorWalletClient.signReveal({
74
+ // account: account,
75
+ // chain: signet,
76
+ // psbt: res.result.reveal_psbt_hex,
77
+ // parcipantScripts: res.result.per_participant,
78
+ // });
79
+ //
80
+ // const commitExtracted = commit.extract();
81
+ // const revealExtracted = reveal.extract();
82
+ //
83
+ // // const m = await btcPublicClient.testMempoolAccept({
84
+ // // rawtx: [hex.encode(commitExtracted), hex.encode(revealExtracted)],
85
+ // // options: {},
86
+ // // });
87
+ // //
88
+ //
89
+ // const r = await fetch("https://signet.kontor.network:38332", {
90
+ // method: "POST",
91
+ // headers: {
92
+ // "Content-Type": "application/json",
93
+ // Authorization: `Basic ${Buffer.from("rpc:rpc").toString("base64")}`,
94
+ // },
95
+ // body: JSON.stringify({
96
+ // method: "testmempoolaccept",
97
+ // params: [[hex.encode(commitExtracted), hex.encode(revealExtracted)]],
98
+ // }),
99
+ // });
100
+ // console.log({
101
+ // r,
102
+ // reveal: [hex.encode(commitExtracted), hex.encode(revealExtracted)],
103
+ // });
104
+ //
105
+ // const j = await r.json();
106
+ //
107
+ // console.log(j);
108
+ // //
109
+ // // const op = await kontorPublicClient.inspect({
110
+ // // hex: hex.encode(revealExtracted),
111
+ // // });
112
+ //
113
+ // // console.log(JSON.stringify(op.result[0]!.op));
114
+ // //
115
+ // });
116
+
35
117
  test("e2e kontor wallet client", async () => {
36
118
  const account = mnemonicToAccount(process.env.TEST_MNEMONIC!);
37
119
 
120
+ const res = {
121
+ result: {
122
+ commit_transaction: {
123
+ version: 2,
124
+ lock_time: 0,
125
+ input: [
126
+ {
127
+ previous_output:
128
+ "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
129
+ script_sig: "",
130
+ sequence: 4294967295,
131
+ witness: [],
132
+ },
133
+ ],
134
+ output: [
135
+ {
136
+ value: 570,
137
+ script_pubkey:
138
+ "51207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f",
139
+ },
140
+ {
141
+ value: 8502,
142
+ script_pubkey:
143
+ "5120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f",
144
+ },
145
+ ],
146
+ },
147
+ commit_transaction_hex:
148
+ "0200000001332a0e2d0c369ebb984ce8addb4387bd6702f59b255ceada1c0fcff4ed401c640100000000ffffffff023a020000000000002251207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f3621000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f00000000",
149
+ commit_psbt_hex:
150
+ "70736274ff0100890200000001332a0e2d0c369ebb984ce8addb4387bd6702f59b255ceada1c0fcff4ed401c640100000000ffffffff023a020000000000002251207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f3621000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f000000000001012b8e24000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f0117202c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f000000",
151
+ reveal_transaction: {
152
+ version: 2,
153
+ lock_time: 0,
154
+ input: [
155
+ {
156
+ previous_output:
157
+ "4b195fabb3bd5360de2e2db6821df9d8909f0dbd5f1ba50ae1ca71a841080c3d:0",
158
+ script_sig: "",
159
+ sequence: 4294967295,
160
+ witness: [],
161
+ },
162
+ ],
163
+ output: [
164
+ {
165
+ value: 330,
166
+ script_pubkey:
167
+ "5120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f",
168
+ },
169
+ ],
170
+ },
171
+ reveal_transaction_hex:
172
+ "02000000013d0c0841a871cae10aa51b5fbd0d9f90d8f91d82b62d2ede6053bdb3ab5f194b0000000000ffffffff014a01000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f00000000",
173
+ reveal_psbt_hex:
174
+ "70736274ff01005e02000000013d0c0841a871cae10aa51b5fbd0d9f90d8f91d82b62d2ede6053bdb3ab5f194b0000000000ffffffff014a01000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f000000000001012b3a020000000000002251207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f0117202c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f0000",
175
+ per_participant: [
176
+ {
177
+ address:
178
+ "tb1pj2wrjsg0ksmmflec0myf3j7qnqm9myvk2pesqn7y8cqn6sgdg9ls9u6tar",
179
+ x_only_public_key:
180
+ "2c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f",
181
+ commit_tap_leaf_script: {
182
+ leafVersion: 192,
183
+ script:
184
+ "202c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51fac0063036b6f6e00010268",
185
+ controlBlock:
186
+ "c12c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f",
187
+ },
188
+ chained_tap_leaf_script: null,
189
+ },
190
+ ],
191
+ },
192
+ };
193
+
38
194
  const kontorPublicClient = createKontorPublicClient({
39
195
  transport: http("https://signet-staging.kontor.network:35000/api"),
40
196
  account,
197
+ chain: signet,
41
198
  });
42
199
 
43
200
  const kontorWalletClient = createKontorWalletClient({
@@ -48,22 +205,21 @@ test("e2e kontor wallet client", async () => {
48
205
  }),
49
206
  });
50
207
 
51
- const res = await kontorPublicClient.procContract({
52
- wit: wit,
53
- // TODO: add optional account override
54
-
55
- functionName: "mint", // functin name is only valid if it's got a proc-context
56
- contractAddress: "token_0_0",
57
- args: [[7n, 18]],
58
- satsPerVByte: 1,
59
- utxos: [
60
- "57f1f46857ab12e20f32ecaac780b4096b0951458e15ab08e2ce0992f0521323:0",
61
- ],
62
- gas: 10n,
63
- });
208
+ // const res = await kontorPublicClient.procContract({
209
+ // wit: wit,
210
+ // // TODO: add optional account override
211
+ //
212
+ // functionName: "mint", // functin name is only valid if it's got a proc-context
213
+ // contractAddress: "token_0_0",
214
+ // args: [[7n, 18]],
215
+ // satsPerVByte: 1,
216
+ // utxos: [
217
+ // "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
218
+ // ],
219
+ // gas: 10n,
220
+ // });
64
221
 
65
- // @ts-ignore
66
- const commit_: Transaction = await kontorWalletClient.signCommit({
222
+ const commit: Transaction = await kontorWalletClient.signCommit({
67
223
  account: account,
68
224
  chain: signet,
69
225
  psbt: res.result.commit_psbt_hex,
@@ -76,8 +232,30 @@ test("e2e kontor wallet client", async () => {
76
232
  parcipantScripts: res.result.per_participant,
77
233
  });
78
234
 
235
+ const commitExtracted = commit.extract();
79
236
  const revealExtracted = reveal.extract();
80
237
 
238
+ // const m = await btcPublicClient.testMempoolAccept({
239
+ // rawtx: [hex.encode(commitExtracted), hex.encode(revealExtracted)],
240
+ // options: {},
241
+ // });
242
+
243
+ const r = await fetch("https://signet.kontor.network:38332", {
244
+ method: "POST",
245
+ headers: {
246
+ "Content-Type": "application/json",
247
+ Authorization: `Basic ${Buffer.from("rpc:rpc").toString("base64")}`,
248
+ },
249
+ body: JSON.stringify({
250
+ method: "testmempoolaccept",
251
+ params: [[hex.encode(commitExtracted), hex.encode(revealExtracted)]],
252
+ }),
253
+ });
254
+
255
+ const mempoolAccept = await r.json();
256
+
257
+ console.log({ mempoolAccept: mempoolAccept.result });
258
+ //
81
259
  const op = await kontorPublicClient.inspect({
82
260
  hex: hex.encode(revealExtracted),
83
261
  });
@@ -1,10 +1,5 @@
1
1
  import type { Prettify } from "../../wit/type-utils.js";
2
2
 
3
- // import type {
4
- // TestMempoolAcceptParams,
5
- // TestMempoolAcceptReturnType,
6
- // } from "../actions/public/test-mempool-accept.js";
7
-
8
3
  import type { RpcRequestFn, RpcSchema, RpcSchemaEntry } from "./rpc-schema.js";
9
4
 
10
5
  export type SendRawTransactionParams = [
@@ -16,18 +11,24 @@ export interface SendRawTransactionReturnType {
16
11
  txid: string;
17
12
  }
18
13
 
14
+ export type TestMempoolAcceptParams = [
15
+ txs: string[],
16
+ opts?: { maxFeeRate: number | string },
17
+ ];
18
+
19
+ export type TestMempoolAcceptReturnType = any;
20
+
19
21
  export type BtcRpcSchema = readonly [
20
22
  RpcSchemaEntry<
21
23
  "sendrawtransaction",
22
24
  SendRawTransactionParams,
23
25
  SendRawTransactionReturnType
24
26
  >,
25
- // RpcSchemaEntry<
26
- // "testmempoolaccept",
27
- // // todo add options
28
- // [TestMempoolAcceptParams["rawtx"]],
29
- // string[][]
30
- // >,
27
+ RpcSchemaEntry<
28
+ "testmempoolaccept",
29
+ TestMempoolAcceptParams,
30
+ TestMempoolAcceptReturnType
31
+ >,
31
32
  ];
32
33
 
33
34
  export type BtcNodeRequestFn<
@@ -7,8 +7,10 @@ import type {
7
7
  OpWithResult as OpWithResult_,
8
8
  ViewResult as ViewResult_,
9
9
  InstructionQuery as InstructionQuery_,
10
+ Inst as Inst_,
10
11
  ParticipantScripts as ParticipantScripts_,
11
12
  } from "@kontor/kontor-ts";
13
+
12
14
  import type { ResolvedRegister } from "../../wit/register.js";
13
15
 
14
16
  import type { HttpSchemaEntry, HttpParameters } from "./http-schema.js";
@@ -31,6 +33,42 @@ export type InstructionQuery = InstructionQuery_;
31
33
 
32
34
  export type ParticipantScripts = ParticipantScripts_;
33
35
 
36
+ export type Inst = Inst_;
37
+
38
+ export namespace Instruction {
39
+ export function publish(params: {
40
+ name: string;
41
+ bytes: number[]; // or Uint8Array
42
+ gasLimit: bigint;
43
+ }): Inst {
44
+ return {
45
+ Publish: {
46
+ gas_limit: Number(params.gasLimit),
47
+ name: params.name,
48
+ bytes: params.bytes,
49
+ },
50
+ };
51
+ }
52
+
53
+ export function call(params: {
54
+ contract: ResolvedRegister["contractAddress"]; // stricter than plain string if you want
55
+ expr: string;
56
+ gasLimit: bigint;
57
+ }): Inst {
58
+ return {
59
+ Call: {
60
+ gas_limit: Number(params.gasLimit),
61
+ contract: params.contract,
62
+ expr: params.expr,
63
+ },
64
+ };
65
+ }
66
+
67
+ export function issuance(): Inst {
68
+ return "Issuance";
69
+ }
70
+ }
71
+
34
72
  export type KontorSchemaPublic = readonly [
35
73
  HttpSchemaEntry<
36
74
  "/contracts/:contractAddress",
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,16 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,96 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,28 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/types.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"}