eosjs API学习

2018-05-31  本文已影响3384人  糖果果老师

getCurrencyBalance


"get_currency_balance": {
  "params": {
    "code": "name",
    "account": "name",
    "symbol": "optional<string>"
  },
  "results": "asset[]"
}

getCurrencyStats


"get_currency_stats": {
  "params": {
    "code": "name",
    "symbol": "string"
  },
  "results": {
    "supply": "asset",
    "max_supply": "asset",
    "issuer": "account_name"
  }
}

getProducers


"get_producers": {
  "brief": "Fetch smart contract data from producer.",
  "params": {
    "json": { "type": "bool", "default": false},
    "lower_bound": "string",
    "limit": {"type": "uint32", "default": "10"}
  },
  "results": {
    "rows": {
      "type": "vector",
      "doc": "one row per item, either encoded as hex String or JSON object"
    },
    "total_producer_vote_weight": {
      "type": "float64",
      "doc": "total vote"
    },
    "more": {
      "type": "string",
      "doc": "fill lower_bound with this value to fetch more rows"
    }
  }
}

getInfo


"get_info": {
  "brief": "Return general network information.",
  "params": null,
  "results": {
    "server_version" : "string",
    "head_block_num" : "uint32",
    "last_irreversible_block_num" : "uint32",
    "last_irreversible_block_id" : "block_id",
    "head_block_id" : "block_id",
    "head_block_time" : "time_point_sec",
    "head_block_producer" : "account_name",
    "virtual_block_cpu_limit" : "uint64",
    "virtual_block_net_limit" : "uint64",
    "block_cpu_limit" : "uint64",
    "block_net_limit" : "uint64"
  }
}

getBlock


"get_block": {
  "brief": "Fetch a block from the blockchain.",
  "params": {
    "block_num_or_id": "string"
  },
  "results": "variant",
  "errors": {
    "unknown block": null
  }
}

getAccount


"get_account": {
  "brief": "Fetch a blockchain account",
  "params": {
    "account_name": "name"
  },
  "results": {
    "account_name": "name",
    "privileged": "bool",
    "last_code_update": "time_point",
    "created": "time_point",
    "ram_quota": "int64",
    "net_weight": "int64",
    "cpu_weight": "int64",
    "net_limit": "int64",
    "cpu_limit": "int64",
    "ram_usage": "int64",
    "permissions": "vector<permission>",
    "total_resources": "variant",
    "delegated_bandwidth": "variant",
    "voter_info": "variant"
  }
}

getCode


"get_code": {
  "brief": "Fetch smart contract code",
  "params": {
    "account_name": "name"
  },
  "results": {
    "account_name": "name",
    "wast": "string",
    "code_hash": "sha256",
    "abi": "optional<abi_def>"
  }
}

getTableRows


"get_table_rows": {
  "brief": "Fetch smart contract data from an account.",
  "params": {
    "json": { "type": "bool", "default": false},
    "code": "name",
    "scope": "name",
    "table": "name",
    "table_key": "string",
    "lower_bound": {"type": "string", "default": "0"},
    "upper_bound": {"type": "string", "default": "-1"},
    "limit": {"type": "uint32", "default": "10"}
  },
  "results": {
    "rows": {
      "type": "vector",
      "doc": "one row per item, either encoded as hex String or JSON object"
    },
    "more": {
      "type": "bool",
      "doc": "true if last element"
    }
  }
}

abiJsonToBin


"abi_json_to_bin": {
  "brief": "Manually serialize json into binary hex.  The binayargs is usually stored in Action.data.",
  "params": {
    "code": "name",
    "action": "name",
    "args": "bytes"
  },
  "results": {
    "binargs": "bytes"
  }
}

abiBinToJson


"abi_bin_to_json": {
  "brief": "Convert bin hex back into Abi json definition.",
  "params": {
    "code": "name",
    "action": "name",
    "binargs": "bytes"
  },
  "results": {
    "args": "bytes",
    "required_scope": "name[]",
    "required_auth": "name[]"
  }
}

getRequiredKeys


"get_required_keys": {
  "params": {
    "transaction": "transaction",
    "available_keys": "set[public_key]"
  },
  "results": "Set[public_key]"
}

pushBlock


"push_block": {
  "brief": "Append a block to the chain database.",
  "params": {
    "block": "signed_block"
  },
  "results": null
}

pushTransaction


"push_transaction": {
  "brief": "Attempts to push the transaction into the pending queue.",
  "params": {
    "signed_transaction": "signed_transaction"
  },
  "results": {
    "transaction_id": "fixed_bytes32",
    "processed": "bytes"
  }
}

pushTransactions


"push_transactions": {
  "brief": "Attempts to push transactions into the pending queue.",
  "params": {
    "signed_transaction[]": "signed_transaction"
  },
  "results": "vector[push_transaction.results]"
}

getActions


"get_actions": {
  "params": {
    "account_name": "account_name",
    "pos": "int32?",
    "offset": "int32?"
  },
  "results": {
    "actions": "ordered_action_result[]",
    "last_irreversible_block": "uint32",
    "time_limit_exceeded_error": "bool?"
  },
  "structs": [{
    "name": "ordered_action_result",
    "fields": {
      "global_action_seq": "uint64",
      "account_action_seq": "int32",
      "block_num": "uint32",
      "block_time": "block_timestamp_type",
      "action_trace": "variant"
    }
  }]
}

getControlledAccounts


"get_controlled_accounts": {
  "params": {
    "controlling_account": "account_name"
  },
  "results": {
    "controlled_accounts": "account_name[]"
  }
}

getKeyAccounts


"get_key_accounts": {
  "params": {
    "public_key": "public_key_type"
  },
  "results": {
    "account_names": "account_name[]"
  }
}

getTransaction


"get_transaction": {
  "brief": "Retrieve a transaction from the blockchain.",
  "params": {
    "id": "transaction_id_type"
  },
  "results": {
    "id": "transaction_id_type",
    "trx": "variant",
    "block_time": "block_timestamp_type",
    "block_num": "uint32",
    "last_irreversible_block": "uint32",
    "traces": "variant[]"
  }
}

bidname


"bidname": {
  "base": "",
  "action": {
    "name": "bidname",
    "account": "eosio"
  },
  "fields": {
    "bidder": "account_name",
    "newname": "account_name",
    "bid": "asset"
  }
}

buyram


"buyram": {
  "base": "",
  "action": {
    "name": "buyram",
    "account": "eosio"
  },
  "fields": {
    "payer": "account_name",
    "receiver": "account_name",
    "quant": "asset"
  }
}

buyrambytes


"buyrambytes": {
  "base": "",
  "action": {
    "name": "buyrambytes",
    "account": "eosio"
  },
  "fields": {
    "payer": "account_name",
    "receiver": "account_name",
    "bytes": "uint32"
  }
}

canceldelay


"canceldelay": {
  "base": "",
  "action": {
    "name": "canceldelay",
    "account": "eosio"
  },
  "fields": {
    "canceling_auth": "permission_level",
    "trx_id": "transaction_id_type"
  }
}

claimrewards


"claimrewards": {
  "base": "",
  "action": {
    "name": "claimrewards",
    "account": "eosio"
  },
  "fields": {
    "owner": "account_name"
  }
}

delegatebw


"delegatebw": {
  "base": "",
  "action": {
    "name": "delegatebw",
    "account": "eosio"
  },
  "fields": {
    "from": "account_name",
    "receiver": "account_name",
    "stake_net_quantity": "asset",
    "stake_cpu_quantity": "asset",
    "transfer": "bool"
  }
}

deleteauth


"deleteauth": {
  "base": "",
  "action": {
    "name": "deleteauth",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "permission": "permission_name"
  }
}

linkauth


"linkauth": {
  "base": "",
  "action": {
    "name": "linkauth",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "code": "account_name",
    "type": "action_name",
    "requirement": "permission_name"
  }
}

newaccount


"newaccount": {
  "base": "",
  "action": {
    "name": "newaccount",
    "account": "eosio"
  },
  "fields": {
    "creator": "account_name",
    "name": "account_name",
    "owner": "authority",
    "active": "authority"
  }
}

onerror


"onerror": {
  "base": "",
  "action": {
    "name": "onerror",
    "account": "eosio"
  },
  "fields": {
    "sender_id": "uint128",
    "sent_trx": "bytes"
  }
}

refund


"refund": {
  "base": "",
  "action": {
    "name": "refund",
    "account": "eosio"
  },
  "fields": {
    "owner": "account_name"
  }
}

regproducer


"regproducer": {
  "base": "",
  "action": {
    "name": "regproducer",
    "account": "eosio"
  },
  "fields": {
    "producer": "account_name",
    "producer_key": "public_key",
    "url": "string",
    "location": "uint16"
  }
}

regproxy


"regproxy": {
  "base": "",
  "action": {
    "name": "regproxy",
    "account": "eosio"
  },
  "fields": {
    "proxy": "account_name",
    "isproxy": "bool"
  }
}

reqauth


"require_auth": {
  "base": "",
  "action": {
    "name": "reqauth",
    "account": "eosio"
  },
  "fields": {
    "from": "account_name"
  }
}

sellram


"sellram": {
  "base": "",
  "action": {
    "name": "sellram",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "bytes": "uint64"
  }
}

setalimits


"set_account_limits": {
  "base": "",
  "action": {
    "name": "setalimits",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "ram_bytes": "int64",
    "net_weight": "int64",
    "cpu_weight": "int64"
  }
}

setglimits


"set_global_limits": {
  "base": "",
  "action": {
    "name": "setglimits",
    "account": "eosio"
  },
  "fields": {
    "cpu_usec_per_period": "int64"
  }
}

setprods


"set_producers": {
  "base": "",
  "action": {
    "name": "setprods",
    "account": "eosio"
  },
  "fields": {
    "schedule": "producer_key[]"
  }
}

setabi


"setabi": {
  "base": "",
  "action": {
    "name": "setabi",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "abi": "abi_def"
  }
}

setcode


"setcode": {
  "base": "",
  "action": {
    "name": "setcode",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "vmtype": "uint8",
    "vmversion": "uint8",
    "code": "bytes"
  }
}

setparams


"setparams": {
  "base": "",
  "action": {
    "name": "setparams",
    "account": "eosio"
  },
  "fields": {
    "params": "eosio_parameters"
  }
}

setpriv


"setpriv": {
  "base": "",
  "action": {
    "name": "setpriv",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "is_priv": "int8"
  }
}

##setram

"setram": {
"base": "",
"action": {
"name": "setram",
"account": "eosio"
},
"fields": {
"max_ram_size": "uint64"
}
}

undelegatebw


"undelegatebw": {
  "base": "",
  "action": {
    "name": "undelegatebw",
    "account": "eosio"
  },
  "fields": {
    "from": "account_name",
    "receiver": "account_name",
    "unstake_net_quantity": "asset",
    "unstake_cpu_quantity": "asset"
  }
}

unlinkauth


"unlinkauth": {
  "base": "",
  "action": {
    "name": "unlinkauth",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "code": "account_name",
    "type": "action_name"
  }
}

unregprod


"unregprod": {
  "base": "",
  "action": {
    "name": "unregprod",
    "account": "eosio"
  },
  "fields": {
    "producer": "account_name"
  }
}

updateauth


"updateauth": {
  "base": "",
  "action": {
    "name": "updateauth",
    "account": "eosio"
  },
  "fields": {
    "account": "account_name",
    "permission": "permission_name",
    "parent": "permission_name",
    "auth": "authority"
  }
}

voteproducer


"voteproducer": {
  "base": "",
  "action": {
    "name": "voteproducer",
    "account": "eosio"
  },
  "fields": {
    "voter": "account_name",
    "proxy": "account_name",
    "producers": "account_name[]"
  }
}

create


"create": {
  "base": "",
  "action": {
    "name": "create",
    "account": "eosio.token"
  },
  "fields": {
    "issuer": "account_name",
    "maximum_supply": "asset"
  }
}

issue


"issue": {
  "base": "",
  "action": {
    "name": "issue",
    "account": "eosio.token"
  },
  "fields": {
    "to": "account_name",
    "quantity": "asset",
    "memo": "string"
  }
}

transfer


"transfer": {
  "base": "",
  "action": {
    "name": "transfer",
    "account": "eosio.token"
  },
  "fields": {
    "from": "account_name",
    "to": "account_name",
    "quantity": "asset",
    "memo": "string"
  }
}

createTransaction

transaction

contract

上一篇下一篇

猜你喜欢

热点阅读