Closed CedarMist closed 11 months ago
Is there a library to generate python bindings for your solidity contract (similar to ethers for javascript) so you could do something like:
greeter = Greeter()
greeter.deploy().wait()
print(greeter.address)
Then, we could actually make a practical example and add it to our official documentation.
Is there a library to generate python bindings for your solidity contract (similar to ethers for javascript) so you could do something like:
greeter = Greeter() greeter.deploy().wait() print(greeter.address)
Then, we could actually make a practical example and add it to our official documentation.
Ah, it's ethers for python duh https://pypi.org/project/ethers/
web3.py allows a similar pattern: https://github.com/oasisprotocol/sapphire-paratime/pull/218/files#diff-00b5c90060622faf7d475f14961a2a6b11a9d4d8f1d316ab3c3408864bab5635R45
x = self.greeter.functions.blah().transact({'gasPrice': w3.eth.gas_price})
y = w3.eth.wait_for_transaction_receipt(x)
z = greeter.events.Greeting().process_receipt(y)
To support ethers-py we'd either have to add support for ethers-rs
or add a wrapper for ethers-py
, most people in Python land seem to use web3.py and ethers-py
doesn't have much usage.
This PR also relates to https://github.com/oasisprotocol/sapphire-paratime/issues/63
Closes: #63
Example usage:
The
sapphire.wrap
call must be added after anyconstruct_sign_and_send_raw_middleware
or similar signing middleware.It uses the
epoch
flag for encrypted envelopes, and handles re-fetching the calldata keypair if the epoch is too old. This isn't optimal behavior as if the client runs for any amount of time it will end up using an old keypair for calldata encryption as it doesn't know when the validity expires without first receiving an error.