mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-05 23:23:08 +00:00
remove CatchableError from contract macro async raises list
This commit is contained in:
parent
f088cde27f
commit
6c6aadcfc9
@ -19,6 +19,8 @@ export events
|
|||||||
export errors.SolidityError
|
export errors.SolidityError
|
||||||
export errors.errors
|
export errors.errors
|
||||||
|
|
||||||
|
{.push raises: [].}
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "ethers contract"
|
topics = "ethers contract"
|
||||||
|
|
||||||
@ -40,6 +42,7 @@ type
|
|||||||
response*: ?TransactionResponse
|
response*: ?TransactionResponse
|
||||||
convert*: ConvertCustomErrors
|
convert*: ConvertCustomErrors
|
||||||
EventHandler*[E: Event] = proc(event: ?!E) {.gcsafe, raises:[].}
|
EventHandler*[E: Event] = proc(event: ?!E) {.gcsafe, raises:[].}
|
||||||
|
ContractError* = object of EthersError
|
||||||
|
|
||||||
func new*(ContractType: type Contract,
|
func new*(ContractType: type Contract,
|
||||||
address: Address,
|
address: Address,
|
||||||
@ -48,10 +51,10 @@ func new*(ContractType: type Contract,
|
|||||||
|
|
||||||
func new*(ContractType: type Contract,
|
func new*(ContractType: type Contract,
|
||||||
address: Address,
|
address: Address,
|
||||||
signer: Signer): ContractType =
|
signer: Signer): ContractType {.raises: [SignerError].} =
|
||||||
ContractType(signer: some signer, provider: signer.provider, address: address)
|
ContractType(signer: some signer, provider: signer.provider, address: address)
|
||||||
|
|
||||||
func connect*[T: Contract](contract: T, provider: Provider | Signer): T =
|
func connect*[T: Contract](contract: T, provider: Provider | Signer): T {.raises: [SignerError].} =
|
||||||
T.new(contract.address, provider)
|
T.new(contract.address, provider)
|
||||||
|
|
||||||
func provider*(contract: Contract): Provider =
|
func provider*(contract: Contract): Provider =
|
||||||
@ -83,7 +86,7 @@ proc createTransaction(contract: Contract,
|
|||||||
gasLimit: overrides.gasLimit,
|
gasLimit: overrides.gasLimit,
|
||||||
)
|
)
|
||||||
|
|
||||||
proc decodeResponse(T: type, bytes: seq[byte]): T =
|
proc decodeResponse(T: type, bytes: seq[byte]): T {.raises: [ContractError].} =
|
||||||
without decoded =? AbiDecoder.decode(bytes, T):
|
without decoded =? AbiDecoder.decode(bytes, T):
|
||||||
raiseContractError "unable to decode return value as " & $T
|
raiseContractError "unable to decode return value as " & $T
|
||||||
return decoded
|
return decoded
|
||||||
@ -131,7 +134,7 @@ proc send(
|
|||||||
function: string,
|
function: string,
|
||||||
parameters: tuple,
|
parameters: tuple,
|
||||||
overrides = TransactionOverrides()
|
overrides = TransactionOverrides()
|
||||||
): Future[?TransactionResponse] {.async: (raises: [AsyncLockError, CancelledError, CatchableError]).} =
|
): Future[?TransactionResponse] {.async: (raises: [AsyncLockError, SignerError, ProviderError, CancelledError]).} =
|
||||||
|
|
||||||
if signer =? contract.signer:
|
if signer =? contract.signer:
|
||||||
withLock(signer):
|
withLock(signer):
|
||||||
@ -278,7 +281,6 @@ func addAsyncPragma(procedure: var NimNode) =
|
|||||||
newIdentNode("ProviderError"),
|
newIdentNode("ProviderError"),
|
||||||
newIdentNode("EthersError"),
|
newIdentNode("EthersError"),
|
||||||
newIdentNode("AsyncLockError"),
|
newIdentNode("AsyncLockError"),
|
||||||
newIdentNode("CatchableError"),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user