@alephium/web3 0.0.3 → 0.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/.editorconfig +13 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.json +21 -0
  4. package/README.md +2 -2
  5. package/contracts/add.ral +7 -3
  6. package/contracts/greeter.ral +3 -1
  7. package/contracts/greeter_interface.ral +3 -0
  8. package/contracts/greeter_main.ral +9 -0
  9. package/contracts/main.ral +3 -5
  10. package/dev/user.conf +8 -4
  11. package/dist/alephium-web3.min.js +1 -1
  12. package/dist/alephium-web3.min.js.map +1 -1
  13. package/dist/scripts/check-versions.d.ts +1 -0
  14. package/dist/scripts/check-versions.js +39 -0
  15. package/dist/{cli → scripts}/create-project.d.ts +0 -0
  16. package/dist/scripts/create-project.js +124 -0
  17. package/dist/scripts/header.d.ts +0 -0
  18. package/dist/scripts/header.js +18 -0
  19. package/dist/scripts/rename-gitignore.d.ts +1 -0
  20. package/dist/scripts/rename-gitignore.js +24 -0
  21. package/dist/scripts/start-devnet.d.ts +1 -0
  22. package/dist/scripts/start-devnet.js +131 -0
  23. package/dist/scripts/stop-devnet.d.ts +1 -0
  24. package/dist/scripts/stop-devnet.js +32 -0
  25. package/dist/{api → src/api}/api-alephium.d.ts +287 -168
  26. package/dist/{api → src/api}/api-alephium.js +497 -115
  27. package/dist/{api → src/api}/api-explorer.d.ts +117 -19
  28. package/dist/{api → src/api}/api-explorer.js +206 -46
  29. package/dist/src/api/index.d.ts +10 -0
  30. package/dist/src/api/index.js +55 -0
  31. package/dist/{lib → src}/constants.d.ts +0 -0
  32. package/dist/{lib → src}/constants.js +0 -0
  33. package/dist/src/contract/contract.d.ts +182 -0
  34. package/dist/src/contract/contract.js +760 -0
  35. package/dist/src/contract/events.d.ts +29 -0
  36. package/dist/src/contract/events.js +77 -0
  37. package/dist/src/contract/index.d.ts +3 -0
  38. package/dist/src/contract/index.js +32 -0
  39. package/dist/src/contract/ralph.d.ts +12 -0
  40. package/dist/src/contract/ralph.js +362 -0
  41. package/dist/src/index.d.ts +5 -0
  42. package/dist/src/index.js +34 -0
  43. package/dist/src/signer/index.d.ts +2 -0
  44. package/dist/src/signer/index.js +31 -0
  45. package/dist/src/signer/node-wallet.d.ts +13 -0
  46. package/dist/src/signer/node-wallet.js +60 -0
  47. package/dist/src/signer/signer.d.ts +143 -0
  48. package/dist/src/signer/signer.js +184 -0
  49. package/dist/src/test/index.d.ts +7 -0
  50. package/dist/src/test/index.js +41 -0
  51. package/dist/src/test/privatekey-wallet.d.ts +12 -0
  52. package/dist/src/test/privatekey-wallet.js +68 -0
  53. package/dist/{lib → src/utils}/address.d.ts +0 -0
  54. package/dist/{lib → src/utils}/address.js +1 -1
  55. package/dist/{lib → src/utils}/bs58.d.ts +2 -2
  56. package/dist/{lib → src/utils}/bs58.js +3 -1
  57. package/dist/{lib → src/utils}/djb2.d.ts +0 -0
  58. package/dist/{lib → src/utils}/djb2.js +1 -1
  59. package/dist/src/utils/index.d.ts +6 -0
  60. package/dist/src/utils/index.js +35 -0
  61. package/dist/{lib → src/utils}/password-crypto.d.ts +0 -0
  62. package/dist/{lib → src/utils}/password-crypto.js +8 -7
  63. package/dist/src/utils/transaction.d.ts +2 -0
  64. package/dist/src/utils/transaction.js +58 -0
  65. package/dist/src/utils/utils.d.ts +30 -0
  66. package/dist/{lib → src/utils}/utils.js +83 -19
  67. package/gitignore +5 -4
  68. package/package.json +56 -40
  69. package/scripts/create-project.ts +136 -0
  70. package/scripts/header.js +17 -0
  71. package/scripts/start-devnet.js +3 -3
  72. package/src/api/api-alephium.ts +2323 -0
  73. package/src/api/api-explorer.ts +808 -0
  74. package/src/api/index.ts +35 -0
  75. package/src/constants.ts +20 -0
  76. package/src/contract/contract.ts +1014 -0
  77. package/src/contract/events.ts +102 -0
  78. package/src/contract/index.ts +21 -0
  79. package/src/contract/ralph.test.ts +178 -0
  80. package/src/contract/ralph.ts +362 -0
  81. package/src/fixtures/address.json +36 -0
  82. package/src/fixtures/balance.json +9 -0
  83. package/src/fixtures/self-clique.json +19 -0
  84. package/src/fixtures/transaction.json +13 -0
  85. package/src/fixtures/transactions.json +179 -0
  86. package/src/index.ts +24 -0
  87. package/src/signer/fixtures/genesis.json +26 -0
  88. package/src/signer/fixtures/wallets.json +26 -0
  89. package/src/signer/index.ts +20 -0
  90. package/src/signer/node-wallet.ts +74 -0
  91. package/src/signer/signer.ts +313 -0
  92. package/src/test/index.ts +32 -0
  93. package/src/test/privatekey-wallet.ts +58 -0
  94. package/src/utils/address.test.ts +47 -0
  95. package/src/utils/address.ts +39 -0
  96. package/src/utils/bs58.ts +26 -0
  97. package/src/utils/djb2.test.ts +35 -0
  98. package/src/utils/djb2.ts +25 -0
  99. package/src/utils/index.ts +24 -0
  100. package/src/utils/password-crypto.test.ts +27 -0
  101. package/src/utils/password-crypto.ts +77 -0
  102. package/src/utils/transaction.test.ts +50 -0
  103. package/src/utils/transaction.ts +39 -0
  104. package/src/utils/utils.test.ts +160 -0
  105. package/src/utils/utils.ts +209 -0
  106. package/templates/{README.md → base/README.md} +4 -4
  107. package/templates/base/package.json +35 -0
  108. package/templates/base/src/greeter.ts +41 -0
  109. package/templates/base/tsconfig.json +19 -0
  110. package/templates/react/README.md +34 -0
  111. package/templates/react/config-overrides.js +18 -0
  112. package/templates/react/package.json +66 -0
  113. package/templates/react/src/App.tsx +42 -0
  114. package/templates/react/src/artifacts/greeter.ral.json +26 -0
  115. package/templates/react/src/artifacts/greeter_main.ral.json +22 -0
  116. package/templates/shared/.eslintrc.json +12 -0
  117. package/templates/shared/scripts/header.js +0 -0
  118. package/test/contract.test.ts +161 -0
  119. package/test/events.test.ts +139 -0
  120. package/webpack.config.js +1 -1
  121. package/contracts/greeter-main.ral +0 -8
  122. package/dist/cli/create-project.js +0 -87
  123. package/dist/lib/clique.d.ts +0 -23
  124. package/dist/lib/clique.js +0 -149
  125. package/dist/lib/contract.d.ts +0 -152
  126. package/dist/lib/contract.js +0 -711
  127. package/dist/lib/explorer.d.ts +0 -8
  128. package/dist/lib/explorer.js +0 -46
  129. package/dist/lib/index.d.ts +0 -12
  130. package/dist/lib/index.js +0 -60
  131. package/dist/lib/node.d.ts +0 -10
  132. package/dist/lib/node.js +0 -64
  133. package/dist/lib/numbers.d.ts +0 -7
  134. package/dist/lib/numbers.js +0 -128
  135. package/dist/lib/signer.d.ts +0 -17
  136. package/dist/lib/signer.js +0 -70
  137. package/dist/lib/storage-browser.d.ts +0 -9
  138. package/dist/lib/storage-browser.js +0 -52
  139. package/dist/lib/storage-node.d.ts +0 -9
  140. package/dist/lib/storage-node.js +0 -65
  141. package/dist/lib/utils.d.ts +0 -11
  142. package/dist/lib/wallet.d.ts +0 -30
  143. package/dist/lib/wallet.js +0 -142
  144. package/templates/package.json +0 -29
@@ -0,0 +1,35 @@
1
+ /*
2
+ Copyright 2018 - 2022 The Alephium Authors
3
+ This file is part of the alephium project.
4
+
5
+ The library is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Lesser General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ The library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public License
16
+ along with the library. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ import { Api as NodeApi } from './api-alephium'
20
+ import { Api as ExplorerApi } from './api-explorer'
21
+
22
+ export class NodeProvider extends NodeApi<null> {
23
+ constructor(baseUrl: string) {
24
+ super({ baseUrl: baseUrl })
25
+ }
26
+ }
27
+
28
+ export class ExplorerProvider extends ExplorerApi<null> {
29
+ constructor(baseUrl: string) {
30
+ super({ baseUrl: baseUrl })
31
+ }
32
+ }
33
+
34
+ export * as node from './api-alephium'
35
+ export * as explorer from './api-explorer'
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2018 - 2022 The Alephium Authors
3
+ This file is part of the alephium project.
4
+
5
+ The library is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Lesser General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ The library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public License
16
+ along with the library. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ export const TOTAL_NUMBER_OF_GROUPS = 4
20
+ export const MIN_UTXO_SET_AMOUNT = BigInt(1000000000000)