github.com/algorand/go-algorand-sdk@v1.24.0/client/algod/models/models.go (about) 1 // Package models defines models used by an algod rest client// 2 // IF YOU MODIFY THIS FILE: IMPORTANT 3 // In practice, this is straight up copied from /v1/models/model.go. It is duplicated 4 // from internal model code, to maintain the internal/external client encapsulation. 5 // It does flatten some embedded structs, however. 6 // No client should depend on any package in v1. 7 package models 8 9 import ( 10 "github.com/algorand/go-algorand-sdk/types" 11 ) 12 13 // NodeStatus contains the information about a node status 14 // swagger:model NodeStatus 15 type NodeStatus struct { 16 // LastRound indicates the last round seen 17 // 18 // required: true 19 LastRound uint64 `json:"lastRound"` 20 21 // LastVersion indicates the last consensus version supported 22 // 23 // required: true 24 LastVersion string `json:"lastConsensusVersion"` 25 26 // NextVersion of consensus protocol to use 27 // 28 // required: true 29 NextVersion string `json:"nextConsensusVersion"` 30 31 // NextVersionRound is the round at which the next consensus version will apply 32 // 33 // required: true 34 NextVersionRound uint64 `json:"nextConsensusVersionRound"` 35 36 // NextVersionSupported indicates whether the next consensus version is supported by this node 37 // 38 // required: true 39 NextVersionSupported bool `json:"nextConsensusVersionSupported"` 40 41 // TimeSinceLastRound in nanoseconds 42 // 43 // required: true 44 TimeSinceLastRound int64 `json:"timeSinceLastRound"` 45 46 // CatchupTime in nanoseconds 47 // 48 // required: true 49 CatchupTime int64 `json:"catchupTime"` 50 51 // HasSyncedSinceStartup indicates whether a round has completed since startup 52 // Required: true 53 HasSyncedSinceStartup bool `json:"hasSyncedSinceStartup"` 54 55 // StoppedAtUnsupportedRound indicates that the node does not support the new rounds and has stopped making progress 56 // 57 // Required: true 58 StoppedAtUnsupportedRound bool `json:"stoppedAtUnsupportedRound"` 59 } 60 61 // TransactionID Description 62 // swagger:model transactionID 63 type TransactionID struct { 64 // TxId is the string encoding of the transaction hash 65 // 66 // required: true 67 TxID string `json:"txId"` 68 } 69 70 // Participation Description 71 // swagger:model Participation 72 type Participation struct { // Round and Address fields are redundant if Participation embedded in Account. Exclude for now. 73 // ParticipationPK is the root participation public key (if any) currently registered for this round 74 // 75 // required: true 76 // swagger:strfmt byte 77 ParticipationPK []byte `json:"partpkb64"` 78 79 // VRFPK is the selection public key (if any) currently registered for this round 80 // 81 // required: true 82 // swagger:strfmt byte 83 VRFPK []byte `json:"vrfpkb64"` 84 85 // VoteFirst is the first round for which this participation is valid. 86 // 87 // required: true 88 VoteFirst uint64 `json:"votefst"` 89 90 // VoteLast is the last round for which this participation is valid. 91 // 92 // required: true 93 VoteLast uint64 `json:"votelst"` 94 95 // VoteKeyDilution is the number of subkeys in for each batch of participation keys. 96 // 97 // required: true 98 VoteKeyDilution uint64 `json:"votekd"` 99 } 100 101 // Account Description 102 // swagger:model Account 103 type Account struct { 104 // Round indicates the round for which this information is relevant 105 // 106 // required: true 107 Round uint64 `json:"round"` 108 109 // Address indicates the account public key 110 // 111 // required: true 112 Address string `json:"address"` 113 114 // Amount indicates the total number of MicroAlgos in the account 115 // 116 // required: true 117 Amount uint64 `json:"amount"` 118 119 // PendingRewards specifies the amount of MicroAlgos of pending 120 // rewards in this account. 121 // 122 // required: true 123 PendingRewards uint64 `json:"pendingrewards"` 124 125 // AmountWithoutPendingRewards specifies the amount of MicroAlgos in 126 // the account, without the pending rewards. 127 // 128 // required: true 129 AmountWithoutPendingRewards uint64 `json:"amountwithoutpendingrewards"` 130 131 // Rewards indicates the total rewards of MicroAlgos the account has received, including pending rewards. 132 // 133 // required: true 134 Rewards uint64 `json:"rewards"` 135 136 // Status indicates the delegation status of the account's MicroAlgos 137 // Offline - indicates that the associated account is delegated. 138 // Online - indicates that the associated account used as part of the delegation pool. 139 // NotParticipating - indicates that the associated account is neither a delegator nor a delegate. 140 // 141 // required: true 142 Status string `json:"status"` 143 144 // Participation is the participation information currently associated with the account, if any. 145 // This field is optional and may not be set even if participation information is registered. 146 // In future REST API versions, this field may become required. 147 // 148 // required: false 149 Participation *Participation `json:"participation,omitempty"` 150 151 // AssetParams specifies the parameters of assets created by this account. 152 // 153 // required: false 154 AssetParams map[uint64]AssetParams `json:"thisassettotal,omitempty"` 155 156 // Assets specifies the holdings of assets by this account, 157 // indexed by the asset ID. 158 // 159 // required: false 160 Assets map[uint64]AssetHolding `json:"assets,omitempty"` 161 } 162 163 // Asset specifies both the unique identifier and the parameters for an asset 164 // swagger:model Asset 165 type Asset struct { 166 // AssetIndex is the unique asset identifier 167 // 168 // required: true 169 AssetIndex uint64 170 171 // AssetParams specifies the parameters of asset referred to by AssetIndex 172 // 173 // required: true 174 AssetParams AssetParams 175 } 176 177 // AssetParams specifies the parameters for an asset. 178 // swagger:model AssetParams 179 type AssetParams struct { 180 // Creator specifies the address that created this asset. 181 // This is the address where the parameters for this asset 182 // can be found, and also the address where unwanted asset 183 // units can be sent in the worst case. 184 // 185 // required: true 186 Creator string `json:"creator"` 187 188 // Total specifies the total number of units of this asset. 189 // 190 // required: true 191 Total uint64 `json:"total"` 192 193 // Decimals specifies the number of digits to use after the decimal 194 // point when displaying this asset. If 0, the asset is not divisible. 195 // If 1, the base unit of the asset is in tenths. If 2, the base unit 196 // of the asset is in hundredths, and so on. 197 // 198 // required: true 199 Decimals uint32 `json:"decimals"` 200 201 // DefaultFrozen specifies whether holdings in this asset 202 // are frozen by default. 203 // 204 // required: false 205 DefaultFrozen bool `json:"defaultfrozen"` 206 207 // UnitName specifies the name of a unit of this asset, 208 // as supplied by the creator. 209 // 210 // required: false 211 UnitName string `json:"unitname,omitempty"` 212 213 // AssetName specifies the name of this asset, 214 // as supplied by the creator. 215 // 216 // required: false 217 AssetName string `json:"assetname,omitempty"` 218 219 // URL specifies a URL where more information about the asset can be 220 // retrieved 221 // 222 // required: false 223 URL string `json:"url,omitempty"` 224 225 // MetadataHash specifies a commitment to some unspecified asset 226 // metadata. The format of this metadata is up to the application. 227 // 228 // required: false 229 // swagger:strfmt byte 230 MetadataHash []byte `json:"metadatahash,omitempty"` 231 232 // ManagerAddr specifies the address used to manage the keys of this 233 // asset and to destroy it. 234 // 235 // required: false 236 ManagerAddr string `json:"managerkey"` 237 238 // ReserveAddr specifies the address holding reserve (non-minted) 239 // units of this asset. 240 // 241 // required: false 242 ReserveAddr string `json:"reserveaddr"` 243 244 // FreezeAddr specifies the address used to freeze holdings of 245 // this asset. If empty, freezing is not permitted. 246 // 247 // required: false 248 FreezeAddr string `json:"freezeaddr"` 249 250 // ClawbackAddr specifies the address used to clawback holdings of 251 // this asset. If empty, clawback is not permitted. 252 // 253 // required: false 254 ClawbackAddr string `json:"clawbackaddr"` 255 } 256 257 // AssetHolding specifies the holdings of a particular asset. 258 // swagger:model AssetHolding 259 type AssetHolding struct { 260 // Creator specifies the address that created this asset. 261 // This is the address where the parameters for this asset 262 // can be found, and also the address where unwanted asset 263 // units can be sent in the worst case. 264 // 265 // required: true 266 Creator string `json:"creator"` 267 268 // Amount specifies the number of units held. 269 // 270 // required: true 271 Amount uint64 `json:"amount"` 272 273 // Frozen specifies whether this holding is frozen. 274 // 275 // required: false 276 Frozen bool `json:"frozen"` 277 } 278 279 // Transaction contains all fields common to all transactions and serves as an envelope to all transactions 280 // type 281 // swagger:model Transaction 282 type Transaction struct { 283 // Type is the transaction type 284 // 285 // required: true 286 Type types.TxType `json:"type"` 287 288 // TxID is the transaction ID 289 // 290 // required: true 291 TxID string `json:"tx"` 292 293 // From is the sender's address 294 // 295 // required: true 296 From string `json:"from"` 297 298 // Fee is the transaction fee 299 // 300 // required: true 301 Fee uint64 `json:"fee"` 302 303 // FirstRound indicates the first valid round for this transaction 304 // 305 // required: true 306 FirstRound uint64 `json:"first-round"` 307 308 // LastRound indicates the last valid round for this transaction 309 // 310 // required: true 311 LastRound uint64 `json:"last-round"` 312 313 // Note is a free form data 314 // 315 // required: false 316 // swagger:strfmt byte 317 Note []byte `json:"noteb64,omitempty"` 318 319 // Lease enforces mutual exclusion of transactions. If this field is 320 // nonzero, then once the transaction is confirmed, it acquires the 321 // lease identified by the (Sender, Lease) pair of the transaction until 322 // the LastValid round passes. While this transaction possesses the 323 // lease, no other transaction specifying this lease can be confirmed. 324 // 325 // required: false 326 // swagger:strfmt byte 327 Lease []byte `json:"lease,omitempty"` 328 329 // ConfirmedRound indicates the block number this transaction appeared in 330 // 331 // required: false 332 ConfirmedRound uint64 `json:"round"` 333 334 // TransactionResults contains information about the side effects of a transaction 335 // 336 // required: false 337 TransactionResults *TransactionResults `json:"txresults,omitempty"` 338 339 // PoolError indicates the transaction was evicted from this node's transaction 340 // pool (if non-empty). A non-empty PoolError does not guarantee that the 341 // transaction will never be committed; other nodes may not have evicted the 342 // transaction and may attempt to commit it in the future. 343 // 344 // required: false 345 PoolError string `json:"poolerror,omitempty"` 346 347 // This is a list of all supported transactions. 348 // To add another one, create a struct with XXXTransactionType and embed it here. 349 // To prevent extraneous fields, all must have the "omitempty" tag. 350 351 // Payment contains the additional fields for a payment transaction. 352 // 353 // required: false 354 Payment *PaymentTransactionType `json:"payment,omitempty"` 355 356 // Keyreg contains the additional fields for a keyreg transaction. 357 // 358 // required: false 359 Keyreg *KeyregTransactionType `json:"keyreg,omitempty"` 360 361 // AssetConfig contains the additional fields for an asset config transaction. 362 // 363 // required: false 364 AssetConfig *AssetConfigTransactionType `json:"curcfg,omitempty"` 365 366 // AssetTransfer contains the additional fields for an asset transfer transaction. 367 // 368 // required: false 369 AssetTransfer *AssetTransferTransactionType `json:"curxfer,omitempty"` 370 371 // AssetFreeze contains the additional fields for an asset freeze transaction. 372 // 373 // required: false 374 AssetFreeze *AssetFreezeTransactionType `json:"curfrz,omitempty"` 375 376 // FromRewards is the amount of pending rewards applied to the From 377 // account as part of this transaction. 378 // 379 // required: false 380 FromRewards uint64 `json:"fromrewards"` 381 382 // Genesis ID 383 // 384 // required: true 385 GenesisID string `json:"genesisID"` 386 387 // Genesis hash 388 // 389 // required: true 390 // swagger:strfmt byte 391 GenesisHash []byte `json:"genesishashb64"` 392 393 // Group 394 // 395 // required: false 396 // swagger:strfmt byte 397 Group []byte `json:"group,omitempty"` 398 } 399 400 // PaymentTransactionType contains the additional fields for a payment Transaction 401 // swagger:model PaymentTransactionType 402 type PaymentTransactionType struct { 403 // To is the receiver's address 404 // 405 // required: true 406 To string `json:"to"` 407 408 // CloseRemainderTo is the address the sender closed to 409 // 410 // required: false 411 CloseRemainderTo string `json:"close,omitempty"` 412 413 // CloseAmount is the amount sent to CloseRemainderTo, for committed transaction 414 // 415 // required: false 416 CloseAmount uint64 `json:"closeamount,omitempty"` 417 418 // Amount is the amount of MicroAlgos intended to be transferred 419 // 420 // required: true 421 Amount uint64 `json:"amount"` 422 423 // ToRewards is the amount of pending rewards applied to the To account 424 // as part of this transaction. 425 // 426 // required: false 427 ToRewards uint64 `json:"torewards"` 428 429 // CloseRewards is the amount of pending rewards applied to the CloseRemainderTo 430 // account as part of this transaction. 431 // 432 // required: false 433 CloseRewards uint64 `json:"closerewards"` 434 } 435 436 // KeyregTransactionType contains the additional fields for a keyreg Transaction 437 // swagger:model KeyregTransactionType 438 type KeyregTransactionType struct { 439 // VotePK is the participation public key used in key registration transactions 440 // 441 // required: false 442 // swagger:strfmt byte 443 VotePK []byte `json:"votekey"` 444 445 // SelectionPK is the VRF public key used in key registration transactions 446 // 447 // required: false 448 // swagger:strfmt byte 449 SelectionPK []byte `json:"selkey"` 450 451 // VoteFirst is the first round this participation key is valid 452 // 453 // required: false 454 VoteFirst uint64 `json:"votefst"` 455 456 // VoteLast is the last round this participation key is valid 457 // 458 // required: false 459 VoteLast uint64 `json:"votelst"` 460 461 // VoteKeyDilution is the dilution for the 2-level participation key 462 // 463 // required: false 464 VoteKeyDilution uint64 `json:"votekd"` 465 } 466 467 // TransactionResults contains information about the side effects of a transaction 468 // swagger:model TransactionResults 469 type TransactionResults struct { 470 // CreatedAssetIndex indicates the asset index of an asset created by this txn 471 // 472 // required: false 473 CreatedAssetIndex uint64 `json:"createdasset,omitempty"` 474 } 475 476 // AssetConfigTransactionType contains the additional fields for an asset config transaction 477 // swagger:model AssetConfigTransactionType 478 type AssetConfigTransactionType struct { 479 // AssetID is the asset being configured (or empty if creating) 480 // 481 // required: false 482 AssetID uint64 `json:"id"` 483 484 // Params specifies the new asset parameters (or empty if deleting) 485 // 486 // required: false 487 Params AssetParams `json:"params"` 488 } 489 490 // AssetTransferTransactionType contains the additional fields for an asset transfer transaction 491 // swagger:model AssetTransferTransactionType 492 type AssetTransferTransactionType struct { 493 // AssetID is the asset being configured (or empty if creating) 494 // 495 // required: true 496 AssetID uint64 `json:"id"` 497 498 // Amount is the amount being transferred. 499 // 500 // required: true 501 Amount uint64 `json:"amt"` 502 503 // Sender is the source account (if using clawback). 504 // 505 // required: false 506 Sender string `json:"snd"` 507 508 // Receiver is the recipient account. 509 // 510 // required: true 511 Receiver string `json:"rcv"` 512 513 // CloseTo is the destination for remaining funds (if closing). 514 // 515 // required: false 516 CloseTo string `json:"closeto"` 517 } 518 519 // AssetFreezeTransactionType contains the additional fields for an asset freeze transaction 520 // swagger:model AssetFreezeTransactionType 521 type AssetFreezeTransactionType struct { 522 // AssetID is the asset being configured (or empty if creating) 523 // 524 // required: true 525 AssetID uint64 `json:"id"` 526 527 // Account specifies the account where the asset is being frozen or thawed. 528 // 529 // required: true 530 Account string `json:"acct"` 531 532 // NewFreezeStatus specifies the new freeze status. 533 // 534 // required: true 535 NewFreezeStatus bool `json:"freeze"` 536 } 537 538 // TransactionList contains a list of transactions 539 // swagger:model TransactionList 540 type TransactionList struct { 541 // TransactionList is a list of transactions 542 // 543 // required: true 544 Transactions []Transaction `json:"transactions,omitempty"` 545 } 546 547 // AssetList contains a list of assets 548 // swagger:model AssetList 549 type AssetList struct { 550 // AssetList is a list of assets 551 // 552 // required: true 553 Assets []Asset `json:"assets,omitempty"` 554 } 555 556 // TransactionFee contains the suggested fee 557 // swagger:model TransactionFee 558 type TransactionFee struct { 559 // Fee is transaction fee 560 // Fee is in units of micro-Algos per byte. 561 // Fee may fall to zero but a group of N atomic transactions must 562 // still have a fee of at least N*MinTxnFee for the current network protocol. 563 // 564 // required: true 565 Fee uint64 `json:"fee"` 566 } 567 568 // TransactionParams contains the parameters that help a client construct 569 // a new transaction. 570 // swagger:model TransactionParams 571 type TransactionParams struct { 572 // Fee is the suggested transaction fee 573 // Fee is in units of micro-Algos per byte. 574 // Fee may fall to zero but a group of N atomic transactions must 575 // still have a fee of at least N*MinTxnFee for the current network protocol. 576 // 577 // required: true 578 Fee uint64 `json:"fee"` 579 580 // Genesis ID 581 // 582 // required: true 583 GenesisID string `json:"genesisID"` 584 585 // Genesis hash 586 // 587 // required: true 588 // swagger:strfmt byte 589 GenesisHash []byte `json:"genesishashb64"` 590 591 // LastRound indicates the last round seen 592 // 593 // required: true 594 LastRound uint64 `json:"lastRound"` 595 596 // ConsensusVersion indicates the consensus protocol version 597 // as of LastRound. 598 // 599 // required: true 600 ConsensusVersion string `json:"consensusVersion"` 601 602 // The minimum transaction fee (not per byte) required for the 603 // txn to validate for the current network protocol. 604 // 605 // required: false 606 MinTxnFee uint64 `json:"minFee"` 607 } 608 609 // RawResponse is fulfilled by responses that should not be decoded as msgpack 610 type RawResponse interface { 611 SetBytes([]byte) 612 } 613 614 // RawBlock represents an encoded msgpack block 615 // swagger:model RawBlock 616 // swagger:strfmt byte 617 type RawBlock []byte 618 619 // SetBytes fulfills the RawResponse interface on RawBlock 620 func (rb *RawBlock) SetBytes(b []byte) { 621 *rb = b 622 } 623 624 // Block contains a block information 625 // swagger:model Block 626 type Block struct { 627 // Hash is the current block hash 628 // 629 // required: true 630 Hash string `json:"hash"` 631 632 // PreviousBlockHash is the previous block hash 633 // 634 // required: true 635 PreviousBlockHash string `json:"previousBlockHash"` 636 637 // Seed is the sortition seed 638 // 639 // required: true 640 Seed string `json:"seed"` 641 642 // Proposer is the address of this block proposer 643 // 644 // required: true 645 Proposer string `json:"proposer"` 646 647 // Round is the current round on which this block was appended to the chain 648 // 649 // required: true 650 Round uint64 `json:"round"` 651 652 // Period is the period on which the block was confirmed 653 // 654 // required: true 655 Period uint64 `json:"period"` 656 657 // TransactionsRoot authenticates the set of transactions appearing in the block. 658 // More specifically, it's the root of a merkle tree whose leaves are the block's Txids, in lexicographic order. 659 // For the empty block, it's 0. 660 // Note that the TxnRoot does not authenticate the signatures on the transactions, only the transactions themselves. 661 // Two blocks with the same transactions but in a different order and with different signatures will have the same TxnRoot. 662 // 663 // required: true 664 TransactionsRoot string `json:"txnRoot"` 665 666 // RewardsLevel specifies how many rewards, in MicroAlgos, 667 // have been distributed to each config.Protocol.RewardUnit 668 // of MicroAlgos since genesis. 669 RewardsLevel uint64 `json:"reward"` 670 671 // The number of new MicroAlgos added to the participation stake from rewards at the next round. 672 RewardsRate uint64 `json:"rate"` 673 674 // The number of leftover MicroAlgos after the distribution of RewardsRate/rewardUnits 675 // MicroAlgos for every reward unit in the next round. 676 RewardsResidue uint64 `json:"frac"` 677 678 // Transactions is the list of transactions in this block 679 Transactions TransactionList `json:"txns"` 680 681 // TimeStamp in seconds since epoch 682 // 683 // required: true 684 Timestamp int64 `json:"timestamp"` 685 686 UpgradeState 687 UpgradeVote 688 } 689 690 // UpgradeState contains the information about a current state of an upgrade 691 // swagger:model UpgradeState 692 type UpgradeState struct { 693 // CurrentProtocol is a string that represents the current protocol 694 // 695 // required: true 696 CurrentProtocol string `json:"currentProtocol"` 697 698 // NextProtocol is a string that represents the next proposed protocol 699 // 700 // required: true 701 NextProtocol string `json:"nextProtocol"` 702 703 // NextProtocolApprovals is the number of blocks which approved the protocol upgrade 704 // 705 // required: true 706 NextProtocolApprovals uint64 `json:"nextProtocolApprovals"` 707 708 // NextProtocolVoteBefore is the deadline round for this protocol upgrade (No votes will be consider after this round) 709 // 710 // required: true 711 NextProtocolVoteBefore uint64 `json:"nextProtocolVoteBefore"` 712 713 // NextProtocolSwitchOn is the round on which the protocol upgrade will take effect 714 // 715 // required: true 716 NextProtocolSwitchOn uint64 `json:"nextProtocolSwitchOn"` 717 } 718 719 // UpgradeVote represents the vote of the block proposer with respect to protocol upgrades. 720 // swagger:model UpgradeVote 721 type UpgradeVote struct { 722 // UpgradePropose indicates a proposed upgrade 723 // 724 // required: true 725 UpgradePropose string `json:"upgradePropose"` 726 727 // UpgradeApprove indicates a yes vote for the current proposal 728 // 729 // required: true 730 UpgradeApprove bool `json:"upgradeApprove"` 731 } 732 733 // Supply represents the current supply of MicroAlgos in the system 734 // swagger:model Supply 735 type Supply struct { 736 // Round 737 // 738 // required: true 739 Round uint64 `json:"round"` 740 741 // TotalMoney 742 // 743 // required: true 744 TotalMoney uint64 `json:"totalMoney"` 745 746 // OnlineMoney 747 // 748 // required: true 749 OnlineMoney uint64 `json:"onlineMoney"` 750 } 751 752 // PendingTransactions represents a potentially truncated list of transactions currently in the 753 // node's transaction pool. 754 // swagger:model PendingTransactions 755 type PendingTransactions struct { 756 // TruncatedTxns 757 // required: true 758 TruncatedTxns TransactionList `json:"truncatedTxns"` 759 // TotalTxns 760 // required: true 761 TotalTxns uint64 `json:"totalTxns"` 762 } 763 764 // Version contains the current algod version. 765 // 766 // Note that we annotate this as a model so that legacy clients 767 // can directly import a swagger generated Version model. 768 // swagger:model Version 769 type Version struct { 770 // required: true 771 // returns a list of supported protocol versions ( i.e. v1, v2, etc. ) 772 Versions []string `json:"versions"` 773 // required: true 774 GenesisID string `json:"genesis_id"` 775 // required: true 776 // swagger:strfmt byte 777 GenesisHash []byte `json:"genesis_hash_b64"` 778 // required: true 779 Build BuildVersion `json:"build"` 780 } 781 782 // BuildVersion contains the current algod build version information. 783 type BuildVersion struct { 784 // required: true 785 // Algorand's major version number 786 Major int `json:"major"` 787 // required: true 788 // Algorand's minor version number 789 Minor int `json:"minor"` 790 // required: true 791 // Algorand's Build Number 792 BuildNumber int `json:"build_number"` 793 // required: true 794 // Hash of commit the build is based on 795 CommitHash string `json:"commit_hash"` 796 // required: true 797 // Branch the build is based on 798 Branch string `json:"branch"` 799 // required: true 800 // Branch-derived release channel the build is based on 801 Channel string `json:"channel"` 802 } 803 804 // VersionsResponse is the response to 'GET /versions' 805 // 806 // swagger:response VersionsResponse 807 type VersionsResponse struct { 808 // in: body 809 Body Version 810 }