Categorygithub.com/ross-weir/go-ergo-rest
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

ClassMethodHTTP requestDescription
BlocksApiGetBlockHeaderByIdGet /blocks/{headerId}/headerGet the block header info by a given signature
BlocksApiGetBlockTransactionsByIdGet /blocks/{headerId}/transactionsGet the block transactions info by a given signature
BlocksApiGetChainSliceGet /blocks/chainSliceGet headers in a specified range
BlocksApiGetFullBlockAtGet /blocks/at/{blockHeight}Get the header ids at a given height
BlocksApiGetFullBlockByIdGet /blocks/{headerId}Get the full block info by a given signature
BlocksApiGetHeaderIdsGet /blocksGet the Array of header ids
BlocksApiGetLastHeadersGet /blocks/lastHeaders/{count}Get the last headers objects
BlocksApiGetModifierByIdGet /blocks/modifier/{modifierId}Get the persistent modifier by its id
BlocksApiGetProofForTxGet /blocks/{headerId}/proofFor/{txId}Get Merkle proof for transaction
BlocksApiSendMinedBlockPost /blocksSend a mined block
InfoApiGetNodeInfoGet /infoGet the information about the Node
MiningApiMiningReadMinerRewardAddressGet /mining/rewardAddressRead miner reward address
MiningApiMiningReadMinerRewardPubkeyGet /mining/rewardPublicKeyRead public key associated with miner rewards
MiningApiMiningRequestBlockCandidateGet /mining/candidateRequest block candidate
MiningApiMiningRequestBlockCandidateWithMandatoryTransactionsPost /mining/candidateWithTxsRequest block candidate
MiningApiMiningSubmitSolutionPost /mining/solutionSubmit solution for current candidate
NipopowApiGetPopowHeaderByHeightGet /nipopow/popowHeaderByHeight/{height}Construct PoPow header for best header at given height
NipopowApiGetPopowHeaderByIdGet /nipopow/popowHeaderById/{headerId}Construct PoPow header according to given header id
NipopowApiGetPopowProofGet /nipopow/proof/{minChainLength}/{suffixLength}Construct PoPoW proof for given min superchain length and suffix length
NipopowApiGetPopowProofByHeaderIdGet /nipopow/proof/{minChainLength}/{suffixLength}/{headerId}Construct PoPoW proof for given min superchain length, suffix length and header ID
NodeApiNodeShutdownPost /node/shutdownShuts down the node
PeersApiConnectToPeerPost /peers/connectAdd address to peers list
PeersApiGetAllPeersGet /peers/allGet all known peers
PeersApiGetBlacklistedPeersGet /peers/blacklistedGet blacklisted peers
PeersApiGetConnectedPeersGet /peers/connectedGet current connected peers
PeersApiGetPeersStatusGet /peers/statusGet last incoming message timestamp and current network time
PeersApiGetPeersSyncInfoGet /peers/syncInfoGet sync info reported by peers, including versions, current status and height (if available)
PeersApiGetPeersTrackInfoGet /peers/trackInfoGet track info reported by peers, including count of invalid modifiers and details of requested and received modifiers
ScanApiAddBoxPost /scan/addBoxAdds 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.
ScanApiDeregisterScanPost /scan/deregisterStop tracking and deregister scan
ScanApiListAllScansGet /scan/listAllList all the registered scans
ScanApiListUnspentScansGet /scan/unspentBoxes/{scanId}List boxes which are not spent.
ScanApiRegisterScanPost /scan/registerRegister a scan
ScanApiScanStopTrackingPost /scan/stopTrackingStop scan-related box tracking
ScriptApiAddressToBytesGet /script/addressToBytes/{address}Convert an address to hex-encoded Sigma byte array constant which contains script bytes
ScriptApiAddressToTreeGet /script/addressToTree/{address}Convert an address to hex-encoded serialized ErgoTree (script)
ScriptApiExecuteWithContextPost /script/executeWithContextExecute script with context
ScriptApiScriptP2SAddressPost /script/p2sAddressCreate P2SAddress from Sigma source
ScriptApiScriptP2SHAddressPost /script/p2shAddressCreate P2SHAddress from Sigma source
TransactionsApiCheckTransactionPost /transactions/checkChecks 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.
TransactionsApiGetExpectedWaitTimeGet /transactions/waitTimeGet expected wait time for the transaction with specified fee and size
TransactionsApiGetFeeHistogramGet /transactions/poolHistogramGet 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.
TransactionsApiGetRecommendedFeeGet /transactions/getFeeGet recommended fee (in nanoErgs) for a transaction with specified size (in bytes) to be proceeded in specified time (in minutes)
TransactionsApiGetUnconfirmedTransactionsGet /transactions/unconfirmedGet current pool of the unconfirmed transactions pool
TransactionsApiSendTransactionPost /transactionsSubmit an Ergo transaction to unconfirmed pool to send it over the network
UtilsApiAddressToRawGet /utils/addressToRaw/{address}Convert Pay-To-Public-Key Address to raw representation (hex-encoded serialized curve point)
UtilsApiCheckAddressValidityGet /utils/address/{address}Check address validity
UtilsApiErgoTreeToAddressGet /utils/ergoTreeToAddress/{ergoTreeHex}Generate Ergo address from hex-encoded ErgoTree
UtilsApiGetRandomSeedGet /utils/seedGet random seed of 32 bytes
UtilsApiGetRandomSeedWithLengthGet /utils/seed/{length}Generate random seed of specified length in bytes
UtilsApiHashBlake2bPost /utils/hash/blake2bReturn Blake2b hash of specified message
UtilsApiRawToAddressGet /utils/rawToAddress/{pubkeyHex}Generate Pay-To-Public-Key address from hex-encoded raw pubkey (secp256k1 serialized point)
UtxoApiGenesisBoxesGet /utxo/genesisGet genesis boxes (boxes existed before the very first block)
UtxoApiGetBoxByIdGet /utxo/byId/{boxId}Get box contents for a box by a unique identifier.
UtxoApiGetBoxByIdBinaryGet /utxo/byIdBinary/{boxId}Get serialized box from UTXO pool in Base16 encoding by an identifier.
UtxoApiGetBoxWithPoolByIdGet /utxo/withPool/byId/{boxId}Get box contents for a box by a unique identifier, from UTXO set and also the mempool.
UtxoApiGetBoxWithPoolByIdBinaryGet /utxo/withPool/byIdBinary/{boxId}Get serialized box in Base16 encoding by an identifier, considering also the mempool.
UtxoApiGetBoxesBinaryProofPost /utxo/getBoxesBinaryProofGet serialized batch proof for given set of boxes
WalletApiAddBoxPost /scan/addBoxAdds 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.
WalletApiCheckSeedPost /wallet/checkCheck whether mnemonic phrase is corresponding to the wallet seed
WalletApiExtractHintsPost /wallet/extractHintsExtract hints from a transaction
WalletApiGenerateCommitmentsPost /wallet/generateCommitmentsGenerate signature commitments for inputs of an unsigned transaction
WalletApiGetWalletStatusGet /wallet/statusGet wallet status
WalletApiWalletAddressesGet /wallet/addressesGet wallet addresses
WalletApiWalletBalancesGet /wallet/balancesGet total amount of confirmed Ergo tokens and assets
WalletApiWalletBalancesUnconfirmedGet /wallet/balances/withUnconfirmedGet summary amount of confirmed plus unconfirmed Ergo tokens and assets
WalletApiWalletBoxesGet /wallet/boxesGet a list of all wallet-related boxes, both spent and unspent. Set minConfirmations to -1 to get mempool boxes included.
WalletApiWalletBoxesCollectPost /wallet/boxes/collectGet a list of collected boxes.
WalletApiWalletDeriveKeyPost /wallet/deriveKeyDerive new key according to a provided path
WalletApiWalletDeriveNextKeyGet /wallet/deriveNextKeyDerive next key
WalletApiWalletGetTransactionGet /wallet/transactionByIdGet wallet-related transaction by id
WalletApiWalletInitPost /wallet/initInitialize new wallet with randomly generated seed
WalletApiWalletLockGet /wallet/lockLock wallet
WalletApiWalletPaymentTransactionGenerateAndSendPost /wallet/payment/sendGenerate and send payment transaction (default fee of 0.001 Erg is used)
WalletApiWalletRescanGet /wallet/rescanRescan wallet (all the available full blocks)
WalletApiWalletRestorePost /wallet/restoreCreate new wallet from existing mnemonic seed
WalletApiWalletTransactionGeneratePost /wallet/transaction/generateGenerate arbitrary transaction from array of requests.
WalletApiWalletTransactionGenerateAndSendPost /wallet/transaction/sendGenerate and send arbitrary transaction
WalletApiWalletTransactionSignPost /wallet/transaction/signSign arbitrary unsigned transaction with wallet secrets and also secrets provided.
WalletApiWalletTransactionsGet /wallet/transactionsGet a list of all wallet-related transactions
WalletApiWalletTransactionsByScanIdGet /wallet/transactionsByScanId/{scanId}Get scan-related transactions by scan id
WalletApiWalletUnlockPost /wallet/unlockUnlock wallet
WalletApiWalletUnsignedTransactionGeneratePost /wallet/transaction/generateUnsignedGenerate unsigned transaction from array of requests.
WalletApiWalletUnspentBoxesGet /wallet/boxes/unspentGet a list of unspent boxes. Set minConfirmations to -1 to have mempool boxes considered.
WalletApiWalletUpdateChangeAddressPost /wallet/updateChangeAddressUpdate address to be used to send change to

Documentation For Models

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

[email protected]