@gnolang/tm2-js-client 1.3.3 → 2.0.1

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 (316) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.cjs +12 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.mjs +12 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.cjs +14 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.mjs +14 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.cjs +9 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.mjs +9 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.cjs +16 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.mjs +11 -0
  10. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  11. package/dist/index.cjs +92 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +23 -0
  14. package/dist/index.d.cts.map +1 -0
  15. package/dist/index.d.mts +23 -0
  16. package/dist/index.d.mts.map +1 -0
  17. package/dist/index.mjs +22 -0
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/proto/google/protobuf/any.cjs +84 -0
  20. package/dist/proto/google/protobuf/any.cjs.map +1 -0
  21. package/dist/proto/google/protobuf/any.d.cts +141 -0
  22. package/dist/proto/google/protobuf/any.d.cts.map +1 -0
  23. package/dist/proto/google/protobuf/any.d.mts +141 -0
  24. package/dist/proto/google/protobuf/any.d.mts.map +1 -0
  25. package/dist/proto/google/protobuf/any.mjs +83 -0
  26. package/dist/proto/google/protobuf/any.mjs.map +1 -0
  27. package/dist/proto/index.cjs +2 -0
  28. package/dist/proto/index.d.cts +2 -0
  29. package/dist/proto/index.d.mts +2 -0
  30. package/dist/proto/index.mjs +3 -0
  31. package/dist/proto/tm2/abci.cjs +182 -0
  32. package/dist/proto/tm2/abci.cjs.map +1 -0
  33. package/dist/proto/tm2/abci.d.cts +33 -0
  34. package/dist/proto/tm2/abci.d.cts.map +1 -0
  35. package/dist/proto/tm2/abci.d.mts +33 -0
  36. package/dist/proto/tm2/abci.d.mts.map +1 -0
  37. package/dist/proto/tm2/abci.mjs +181 -0
  38. package/dist/proto/tm2/abci.mjs.map +1 -0
  39. package/dist/proto/tm2/tx.cjs +263 -0
  40. package/dist/proto/tm2/tx.cjs.map +1 -0
  41. package/dist/proto/tm2/tx.d.cts +49 -0
  42. package/dist/proto/tm2/tx.d.cts.map +1 -0
  43. package/dist/proto/tm2/tx.d.mts +49 -0
  44. package/dist/proto/tm2/tx.d.mts.map +1 -0
  45. package/dist/proto/tm2/tx.mjs +258 -0
  46. package/dist/proto/tm2/tx.mjs.map +1 -0
  47. package/dist/provider/endpoints.cjs +43 -0
  48. package/dist/provider/endpoints.cjs.map +1 -0
  49. package/dist/provider/endpoints.d.cts +33 -0
  50. package/dist/provider/endpoints.d.cts.map +1 -0
  51. package/dist/provider/endpoints.d.mts +33 -0
  52. package/dist/provider/endpoints.d.mts.map +1 -0
  53. package/dist/provider/endpoints.mjs +39 -0
  54. package/dist/provider/endpoints.mjs.map +1 -0
  55. package/dist/provider/errors/errors.cjs +122 -0
  56. package/dist/provider/errors/errors.cjs.map +1 -0
  57. package/dist/provider/errors/errors.d.cts +62 -0
  58. package/dist/provider/errors/errors.d.cts.map +1 -0
  59. package/dist/provider/errors/errors.d.mts +62 -0
  60. package/dist/provider/errors/errors.d.mts.map +1 -0
  61. package/dist/provider/errors/errors.mjs +104 -0
  62. package/dist/provider/errors/errors.mjs.map +1 -0
  63. package/dist/provider/errors/messages.cjs +40 -0
  64. package/dist/provider/errors/messages.cjs.map +1 -0
  65. package/dist/provider/errors/messages.mjs +23 -0
  66. package/dist/provider/errors/messages.mjs.map +1 -0
  67. package/dist/provider/index.cjs +12 -0
  68. package/dist/provider/index.d.cts +11 -0
  69. package/dist/provider/index.d.mts +11 -0
  70. package/dist/provider/index.mjs +13 -0
  71. package/dist/provider/jsonrpc/index.cjs +1 -0
  72. package/dist/provider/jsonrpc/index.d.cts +1 -0
  73. package/dist/provider/jsonrpc/index.d.mts +1 -0
  74. package/dist/provider/jsonrpc/index.mjs +2 -0
  75. package/dist/provider/jsonrpc/jsonrpc.cjs +20 -0
  76. package/dist/provider/jsonrpc/jsonrpc.cjs.map +1 -0
  77. package/dist/provider/jsonrpc/jsonrpc.d.cts +16 -0
  78. package/dist/provider/jsonrpc/jsonrpc.d.cts.map +1 -0
  79. package/dist/provider/jsonrpc/jsonrpc.d.mts +16 -0
  80. package/dist/provider/jsonrpc/jsonrpc.d.mts.map +1 -0
  81. package/dist/provider/jsonrpc/jsonrpc.mjs +19 -0
  82. package/dist/provider/jsonrpc/jsonrpc.mjs.map +1 -0
  83. package/dist/provider/provider.cjs +130 -0
  84. package/dist/provider/provider.cjs.map +1 -0
  85. package/dist/provider/provider.d.cts +130 -0
  86. package/dist/provider/provider.d.cts.map +1 -0
  87. package/dist/provider/provider.d.mts +130 -0
  88. package/dist/provider/provider.d.mts.map +1 -0
  89. package/dist/provider/provider.mjs +130 -0
  90. package/dist/provider/provider.mjs.map +1 -0
  91. package/dist/provider/types/abci.cjs +6 -0
  92. package/dist/provider/types/abci.cjs.map +1 -0
  93. package/dist/provider/types/abci.d.cts +42 -0
  94. package/dist/provider/types/abci.d.cts.map +1 -0
  95. package/dist/provider/types/abci.d.mts +42 -0
  96. package/dist/provider/types/abci.d.mts.map +1 -0
  97. package/dist/provider/types/abci.mjs +6 -0
  98. package/dist/provider/types/abci.mjs.map +1 -0
  99. package/dist/provider/types/common.d.cts +186 -0
  100. package/dist/provider/types/common.d.cts.map +1 -0
  101. package/dist/provider/types/common.d.mts +186 -0
  102. package/dist/provider/types/common.d.mts.map +1 -0
  103. package/dist/provider/types/jsonrpc.d.cts +30 -0
  104. package/dist/provider/types/jsonrpc.d.cts.map +1 -0
  105. package/dist/provider/types/jsonrpc.d.mts +30 -0
  106. package/dist/provider/types/jsonrpc.d.mts.map +1 -0
  107. package/dist/provider/utility/adapters.cjs +241 -0
  108. package/dist/provider/utility/adapters.cjs.map +1 -0
  109. package/dist/provider/utility/adapters.d.cts +19 -0
  110. package/dist/provider/utility/adapters.d.cts.map +1 -0
  111. package/dist/provider/utility/adapters.d.mts +19 -0
  112. package/dist/provider/utility/adapters.d.mts.map +1 -0
  113. package/dist/provider/utility/adapters.mjs +231 -0
  114. package/dist/provider/utility/adapters.mjs.map +1 -0
  115. package/dist/provider/utility/errors.utility.cjs +38 -0
  116. package/dist/provider/utility/errors.utility.cjs.map +1 -0
  117. package/dist/provider/utility/errors.utility.mjs +38 -0
  118. package/dist/provider/utility/errors.utility.mjs.map +1 -0
  119. package/dist/provider/utility/index.cjs +3 -0
  120. package/dist/provider/utility/index.d.cts +3 -0
  121. package/dist/provider/utility/index.d.mts +3 -0
  122. package/dist/provider/utility/index.mjs +4 -0
  123. package/dist/provider/utility/provider.utility.cjs +122 -0
  124. package/dist/provider/utility/provider.utility.cjs.map +1 -0
  125. package/{bin/provider/utility/provider.utility.d.ts → dist/provider/utility/provider.utility.d.cts} +15 -10
  126. package/dist/provider/utility/provider.utility.d.cts.map +1 -0
  127. package/dist/provider/utility/provider.utility.d.mts +45 -0
  128. package/dist/provider/utility/provider.utility.d.mts.map +1 -0
  129. package/dist/provider/utility/provider.utility.mjs +116 -0
  130. package/dist/provider/utility/provider.utility.mjs.map +1 -0
  131. package/dist/provider/utility/requests.utility.cjs +75 -0
  132. package/dist/provider/utility/requests.utility.cjs.map +1 -0
  133. package/dist/provider/utility/requests.utility.d.cts +40 -0
  134. package/dist/provider/utility/requests.utility.d.cts.map +1 -0
  135. package/dist/provider/utility/requests.utility.d.mts +40 -0
  136. package/dist/provider/utility/requests.utility.d.mts.map +1 -0
  137. package/dist/provider/utility/requests.utility.mjs +68 -0
  138. package/dist/provider/utility/requests.utility.mjs.map +1 -0
  139. package/dist/provider/websocket/index.cjs +1 -0
  140. package/dist/provider/websocket/index.d.cts +1 -0
  141. package/dist/provider/websocket/index.d.mts +1 -0
  142. package/dist/provider/websocket/index.mjs +2 -0
  143. package/dist/provider/websocket/ws.cjs +27 -0
  144. package/dist/provider/websocket/ws.cjs.map +1 -0
  145. package/dist/provider/websocket/ws.d.cts +21 -0
  146. package/dist/provider/websocket/ws.d.cts.map +1 -0
  147. package/dist/provider/websocket/ws.d.mts +21 -0
  148. package/dist/provider/websocket/ws.d.mts.map +1 -0
  149. package/dist/provider/websocket/ws.mjs +26 -0
  150. package/dist/provider/websocket/ws.mjs.map +1 -0
  151. package/dist/services/index.cjs +1 -0
  152. package/dist/services/index.d.cts +2 -0
  153. package/dist/services/index.d.mts +2 -0
  154. package/dist/services/index.mjs +2 -0
  155. package/dist/services/rest/restService.cjs +16 -0
  156. package/dist/services/rest/restService.cjs.map +1 -0
  157. package/dist/services/rest/restService.d.cts +9 -0
  158. package/dist/services/rest/restService.d.cts.map +1 -0
  159. package/dist/services/rest/restService.d.mts +9 -0
  160. package/dist/services/rest/restService.d.mts.map +1 -0
  161. package/dist/services/rest/restService.mjs +14 -0
  162. package/dist/services/rest/restService.mjs.map +1 -0
  163. package/dist/services/rest/restService.types.d.cts +11 -0
  164. package/dist/services/rest/restService.types.d.cts.map +1 -0
  165. package/dist/services/rest/restService.types.d.mts +11 -0
  166. package/dist/services/rest/restService.types.d.mts.map +1 -0
  167. package/dist/wallet/index.cjs +8 -0
  168. package/dist/wallet/index.d.cts +7 -0
  169. package/dist/wallet/index.d.mts +7 -0
  170. package/dist/wallet/index.mjs +9 -0
  171. package/dist/wallet/key/index.cjs +1 -0
  172. package/dist/wallet/key/index.mjs +2 -0
  173. package/dist/wallet/key/key.cjs +46 -0
  174. package/dist/wallet/key/key.cjs.map +1 -0
  175. package/dist/wallet/key/key.d.cts +26 -0
  176. package/dist/wallet/key/key.d.cts.map +1 -0
  177. package/dist/wallet/key/key.d.mts +26 -0
  178. package/dist/wallet/key/key.d.mts.map +1 -0
  179. package/dist/wallet/key/key.mjs +45 -0
  180. package/dist/wallet/key/key.mjs.map +1 -0
  181. package/dist/wallet/ledger/index.cjs +1 -0
  182. package/dist/wallet/ledger/index.d.cts +1 -0
  183. package/dist/wallet/ledger/index.d.mts +1 -0
  184. package/dist/wallet/ledger/index.mjs +2 -0
  185. package/dist/wallet/ledger/ledger.cjs +49 -0
  186. package/dist/wallet/ledger/ledger.cjs.map +1 -0
  187. package/dist/wallet/ledger/ledger.d.cts +27 -0
  188. package/dist/wallet/ledger/ledger.d.cts.map +1 -0
  189. package/dist/wallet/ledger/ledger.d.mts +27 -0
  190. package/dist/wallet/ledger/ledger.d.mts.map +1 -0
  191. package/dist/wallet/ledger/ledger.mjs +48 -0
  192. package/dist/wallet/ledger/ledger.mjs.map +1 -0
  193. package/dist/wallet/signer.d.cts +33 -0
  194. package/dist/wallet/signer.d.cts.map +1 -0
  195. package/dist/wallet/signer.d.mts +33 -0
  196. package/dist/wallet/signer.d.mts.map +1 -0
  197. package/dist/wallet/types/sign.cjs +6 -0
  198. package/dist/wallet/types/sign.cjs.map +1 -0
  199. package/dist/wallet/types/sign.d.cts +20 -0
  200. package/dist/wallet/types/sign.d.cts.map +1 -0
  201. package/dist/wallet/types/sign.d.mts +20 -0
  202. package/dist/wallet/types/sign.d.mts.map +1 -0
  203. package/dist/wallet/types/sign.mjs +6 -0
  204. package/dist/wallet/types/sign.mjs.map +1 -0
  205. package/dist/wallet/types/wallet.d.cts +9 -0
  206. package/dist/wallet/types/wallet.d.cts.map +1 -0
  207. package/dist/wallet/types/wallet.d.mts +9 -0
  208. package/dist/wallet/types/wallet.d.mts.map +1 -0
  209. package/dist/wallet/utility/index.cjs +1 -0
  210. package/dist/wallet/utility/index.d.cts +1 -0
  211. package/dist/wallet/utility/index.d.mts +1 -0
  212. package/dist/wallet/utility/index.mjs +2 -0
  213. package/dist/wallet/utility/utility.cjs +83 -0
  214. package/dist/wallet/utility/utility.cjs.map +1 -0
  215. package/dist/wallet/utility/utility.d.cts +42 -0
  216. package/dist/wallet/utility/utility.d.cts.map +1 -0
  217. package/dist/wallet/utility/utility.d.mts +42 -0
  218. package/dist/wallet/utility/utility.d.mts.map +1 -0
  219. package/dist/wallet/utility/utility.mjs +75 -0
  220. package/dist/wallet/utility/utility.mjs.map +1 -0
  221. package/dist/wallet/wallet.cjs +223 -0
  222. package/dist/wallet/wallet.cjs.map +1 -0
  223. package/dist/wallet/wallet.d.cts +113 -0
  224. package/dist/wallet/wallet.d.cts.map +1 -0
  225. package/dist/wallet/wallet.d.mts +113 -0
  226. package/dist/wallet/wallet.d.mts.map +1 -0
  227. package/dist/wallet/wallet.mjs +222 -0
  228. package/dist/wallet/wallet.mjs.map +1 -0
  229. package/package.json +57 -38
  230. package/bin/index.d.ts +0 -4
  231. package/bin/index.js +0 -20
  232. package/bin/proto/google/protobuf/any.d.ts +0 -145
  233. package/bin/proto/google/protobuf/any.js +0 -113
  234. package/bin/proto/index.d.ts +0 -2
  235. package/bin/proto/index.js +0 -20
  236. package/bin/proto/tm2/abci.d.ts +0 -37
  237. package/bin/proto/tm2/abci.js +0 -277
  238. package/bin/proto/tm2/multisig.d.ts +0 -43
  239. package/bin/proto/tm2/multisig.js +0 -322
  240. package/bin/proto/tm2/multisig.test.d.ts +0 -1
  241. package/bin/proto/tm2/multisig.test.js +0 -63
  242. package/bin/proto/tm2/tx.d.ts +0 -52
  243. package/bin/proto/tm2/tx.js +0 -360
  244. package/bin/provider/endpoints.d.ts +0 -29
  245. package/bin/provider/endpoints.js +0 -37
  246. package/bin/provider/errors/errors.d.ts +0 -59
  247. package/bin/provider/errors/errors.js +0 -173
  248. package/bin/provider/errors/index.d.ts +0 -1
  249. package/bin/provider/errors/index.js +0 -17
  250. package/bin/provider/errors/messages.d.ts +0 -19
  251. package/bin/provider/errors/messages.js +0 -41
  252. package/bin/provider/index.d.ts +0 -7
  253. package/bin/provider/index.js +0 -23
  254. package/bin/provider/jsonrpc/index.d.ts +0 -1
  255. package/bin/provider/jsonrpc/index.js +0 -17
  256. package/bin/provider/jsonrpc/jsonrpc.d.ts +0 -31
  257. package/bin/provider/jsonrpc/jsonrpc.js +0 -327
  258. package/bin/provider/jsonrpc/jsonrpc.test.d.ts +0 -1
  259. package/bin/provider/jsonrpc/jsonrpc.test.js +0 -488
  260. package/bin/provider/provider.d.ts +0 -98
  261. package/bin/provider/provider.js +0 -2
  262. package/bin/provider/types/abci.d.ts +0 -39
  263. package/bin/provider/types/abci.js +0 -4
  264. package/bin/provider/types/common.d.ts +0 -184
  265. package/bin/provider/types/common.js +0 -3
  266. package/bin/provider/types/index.d.ts +0 -3
  267. package/bin/provider/types/index.js +0 -19
  268. package/bin/provider/types/jsonrpc.d.ts +0 -26
  269. package/bin/provider/types/jsonrpc.js +0 -2
  270. package/bin/provider/utility/errors.utility.d.ts +0 -11
  271. package/bin/provider/utility/errors.utility.js +0 -56
  272. package/bin/provider/utility/index.d.ts +0 -2
  273. package/bin/provider/utility/index.js +0 -18
  274. package/bin/provider/utility/provider.utility.js +0 -244
  275. package/bin/provider/utility/requests.utility.d.ts +0 -35
  276. package/bin/provider/utility/requests.utility.js +0 -80
  277. package/bin/provider/websocket/index.d.ts +0 -1
  278. package/bin/provider/websocket/index.js +0 -17
  279. package/bin/provider/websocket/ws.d.ts +0 -58
  280. package/bin/provider/websocket/ws.js +0 -415
  281. package/bin/provider/websocket/ws.test.d.ts +0 -1
  282. package/bin/provider/websocket/ws.test.js +0 -648
  283. package/bin/services/index.d.ts +0 -2
  284. package/bin/services/index.js +0 -18
  285. package/bin/services/rest/restService.d.ts +0 -4
  286. package/bin/services/rest/restService.js +0 -72
  287. package/bin/services/rest/restService.types.d.ts +0 -6
  288. package/bin/services/rest/restService.types.js +0 -2
  289. package/bin/wallet/index.d.ts +0 -6
  290. package/bin/wallet/index.js +0 -22
  291. package/bin/wallet/key/index.d.ts +0 -1
  292. package/bin/wallet/key/index.js +0 -17
  293. package/bin/wallet/key/key.d.ts +0 -21
  294. package/bin/wallet/key/key.js +0 -102
  295. package/bin/wallet/key/key.test.d.ts +0 -1
  296. package/bin/wallet/key/key.test.js +0 -121
  297. package/bin/wallet/ledger/index.d.ts +0 -1
  298. package/bin/wallet/ledger/index.js +0 -17
  299. package/bin/wallet/ledger/ledger.d.ts +0 -22
  300. package/bin/wallet/ledger/ledger.js +0 -109
  301. package/bin/wallet/signer.d.ts +0 -29
  302. package/bin/wallet/signer.js +0 -2
  303. package/bin/wallet/types/index.d.ts +0 -2
  304. package/bin/wallet/types/index.js +0 -18
  305. package/bin/wallet/types/sign.d.ts +0 -16
  306. package/bin/wallet/types/sign.js +0 -4
  307. package/bin/wallet/types/wallet.d.ts +0 -5
  308. package/bin/wallet/types/wallet.js +0 -2
  309. package/bin/wallet/utility/index.d.ts +0 -1
  310. package/bin/wallet/utility/index.js +0 -17
  311. package/bin/wallet/utility/utility.d.ts +0 -36
  312. package/bin/wallet/utility/utility.js +0 -117
  313. package/bin/wallet/wallet.d.ts +0 -106
  314. package/bin/wallet/wallet.js +0 -361
  315. package/bin/wallet/wallet.test.d.ts +0 -1
  316. package/bin/wallet/wallet.test.js +0 -423
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./utility"), exports);
@@ -1,36 +0,0 @@
1
- import { HdPath } from '@cosmjs/crypto';
2
- /**
3
- * Generates the HD path, for the specified index, in the form 'm/44'/118'/0'/0/i',
4
- * where 'i' is the account index
5
- * @param {number} [index=0] the account index
6
- */
7
- export declare const generateHDPath: (index?: number) => HdPath;
8
- /**
9
- * Generates random entropy of the specified size (in B)
10
- * @param {number} [size=32] the entropy size in bytes
11
- */
12
- export declare const generateEntropy: (size?: number) => Uint8Array;
13
- interface keyPair {
14
- privateKey: Uint8Array;
15
- publicKey: Uint8Array;
16
- }
17
- /**
18
- * Generates a new Secp256k1 key-pair using
19
- * the provided English mnemonic and account index
20
- * @param {string} mnemonic the English mnemonic
21
- * @param {number} [accountIndex=0] the account index
22
- */
23
- export declare const generateKeyPair: (mnemonic: string, accountIndex?: number) => Promise<keyPair>;
24
- export declare const defaultAddressPrefix = "g";
25
- /**
26
- * Encodes a string into a Uint8Array
27
- * @param {string} str the string to be encoded
28
- */
29
- export declare const stringToUTF8: (str: string) => Uint8Array;
30
- /**
31
- * Escapes <,>,& in string.
32
- * Golang's json marshaller escapes <,>,& by default.
33
- * https://cs.opensource.google/go/go/+/refs/tags/go1.20.6:src/encoding/json/encode.go;l=46-53
34
- */
35
- export declare function encodeCharacterSet(data: string): string;
36
- export {};
@@ -1,117 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.stringToUTF8 = exports.defaultAddressPrefix = exports.generateKeyPair = exports.generateEntropy = exports.generateHDPath = void 0;
43
- exports.encodeCharacterSet = encodeCharacterSet;
44
- var crypto_1 = require("@cosmjs/crypto");
45
- var crypto_2 = __importDefault(require("crypto"));
46
- /**
47
- * Generates the HD path, for the specified index, in the form 'm/44'/118'/0'/0/i',
48
- * where 'i' is the account index
49
- * @param {number} [index=0] the account index
50
- */
51
- var generateHDPath = function (index) {
52
- return [
53
- crypto_1.Slip10RawIndex.hardened(44),
54
- crypto_1.Slip10RawIndex.hardened(118),
55
- crypto_1.Slip10RawIndex.hardened(0),
56
- crypto_1.Slip10RawIndex.normal(0),
57
- crypto_1.Slip10RawIndex.normal(index ? index : 0),
58
- ];
59
- };
60
- exports.generateHDPath = generateHDPath;
61
- /**
62
- * Generates random entropy of the specified size (in B)
63
- * @param {number} [size=32] the entropy size in bytes
64
- */
65
- var generateEntropy = function (size) {
66
- var array = new Uint8Array(size ? size : 32);
67
- // Generate random data
68
- crypto_2.default.randomFillSync(array);
69
- return array;
70
- };
71
- exports.generateEntropy = generateEntropy;
72
- /**
73
- * Generates a new Secp256k1 key-pair using
74
- * the provided English mnemonic and account index
75
- * @param {string} mnemonic the English mnemonic
76
- * @param {number} [accountIndex=0] the account index
77
- */
78
- var generateKeyPair = function (mnemonic, accountIndex) { return __awaiter(void 0, void 0, void 0, function () {
79
- var seed, privateKey, publicKey;
80
- return __generator(this, function (_a) {
81
- switch (_a.label) {
82
- case 0: return [4 /*yield*/, crypto_1.Bip39.mnemonicToSeed(new crypto_1.EnglishMnemonic(mnemonic))];
83
- case 1:
84
- seed = _a.sent();
85
- privateKey = crypto_1.Slip10.derivePath(crypto_1.Slip10Curve.Secp256k1, seed, (0, exports.generateHDPath)(accountIndex)).privkey;
86
- return [4 /*yield*/, crypto_1.Secp256k1.makeKeypair(privateKey)];
87
- case 2:
88
- publicKey = (_a.sent()).pubkey;
89
- return [2 /*return*/, {
90
- publicKey: publicKey,
91
- privateKey: privateKey,
92
- }];
93
- }
94
- });
95
- }); };
96
- exports.generateKeyPair = generateKeyPair;
97
- // Address prefix for TM2 networks
98
- exports.defaultAddressPrefix = 'g';
99
- /**
100
- * Encodes a string into a Uint8Array
101
- * @param {string} str the string to be encoded
102
- */
103
- var stringToUTF8 = function (str) {
104
- return new TextEncoder().encode(str);
105
- };
106
- exports.stringToUTF8 = stringToUTF8;
107
- /**
108
- * Escapes <,>,& in string.
109
- * Golang's json marshaller escapes <,>,& by default.
110
- * https://cs.opensource.google/go/go/+/refs/tags/go1.20.6:src/encoding/json/encode.go;l=46-53
111
- */
112
- function encodeCharacterSet(data) {
113
- return data
114
- .replace(/</g, '\\u003c')
115
- .replace(/>/g, '\\u003e')
116
- .replace(/&/g, '\\u0026');
117
- }
@@ -1,106 +0,0 @@
1
- import { BroadcastTransactionMap, Provider } from '../provider';
2
- import { Signer } from './signer';
3
- import { LedgerConnector } from '@cosmjs/ledger-amino';
4
- import { Any, Tx } from '../proto';
5
- import { AccountWalletOption, CreateWalletOptions } from './types';
6
- export interface SignTransactionOptions {
7
- accountNumber?: string;
8
- sequence?: string;
9
- }
10
- /**
11
- * Wallet is a single account abstraction
12
- * that can interact with the blockchain
13
- */
14
- export declare class Wallet {
15
- protected provider: Provider;
16
- protected signer: Signer;
17
- /**
18
- * Connects the wallet to the specified {@link Provider}
19
- * @param {Provider} provider the active {@link Provider}, if any
20
- */
21
- connect: (provider: Provider) => void;
22
- /**
23
- * Generates a private key-based wallet, using a random seed
24
- * @param {AccountWalletOption} options the account options
25
- */
26
- static createRandom: (options?: AccountWalletOption) => Promise<Wallet>;
27
- /**
28
- * Generates a custom signer-based wallet
29
- * @param {Signer} signer the custom signer implementing the Signer interface
30
- * @param {CreateWalletOptions} options the wallet generation options
31
- */
32
- static fromSigner: (signer: Signer) => Promise<Wallet>;
33
- /**
34
- * Generates a bip39 mnemonic-based wallet
35
- * @param {string} mnemonic the bip39 mnemonic
36
- * @param {CreateWalletOptions} options the wallet generation options
37
- */
38
- static fromMnemonic: (mnemonic: string, options?: CreateWalletOptions) => Promise<Wallet>;
39
- /**
40
- * Generates a private key-based wallet
41
- * @param {string} privateKey the private key
42
- * @param {AccountWalletOption} options the account options
43
- */
44
- static fromPrivateKey: (privateKey: Uint8Array, options?: AccountWalletOption) => Promise<Wallet>;
45
- /**
46
- * Creates a Ledger-based wallet
47
- * @param {LedgerConnector} connector the Ledger device connector
48
- * @param {CreateWalletOptions} options the wallet generation options
49
- */
50
- static fromLedger: (connector: LedgerConnector, options?: CreateWalletOptions) => Wallet;
51
- /**
52
- * Fetches the address associated with the wallet
53
- */
54
- getAddress: () => Promise<string>;
55
- /**
56
- * Fetches the account sequence for the wallet
57
- * @param {number} [height=latest] the block height
58
- */
59
- getAccountSequence: (height?: number) => Promise<number>;
60
- /**
61
- * Fetches the account number for the wallet. Errors out if the
62
- * account is not initialized
63
- * @param {number} [height=latest] the block height
64
- */
65
- getAccountNumber: (height?: number) => Promise<number>;
66
- /**
67
- * Fetches the account balance for the specific denomination
68
- * @param {string} [denomination=ugnot] the fund denomination
69
- */
70
- getBalance: (denomination?: string) => Promise<number>;
71
- /**
72
- * Fetches the current (recommended) average gas price
73
- */
74
- getGasPrice: () => Promise<number>;
75
- /**
76
- * Estimates the gas limit for the transaction
77
- * @param {Tx} tx the transaction that needs estimating
78
- */
79
- estimateGas: (tx: Tx) => Promise<number>;
80
- /**
81
- * Returns the connected provider, if any
82
- */
83
- getProvider: () => Provider;
84
- /**
85
- * Generates a transaction signature, and appends it to the transaction
86
- * @param {Tx} tx the transaction to be signed
87
- * @param {(messages: Any[]) => any[]} decodeTxMessages tx message decode callback
88
- * that should expand the concrete message fields into an object. Required because
89
- * the transaction sign bytes are generated using sorted JSON, which requires
90
- * encoded message values to be decoded for sorting
91
- */
92
- signTransaction: (tx: Tx, decodeTxMessages: (messages: Any[]) => any[], opts?: SignTransactionOptions) => Promise<Tx>;
93
- /**
94
- * Encodes and sends the transaction. If the type of endpoint
95
- * is a broadcast commit, waits for the transaction to be committed to the chain.
96
- * The transaction needs to be signed beforehand.
97
- * Returns the transaction hash (base-64)
98
- * @param {Tx} tx the signed transaction
99
- * @param {BroadcastType} endpoint the transaction broadcast type (sync / commit)
100
- */
101
- sendTransaction<K extends keyof BroadcastTransactionMap>(tx: Tx, endpoint: K): Promise<BroadcastTransactionMap[K]['result']>;
102
- /**
103
- * Returns the associated signer
104
- */
105
- getSigner: () => Signer;
106
- }
@@ -1,361 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
- if (ar || !(i in from)) {
52
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
- ar[i] = from[i];
54
- }
55
- }
56
- return to.concat(ar || Array.prototype.slice.call(from));
57
- };
58
- Object.defineProperty(exports, "__esModule", { value: true });
59
- exports.Wallet = void 0;
60
- var provider_1 = require("../provider");
61
- var ledger_1 = require("./ledger");
62
- var key_1 = require("./key");
63
- var crypto_1 = require("@cosmjs/crypto");
64
- var utility_1 = require("./utility");
65
- var bip39_1 = require("@cosmjs/crypto/build/bip39");
66
- var proto_1 = require("../proto");
67
- var types_1 = require("./types");
68
- var signdoc_1 = require("@cosmjs/amino/build/signdoc");
69
- /**
70
- * Wallet is a single account abstraction
71
- * that can interact with the blockchain
72
- */
73
- var Wallet = /** @class */ (function () {
74
- function Wallet() {
75
- var _this = this;
76
- /**
77
- * Connects the wallet to the specified {@link Provider}
78
- * @param {Provider} provider the active {@link Provider}, if any
79
- */
80
- this.connect = function (provider) {
81
- _this.provider = provider;
82
- };
83
- // Account manipulation //
84
- /**
85
- * Fetches the address associated with the wallet
86
- */
87
- this.getAddress = function () {
88
- return _this.signer.getAddress();
89
- };
90
- /**
91
- * Fetches the account sequence for the wallet
92
- * @param {number} [height=latest] the block height
93
- */
94
- this.getAccountSequence = function (height) { return __awaiter(_this, void 0, void 0, function () {
95
- var address;
96
- return __generator(this, function (_b) {
97
- switch (_b.label) {
98
- case 0:
99
- if (!this.provider) {
100
- throw new Error('provider not connected');
101
- }
102
- return [4 /*yield*/, this.getAddress()];
103
- case 1:
104
- address = _b.sent();
105
- return [2 /*return*/, this.provider.getAccountSequence(address, height)];
106
- }
107
- });
108
- }); };
109
- /**
110
- * Fetches the account number for the wallet. Errors out if the
111
- * account is not initialized
112
- * @param {number} [height=latest] the block height
113
- */
114
- this.getAccountNumber = function (height) { return __awaiter(_this, void 0, void 0, function () {
115
- var address;
116
- return __generator(this, function (_b) {
117
- switch (_b.label) {
118
- case 0:
119
- if (!this.provider) {
120
- throw new Error('provider not connected');
121
- }
122
- return [4 /*yield*/, this.getAddress()];
123
- case 1:
124
- address = _b.sent();
125
- return [2 /*return*/, this.provider.getAccountNumber(address, height)];
126
- }
127
- });
128
- }); };
129
- /**
130
- * Fetches the account balance for the specific denomination
131
- * @param {string} [denomination=ugnot] the fund denomination
132
- */
133
- this.getBalance = function (denomination) { return __awaiter(_this, void 0, void 0, function () {
134
- var address;
135
- return __generator(this, function (_b) {
136
- switch (_b.label) {
137
- case 0:
138
- if (!this.provider) {
139
- throw new Error('provider not connected');
140
- }
141
- return [4 /*yield*/, this.getAddress()];
142
- case 1:
143
- address = _b.sent();
144
- return [2 /*return*/, this.provider.getBalance(address, denomination ? denomination : 'ugnot')];
145
- }
146
- });
147
- }); };
148
- /**
149
- * Fetches the current (recommended) average gas price
150
- */
151
- this.getGasPrice = function () { return __awaiter(_this, void 0, void 0, function () {
152
- return __generator(this, function (_b) {
153
- if (!this.provider) {
154
- throw new Error('provider not connected');
155
- }
156
- return [2 /*return*/, this.provider.getGasPrice()];
157
- });
158
- }); };
159
- /**
160
- * Estimates the gas limit for the transaction
161
- * @param {Tx} tx the transaction that needs estimating
162
- */
163
- this.estimateGas = function (tx) { return __awaiter(_this, void 0, void 0, function () {
164
- return __generator(this, function (_b) {
165
- if (!this.provider) {
166
- throw new Error('provider not connected');
167
- }
168
- return [2 /*return*/, this.provider.estimateGas(tx)];
169
- });
170
- }); };
171
- /**
172
- * Returns the connected provider, if any
173
- */
174
- this.getProvider = function () {
175
- return _this.provider;
176
- };
177
- /**
178
- * Generates a transaction signature, and appends it to the transaction
179
- * @param {Tx} tx the transaction to be signed
180
- * @param {(messages: Any[]) => any[]} decodeTxMessages tx message decode callback
181
- * that should expand the concrete message fields into an object. Required because
182
- * the transaction sign bytes are generated using sorted JSON, which requires
183
- * encoded message values to be decoded for sorting
184
- */
185
- this.signTransaction = function (tx, decodeTxMessages, opts) { return __awaiter(_this, void 0, void 0, function () {
186
- var status, chainID, accountNumber, accountSequence, address, account, publicKey, signPayload, signBytes, wrappedKey, txSignature;
187
- var _b;
188
- return __generator(this, function (_c) {
189
- switch (_c.label) {
190
- case 0:
191
- if (!this.provider) {
192
- throw new Error('provider not connected');
193
- }
194
- // Make sure the tx fee is initialized
195
- if (!tx.fee) {
196
- throw new Error('invalid transaction fee provided');
197
- }
198
- return [4 /*yield*/, this.provider.getStatus()];
199
- case 1:
200
- status = _c.sent();
201
- chainID = status.node_info.network;
202
- accountNumber = opts === null || opts === void 0 ? void 0 : opts.accountNumber;
203
- accountSequence = opts === null || opts === void 0 ? void 0 : opts.sequence;
204
- if (!(accountNumber === undefined || accountSequence === undefined)) return [3 /*break*/, 4];
205
- return [4 /*yield*/, this.getAddress()];
206
- case 2:
207
- address = _c.sent();
208
- return [4 /*yield*/, this.provider.getAccount(address)];
209
- case 3:
210
- account = _c.sent();
211
- if (accountNumber === undefined) {
212
- accountNumber = account.BaseAccount.account_number;
213
- }
214
- if (accountSequence === undefined) {
215
- accountSequence = account.BaseAccount.sequence;
216
- }
217
- _c.label = 4;
218
- case 4: return [4 /*yield*/, this.signer.getPublicKey()];
219
- case 5:
220
- publicKey = _c.sent();
221
- signPayload = {
222
- chain_id: chainID,
223
- account_number: accountNumber,
224
- sequence: accountSequence,
225
- fee: {
226
- gas_fee: tx.fee.gas_fee,
227
- gas_wanted: tx.fee.gas_wanted.toString(10),
228
- },
229
- msgs: decodeTxMessages(tx.messages), // unrolled message objects
230
- memo: tx.memo,
231
- };
232
- signBytes = (0, utility_1.stringToUTF8)((0, utility_1.encodeCharacterSet)((0, signdoc_1.sortedJsonStringify)(signPayload)));
233
- wrappedKey = {
234
- key: publicKey,
235
- };
236
- _b = {
237
- pub_key: {
238
- type_url: types_1.Secp256k1PubKeyType,
239
- value: proto_1.PubKeySecp256k1.encode(wrappedKey).finish(),
240
- }
241
- };
242
- return [4 /*yield*/, this.getSigner().signData(signBytes)];
243
- case 6:
244
- txSignature = (_b.signature = _c.sent(),
245
- _b);
246
- // Append the signature
247
- return [2 /*return*/, __assign(__assign({}, tx), { signatures: __spreadArray(__spreadArray([], tx.signatures, true), [txSignature], false) })];
248
- }
249
- });
250
- }); };
251
- /**
252
- * Returns the associated signer
253
- */
254
- this.getSigner = function () {
255
- return _this.signer;
256
- };
257
- }
258
- /**
259
- * Encodes and sends the transaction. If the type of endpoint
260
- * is a broadcast commit, waits for the transaction to be committed to the chain.
261
- * The transaction needs to be signed beforehand.
262
- * Returns the transaction hash (base-64)
263
- * @param {Tx} tx the signed transaction
264
- * @param {BroadcastType} endpoint the transaction broadcast type (sync / commit)
265
- */
266
- Wallet.prototype.sendTransaction = function (tx, endpoint) {
267
- return __awaiter(this, void 0, void 0, function () {
268
- var encodedTx;
269
- return __generator(this, function (_b) {
270
- if (!this.provider) {
271
- throw new Error('provider not connected');
272
- }
273
- encodedTx = (0, provider_1.uint8ArrayToBase64)(proto_1.Tx.encode(tx).finish());
274
- // Send the encoded transaction
275
- return [2 /*return*/, this.provider.sendTransaction(encodedTx, endpoint)];
276
- });
277
- });
278
- };
279
- var _a;
280
- _a = Wallet;
281
- // Wallet initialization //
282
- /**
283
- * Generates a private key-based wallet, using a random seed
284
- * @param {AccountWalletOption} options the account options
285
- */
286
- Wallet.createRandom = function (options) { return __awaiter(void 0, void 0, void 0, function () {
287
- var _b, publicKey, privateKey, wallet;
288
- return __generator(_a, function (_c) {
289
- switch (_c.label) {
290
- case 0: return [4 /*yield*/, (0, utility_1.generateKeyPair)((0, bip39_1.entropyToMnemonic)((0, utility_1.generateEntropy)()), 0)];
291
- case 1:
292
- _b = _c.sent(), publicKey = _b.publicKey, privateKey = _b.privateKey;
293
- wallet = new _a();
294
- wallet.signer = new key_1.KeySigner(privateKey, crypto_1.Secp256k1.compressPubkey(publicKey), options === null || options === void 0 ? void 0 : options.addressPrefix);
295
- return [2 /*return*/, wallet];
296
- }
297
- });
298
- }); };
299
- /**
300
- * Generates a custom signer-based wallet
301
- * @param {Signer} signer the custom signer implementing the Signer interface
302
- * @param {CreateWalletOptions} options the wallet generation options
303
- */
304
- Wallet.fromSigner = function (signer) { return __awaiter(void 0, void 0, void 0, function () {
305
- var wallet;
306
- return __generator(_a, function (_b) {
307
- wallet = new _a();
308
- wallet.signer = signer;
309
- return [2 /*return*/, wallet];
310
- });
311
- }); };
312
- /**
313
- * Generates a bip39 mnemonic-based wallet
314
- * @param {string} mnemonic the bip39 mnemonic
315
- * @param {CreateWalletOptions} options the wallet generation options
316
- */
317
- Wallet.fromMnemonic = function (mnemonic, options) { return __awaiter(void 0, void 0, void 0, function () {
318
- var _b, publicKey, privateKey, wallet;
319
- return __generator(_a, function (_c) {
320
- switch (_c.label) {
321
- case 0: return [4 /*yield*/, (0, utility_1.generateKeyPair)(mnemonic, options === null || options === void 0 ? void 0 : options.accountIndex)];
322
- case 1:
323
- _b = _c.sent(), publicKey = _b.publicKey, privateKey = _b.privateKey;
324
- wallet = new _a();
325
- wallet.signer = new key_1.KeySigner(privateKey, crypto_1.Secp256k1.compressPubkey(publicKey), options === null || options === void 0 ? void 0 : options.addressPrefix);
326
- return [2 /*return*/, wallet];
327
- }
328
- });
329
- }); };
330
- /**
331
- * Generates a private key-based wallet
332
- * @param {string} privateKey the private key
333
- * @param {AccountWalletOption} options the account options
334
- */
335
- Wallet.fromPrivateKey = function (privateKey, options) { return __awaiter(void 0, void 0, void 0, function () {
336
- var publicKey, wallet;
337
- return __generator(_a, function (_b) {
338
- switch (_b.label) {
339
- case 0: return [4 /*yield*/, crypto_1.Secp256k1.makeKeypair(privateKey)];
340
- case 1:
341
- publicKey = (_b.sent()).pubkey;
342
- wallet = new _a();
343
- wallet.signer = new key_1.KeySigner(privateKey, crypto_1.Secp256k1.compressPubkey(publicKey), options === null || options === void 0 ? void 0 : options.addressPrefix);
344
- return [2 /*return*/, wallet];
345
- }
346
- });
347
- }); };
348
- /**
349
- * Creates a Ledger-based wallet
350
- * @param {LedgerConnector} connector the Ledger device connector
351
- * @param {CreateWalletOptions} options the wallet generation options
352
- */
353
- Wallet.fromLedger = function (connector, options) {
354
- var _b;
355
- var wallet = new _a();
356
- wallet.signer = new ledger_1.LedgerSigner(connector, (_b = options === null || options === void 0 ? void 0 : options.accountIndex) !== null && _b !== void 0 ? _b : 0, options === null || options === void 0 ? void 0 : options.addressPrefix);
357
- return wallet;
358
- };
359
- return Wallet;
360
- }());
361
- exports.Wallet = Wallet;
@@ -1 +0,0 @@
1
- export {};