Skip to content

Latest commit

 

History

History
91 lines (72 loc) · 2.18 KB

sendfrom.md

File metadata and controls

91 lines (72 loc) · 2.18 KB

sendfrom Method

Transfer from the specified address to the destination address.

  1. Install the plugin RpcServer
  2. Call the RPC method openwallet to open the wallet first.
{
  "jsonrpc": "2.0",
  "method": "sendfrom",
  "params": [asset_id, from, to, value],
  "id": 1
}

Parameter Description

  • asset_id:Asset ID(asset identifier), the script hash of nep-5 contract.
  • from: transfering address.
  • to: destination address.
  • value:Transfer amount

Example

Request body:

{
  "jsonrpc": "2.0",
  "method": "sendfrom",
  "params": ["602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7","AWg3L6W68bFfSS13Tf4rt8CRdG2ktaAjGb","AWg3L6W68bFfSS13Tf4rt8CRdG2ktaAjGb",1],
  "id": 1
}

Request body:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "txid": "0x60170ad03627ce45c7dd56ececbf33b26eab0845aa8b2cbbeecaefc5771b9eb1",
    "size": 262,
    "type": "ContractTransaction",
    "version": 0,
    "attributes": [],
    "vin": [
      {
        "txid": "0xd2188c1bd454ac883d79826e5c677deedb91cc61ec6d819df48ff4a963873adb",
        "vout": 1
      }
    ],
    "vout": [
      {
        "n": 0,
        "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
        "value": "1",
        "address": "AWg3L6W68bFfSS13Tf4rt8CRdG2ktaAjGb"
      },
      {
        "n": 1,
        "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
        "value": "17.4798197",
        "address": "AWg3L6W68bFfSS13Tf4rt8CRdG2ktaAjGb"
      }
    ],
    "sys_fee": "0",
    "net_fee": "0",
    "scripts": [
      {
        "invocation": "40a8d40e1652d7ad0c7bb59ef8217237037824af54ee5e46f2fd096c44dd46ef27fa7255010e2a8a2166af8a904e13b96bd3ac82e791633685824c35e7f2731e79",
        "verification": "2102883118351f8f47107c83ab634dc7e4ffe29d274e7d3dcf70159c8935ff769bebac"
      }
    ]
  }
}

Response Description:

Returns the transaction details as above if the transaction was sent successfully; otherwise the transaction is failed.

If the signature is incomplete, a pending transaction is returned. If the balance is insufficient, an error message is returned.s