/evaluateSmartContractTransactionWithContractInfo
1 min
POST
http://1.1.1.1/evaluateSmartContractTransactionWithContractInfo
from_addressstringthe address where the transaction is sent from.
contract_addressstringthe address of the contract to send to
gas_pricestring<p>the gas price we want to transfer with, in Wei - if None the gas price will be the default value from the eth call.</p>
function_namestring<p>representing the function name to call, e.g. "foo" (with no params).</p>
amountstring<p>the amount to send with this transaction, in Wei - if None the amount will be the default value from the eth call. transaction</p>
gas_limitstring<p>the gas limit we want to transfer, in gas units - if None the gas limit will be the default value from the eth call.</p>
evm_coin_symbolstring<p>the coin symbol of the EVM network on which the smart contract is deployed, for example: ETH, CELO, etc...</p>
parameters_fields_types_and_valuesobjectlist of pairs of "type" and value for each parameter in the function (see below)
e.g [["int","32432"],["bytes","0x1234567890"],["int8[3]",["-20","0","127"]],["string","got the idea, right?"]
Type:
string representing the parameters types, e.g. ["int32","uint256","string[]","bool"]
GK8 system supports all the types supported by solidity:
* uint<M>: unsigned integer type of M bits, 0 < M <= 256, M % 8 == 0. e.g. uint32, uint8, uint256. (uint is uint256)
* int<M>: signed integer type of M bits, 0 < M <= 256, M % 8 == 0. e.g. int32, int8, int256. (int is int256)
* address
* bool
* bytes<M>: binary type of M bytes, 0 < M <= 32
* function: an address (20 bytes) followed by a function selector (4 bytes)
* <type>[M]: an array of constant size of any type, e.g. int[32], string[7], bytes3[2],....
* bytes: an unlimited collection of bytes
* string: string in UTF8
* <type>[]: a variable-length array of elements of the given type. e.g. int[], string[], bytes3[],....
* tuple: (T1,T2,...,Tn): tuple consisting of the types T1, รขโฌยฆ, Tn, n >= 0, e.g. (int,string,int[32])
IMPORTANT: you must spell the type name correctly! No redundant spaces, no Capitals, spelling it in a wrong way will cause the request to fail.
Value:
representing the value of parameters in parameters_fields_types, e.g. ["12345678","34769874356980435879",[1,34,-1],["bl","cl","mkasdsa"],"True"]
Except than "function", "fixed length array" "variable-length array", "tuple", all the values must be given as strings, even ints.
Those 4 types are given as python lists containing in inner value in each cell. Some examples:
* uint<M>: any base 10 non negative number in range of M bits: "2131" / "12131" / "45678906543467890" / "0"
* int<M>: any base 10 number in range of two's complement M bits "2131" / "-2131" / "45678906543467890" / "0"
* address: any EVM address, 0x + 40 hex chars "0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9" / "0x0000C138F990B4ED9B7CB83F6AD8FF76017572B9" / "0xedf9c138f990b4ed9b7cb83f6ad8ff76017572b9"
* bool: "true" / "false"
* bytes<M>: given in hex with 0x prefix, must hold 2*M hex characters "0x00F9C138F990b4ed9b7c" / "0xEDF9C138F990B4ED9B7CB83F6AD8FF76017572B9" / "0xe9"
* function: a python list of length 2, holding address and one of "4 bytes digested function pointer e.g. 0x1234abcd" or "function declaration ready to be hashed, e.g. 'foo(int,string)'"
["0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9","0x1234abcd"] / ["0x0000C138F990B4ED9B7CB83F6AD8FF76017572B9","foo(int,string)"]
* <type>[M]: python list of <type>, e.g.
int[3] -> ["2342","-32432","1"]
bytes3[2] -> ["0x232323","0x000011","0xabABcd"]
bool[3] -> ["True","True","False"]
* bytes: same as bytes<M>, must start with 0x and hold an even non negative count of hex digits
* string: "hello world!" / "รยฉรลรโขรย รยขรโขรลรย!" / "Ethereum is so cool :)"
* <type>[]: same as <type>[M]
* tuple: (T1,T2,...,Tn): python list of the types, e.g.
(int,string,bool[3]) -> ["-2133242","tuples are kind of redundant,right?", ["True","True","False"]]
(int,string,(int, bool[3])) -> ["7","tuples are redundant", ["7",["True","True","False"]]]
bodyobjectRequest data for an Ethereum contract transaction.
200success
curl --request POST \
--url 'http://1.1.1.1/evaluateSmartContractTransactionWithContractInfo?from_address=0x862842A56B5D5F30B7d519cCe683983F57499cE6&contract_address=0x4022243F55675F33C8159A16Be7a22264ACBB545&gas_price=1000000000&function_name=transfer&amount=1&gas_limit=600000&evm_coin_symbol=ETH¶meters_fields_types_and_values=%22[%5Cn%20%20{%5C%22key%5C%22%3A%20%5C%22address%5C%22%2C%20%5C%22value%5C%22%3A%20%5C%220x6705ff69a6745ee35e2a7c3a0A8fb27698C7ea67%5C%22}%2C%5Cn%20%20{%5C%22key%5C%22%3A%20%5C%22uint%5C%22%2C%20%5C%22value%5C%22%3A%20%5C%221%5C%22}%5Cn]%5Cn%22' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"FunctionData": {
"Amount": "1",
"ContractAddress": "0x4022243F55675F33C8159A16Be7a22264ACBB545",
"DataForContract": {
"FunctionName": "transfer"
},
"EvmCoinSymbol": "ETH",
"FromAddress": "0x862842A56B5D5F30B7d519cCe683983F57499cE6",
"GasLimit": "600000",
"GasPrice": "1000000000"
},
"Meta": {
"FunctionName": "evaluateSmartContractTransactionWithContractInfo",
"RandomData": "288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229",
"Destination": "b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea",
"Time": "2021-02-07T18:37:46.948Z",
"Source": "048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99",
"AccessToken": "51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087"
}
}'This function evaluates a smart contract transaction including contract information by calling an ETH call and return the EthCallResponse๏ปฟ https://solidity.readthedocs.io/en/develop/abi-spec.html
- return - returns ETHCallReturnValue if succeed else error. (error examples shown below this line)
- return error examples -
- gas is too low - "err: intrinsic gas too low: have 21500, want 21572 (supplied gas 21500)"
- not an address of an eth contract - "0xe62862CBcE5C0c6F53B180Ee5dbf95a8AeA2dd60 is not an address of Ethereum contract!"
- revert - "execution reverted"
- success example -
- example - "EthCallReturnValue": "0000000000000000000000000000000000000000000000000000000000000001"
example-๏ปฟ
- evaluateSmartContractTransactionWithContractInfo("0xd38fcFD88C41F32E4711f3722375dD611b42A024","0x963d0aef2a6ba868b38cb032f2a81db145c467fb", "transfer",[("address","0x6705ff69a6745ee35e2a7c3a0A8fb27698C7ea67"),("uint","1")])๏ปฟ
Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.