github.com/mit-dci/lit@v0.0.0-20221102210550-8c3d3b49f2ce/litrpc/README.md (about) 1 # RPC Commands 2 3 Other structs referenced in request/responses have their declarations copied in 4 second secton of this document. 5 6 ## chancmds 7 8 ### ChannelList 9 10 Args: 11 12 * `ChanIdx (uint32)` 13 14 Returns: 15 16 * `Channels (ChannelInfo list)` 17 18 If ChanIdx is nonzero, returns info for only that channel. 19 20 ### FundChannel 21 22 Args: 23 24 * `Peer (uint32)` 25 * `CoinType (uint32)` 26 * `Capacity (int64)` 27 * `Roundup (int64)` 28 * `InitialSend (int64)` 29 * `Data (32 byte array)` 30 31 Returns: 32 33 * `Status (string)` 34 35 ### DualFundChannel 36 37 Args: 38 39 * `Peer (uint32)` 40 * `CoinType (uint32)` 41 * `OurAmount (int64)` 42 * `TheirAmount (int64)` 43 44 Returns: 45 46 * `Status (string)` 47 48 ### DualFundRespond 49 50 Args: 51 52 * `AcceptOrDecline (bool)` 53 54 Returns: 55 56 * `Status (string)` 57 58 True for accept, false for decline. 59 60 ### PendingDualFund 61 62 Args: *empty object* 63 64 Returns: 65 66 * `Pending (bool)` 67 * `PeerIdx (uint32)` 68 * `CoinType (uint32)` 69 * `TheirAmount (int64)` 70 * `RequestedAmount (int64)` 71 72 ### StateDump 73 74 Args: *empty object* 75 76 Returns: 77 78 * `Txs (JusticeTx list)` 79 80 ### Push 81 82 Args: 83 84 * `ChanIdx (uint32)` 85 * `Amt (int64)` 86 * `Data (32 byte array)` 87 88 Returns: 89 90 * `StateIndex (uint64)`` 91 92 ### CloseChannel 93 94 Args: 95 96 * `ChanIdx (uint32)` 97 98 Returns: 99 100 * `Status (string)` 101 102 ### BreakChannel 103 104 Args: 105 106 * `ChanIdx (uint32)` 107 108 Returns: 109 110 * `Status (string)` 111 112 ### DumpPrivs 113 114 Args: *none* 115 116 Returns: 117 118 * `Privs (PrivInfo list)` 119 120 ## dlccmds 121 122 ### ListOracles 123 124 Args: *empty object* 125 126 Returns: 127 128 * `Oracles (DlcOracle list)` 129 130 ### ImportOracle 131 132 Args: 133 134 * `Url (string)` 135 * `Name (string)` 136 137 Returns: 138 139 * `Oracle (DlcOracle)` 140 141 ### AddOracle 142 143 Args: 144 145 * `Key (string)` 146 * `Name (string)` 147 148 Returns: 149 150 * `Oracle (DlcOracle)` 151 152 ### NewContract 153 154 Args: *empty object* 155 156 Returns: 157 158 * `Contract (DlcContract)` 159 160 ### ListContracts 161 162 Args: *empty object* 163 164 Returns: 165 166 * `Contracts (DlcContract list)` 167 168 ### GetContract 169 170 Args: 171 172 * `Idx (uint64)` 173 174 Returns: 175 176 * `Contract (DlcContract)` 177 178 ### SetContractOracle 179 180 Args: 181 182 * `CIdx (uint64)` 183 * `OIdx (uint64)` 184 185 Returns: 186 187 * `Success (bool)` 188 189 ### SetContractDatafeed 190 191 Args: 192 193 * `CIdx (uint64)` 194 * `Feed (uint64)` 195 196 Returns: 197 198 * `Success (bool)` 199 200 ### SetContractRPoint 201 202 Args: 203 204 * `CIdx (uint64)` 205 * `RPoint (33 byte list)` 206 207 Returns: 208 209 * `Success (bool)` 210 211 ### SetContractFunding 212 213 Args: 214 215 * `CIdx (uint64)` 216 * `OutAmount (int64)` 217 * `TheirAmount (int64)` 218 219 ### SetContractDivision 220 221 Args: 222 223 * `CIdx (uint64)` 224 * `ValueFullyOurs (int64)` 225 * `ValueFullyTheirs (int64)` 226 227 Returns: 228 229 * `Success (bool)` 230 231 ### SetContractCoinType 232 233 Args: 234 235 * `CIdx (uint64)` 236 * `CoinType (uint32)` 237 238 Returns: 239 240 * `Success (bool)` 241 242 ### OfferContract 243 244 Args: 245 246 * `CIdx (uint64)` 247 * `PeerIdx (uint32)` 248 249 Returns: 250 251 * `Success (bool)` 252 253 ### ContractRespond 254 255 Args: 256 257 * `AcceptOrDecline (bool)` 258 * `CIdx (uint64)` 259 260 Returns: 261 262 * `Success (bool)` 263 264 True for accept, false for decline. 265 266 ### SettleContract 267 268 Args: 269 270 * `CIdx (uint64)` 271 * `OracleValue (int64)` 272 * `OracleSig (32 byte list)` 273 274 Returns: 275 276 * `Success (bool)` 277 * `SettleTxHash (32 byte list)` 278 * `ClaimTxHash (32 byte list)` 279 280 ## netcmds 281 282 ### Listen 283 284 Args: 285 286 * `Port (string)` (why is this a string lol) 287 288 Returns: 289 290 * `LisIpPorts (string list)` 291 * `Adr (string)` 292 293 ### Connect 294 295 Args: 296 297 * `LNAddr (string)` 298 299 Returns: 300 301 * `Status (string)` 302 * `PeerIdx (uint32)` 303 304 ### AssignNickname 305 306 Args: 307 308 * `Peer (uint32)` 309 * `Nickname (string)` 310 311 Returns: 312 313 * `Status (string)` 314 315 ### ListConnections 316 317 Args: *none* 318 319 Returns: 320 321 * `Connections (PeerInfo list)` 322 * `MyPKH (string)` 323 324 ### GetListeningPorts 325 326 Args: *none* 327 328 Returns: 329 330 * `LisIpPorts (string list)` 331 * `Adr (string)` 332 333 ### GetMessages 334 335 Args: *none* 336 337 Returns: 338 339 * `Status (string)` 340 341 ### Say 342 343 Args: 344 345 * `Peer (uint32)` 346 * `Message (string)` 347 348 Returns: 349 350 * `Status (string)` 351 352 ### Stop 353 354 Args: *none* 355 356 Returns: 357 358 * `Status (string)` 359 360 ### GetChannelMap 361 362 Args: *none* 363 364 Returns: 365 366 * `Graph (string)` 367 368 The string is formatted in the GraphViz `.dot` format. 369 370 ## towercmds 371 372 ### Watch 373 374 Args: 375 376 * `ChanIdx (uint32)` 377 * `SendToPeer (uint32)` 378 379 Returns: 380 381 * `Msg (string)` 382 383 ## walletcmds 384 385 ### Balance 386 387 Args: *none* 388 389 Returns: 390 391 * `Balances (CoinBalReply list)` 392 393 ### TxoList 394 395 Args: *none* 396 397 Returns: 398 399 * `Txos (TxoInfo list)` 400 401 ### Send 402 403 Args: 404 405 * `DestArgs (string list)` 406 * `Amts (int64 list)` 407 408 Returns: 409 410 * `Txids (string list)` 411 412 ### Sweep 413 414 Args: 415 416 * `DestAdr (string)` 417 * `NumTx (uint32)` 418 * `Drop (bool)` 419 420 Returns: 421 422 * `Txids (string list)` 423 424 ### Fanout 425 426 Args: 427 428 * `DestAdr (string)` 429 * `NumOutputs (uint32)` 430 * `AmtPerOutput (int64)` 431 432 Returns: 433 434 * `Txids (string list)` 435 436 ### SetFee 437 438 Args: 439 440 * `Fee (int64)` 441 * `CoinType (uint32)` 442 443 Returns: 444 445 * `CurrentFee (int64)` 446 447 ### GetFee 448 449 Args: 450 451 * `CoinType (uint32)` 452 453 Returns: 454 455 * `CurrentFee (int64)` 456 457 ### Address 458 459 Args: 460 461 * `NumToMake (uint32)` 462 * `CoinType (uint32)` 463 464 Returns: 465 466 * `CoinTypes (uint32 list)` 467 * `WitAddresses (string list)` 468 * `LegacyAddresses (string list)` 469 470 If you set NumToMake to 0, it'll return all the addresses of the type. 471 472 ### GetAddresses 473 474 Args: *none* 475 476 Returns: 477 478 * `CoinTypes (uint32 list)` 479 * `WitAddresses (string list)` 480 * `LegacyAddresses (string list)` 481 482 # Other Types 483 484 ### ChannelInfo 485 486 ```go 487 type ChannelInfo struct { 488 OutPoint string 489 CoinType uint32 490 Closed bool 491 Capacity int64 492 MyBalance int64 493 Height int32 // block height of channel fund confirmation 494 StateNum uint64 // Most recent commit number 495 PeerIdx, CIdx uint32 496 PeerID string 497 Data [32]byte 498 Pkh [20]byte 499 LastUpdate uint64 500 } 501 ``` 502 503 ### Priv Info 504 505 ```go 506 type PrivInfo struct { 507 OutPoint string 508 Amt int64 509 Height int32 510 Delay int32 511 CoinType string 512 Witty bool 513 PairKey string 514 515 WIF string 516 } 517 ``` 518 519 ### DlcOracle 520 521 ```go 522 type DlcOracle struct { 523 Idx uint64 // Index of the oracle for refencing in commands 524 A [33]byte // public key of the oracle 525 Name string // Name of the oracle for display purposes 526 Url string // Base URL of the oracle, if its REST based (optional) 527 } 528 ``` 529 530 ### DlcContract 531 532 ```go 533 type DlcContract struct { 534 // Index of the contract for referencing in commands 535 Idx uint64 536 // Index of the contract on the other peer (so we can reference it in 537 // messages) 538 TheirIdx uint64 539 // Index of the peer we've offered the contract to or received the contract 540 // from 541 PeerIdx uint32 542 // Coin type 543 CoinType uint32 544 // Pub keys of the oracle and the R point used in the contract 545 OracleA, OracleR [33]byte 546 // The time we expect the oracle to publish 547 OracleTimestamp uint64 548 // The payout specification 549 Division []DlcContractDivision 550 // The amounts either side are funding 551 OurFundingAmount, TheirFundingAmount int64 552 // PKH to which the contracts funding change should go 553 OurChangePKH, TheirChangePKH [20]byte 554 // Pubkey used in the funding multisig output 555 OurFundMultisigPub, TheirFundMultisigPub [33]byte 556 // Pubkey to be used in the commit script (combined with oracle pubkey 557 // or CSV timeout) 558 OurPayoutBase, TheirPayoutBase [33]byte 559 // Pubkeyhash to which the contract pays out (directly) 560 OurPayoutPKH, TheirPayoutPKH [20]byte 561 // Status of the contract 562 Status DlcContractStatus 563 // Outpoints used to fund the contract 564 OurFundingInputs, TheirFundingInputs []DlcContractFundingInput 565 // Signatures for the settlement transactions 566 TheirSettlementSignatures []DlcContractSettlementSignature 567 // The outpoint of the funding TX we want to spend in the settlement 568 // for easier monitoring 569 FundingOutpoint wire.OutPoint 570 } 571 ``` 572 573 ### PeerInfo 574 575 ```go 576 type PeerInfo struct { 577 PeerNumber uint32 578 RemoteHost string 579 LitAdr string 580 Nickname string 581 } 582 ``` 583 584 ### CoinBalReply 585 586 ```go 587 type CoinBalReply struct { 588 CoinType uint32 589 SyncHeight int32 // height this wallet is synced to 590 ChanTotal int64 // total balance in channels 591 TxoTotal int64 // all utxos 592 MatureWitty int64 // confirmed, spendable and witness 593 FeeRate int64 // fee per byte 594 } 595 ``` 596 597 ### TxoInfo 598 599 ```go 600 type TxoInfo struct { 601 OutPoint string 602 Amt int64 603 Height int32 604 Delay int32 605 CoinType string 606 Witty bool 607 608 KeyPath string 609 } 610 ```