@arkecosystem/typescript-crypto 0.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 (278) hide show
  1. package/.editorconfig +16 -0
  2. package/.eslintrc.js +12 -0
  3. package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  4. package/.github/workflows/ci.yml +36 -0
  5. package/.github/workflows/publish.yml +56 -0
  6. package/.vscode/settings.json +2 -0
  7. package/README.md +31 -0
  8. package/dist/configuration/Network.d.ts +7 -0
  9. package/dist/configuration/Network.d.ts.map +1 -0
  10. package/dist/configuration/Network.js +12 -0
  11. package/dist/configuration/index.d.ts +2 -0
  12. package/dist/configuration/index.d.ts.map +1 -0
  13. package/dist/configuration/index.js +1 -0
  14. package/dist/enums/AbiFunction.d.ts +10 -0
  15. package/dist/enums/AbiFunction.d.ts.map +1 -0
  16. package/dist/enums/AbiFunction.js +10 -0
  17. package/dist/enums/Constants.d.ts +5 -0
  18. package/dist/enums/Constants.d.ts.map +1 -0
  19. package/dist/enums/Constants.js +5 -0
  20. package/dist/enums/ContractAbiType.d.ts +7 -0
  21. package/dist/enums/ContractAbiType.d.ts.map +1 -0
  22. package/dist/enums/ContractAbiType.js +7 -0
  23. package/dist/enums/ContractAddresses.d.ts +6 -0
  24. package/dist/enums/ContractAddresses.d.ts.map +1 -0
  25. package/dist/enums/ContractAddresses.js +6 -0
  26. package/dist/enums/index.d.ts +5 -0
  27. package/dist/enums/index.d.ts.map +1 -0
  28. package/dist/enums/index.js +4 -0
  29. package/dist/exceptions/InvalidUsernameException.d.ts +4 -0
  30. package/dist/exceptions/InvalidUsernameException.d.ts.map +1 -0
  31. package/dist/exceptions/InvalidUsernameException.js +6 -0
  32. package/dist/exceptions/index.d.ts +2 -0
  33. package/dist/exceptions/index.d.ts.map +1 -0
  34. package/dist/exceptions/index.js +1 -0
  35. package/dist/identities/Address.d.ts +7 -0
  36. package/dist/identities/Address.d.ts.map +1 -0
  37. package/dist/identities/Address.js +15 -0
  38. package/dist/identities/PrivateKey.d.ts +16 -0
  39. package/dist/identities/PrivateKey.d.ts.map +1 -0
  40. package/dist/identities/PrivateKey.js +31 -0
  41. package/dist/identities/PublicKey.d.ts +8 -0
  42. package/dist/identities/PublicKey.d.ts.map +1 -0
  43. package/dist/identities/PublicKey.js +24 -0
  44. package/dist/identities/WIF.d.ts +4 -0
  45. package/dist/identities/WIF.d.ts.map +1 -0
  46. package/dist/identities/WIF.js +13 -0
  47. package/dist/identities/index.d.ts +5 -0
  48. package/dist/identities/index.d.ts.map +1 -0
  49. package/dist/identities/index.js +4 -0
  50. package/dist/index.d.ts +8 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +24 -0
  53. package/dist/networks/AbstractNetwork.d.ts +6 -0
  54. package/dist/networks/AbstractNetwork.d.ts.map +1 -0
  55. package/dist/networks/AbstractNetwork.js +2 -0
  56. package/dist/networks/Mainnet.d.ts +7 -0
  57. package/dist/networks/Mainnet.d.ts.map +1 -0
  58. package/dist/networks/Mainnet.js +12 -0
  59. package/dist/networks/Testnet.d.ts +7 -0
  60. package/dist/networks/Testnet.d.ts.map +1 -0
  61. package/dist/networks/Testnet.js +12 -0
  62. package/dist/networks/index.d.ts +4 -0
  63. package/dist/networks/index.d.ts.map +1 -0
  64. package/dist/networks/index.js +3 -0
  65. package/dist/transactions/Deserializer.d.ts +18 -0
  66. package/dist/transactions/Deserializer.d.ts.map +1 -0
  67. package/dist/transactions/Deserializer.js +106 -0
  68. package/dist/transactions/Serializer.d.ts +9 -0
  69. package/dist/transactions/Serializer.d.ts.map +1 -0
  70. package/dist/transactions/Serializer.js +16 -0
  71. package/dist/transactions/builders/AbstractTransactionBuilder.d.ts +17 -0
  72. package/dist/transactions/builders/AbstractTransactionBuilder.d.ts.map +1 -0
  73. package/dist/transactions/builders/AbstractTransactionBuilder.js +54 -0
  74. package/dist/transactions/builders/EvmCallBuilder.d.ts +9 -0
  75. package/dist/transactions/builders/EvmCallBuilder.d.ts.map +1 -0
  76. package/dist/transactions/builders/EvmCallBuilder.js +18 -0
  77. package/dist/transactions/builders/MultipaymentBuilder.d.ts +9 -0
  78. package/dist/transactions/builders/MultipaymentBuilder.d.ts.map +1 -0
  79. package/dist/transactions/builders/MultipaymentBuilder.js +25 -0
  80. package/dist/transactions/builders/TransferBuilder.d.ts +8 -0
  81. package/dist/transactions/builders/TransferBuilder.d.ts.map +1 -0
  82. package/dist/transactions/builders/TransferBuilder.js +15 -0
  83. package/dist/transactions/builders/UnvoteBuilder.d.ts +8 -0
  84. package/dist/transactions/builders/UnvoteBuilder.d.ts.map +1 -0
  85. package/dist/transactions/builders/UnvoteBuilder.js +15 -0
  86. package/dist/transactions/builders/UsernameRegistrationBuilder.d.ts +9 -0
  87. package/dist/transactions/builders/UsernameRegistrationBuilder.d.ts.map +1 -0
  88. package/dist/transactions/builders/UsernameRegistrationBuilder.js +22 -0
  89. package/dist/transactions/builders/UsernameResignationBuilder.d.ts +8 -0
  90. package/dist/transactions/builders/UsernameResignationBuilder.d.ts.map +1 -0
  91. package/dist/transactions/builders/UsernameResignationBuilder.js +15 -0
  92. package/dist/transactions/builders/ValidatorRegistrationBuilder.d.ts +9 -0
  93. package/dist/transactions/builders/ValidatorRegistrationBuilder.d.ts.map +1 -0
  94. package/dist/transactions/builders/ValidatorRegistrationBuilder.js +20 -0
  95. package/dist/transactions/builders/ValidatorResignationBuilder.d.ts +8 -0
  96. package/dist/transactions/builders/ValidatorResignationBuilder.d.ts.map +1 -0
  97. package/dist/transactions/builders/ValidatorResignationBuilder.js +15 -0
  98. package/dist/transactions/builders/VoteBuilder.d.ts +9 -0
  99. package/dist/transactions/builders/VoteBuilder.d.ts.map +1 -0
  100. package/dist/transactions/builders/VoteBuilder.js +20 -0
  101. package/dist/transactions/builders/index.d.ts +11 -0
  102. package/dist/transactions/builders/index.d.ts.map +1 -0
  103. package/dist/transactions/builders/index.js +10 -0
  104. package/dist/transactions/index.d.ts +5 -0
  105. package/dist/transactions/index.d.ts.map +1 -0
  106. package/dist/transactions/index.js +4 -0
  107. package/dist/transactions/types/AbstractTransaction.d.ts +22 -0
  108. package/dist/transactions/types/AbstractTransaction.d.ts.map +1 -0
  109. package/dist/transactions/types/AbstractTransaction.js +79 -0
  110. package/dist/transactions/types/EvmCall.d.ts +8 -0
  111. package/dist/transactions/types/EvmCall.d.ts.map +1 -0
  112. package/dist/transactions/types/EvmCall.js +14 -0
  113. package/dist/transactions/types/Multipayment.d.ts +9 -0
  114. package/dist/transactions/types/Multipayment.d.ts.map +1 -0
  115. package/dist/transactions/types/Multipayment.js +38 -0
  116. package/dist/transactions/types/Transfer.d.ts +8 -0
  117. package/dist/transactions/types/Transfer.d.ts.map +1 -0
  118. package/dist/transactions/types/Transfer.js +14 -0
  119. package/dist/transactions/types/Unvote.d.ts +8 -0
  120. package/dist/transactions/types/Unvote.d.ts.map +1 -0
  121. package/dist/transactions/types/Unvote.js +16 -0
  122. package/dist/transactions/types/UsernameRegistration.d.ts +9 -0
  123. package/dist/transactions/types/UsernameRegistration.d.ts.map +1 -0
  124. package/dist/transactions/types/UsernameRegistration.js +33 -0
  125. package/dist/transactions/types/UsernameResignation.d.ts +8 -0
  126. package/dist/transactions/types/UsernameResignation.d.ts.map +1 -0
  127. package/dist/transactions/types/UsernameResignation.js +16 -0
  128. package/dist/transactions/types/ValidatorRegistration.d.ts +9 -0
  129. package/dist/transactions/types/ValidatorRegistration.d.ts.map +1 -0
  130. package/dist/transactions/types/ValidatorRegistration.js +33 -0
  131. package/dist/transactions/types/ValidatorResignation.d.ts +8 -0
  132. package/dist/transactions/types/ValidatorResignation.d.ts.map +1 -0
  133. package/dist/transactions/types/ValidatorResignation.js +16 -0
  134. package/dist/transactions/types/Vote.d.ts +9 -0
  135. package/dist/transactions/types/Vote.d.ts.map +1 -0
  136. package/dist/transactions/types/Vote.js +31 -0
  137. package/dist/transactions/types/index.d.ts +11 -0
  138. package/dist/transactions/types/index.d.ts.map +1 -0
  139. package/dist/transactions/types/index.js +10 -0
  140. package/dist/types.d.ts +72 -0
  141. package/dist/types.d.ts.map +1 -0
  142. package/dist/types.js +1 -0
  143. package/dist/utils/Abi/ArgumentDecoder.d.ts +10 -0
  144. package/dist/utils/Abi/ArgumentDecoder.d.ts.map +1 -0
  145. package/dist/utils/Abi/ArgumentDecoder.js +21 -0
  146. package/dist/utils/Abi/json/Abi.Consensus.json +1673 -0
  147. package/dist/utils/Abi/json/Abi.Multipayment.json +110 -0
  148. package/dist/utils/Abi/json/Abi.Usernames.json +900 -0
  149. package/dist/utils/AbiBase.d.ts +8 -0
  150. package/dist/utils/AbiBase.d.ts.map +1 -0
  151. package/dist/utils/AbiBase.js +25 -0
  152. package/dist/utils/AbiDecoder.d.ts +6 -0
  153. package/dist/utils/AbiDecoder.d.ts.map +1 -0
  154. package/dist/utils/AbiDecoder.js +14 -0
  155. package/dist/utils/AbiEncoder.d.ts +5 -0
  156. package/dist/utils/AbiEncoder.d.ts.map +1 -0
  157. package/dist/utils/AbiEncoder.js +6 -0
  158. package/dist/utils/Helpers.d.ts +19 -0
  159. package/dist/utils/Helpers.d.ts.map +1 -0
  160. package/dist/utils/Helpers.js +38 -0
  161. package/dist/utils/Message.d.ts +14 -0
  162. package/dist/utils/Message.d.ts.map +1 -0
  163. package/dist/utils/Message.js +43 -0
  164. package/dist/utils/Slot.d.ts +5 -0
  165. package/dist/utils/Slot.d.ts.map +1 -0
  166. package/dist/utils/Slot.js +9 -0
  167. package/dist/utils/TransactionUtils.d.ts +7 -0
  168. package/dist/utils/TransactionUtils.d.ts.map +1 -0
  169. package/dist/utils/TransactionUtils.js +35 -0
  170. package/dist/utils/UnitConverter.d.ts +8 -0
  171. package/dist/utils/UnitConverter.d.ts.map +1 -0
  172. package/dist/utils/UnitConverter.js +48 -0
  173. package/dist/utils/index.d.ts +9 -0
  174. package/dist/utils/index.d.ts.map +1 -0
  175. package/dist/utils/index.js +8 -0
  176. package/jest.config.ts +14 -0
  177. package/package.json +59 -0
  178. package/prettier.config.js +8 -0
  179. package/src/configuration/Network.ts +18 -0
  180. package/src/configuration/index.ts +1 -0
  181. package/src/enums/AbiFunction.ts +9 -0
  182. package/src/enums/Constants.ts +4 -0
  183. package/src/enums/ContractAbiType.ts +6 -0
  184. package/src/enums/ContractAddresses.ts +5 -0
  185. package/src/enums/index.ts +4 -0
  186. package/src/exceptions/InvalidUsernameException.ts +6 -0
  187. package/src/exceptions/index.ts +1 -0
  188. package/src/identities/Address.ts +19 -0
  189. package/src/identities/PrivateKey.ts +49 -0
  190. package/src/identities/PublicKey.ts +28 -0
  191. package/src/identities/WIF.ts +16 -0
  192. package/src/identities/index.ts +4 -0
  193. package/src/index.ts +7 -0
  194. package/src/networks/AbstractNetwork.ts +7 -0
  195. package/src/networks/Mainnet.ts +15 -0
  196. package/src/networks/Testnet.ts +15 -0
  197. package/src/networks/index.ts +3 -0
  198. package/src/transactions/Deserializer.ts +140 -0
  199. package/src/transactions/Serializer.ts +24 -0
  200. package/src/transactions/builders/AbstractTransactionBuilder.ts +81 -0
  201. package/src/transactions/builders/EvmCallBuilder.ts +24 -0
  202. package/src/transactions/builders/MultipaymentBuilder.ts +37 -0
  203. package/src/transactions/builders/TransferBuilder.ts +22 -0
  204. package/src/transactions/builders/UnvoteBuilder.ts +21 -0
  205. package/src/transactions/builders/UsernameRegistrationBuilder.ts +35 -0
  206. package/src/transactions/builders/UsernameResignationBuilder.ts +21 -0
  207. package/src/transactions/builders/ValidatorRegistrationBuilder.ts +32 -0
  208. package/src/transactions/builders/ValidatorResignationBuilder.ts +21 -0
  209. package/src/transactions/builders/VoteBuilder.ts +29 -0
  210. package/src/transactions/builders/index.ts +10 -0
  211. package/src/transactions/index.ts +4 -0
  212. package/src/transactions/types/AbstractTransaction.ts +118 -0
  213. package/src/transactions/types/EvmCall.ts +22 -0
  214. package/src/transactions/types/Multipayment.ts +51 -0
  215. package/src/transactions/types/Transfer.ts +22 -0
  216. package/src/transactions/types/Unvote.ts +24 -0
  217. package/src/transactions/types/UsernameRegistration.ts +44 -0
  218. package/src/transactions/types/UsernameResignation.ts +24 -0
  219. package/src/transactions/types/ValidatorRegistration.ts +44 -0
  220. package/src/transactions/types/ValidatorResignation.ts +24 -0
  221. package/src/transactions/types/Vote.ts +42 -0
  222. package/src/transactions/types/index.ts +10 -0
  223. package/src/types.ts +86 -0
  224. package/src/utils/Abi/ArgumentDecoder.ts +29 -0
  225. package/src/utils/Abi/json/Abi.Consensus.json +1673 -0
  226. package/src/utils/Abi/json/Abi.Multipayment.json +110 -0
  227. package/src/utils/Abi/json/Abi.Usernames.json +900 -0
  228. package/src/utils/AbiBase.ts +32 -0
  229. package/src/utils/AbiDecoder.ts +19 -0
  230. package/src/utils/AbiEncoder.ts +7 -0
  231. package/src/utils/Helpers.ts +46 -0
  232. package/src/utils/Message.ts +63 -0
  233. package/src/utils/Slot.ts +11 -0
  234. package/src/utils/TransactionUtils.ts +43 -0
  235. package/src/utils/UnitConverter.ts +57 -0
  236. package/src/utils/index.ts +8 -0
  237. package/tests/fixtures/global.json +10 -0
  238. package/tests/fixtures/identity.json +11 -0
  239. package/tests/fixtures/message-sign.json +5 -0
  240. package/tests/fixtures/sign-compact.json +10 -0
  241. package/tests/fixtures/transactions/evm-sign.json +18 -0
  242. package/tests/fixtures/transactions/multipayment-empty.json +18 -0
  243. package/tests/fixtures/transactions/multipayment-single.json +18 -0
  244. package/tests/fixtures/transactions/multipayment.json +18 -0
  245. package/tests/fixtures/transactions/transfer-0.json +18 -0
  246. package/tests/fixtures/transactions/transfer-large-amount.json +18 -0
  247. package/tests/fixtures/transactions/transfer.json +18 -0
  248. package/tests/fixtures/transactions/unvote.json +18 -0
  249. package/tests/fixtures/transactions/username-registration.json +18 -0
  250. package/tests/fixtures/transactions/username-resignation.json +18 -0
  251. package/tests/fixtures/transactions/validator-registration.json +18 -0
  252. package/tests/fixtures/transactions/validator-resignation.json +18 -0
  253. package/tests/fixtures/transactions/vote.json +18 -0
  254. package/tests/unit/identities/Address.test.ts +26 -0
  255. package/tests/unit/identities/PrivateKey.test.ts +36 -0
  256. package/tests/unit/identities/PublicKey.test.ts +39 -0
  257. package/tests/unit/identities/WIF.test.ts +8 -0
  258. package/tests/unit/transactions/Deserializer.test.ts +138 -0
  259. package/tests/unit/transactions/Serializer.test.ts +9 -0
  260. package/tests/unit/transactions/builders/EvmCallBuilder.test.ts +49 -0
  261. package/tests/unit/transactions/builders/MultipaymentBuilder.test.ts +99 -0
  262. package/tests/unit/transactions/builders/TransferBuilder.test.ts +73 -0
  263. package/tests/unit/transactions/builders/UnvoteBuilder.test.ts +47 -0
  264. package/tests/unit/transactions/builders/UsernameRegistrationBuilder.test.ts +54 -0
  265. package/tests/unit/transactions/builders/UsernameResignationBuilder.test.ts +48 -0
  266. package/tests/unit/transactions/builders/ValidatorRegistrationBuilder.test.ts +51 -0
  267. package/tests/unit/transactions/builders/ValidatorResignationBuilder.test.ts +48 -0
  268. package/tests/unit/transactions/builders/VoteBuilder.test.ts +48 -0
  269. package/tests/unit/transactions/types/AbstractTransaction.test.ts +145 -0
  270. package/tests/unit/utils/Abi/ArgumentDecoder.test.ts +55 -0
  271. package/tests/unit/utils/AbiDecoder.test.ts +44 -0
  272. package/tests/unit/utils/AbiEncoder.test.ts +30 -0
  273. package/tests/unit/utils/Helpers.test.ts +120 -0
  274. package/tests/unit/utils/Message.test.ts +104 -0
  275. package/tests/unit/utils/Slot.test.ts +69 -0
  276. package/tests/unit/utils/TransactionUtils.test.ts +31 -0
  277. package/tests/unit/utils/UnitConverter.test.ts +71 -0
  278. package/tsconfig.json +20 -0
package/.editorconfig ADDED
@@ -0,0 +1,16 @@
1
+ # EditorConfig is awesome: https://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ [*]
7
+ indent_style = tab
8
+ indent_size = 4
9
+ end_of_line = lf
10
+ charset = utf-8
11
+ trim_trailing_whitespace = true
12
+ insert_final_newline = true
13
+
14
+ [*.yml]
15
+ indent_style = space
16
+ indent_size = 2
package/.eslintrc.js ADDED
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ parser: "@typescript-eslint/parser",
3
+ plugins: ["@typescript-eslint"],
4
+ extends: [
5
+ "eslint:recommended",
6
+ "plugin:@typescript-eslint/recommended",
7
+ "prettier"
8
+ ],
9
+ rules: {
10
+ "prettier/prettier": "error"
11
+ }
12
+ };
@@ -0,0 +1,24 @@
1
+ <!--
2
+ Thanks for your interest in the project. Bugs filed and PRs submitted are appreciated!
3
+
4
+ Please make sure you're familiar with and follow the instructions in the [contributing guidelines](https://ark.dev/docs/program-incentives/guidelines/contributing).
5
+
6
+ Please fill out the information below to expedite the review and (hopefully) merge of your pull request!
7
+ -->
8
+
9
+ ## Summary
10
+
11
+ <!-- What changes are being made? -->
12
+
13
+ <!-- Why are these changes necessary? -->
14
+
15
+ <!-- How were these changes implemented? -->
16
+
17
+ ## Checklist
18
+
19
+ <!-- Have you done all of these things? -->
20
+
21
+ - [ ] Documentation _(if necessary)_
22
+ - [ ] Tests _(if necessary)_
23
+
24
+ <!-- Feel free to add additional comments. -->
@@ -0,0 +1,36 @@
1
+ name: CI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ node-version: [20.12.2]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ ref: ${{ github.head_ref }}
17
+ token: ${{ secrets.GH_TOKEN }}
18
+
19
+ - uses: pnpm/action-setup@v4
20
+ with:
21
+ version: 9
22
+
23
+ - uses: actions/setup-node@v4
24
+ with:
25
+ node-version: ${{ matrix.node-version }}
26
+ cache: pnpm
27
+
28
+ - name: Update System
29
+ run: sudo apt-get update
30
+
31
+ - name: Install
32
+ run: pnpm install
33
+
34
+ - run: pnpm run build
35
+
36
+ - run: pnpm test
@@ -0,0 +1,56 @@
1
+ name: Publish Package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ push:
7
+ branches:
8
+ - main
9
+ - develop
10
+
11
+ jobs:
12
+ publish:
13
+ # Only run if commit message starts with 'release:'
14
+ if: startsWith(github.event.head_commit.message, 'release:') || github.event_name == 'workflow_dispatch'
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ node-version: [20.x]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Use Node.js ${{ matrix.node-version }}
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: ${{ matrix.node-version }}
28
+ registry-url: "https://registry.npmjs.org/"
29
+
30
+ - name: Cache pnpm modules
31
+ uses: actions/cache@v4
32
+ env:
33
+ cache-name: cache-pnpm-modules
34
+ with:
35
+ path: ~/.pnpm-store
36
+ key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
37
+ restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
38
+
39
+ - name: Install pnpm
40
+ uses: pnpm/action-setup@v4
41
+ with:
42
+ version: 9.x
43
+
44
+ - name: Install dependencies
45
+ run: pnpm install
46
+
47
+ - name: Build
48
+ run: pnpm run build
49
+
50
+ - name: Publish (develop branch)
51
+ if: github.ref == 'refs/heads/develop'
52
+ run: NPM_AUTH_TOKEN=${{ secrets.NODE_AUTH_TOKEN_ARK }} npm publish --access=public --publish-branch=develop --tag=next
53
+
54
+ - name: Publish (main branch)
55
+ if: github.ref == 'refs/heads/main'
56
+ run: NPM_AUTH_TOKEN=${{ secrets.NODE_AUTH_TOKEN_ARK }} npm publish --access=public
@@ -0,0 +1,2 @@
1
+ {
2
+ }
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # ARK TypeScript - Crypto
2
+
3
+ > A simple TypeScript Cryptography Implementation for the ARK Blockchain.
4
+
5
+ ## Documentation
6
+
7
+ You can find installation instructions and detailed instructions on how to use this package at the dedicated documentation site.
8
+
9
+ ## Development
10
+
11
+ [pnpm](https://pnpm.io/) is used in this repository as package manager, make sure you have it installed before working on this repository.
12
+
13
+ ### Tests
14
+
15
+ You can run the tests with `pnpm test`. This will run the jest test suite with additional parameters to handle the crypto package.
16
+
17
+ ### Releases
18
+
19
+ Releases are handled by a GitHub action that runs when it detects a commit prefixed with `release:`. Make sure to update the version of the package prior to opening a release PR by running `npm version <version> -m "release: %s"`, e.g. `npm version 1.0.0 -m "release: %s"`. This will update the `package.json` with the right version number.
20
+
21
+ ## Security
22
+
23
+ If you discover a security vulnerability within this package, please send an e-mail to security@ardenthq.com. All security vulnerabilities will be promptly addressed.
24
+
25
+ ## Credits
26
+
27
+ This project exists thanks to all the people who [contribute](../../contributors).
28
+
29
+ ## License
30
+
31
+ [MIT](LICENSE) © [Ardent](https://ardenthq.com)
@@ -0,0 +1,7 @@
1
+ import { AbstractNetwork } from "../networks/AbstractNetwork";
2
+ export declare class Network {
3
+ private static network;
4
+ static get(): AbstractNetwork;
5
+ static set(network: AbstractNetwork): void;
6
+ }
7
+ //# sourceMappingURL=Network.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Network.d.ts","sourceRoot":"","sources":["../../src/configuration/Network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,qBAAa,OAAO;IACnB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAkB;WAE1B,GAAG,IAAI,eAAe;WAQtB,GAAG,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAGjD"}
@@ -0,0 +1,12 @@
1
+ import { Testnet } from "../networks/Testnet";
2
+ export class Network {
3
+ static get() {
4
+ if (!this.network) {
5
+ this.network = new Testnet();
6
+ }
7
+ return this.network;
8
+ }
9
+ static set(network) {
10
+ this.network = network;
11
+ }
12
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Network";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./Network";
@@ -0,0 +1,10 @@
1
+ export declare enum AbiFunction {
2
+ VOTE = "vote",
3
+ UNVOTE = "unvote",
4
+ VALIDATOR_REGISTRATION = "registerValidator",
5
+ VALIDATOR_RESIGNATION = "resignValidator",
6
+ USERNAME_REGISTRATION = "registerUsername",
7
+ USERNAME_RESIGNATION = "resignUsername",
8
+ MULTIPAYMENT = "pay"
9
+ }
10
+ //# sourceMappingURL=AbiFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbiFunction.d.ts","sourceRoot":"","sources":["../../src/enums/AbiFunction.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACtB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,sBAAsB,sBAAsB;IAC5C,qBAAqB,oBAAoB;IACzC,qBAAqB,qBAAqB;IAC1C,oBAAoB,mBAAmB;IACvC,YAAY,QAAQ;CACpB"}
@@ -0,0 +1,10 @@
1
+ export var AbiFunction;
2
+ (function (AbiFunction) {
3
+ AbiFunction["VOTE"] = "vote";
4
+ AbiFunction["UNVOTE"] = "unvote";
5
+ AbiFunction["VALIDATOR_REGISTRATION"] = "registerValidator";
6
+ AbiFunction["VALIDATOR_RESIGNATION"] = "resignValidator";
7
+ AbiFunction["USERNAME_REGISTRATION"] = "registerUsername";
8
+ AbiFunction["USERNAME_RESIGNATION"] = "resignUsername";
9
+ AbiFunction["MULTIPAYMENT"] = "pay";
10
+ })(AbiFunction || (AbiFunction = {}));
@@ -0,0 +1,5 @@
1
+ export declare enum Constants {
2
+ EIP_1559_PREFIX = "02",
3
+ ETHEREUM_RECOVERY_ID_OFFSET = 27
4
+ }
5
+ //# sourceMappingURL=Constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/enums/Constants.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACpB,eAAe,OAAO;IACtB,2BAA2B,KAAK;CAChC"}
@@ -0,0 +1,5 @@
1
+ export var Constants;
2
+ (function (Constants) {
3
+ Constants["EIP_1559_PREFIX"] = "02";
4
+ Constants[Constants["ETHEREUM_RECOVERY_ID_OFFSET"] = 27] = "ETHEREUM_RECOVERY_ID_OFFSET";
5
+ })(Constants || (Constants = {}));
@@ -0,0 +1,7 @@
1
+ export declare enum ContractAbiType {
2
+ CUSTOM = "custom",
3
+ CONSENSUS = "consensus",
4
+ MULTIPAYMENT = "multipayment",
5
+ USERNAMES = "usernames"
6
+ }
7
+ //# sourceMappingURL=ContractAbiType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContractAbiType.d.ts","sourceRoot":"","sources":["../../src/enums/ContractAbiType.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACvB,MAAM,WAAiB;IACvB,SAAS,cAAiB;IAC1B,YAAY,iBAAiB;IAC7B,SAAS,cAAiB;CAC7B"}
@@ -0,0 +1,7 @@
1
+ export var ContractAbiType;
2
+ (function (ContractAbiType) {
3
+ ContractAbiType["CUSTOM"] = "custom";
4
+ ContractAbiType["CONSENSUS"] = "consensus";
5
+ ContractAbiType["MULTIPAYMENT"] = "multipayment";
6
+ ContractAbiType["USERNAMES"] = "usernames";
7
+ })(ContractAbiType || (ContractAbiType = {}));
@@ -0,0 +1,6 @@
1
+ export declare enum ContractAddresses {
2
+ CONSENSUS = "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1",
3
+ MULTIPAYMENT = "0x00EFd0D4639191C49908A7BddbB9A11A994A8527",
4
+ USERNAMES = "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6"
5
+ }
6
+ //# sourceMappingURL=ContractAddresses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContractAddresses.d.ts","sourceRoot":"","sources":["../../src/enums/ContractAddresses.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC5B,SAAS,+CAA+C;IACxD,YAAY,+CAA+C;IAC3D,SAAS,+CAA+C;CACxD"}
@@ -0,0 +1,6 @@
1
+ export var ContractAddresses;
2
+ (function (ContractAddresses) {
3
+ ContractAddresses["CONSENSUS"] = "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1";
4
+ ContractAddresses["MULTIPAYMENT"] = "0x00EFd0D4639191C49908A7BddbB9A11A994A8527";
5
+ ContractAddresses["USERNAMES"] = "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6";
6
+ })(ContractAddresses || (ContractAddresses = {}));
@@ -0,0 +1,5 @@
1
+ export * from "./AbiFunction";
2
+ export * from "./Constants";
3
+ export * from "./ContractAbiType";
4
+ export * from "./ContractAddresses";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/enums/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./AbiFunction";
2
+ export * from "./Constants";
3
+ export * from "./ContractAbiType";
4
+ export * from "./ContractAddresses";
@@ -0,0 +1,4 @@
1
+ export declare class InvalidUsernameException extends Error {
2
+ constructor(message: string);
3
+ }
4
+ //# sourceMappingURL=InvalidUsernameException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvalidUsernameException.d.ts","sourceRoot":"","sources":["../../src/exceptions/InvalidUsernameException.ts"],"names":[],"mappings":"AAAA,qBAAa,wBAAyB,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI3B"}
@@ -0,0 +1,6 @@
1
+ export class InvalidUsernameException extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = "InvalidUsernameException";
5
+ }
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./InvalidUsernameException";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
@@ -0,0 +1 @@
1
+ export * from "./InvalidUsernameException";
@@ -0,0 +1,7 @@
1
+ export declare class Address {
2
+ static fromPassphrase(passphrase: string): string;
3
+ static fromPublicKey(publicKey: string): string;
4
+ static fromPrivateKey(privateKey: string): string;
5
+ static validate(address: string): boolean;
6
+ }
7
+ //# sourceMappingURL=Address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../src/identities/Address.ts"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IACnB,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIjD,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAI/C,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIjD,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAGzC"}
@@ -0,0 +1,15 @@
1
+ import { ethers, sha256 } from "ethers";
2
+ export class Address {
3
+ static fromPassphrase(passphrase) {
4
+ return this.fromPrivateKey(sha256(Buffer.from(passphrase)));
5
+ }
6
+ static fromPublicKey(publicKey) {
7
+ return ethers.computeAddress(`0x${publicKey}`);
8
+ }
9
+ static fromPrivateKey(privateKey) {
10
+ return new ethers.Wallet(privateKey).address;
11
+ }
12
+ static validate(address) {
13
+ return ethers.isAddress(address);
14
+ }
15
+ }
@@ -0,0 +1,16 @@
1
+ import { ethers } from "ethers";
2
+ type RecoverableSignature = {
3
+ r: string;
4
+ s: string;
5
+ v: number;
6
+ };
7
+ export declare class PrivateKey {
8
+ privateKey: string;
9
+ constructor(keyPair: ethers.Wallet);
10
+ static fromPassphrase(passphrase: string): PrivateKey;
11
+ static fromHex(hex: string): PrivateKey;
12
+ static fromWif(wif: string): PrivateKey;
13
+ sign(message: string): RecoverableSignature;
14
+ }
15
+ export {};
16
+ //# sourceMappingURL=PrivateKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/identities/PrivateKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAqB,MAAM,QAAQ,CAAC;AAMnD,KAAK,oBAAoB,GAAG;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV,CAAC;AAEF,qBAAa,UAAU;IACf,UAAU,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,CAAC,MAAM;IAIlC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAIrD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAMvC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAMvC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;CAa3C"}
@@ -0,0 +1,31 @@
1
+ import * as WIF from "wif";
2
+ import { ethers, keccak256, sha256 } from "ethers";
3
+ import { signRecoverable } from "tiny-secp256k1";
4
+ import { Constants } from "../enums/Constants";
5
+ import { Network } from "../configuration/Network";
6
+ export class PrivateKey {
7
+ constructor(keyPair) {
8
+ this.privateKey = keyPair.privateKey.substring(2);
9
+ }
10
+ static fromPassphrase(passphrase) {
11
+ return PrivateKey.fromHex(sha256(Buffer.from(passphrase)));
12
+ }
13
+ static fromHex(hex) {
14
+ const wallet = new ethers.Wallet(hex);
15
+ return new PrivateKey(wallet);
16
+ }
17
+ static fromWif(wif) {
18
+ const decodedWif = WIF.decode(wif, Buffer.from(Network.get().getWif(), "hex").readUInt8());
19
+ return PrivateKey.fromHex(Buffer.from(decodedWif.privateKey).toString("hex"));
20
+ }
21
+ sign(message) {
22
+ const hash = Buffer.from(keccak256("0x" + message).slice(2), "hex");
23
+ const signature = signRecoverable(hash, Buffer.from(this.privateKey, "hex"));
24
+ const signatureHex = Buffer.from(signature.signature).toString("hex");
25
+ return {
26
+ r: signatureHex.slice(0, 64).toString(),
27
+ s: signatureHex.slice(64, 128).toString(),
28
+ v: signature.recoveryId + Constants.ETHEREUM_RECOVERY_ID_OFFSET,
29
+ };
30
+ }
31
+ }
@@ -0,0 +1,8 @@
1
+ export declare class PublicKey {
2
+ publicKey: string;
3
+ constructor(publicKey: string);
4
+ static fromPassphrase(passphrase: string): PublicKey;
5
+ static fromHex(publicKey: string): PublicKey;
6
+ static recover(message: Buffer, signatureRS: Buffer, v: number): PublicKey;
7
+ }
8
+ //# sourceMappingURL=PublicKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PublicKey.d.ts","sourceRoot":"","sources":["../../src/identities/PublicKey.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IACd,SAAS,EAAE,MAAM,CAAC;gBAEb,SAAS,EAAE,MAAM;IAI7B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS;IAMpD,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IAM5C,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS;CAY1E"}
@@ -0,0 +1,24 @@
1
+ import { sha256, SigningKey } from "ethers";
2
+ import { recover } from "tiny-secp256k1";
3
+ export class PublicKey {
4
+ constructor(publicKey) {
5
+ this.publicKey = publicKey;
6
+ }
7
+ static fromPassphrase(passphrase) {
8
+ const publicKey = SigningKey.computePublicKey(sha256(Buffer.from(passphrase)), true).substring(2);
9
+ return new PublicKey(publicKey);
10
+ }
11
+ static fromHex(publicKey) {
12
+ const computedPublicKey = SigningKey.computePublicKey(`0x${publicKey}`).substring(2);
13
+ return new PublicKey(computedPublicKey);
14
+ }
15
+ static recover(message, signatureRS, v) {
16
+ if (v < 0 || v > 3) {
17
+ throw new Error("Bad Recovery Id");
18
+ }
19
+ const recoveryId = v;
20
+ // Can't get the recover method to return null so we are enforcing the type here
21
+ const signature = recover(message, signatureRS, recoveryId, true);
22
+ return new PublicKey(Buffer.from(signature).toString("hex"));
23
+ }
24
+ }
@@ -0,0 +1,4 @@
1
+ export declare class WIF {
2
+ static fromPassphrase(passphrase: string): string;
3
+ }
4
+ //# sourceMappingURL=WIF.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WIF.d.ts","sourceRoot":"","sources":["../../src/identities/WIF.ts"],"names":[],"mappings":"AAKA,qBAAa,GAAG;IACf,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CASjD"}
@@ -0,0 +1,13 @@
1
+ import { Network } from "../configuration/Network";
2
+ import * as WIFPackage from "wif";
3
+ import { PrivateKey } from "./PrivateKey";
4
+ export class WIF {
5
+ static fromPassphrase(passphrase) {
6
+ const privateKey = PrivateKey.fromPassphrase(passphrase);
7
+ return WIFPackage.encode({
8
+ version: Buffer.from(Network.get().getWif(), 'hex').readUInt8(),
9
+ privateKey: Buffer.from(privateKey.privateKey, 'hex'),
10
+ compressed: true,
11
+ });
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./Address";
2
+ export * from "./PrivateKey";
3
+ export * from "./PublicKey";
4
+ export * from "./WIF";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identities/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./Address";
2
+ export * from "./PrivateKey";
3
+ export * from "./PublicKey";
4
+ export * from "./WIF";
@@ -0,0 +1,8 @@
1
+ export * from "./configuration";
2
+ export * from "./enums";
3
+ export * from "./exceptions";
4
+ export * from "./identities";
5
+ export * from "./networks";
6
+ export * from "./transactions";
7
+ export * from "./utils";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
18
+ __reExport(index_exports, require("./configuration"), module.exports);
19
+ __reExport(index_exports, require("./enums"), module.exports);
20
+ __reExport(index_exports, require("./exceptions"), module.exports);
21
+ __reExport(index_exports, require("./identities"), module.exports);
22
+ __reExport(index_exports, require("./networks"), module.exports);
23
+ __reExport(index_exports, require("./transactions"), module.exports);
24
+ __reExport(index_exports, require("./utils"), module.exports);
@@ -0,0 +1,6 @@
1
+ export declare abstract class AbstractNetwork {
2
+ abstract chainId(): number;
3
+ abstract epoch(): string;
4
+ abstract getWif(): string;
5
+ }
6
+ //# sourceMappingURL=AbstractNetwork.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractNetwork.d.ts","sourceRoot":"","sources":["../../src/networks/AbstractNetwork.ts"],"names":[],"mappings":"AAAA,8BAAsB,eAAe;IACjC,QAAQ,CAAC,OAAO,IAAI,MAAM;IAE1B,QAAQ,CAAC,KAAK,IAAI,MAAM;IAExB,QAAQ,CAAC,MAAM,IAAI,MAAM;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export class AbstractNetwork {
2
+ }
@@ -0,0 +1,7 @@
1
+ import { AbstractNetwork } from "./AbstractNetwork";
2
+ export declare class Mainnet extends AbstractNetwork {
3
+ chainId(): number;
4
+ epoch(): string;
5
+ getWif(): string;
6
+ }
7
+ //# sourceMappingURL=Mainnet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mainnet.d.ts","sourceRoot":"","sources":["../../src/networks/Mainnet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,OAAQ,SAAQ,eAAe;IACpC,OAAO,IAAI,MAAM;IAIjB,KAAK,IAAI,MAAM;IAIf,MAAM,IAAI,MAAM;CAGvB"}
@@ -0,0 +1,12 @@
1
+ import { AbstractNetwork } from "./AbstractNetwork";
2
+ export class Mainnet extends AbstractNetwork {
3
+ chainId() {
4
+ return 10000;
5
+ }
6
+ epoch() {
7
+ return "2017-03-21T13:00:00.000Z";
8
+ }
9
+ getWif() {
10
+ return "ba";
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ import { AbstractNetwork } from "./AbstractNetwork";
2
+ export declare class Testnet extends AbstractNetwork {
3
+ chainId(): number;
4
+ epoch(): string;
5
+ getWif(): string;
6
+ }
7
+ //# sourceMappingURL=Testnet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Testnet.d.ts","sourceRoot":"","sources":["../../src/networks/Testnet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,OAAQ,SAAQ,eAAe;IACpC,OAAO,IAAI,MAAM;IAIjB,KAAK,IAAI,MAAM;IAIf,MAAM,IAAI,MAAM;CAGvB"}
@@ -0,0 +1,12 @@
1
+ import { AbstractNetwork } from "./AbstractNetwork";
2
+ export class Testnet extends AbstractNetwork {
3
+ chainId() {
4
+ return 10000;
5
+ }
6
+ epoch() {
7
+ return "2017-03-21T13:00:00.000Z";
8
+ }
9
+ getWif() {
10
+ return "ba";
11
+ }
12
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./AbstractNetwork";
2
+ export * from "./Mainnet";
3
+ export * from "./Testnet";
4
+ //# sourceMappingURL=index.d.ts.map