Interact with the Ethereum Blockchain
type Module implements Utils_Module @imports(
types: [
"Provider_Module",
"Provider_Connection",
"Utils_Module"
]
) {
getChainId(
connection: Connection
): String!
getSignerAddress(
connection: Connection
): String!
getSignerBalance(
blockTag: BigInt
connection: Connection
): BigInt!
getGasPrice(
connection: Connection
): BigInt!
estimateEip1559Fees(
connection: Connection
): Eip1559FeesEstimate!
getSignerTransactionCount(
blockTag: BigInt
connection: Connection
): BigInt!
checkAddress(
address: String!
connection: Connection
): Boolean!
callContractView(
address: String!
method: String!
args: [String!]
connection: Connection
): String!
callContractStatic(
address: String!
method: String!
args: [String!]
options: TxOptions
connection: Connection
): StaticTxResult!
getBalance(
address: String!
blockTag: BigInt
connection: Connection
): BigInt!
getTransaction(
hash: String!
connection: Connection
): TxResponse!
sendRpc(
method: String!
params: [String!]!
connection: Connection
): String!
estimateTransactionGas(
tx: TxRequest!
connection: Connection
): BigInt!
awaitTransaction(
txHash: String!
confirmations: UInt32!
timeout: UInt32
connection: Connection
): TxReceipt!
sendTransaction(
tx: TxRequest!
connection: Connection
): TxResponse!
sendTransactionAndWait(
tx: TxRequest!
connection: Connection
): TxReceipt!
deployContract(
abi: String!
bytecode: String!
args: [String!]
options: TxOptions
connection: Connection
): String!
estimateContractCallGas(
address: String!
method: String!
args: [String!]
options: TxOptions
connection: Connection
): BigInt!
callContractMethod(
address: String!
method: String!
args: [String!]
options: TxOptions
connection: Connection
): TxResponse!
callContractMethodAndWait(
address: String!
method: String!
args: [String!]
options: TxOptions
connection: Connection
): TxReceipt!
signMessage(
message: String!
connection: Connection
): String!
signMessageBytes(
bytes: Bytes!
connection: Connection
): String!
signTransaction(
tx: TxRequest!
connection: Connection
): String!
signTypedData(
payload: JSON!
connection: Connection
): String!
generateCreate2Address(
address: String!
salt: String!
initCode: String!
): String!
keccak256BytesEncodePacked(
value: String!
): String!
keccak256(
value: String!
): String!
encodeMetaTransaction(
operation: BigInt
to: String!
value: BigInt!
data: String!
): String!
encodeParams(
types: [String!]!
values: [String!]!
): String!
encodeFunction(
method: String!
args: [String!]
): String!
toWei(
eth: String!
): String!
toEth(
wei: String!
): String!
solidityPack(
types: [String!]!
values: [String!]!
): String!
}
type Connection {
node: String
networkNameOrChainId: String
}
type TxRequest {
to: String
from: String
data: String
type: UInt32
chainId: BigInt
accessList: [AccessItem!]
"""
Gas supplied for the transaction
"""
gasLimit: BigInt
"""
The max total fee to pay per unit of gas.
The difference between maxFeePerGas and baseFeePerGas + maxPriorityFeePerGas is “refunded” to the user.
This property is ignored when gasPrice is not null.
"""
maxFeePerGas: BigInt
"""
The gas price paid is baseFeePerGas + maxPriorityFeePerGas.
The difference between maxFeePerGas and baseFeePerGas + maxPriorityFeePerGas is “refunded” to the user.
This property is ignored when gasPrice is not null.
"""
maxPriorityFeePerGas: BigInt
"""
The gas price for legacy transactions.
If this property is not null, a legacy transaction will be sent and maxFeePerGas and maxPriorityFeePerGas will be ignored.
"""
gasPrice: BigInt
"""
Ether value sent with transaction
"""
value: BigInt
"""
Override default nonce
"""
nonce: UInt32
}
type AccessItem {
address: String!
storageKeys: [String!]!
}
type TxResponse {
hash: String!
to: String
from: String!
nonce: UInt32!
gasLimit: BigInt!
maxFeePerGas: BigInt
maxPriorityFeePerGas: BigInt
gasPrice: BigInt
value: BigInt!
chainId: BigInt!
blockNumber: BigInt
blockHash: String
timestamp: UInt32
r: String
s: String
v: UInt32
type: UInt32
accessList: [AccessItem!]
}
type Log {
blockNumber: BigInt!
blockHash: String!
transactionIndex: UInt32!
removed: Boolean!
address: String!
data: String!
topics: [String!]!
transactionHash: String!
logIndex: UInt32!
}
type TxReceipt {
to: String!
from: String!
contractAddress: String!
transactionIndex: UInt32!
root: String
gasUsed: BigInt!
logsBloom: String!
transactionHash: String!
logs: [Log!]!
blockNumber: BigInt!
blockHash: String!
confirmations: UInt32!
cumulativeGasUsed: BigInt!
effectiveGasPrice: BigInt!
type: UInt32!
status: UInt32
}
type TxOptions {
"""
Gas supplied for the transaction
"""
gasLimit: BigInt
"""
The max total fee to pay per unit of gas.
The difference between maxFeePerGas and baseFeePerGas + maxPriorityFeePerGas is “refunded” to the user.
This property is ignored when gasPrice is not null.
"""
maxFeePerGas: BigInt
"""
The gas price paid is baseFeePerGas + maxPriorityFeePerGas.
The difference between maxFeePerGas and baseFeePerGas + maxPriorityFeePerGas is “refunded” to the user.
This property is ignored when gasPrice is not null.
"""
maxPriorityFeePerGas: BigInt
"""
The gas price for legacy transactions.
If this property is not null, a legacy transaction will be sent and maxFeePerGas and maxPriorityFeePerGas will be ignored.
"""
gasPrice: BigInt
"""
Ether value sent with transaction
"""
value: BigInt
"""
Override default nonce
"""
nonce: UInt32
}
type StaticTxResult {
result: String!
error: Boolean!
}
type Eip1559FeesEstimate {
maxFeePerGas: BigInt!
maxPriorityFeePerGas: BigInt!
}
### Imported Modules START ###
type Provider_Module @imported(
uri: "wrapscan.io/polywrap/ethereum-wallet@1.0",
namespace: "Provider",
nativeType: "Module"
) {
"""
Send a remote RPC request to the registered provider
"""
request(
method: String!
params: JSON
connection: Provider_Connection
): JSON!
"""
Wait for a transaction to be confirmed
"""
waitForTransaction(
txHash: String!
confirmations: UInt32!
timeout: UInt32
connection: Provider_Connection
): Boolean!
"""
Get the ethereum address of the signer. Return null if signer is missing.
"""
signerAddress(
connection: Provider_Connection
): String
"""
Sign a message and return the signature. Throws if signer is missing.
"""
signMessage(
message: Bytes!
connection: Provider_Connection
): String!
"""
Sign a serialized unsigned transaction and return the signature. Throws if signer is missing.
This method requires a wallet-based signer with a private key, and is not needed for most use cases.
Typically, transactions are sent by `request` and signed by the wallet.
"""
signTransaction(
rlp: Bytes!
connection: Provider_Connection
): String!
}
type Utils_Module @imported(
uri: "wrapscan.io/polywrap/ethers-utils@1.0.1",
namespace: "Utils",
nativeType: "Module"
) {
"""
Generates a deterministic Ethereum address using the CREATE2 opcode.
Returns the generated address.
"""
generateCreate2Address(
address: String!
salt: String!
initCode: String!
): String!
"""
The input string of bytes will be `encode_packed`,
and then hashed using the Keccak-256 algorithm.
Returns the resulting hash as a string of bytes.
"""
keccak256BytesEncodePacked(
value: String!
): String!
"""
Hashes the given input using the Keccak-256 algorithm.
Returns the resulting hash as a string of bytes.
"""
keccak256(
value: String!
): String!
"""
Encodes a meta-transaction into a string that can be
signed and broadcast to the Ethereum network.
Returns the encoded meta-transaction as a string.
"""
encodeMetaTransaction(
operation: BigInt
to: String!
value: BigInt!
data: String!
): String!
"""
Encodes the given parameters into a string that can be
used in an Ethereum transaction.
Returns the encoded parameters as a string.
"""
encodeParams(
types: [String!]!
values: [String!]!
): String!
"""
Encodes the given function call into a string that can be used
in an Ethereum transaction.
Returns the encoded function call as a string.
"""
encodeFunction(
method: String!
args: [String!]
): String!
"""
Converts the given value in Ether to its equivalent value in Wei.
Returns the equivalent value in Wei as a string.
"""
toWei(
eth: String!
): String!
"""
Converts the given value in Wei to its equivalent value in Ether.
Returns the equivalent value in Ether as a string.
"""
toEth(
wei: String!
): String!
"""
Packs the given values into a tightly-packed byte array using
Solidity's packing rules.
Returns the packed byte array as a string.
"""
solidityPack(
types: [String!]!
values: [String!]!
): String!
}
### Imported Modules END ###
### Imported Objects START ###
type Provider_Connection @imported(
uri: "wrapscan.io/polywrap/ethereum-wallet@1.0",
namespace: "Provider",
nativeType: "Connection"
) {
node: String
networkNameOrChainId: String
}
### Imported Objects END ###
### Imported Envs START ###
### Imported Envs END ###