nim-codex/tests/contracts/testInteractions.nim
markspanbroek 097a4cfd67
Better command line options for Ethereum (#181)
* [contracts] ContractInteractions.new() now requires account parameter

* [cli] Only perform Ethereum interactions when --eth-account is specified

* [cli] Add --persistence option that is disabled by default

* [cli] Use Option for ethDeployment parameter

* [node] Better error reporting when Ethereum node cannot be reached
2022-08-09 06:29:06 +02:00

35 lines
971 B
Nim

import std/os
import codex/contracts
import ../ethertest
import ./examples
ethersuite "Storage Contract Interactions":
let account = Address.example
var contracts: ContractInteractions
setup:
contracts = !ContractInteractions.new(account)
test "can be instantiated with a signer and deployment info":
let signer = provider.getSigner()
let deployment = deployment()
check ContractInteractions.new(signer, deployment).isSome
test "can be instantiated with a provider url":
let url = "http://localhost:8545"
let account = Address.example
let deployment = "vendor" / "dagger-contracts" / "deployment-localhost.json"
check ContractInteractions.new(url, account).isSome
check ContractInteractions.new(url, account, deployment).isSome
test "provides purchasing":
check contracts.purchasing != nil
test "provides sales":
check contracts.sales != nil
test "provides proving":
check contracts.proving != nil