# Packages
# README
Go API client for alephium
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
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: 2.5.6
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import alephium "github.com/alephium/go-sdk"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), alephium.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), alephium.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), alephium.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), alephium.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to http://..
Class | Method | HTTP request | Description |
---|---|---|---|
AddressesApi | GetAddressesAddressBalance | Get /addresses/{address}/balance | Get the balance of an address |
AddressesApi | GetAddressesAddressGroup | Get /addresses/{address}/group | Get the group of an address |
AddressesApi | GetAddressesAddressUtxos | Get /addresses/{address}/utxos | Get the UTXOs of an address |
BlockflowApi | GetBlockflowBlocks | Get /blockflow/blocks | List blocks on the given time interval |
BlockflowApi | GetBlockflowBlocksBlockHash | Get /blockflow/blocks/{block_hash} | Get a block with hash |
BlockflowApi | GetBlockflowBlocksWithEvents | Get /blockflow/blocks-with-events | List blocks with events on the given time interval |
BlockflowApi | GetBlockflowBlocksWithEventsBlockHash | Get /blockflow/blocks-with-events/{block_hash} | Get a block and events with hash |
BlockflowApi | GetBlockflowChainInfo | Get /blockflow/chain-info | Get infos about the chain from the given groups |
BlockflowApi | GetBlockflowHashes | Get /blockflow/hashes | Get all block's hashes at given height for given groups |
BlockflowApi | GetBlockflowHeadersBlockHash | Get /blockflow/headers/{block_hash} | Get block header |
BlockflowApi | GetBlockflowIsBlockInMainChain | Get /blockflow/is-block-in-main-chain | Check if the block is in main chain |
ContractsApi | GetContractsAddressState | Get /contracts/{address}/state | Get contract state |
ContractsApi | PostContractsCallContract | Post /contracts/call-contract | Call contract |
ContractsApi | PostContractsCompileContract | Post /contracts/compile-contract | Compile a smart contract |
ContractsApi | PostContractsCompileProject | Post /contracts/compile-project | Compile a project |
ContractsApi | PostContractsCompileScript | Post /contracts/compile-script | Compile a script |
ContractsApi | PostContractsMulticallContract | Post /contracts/multicall-contract | Multiple call contract |
ContractsApi | PostContractsTestContract | Post /contracts/test-contract | Test contract |
ContractsApi | PostContractsUnsignedTxDeployContract | Post /contracts/unsigned-tx/deploy-contract | Build an unsigned contract |
ContractsApi | PostContractsUnsignedTxExecuteScript | Post /contracts/unsigned-tx/execute-script | Build an unsigned script |
EventsApi | GetEventsBlockHashBlockhash | Get /events/block-hash/{blockHash} | Get contract events for a block |
EventsApi | GetEventsContractContractaddress | Get /events/contract/{contractAddress} | Get events for a contract within a counter range |
EventsApi | GetEventsContractContractaddressCurrentCount | Get /events/contract/{contractAddress}/current-count | Get current value of the events counter for a contract |
EventsApi | GetEventsTxIdTxid | Get /events/tx-id/{txId} | Get contract events for a transaction |
InfosApi | GetInfosChainParams | Get /infos/chain-params | Get key params about your blockchain |
InfosApi | GetInfosCurrentDifficulty | Get /infos/current-difficulty | Get the average difficulty of the latest blocks from all shards |
InfosApi | GetInfosCurrentHashrate | Get /infos/current-hashrate | Get average hashrate from `now - timespan(millis)` to `now` |
InfosApi | GetInfosDiscoveredNeighbors | Get /infos/discovered-neighbors | Get discovered neighbors |
InfosApi | GetInfosHistoryHashrate | Get /infos/history-hashrate | Get history average hashrate on the given time interval |
InfosApi | GetInfosInterCliquePeerInfo | Get /infos/inter-clique-peer-info | Get infos about the inter cliques |
InfosApi | GetInfosMisbehaviors | Get /infos/misbehaviors | Get the misbehaviors of peers |
InfosApi | GetInfosNode | Get /infos/node | Get info about that node |
InfosApi | GetInfosSelfClique | Get /infos/self-clique | Get info about your own clique |
InfosApi | GetInfosUnreachable | Get /infos/unreachable | Get the unreachable brokers |
InfosApi | GetInfosVersion | Get /infos/version | Get version about that node |
InfosApi | PostInfosDiscovery | Post /infos/discovery | Set brokers to be unreachable/reachable |
InfosApi | PostInfosMisbehaviors | Post /infos/misbehaviors | Ban/Unban given peers |
MempoolApi | DeleteMempoolTransactions | Delete /mempool/transactions | Remove all transactions from mempool |
MempoolApi | GetMempoolTransactions | Get /mempool/transactions | List mempool transactions |
MempoolApi | PutMempoolTransactionsRebroadcast | Put /mempool/transactions/rebroadcast | Rebroadcase a mempool transaction to the network |
MempoolApi | PutMempoolTransactionsValidate | Put /mempool/transactions/validate | Validate all mempool transactions and remove invalid ones |
MinersApi | GetMinersAddresses | Get /miners/addresses | List miner's addresses |
MinersApi | GetWalletsWalletNameMinerAddresses | Get /wallets/{wallet_name}/miner-addresses | List all miner addresses per group |
MinersApi | PostMinersCpuMining | Post /miners/cpu-mining | Execute an action on CPU miner. !!! for test only !!! |
MinersApi | PostMinersCpuMiningMineOneBlock | Post /miners/cpu-mining/mine-one-block | Mine a block on CPU miner. !!! for test only !!! |
MinersApi | PostWalletsWalletNameDeriveNextMinerAddresses | Post /wallets/{wallet_name}/derive-next-miner-addresses | Derive your next miner addresses for each group |
MinersApi | PutMinersAddresses | Put /miners/addresses | Update miner's addresses, but better to use user.conf instead |
MultiSignatureApi | PostMultisigAddress | Post /multisig/address | Create the multisig address and unlock script |
MultiSignatureApi | PostMultisigBuild | Post /multisig/build | Build a multisig unsigned transaction |
MultiSignatureApi | PostMultisigSubmit | Post /multisig/submit | Submit a multi-signed transaction |
MultiSignatureApi | PostMultisigSweep | Post /multisig/sweep | Sweep all unlocked ALPH and token balances of a multisig address to another address |
TransactionsApi | GetTransactionsDetailsTxid | Get /transactions/details/{txId} | Get transaction details |
TransactionsApi | GetTransactionsStatus | Get /transactions/status | Get tx status |
TransactionsApi | PostTransactionsBuild | Post /transactions/build | Build an unsigned transaction to a number of recipients |
TransactionsApi | PostTransactionsDecodeUnsignedTx | Post /transactions/decode-unsigned-tx | Decode an unsigned transaction |
TransactionsApi | PostTransactionsSubmit | Post /transactions/submit | Submit a signed transaction |
TransactionsApi | PostTransactionsSweepAddressBuild | Post /transactions/sweep-address/build | Build unsigned transactions to send all unlocked ALPH and token balances of one address to another address |
UtilsApi | PostUtilsVerifySignature | Post /utils/verify-signature | Verify the SecP256K1 signature of some data |
UtilsApi | PutUtilsCheckHashIndexing | Put /utils/check-hash-indexing | Check and repair the indexing of block hashes |
WalletsApi | DeleteWalletsWalletName | Delete /wallets/{wallet_name} | Delete your wallet file (can be recovered with your mnemonic) |
WalletsApi | GetWallets | Get /wallets | List available wallets |
WalletsApi | GetWalletsWalletName | Get /wallets/{wallet_name} | Get wallet's status |
WalletsApi | GetWalletsWalletNameAddresses | Get /wallets/{wallet_name}/addresses | List all your wallet's addresses |
WalletsApi | GetWalletsWalletNameAddressesAddress | Get /wallets/{wallet_name}/addresses/{address} | Get address' info |
WalletsApi | GetWalletsWalletNameBalances | Get /wallets/{wallet_name}/balances | Get your total balance |
WalletsApi | PostWallets | Post /wallets | Create a new wallet |
WalletsApi | PostWalletsWalletNameChangeActiveAddress | Post /wallets/{wallet_name}/change-active-address | Choose the active address |
WalletsApi | PostWalletsWalletNameDeriveNextAddress | Post /wallets/{wallet_name}/derive-next-address | Derive your next address |
WalletsApi | PostWalletsWalletNameLock | Post /wallets/{wallet_name}/lock | Lock your wallet |
WalletsApi | PostWalletsWalletNameRevealMnemonic | Post /wallets/{wallet_name}/reveal-mnemonic | Reveal your mnemonic. !!! use it with caution !!! |
WalletsApi | PostWalletsWalletNameSign | Post /wallets/{wallet_name}/sign | Sign the given data and return back the signature |
WalletsApi | PostWalletsWalletNameSweepActiveAddress | Post /wallets/{wallet_name}/sweep-active-address | Transfer all unlocked ALPH from the active address to another address |
WalletsApi | PostWalletsWalletNameSweepAllAddresses | Post /wallets/{wallet_name}/sweep-all-addresses | Transfer unlocked ALPH from all addresses (including all mining addresses if applicable) to another address |
WalletsApi | PostWalletsWalletNameTransfer | Post /wallets/{wallet_name}/transfer | Transfer ALPH from the active address |
WalletsApi | PostWalletsWalletNameUnlock | Post /wallets/{wallet_name}/unlock | Unlock your wallet |
WalletsApi | PutWallets | Put /wallets | Restore a wallet from your mnemonic |
Documentation For Models
- AddressBalance
- AddressInfo
- Addresses
- AssetInput
- AssetOutput
- AssetState
- BadRequest
- Balance
- Balances
- Ban
- Banned
- BlockAndEvents
- BlockEntry
- BlockHeaderEntry
- BlocksAndEventsPerTimeStampRange
- BlocksPerTimeStampRange
- BrokerInfo
- BrokerInfoAddress
- BuildDeployContractTx
- BuildDeployContractTxResult
- BuildExecuteScriptTx
- BuildExecuteScriptTxResult
- BuildInfo
- BuildMultisig
- BuildMultisigAddress
- BuildMultisigAddressResult
- BuildSweepAddressTransactions
- BuildSweepAddressTransactionsResult
- BuildSweepMultisig
- BuildTransaction
- BuildTransactionResult
- CallContract
- CallContractFailed
- CallContractResult
- CallContractSucceeded
- ChainInfo
- ChainParams
- ChangeActiveAddress
- CompileContractResult
- CompileProjectResult
- CompileScriptResult
- CompilerOptions
- Confirmed
- Constant
- Contract
- ContractEvent
- ContractEventByBlockHash
- ContractEventByTxId
- ContractEvents
- ContractEventsByBlockHash
- ContractEventsByTxId
- ContractOutput
- ContractState
- DebugMessage
- DecodeUnsignedTx
- DecodeUnsignedTxResult
- Destination
- DiscoveryAction
- Enum
- EnumField
- EventSig
- FieldsSig
- FixedAssetOutput
- FunctionSig
- Group
- HashesAtHeight
- InterCliquePeerInfo
- InternalServerError
- MemPooled
- MempoolTransactions
- MinerAddresses
- MinerAddressesInfo
- MisbehaviorAction
- MultipleCallContract
- MultipleCallContractResult
- NodeInfo
- NodeVersion
- NotFound
- Output
- OutputRef
- PeerAddress
- PeerMisbehavior
- PeerStatus
- Penalty
- Project
- Reachable
- RevealMnemonic
- RevealMnemonicResult
- Script
- SelfClique
- ServiceUnavailable
- Sign
- SignResult
- SubmitMultisig
- SubmitTransaction
- SubmitTxResult
- Sweep
- SweepAddressTransaction
- TestContract
- TestContractResult
- TestInputAsset
- Token
- Transaction
- TransactionTemplate
- Transfer
- TransferResult
- TransferResults
- TxNotFound
- TxStatus
- UTXO
- UTXOs
- Unauthorized
- Unban
- Unreachable
- UnsignedTx
- Val
- ValAddress
- ValArray
- ValBool
- ValByteVec
- ValI256
- ValU256
- VerifySignature
- WalletCreation
- WalletCreationResult
- WalletDeletion
- WalletRestore
- WalletRestoreResult
- WalletStatus
- WalletUnlock
Documentation For Authorization
Endpoints do not require authorization.
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime