Documentation
¶
Index ¶
- Variables
- func AddQuantities(quantity1 string, quantity2 string) string
- func DecryptWithCipher(encryptedDataJSON string, password string) (string, error)
- func EncryptWithCipher(data, key string, initializationVectorSize int) (string, error)
- func GetServerURL(projectID string) string
- func IsNetwork(value string) bool
- type AccountInfo
- type Asset
- type AssetMetadata
- type Assets
- type BlockInfo
- type BlockfrostProvider
- func (bf *BlockfrostProvider) FetchAddressUTxOs(address string, asset *string) ([]UTxO, error)
- func (bf *BlockfrostProvider) FetchTxInfo(hash string) (TransactionInfo, error)
- func (bf *BlockfrostProvider) FetchUTxOs(hash string, index *int) ([]UTxO, error)
- func (bf *BlockfrostProvider) SubmitTx(txCbor string) (string, error)
- type CipherData
- type HttpOgmiosProvider
- type IFetcher
- type IProvider
- type ISubmitter
- type Input
- type KupoProvider
- type MaestroProvider
- func (ms *MaestroProvider) FetchAddressUTxOs(address string, asset *string) ([]UTxO, error)
- func (ms *MaestroProvider) FetchTxInfo(hash string) (TransactionInfo, error)
- func (ms *MaestroProvider) FetchUTxOs(hash string, index *int) ([]UTxO, error)
- func (ms *MaestroProvider) SubmitTx(txCbor string) (string, error)
- type MsDatum
- type Network
- type OgmiosProvider
- type Output
- type Protocol
- type SubmitTxResult
- type TransactionInfo
- type UTxO
- func BfAddressUtxoToUtxo(bfUtxo blockfrost.AddressUTXO) UTxO
- func BfToUtxo(bfUtxo blockfrost.TransactionOutput, hash string) UTxO
- func BfToUtxos(bfUtxos []blockfrost.TransactionOutput, hash string) []UTxO
- func FindUtxoByIndex(utxos []UTxO, index int) *UTxO
- func MakeScriptUtxo(txHash string, outputIndex int, address string, amount []Asset, ...) UTxO
- func MsToUtxo(msUtxo msModel.Utxo) UTxO
- func MsToUtxos(msUtxos []msModel.Utxo) []UTxO
- type Value
- func (v *Value) AddAsset(asset *Asset) *Value
- func (v *Value) AddAssets(assets *[]Asset) *Value
- func (v *Value) Geq(other *Value) bool
- func (v *Value) Get(unit string) int64
- func (v *Value) IsEmpty() bool
- func (v *Value) Merge(values ...*Value) *Value
- func (v *Value) NegateAsset(asset *Asset) *Value
- func (v *Value) NegateAssets(assets *[]Asset) *Value
- func (v *Value) ToAssets() *[]Asset
- func (v *Value) Units() []string
Constants ¶
This section is empty.
Variables ¶
var NetworkMap = map[string]string{ "testnet": blockfrost.CardanoTestNet, "preview": blockfrost.CardanoPreview, "preprod": blockfrost.CardanoPreProd, "mainnet": blockfrost.CardanoMainNet, }
Functions ¶
func AddQuantities ¶
func DecryptWithCipher ¶ added in v0.2.2
func EncryptWithCipher ¶ added in v0.2.2
EncryptWithCipher encrypts data using PBKDF2 key derivation and AES-GCM
func GetServerURL ¶
Types ¶
type AccountInfo ¶
type Asset ¶
type Asset struct {
Unit string `json:"unit" binding:"required"`
Quantity string `json:"quantity" binding:"required"`
}
func BfAddressAmountsToAssets ¶ added in v0.3.2
func BfAddressAmountsToAssets(bfAmounts []blockfrost.AddressAmount) []Asset
func BfToAsset ¶
func BfToAsset(bfAsset blockfrost.TxAmount) Asset
func BfToAssets ¶
func BfToAssets(bfAssets []blockfrost.TxAmount) []Asset
func MsToAssets ¶
type AssetMetadata ¶
type AssetMetadata = map[string]interface{}
type Assets ¶
type Assets []Asset
func (*Assets) GetLovelace ¶
func (*Assets) MergeAssets ¶
func (*Assets) PopAssetByUnit ¶
type BlockfrostProvider ¶
type BlockfrostProvider struct {
// contains filtered or unexported fields
}
func NewBlockfrostProvider ¶
func NewBlockfrostProvider(projectID string) *BlockfrostProvider
func (*BlockfrostProvider) FetchAddressUTxOs ¶ added in v0.3.2
func (bf *BlockfrostProvider) FetchAddressUTxOs(address string, asset *string) ([]UTxO, error)
func (*BlockfrostProvider) FetchTxInfo ¶
func (bf *BlockfrostProvider) FetchTxInfo(hash string) (TransactionInfo, error)
func (*BlockfrostProvider) FetchUTxOs ¶
func (bf *BlockfrostProvider) FetchUTxOs(hash string, index *int) ([]UTxO, error)
type CipherData ¶ added in v0.2.2
CipherData represents the structure of encrypted data
type HttpOgmiosProvider ¶ added in v0.3.4
type HttpOgmiosProvider struct {
// contains filtered or unexported fields
}
type IFetcher ¶
type IFetcher interface {
// FetchAccountInfo(address string) (AccountInfo, error)
FetchAddressUTxOs(address string, asset *string) ([]UTxO, error)
// FetchAssetAddresses(asset string) ([]struct {
// Address string
// Quantity string
// }, error)
// FetchAssetMetadata(asset string) (AssetMetadata, error)
// FetchBlockInfo(hash string) (BlockInfo, error)
// FetchCollectionAssets(policyId string, cursor *interface{}) (struct {
// Assets Assets
// Next *interface{}
// }, error)
// FetchHandle(handle string) (map[string]interface{}, error)
// FetchHandleAddress(handle string) (string, error)
// FetchProtocolParameters(epoch int) (Protocol, error)
FetchTxInfo(hash string) (TransactionInfo, error)
FetchUTxOs(hash string, index *int) ([]UTxO, error)
}
TODO: interface add context params and respect context instead of using context.TODO()
type IProvider ¶
type IProvider interface {
IFetcher
ISubmitter
}
type ISubmitter ¶
func NewHttpOgmiosProvider ¶ added in v0.3.4
func NewHttpOgmiosProvider(baseUrl string) ISubmitter
func NewOgmiosProvider ¶ added in v0.3.4
func NewOgmiosProvider(baseUrl string, logger ogmigo.Logger) ISubmitter
type KupoProvider ¶ added in v0.3.4
type KupoProvider struct {
// contains filtered or unexported fields
}
func (*KupoProvider) FetchAddressUTxOs ¶ added in v0.3.4
func (kp *KupoProvider) FetchAddressUTxOs(address string, asset *string) ([]UTxO, error)
func (*KupoProvider) FetchTxInfo ¶ added in v0.3.4
func (kp *KupoProvider) FetchTxInfo(hash string) (TransactionInfo, error)
func (*KupoProvider) FetchUTxOs ¶ added in v0.3.4
func (kp *KupoProvider) FetchUTxOs(hash string, index *int) ([]UTxO, error)
type MaestroProvider ¶
type MaestroProvider struct {
// contains filtered or unexported fields
}
func NewMaestroProvider ¶
func NewMaestroProvider(apiKey string, network Network) *MaestroProvider
func (*MaestroProvider) FetchAddressUTxOs ¶ added in v0.3.3
func (ms *MaestroProvider) FetchAddressUTxOs(address string, asset *string) ([]UTxO, error)
TODO: implement FetchAddressUTxOs
func (*MaestroProvider) FetchTxInfo ¶
func (ms *MaestroProvider) FetchTxInfo(hash string) (TransactionInfo, error)
func (*MaestroProvider) FetchUTxOs ¶
func (ms *MaestroProvider) FetchUTxOs(hash string, index *int) ([]UTxO, error)
type OgmiosProvider ¶ added in v0.3.4
type Output ¶
type Output struct {
Address string `json:"address" binding:"required"`
Amount []Asset `json:"amount" binding:"required"`
DataHash string `json:"data_hash,omitempty"`
PlutusData string `json:"plutus_data,omitempty"`
ScriptRef string `json:"script_ref,omitempty"`
ScriptHash string `json:"script_hash,omitempty"`
}
type Protocol ¶
type Protocol struct {
Epoch int
MinFeeA int
MinFeeB int
MaxBlockSize int
MaxTxSize int
MaxBlockHeaderSize int
KeyDeposit int
PoolDeposit int
Decentralisation float64
MinPoolCost string
PriceMem float64
PriceStep float64
MaxTxExMem string
MaxTxExSteps string
MaxBlockExMem string
MaxBlockExSteps string
MaxValSize int
CollateralPercent int
MaxCollateralInputs int
CoinsPerUtxoSize int
MinFeeRefScriptCostPerByte int
}
type SubmitTxResult ¶ added in v0.3.4
type SubmitTxResult struct {
Transaction struct {
ID string `json:"id"`
} `json:"transaction"`
}
type TransactionInfo ¶
type UTxO ¶
type UTxO struct {
Input Input `json:"input" binding:"required"`
Output Output `json:"output" binding:"required"`
}
func BfAddressUtxoToUtxo ¶ added in v0.3.2
func BfAddressUtxoToUtxo(bfUtxo blockfrost.AddressUTXO) UTxO
func BfToUtxo ¶
func BfToUtxo(bfUtxo blockfrost.TransactionOutput, hash string) UTxO
func BfToUtxos ¶
func BfToUtxos(bfUtxos []blockfrost.TransactionOutput, hash string) []UTxO
func FindUtxoByIndex ¶
func MakeScriptUtxo ¶
type Value ¶
Value provide utility to handle the Cardano value manipulation. It offers certain axioms: 1. No duplication of asset - adding assets with same asset name will increase the quantity of the asset in the same record. 2. No zero and negative entry - the quantity of the asset should not be zero or negative. 3. Sanitization of lovelace asset name - the class handle back and forth conversion of lovelace asset name to empty string. 4. Easy convertion to Cardano data - offer utility to convert into either Mesh Data type and JSON type for its Cardano data representation.
func NewValueFromAssets ¶
NewValueFromAssets - create a new Value instance with the given assets.
func (*Value) Merge ¶
Merge - merge multiple Value class's value record into the current Value class's value record.
func (*Value) NegateAsset ¶
NegateAsset - deduct the value amount of an asset from the Value class's value record.
func (*Value) NegateAssets ¶
NegateAssets - deduct the value amount of multiple assets from the Value class's value record.