1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
//! Contains all the factomd api calls //! //! Documentation for all api methods are located on the [Factom struct page](struct.Factom.html) use super::*; impl Factom{ /*! The public facing API handler containing all method calls Individual method examples all use a blocking fetch call for demonstration purposes here. The methods return futures which can be run asynchronously in a runtime for better performance in a production environment. Committing or revealing entries require the result of the compose methods and will need to wait for those queries to complete. # Example ``` use factom::*; let factom = Factom::new(); let query = factom.properties() .map(|result| println!("{:?}", result)) .map_err(|err| panic!("{:?}", err)); let result = fetch(query).unwrap(); ``` */ /** Retrieve administrative blocks for any given height. The admin block contains data related to the identities within the factom system and the decisions the system makes as it builds the block chain. The abentries’ (admin block entries) in the JSON response can be of various types, the most common is a directory block signature (DBSig). A majority of the federated servers sign every directory block, meaning every block after m5 will contain 5 DBSigs in each admin block. The ABEntries are detailed [here](https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#adminid-bytes) # Example ``` use factom::*; let factom = Factom::new(); let query = factom .ablock_by_height(2) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn ablock_by_height(self, height: u32)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("height".to_string(), json!(height)); self.call("ablock-by-height", params) } /** This api call is used to find the status of a transaction, whether it be a factoid, reveal entry, or commit entry. When using this, you must specify the type of the transaction by giving the chainid field 1 of 3 values: * f for factoid transactions * c for entry credit transactions (commit entry/chain) * <ChainID> for reveal entry/chain The status types returned are as follows: * “Unknown” : Not found anywhere * “NotConfirmed” : Found on local node, but not in network (Holding Map) * “TransactionACK” : Found in network, but not written to the blockchain yet (ProcessList) * “DBlockConfirmed” : Found in Blockchain You may also provide the full marshaled transaction, instead of a hash, and it will be hashed for you. The responses vary based on the type: ### Entries Requesting an entry requires you to specify if the hash you provide is a commit or an entry hash. The chainid field is used to specify this. If you are searching for a commit, put c as the chainid field, otherwise, put the chainid that the entry belongs too. For commit/reveal acks, the response has 2 sections, one for the commit, one for the reveal. If you provide the entryhash and chainid, both will be filled (if found). If you only provide the commit txid and c as the chainid, then only the commitdata is guaranteed to come back with data. The committxid and entryhash fields correspond to the commitdata and entrydata objects. ### Factoid Transactions The hash field for a factoid transaction is equivalent to txid. To indicate the hash is a factoid transaction, put f in the chainid field and the txid in the hash field. The response will look different than entry related ack calls. ### Extra notes: Why c? It is short for 000000000000000000000000000000000000000000000000000000000000000c, which is the chainid for all entry credit blocks. All commits are placed in the entry credit block (assuming they are valid and are properly paid for) Why f? It is short for 000000000000000000000000000000000000000000000000000000000000000f, which is the chainid for all factoid blocks. All factoid transactions are placed in the factoid (assuming they are valid) # Example ``` use factom::*; let hash = "6ecd7c6c40d0e9dbb52457343e083d4306c5b4cd2d6e623ba67cf9d18b39faa7"; let tx_type = "f"; let factom = Factom::new(); let query = factom .ack(hash, tx_type, None) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn ack(self, hash: &str, chainid: &str, full_transaction: Option<&str>) -> impl Future<Item=Response, Error=FetchError> { let mut params = HashMap::new(); params.insert("hash".to_string(), json!(hash)); params.insert("chainid".to_string(), json!(chainid)); if let Some(tx) = full_transaction{ params.insert("fulltransaction".to_string(), json!(tx)); } self.call("ack", params) } /** Retrieve a specified admin block given its merkle root key. # Example ``` use factom::*; let keymr = "9f9b2d68e7f018a272e9331765ac8d353c7f58c6f18685405b5286353b58daee"; let factom = Factom::new(); let query = factom .admin_block(keymr) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn admin_block(self, keymr: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("keymr".to_string(), json!(keymr)); self.call("admin-block", params) } /** Return the keymr of the head of the chain for a chain ID (the unique hash created when the chain was created). # Example ``` use factom::*; let chainid = "9dec48601fba6ddb4bcea12066ba0f2b2467f89c788c5a243eb253c3de0f815b"; let factom = Factom::new(); let query = factom .chain_head(chainid) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn chain_head(self, chainid: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("chainid".to_string(), json!(chainid)); self.call("chain-head", params) } /** Send a Chain Commit Message to factomd to create a new Chain. The commit chain hex encoded string is documented here: Github Documentation The commit-chain API takes a specifically formated message encoded in hex that includes signatures. If you have a factom-walletd instance running, you can construct this commit-chain API call with compose-chain which takes easier to construct arguments. The compose-chain api call has two api calls in it’s response: commit-chain and reveal-chain. To successfully create a chain, the reveal-chain must be called after the commit-chain. Notes: It is possible to be unable to send a commit, if the commit already exists (if you try to send it twice). This is a mechanism to prevent you from double spending. If you encounter this error, just skip to the reveal-chain. The error format can be found here: repeated-commit */ pub fn commit_chain(self, message: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("message".to_string(), json!(message)); self.call("commit-chain", params) } /** Send an Entry Commit Message to factom to create a new Entry. The entry commit hex encoded string is documented here: [Github Documentation](https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry-commit) The commit-entry API takes a specifically formated message encoded in hex that includes signatures. If you have a factom-walletd instance running, you can construct this commit-entry API call with compose-entry which takes easier to construct arguments. The compose-entry api call has two api calls in it’s response: commit-entry and reveal-entry. To successfully create an entry, the reveal-entry must be called after the commit-entry. Notes: It is possible to be unable to send a commit, if the commit already exists (if you try to send it twice). This is a mechanism to prevent you from double spending. If you encounter this error, just skip to the reveal-entry. The error format can be found here: repeated-commit */ pub fn commit_entry(self, message: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("message".to_string(), json!(message)); self.call("commit-entry", params) } /** The current-minute API call returns: * `leaderheight` returns the current block height. * `directoryblockheight` returns the last saved height. * `minute` returns the current minute number for the open entry block. * `currentblockstarttime` returns the start time for the current block. * `currentminutestarttime` returns the start time for the current minute. * `currenttime` returns the current nodes understanding of current time. * `directoryblockinseconds` returns the number of seconds per block. * `stalldetected` returns if factomd thinks it has stalled. * `faulttimeout` returns the number of seconds before leader node is faulted for failing to provide a necessary message. * `roundtimeout` returns the number of seconds between rounds of an election during a fault. # Example ``` use factom::*; let factom = Factom::new(); let query = factom .current_minute() .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn current_minute(self)-> impl Future<Item=Response, Error=FetchError>{ self.call("current-minute", HashMap::new()) } /** Retrieve a directory block given only its height. # Example ``` use factom::*; let factom = Factom::new(); let query = factom .dblock_by_height(2) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn dblock_by_height(self, height: u32)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("height".to_string(), json!(height)); self.call("dblock-by-height", params) } /** Every directory block has a KeyMR (Key Merkle Root), which can be used to retrieve it. The response will contain information that can be used to navigate through all transactions (entry and factoid) within that block. The header of the directory block will contain information regarding the previous directory block’s keyMR, directory block height, and the timestamp. # Example ``` use factom::*; let keymr = "5b372f4622c682c984dc922983d0c769db33c376d107c74e8023446029592011"; let factom = Factom::new(); let query = factom .directory_block(keymr) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn directory_block(self, keymr: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("keymr".to_string(), json!(keymr)); self.call("directory-block", params) } /** The directory block head is the last known directory block by factom, or in other words, the most recently recorded block. This can be used to grab the latest block and the information required to traverse the entire blockchain. # Example ``` use factom::*; let factom = Factom::new(); let query = factom .directory_block_head() .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn directory_block_head(self)-> impl Future<Item=Response, Error=FetchError>{ self.call("directory-block-head", HashMap::new()) } /** Retrieve the entry credit block for any given height. These blocks contain entry credit transaction information. # Example ``` use factom::*; let factom = Factom::new(); let query = factom .ecblock_by_height(2) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn ecblock_by_height(self, height: u32)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("height".to_string(), json!(height)); self.call("ecblock-by-height", params) } /** Get an Entry from factomd specified by the Entry Hash. # Example ``` use factom::*; let hash = "6ecd7c6c40d0e9dbb52457343e083d4306c5b4cd2d6e623ba67cf9d18b39faa7"; let factom = Factom::new(); let query = factom.entry(hash) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn entry(self, hash: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("hash".to_string(), json!(hash)); self.call("entry", params) } /** Retrieve a specified entry block given its merkle root key. The entry block contains 0 to many entries # Example ``` use factom::*; let keymr = "1df118c1293858d1111762d6a0df92b12231c72deb14b53bfffc09b867db1f3b"; let factom = Factom::new(); let query = factom .entry_block(keymr) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn entry_block(self, keymr: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("keymr".to_string(), json!(keymr)); self.call("entry-block", params) } /** Return its current balance for a specific entry credit address. # Example ``` use factom::*; let address = "EC3EAsdwvihEN3DFhGJukpMS4aMPsZvxVvRSqyz5jeEqRVJMDDXx"; let factom = Factom::new(); let query = factom .entry_credit_balance(address) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn entry_credit_balance(self, address: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("address".to_string(), json!(address)); self.call("entry-credit-balance", params) } /** Retrieve a specified entrycredit block given its merkle root key. The numbers are minute markers. # Example ``` use factom::*; let keymr = "9b9e5b67b17f2e2d3d8405ea5fc227f6bf61fcc8c2422b36b11a7fce97018521"; let factom = Factom::new(); let query = factom .entry_credit_block(keymr) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn entry_credit_block(self, keymr: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("keymr".to_string(), json!(keymr)); self.call("entrycredit-block", params) } /** Returns the number of Factoshis (Factoids *10^-8) that purchase a single Entry Credit. The minimum factoid fees are also determined by this rate, along with how complex the factoid transaction is. # Example ``` use factom::*; let factom = Factom::new(); let query = factom .entry_credit_rate() .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn entry_credit_rate(self)-> impl Future<Item=Response, Error=FetchError>{ self.call("entry-credit-rate", HashMap::new()) } /** This call returns the number of Factoshis (Factoids *10^-8) that are currently available at the address specified. # Example ``` use factom::*; let address = "FA2jK2HcLnRdS94dEcU27rF3meoJfpUcZPSinpb7AwQvPRY6RL1Q"; let factom = Factom::new(); let query = factom .factoid_balance(address) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn factoid_balance(self, address: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("address".to_string(), json!(address)); self.call("factoid-balance", params) } /** Retrieve a specified factoid block given its merkle root key. # Example ``` use factom::*; let keymr = "aaaf4db6c1f5b716df0d63dcf9605f599d9e41eb635d8ba3e9ddfbe697ec426c"; let factom = Factom::new(); let query = factom .factoid_block(keymr) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn factoid_block(self, keymr: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("keymr".to_string(), json!(keymr)); self.call("factoid-block", params) } /** Submit a factoid transaction. The transaction hex encoded string is documented here: [Github Documentation](https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#factoid-transaction) The factoid-submit API takes a specifically formatted message encoded in hex that includes signatures. If you have a factom-walletd instance running, you can construct this factoid-submit API call with compose-transaction which takes easier to construct arguments. # Example ``` use factom::*; let tx = "0201565d109233010100b0a0e100646f3e8750c550e4582eca5047546ffef89c13a175985e320232bacac81cc428afd7c200ce7b98bfdae90f942bc1fe88c3dd44d8f4c81f4eeb88a5602da05abc82ffdb5301718b5edd2914acc2e4677f336c1a32736e5e9bde13663e6413894f57ec272e28dc1908f98b79df30005a99df3c5caf362722e56eb0e394d20d61d34ff66c079afad1d09eee21dcd4ddaafbb65aacea4d5c1afcd086377d77172f15b3aa32250a"; let factom = Factom::new(); let query = factom .factoid_submit(tx) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn factoid_submit(self, transaction: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("transaction".to_string(), json!(transaction)); self.call("factoid-submit", params) } /** Retrieve the factoid block for any given height. These blocks contain factoid transaction information. # Example ``` use factom::*; let factom = Factom::new(); let query = factom .fblock_by_height(1) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn fblock_by_height(self, height: u32)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("height".to_string(), json!(height)); self.call("fblock-by-height", params) } /** Returns various heights that allows you to view the state of the blockchain. The heights returned provide a lot of information regarding the state of factomd, but not all are needed by most applications. The heights also indicate the most recent block, which could not be complete, and still being built. The heights mean as follows: * directoryblockheight : The current directory block height of the local factomd node. * leaderheight : The current block being worked on by the leaders in the network. This block is not yet complete, but all transactions submitted will go into this block (depending on network conditions, the transaction may be delayed into the next block) * entryblockheight : The height at which the factomd node has all the entry blocks. Directory blocks are obtained first, entry blocks could be lagging behind the directory block when syncing. * entryheight : The height at which the local factomd node has all the entries. If you added entries at a block height above this, they will not be able to be retrieved by the local factomd until it syncs further. A fully synced node should show the same number for all, (except between minute 0 and 1, when leaderheight will be 1 block ahead.) # Example ``` use factom::*; let factom = Factom::new(); let query = factom.heights() .map(|response| response).map_err(|err| err); let result = fetch(query); let response = result.unwrap(); assert!(response.success()); ``` */ pub fn heights(self)-> impl Future<Item=Response, Error=FetchError>{ self.call("heights", HashMap::new()) } /** The multiple-ec-balances API is used to query the acknowledged and saved balances for a list of entry credit addresses. * currentheight is the current height that factomd was loading. * lastsavedheight is the height last saved to the database. * In balances it returns "ack", "saved" and "err". * ack is the balance after processing any in-flight transactions known to the Factom node responding to the API call * saved is the last saved to the database * err is just used to display any error that might have happened during the request. If it is empty that means there was no error. * If the syntax of the parameters is off e.g. missing a quote, a comma, or a square bracket, it will return: `{“jsonrpc”:“2.0”,“id”:null,“error”:{“code”:-32600,“message”:“Invalid Request”}}` * If the parameters are labeled incorrectly the call will return: `{“code”:-32602,“message”:“Invalid params”,“data”:“ERROR! Invalid params passed in, expected addresses”}` * If factomd is not loaded up all the way to the last saved block it will return: `{“currentheight”:0,“lastsavedheight”:0,“balances”:[{“ack”:0,“saved”:0,“err”:“Not fully booted”}]}` * If the list of addresses contains an incorrectly formatted address the call will return: `{“currentheight”:0,“lastsavedheight”:0,“balances”:[{“ack”:0,“saved”:0,“err”:“Error decoding address”}]}` * If an address in the list is valid but has never been part of a transaction the call will return: `“balances”:[{“ack”:0,“saved”:0,“err”:“Address has not had a transaction”}]` # Example ``` use factom::*; let addresses: Vec<&str> = vec!["EC3EAsdwvihEN3DFhGJukpMS4aMPsZvxVvRSqyz5jeEqRVJMDDXx"]; let factom = Factom::new(); let query = factom.multiple_ec_balances(addresses) .map(|response| response).map_err(|err| err); let result = fetch(query); let response = result.unwrap(); assert!(response.success()); ``` */ pub fn multiple_ec_balances(self, addresses: Vec<&str>)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("addresses".to_string(), json!(addresses)); self.call("multiple-ec-balances", params) } /** The multiple-fct-balances API is used to query the acknowledged and saved balances in factoshis (a factoshi is 10^8 factoids) not factoids(FCT) for a list of FCT addresses. * currentheight is the current height that factomd was loading. * lastsavedheight is the height last saved to the database. * In balances it returns "ack", "saved" and "err". * ack is the balance after processing any in-flight transactions known to the Factom node responding to the API call * saved is the last saved to the database * err is just used to display any error that might have happened during the request. If it is "" that means there was no error. * If the syntax of the parameters is off e.g. missing a quote, a comma, or a square bracket, it will return: `{”jsonrpc”:“2.0”,“id”:null,“error”:{“code”:-32600,“message”:“Invalid Request”}}` * If the parameters are labeled incorrectly the call will return: `{“code”:-32602,“message”:“Invalid params”,“data”:“ERROR! Invalid params passed in, expected 'addresses’”}` * If factomd is not loaded up all the way to the last saved block it will return: `{“currentheight”:0,“lastsavedheight”:0,“balances”:[{“ack”:0,“saved”:0,“err”:“Not fully booted”}]}` * If the list of addresses contains an incorrectly formatted address the call will return: `{“currentheight”:0,“lastsavedheight”:0,“balances”:[{“ack”:0,“saved”:0,“err”:“Error decoding address”}]}` * If an address in the list is valid but has never been part of a transaction it will return: `“balances”:[{“ack”:0,“saved”:0,“err”:“Address has not had a transaction”}]` # Example ``` use factom::*; let addresses: Vec<&str> = vec!["FA2jK2HcLnRdS94dEcU27rF3meoJfpUcZPSinpb7AwQvPRY6RL1Q"]; let factom = Factom::new(); let query = factom.multiple_fct_balances(addresses) .map(|response| response).map_err(|err| err); let result = fetch(query); let response = result.unwrap(); assert!(response.success()); ``` */ pub fn multiple_fct_balances(self, addresses: Vec<&str>)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("addresses".to_string(), json!(addresses)); self.call("multiple-fct-balances", params) } /** Returns an array of the entries that have been submitted but have not been recorded into the blockchain. # Example ``` use factom::*; let factom = Factom::new(); let query = factom.pending_entries() .map(|response| response).map_err(|err| err); let result = fetch(query); let response = result.unwrap(); assert!(response.success()); ``` */ pub fn pending_entries(self)-> impl Future<Item=Response, Error=FetchError>{ self.call("pending-entries", HashMap::new()) } /** Returns an array of factoid transactions that have not yet been recorded in the blockchain, but are known to the system. # Example ``` use factom::*; let factom = Factom::new(); let query = factom.pending_transactions(None) .map(|response| response).map_err(|err| err); let result = fetch(query); let response = result.unwrap(); assert!(response.success()); ``` */ pub fn pending_transactions(self, address: Option<&str>)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); if let Some(add) = address { params.insert("address".to_string(), json!(add)); } self.call("pending-transactions", params) } /** Retrieve current properties of the Factom system, including the software and the API versions. # Example ``` use factom::*; let factom = Factom::new(); let query = factom.properties() .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn properties(self)-> impl Future<Item=Response, Error=FetchError>{ self.call("properties", HashMap::new()) } /** Retrieve an entry or transaction in raw format, the data is a hex encoded string. # Example ``` use factom::*; let hash = "6ecd7c6c40d0e9dbb52457343e083d4306c5b4cd2d6e623ba67cf9d18b39faa7"; let factom = Factom::new(); let query = factom.raw_data(hash) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn raw_data(self, hash: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("hash".to_string(), json!(hash)); self.call("raw-data", params) } /** Retrieve a receipt providing cryptographically verifiable proof that information was recorded in the factom blockchain and that this was subsequently anchored in the bitcoin blockchain. # Example ``` use factom::*; let hash = "6ecd7c6c40d0e9dbb52457343e083d4306c5b4cd2d6e623ba67cf9d18b39faa7"; let factom = Factom::new(); let query = factom.receipt(hash) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn receipt(self, hash: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("hash".to_string(), json!(hash)); self.call("receipt", params) } /** Reveal the First Entry in a Chain to factomd after the Commit to complete the Chain creation. The reveal-chain hex encoded string is documented here: [Github Documentation](https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry) The reveal-chain API takes a specifically formatted message encoded in hex that includes signatures. If you have a factom-walletd instance running, you can construct this reveal-chain API call with compose-chain which takes easier to construct arguments. The compose-chain api call has two api calls in its response: commit-chain and reveal-chain. To successfully create a chain, the reveal-chain must be called after the commit-chain. */ pub fn reveal_chain(self, entry: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("entry".to_string(), json!(entry)); self.call("reveal-chain", params) } /** Reveal an Entry to factomd after the Commit to complete the Entry creation. The reveal-entry hex encoded string is documented here: [Github Documentation](https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry) The reveal-entry API takes a specifically formatted message encoded in hex that includes signatures. If you have a factom-walletd instance running, you can construct this reveal-entry API call with compose-entry which takes easier to construct arguments. The compose-entry api call has two api calls in it’s response: commit-entry and reveal-entry. To successfully create an entry, the reveal-entry must be called after the commit-entry. */ pub fn reveal_entry(self, entry: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("entry".to_string(), json!(entry)); self.call("reveal-entry", params) } /** Retrieve details of a factoid transaction using a transaction’s hash (or corresponding transaction id). Note that information regarding the * directory block height, * directory block keymr, and * transaction block keymr are also included. The "blockheight” parameter in the response will always be 0 when using this call, refer to “includedindirectoryblockheight” if you need the height. ### Notes This call will also accept an entry hash as input, in which case the returned data concerns the entry. The returned fields and their format are shown in the 2nd Example Response at right. If the input hash is non-existent, the returned fields will be as follows: * “includedintransactionblock”:“” * “includedindirectoryblock”:“” * “includedindirectoryblockheight”:-1 # Example ``` use factom::*; let hash = "21fc64855771f2ee12da2a85b1aa0108007ed3a566425f3eaec7c8c7d2db6c6d"; let factom = Factom::new(); let query = factom.transaction(hash) .map(|response| response).map_err(|err| err); let response = fetch(query).unwrap(); assert!(response.success()); ``` */ pub fn transaction(self, hash: &str)-> impl Future<Item=Response, Error=FetchError>{ let mut params = HashMap::new(); params.insert("hash".to_string(), json!(hash)); self.call("transaction", params) } }