Wallet Foreign API
Foreign API是钱包供他人调用的一侧。发送方将slate(交易协商数据)提交至此,并取回部分签名的slate;付款方的发票在此完成最终确认;挖矿节点向此请求构建支付给本钱包的coinbase输出。
- 端点:
http://127.0.0.1:3415/v2/foreign,通过epic-wallet listen启动 - 协议:JSON-RPC 2.0 over HTTP POST
- 凭据:无
- 默认绑定:
api_listen_interface为127.0.0.1,api_listen_port为3415(config/src/types.rs:71)
此处不支持凭据,因为完成转账的对方是陌生人,必须能够访问该接口。默认绑定为回环地址,因此对方若要通过HTTP访问本钱包,需要扩大监听接口或在其前端部署反向代理,访问限制只能在前端实现。改用epicbox中继接收则完全不需要开放入站端口。
当owner_api_include_foreign为true时,Owner监听器也提供相同的六个方法(controller/src/controller.rs:151)。
- Endpoint
http://127.0.0.1:3415/v2/foreign- Credential
- None. This is what a counterparty pays you through
- Methods here
- 6
- Documented against
- node 4.0.3, wallet 4.0.0
check_version
Read onlyReport the Foreign API and supported slate versions.
- Surface
/v2/foreignon port 3415- Parameters
- none
- Declared in
- api/src/foreign_rpc.rs:65
This method takes no parameters.
6 lines
{
"jsonrpc": "2.0",
"id": 1,
"method": "check_version",
"params": []
}Response
N/Abuild_coinbase
Changes stateBuild a coinbase output and kernel for a candidate block.
- Surface
/v2/foreignon port 3415- Parameters
- 1 positional
- Declared in
- api/src/foreign_rpc.rs:116
12 lines
{
"jsonrpc": "2.0",
"id": 1,
"method": "build_coinbase",
"params": [
{
"fees": 0,
"height": 1,
"key_id": null
}
]
}Response
N/Abuild_foundation
Changes stateBuild the foundation output and kernel for a candidate block.
- Surface
/v2/foreignon port 3415- Parameters
- 1 positional
- Declared in
- api/src/foreign_rpc.rs:119
12 lines
{
"jsonrpc": "2.0",
"id": 1,
"method": "build_foundation",
"params": [
{
"fees": 0,
"height": 1,
"key_id": null
}
]
}Response
N/Averify_slate_messages
Read onlyVerify message signatures attached to a slate.
- Surface
/v2/foreignon port 3415- Parameters
- 1 positional
- Declared in
- api/src/foreign_rpc.rs:201
8 lines
{
"jsonrpc": "2.0",
"id": 1,
"method": "verify_slate_messages",
"params": [
{}
]
}Response
N/Areceive_tx
Changes stateAdd the listener wallet output and signature to an incoming slate.
- Surface
/v2/foreignon port 3415- Parameters
- 4 positional
- Declared in
- api/src/foreign_rpc.rs:359
11 lines
{
"jsonrpc": "2.0",
"id": 1,
"method": "receive_tx",
"params": [
{},
null,
null,
null
]
}Response
N/Afinalize_invoice_tx
Changes stateFinalize an invoice slate after the payer has funded it.
- Surface
/v2/foreignon port 3415- Parameters
- 1 positional
- Declared in
- api/src/foreign_rpc.rs:532
8 lines
{
"jsonrpc": "2.0",
"id": 1,
"method": "finalize_invoice_tx",
"params": [
{}
]
}Response
N/A来源
api/src/foreign_rpc.rs:65定义了这六个方法controller/src/controller.rs:209是独立监听器libwallet/src/api_impl/foreign.rs为其背后的实现