Commit Graph

69 Commits

Author SHA1 Message Date
andri lim 80031669e1
Fix subscription handler (#175)
* Fix contract_dsl event response parser

* Fix pending subscription event handler

* Use useDefaultSerializationIn for EventData

Surprisingly the pending event bug not detected when using ganache. It only manifest after migrated to hardhat. Also not detected on linux and windows CI. Only on macos amd64 CI, and sometimes on macos arm64 CI. Probably related to async timing trigger pending event?. But it's a genuine bug, dated back far before migration from stdlib/json to json-serialization.
2024-10-23 17:05:48 +07:00
andri lim 86448ed8b6
Replace AccessTuple with AccessPair from nim-eth (#169)
* Fix deprecated warnings related to eth/common

* Replace AccessTuple with AccessPair from nim-eth
2024-10-11 10:44:33 +07:00
Jacek Sieka 25f96c8958
Migrate to common eth types (#162) 2024-10-01 19:41:11 +02:00
andri lim b705f81643
Replace std.Option with results.Opt (#153) 2024-06-12 06:32:06 +07:00
Yuriy Glukhov 954c23cca2
Respect chainId from TransactionArgs when signing (#152) 2024-06-10 15:14:14 +07:00
tersec 85e34e8ab2
add Prague engine API support types (#140) 2024-03-27 04:24:31 +00:00
andri lim 285d97c2b0
Unify EthCall/EthSend into TransactionArgs (#138)
* Unify EthCall/EthSend into TransactionArgs

* Add isEIP4844 of TransactionArgs
2024-03-20 11:12:59 +07:00
Etan Kissling 80c7aa6de2
make `BlockNumber` `distinct` (#137)
The `writeValue` added for `BlockNumber` in #136 interferes with other
`uint64` because `BlockNumber` is not `distinct`. Marking it `distinct`
avoids polluting global serialization logic.
2024-03-17 00:04:38 +01:00
Etan Kissling a67213af4f
re-add support for `fromBlock`, `toBlock`, `blockHash` in `eth_getLogs` (#130)
In #108 a regression got introduced, resulting in `fromBlock`, `toBlock`
and `blockHash` no longer being sent when a client calls `eth_getLogs`.
This may break the deposits import process in `nimbus-eth2`, resulting
in messages such as:

```
ERR 2024-02-06 19:52:34.474+01:00 The Eth1 chain is not synced               ourDepositsCount=0 targetDepositsCount=403
```

Fixing the regression restores successful import messages:

```
INF 2024-02-06 22:12:14.863+01:00 Eth1 sync progress                         topics="elmon" blockNumber=1349452 depositsProcessed=3
```
2024-02-06 21:26:20 +00:00
andri lim baff215937
Reduce compiler warnings (#127)
* Reduce compiler warnings

* Fix test_null_conversion

* Fix regression because of json-rpc too smart when handling null value
2024-01-24 14:37:32 +07:00
Yuriy Glukhov eea0344679 More flexibility to contract DSL, Async contract caller 2024-01-09 14:57:29 +01:00
Yuriy Glukhov 98fb3aa2a1 Fixed compilation error in exec function 2024-01-08 14:58:18 +01:00
jangko 36ff4bbca3
Event handler passing around JsonString instead of JsonNode 2024-01-08 13:09:23 +07:00
jangko ef317bc846
Migrate to json-serialization 2024-01-07 17:23:00 +07:00
jangko be1bb307dc
Reduce compiler warnings when using Nim v2 2024-01-02 09:33:15 +07:00
Will 23c06ca6d2
Bugfix/nully values (#61)
* Fix problem with contract out of assets

* Add nully value json test

* Fix bug with passing null to a few functions

* Typesafe U256 parsing

* Update readme for the web3 to include runner info

* Cleanup commits

Strip out unused JSON

Update comment

Remove echo

Added DynamicBytes test

More correct naming

Remove one extra double check

* Add specific object tests

* Ensure we cover different status types

* Add header comments

* Cleanup

* Add more tests

* Cleanup

* Revert docs

* Nimpretty file

* Fix issue in base stew

* v0.2.4

* Fix test

---------

Co-authored-by: jangko <jangko128@gmail.com>
2023-12-14 06:56:54 +07:00
Eugene Kabanov 195c8c60b4
Fix send() transaction to be working again with EIP-155. (#105)
* Fix send() transaction to be working again with EIP-155.
Add tests.
---------

Co-authored-by: jangko <jangko128@gmail.com>
2023-12-13 13:23:31 +07:00
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