repositorypackage
0.0.1
Repository: https://github.com/ross-weir/go-ergo-rest.git
Documentation: pkg.go.dev
# README
Go API client for ergo_rest
API docs for Ergo Node. Models are shared between all Ergo products
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 4.0.23
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://ergoplatform.org
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional
Put the package under your project folder and add the following in import:
import "./ergo_rest"
Documentation for API Endpoints
All URIs are relative to http://127.0.0.1:9053
Class | Method | HTTP request | Description |
---|---|---|---|
BlocksApi | GetBlockHeaderById | Get /blocks/{headerId}/header | Get the block header info by a given signature |
BlocksApi | GetBlockTransactionsById | Get /blocks/{headerId}/transactions | Get the block transactions info by a given signature |
BlocksApi | GetChainSlice | Get /blocks/chainSlice | Get headers in a specified range |
BlocksApi | GetFullBlockAt | Get /blocks/at/{blockHeight} | Get the header ids at a given height |
BlocksApi | GetFullBlockById | Get /blocks/{headerId} | Get the full block info by a given signature |
BlocksApi | GetHeaderIds | Get /blocks | Get the Array of header ids |
BlocksApi | GetLastHeaders | Get /blocks/lastHeaders/{count} | Get the last headers objects |
BlocksApi | GetModifierById | Get /blocks/modifier/{modifierId} | Get the persistent modifier by its id |
BlocksApi | GetProofForTx | Get /blocks/{headerId}/proofFor/{txId} | Get Merkle proof for transaction |
BlocksApi | SendMinedBlock | Post /blocks | Send a mined block |
InfoApi | GetNodeInfo | Get /info | Get the information about the Node |
MiningApi | MiningReadMinerRewardAddress | Get /mining/rewardAddress | Read miner reward address |
MiningApi | MiningReadMinerRewardPubkey | Get /mining/rewardPublicKey | Read public key associated with miner rewards |
MiningApi | MiningRequestBlockCandidate | Get /mining/candidate | Request block candidate |
MiningApi | MiningRequestBlockCandidateWithMandatoryTransactions | Post /mining/candidateWithTxs | Request block candidate |
MiningApi | MiningSubmitSolution | Post /mining/solution | Submit solution for current candidate |
NipopowApi | GetPopowHeaderByHeight | Get /nipopow/popowHeaderByHeight/{height} | Construct PoPow header for best header at given height |
NipopowApi | GetPopowHeaderById | Get /nipopow/popowHeaderById/{headerId} | Construct PoPow header according to given header id |
NipopowApi | GetPopowProof | Get /nipopow/proof/{minChainLength}/{suffixLength} | Construct PoPoW proof for given min superchain length and suffix length |
NipopowApi | GetPopowProofByHeaderId | Get /nipopow/proof/{minChainLength}/{suffixLength}/{headerId} | Construct PoPoW proof for given min superchain length, suffix length and header ID |
NodeApi | NodeShutdown | Post /node/shutdown | Shuts down the node |
PeersApi | ConnectToPeer | Post /peers/connect | Add address to peers list |
PeersApi | GetAllPeers | Get /peers/all | Get all known peers |
PeersApi | GetBlacklistedPeers | Get /peers/blacklisted | Get blacklisted peers |
PeersApi | GetConnectedPeers | Get /peers/connected | Get current connected peers |
PeersApi | GetPeersStatus | Get /peers/status | Get last incoming message timestamp and current network time |
PeersApi | GetPeersSyncInfo | Get /peers/syncInfo | Get sync info reported by peers, including versions, current status and height (if available) |
PeersApi | GetPeersTrackInfo | Get /peers/trackInfo | Get track info reported by peers, including count of invalid modifiers and details of requested and received modifiers |
ScanApi | AddBox | Post /scan/addBox | Adds a box to scans, writes box to database if it is not there. You can use scan number 10 to add a box to the wallet. |
ScanApi | DeregisterScan | Post /scan/deregister | Stop tracking and deregister scan |
ScanApi | ListAllScans | Get /scan/listAll | List all the registered scans |
ScanApi | ListUnspentScans | Get /scan/unspentBoxes/{scanId} | List boxes which are not spent. |
ScanApi | RegisterScan | Post /scan/register | Register a scan |
ScanApi | ScanStopTracking | Post /scan/stopTracking | Stop scan-related box tracking |
ScriptApi | AddressToBytes | Get /script/addressToBytes/{address} | Convert an address to hex-encoded Sigma byte array constant which contains script bytes |
ScriptApi | AddressToTree | Get /script/addressToTree/{address} | Convert an address to hex-encoded serialized ErgoTree (script) |
ScriptApi | ExecuteWithContext | Post /script/executeWithContext | Execute script with context |
ScriptApi | ScriptP2SAddress | Post /script/p2sAddress | Create P2SAddress from Sigma source |
ScriptApi | ScriptP2SHAddress | Post /script/p2shAddress | Create P2SHAddress from Sigma source |
TransactionsApi | CheckTransaction | Post /transactions/check | Checks an Ergo transaction without sending it over the network. Checks that transaction is valid and its inputs are in the UTXO set. Returns transaction identifier if the transaction is passing the checks. |
TransactionsApi | GetExpectedWaitTime | Get /transactions/waitTime | Get expected wait time for the transaction with specified fee and size |
TransactionsApi | GetFeeHistogram | Get /transactions/poolHistogram | Get histogram (waittime, (n_trans, sum(fee)) for transactions in mempool. It contains "bins"+1 bins, where i-th elements corresponds to transaction with wait time [i*maxtime/bins, (i+1)*maxtime/bins), and last bin corresponds to the transactions with wait time >= maxtime. |
TransactionsApi | GetRecommendedFee | Get /transactions/getFee | Get recommended fee (in nanoErgs) for a transaction with specified size (in bytes) to be proceeded in specified time (in minutes) |
TransactionsApi | GetUnconfirmedTransactions | Get /transactions/unconfirmed | Get current pool of the unconfirmed transactions pool |
TransactionsApi | SendTransaction | Post /transactions | Submit an Ergo transaction to unconfirmed pool to send it over the network |
UtilsApi | AddressToRaw | Get /utils/addressToRaw/{address} | Convert Pay-To-Public-Key Address to raw representation (hex-encoded serialized curve point) |
UtilsApi | CheckAddressValidity | Get /utils/address/{address} | Check address validity |
UtilsApi | ErgoTreeToAddress | Get /utils/ergoTreeToAddress/{ergoTreeHex} | Generate Ergo address from hex-encoded ErgoTree |
UtilsApi | GetRandomSeed | Get /utils/seed | Get random seed of 32 bytes |
UtilsApi | GetRandomSeedWithLength | Get /utils/seed/{length} | Generate random seed of specified length in bytes |
UtilsApi | HashBlake2b | Post /utils/hash/blake2b | Return Blake2b hash of specified message |
UtilsApi | RawToAddress | Get /utils/rawToAddress/{pubkeyHex} | Generate Pay-To-Public-Key address from hex-encoded raw pubkey (secp256k1 serialized point) |
UtxoApi | GenesisBoxes | Get /utxo/genesis | Get genesis boxes (boxes existed before the very first block) |
UtxoApi | GetBoxById | Get /utxo/byId/{boxId} | Get box contents for a box by a unique identifier. |
UtxoApi | GetBoxByIdBinary | Get /utxo/byIdBinary/{boxId} | Get serialized box from UTXO pool in Base16 encoding by an identifier. |
UtxoApi | GetBoxWithPoolById | Get /utxo/withPool/byId/{boxId} | Get box contents for a box by a unique identifier, from UTXO set and also the mempool. |
UtxoApi | GetBoxWithPoolByIdBinary | Get /utxo/withPool/byIdBinary/{boxId} | Get serialized box in Base16 encoding by an identifier, considering also the mempool. |
UtxoApi | GetBoxesBinaryProof | Post /utxo/getBoxesBinaryProof | Get serialized batch proof for given set of boxes |
WalletApi | AddBox | Post /scan/addBox | Adds a box to scans, writes box to database if it is not there. You can use scan number 10 to add a box to the wallet. |
WalletApi | CheckSeed | Post /wallet/check | Check whether mnemonic phrase is corresponding to the wallet seed |
WalletApi | ExtractHints | Post /wallet/extractHints | Extract hints from a transaction |
WalletApi | GenerateCommitments | Post /wallet/generateCommitments | Generate signature commitments for inputs of an unsigned transaction |
WalletApi | GetWalletStatus | Get /wallet/status | Get wallet status |
WalletApi | WalletAddresses | Get /wallet/addresses | Get wallet addresses |
WalletApi | WalletBalances | Get /wallet/balances | Get total amount of confirmed Ergo tokens and assets |
WalletApi | WalletBalancesUnconfirmed | Get /wallet/balances/withUnconfirmed | Get summary amount of confirmed plus unconfirmed Ergo tokens and assets |
WalletApi | WalletBoxes | Get /wallet/boxes | Get a list of all wallet-related boxes, both spent and unspent. Set minConfirmations to -1 to get mempool boxes included. |
WalletApi | WalletBoxesCollect | Post /wallet/boxes/collect | Get a list of collected boxes. |
WalletApi | WalletDeriveKey | Post /wallet/deriveKey | Derive new key according to a provided path |
WalletApi | WalletDeriveNextKey | Get /wallet/deriveNextKey | Derive next key |
WalletApi | WalletGetTransaction | Get /wallet/transactionById | Get wallet-related transaction by id |
WalletApi | WalletInit | Post /wallet/init | Initialize new wallet with randomly generated seed |
WalletApi | WalletLock | Get /wallet/lock | Lock wallet |
WalletApi | WalletPaymentTransactionGenerateAndSend | Post /wallet/payment/send | Generate and send payment transaction (default fee of 0.001 Erg is used) |
WalletApi | WalletRescan | Get /wallet/rescan | Rescan wallet (all the available full blocks) |
WalletApi | WalletRestore | Post /wallet/restore | Create new wallet from existing mnemonic seed |
WalletApi | WalletTransactionGenerate | Post /wallet/transaction/generate | Generate arbitrary transaction from array of requests. |
WalletApi | WalletTransactionGenerateAndSend | Post /wallet/transaction/send | Generate and send arbitrary transaction |
WalletApi | WalletTransactionSign | Post /wallet/transaction/sign | Sign arbitrary unsigned transaction with wallet secrets and also secrets provided. |
WalletApi | WalletTransactions | Get /wallet/transactions | Get a list of all wallet-related transactions |
WalletApi | WalletTransactionsByScanId | Get /wallet/transactionsByScanId/{scanId} | Get scan-related transactions by scan id |
WalletApi | WalletUnlock | Post /wallet/unlock | Unlock wallet |
WalletApi | WalletUnsignedTransactionGenerate | Post /wallet/transaction/generateUnsigned | Generate unsigned transaction from array of requests. |
WalletApi | WalletUnspentBoxes | Get /wallet/boxes/unspent | Get a list of unspent boxes. Set minConfirmations to -1 to have mempool boxes considered. |
WalletApi | WalletUpdateChangeAddress | Post /wallet/updateChangeAddress | Update address to be used to send change to |
Documentation For Models
- AddressHolder
- AddressValidity
- AndPredicate
- ApiError
- Asset
- AssetIssueRequest
- AvlTreeData
- BalancesSnapshot
- BlacklistedPeers
- BlockAdProofs
- BlockHeader
- BlockHeaderWithoutPow
- BlockTransactions
- BoxesRequestHolder
- BurnTokensRequest
- CandidateBlock
- CheckWallet
- Commitment
- CommitmentWithSecret
- ConnectedPeer
- ContainsAssetPredicate
- ContainsPredicate
- CryptoResult
- DeriveKey
- DeriveKeyResult
- DeriveNextKeyResult
- DhtSecret
- DlogCommitment
- EmissionInfo
- EqualsPredicate
- ErgoLikeContext
- ErgoLikeTransaction
- ErgoTransaction
- ErgoTransactionDataInput
- ErgoTransactionInput
- ErgoTransactionOutput
- ErgoTransactionUnsignedInput
- ErgoTreeObject
- ExecuteScript
- Extension
- FeeHistogramBin
- FullBlock
- GenerateCommitmentsRequest
- GenerateCommitmentsRequestSecrets
- HintExtractionRequest
- InitWallet
- InitWalletResult
- MerkleProof
- NipopowProof
- NodeInfo
- OrPredicate
- Parameters
- PassphraseMatch
- PaymentRequest
- Peer
- PeerMode
- PeersStatus
- PopowHeader
- PowSolutions
- PreHeader
- ProofOfUpcomingTransactions
- RequestedInfo
- RequestsHolder
- RestoreWallet
- RewardAddress
- RewardPubKey
- Scan
- ScanId
- ScanIdBoxId
- ScanIdsBox
- ScanRequest
- ScanningPredicate
- ScriptBytes
- SecretProven
- SerializedBox
- SigmaBoolean
- SigmaBooleanAndPredicate
- SigmaBooleanOrPredicate
- SigmaBooleanThresholdPredicate
- SigmaHeader
- SourceHolder
- SpendingProof
- SyncInfo
- TrackInfo
- TransactionHintsBag
- TransactionSigningRequest
- TransactionSigningRequestSecrets
- UnlockWallet
- UnsignedErgoTransaction
- WalletBox
- WalletStatus
- WalletTransaction
- WorkMessage
Documentation For Authorization
ApiKeyAuth
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)