Web3SuiEx.Starcoin.Caller.Contract (web3_sui_ex v0.1.1)

api about contract

Link to this section Summary

Functions

Contract call_v2. Metion: 0x01) func id could be built by Caller.build_namespace 0x02) hex can be tranfered into starcoin_bytes in type_translator example

Verify that the user signature is executable.

get account sequence number

Resolve contract function. get the input type when calling the contract method If the first argument is of type Signer, that the current method requires a signature to be executed

Link to this section Functions

Link to this function

build_payload(function_id, args)

Link to this function

build_payload(function_id, type_args, args)

Link to this function

call_v2(endpoint, function_id, args)

@spec call_v2(String.t(), String.t(), list()) :: any()

Contract call_v2. Metion: 0x01) func id could be built by Caller.build_namespace 0x02) hex can be tranfered into starcoin_bytes in type_translator example:

Web3SuiEx.Caller.Contract.call_v2(
  "http://localhost:9851",
  "0x1168e88ffc5cec53b398b42d61885bbb::EthSigVerifier::verify_eth_sig",
  [],
    ["x"90a938f7457df6e8f741264c32697fc52f9a8f867c52dd70713d9d2d472f2e415d9c94148991bbe1f4a1818d1dff09165782749c877f5cf1eff4ef126e55714d1c"",  "x"29c76e6ad8f28bb1004902578fb108c507be341b"",  "x"b453bd4e271eed985cbab8231da609c4ce0a9cf1f763b6c1594e76315510e0f1""])
Link to this function

call_v2(endpoint, function_id, type_args, args)

@spec call_v2(String.t(), String.t(), list(), list()) :: any()
Link to this function

dry_run_raw(endpoint, hex_signed_data, public_key)

Verify that the user signature is executable.

Link to this function

get_code(endpoint, module_path)

Contract get code:

get_code( "http://localhost:9851", "0x1::Account")
Link to this function

get_resource(endpoint, address, resource_path)

for example:

{
  "id":101,
  "jsonrpc":"2.0",
  "method":"contract.get_resource",
  "params":["0x0000000000000000000000000a550c18", "0x1::Account::Balance<0x1::STC::STC>"]
}
Link to this function

get_sequence_number(endpoint, address)

get account sequence number

Link to this function

resolve_function(endpoint, params)

Resolve contract function. get the input type when calling the contract method If the first argument is of type Signer, that the current method requires a signature to be executed

example

Example

# transfer token to another account

iex> Web3SuiEx.Starcoin.Caller.Contract.Web3SuiEx.Starcoin.Caller.Contract(0x00000000000000000000000000000001::TransferScripts::peer_to_peer_v2)

[

{
    "doc": "",
    "name": "p0",
    "type_tag": "Signer"
},
{
    "doc": "",
    "name": "p1",
    "type_tag": "Address"
},
{
    "doc": "",
    "name": "p2",
    "type_tag": "U128"
}

]