Commit Graph

41 Commits

Author SHA1 Message Date
Eric 958d7b45d1
Remove overloaded UInt256.fromJson (#74)
* Remove overloaded UInt256.fromJson

Rely instead on UInt256.fromJson from nim-serde, which deserializes an empty string for ?UInt256 into UInt256.none. Previously, empty strings were deserialized into 0.u256. BlockNumber was using this deserialization, and it appears that deserializing a missing block number from a TransactionReceipt into 0 might actually cause some issues when waiting on block confirmations.

* bump version of serde

* Remove "v" from version in `.nimble`

* Fix nimble serde version again ¯\_(ツ)_/¯
2024-05-21 13:09:42 +10:00
Mark Spanbroek d46f5a10d3 version 0.8.0
Replaces version 0.7.2, because it includes
breaking changes
2024-02-27 09:13:36 +01:00
benbierens 7911ac6c57
version 0.7.2 2024-02-26 14:03:48 +01:00
Eric 43500c63d7
Upgrade to `nim-json-rpc` v0.4.2 and chronos v4 (#64)
* Add json de/serialization lib from codex to handle conversions

json-rpc now requires nim-json-serialization to convert types to/from json. Use the nim-json-serialization signatures to call the json serialization lib from nim-codex (should be moved to its own lib)

* Add ethers implementation for setMethodHandler

Was removed in json-rpc

* More json conversion updates

* Fix json_rpc.call returning JsonString instead of JsonNode

* Update exceptions

Use {.async: (raises: [...].} where needed
Annotate provider with {.push raises:[].}
Format signatures

* Start fixing tests (mainly conversion fixes)

* rename sender to `from`, update json error logging, add more conversions

* Refactor exceptions for providers and signers, fix more tests

- signer procs raise SignerError, provider procs raise ProviderError
- WalletError now inherits from SignerError
- move wallet module under signers
- create jsonrpo moudle under signers
- bump nim-json-rpc for null-handling fixes
- All jsonrpc provider tests passing, still need to fix others

* remove raises from async annotation for dynamic dispatch

- removes async: raises from getAddress and signTransaction because derived JsonRpcSigner methods were not being used when dynamically dispatched. Once `raises` was removed from the async annotation, the dynamic dispatch worked again. This is only the case for getAddress and signTransaction.
- add gcsafe annotation to wallet.provider so that it matches the base method

* Catch EstimateGasError before ProviderError

EstimateGasError is now a ProviderError (it is a SignerError, and SignerError is a ProviderError), so EstimateGasErrors were not being caught

* clean up - all tests passing

* support nim 2.0

* lock in chronos version

* Add serde options to the json util, along with tests

next step is to:
1. change back any ethers var names that were changed for serialization purposes, eg `from` and `type`
2. move the json util to its own lib

* bump json-rpc to 0.4.0 and fix test

* fix: specify raises for getAddress and sendTransaction

Fixes issue where getAddress and sendTransaction could not be found for MockSigner in tests. The problem was that the async: raises update had not been applied to the MockSigner.

* handle exceptions during jsonrpc init

There are too many exceptions to catch individually, including chronos raising CatchableError exceptions in await expansion. There are also many other errors captured inside of the new proc with CatchableError. Instead of making it more complicated and harder to read, I think sticking with excepting CatchableError inside of convertError is a sensible solution

* cleanup

* deserialize key defaults to serialize key

* Add more tests for OptIn/OptOut/Strict modes, fix logic

* use nim-serde instead of json util

Allows aliasing of de/serialized fields, so revert changes of sender to `from` and transactionType to `type`

* Move hash* shim to its own module

* address PR feedback

- add comments to hashes shim
- remove .catch from callback condition
- derive SignerError from EthersError instead of ProviderError. This allows Providers and Signers to be separate, as Ledger does it, to isolate functionality. Some signer functions now raise both ProviderError and SignerError
- Update reverts to check for SignerError
- Update ERC-20 method comment

* rename subscriptions.init > subscriptions.start
2024-02-19 16:50:46 +11:00
Mark Spanbroek fd16d71ea5 version 0.7.1 2023-12-12 09:28:52 +01:00
Mark Spanbroek c25de86656 remove upraises
we no longer support nim 1.2.x,
so upraises is no longer necessary
2023-12-12 09:28:06 +01:00
Eric 2428b756d6
On transaction failure, fetch revert reason with replayed transaction (#57)
When transaction fails (receipt.status is Failed), fetch revert reason by replaying transaction.
2023-10-25 11:36:00 +11:00
Mark Spanbroek 8fff63102a version 0.7.0 2023-09-13 13:54:41 +02:00
Mark Spanbroek 2ec0313dd3 version 0.6.0
updated contractabi brings in breaking change in nimcrypto
2023-08-29 12:25:39 +02:00
Mark Spanbroek 9327294044 update contractabi to 0.6.0 2023-08-29 12:25:39 +02:00
Eric 9f4f762e21
version 0.5.0
Breaking change:
`Filter` has been changed to `EventFilter` to be inline with ethers.js. `Filter` is used for creating subscriptions in `nim-ethers`. All previously-created instances of `Filter` in your consuming application code should be changed to `EventFilter`.
2023-07-24 15:54:18 +10:00
Mark Spanbroek c49311fca2 version 0.4.0 2023-07-05 15:09:31 +02:00
Mark Spanbroek e086b71b42 version 0.3.0 2023-07-04 12:58:48 +02:00
Mark Spanbroek 0674548ecc Update contractabi to 0.5.0 2023-07-03 13:09:09 +02:00
Adam Uhlíř 18e225607c
fix: eth_call use signers address (#43) 2023-06-13 16:24:59 +02:00
Mark Spanbroek 5a4f786757 version 0.2.5 2023-04-19 10:06:04 +02:00
Mark Spanbroek e462649aec version 0.2.4 2022-11-10 10:22:24 +01:00
Eric Mastro fc3cc9c577 version 0.2.3, bump contractabi 2022-09-21 10:27:45 +10:00
Eric Mastro bbabee3727 update contractabi dependency to support distinct 2022-09-21 10:27:45 +10:00
Eric Mastro 01d277f801 version 0.2.2 2022-09-21 10:27:45 +10:00
Mark Spanbroek e8d0fdf1a9 version 0.2.1 2022-08-08 15:14:11 +02:00
Jackie e01ef1daf8 Add new requirement 2022-08-08 12:40:36 +02:00
Mark Spanbroek 440ca6360b Version 0.2.0
Backwards incompatible because:
- Raises EthersError instead of JsonRpcError
- Nim 1.4.x no longer supported
2022-06-30 10:52:12 +02:00
Mark Spanbroek a626070532 version 0.1.9 2022-06-15 10:54:45 +02:00
Mark Spanbroek 00b511cc9b Allow enums to be used as function parameters 2022-06-15 10:52:35 +02:00
Mark Spanbroek 78115cdd4b version 0.1.8 2022-06-08 11:24:38 +02:00
Eric Mastro 270d358b86
version 0.1.7 2022-05-23 11:31:16 +10:00
Mark Spanbroek 0549800af6 version 0.1.6 2022-05-17 19:28:52 +02:00
Mark Spanbroek 8c45babcdf version 0.1.5 2022-04-19 17:57:16 +02:00
Mark Spanbroek a0dca2674d version 0.1.4 2022-04-13 10:10:53 +02:00
Mark Spanbroek e3d5ce5122 Fix decoding of events with dynamic arguments
Such as byte sequences or strings.
2022-04-13 10:10:53 +02:00
Mark Spanbroek ac74b91f11 version 0.1.3 2022-03-29 10:48:00 +02:00
Mark Spanbroek fc8af1117c version 0.1.2 2022-03-17 10:30:42 +01:00
Mark Spanbroek acc4fc25e6 version 0.1.1 2022-03-16 14:20:56 +01:00
Mark Spanbroek ff5a35aac0 Define and subscribe to solidity events 2022-02-09 14:50:51 +01:00
Mark Spanbroek b965599a47 Use Address implementation from contractabi 2022-01-20 12:55:14 +01:00
Mark Spanbroek 177ed78d65 Ensure that no unexpected exceptions are raised 2022-01-18 14:51:53 +01:00
Mark Spanbroek 7bc102a421 Provider.getBlockNumber() 2022-01-18 14:26:41 +01:00
Mark Spanbroek 05366c4a49 Introduce JsonRpcProvider 2022-01-18 12:10:20 +01:00
Mark Spanbroek fe688bde79 Introduce Address type 2022-01-18 12:09:20 +01:00
Mark Spanbroek 898bf8f16f Project setup 2022-01-17 17:04:14 +01:00