modulepackage
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)
Author
# Functions
CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResonse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewConfiguration returns a new Configuration object.
# Variables
ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
# Structs
AddressHolder Holds encoded ErgoAddress.
AddressValidity Validity status of Ergo address.
AndPredicate struct for AndPredicate.
APIClient manages communication with the Ergo Node API API v4.0.23 In most cases there should be only one, shared, APIClient.
APIError struct for APIError.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
APIResponse stores the API response returned by the server.
Asset Token detail in the transaction.
AssetIssueRequest Request for generation of asset issue transaction.
AvlTreeData struct for AvlTreeData.
BalancesSnapshot Amount of Ergo tokens and assets.
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
BlacklistedPeers struct for BlacklistedPeers.
BlockAdProofs struct for BlockAdProofs.
BlockHeader struct for BlockHeader.
BlockHeaderWithoutPow struct for BlockHeaderWithoutPow.
BlockTransactions struct for BlockTransactions.
BoxesRequestHolder Holds request for wallet boxes.
BurnTokensRequest Request for burning tokens in wallet.
CandidateBlock Can be null if node is not mining or candidate block is not ready.
CheckWallet struct for CheckWallet.
Commitment basic trait for prover commitments.
CommitmentWithSecret commitment to secret along with secret (!) randomness.
Configuration stores the configuration of the API client.
ConnectedPeer struct for ConnectedPeer.
ContainsAssetPredicate struct for ContainsAssetPredicate.
ContainsPredicate struct for ContainsPredicate.
CryptoResult Result of executeWithContext request (reduceToCrypto).
DeriveKey struct for DeriveKey.
DeriveKeyResult struct for DeriveKeyResult.
DeriveNextKeyResult struct for DeriveNextKeyResult.
DhtSecret Hex-encoded big-endian 256-bits secret exponent \"w\" along with generators \"g\", \"h\", and group elements \"u\", \"v\", such as g^w = u, h^w = v.
DlogCommitment Randomness and commitment for the first step of the Schnorr protocol.
EmissionInfo Emission info for height.
EqualsPredicate struct for EqualsPredicate.
ErgoLikeContext struct for ErgoLikeContext.
ErgoLikeTransaction struct for ErgoLikeTransaction.
ErgoTransaction Ergo transaction.
ErgoTransactionDataInput struct for ErgoTransactionDataInput.
ErgoTransactionInput struct for ErgoTransactionInput.
ErgoTransactionOutput struct for ErgoTransactionOutput.
ErgoTransactionUnsignedInput struct for ErgoTransactionUnsignedInput.
ErgoTreeObject struct for ErgoTreeObject.
ExecuteScript struct for ExecuteScript.
Extension struct for Extension.
FeeHistogramBin Fee histogram bin.
FullBlock Block with header and transactions.
GenerateCommitmentsRequest request to generate commitments to sign a transaction.
GenerateCommitmentsRequestSecrets Optionally, external secrets used for signing.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
GetChainSliceOpts Optional parameters for the method 'GetChainSlice'.
GetFeeHistogramOpts Optional parameters for the method 'GetFeeHistogram'.
GetHeaderIDsOpts Optional parameters for the method 'GetHeaderIDs'.
GetUnconfirmedTransactionsOpts Optional parameters for the method 'GetUnconfirmedTransactions'.
HintExtractionRequest request to extract prover hints from a transaction.
InitWallet struct for InitWallet.
InitWalletResult struct for InitWalletResult.
ListUnspentScansOpts Optional parameters for the method 'ListUnspentScans'.
MerkleProof Merkle proof for a leaf, which is an array of bytes (e.g.
NipopowProof struct for NipopowProof.
NodeInfo struct for NodeInfo.
OrPredicate struct for OrPredicate.
Parameters struct for Parameters.
PassphraseMatch struct for PassphraseMatch.
PaymentRequest Request for generation of payment transaction to a given address.
Peer struct for Peer.
PeerMode struct for PeerMode.
PeersStatus struct for PeersStatus.
PopowHeader struct for PopowHeader.
PowSolutions An object containing all components of pow solution.
PreHeader struct for PreHeader.
ProofOfUpcomingTransactions Proof that a block corresponding to given header without PoW contains some transactions.
RequestedInfo struct for RequestedInfo.
RequestsHolder Holds many transaction requests and transaction fee.
RestoreWallet struct for RestoreWallet.
RewardAddress struct for RewardAddress.
RewardPubKey struct for RewardPubKey.
Scan struct for Scan.
ScanID struct for ScanID.
ScanIDBoxID struct for ScanIDBoxID.
ScanIDsBox Ergo box with associated scans (their respective identifiers).
ScanningPredicate struct for ScanningPredicate.
ScanRequest struct for ScanRequest.
ScriptBytes struct for ScriptBytes.
SecretProven struct for SecretProven.
SerializedBox struct for SerializedBox.
ServerConfiguration stores the information about a server.
ServerVariable stores the information about a server variable.
SigmaBoolean Algebraic data type of sigma proposition expressions.
SigmaBooleanAndPredicate struct for SigmaBooleanAndPredicate.
SigmaBooleanOrPredicate struct for SigmaBooleanOrPredicate.
SigmaBooleanThresholdPredicate struct for SigmaBooleanThresholdPredicate.
SigmaHeader Block header format used for sigma ErgoLikeContext.
SourceHolder struct for SourceHolder.
SpendingProof Spending proof for transaction input.
SyncInfo struct for SyncInfo.
TrackInfo struct for TrackInfo.
TransactionHintsBag prover hints extracted from a transaction.
TransactionSigningRequest A request to sign a transaction with secrets provided.
TransactionSigningRequestSecrets Secrets used for signing.
UnlockWallet struct for UnlockWallet.
UnsignedErgoTransaction Unsigned Ergo transaction.
WalletBox struct for WalletBox.
WalletBoxesOpts Optional parameters for the method 'WalletBoxes'.
WalletStatus Status of the node wallet.
WalletTransaction Transaction augmented with some useful information.
WalletTransactionsByScanIDOpts Optional parameters for the method 'WalletTransactionsByScanID'.
WalletTransactionsOpts Optional parameters for the method 'WalletTransactions'.
WalletUnspentBoxesOpts Optional parameters for the method 'WalletUnspentBoxes'.
WorkMessage Block candidate related data for external miner to perform work.
# Type aliases
BlocksAPIService BlocksAPI service.
InfoAPIService InfoAPI service.
MiningAPIService MiningAPI service.
NipopowAPIService NipopowAPI service.
NodeAPIService NodeAPI service.
PeersAPIService PeersAPI service.
ScanAPIService ScanAPI service.
ScriptAPIService ScriptAPI service.
TransactionsAPIService TransactionsAPI service.
UtilsAPIService UtilsAPI service.
UtxoAPIService UtxoAPI service.
WalletAPIService WalletAPI service.