Commit Graph

52 Commits

Author SHA1 Message Date
Yuriy Glukhov 45d09b29d2
Refactoring, contract dsl wasm compatibility, encode/decode fixes. (#108)
* Refactoring, contract dsl wasm compatibility, fixes in encoding/decoding.

* Tests

* Fixed Nim 1.* compatibility

* Some backward compatibility

* Minor tweaks, and a safety check

* Update web3/encoding.nim

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>

* Update web3.nim

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>

* Use stew.assign instead of reinventing the wheel

* Fixed string decoder. Removed extra allocations.

* Added test for string decoder

* v0.2.2

---------

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
Co-authored-by: jangko <jangko128@gmail.com>
2023-12-13 12:26:04 +07:00
jangko dcabb8f29e
v0.2.0: Revamp data types 2023-12-12 12:15:34 +07:00
Etan Kissling 6212e659e5
replace `{.raises: [Defect].}` with `{.raises: [].}` (Nim 1.6) (#104)
With Nim 1.6, `Defect` does not need to be specified anymore inside
`{.raises.}` and triggers redundant `XCannotRaiseY` hints. Remove.
2023-10-05 12:37:04 +02:00
jangko 7b2033178b
fix missing httpclient import 2023-06-04 12:39:28 +07:00
Zahary Karadjov c4fefea387
Allow the user to specify HttpClientFlags when creating a HTTP client 2023-05-05 02:26:27 +03:00
Jacek Sieka 5e20893ef9
tighten nimcrypto imports (#58) 2022-09-05 19:29:33 +02:00
Zahary Karadjov dfa91e350c
The contract event names should be accessible in modules that import the contract definition 2022-07-11 20:51:13 +03:00
Jacek Sieka d260915a0c
enable `styleCheck:usages` (#49) 2022-04-07 15:52:36 +02:00
Dustin Brody abf5a274b4
request header callback 2022-03-04 19:14:42 +00:00
Zahary Karadjov 3a93265075 Handle the realistic large values for total difficulty 2021-10-04 17:41:19 +02:00
Eric Mastro b894d9a2ca
feat: export generated contracts and methods (#40) 2021-09-21 12:03:03 +02:00
Eric Mastro d62f8105a1
fix: allow Bool input/output types for contracts (#39)
* fix: allow Bool input/output types for contracts

Contracts created with the `contract` macro and having a method with a `Bool` input/output type were failing to compile. Example:
```
contract(MyContract):
  proc enableTransfers(
    transfersEnabled: Bool
  )
```
Failed with:
```
Error: type mismatch: got <type Bool>
but expected one of:
proc unknownType()
  first type mismatch at position: 1
  extra argument given

expression: unknownType(Bool)
```
This fix enables translating `Bool` type signatures to solidity’s `bool` type.

* add Bool encoding/decoding test
2021-09-21 12:02:06 +02:00
Jacek Sieka 04845b0ed8
Fix exceptions from callbacks
For https://github.com/status-im/nim-chronos/pull/166/
2021-03-22 17:14:26 +01:00
Ștefan Talpalaru 21b465fcd5 enable cross-compilation 2021-02-03 21:35:17 +02:00
Viktor Kirilov dde382f70e fixed a problem with geth when sending newHeads with an empty {} argument 2020-09-24 15:56:42 +03:00
Zahary Karadjov fc0c27a730
Fix the CI failure 2020-08-10 23:08:44 +03:00
emizzle 3900d91958
refactor: move encoding/decoding functions to sub-lib
Move all encoding/decoding functions to a separate sub-library, to allow libraries to use these functions without needing to import the entire library (ie hopefully without needing to import secp256k1).
2020-08-10 19:43:42 +10:00
Zahary Karadjov 0361338cea
Correct nonce values when sending multiple transactions 2020-08-01 19:41:39 +03:00
jangko 4097cfaf95
fix tests 2020-07-15 15:41:22 +07:00
jangko b29311a9d0
silence spurious warnings 2020-07-15 10:14:28 +07:00
Zahary Karadjov 04be808890
Allow the Web3 types to be saved in Json files; Clean up code duplication with stew/byteutils 2020-07-10 01:07:58 +03:00
Zahary Karadjov 227927ddc8
Move the hex parsing routines to ethtypes to make them more accessible 2020-07-02 13:03:38 +03:00
Zahary Karadjov 91eb7c4a47
Remove a pointless file (a legacy from the time when web3 was extracted from nim-json-rpc) 2020-06-30 15:59:29 +03:00
Zahary Karadjov 71524f0f59
Fix nimble test 2020-06-30 15:59:21 +03:00
Zahary Karadjov 237646de7c
Make the fetching of historic events optional when subscribing to 'logs' 2020-06-27 14:50:53 +03:00
Zahary Karadjov 4590f21d5d
Added `web3.subscribeForBlockHeaders`; Stricter error handling 2020-06-26 18:30:55 +03:00
Zahary Karadjov 694ff2ad74
More hot fixes for Infura compatiblity 2020-06-24 15:13:36 +03:00
Jacek Sieka 806547ddd1
secp: requiresInit 2020-06-22 17:09:35 +02:00
Zahary Karadjov 05f2a17ba4
Make some string-conversions more friendly for Infura use (0x-prefixes are required there) 2020-06-22 15:27:47 +03:00
Zahary Karadjov ee69dbd48a
A helper for checking if a contract has been deployed at a particular block 2020-06-19 19:42:55 +03:00
Viktor Kirilov f1d3e94dda event handlers should't be permitted to raise anything other than a Defect 2020-05-08 17:20:59 +03:00
Zahary Karadjov 0ca6089962
Misc fixes
* Allow BlockHash et al to be used as keys in hash tables
* Switch from Exceptions to CatchableErrors
* Export some helpers that needed in NBC
2020-04-18 17:24:59 +03:00
Zahary Karadjov d172765114
Transform some macro generated code into a generic function 2020-04-18 17:24:59 +03:00
Zahary Karadjov 270fd64620
Add convenience API for obtaining logs from a smart contract event 2020-04-18 17:24:59 +03:00
Zahary Karadjov 6927cd08a2
Allow specifying a block number when making smart contract calls
Other changes:

* More accurate RPC signatures
* Handle empty responses from the Web3 provider in `eth_call`
2020-04-18 17:24:59 +03:00
Jacek Sieka 969adf2f1e
keys: fix deprecations 2020-04-04 18:51:27 +02:00
Jacek Sieka da74eabaa0
web3: fix zero key comparison 2020-04-02 17:31:23 +02:00
Yuriy Glukhov 89d7a0c8fd
Handle and propagate disconnect event from provider 2019-11-22 14:41:12 +02:00
Yuriy Glukhov ca799679f5
Removed unneeded debug prints. Fixes #13 2019-11-04 19:05:31 +02:00
Yuriy Glukhov 37fc461114
Fixed serialization compatibility with geth. Added getMinedTransactionReceipt 2019-10-30 15:05:44 +02:00
Yuriy Glukhov ecd2fb45a6 Added close function 2019-10-23 09:35:54 +09:00
Yuriy Glukhov 08909f9972 Fixed gcsafety issues for newer nim 2019-09-09 23:42:39 -04:00
Yuriy Glukhov 817c819847 Fixed fixed encoding, inputs/outputs parsing 2019-09-06 09:24:37 -04:00
Ștefan Talpalaru 58d78cfa7f
byteutils -> stew/byteutils 2019-08-24 21:48:57 +02:00
Yuriy Glukhov 6ca87380a6 Fixes #5, implemented tx signing 2019-08-06 11:02:38 +03:00
Ștefan Talpalaru a60a2c760f
limit debug prints to explicit debug builds (-d:debug) 2019-08-01 16:55:40 +02:00
Yuriy Glukhov cd0e216aaf Ergonomics changes 2019-07-31 13:13:26 +03:00
Yuriy Glukhov cd3be5aab1 Added raw data argument to subscription handlers 2019-07-22 12:09:09 +03:00
Yuriy Glukhov cf6dc7699f More fixes, fetch historical logs on subsciption, more tests 2019-07-22 12:09:09 +03:00
Yuriy Glukhov 1d6d413318 Fixed dynamic encoding, added deposit contract test 2019-07-22 12:09:09 +03:00