├── README.md ├── fsn-rpc-api.md └── wallet-dev-cn.md /README.md: -------------------------------------------------------------------------------- 1 | # FSN develop guide 2 | 3 | ## Tools 4 | 5 | Web wallet: https://www.myfusionwallet.com/ 6 | 7 | Block explorer: https://blocks.fusionnetwork.io/ 8 | 9 | Node Monitor: https://node.fusionnetwork.io/ 10 | 11 | Testnet faucet: https://https://fsn.dev/faucet/ 12 | 13 | ## Code 14 | 15 | FSN node code: https://github.com/FUSIONFoundation/efsn 16 | 17 | FSN JS SDK: https://github.com/FUSIONFoundation/web3-fusion-extend 18 | 19 | ## Docs 20 | 21 | White/Yellow paper: https://github.com/FUSIONFoundation/Documentation 22 | 23 | Run FSN node: https://fusionnetworks.zendesk.com/hc/en-us/categories/360001967614-Staking-On-Fusion-MainNet 24 | 25 | JavaScript API Doc: https://fusionapi.readthedocs.io/ 26 | 27 | RPC API doc: https://github.com/fsn-dev/fsn-rpc-api/blob/master/fsn-rpc-api.md 28 | 29 | ## API 30 | 31 | Web API Gateway: https://api.fusionnetwork.io/ 32 | 33 | Online RPC API(mainnet): https://fsn.dev/api 34 | 35 | Online RPC API(testnet): https://testnet.fsn.dev/api 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /fsn-rpc-api.md: -------------------------------------------------------------------------------- 1 | # FUSION JSON RPC API 2 | 3 | FUSION RPC is compatible with Ethereum's [JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) and [web3.js](https://github.com/ethereum/web3.js) API. In addition, FUSION's extended API include: Ticket, Asset, Timelock, USAN, Swap, Staking, etc. 4 | 5 | ## JSON RPC 6 | 7 | [JSON](http://json.org/) is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value pairs. 8 | 9 | [JSON-RPC](http://www.jsonrpc.org/specification) is a stateless, light-weight remote procedure call (RPC) protocol. Primarily this specification defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments. It uses JSON ([RFC 4627](http://www.ietf.org/rfc/rfc4627.txt)) as data format. 10 | 11 | 12 | ## JavaScript API 13 | 14 | To talk to an fusion node from inside a JavaScript application use the [web3.js](https://github.com/ethereum/web3.js) library, which gives a convenient interface for the RPC methods. 15 | FUSION's extended JavaScript API, See the [JavaScript API](https://fusionapi.readthedocs.io/) for more. 16 | 17 | ## JSON-RPC Endpoint 18 | 19 | Online RPC service: 20 | 21 | Testnet: https://testnet.fsn.dev/api 22 | 23 | Mainnet: https://fsn.dev/api 24 | 25 | Default JSON-RPC endpoints: 26 | 27 | | Client | URL | 28 | |-------|:------------:| 29 | | Go |http://localhost:9000 | 30 | 31 | 32 | You can start the HTTP JSON-RPC with the `--rpc` flag 33 | ```bash 34 | efsn --rpc 35 | ``` 36 | 37 | change the default port (9000) and listing address (localhost) with: 38 | 39 | ```bash 40 | efsn --rpc --rpcaddr --rpcport 41 | ``` 42 | 43 | If accessing the RPC from a browser, CORS will need to be enabled with the appropriate domain set. Otherwise, JavaScript calls are limit by the same-origin policy and requests will fail: 44 | 45 | ```bash 46 | efsn --rpc --rpccorsdomain "http://localhost:9000" 47 | ``` 48 | 49 | The JSON RPC can also be started from the efsn console using the `admin.startRPC(addr, port)` command. 50 | 51 | ## Curl Examples Explained 52 | 53 | The curl options below might return a response where the node complains about the content type, this is because the --data option sets the content type to application/x-www-form-urlencoded . If your node does complain, manually set the header by placing -H "Content-Type: application/json" at the start of the call. 54 | 55 | The examples also do not include the URL/IP & port combination which must be the last argument given to curl e.x. 127.0.0.1:9000 56 | 57 | ## JSON-RPC methods 58 | 59 | * [fsn_ticketPrice](#fsn_ticketPrice) 60 | * [fsn_getStakeInfo](#fsn_getStakeInfo) 61 | * [fsn_getBlockReward](#fsn_getBlockReward) 62 | * [fsntx_buyTicket](#fsntx_buyTicket) 63 | * [fsntx_buildBuyTicketTx](#fsntx_buildBuyTicketTx) 64 | * [fsn_allTickets](#fsn_allTickets) 65 | * [fsn_allTicketsByAddress](#fsn_allTicketsByAddress) 66 | * [fsn_totalNumberOfTickets](#fsn_totalNumberOfTickets) 67 | * [fsn_totalNumberOfTicketsByAddress](#fsn_totalNumberOfTicketsByAddress) 68 | * [fsntx_sendTimeLock](#fsntx_sendTimeLock) 69 | * [fsntx_assetToTimeLock](#fsntx_assetToTimeLock) 70 | * [fsntx_buildAssetToTimeLockTx](#fsntx_buildAssetToTimeLockTx) 71 | * [fsntx_timeLockToTimeLock](#fsntx_timeLockToTimeLock) 72 | * [fsntx_buildTimeLockToTimeLockTx](#fsntx_buildTimeLockToTimeLockTx) 73 | * [fsntx_timeLockToAsset](#fsntx_timeLockToAsset) 74 | * [fsntx_buildTimeLockToAssetTx](#fsntx_buildTimeLockToAssetTx) 75 | * [fsn_getTimeLockValueByInterval](#fsn_getTimeLockValueByInterval) 76 | * [fsn_getTimeLockBalance](#fsn_getTimeLockBalance) 77 | * [fsn_getAllTimeLockBalances](#fsn_getAllTimeLockBalances) 78 | * [fsntx_genAsset](#fsntx_genAsset) 79 | * [fsntx_buildGenAssetTx](#fsntx_buildGenAssetTx) 80 | * [fsntx_decAsset](#fsntx_decAsset) 81 | * [fsntx_buildDecAssetTx](#fsntx_buildDecAssetTx) 82 | * [fsntx_incAsset](#fsntx_incAsset) 83 | * [fsntx_buildIncAssetTx](#fsntx_buildIncAssetTx) 84 | * [fsntx_sendAsset](#fsntx_sendAsset) 85 | * [fsntx_buildSendAssetTx](#fsntx_buildSendAssetTx) 86 | * [fsn_getAllBalances](#fsn_getAllBalances) 87 | * [fsn_getLatestNotation](#fsn_getLatestNotation) 88 | * [fsntx_genNotation](#fsntx_genNotation) 89 | * [fsntx_buildGenNotationTx](#fsntx_buildGenNotationTx) 90 | * [fsn_getNotation](#fsn_getNotation) 91 | * [fsn_getAddressByNotation](#fsn_getAddressByNotation) 92 | * [fsn_getAsset](#fsn_getAsset) 93 | * [fsn_getBalance](#fsn_getBalance) 94 | * [fsntx_makeSwap](#fsntx_makeSwap) 95 | * [fsntx_buildMakeSwapTx](#fsntx_buildMakeSwapTx) 96 | * [fsn_getSwap](#fsn_getSwap) 97 | * [fsntx_takeSwap](#fsntx_takeSwap) 98 | * [fsntx_buildTakeSwapTx](#fsntx_buildTakeSwapTx) 99 | * [fsntx_recallSwap](#fsntx_recallSwap) 100 | * [fsntx_buildRecallSwapTx](#fsntx_buildRecallSwapTx) 101 | * [fsntx_makeMultiSwap](#fsntx_makeMultiSwap) 102 | * [fsntx_buildMakeMultiSwapTx](#fsntx_buildMakeMultiSwapTx) 103 | * [fsn_getMultiSwap](#fsn_getMultiSwap) 104 | * [fsntx_takeMultiSwap](#fsntx_takeMultiSwap) 105 | * [fsntx_buildTakeMultiSwapTx](#fsntx_buildTakeMultiSwapTx) 106 | * [fsntx_recallMultiSwap](#fsntx_recallMultiSwap) 107 | * [fsntx_buildRecallMultiSwapTx](#fsntx_buildRecallMultiSwapTx) 108 | * [fsntx_isAutoBuyTicket](#fsntx_isAutoBuyTicket) 109 | * [miner_startAutoBuyTicket](#miner_startAutoBuyTicket) 110 | * [miner_stopAutoBuyTicket](#miner_stopAutoBuyTicket) 111 | * [fsn_getTransactionAndReceipt](#fsn_getTransactionAndReceipt) 112 | * [fsn_allInfoByAddress](#fsn_allInfoByAddress) 113 | 114 | ## JSON RPC API Reference 115 | 116 | *** 117 | 118 | #### fsn_ticketPrice 119 | 120 | Return price of the ticket. 121 | 122 | ##### Parameters 123 | 124 | `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 125 | 126 | ```js 127 | params: [ 128 | "latest" // state at the latest block 129 | ] 130 | ``` 131 | 132 | ##### Return 133 | 134 | `QUANTITY` - integer of the current ticket price in wei. 135 | 136 | ##### Example 137 | ```js 138 | // Request 139 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_ticketPrice","params":["latest"],"id":1}' 140 | 141 | // Result 142 | { 143 | "jsonrpc": "2.0", 144 | "id": 1, 145 | "result": "5000000000000000000000" 146 | } 147 | 148 | ``` 149 | 150 | *** 151 | 152 | #### fsn_getStakeInfo 153 | 154 | Returns information about all miners. 155 | 156 | ##### Parameters 157 | 158 | `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 159 | 160 | ```js 161 | params: [ 162 | "latest" // state at the latest block 163 | ] 164 | ``` 165 | 166 | ##### Return 167 | 168 | `DATA` - all miners' address, total number of miners and tickets. 169 | 170 | ##### Example 171 | ```js 172 | // Request 173 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getStakeInfo","params":["latest"],"id":1}' 174 | 175 | // Result 176 | { 177 | "jsonrpc": "2.0", 178 | "id": 1, 179 | "result": { 180 | "stakeInfo": { 181 | "0x3a1b3b81ed061581558a81f11d63e03129347437": 2 182 | }, 183 | "summary": { 184 | "totalMiners": 1, 185 | "totalTickets": 2 186 | } 187 | } 188 | } 189 | 190 | ``` 191 | #### fsn_getBlockReward 192 | 193 | Returns block rewards. 194 | 195 | ##### Parameters 196 | 197 | `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 198 | 199 | ```js 200 | params: [ 201 | "latest" // state at the latest block 202 | ] 203 | ``` 204 | 205 | ##### Return 206 | 207 | `DATA` - the rewards of the block. 208 | 209 | ##### Example 210 | ```js 211 | // Request 212 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getBlockReward","params":["latest"],"id":1}' 213 | 214 | // Result 215 | { 216 | "jsonrpc":"2.0", 217 | "id":1, 218 | "result":"2500021952000000000" 219 | } 220 | 221 | ``` 222 | *** 223 | 224 | #### fsntx_buyTicket 225 | 226 | Return `hash` if successful ticket purchase. (Account has been unlocked) 227 | 228 | ##### Parameters 229 | 230 | `DATA`, from - The address for the account. 231 | 232 | ```js 233 | params: [{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac"}] 234 | ``` 235 | 236 | ##### Return 237 | 238 | `DATA`, 32 Bytes - The transaction hash. 239 | 240 | ##### Example 241 | ```js 242 | // Request 243 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buyTicket","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac"}],"id":1}' 244 | 245 | // Result 246 | { 247 | "jsonrpc":"2.0", 248 | "id":1, 249 | "result":"0x7bee2c9931da61d53da0cfbbc35b7614dd0283959f2e6023dc7792baeafe97f5" 250 | } 251 | 252 | ``` 253 | *** 254 | 255 | #### fsntx_buildBuyTicketTx 256 | 257 | Build buyTicket unsigned raw transaction. 258 | 259 | ##### Parameters 260 | 261 | `DATA`, from - The address for the account. 262 | 263 | ```js 264 | params: [{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac"}] 265 | ``` 266 | 267 | ##### Return 268 | 269 | `DATA`, unsigned raw transaction. 270 | 271 | ##### Example 272 | ```js 273 | // Request 274 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildBuyTicketTx","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac"}],"id":1}' 275 | 276 | // Result 277 | { 278 | "jsonrpc":"2.0", 279 | "id":1, 280 | "result":{ 281 | "nonce":"0x0", 282 | "gasPrice":"0x3b9aca00", 283 | "gas":"0x15f90", 284 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 285 | "value":"0x0", 286 | "input":"0xcd048bca845ee88333845f101033", 287 | "v":"0x0", 288 | "r":"0x0", 289 | "s":"0x0", 290 | "hash":"0xe73510d1333c4eea413325cfb0774de7e27dbf5417f1bbc52aab45c9614e850a" 291 | } 292 | } 293 | 294 | ``` 295 | 296 | *** 297 | 298 | #### fsn_allTickets 299 | 300 | Return all tickets to all accounts. 301 | 302 | ##### Parameters 303 | 304 | `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 305 | 306 | ```js 307 | params: [ 308 | "latest" // state at the latest block 309 | ] 310 | ``` 311 | 312 | ##### Return 313 | 314 | `DATA` - All tickets. 315 | 316 | ##### Example 317 | ```js 318 | // Request 319 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_allTickets","params":["latest"],"id":1}' 320 | 321 | // Result 322 | { 323 | "jsonrpc":"2.0", 324 | "id":1, 325 | "result":{ 326 | "0x07d523bfcfc6d1cb5973403e799b7808f94ea0a6b3fca745a9d814c3813015ca": 327 | { 328 | "Owner":"0x3a1b3b81ed061581558a81f11d63e03129347437", 329 | "Height":132, 330 | "StartTime":1567405502, 331 | "ExpireTime":1569997502, 332 | "Value":5000000000000000000000 333 | }, 334 | "0x0932192a10e7be74ea33ebd83b4cdffa613c0bd896803ac03b67b52f06cc20d7": 335 | { 336 | "Owner":"0x0963a18ea497b7724340fdfe4ff6e060d3f9e388", 337 | "Height":113, 338 | "StartTime":1567405255, 339 | "ExpireTime":1569997255, 340 | "Value":5000000000000000000000 341 | } 342 | } 343 | } 344 | ``` 345 | 346 | *** 347 | 348 | #### fsn_allTicketsByAddress 349 | 350 | Return all tickets of this address. 351 | 352 | ##### Parameters 353 | 354 | 1. `DATA`, address - The address for the account. 355 | 2. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 356 | 357 | ```js 358 | params: [ 359 | "0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 360 | "latest" // state at the latest block 361 | ] 362 | ``` 363 | 364 | ##### Return 365 | 366 | `DATA` - All tickets of the address. 367 | 368 | ##### Example 369 | ```js 370 | // Request 371 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_allTicketsByAddress","params":["0x5b15a29274c74cd7cae59cabf656873a0ea706ac","latest"],"id":1} 372 | 373 | // Result 374 | { 375 | "jsonrpc":"2.0", 376 | "id":1, 377 | "result": 378 | { 379 | "0x5bd28f3dbe5d56294c4f8db4f6db86df2210544e1d17d127930742a1f0b7edda": 380 | { 381 | "Owner":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 382 | "Height":180, 383 | "StartTime":1567406170, 384 | "ExpireTime":1569998170, 385 | "Value":5000000000000000000000 386 | } 387 | } 388 | } 389 | ``` 390 | 391 | *** 392 | 393 | #### fsn_totalNumberOfTickets 394 | 395 | Return the total number of all addresses. 396 | 397 | ##### Parameters 398 | 399 | `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 400 | 401 | ```js 402 | params: [ 403 | "latest" // state at the latest block 404 | ] 405 | ``` 406 | 407 | ##### Return 408 | 409 | `Number` - The total number of all tickets. 410 | 411 | ##### Example 412 | ```js 413 | // Request 414 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_totalNumberOfTickets","params":["latest"],"id":1}' 415 | 416 | // Result 417 | { 418 | "jsonrpc":"2.0", 419 | "id":1, 420 | "result":67 421 | } 422 | ``` 423 | 424 | *** 425 | 426 | #### fsn_totalNumberOfTicketsByAddress 427 | 428 | Return the total number of tickets by address. 429 | 430 | ##### Parameters 431 | 432 | 1. `String|Address`, 20 Bytes - The address for the account. 433 | 2. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 434 | 435 | ```js 436 | params: [ 437 | "0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 438 | "latest" // state at the latest block 439 | ] 440 | ``` 441 | 442 | ##### Return 443 | 444 | `Number` - The total number tickets of the address. 445 | 446 | ##### Example 447 | ```js 448 | // Request 449 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_totalNumberOfTicketsByAddress","params":["0x5b15a29274c74cd7cae59cabf656873a0ea706ac","latest"],"id":1}' 450 | 451 | // Result 452 | { 453 | "jsonrpc":"2.0", 454 | "id":1, 455 | "result":1 456 | } 457 | ``` 458 | 459 | *** 460 | #### fsntx_sendTimeLock 461 | 462 | Convert assets or timelock to timelock balance.(Account has been unlocked) 463 | 464 | ##### Parameters 465 | 466 | 1. `String|Address`, from - The address for the sending account. 467 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 468 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 469 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 470 | 5. `String|Hash`, asset - The hash of the asset. 471 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 472 | 7. `String|BigNumber`, value - The value for sending. 473 | 8. `String|HexNumber`, start - (optional) The start time of the time lock. 474 | 9. `Number`, end - (optional) The end time of the time lock. 475 | 476 | 477 | ```js 478 | 1.params: [{ 479 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 480 | "from":"0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1", 481 | "to":"0x66272b2bc4f7bc74f81a40ee8f4259bcf93d638e", 482 | "start":"0x5e4f5011", //2020/2/21 11:35:45 483 | "end":"0x5e758b91", //2020/3/21 11:35:45 484 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000 485 | }] 486 | 2.params: [{ 487 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 488 | "from":"0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1", 489 | "toUSAN":104, 490 | "start":"0x5e4f5011", //2020/2/21 11:35:45 491 | "end":"0x5e758b91", //2020/3/21 11:35:45 492 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000 493 | }] 494 | ``` 495 | 496 | ##### Return 497 | 498 | `DATA`, 32 Bytes - The transaction hash. 499 | 500 | ##### Example 501 | ```js 502 | // Request 503 | 1.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_sendTimeLock","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1","to":"0x66272b2bc4f7bc74f81a40ee8f4259bcf93d638e","start":"0x5e4f5011","end":"0x5e758b91","value":"0x1BC16D674EC80000"}],"id":1}' 504 | 505 | 2.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_sendTimeLock","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1","toUSAN":104,"start":"0x5e4f5011","end":"0x5e758b91","value":"0x1BC16D674EC80000"}],"id":1}' 506 | // Result 507 | { 508 | "jsonrpc":"2.0", 509 | "id":1, 510 | "result":"0xd3c4777df1e1ec47586c1ec16952dcdcc328f4a27808793824a7041a1a2035d6" 511 | } 512 | 513 | ``` 514 | 515 | #### fsntx_assetToTimeLock 516 | 517 | Convert assets to timelock balance.(Account has been unlocked) 518 | 519 | ##### Parameters 520 | 521 | 1. `String|Address`, from - The address for the sending account. 522 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 523 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 524 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 525 | 5. `String|Hash`, asset - The hash of the asset. 526 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 527 | 7. `String|BigNumber`, value - The value for sending. 528 | 8. `String|HexNumber`, start - (optional) The start time of the time lock. 529 | 9. `Number`, end - (optional) The end time of the time lock. 530 | 531 | 532 | ```js 533 | 1.params: [{ 534 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 535 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 536 | "to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 537 | "start":"0x5D6CD2FC", //2019/9/2 16:29:48 538 | "end":"0x5D945FFC", //2019/10/2 16:29:48 539 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000 540 | }] 541 | 2.params: [{ 542 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 543 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 544 | "toUSAN":104, 545 | "start":"0x5D6CD2FC", //2019/9/2 16:29:48 546 | "end":"0x5D945FFC", //2019/10/2 16:29:48 547 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000 548 | }] 549 | ``` 550 | 551 | ##### Return 552 | 553 | `DATA`, 32 Bytes - The transaction hash. 554 | 555 | ##### Example 556 | ```js 557 | // Request 558 | 1.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_assetToTimeLock","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","start":"0x5D6CD2FC","end":"0x5D945FFC","value":"0x1BC16D674EC80000"}],"id":1}' 559 | 560 | 2.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_assetToTimeLock","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","toUSAN":104,"start":"0x5D6CD2FC","end":"0x5D945FFC","value":"0x1BC16D674EC80000"}],"id":1}' 561 | // Result 562 | { 563 | "jsonrpc":"2.0", 564 | "id":1, 565 | "result":"0xa5c08546790e19974fbbb554878289147e439fff9f57e12cb40e63d1e3ea8096" 566 | } 567 | 568 | ``` 569 | *** 570 | #### fsntx_buildAssetToTimeLockTx 571 | 572 | Build assetToTimeLock unsigned raw transaction. 573 | 574 | ##### Parameters 575 | 576 | 1. `String|Address`, from - The address for the sending account. 577 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 578 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 579 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 580 | 5. `String|Hash`, asset - The hash of the asset. 581 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 582 | 7. `String|BigNumber`, value - The value for sending. 583 | 8. `String|HexNumber`, start - (optional) The start time of the time lock. 584 | 9. `Number`, end - (optional) The end time of the time lock. 585 | 586 | 587 | ```js 588 | 1.params: [{ 589 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 590 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 591 | "to":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 592 | "start":"0x5ee884db", //2020/6/16 16:37:32 593 | "end":"0x5f1011cc", //2020/7/16 16:37:32 594 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000 595 | }] 596 | 2.params: [{ 597 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 598 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 599 | "toUSAN":104, 600 | "start":"0x5ee884db", //2020/6/16 16:37:32 601 | "end":"0x5f1011cc", //2020/7/16 16:37:32 602 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000 603 | }] 604 | ``` 605 | 606 | ##### Return 607 | 608 | `DATA`, unsigned raw transaction. 609 | 610 | ##### Example 611 | ```js 612 | // Request 613 | 1.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildAssetToTimeLockTx","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","to":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","start":"0x5ee884db","end":"0x5f1011cc","value":"0x1BC16D674EC80000"}],"id":1}' 614 | 615 | 2.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildAssetToTimeLockTx","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","toUSAN":104,"start":"0x5ee884db","end":"0x5f1011cc","value":"0x1BC16D674EC80000"}],"id":1}' 616 | // Result 617 | { 618 | "jsonrpc":"2.0", 619 | "id":1, 620 | "result":{ 621 | "nonce":"0x0", 622 | "gasPrice":"0x3b9aca00", 623 | "gas":"0x15f90", 624 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 625 | "value":"0x0", 626 | "input":"0xf84f03b84cf84a80a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94cc9ea1c564fa513d6abd9339587dc4f886d7acc4845ee884db845f1011cc881bc16d674ec80000", 627 | "v":"0x0", 628 | "r":"0x0", 629 | "s":"0x0", 630 | "hash":"0x169f3ee737cc46f3ba020e9311b9e91ff9d46beb47bdb2d605e7601d97b9d545" 631 | } 632 | } 633 | 634 | ``` 635 | 636 | *** 637 | 638 | #### fsntx_timeLockToTimeLock 639 | 640 | Send a time locked asset to another account.(Account has been unlocked) 641 | 642 | ##### Parameters 643 | 644 | 1. `String|Address`, from - The address for the account. 645 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 646 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 647 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 648 | 5. `String|Hash`, asset - The hash of the asset. 649 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 650 | 7. `String|BigNumber`, value - The value for sending. 651 | 8. `String|HexNumber`, start - The start time of the time lock. 652 | 9. `String|HexNumber`, end - The end time of the time lock. 653 | 654 | 655 | ```js 656 | 1. params: [{ 657 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 658 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 659 | "to":"0x07718f21f889b84451727ada8c65952a597b2e78", 660 | "start":"0x5D6CD2FC", //2019/9/2 16:29:48 661 | "end":"0x5D945FFC", //2019/10/2 16:29:48 662 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 663 | }] 664 | 665 | 2. params: [{ 666 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 667 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 668 | "toUSAN":104, 669 | "start":"0x5D6CD2FC", //2019/9/2 16:29:48 670 | "end":"0x5D945FFC", //2019/10/2 16:29:48 671 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 672 | }] 673 | ``` 674 | 675 | ##### Return 676 | 677 | `DATA`, 32 Bytes - The transaction hash. 678 | 679 | ##### Example 680 | ```js 681 | // Request 682 | 1. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_timeLockToTimeLock","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","to":"0x07718f21f889b84451727ada8c65952a597b2e78","start":"0x5D6CD2FC","end":"0x5D945FFC","value":"0x1BC16D674EC80000"}],"id":1}' 683 | 684 | 2. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_timeLockToTimeLock","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","toUSAN":104,"start":"0x5D6CD2FC","end":"0x5D945FFC","value":"0x1BC16D674EC80000"}],"id":1}' 685 | 686 | // Result 687 | { 688 | "jsonrpc":"2.0", 689 | "id":1, 690 | "result":"0x7ca4fa378a8ece6f2db1fe41521c80edcda45fff270b0bc12c81ab269c651d27" 691 | } 692 | ``` 693 | *** 694 | 695 | #### fsntx_buildTimeLockToTimeLockTx 696 | 697 | Build timeLockToTimeLock unsigned raw transaction. 698 | ##### Parameters 699 | 700 | 1. `String|Address`, from - The address for the account. 701 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 702 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 703 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 704 | 5. `String|Hash`, asset - The hash of the asset. 705 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 706 | 7. `String|BigNumber`, value - The value for sending. 707 | 8. `String|HexNumber`, start - The start time of the time lock. 708 | 9. `String|HexNumber`, end - The end time of the time lock. 709 | 710 | 711 | ```js 712 | 1. params: [{ 713 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 714 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 715 | "to":"0x07718f21f889b84451727ada8c65952a597b2e78", 716 | "start":"0x5ee884db", //2020/6/16 16:37:32 717 | "end":"0x5f1011cc", //2020/7/16 16:37:32 718 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 719 | }] 720 | 721 | 2. params: [{ 722 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 723 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 724 | "toUSAN":104, 725 | "start":"0x5ee884db", //2020/6/16 16:37:32 726 | "end":"0x5f1011cc", //2020/7/16 16:37:32 727 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 728 | }] 729 | ``` 730 | 731 | ##### Return 732 | 733 | `DATA`, unsigned raw transaction. 734 | 735 | ##### Example 736 | ```js 737 | // Request 738 | 1. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildTimeLockToTimeLockTx","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","to":"0x07718f21f889b84451727ada8c65952a597b2e78","start":"0x5ee884db","end":"0x5f1011cc","value":"0x1BC16D674EC80000"}],"id":1}' 739 | 740 | 2. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildTimeLockToTimeLockTx","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","toUSAN":104,"start":"0x5ee884db","end":"0x5f1011cc","value":"0x1BC16D674EC80000"}],"id":1}' 741 | 742 | // Result 743 | { 744 | "jsonrpc":"2.0", 745 | "id":1, 746 | "result":{ 747 | "nonce":"0x0", 748 | "gasPrice":"0x3b9aca00", 749 | "gas":"0x15f90", 750 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 751 | "value":"0x0", 752 | "input":"0xf84f03b84cf84a01a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9407718f21f889b84451727ada8c65952a597b2e78845ee884db845f1011cc881bc16d674ec80000", 753 | "v":"0x0", 754 | "r":"0x0", 755 | "s":"0x0", 756 | "hash":"0xc27d2840674a0f6eae2b393668ce96adc143047f1f3f39e9dbb19498c94689d7" 757 | } 758 | } 759 | ``` 760 | 761 | *** 762 | 763 | #### fsntx_timeLockToAsset 764 | 765 | Convert timelock balance to asset.(Account has been unlocked) 766 | 767 | 768 | ##### Parameters 769 | 770 | 1. `String|Address`, from - The address for the account. 771 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 772 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 773 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 774 | 5. `String|Hash`, asset - The hash of the asset. 775 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 776 | 7. `String|BigNumber`, value - The value for sending. 777 | 8. `String|HexNumber`, start - (optional) The start time of the time lock. 778 | 9. `String|HexNumber`, end - (optional) The end time of the time lock. 779 | 780 | ```js 781 | 1. params: [{ 782 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 783 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 784 | "to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 785 | "start":"0x5D6CD2FC", //2019/9/2 16:29:48 786 | "end":"0x5D945FFC", //2019/10/2 16:29:48 787 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 788 | }] 789 | 790 | 2. params: [{ 791 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 792 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 793 | "toUSAN":104, 794 | "start":"0x5D6CD2FC", //2019/9/2 16:29:48 795 | "end":"0x5D945FFC", //2019/10/2 16:29:48 796 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 797 | }] 798 | ``` 799 | 800 | ##### Return 801 | 802 | `DATA`, 32 Bytes - The transaction hash. 803 | 804 | ##### Example 805 | ```js 806 | // Request 807 | 1.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_timeLockToAsset","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","start":"0x5D6CD2FC","end":"0x5D945FFC","value":"0x1BC16D674EC80000"}],"id":1}' 808 | 809 | 2.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_timeLockToAsset","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","toUSAN":104,"start":"0x5D6CD2FC","end":"0x5D945FFC","value":"0x1BC16D674EC80000"}],"id":1}' 810 | 811 | // Result 812 | { 813 | "jsonrpc":"2.0", 814 | "id":1, 815 | "result":"0xb8242235c1f4fa1bcbc22b65bdfd2ab19db97cdfdc3b804fa302f87eafcd69c2" 816 | } 817 | ``` 818 | *** 819 | #### fsntx_buildTimeLockToAssetTx 820 | 821 | Build timeLockToAsset unsigned raw transaction. 822 | 823 | 824 | ##### Parameters 825 | 826 | 1. `String|Address`, from - The address for the account. 827 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 828 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 829 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 830 | 5. `String|Hash`, asset - The hash of the asset. 831 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 832 | 7. `String|BigNumber`, value - The value for sending. 833 | 8. `String|HexNumber`, start - (optional) The start time of the time lock. 834 | 9. `String|HexNumber`, end - (optional) The end time of the time lock. 835 | 836 | ```js 837 | 1. params: [{ 838 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 839 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 840 | "to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 841 | "start":"0x5ee884db", //2020/6/16 16:37:32 842 | "end":"0x5f1011cc", //2020/7/16 16:37:32 843 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 844 | }] 845 | 846 | 2. params: [{ 847 | "asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 848 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 849 | "toUSAN":104, 850 | "start":"0x5ee884db", //2020/6/16 16:37:32 851 | "end":"0x5f1011cc", //2020/7/16 16:37:32 852 | "value":"0x1BC16D674EC80000" //2,000,000,000,000,000,000‬ 853 | }] 854 | ``` 855 | 856 | ##### Return 857 | 858 | `DATA`, unsigned raw transaction. 859 | 860 | ##### Example 861 | ```js 862 | // Request 863 | 1.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildTimeLockToAssetTx","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","to":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","start":"0x5ee884db","end":"0x5f1011cc","value":"0x1BC16D674EC80000"}],"id":1}' 864 | 865 | 2.curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildTimeLockToAssetTx","params":[{"asset":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","toUSAN":104,"start":"0x5ee884db","end":"0x5f1011cc","value":"0x1BC16D674EC80000"}],"id":1}' 866 | 867 | // Result 868 | { 869 | "jsonrpc":"2.0", 870 | "id":1, 871 | "result":{ 872 | "nonce":"0x0", 873 | "gasPrice":"0x3b9aca00", 874 | "gas":"0x15f90", 875 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 876 | "value":"0x0", 877 | "input":"0xf85303b850f84e02a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94cc9ea1c564fa513d6abd9339587dc4f886d7acc4845ee88d1a88ffffffffffffffff881bc16d674ec80000", 878 | "v":"0x0", 879 | "r":"0x0", 880 | "s":"0x0", 881 | "hash":"0xfe26e01c9f17a0c6c6b037c8872c61a398abb324fca4bf4387c55f63e63b468b" 882 | } 883 | } 884 | ``` 885 | 886 | *** 887 | 888 | #### fsn_getTimeLockValueByInterval 889 | 890 | Return transfer amount within specified time. 891 | 892 | 893 | ##### Parameters 894 | 895 | 1. `String|Hash`, assetID - The hash of the asset. 896 | 2. `String|Address`, address - The address for the account. 897 | 3. `String|HexNumber`, start - (optional) The start time of the time lock. 898 | 4. `String|HexNumber`, end - (optional) The end time of the time lock. 899 | 5. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 900 | 901 | 902 | ```js 903 | params: [{ 904 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 905 | "0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1", 906 | 0, // start time 907 | 0, // end time 908 | "latest" // state at the latest block 909 | }] 910 | ``` 911 | 912 | ##### Return 913 | 914 | `DATA`, The transfer amount within specified time. 915 | 916 | ##### Example 917 | ```js 918 | // Request 919 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getTimeLockValueByInterval","params":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1",0,0,"latest"],"id":1}' 920 | 921 | // Result 922 | { 923 | "jsonrpc":"2.0", 924 | "id":1, 925 | "result":"6000000000000000000" 926 | } 927 | ``` 928 | 929 | *** 930 | 931 | #### fsn_getTimeLockBalance 932 | 933 | Return time locked balance of assetID. 934 | 935 | 936 | ##### Parameters 937 | 938 | 1. `String|Hash`, assetID - The hash of the asset. 939 | 2. `String|Address`, address - The address for the account. 940 | 3. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 941 | 942 | 943 | ```js 944 | params: [{ 945 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 946 | "0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 947 | "latest" // state at the latest block 948 | }] 949 | ``` 950 | 951 | ##### Return 952 | 953 | `DATA`, The detail of the TimeLock balance. 954 | 955 | ##### Example 956 | ```js 957 | // Request 958 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getTimeLockBalance","params":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x5b15a29274c74cd7cae59cabf656873a0ea706ac","latest"],"id":1}' 959 | 960 | // Result 961 | { 962 | "jsonrpc":"2.0", 963 | "id":1, 964 | "result": 965 | { 966 | "Items": 967 | [{ 968 | "StartTime":1570002245, 969 | "EndTime":18446744073709551615, 970 | "Value":"5000000000000000000000" 971 | }] 972 | } 973 | } 974 | ``` 975 | 976 | *** 977 | 978 | #### fsn_getAllTimeLockBalances 979 | 980 | Return all time lock balances. 981 | 982 | ##### Parameters 983 | 984 | 1. `DATA`, 20 Bytes - The address for the account. 985 | 2. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 986 | 987 | ```js 988 | params: [{ 989 | "0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 990 | "latest" // state at the latest block 991 | }] 992 | ``` 993 | 994 | ##### Return 995 | 996 | `DATA`, The detail of the TimeLock balance. 997 | 998 | ##### Example 999 | ```js 1000 | // Request 1001 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getAllTimeLockBalances","params":["0x5b15a29274c74cd7cae59cabf656873a0ea706ac","latest"],"id":1}' 1002 | 1003 | // Result 1004 | { 1005 | "jsonrpc":"2.0", 1006 | "id":1, 1007 | "result": 1008 | { 1009 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": 1010 | { 1011 | "Items": 1012 | [{ 1013 | "StartTime":1570002245, 1014 | "EndTime":18446744073709551615, 1015 | "Value":"5000000000000000000000" 1016 | }] 1017 | } 1018 | } 1019 | } 1020 | 1021 | ``` 1022 | 1023 | *** 1024 | 1025 | #### fsntx_genAsset 1026 | 1027 | Generate new asset.(Account has been unlocked) 1028 | 1029 | ##### Parameters 1030 | 1031 | 1. `String|Address`, from - The address for the account. 1032 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1033 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1034 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1035 | 5. `String`, name - The name for the asset. 1036 | 6. `String`, symbol - The symbol for the asset. 1037 | 7. `Number`, decimals - The decimals for the asset. 1038 | 8. `String|BigNumber`, total - The total value for the asset. 1039 | 9. `bool`, canChange - Values can be changed. 1040 | 1041 | ```js 1042 | params: [{ 1043 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1044 | "name":"FusionTest", 1045 | "symbol":"FT", 1046 | "decimals":1, 1047 | "total":"0x200", 1048 | "canChange":true 1049 | }] 1050 | ``` 1051 | 1052 | ##### Return 1053 | 1054 | `DATA`, 32 Bytes - The transaction hash. 1055 | 1056 | ##### Example 1057 | ```js 1058 | // Request 1059 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_genAsset","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","name":"FusionTest","symbol":"FT","decimals":1,"total":"0x200","canChange":true}],"id":1}' 1060 | 1061 | // Result 1062 | { 1063 | "jsonrpc":"2.0", 1064 | "id":1, 1065 | "result":"0x6e566d3de4da6bd8628ddc228dd571ddcc7e708ff11d02152f810570fb0d0b9a" 1066 | } 1067 | 1068 | ``` 1069 | *** 1070 | 1071 | #### fsntx_buildGenAssetTx 1072 | 1073 | Build genAsset unsigned raw transaction. 1074 | 1075 | ##### Parameters 1076 | 1077 | 1. `String|Address`, from - The address for the account. 1078 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1079 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1080 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1081 | 5. `String`, name - The name for the asset. 1082 | 6. `String`, symbol - The symbol for the asset. 1083 | 7. `Number`, decimals - The decimals for the asset. 1084 | 8. `String|BigNumber`, total - The total value for the asset. 1085 | 9. `bool`, canChange - Values can be changed. 1086 | 1087 | ```js 1088 | params: [{ 1089 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1090 | "name":"FusionTest", 1091 | "symbol":"FT", 1092 | "decimals":1, 1093 | "total":"0x200", 1094 | "canChange":true 1095 | }] 1096 | ``` 1097 | 1098 | ##### Return 1099 | 1100 | `DATA`, unsigned raw transaction. 1101 | 1102 | ##### Example 1103 | ```js 1104 | // Request 1105 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildGenAssetTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","name":"FusionTest","symbol":"FT","decimals":1,"total":"0x200","canChange":true}],"id":1}' 1106 | 1107 | // Result 1108 | { 1109 | "jsonrpc":"2.0", 1110 | "id":1, 1111 | "result":{ 1112 | "nonce":"0x0", 1113 | "gasPrice":"0x3b9aca00", 1114 | "gas":"0x15f90", 1115 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 1116 | "value":"0x0", 1117 | "input":"0xd70195d48a467573696f6e54657374824654018202000180", 1118 | "v":"0x0", 1119 | "r":"0x0", 1120 | "s":"0x0", 1121 | "hash":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b" 1122 | } 1123 | } 1124 | 1125 | ``` 1126 | 1127 | *** 1128 | 1129 | #### fsntx_decAsset 1130 | 1131 | Reduction the total amount of asset.(Account has been unlocked && "canChange" is true for the asset) 1132 | 1133 | ##### Parameters 1134 | 1135 | 1. `String|Address`, from - The address for the account. 1136 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1137 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1138 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1139 | 5. `String|Hash`, asset - The hash of the asset. 1140 | 6. `String|Address`, to - The address for the receiving account. 1141 | 7. `String|BigNumber`, value - The value of decrease. 1142 | 8. `String`, transacData - (optional) The data for transaction. 1143 | 1144 | 1145 | ```js 1146 | params: [{ 1147 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1148 | "to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1149 | "value":"0x10", 1150 | "asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd" 1151 | }] 1152 | ``` 1153 | 1154 | ##### Return 1155 | 1156 | `DATA`, 32 Bytes - The transaction hash. 1157 | 1158 | ##### Example 1159 | ```js 1160 | // Request 1161 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_decAsset","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","value":"0x10","asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd"}],"id":1}' 1162 | 1163 | // Result 1164 | { 1165 | "jsonrpc":"2.0", 1166 | "id":1, 1167 | "result":"0x85d95f61676e99046053346419129afec9d7a8fee2924d9062419aee253f17a4" 1168 | } 1169 | ``` 1170 | *** 1171 | 1172 | #### fsntx_buildDecAssetTx 1173 | 1174 | Build decAsset unsigned raw transaction. 1175 | 1176 | ##### Parameters 1177 | 1178 | 1. `String|Address`, from - The address for the account. 1179 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1180 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1181 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1182 | 5. `String|Hash`, asset - The hash of the asset. 1183 | 6. `String|Address`, to - The address for the receiving account. 1184 | 7. `String|BigNumber`, value - The value of decrease. 1185 | 8. `String`, transacData - (optional) The data for transaction. 1186 | 1187 | 1188 | ```js 1189 | params: [{ 1190 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1191 | "to":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1192 | "value":"0x10", 1193 | "asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b" 1194 | }] 1195 | ``` 1196 | 1197 | ##### Return 1198 | 1199 | `DATA`, unsigned raw transaction. 1200 | 1201 | ##### Example 1202 | ```js 1203 | // Request 1204 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildDecAssetTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","to":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","value":"0x10","asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b"}],"id":1}' 1205 | 1206 | // Result 1207 | { 1208 | "jsonrpc":"2.0", 1209 | "id":1, 1210 | "result":{ 1211 | "nonce":"0x1", 1212 | "gasPrice":"0x3b9aca00", 1213 | "gas":"0x15f90", 1214 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 1215 | "value":"0x0", 1216 | "input":"0xf83e0cb83bf839a04473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b94cc9ea1c564fa513d6abd9339587dc4f886d7acc4108080", 1217 | "v":"0x0", 1218 | "r":"0x0", 1219 | "s":"0x0", 1220 | "hash":"0x9798a2295357a31484948f6cbbd47f0fbfd82f6de79480383af747d75039356f" 1221 | } 1222 | } 1223 | ``` 1224 | 1225 | *** 1226 | 1227 | #### fsntx_incAsset 1228 | 1229 | Increase the total amount of asset.(Account has been unlocked && "canChange" is true for the asset) 1230 | 1231 | 1232 | ##### Parameters 1233 | 1234 | 1. `String|Address`, from - The address for the account. 1235 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1236 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1237 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1238 | 5. `String|Hash`, asset - The hash of the asset. 1239 | 6. `String|Address`, to - The address for the receiving account. 1240 | 7. `String|BigNumber`, value - The value of increase. 1241 | 8. `String`, transacData - (optional) The data for transaction. 1242 | 1243 | 1244 | ```js 1245 | params: [{ 1246 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1247 | "to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1248 | "value":"0x10", 1249 | "asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd" 1250 | }] 1251 | ``` 1252 | 1253 | ##### Return 1254 | 1255 | `DATA`, 32 Bytes - The transaction hash. 1256 | 1257 | ##### Example 1258 | ```js 1259 | // Request 1260 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_incAsset","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","to":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","value":"0x10","asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd"}],"id":1}' 1261 | 1262 | // Result 1263 | { 1264 | "jsonrpc":"2.0", 1265 | "id":1, 1266 | "result":"0xdb48fa3fdad4ad6c85b3700d89c37e776cb4fe61487425c752b863c25fe8a7d8" 1267 | } 1268 | ``` 1269 | *** 1270 | 1271 | #### fsntx_buildIncAssetTx 1272 | 1273 | Build incAsset unsigned raw transaction. 1274 | 1275 | 1276 | ##### Parameters 1277 | 1278 | 1. `String|Address`, from - The address for the account. 1279 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1280 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1281 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1282 | 5. `String|Hash`, asset - The hash of the asset. 1283 | 6. `String|Address`, to - The address for the receiving account. 1284 | 7. `String|BigNumber`, value - The value of increase. 1285 | 8. `String`, transacData - (optional) The data for transaction. 1286 | 1287 | 1288 | ```js 1289 | params: [{ 1290 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1291 | "to":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1292 | "value":"0x10", 1293 | "asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b" 1294 | }] 1295 | ``` 1296 | 1297 | ##### Return 1298 | 1299 | `DATA`, unsigned raw transaction. 1300 | 1301 | ##### Example 1302 | ```js 1303 | // Request 1304 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildIncAssetTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","to":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","value":"0x10","asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b"}],"id":1}' 1305 | 1306 | // Result 1307 | { 1308 | "jsonrpc":"2.0", 1309 | "id":1, 1310 | "result":{ 1311 | "nonce":"0x1", 1312 | "gasPrice":"0x3b9aca00", 1313 | "gas":"0x15f90", 1314 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 1315 | "value":"0x0", 1316 | "input":"0xf83e0cb83bf839a04473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b94cc9ea1c564fa513d6abd9339587dc4f886d7acc4100180", 1317 | "v":"0x0", 1318 | "r":"0x0", 1319 | "s":"0x0", 1320 | "hash":"0x1caa8be9419ba4e9a8ddf7d262af46fbbc11d879b94356f11f807a4d4d291db1" 1321 | } 1322 | } 1323 | ``` 1324 | 1325 | *** 1326 | 1327 | #### fsntx_sendAsset 1328 | 1329 | Send assets to other accounts.(Account has been unlocked) 1330 | 1331 | ##### Parameters 1332 | 1333 | 1. `String|Address`, from - The address for the sending account. 1334 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1335 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1336 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1337 | 5. `String|Hash`, asset - The hash of the asset. 1338 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 1339 | 7. `String|BigNumber`, value - The value for sending. 1340 | 1341 | 1342 | ```js 1343 | 1. params: [{ 1344 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1345 | "to":"0x07718f21f889b84451727ada8c65952a597b2e78", 1346 | "value":"0x10", 1347 | "asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd" 1348 | }] 1349 | 2. params:[{ 1350 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1351 | "toUSAN":104, 1352 | "value":"0x10", 1353 | "asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd" 1354 | }] 1355 | 1356 | ``` 1357 | 1358 | ##### Return 1359 | 1360 | `DATA`, 32 Bytes - The transaction hash. 1361 | 1362 | ##### Example 1363 | ```js 1364 | // Request 1365 | 1. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_sendAsset","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","to":"0x07718f21f889b84451727ada8c65952a597b2e78","value":"0x10","asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd"}],"id":1}' 1366 | 2. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_sendAsset","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","toUSAN":104,"value":"0x10","asset":"0x530566afdbc2e3e4192fb561a1032fba189571bd65abb823e0b0d0ae023dfbbd"}],"id":1}' 1367 | 1368 | // Result 1369 | { 1370 | "jsonrpc":"2.0", 1371 | "id":1, 1372 | "result":"0xbb9651c88974a0f79cde02e763f7999f0da36df751719934b40d04814b0640af" 1373 | } 1374 | ``` 1375 | *** 1376 | 1377 | #### fsntx_buildSendAssetTx 1378 | 1379 | Build sendAsset unsigned raw transaction. 1380 | 1381 | ##### Parameters 1382 | 1383 | 1. `String|Address`, from - The address for the sending account. 1384 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1385 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1386 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1387 | 5. `String|Hash`, asset - The hash of the asset. 1388 | 6. `String|Address|Number`, to|toUSAN - The address for the receiving account | The notation of receiving account address. 1389 | 7. `String|BigNumber`, value - The value for sending. 1390 | 1391 | 1392 | ```js 1393 | 1. params: [{ 1394 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1395 | "to":"0x07718f21f889b84451727ada8c65952a597b2e78", 1396 | "value":"0x10", 1397 | "asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b" 1398 | }] 1399 | 2. params:[{ 1400 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1401 | "toUSAN":"104", 1402 | "value":"0x10", 1403 | "asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b" 1404 | }] 1405 | 1406 | ``` 1407 | 1408 | ##### Return 1409 | 1410 | `DATA`, unsigned raw transaction. 1411 | 1412 | ##### Example 1413 | ```js 1414 | // Request 1415 | 1. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildSendAssetTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","to":"0x07718f21f889b84451727ada8c65952a597b2e78","value":"0x10","asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b"}],"id":1}' 1416 | 2. curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildSendAssetTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","toUSAN":104,"value":"0x10","asset":"0x4473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b"}],"id":1}' 1417 | 1418 | // Result 1419 | { 1420 | "jsonrpc":"2.0", 1421 | "id":1, 1422 | "result":{ 1423 | "nonce":"0x1", 1424 | "gasPrice":"0x3b9aca00", 1425 | "gas":"0x15f90", 1426 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 1427 | "value":"0x0", 1428 | "input":"0xf83b02b838f7a04473c9c46aa575aca6665e0b485c5bb85eee55cb6161a002140c4829066f459b9407718f21f889b84451727ada8c65952a597b2e7810", 1429 | "v":"0x0", 1430 | "r":"0x0", 1431 | "s":"0x0", 1432 | "hash":"0x8826547721392cd3b9f1accb3c739e42a57e531c227346df598bd2424457a1b2" 1433 | } 1434 | } 1435 | ``` 1436 | 1437 | *** 1438 | 1439 | #### fsn_getAllBalances 1440 | 1441 | Get all assets balances of account. 1442 | 1443 | ##### Parameters 1444 | 1445 | 1. `String|Address`, address - The address for the account. 1446 | 2. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 1447 | 1448 | 1449 | ```js 1450 | params: [ 1451 | "0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1452 | "latest" // state at the latest block 1453 | ] 1454 | ``` 1455 | 1456 | ##### Return 1457 | 1458 | `QUANTITY` - integer of the current balance in wei. 1459 | 1460 | 1461 | ##### Example 1462 | ```js 1463 | // Request 1464 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getAllBalances","params":["0x5b15a29274c74cd7cae59cabf656873a0ea706ac","latest"],"id":1}' 1465 | 1466 | // Result 1467 | { 1468 | "jsonrpc":"2.0", 1469 | "id":1, 1470 | "result":{"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff":"3499978048000000000"}} 1471 | ``` 1472 | 1473 | *** 1474 | 1475 | #### fsn_getLatestNotation 1476 | 1477 | Get the last Notation in the blockchain. 1478 | 1479 | 1480 | ##### Parameters 1481 | 1482 | 1. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 1483 | 1484 | 1485 | ```js 1486 | params: [ 1487 | "latest" // state at the latest block 1488 | ] 1489 | ``` 1490 | 1491 | ##### Return 1492 | 1493 | `DATA` - the latest notation of the blockNumber. 1494 | 1495 | 1496 | ##### Example 1497 | ```js 1498 | // Request 1499 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getLatestNotation","params":["latest"],"id":1}' 1500 | 1501 | // Result 1502 | { 1503 | "jsonrpc":"2.0", 1504 | "id":1, 1505 | "result":104 1506 | } 1507 | ``` 1508 | 1509 | *** 1510 | 1511 | #### fsntx_genNotation 1512 | 1513 | Create a notation for a account. (Account has been unlocked) 1514 | 1515 | 1516 | ##### Parameters 1517 | 1518 | 1. `String|Address`, from - The address for the account. 1519 | 2. `Number` gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1520 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1521 | 4. `Number` nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1522 | 1523 | 1524 | ```js 1525 | params: [{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac"}] 1526 | ``` 1527 | 1528 | ##### Return 1529 | 1530 | `DATA`, 32 Bytes - The transaction hash. 1531 | 1532 | 1533 | ##### Example 1534 | ```js 1535 | // Request 1536 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_genNotation","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac"}],"id":1}' 1537 | 1538 | // Result 1539 | { 1540 | "jsonrpc":"2.0", 1541 | "id":1, 1542 | "result":"0xae4b4949f9e2ad46343df4e11d5a245306281b60cb6d217dd10c011d18638445" 1543 | } 1544 | ``` 1545 | *** 1546 | #### fsntx_buildGenNotationTx 1547 | 1548 | Build genNotation unsigned raw transaction. 1549 | 1550 | 1551 | ##### Parameters 1552 | 1553 | 1. `String|Address`, from - The address for the account. 1554 | 2. `Number` gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1555 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1556 | 4. `Number` nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1557 | 1558 | 1559 | ```js 1560 | params: [{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4"}] 1561 | ``` 1562 | 1563 | ##### Return 1564 | 1565 | `DATA`, unsigned raw transaction. 1566 | 1567 | 1568 | ##### Example 1569 | ```js 1570 | // Request 1571 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildGenNotationTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4"}],"id":1}' 1572 | 1573 | // Result 1574 | { 1575 | "jsonrpc":"2.0", 1576 | "id":1, 1577 | "result":{ 1578 | "nonce":"0x1", 1579 | "gasPrice":"0x3b9aca00", 1580 | "gas":"0x15f90", 1581 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 1582 | "value":"0x0", 1583 | "input":"0xc28080", 1584 | "v":"0x0", 1585 | "r":"0x0", 1586 | "s":"0x0", 1587 | "hash":"0xcfbe0320045fa877f9076e54bc1f7d64f0c85d2a6d20a36ba96059f4afe232b5" 1588 | } 1589 | } 1590 | ``` 1591 | 1592 | *** 1593 | 1594 | #### fsn_getNotation 1595 | 1596 | Get notation of account. 1597 | 1598 | 1599 | ##### Parameters 1600 | 1601 | 1. `String|Address` - The address for the account. 1602 | 2. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 1603 | 1604 | ```js 1605 | params: [ 1606 | "0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1607 | "latest" // state at the latest block 1608 | ] 1609 | ``` 1610 | 1611 | ##### Return 1612 | 1613 | `Number` - the number of notation. 1614 | 1615 | 1616 | ##### Example 1617 | ```js 1618 | // Request 1619 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getNotation","params":["0x5b15a29274c74cd7cae59cabf656873a0ea706ac","latest"],"id":1}' 1620 | 1621 | // Result 1622 | { 1623 | "jsonrpc":"2.0", 1624 | "id":1, 1625 | "result":104 1626 | } 1627 | ``` 1628 | 1629 | *** 1630 | 1631 | #### fsn_getAddressByNotation 1632 | 1633 | Return the address of the notation. 1634 | 1635 | 1636 | ##### Parameters 1637 | 1638 | 1. `Number`, notation - The number of the notation. 1639 | 2. `String|HexNumber|TAG` - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`. 1640 | 1641 | ```js 1642 | params: [ 1643 | 104, //Notation 1644 | "latest" // state at the latest block 1645 | ] 1646 | ``` 1647 | 1648 | ##### Return 1649 | 1650 | `DATA` - 20 bytes - the address of the notation. 1651 | 1652 | ##### Example 1653 | ```js 1654 | // Request 1655 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getAddressByNotation","params":[104,"latest"],"id":1}' 1656 | 1657 | // Result 1658 | { 1659 | "jsonrpc":"2.0", 1660 | "id":1, 1661 | "result":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac" 1662 | } 1663 | ``` 1664 | 1665 | *** 1666 | 1667 | #### fsn_getAsset 1668 | 1669 | Get the asset information. 1670 | 1671 | 1672 | ##### Parameters 1673 | 1674 | 1. `String|Hash`, assetID - The hash of the asset. 1675 | 2. `String|HexNumber|TAG`, blockNr - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`. 1676 | 1677 | 1678 | ```js 1679 | params: [ 1680 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", //AssetId 1681 | "latest" // state at the latest block 1682 | ] 1683 | ``` 1684 | 1685 | ##### Return 1686 | 1687 | `DATA` - the detail of the asset. 1688 | 1689 | 1690 | ##### Example 1691 | ```js 1692 | // Request 1693 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getAsset","params":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","latest"],"id":1}' 1694 | 1695 | // Result 1696 | { 1697 | "jsonrpc":"2.0", 1698 | "id":1, 1699 | "result": 1700 | { 1701 | "ID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 1702 | "Owner":"0x0000000000000000000000000000000000000000", 1703 | "Name":"Fusion", 1704 | "Symbol":"FSN", 1705 | "Decimals":18, 1706 | "Total":"81920000000000000000000000", 1707 | "CanChange":false, 1708 | "Description":"https://fusion.org" 1709 | } 1710 | } 1711 | ``` 1712 | *** 1713 | 1714 | #### fsn_getBalance 1715 | 1716 | Get the balance of account. 1717 | 1718 | 1719 | ##### Parameters 1720 | 1721 | 1. `String|Number`, assetID - The asset of the account. 1722 | 2. `String|Address`, address - The address of the account. 1723 | 3. `String|HexNumber|TAG`, blockNr - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`. 1724 | 1725 | 1726 | ```js 1727 | params: [ 1728 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", //AssetId 1729 | "0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1730 | "latest" // state at the latest block 1731 | ] 1732 | ``` 1733 | 1734 | ##### Return 1735 | 1736 | `QUANTITY` - integer of the current balance in wei. 1737 | 1738 | 1739 | ##### Example 1740 | ```js 1741 | // Request 1742 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getBalance","params":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x5b15a29274c74cd7cae59cabf656873a0ea706ac","latest"],"id":1}' 1743 | 1744 | // Result 1745 | { 1746 | "jsonrpc":"2.0", 1747 | "id":1, 1748 | "result":"5999978048000000000" 1749 | } 1750 | ``` 1751 | 1752 | *** 1753 | 1754 | #### fsntx_makeSwap 1755 | 1756 | Create a quantum swap order.(Account has been unlocked) 1757 | 1758 | 1759 | ##### Parameters 1760 | 1761 | 1. `String|Address`, from - The address for the sending account. 1762 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1763 | 3. `String|BigNumber`, gasPrice- (optional) The price of gas for this transaction in wei. 1764 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1765 | 5. `String|Number`, FromAssetID - The assetID of the from account. 1766 | 6. `String|HexNumber`, FromStartTime - (optional) The start time of the sending account. 1767 | 7. `String|HexNumber`, FromEndTime - (optional) The end time of the sending account. 1768 | 8. `String|BigNumber`, MinFromAmount - The amonut of the sending account. 1769 | 9. `String|Number`, ToAssetID - The assetID of the to account. 1770 | 10. `String|HexNumber`, ToStartTime - (optional) The start time of the receiving account. 1771 | 11. `String|HexNumber`, ToEndTime - (optional) The end time of the receiving account.. 1772 | 12. `String|BigNumber`, MinToAmount - The amonut of the receiving account. 1773 | 13. `Number`, SwapSize - The size of swap. 1774 | 14. `Array String|Address`, Targes - Only these addresses can be exchanged. 1775 | 1776 | 1777 | ```js 1778 | params: [ 1779 | { 1780 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 1781 | "FromAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", //If FromAssetID is "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe",it means make a Notation swap 1782 | "ToAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 1783 | "MinToAmount":"0x1BC16D674EC80000", //2000000000000000000 1784 | "MinFromAmount":"0x29A2241AF62C0000", //3000000000000000000 1785 | "FromStartTime":"0x5D6CE866", //2019/9/2 18:1:10 1786 | "FromEndTime":"0x5D9475B9", //2019/10/2 18:2:33 1787 | "SwapSize":2, 1788 | "Targes":["0x07718f21f889b84451727ada8c65952a597b2e78"] 1789 | } 1790 | ] 1791 | ``` 1792 | 1793 | ##### Return 1794 | 1795 | `DATA`, 32 Bytes - the transaction hash. 1796 | 1797 | 1798 | ##### Example 1799 | ```js 1800 | // Request 1801 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_makeSwap","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","FromAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","ToAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","MinToAmount":"0x1BC16D674EC80000","MinFromAmount":"0x29A2241AF62C0000","FromStartTime":"0x5D6CE866","FromEndTime":"0x5D9475B9","SwapSize":2,"Targes":["0x07718f21f889b84451727ada8c65952a597b2e78"]}],"id":1}' 1802 | 1803 | // Result 1804 | { 1805 | "jsonrpc":"2.0", 1806 | "id":1, 1807 | "result":"0xfbd0eb501114d23aa42d92be50d705a3e987bda658772a92283e1483fcc6027a" 1808 | } 1809 | ``` 1810 | *** 1811 | #### fsntx_buildMakeSwapTx 1812 | 1813 | Build makeSwap unsigned raw transaction. 1814 | 1815 | 1816 | ##### Parameters 1817 | 1818 | 1. `String|Address`, from - The address for the sending account. 1819 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1820 | 3. `String|BigNumber`, gasPrice- (optional) The price of gas for this transaction in wei. 1821 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1822 | 5. `String|Number`, FromAssetID - The assetID of the from account. 1823 | 6. `String|HexNumber`, FromStartTime - (optional) The start time of the sending account. 1824 | 7. `String|HexNumber`, FromEndTime - (optional) The end time of the sending account. 1825 | 8. `String|BigNumber`, MinFromAmount - The amonut of the sending account. 1826 | 9. `String|Number`, ToAssetID - The assetID of the to account. 1827 | 10. `String|HexNumber`, ToStartTime - (optional) The start time of the receiving account. 1828 | 11. `String|HexNumber`, ToEndTime - (optional) The end time of the receiving account.. 1829 | 12. `String|BigNumber`, MinToAmount - The amonut of the receiving account. 1830 | 13. `Number`, SwapSize - The size of swap. 1831 | 14. `Array String|Address`, Targes - Only these addresses can be exchanged. 1832 | 1833 | 1834 | ```js 1835 | params: [ 1836 | { 1837 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1838 | "FromAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", //If FromAssetID is "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe",it means make a Notation swap 1839 | "ToAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 1840 | "MinToAmount":"0x1BC16D674EC80000", //2000000000000000000 1841 | "MinFromAmount":"0x29A2241AF62C0000", //3000000000000000000 1842 | "FromStartTime":"0x5ee884db", //2019/9/2 18:1:10 1843 | "FromEndTime":"0x5f1011cc", //2019/10/2 18:2:33 1844 | "SwapSize":2, 1845 | "Targes":["0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1"] 1846 | } 1847 | ] 1848 | ``` 1849 | 1850 | ##### Return 1851 | 1852 | `DATA`, unsigned raw transaction. 1853 | 1854 | 1855 | ##### Example 1856 | ```js 1857 | // Request 1858 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildMakeSwapTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","FromAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","ToAssetID":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","MinToAmount":"0x1BC16D674EC80000","MinFromAmount":"0x29A2241AF62C0000","FromStartTime":"0x5ee884db","FromEndTime":"0x5f1011cc","SwapSize":2,"Targes":["0xd1c675d3fc4c19d71b50bfe056a09627ca7e85a1"]}],"id":1}' 1859 | 1860 | // Result 1861 | { 1862 | "jsonrpc":"2.0", 1863 | "id":1, 1864 | "result":{ 1865 | "nonce":"0x1", 1866 | "gasPrice":"0x3b9aca00", 1867 | "gas":"0x15f90", 1868 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 1869 | "value":"0x0", 1870 | "input":"0xf88a0ab887f885a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff845ee884db845f1011cc8829a2241af62c0000a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8088ffffffffffffffff881bc16d674ec8000002d594d1c675d3fc4c19d71b50bfe056a09627ca7e85a1845ee8943680", 1871 | "v":"0x0", 1872 | "r":"0x0", 1873 | "s":"0x0", 1874 | "hash":"0x1184284f0a299efbb8e4c99d24b629039a4aff041b790d5f3ef756ee55c0246c" 1875 | } 1876 | } 1877 | ``` 1878 | 1879 | *** 1880 | 1881 | #### fsn_getSwap 1882 | 1883 | Get the details of MakeSwap. 1884 | 1885 | 1886 | ##### Parameters 1887 | 1888 | 1. `String|Hash` - the hash of the MakeSwap transaction. 1889 | 2. `String|HexNumber|TAG`, blockNr - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`. 1890 | 1891 | ```js 1892 | params: [ 1893 | "0x2bd4929f673c53bd4ff90ee640f8d3ccd6b756977893009ca6ef5561e54af535", 1894 | "latest" 1895 | ] 1896 | ``` 1897 | 1898 | ##### Return 1899 | 1900 | `DATA` - the detail of the MakeSwap. 1901 | 1902 | 1903 | ##### Example 1904 | ```js 1905 | // Request 1906 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getSwap","params":["0x2bd4929f673c53bd4ff90ee640f8d3ccd6b756977893009ca6ef5561e54af535","latest"],"id":1}' 1907 | 1908 | // Result 1909 | { 1910 | "jsonrpc": "2.0", 1911 | "id": 1, 1912 | "result": { 1913 | "ID": "0xaac295a8b71c4698615d2ceb08e205355ad5f0bb622020fe1bac145e47a24141", 1914 | "Owner": "0x3a1b3b81ed061581558a81f11d63e03129347437", 1915 | "FromAssetID": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 1916 | "FromStartTime": 1567418470, 1917 | "FromEndTime": 1570010553, 1918 | "MinFromAmount": 3e+18, 1919 | "ToAssetID": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 1920 | "ToStartTime": 0, 1921 | "ToEndTime": 18446744073709552000, 1922 | "MinToAmount": 2e+18, 1923 | "SwapSize": 2, 1924 | "Targes": [ 1925 | "0xb49edfcd6ab3dac4cc908f31fc4b3f7772773113" 1926 | ], 1927 | "Time": 1569381182, 1928 | "Description": "", 1929 | "Notation": 0 1930 | } 1931 | } 1932 | ``` 1933 | 1934 | *** 1935 | 1936 | #### fsntx_takeSwap 1937 | 1938 | Take the quantum swap order.(Account has been unlocked) 1939 | 1940 | 1941 | ##### Parameters 1942 | 1943 | 1. `String|Address`, The address for the sending account. 1944 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1945 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1946 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1947 | 5. `String|Hash`, SwapID - The hash of the swap. 1948 | 6. `Number`, Size - The size of swap. 1949 | 1950 | 1951 | ```js 1952 | params: [{ 1953 | "from":"0x07718f21f889b84451727ada8c65952a597b2e78", 1954 | "SwapID":"0x3be968fd7368b73d2cd8ccac12fedb0a9a3b85b8b86f10bdb69b4a8e3285dbab", 1955 | "Size":1 1956 | }] 1957 | ``` 1958 | 1959 | ##### Return 1960 | 1961 | `DATA`, 32 Bytes - the transaction hash. 1962 | 1963 | 1964 | ##### Example 1965 | ```js 1966 | // Request 1967 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_takeSwap","params":[{"from":"0x07718f21f889b84451727ada8c65952a597b2e78","SwapID":"0x3be968fd7368b73d2cd8ccac12fedb0a9a3b85b8b86f10bdb69b4a8e3285dbab","Size":1}],"id":1}' 1968 | 1969 | // Result 1970 | { 1971 | "jsonrpc":"2.0", 1972 | "id":1, 1973 | "result":"0x61923c6b6c5bf635130b5f2d093754a70fc7a9986cc2acc8c4fcfc87a580c25d" 1974 | } 1975 | ``` 1976 | *** 1977 | 1978 | #### fsntx_buildTakeSwapTx 1979 | 1980 | Build takeSwap unsigned raw transaction. 1981 | 1982 | 1983 | ##### Parameters 1984 | 1985 | 1. `String|Address`, The address for the sending account. 1986 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 1987 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 1988 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 1989 | 5. `String|Hash`, SwapID - The hash of the swap. 1990 | 6. `Number`, Size - The size of swap. 1991 | 1992 | 1993 | ```js 1994 | params: [{ 1995 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 1996 | "SwapID":"0x5aac73c44f6bd8a0908a283c553bccd35e70452ea176b5001a0401bd943ef334", 1997 | "Size":1 1998 | }] 1999 | ``` 2000 | 2001 | ##### Return 2002 | 2003 | `DATA`, unsigned raw transaction. 2004 | 2005 | 2006 | ##### Example 2007 | ```js 2008 | // Request 2009 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildTakeSwapTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","SwapID":"0x5aac73c44f6bd8a0908a283c553bccd35e70452ea176b5001a0401bd943ef334","Size":1}],"id":1}' 2010 | 2011 | // Result 2012 | { 2013 | "jsonrpc":"2.0", 2014 | "id":1, 2015 | "result":{ 2016 | "nonce":"0x2", 2017 | "gasPrice":"0x3b9aca00", 2018 | "gas":"0x15f90", 2019 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 2020 | "value":"0x0", 2021 | "input":"0xe50ba3e2a05aac73c44f6bd8a0908a283c553bccd35e70452ea176b5001a0401bd943ef33401", 2022 | "v":"0x0", 2023 | "r":"0x0", 2024 | "s":"0x0", 2025 | "hash":"0x857cc1bc6b23ec12420e17848a50d4395c1fcaeed6ff98298f85f475d9a82062" 2026 | } 2027 | } 2028 | ``` 2029 | 2030 | *** 2031 | 2032 | #### fsntx_recallSwap 2033 | 2034 | Destroy Quantum swap order and Return Assets.(Account has been unlocked) 2035 | 2036 | ##### Parameters 2037 | 2038 | 1. `String|Address`, from - The address for the account. 2039 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2040 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2041 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2042 | 5. `String|Hash`, SwapID - The hash of the swap. 2043 | 2044 | 2045 | ```js 2046 | params: [{ 2047 | "from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac", 2048 | "SwapID":"0x3be968fd7368b73d2cd8ccac12fedb0a9a3b85b8b86f10bdb69b4a8e3285dbab" 2049 | }] 2050 | ``` 2051 | 2052 | ##### Return 2053 | 2054 | `DATA`, 32 Bytes - the transaction hash. 2055 | 2056 | 2057 | ##### Example 2058 | ```js 2059 | // Request 2060 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_recallSwap","params":[{"from":"0x5b15a29274c74cd7cae59cabf656873a0ea706ac","SwapID":"0x3be968fd7368b73d2cd8ccac12fedb0a9a3b85b8b86f10bdb69b4a8e3285dbab"}],"id":1}' 2061 | 2062 | // Result 2063 | { 2064 | "jsonrpc":"2.0", 2065 | "id":1, 2066 | "result":"0x4270a81d7377fffb7e4aa4785f729baab5ca6711b9ae6df8777916a6f036285d" 2067 | } 2068 | ``` 2069 | *** 2070 | #### fsntx_buildRecallSwapTx 2071 | 2072 | Build recallSwap unsigned raw transaction. 2073 | 2074 | ##### Parameters 2075 | 2076 | 1. `String|Address`, from - The address for the account. 2077 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2078 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2079 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2080 | 5. `String|Hash`, SwapID - The hash of the swap. 2081 | 2082 | 2083 | ```js 2084 | params: [{ 2085 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 2086 | "SwapID":"0x5aac73c44f6bd8a0908a283c553bccd35e70452ea176b5001a0401bd943ef334" 2087 | }] 2088 | ``` 2089 | 2090 | ##### Return 2091 | 2092 | `DATA`, unsigned raw transaction. 2093 | 2094 | 2095 | ##### Example 2096 | ```js 2097 | // Request 2098 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildRecallSwapTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","SwapID":"0x5aac73c44f6bd8a0908a283c553bccd35e70452ea176b5001a0401bd943ef334"}],"id":1}' 2099 | 2100 | // Result 2101 | { 2102 | "jsonrpc":"2.0", 2103 | "id":1, 2104 | "result":{ 2105 | "nonce":"0x2", 2106 | "gasPrice":"0x3b9aca00", 2107 | "gas":"0x15f90", 2108 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 2109 | "value":"0x0", 2110 | "input":"0xe407a2e1a05aac73c44f6bd8a0908a283c553bccd35e70452ea176b5001a0401bd943ef334", 2111 | "v":"0x0", 2112 | "r":"0x0", 2113 | "s":"0x0", 2114 | "hash":"0x25fe3ca136e91ba0448f775e36360348a4f09cf176afca8ffab2209515003e31" 2115 | } 2116 | } 2117 | ``` 2118 | 2119 | *** 2120 | #### fsntx_makeMultiSwap 2121 | 2122 | Create a multi swap order.(Account has been unlocked) 2123 | 2124 | 2125 | ##### Parameters 2126 | 2127 | 1. `String|Address`, from - The address for the sending account. 2128 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2129 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2130 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2131 | 5. `String|Number`, FromAssetID - The assetID of the from account. 2132 | 6. `String|HexNumber`, FromStartTime - (optional) The start time of the sending account. 2133 | 7. `String|HexNumber`, FromEndTime - (optional) The end time of the sending account. 2134 | 8. `String|BigNumber`, MinFromAmount - The amonut of the sending account. 2135 | 9. `String|Number`, ToAssetID - The assetID of the to account. 2136 | 10. `String|HexNumber`, ToStartTime - (optional) The start time of the receiving account. 2137 | 11. `String|HexNumber`, ToEndTime - (optional) The end time of the receiving account.. 2138 | 12. `String|BigNumber`, MinToAmount - The amonut of the receiving account. 2139 | 13. `Number`, SwapSize - The size of swap. 2140 | 14. `Array String|Address`, Targes - Only these addresses can be exchanged. 2141 | 2142 | 2143 | ```js 2144 | params: [ 2145 | { 2146 | "from":"0x3a1b3b81ed061581558a81f11d63e03129347437", 2147 | "FromAssetID":[ 2148 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2149 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"], 2150 | "ToAssetID":[ 2151 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2152 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"], 2153 | "MinToAmount":["0x1BC16D674EC80000","0x1BC16D674EC80000"], 2154 | "MinFromAmount":["0x29A2241AF62C0000","0x29A2241AF62C0000"], 2155 | "FromStartTime":["0x5D6CE866","0x5D6CE866"], 2156 | "FromEndTime":["0x5D9475B9","0x5D9475B9"], 2157 | "SwapSize":2, 2158 | "Targes":[] 2159 | } 2160 | ] 2161 | ``` 2162 | 2163 | ##### Return 2164 | 2165 | `DATA`, 32 Bytes - the transaction hash. 2166 | 2167 | 2168 | ##### Example 2169 | ```js 2170 | // Request 2171 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_makeMultiSwap","params":[{"from":"0x3a1b3b81ed061581558a81f11d63e03129347437","FromAssetID":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"ToAssetID":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"MinToAmount":["0x1BC16D674EC80000","0x1BC16D674EC80000"],"MinFromAmount":["0x29A2241AF62C0000","0x29A2241AF62C0000"],"FromStartTime":["0x5D6CE866","0x5D6CE866"],"FromEndTime":["0x5D9475B9","0x5D9475B9"],"SwapSize":2,"Targes":[]}],"id":1}' 2172 | 2173 | // Result 2174 | { 2175 | "jsonrpc":"2.0", 2176 | "id":1, 2177 | "result":"0x89e699deac578e491675f1e4fe2233966e79fd388f9725035479268605801c87" 2178 | } 2179 | ``` 2180 | *** 2181 | #### fsntx_buildMakeMultiSwapTx 2182 | 2183 | Build makeMultiSwap unsigned raw transaction. 2184 | 2185 | 2186 | ##### Parameters 2187 | 2188 | 1. `String|Address`, from - The address for the sending account. 2189 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2190 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2191 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2192 | 5. `String|Number`, FromAssetID - The assetID of the from account. 2193 | 6. `String|HexNumber`, FromStartTime - (optional) The start time of the sending account. 2194 | 7. `String|HexNumber`, FromEndTime - (optional) The end time of the sending account. 2195 | 8. `String|BigNumber`, MinFromAmount - The amonut of the sending account. 2196 | 9. `String|Number`, ToAssetID - The assetID of the to account. 2197 | 10. `String|HexNumber`, ToStartTime - (optional) The start time of the receiving account. 2198 | 11. `String|HexNumber`, ToEndTime - (optional) The end time of the receiving account.. 2199 | 12. `String|BigNumber`, MinToAmount - The amonut of the receiving account. 2200 | 13. `Number`, SwapSize - The size of swap. 2201 | 14. `Array String|Address`, Targes - Only these addresses can be exchanged. 2202 | 2203 | 2204 | ```js 2205 | params: [ 2206 | { 2207 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 2208 | "FromAssetID":[ 2209 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2210 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"], 2211 | "ToAssetID":[ 2212 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2213 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"], 2214 | "MinToAmount":["0x1BC16D674EC80000","0x1BC16D674EC80000"], 2215 | "MinFromAmount":["0x29A2241AF62C0000","0x29A2241AF62C0000"], 2216 | "FromStartTime":["0x5ee884db","0x5ee884db"], 2217 | "FromEndTime":["0x5f1011cc","0x5f1011ff"], 2218 | "SwapSize":2, 2219 | "Targes":[] 2220 | } 2221 | ] 2222 | ``` 2223 | 2224 | ##### Return 2225 | 2226 | `DATA`, unsigned raw transaction. 2227 | 2228 | 2229 | ##### Example 2230 | ```js 2231 | // Request 2232 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildMakeMultiSwapTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","FromAssetID":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"ToAssetID":["0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"MinToAmount":["0x1BC16D674EC80000","0x1BC16D674EC80000"],"MinFromAmount":["0x29A2241AF62C0000","0x29A2241AF62C0000"],"FromStartTime":["0x5ee884db","0x5ee884db"],"FromEndTime":["0x5f1011cc","0x5f1011ff"],"SwapSize":2,"Targes":[]}],"id":1}' 2233 | 2234 | // Result 2235 | { 2236 | "jsonrpc":"2.0", 2237 | "id":1, 2238 | "result":{ 2239 | "nonce":"0x2", 2240 | "gasPrice":"0x3b9aca00", 2241 | "gas":"0x15f90", 2242 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 2243 | "value":"0x0", 2244 | "input":"0xf8e70db8e4f8e2f842a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffca845ee884db845ee884dbca845f1011cc845f1011ffd28829a2241af62c00008829a2241af62c0000f842a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc28080d288ffffffffffffffff88ffffffffffffffffd2881bc16d674ec80000881bc16d674ec8000002c0845ee8970e80", 2245 | "v":"0x0", 2246 | "r":"0x0", 2247 | "s":"0x0", 2248 | "hash":"0xe3070d1240181df70ae3665cbfe00b743529aa24e1c5faa04be3da898ad97452" 2249 | } 2250 | } 2251 | ``` 2252 | 2253 | *** 2254 | 2255 | #### fsn_getMultiSwap 2256 | 2257 | Get the details of the multi MakeSwap. 2258 | 2259 | 2260 | ##### Parameters 2261 | 2262 | 1. `String|Hash` - the hash of the Multi MakeSwap transaction. 2263 | 2. `String|HexNumber|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`. 2264 | 2265 | ```js 2266 | params: [ 2267 | "0xf616d50440414ce2bfd2204ace993a34e53e58cc656c82b339be935670f2070e", 2268 | "latest" 2269 | ] 2270 | ``` 2271 | 2272 | ##### Return 2273 | 2274 | `DATA`, the detail of the multi MakeSwap. 2275 | 2276 | 2277 | ##### Example 2278 | ```js 2279 | // Request 2280 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getMultiSwap","params":["0xf616d50440414ce2bfd2204ace993a34e53e58cc656c82b339be935670f2070e","latest"],"id":1}' 2281 | 2282 | // Result 2283 | { 2284 | "jsonrpc": "2.0", 2285 | "id": 1, 2286 | "result": { 2287 | "ID": "0xac05ff3d0d7ad5440eba0ee751ba19f876105b790dec63051c4db0b434cefa47", 2288 | "Owner": "0x3a1b3b81ed061581558a81f11d63e03129347437", 2289 | "FromAssetID": [ 2290 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2291 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" 2292 | ], 2293 | "FromStartTime": [ 2294 | 1567418470, 2295 | 1567418470 2296 | ], 2297 | "FromEndTime": [ 2298 | 1570010553, 2299 | 1570010553 2300 | ], 2301 | "MinFromAmount": [ 2302 | 3e+18, 2303 | 3e+18 2304 | ], 2305 | "ToAssetID": [ 2306 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2307 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" 2308 | ], 2309 | "ToStartTime": [ 2310 | 0, 2311 | 0 2312 | ], 2313 | "ToEndTime": [ 2314 | 18446744073709552000, 2315 | 18446744073709552000 2316 | ], 2317 | "MinToAmount": [ 2318 | 2e+18, 2319 | 2e+18 2320 | ], 2321 | "SwapSize": 2, 2322 | "Targes": [], 2323 | "Time": 1569387880, 2324 | "Description": "", 2325 | "Notation": 0 2326 | } 2327 | } 2328 | ``` 2329 | 2330 | *** 2331 | 2332 | #### fsntx_takeMultiSwap 2333 | 2334 | Take the multi swap order.(Account has been unlocked) 2335 | 2336 | 2337 | ##### Parameters 2338 | 2339 | 1. `String|Address`, from - The address for the sending account. 2340 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2341 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2342 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2343 | 5. `String|Hash`, SwapID - The hash of the multi swap. 2344 | 6. `Number`, Size - The size of multi swap. 2345 | 2346 | 2347 | ```js 2348 | params: [{ 2349 | "from":"0xb49edfcd6ab3dac4cc908f31fc4b3f7772773113", 2350 | "SwapID":"0xac05ff3d0d7ad5440eba0ee751ba19f876105b790dec63051c4db0b434cefa47", 2351 | "Size":1 2352 | }] 2353 | ``` 2354 | 2355 | ##### Return 2356 | 2357 | `DATA`, 32 Bytes - the transaction hash. 2358 | 2359 | 2360 | ##### Example 2361 | ```js 2362 | // Request 2363 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_takeMultiSwap","params":[{"from":"0xb49edfcd6ab3dac4cc908f31fc4b3f7772773113","SwapID":"0xac05ff3d0d7ad5440eba0ee751ba19f876105b790dec63051c4db0b434cefa47","Size":1}],"id":1}' 2364 | 2365 | // Result 2366 | { 2367 | "jsonrpc":"2.0", 2368 | "id":1, 2369 | "result":"0x75ebbd003ae590e1df879ebc931d34c6c494f9479b828017baecf60b44e2c59c" 2370 | } 2371 | ``` 2372 | *** 2373 | #### fsntx_buildTakeMultiSwapTx 2374 | 2375 | Build takeMultiSwap unsigned raw transaction. 2376 | 2377 | 2378 | ##### Parameters 2379 | 2380 | 1. `String|Address`, from - The address for the sending account. 2381 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2382 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2383 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2384 | 5. `String|Hash`, SwapID - The hash of the multi swap. 2385 | 6. `Number`, Size - The size of multi swap. 2386 | 2387 | 2388 | ```js 2389 | params: [{ 2390 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 2391 | "SwapID":"0x18f7b73f2321acafcfb3aec2c24a4bfcb6af59f8a0137a565af5fe378bb6f1f5", 2392 | "Size":1 2393 | }] 2394 | ``` 2395 | 2396 | ##### Return 2397 | 2398 | `DATA`, unsigned raw transaction. 2399 | 2400 | 2401 | ##### Example 2402 | ```js 2403 | // Request 2404 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildTakeMultiSwapTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","SwapID":"0x18f7b73f2321acafcfb3aec2c24a4bfcb6af59f8a0137a565af5fe378bb6f1f5","Size":1}],"id":1}' 2405 | 2406 | // Result 2407 | { 2408 | "jsonrpc":"2.0", 2409 | "id":1, 2410 | "result":{ 2411 | "nonce":"0x3", 2412 | "gasPrice":"0x3b9aca00", 2413 | "gas":"0x15f90", 2414 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 2415 | "value":"0x0", 2416 | "input":"0xe50fa3e2a018f7b73f2321acafcfb3aec2c24a4bfcb6af59f8a0137a565af5fe378bb6f1f501", 2417 | "v":"0x0", 2418 | "r":"0x0", 2419 | "s":"0x0", 2420 | "hash":"0x21fb72ada22013431bd42bfc610330074f9352a5999528a78fac748cec5c2e99" 2421 | } 2422 | } 2423 | ``` 2424 | 2425 | *** 2426 | 2427 | #### fsntx_recallMultiSwap 2428 | 2429 | Destroy multi swap order and Return Assets.(Account has been unlocked) 2430 | 2431 | ##### Parameters 2432 | 2433 | 1. `String|Address`, from - The address for the account. 2434 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2435 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2436 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2437 | 5. `String|Number`, SwapID - The hash of multi swap. 2438 | 2439 | 2440 | ```js 2441 | params: [{ 2442 | "from":"0x3a1b3b81ed061581558a81f11d63e03129347437", 2443 | "SwapID":"0xac05ff3d0d7ad5440eba0ee751ba19f876105b790dec63051c4db0b434cefa47" 2444 | }] 2445 | ``` 2446 | 2447 | ##### Return 2448 | 2449 | `DATA`, 32 Bytes - the transaction hash. 2450 | 2451 | 2452 | ##### Example 2453 | ```js 2454 | // Request 2455 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_recallMultiSwap","params":[{"from":"0x3a1b3b81ed061581558a81f11d63e03129347437","SwapID":"0xac05ff3d0d7ad5440eba0ee751ba19f876105b790dec63051c4db0b434cefa47"}],"id":1}' 2456 | 2457 | // Result 2458 | { 2459 | "jsonrpc":"2.0", 2460 | "id":1, 2461 | "result":"0xe2dd257d22e2717f9591d207d18e493acb5aae5d19dc94a3f95ded7227f7c825" 2462 | } 2463 | ``` 2464 | 2465 | *** 2466 | #### fsntx_isAutoBuyTicket 2467 | 2468 | Return `true` if the ticket is purchased automatically.(Account has been unlocked) 2469 | 2470 | ##### Parameters 2471 | 2472 | `String|HexNumber|TAG`, blockNr - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`. 2473 | 2474 | ```js 2475 | params: ["latest"] 2476 | ``` 2477 | 2478 | ##### Return 2479 | 2480 | `bool`, If the ticket is purchased automatically, return true. 2481 | 2482 | ##### Example 2483 | ```js 2484 | // Request 2485 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_isAutoBuyTicket","params":["latest"],"id":1}' 2486 | 2487 | // Result 2488 | { 2489 | "jsonrpc":"2.0", 2490 | "id":1, 2491 | "result":true 2492 | } 2493 | 2494 | ``` 2495 | *** 2496 | #### fsntx_buildRecallMultiSwapTx 2497 | 2498 | Build recallMultiSwap unsigned raw transaction. 2499 | 2500 | ##### Parameters 2501 | 2502 | 1. `String|Address`, from - The address for the account. 2503 | 2. `Number`, gas - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). 2504 | 3. `String|BigNumber`, gasPrice - (optional) The price of gas for this transaction in wei. 2505 | 4. `Number`, nonce - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. 2506 | 5. `String|Number`, SwapID - The hash of multi swap. 2507 | 2508 | 2509 | ```js 2510 | params: [{ 2511 | "from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4", 2512 | "SwapID":"0x18f7b73f2321acafcfb3aec2c24a4bfcb6af59f8a0137a565af5fe378bb6f1f5" 2513 | }] 2514 | ``` 2515 | 2516 | ##### Return 2517 | 2518 | `DATA`, unsigned raw transaction. 2519 | 2520 | 2521 | ##### Example 2522 | ```js 2523 | // Request 2524 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsntx_buildRecallMultiSwapTx","params":[{"from":"0xcc9ea1c564fa513d6abd9339587dc4f886d7acc4","SwapID":"0x18f7b73f2321acafcfb3aec2c24a4bfcb6af59f8a0137a565af5fe378bb6f1f5"}],"id":1}' 2525 | 2526 | // Result 2527 | { 2528 | "jsonrpc":"2.0", 2529 | "id":1, 2530 | "result":{ 2531 | "nonce":"0x3", 2532 | "gasPrice":"0x3b9aca00", 2533 | "gas":"0x15f90", 2534 | "to":"0xffffffffffffffffffffffffffffffffffffffff", 2535 | "value":"0x0", 2536 | "input":"0xe40ea2e1a018f7b73f2321acafcfb3aec2c24a4bfcb6af59f8a0137a565af5fe378bb6f1f5", 2537 | "v":"0x0", 2538 | "r":"0x0", 2539 | "s":"0x0", 2540 | "hash":"0x9822e3274a33296084e2699509fcc7738a51a219129afc08b355c8020da4c80e" 2541 | } 2542 | } 2543 | ``` 2544 | 2545 | *** 2546 | #### miner_startAutoBuyTicket 2547 | 2548 | Start buying tickets automatically.(Account has been unlocked) 2549 | 2550 | ##### Parameters 2551 | 2552 | none 2553 | 2554 | ##### Return 2555 | 2556 | `String`, Return null. 2557 | 2558 | ##### Example 2559 | ```js 2560 | // Request 2561 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"miner_startAutoBuyTicket","params":[],"id":1}' 2562 | 2563 | // Result 2564 | { 2565 | "jsonrpc":"2.0", 2566 | "id":1, 2567 | "result":null 2568 | } 2569 | 2570 | ``` 2571 | 2572 | *** 2573 | #### miner_stopAutoBuyTicket 2574 | 2575 | Stop buying tickets automatically.(Account has been unlocked) 2576 | 2577 | ##### Parameters 2578 | 2579 | none 2580 | 2581 | ##### Return 2582 | 2583 | `String`, Return null. 2584 | 2585 | ##### Example 2586 | ```js 2587 | // Request 2588 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"miner_stopAutoBuyTicket","params":[],"id":1}' 2589 | 2590 | // Result 2591 | { 2592 | "jsonrpc":"2.0", 2593 | "id":1, 2594 | "result":null 2595 | } 2596 | 2597 | ``` 2598 | 2599 | *** 2600 | #### fsn_getTransactionAndReceipt 2601 | 2602 | Return the tx and receipt of the transaction. 2603 | 2604 | ##### Parameters 2605 | 2606 | `DATA`, 32 Bytes - the hash of the transaction. 2607 | 2608 | ```js 2609 | params: ["0x8700056ef2896b47760e661902b21d8f294a80bff87c7e4108d7bbd5bce4ce6d"] 2610 | ``` 2611 | 2612 | ##### Return 2613 | 2614 | `DATA` - the tx and receipt of the transaction. 2615 | 2616 | ##### Example 2617 | ```js 2618 | // Request 2619 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_getTransactionAndReceipt","params":["0x8700056ef2896b47760e661902b21d8f294a80bff87c7e4108d7bbd5bce4ce6d"],"id":1}' 2620 | 2621 | // Result 2622 | { 2623 | "jsonrpc": "2.0", 2624 | "id": 1, 2625 | "result": { 2626 | "fsnTxInput": { 2627 | "FuncType": "SendAssetFunc", 2628 | "FuncParam": { 2629 | "AssetID": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2630 | "To": "0x37a200388caa75edcc53a2bd329f7e9563c6acb6", 2631 | "Value": 1e+18 2632 | } 2633 | }, 2634 | "tx": { 2635 | "blockHash": "0xd8d4b5f054cb398b1f0b5bb5d4add5e80d10a432f2c15226f620609577536b6b", 2636 | "blockNumber": "0xad1a5", 2637 | "from": "0x0122bf3930c1201a21133937ad5c83eb4ded1b08", 2638 | "gas": "0x15f90", 2639 | "gasPrice": "0x3b9aca00", 2640 | "hash": "0x8700056ef2896b47760e661902b21d8f294a80bff87c7e4108d7bbd5bce4ce6d", 2641 | "input": "0xf84402b841f83fa0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9437a200388caa75edcc53a2bd329f7e9563c6acb6880de0b6b3a7640000", 2642 | "nonce": "0xa7cc", 2643 | "to": "0xffffffffffffffffffffffffffffffffffffffff", 2644 | "transactionIndex": "0x2", 2645 | "value": "0x0", 2646 | "v": "0x16ce3", 2647 | "r": "0x8244e44f720023b240faafab08bb401b1b3167087f2882fa6b8f4fc87b59bdfc", 2648 | "s": "0x277635df431668f4a8b8c8b0702077634dd404db9a1139539d3c276651d3d1ce" 2649 | }, 2650 | "receipt": { 2651 | "blockHash": "0xd8d4b5f054cb398b1f0b5bb5d4add5e80d10a432f2c15226f620609577536b6b", 2652 | "blockNumber": "0xad1a5", 2653 | "contractAddress": null, 2654 | "cumulativeGasUsed": "0x10f60", 2655 | "from": "0x0122bf3930c1201a21133937ad5c83eb4ded1b08", 2656 | "fsnLogData": { 2657 | "AssetID": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 2658 | "To": "0x37a200388caa75edcc53a2bd329f7e9563c6acb6", 2659 | "Value": 1e+18 2660 | }, 2661 | "fsnLogTopic": "SendAssetFunc", 2662 | "gasUsed": "0x63e0", 2663 | "logs": [ 2664 | { 2665 | "address": "0xffffffffffffffffffffffffffffffffffffffff", 2666 | "topics": [ 2667 | "0x0000000000000000000000000000000000000000000000000000000000000002" 2668 | ], 2669 | "data": "0x7b2241737365744944223a22307866666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666222c22546f223a22307833376132303033383863616137356564636335336132626433323966376539353633633661636236222c2256616c7565223a313030303030303030303030303030303030307d", 2670 | "blockNumber": "0xad1a5", 2671 | "transactionHash": "0x8700056ef2896b47760e661902b21d8f294a80bff87c7e4108d7bbd5bce4ce6d", 2672 | "transactionIndex": "0x2", 2673 | "blockHash": "0xd8d4b5f054cb398b1f0b5bb5d4add5e80d10a432f2c15226f620609577536b6b", 2674 | "logIndex": "0x2", 2675 | "removed": false 2676 | } 2677 | ], 2678 | "logsBloom": "0x04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000002000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000008000000000000000000000", 2679 | "status": "0x1", 2680 | "to": "0xffffffffffffffffffffffffffffffffffffffff", 2681 | "transactionHash": "0x8700056ef2896b47760e661902b21d8f294a80bff87c7e4108d7bbd5bce4ce6d", 2682 | "transactionIndex": "0x2" 2683 | }, 2684 | "receiptFound": true 2685 | } 2686 | } 2687 | ``` 2688 | 2689 | *** 2690 | #### fsn_allInfoByAddress 2691 | 2692 | Returns all information about the address. 2693 | 2694 | ##### Parameters 2695 | 2696 | 1. `String|Address`, 20 Bytes - the address to be queried. 2697 | 2. `String|HexNumber|TAG`, blockNr - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`. 2698 | 2699 | ```js 2700 | params: ["0x3a1b3b81ed061581558a81f11d63e03129347437","latest"] 2701 | ``` 2702 | ##### Return 2703 | 2704 | `DATA` - All information of the address. 2705 | 2706 | ##### Example 2707 | ```js 2708 | // Request 2709 | curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"fsn_allInfoByAddress","params":["0x3a1b3b81ed061581558a81f11d63e03129347437","latest"],"id":1}' 2710 | 2711 | // Result 2712 | { 2713 | "jsonrpc": "2.0", 2714 | "id": 1, 2715 | "result": { 2716 | "tickets": { 2717 | "0x8fd87180c90cc7133be48b83b03781810c8ae4ad86446870dbed6b1a9a3193a8": { 2718 | "Owner": "0x3a1b3b81ed061581558a81f11d63e03129347437", 2719 | "Height": 251, 2720 | "StartTime": 1569381648, 2721 | "ExpireTime": 1571973648, 2722 | "Value": 5e+21 2723 | }, 2724 | "0xf9972189b9c077207cc05ab81d2e35bfe4ce6db28683d68c9ebfff6ff640722e": { 2725 | "Owner": "0x3a1b3b81ed061581558a81f11d63e03129347437", 2726 | "Height": 255, 2727 | "StartTime": 1569381700, 2728 | "ExpireTime": 1571973700, 2729 | "Value": 5e+21 2730 | } 2731 | }, 2732 | "balances": { 2733 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": "98980637500000000000000000" 2734 | }, 2735 | "timeLockBalances": { 2736 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": { 2737 | "Items": [ 2738 | { 2739 | "StartTime": 1569381700, 2740 | "EndTime": 18446744073709552000, 2741 | "Value": "9994000000000000000000" 2742 | }, 2743 | { 2744 | "StartTime": 1571973649, 2745 | "EndTime": 18446744073709552000, 2746 | "Value": "5000000000000000000000" 2747 | }, 2748 | { 2749 | "StartTime": 1571973701, 2750 | "EndTime": 18446744073709552000, 2751 | "Value": "5000000000000000000000" 2752 | }, 2753 | { 2754 | "StartTime": 1570010554, 2755 | "EndTime": 18446744073709552000, 2756 | "Value": "6000000000000000000" 2757 | } 2758 | ] 2759 | } 2760 | }, 2761 | "notation": 0 2762 | } 2763 | } 2764 | ``` 2765 | 2766 | *** 2767 | -------------------------------------------------------------------------------- /wallet-dev-cn.md: -------------------------------------------------------------------------------- 1 | # FSN钱包对接开发指南 2 | 3 | 本文档主要描述交易所、矿池、钱包等在对接FSN的开发过程中涉及到充值、提现、转账、查询等接口,以及如何一键部署FSN节点。 4 | 5 | ## 部署FSN节点 6 | 7 | FSN节点支持两种部署方法: 8 | 9 | 1、docker镜像一键部署,镜像地址:https://hub.docker.com/u/fusionnetwork 10 | 11 | 2、源码编译部署 12 | 13 | ### 1. docker一键部署 14 | 15 | 在Linux系统中运行命令: 16 | 17 | `bash -c "$(curl -fsSL https://raw.githubusercontent.com/FUSIONFoundation/efsn/master/QuickNodeSetup/fsnNode.sh)"` 18 | 19 | 部署过程中如果选择挖矿节点需要输入keystore文件和password,详细请参考:https://fusionnetworks.zendesk.com/hc/en-us/categories/360001967614-Staking-On-Fusion-MainNet 20 | 21 | ### 2. 源码编译部署 22 | 23 | 1. 同步代码 24 | 25 | `git clone https://github.com/FUSIONFoundation/efsn.git` 26 | 27 | 2. 编译源码(golang > 1.11): 28 | 29 | `cd efsn && make efsn` 30 | 31 | 3. 运行节点: 32 | 33 | `./build/bin/efsn console` 34 | 35 | 4. 作为后台同步节点开放RPC接口的运行参数如下: 36 | 37 | `nohup ./build/bin/efsn --datadir ./node1/ --gcmode=archive --rpc --rpcaddr 0.0.0.0 --rpcapi net,fsn,eth,web3 --rpcport 9001 --rpccorsdomain "*" &` 38 | 39 | 测试网运行请添加`--testnet`参数。 40 | 41 | 作为同步节点能够查询所有历史数据需要打开`--gcmode=archive`参数,在770000块高度时占用硬盘空间超过100G,采用此模式需要提前准备服务器存储空间(建议>300G)。非archive模式1G左右,但无法查询一些历史数据。 42 | 43 | ## FSN钱包对接 44 | 45 | FSN节点代码fork于[go-ethereum](https://github.com/ethereum/go-ethereum),RPC接口与ETH兼容,上层应用接口与[web3.js](https://github.com/ethereum/web3.js)兼容。FSN的Ticket, Asset, Timelock, USAN, Swap, Staking等功能提供[RPC扩展接口](https://github.com/FUSIONFoundation/efsn/wiki/FSN-RPC-API)和[web3扩展接口](https://github.com/FUSIONFoundation/web3-fusion-extend)。 46 | 47 | ### 充值识别 48 | 49 | FSN网络支持两种转账交易类型,这两种交易类型都可以充值: 50 | 51 | - 默认采用[sendAsset](https://github.com/FUSIONFoundation/efsn/wiki/FSN-RPC-API#fsntx_sendAsset) 52 | 53 | - 兼容eth的[sendtransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction) 54 | 55 | 56 | 兼容eth的sendtransaction转账交易可以采用和以太坊一样的充值识别代码。一般是通过监控最新区块,获取区块里的所有交易列表,然后遍历交易列表识别to地址是否为充值地址,是则为充值交易。 57 | 58 | 默认采用的sendAsset转账交易类似erc20智能合约转账交易,需要增加一段代码来识别充值。区别在于此类交易的实际to地址和转账金额需要从交易的receipt的data参数中解析后获取。解析接口采用[getTransactionAndReceipt](https://github.com/FUSIONFoundation/efsn/wiki/FSN-RPC-API#fsn_getTransactionAndReceipt),其中交易类型通过此参数识别:`"fsnLogTopic": "SendAssetFunc"`,实际to地址和转账金额Value通过此参数识别: 59 | 60 | ``` 61 | "fsnLogData": { 62 | "AssetID": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 63 | "To": "0x37a200388caa75edcc53a2bd329f7e9563c6acb6", 64 | "Value": 1e+18 65 | } 66 | 67 | ``` 68 | 69 | 充值入账的块确认数量建议大于30个。 70 | 71 | ### 提现交易 72 | 73 | 发送提现交易可以采用和以太坊兼容的提现代码。交易离线签名后通过[sendrawtransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction)接口发送至FSN节点RPC接口。 74 | 75 | 交易签名时,FSN主网chainid=32659 测试网chainid=3 76 | 77 | ## 开发社区 78 | 79 | 如有开发问题请加入开发社区沟通:https://fsn.dev/group/ 80 | --------------------------------------------------------------------------------