Documentation ¶
Index ¶
- Constants
- func NewBlockfrostBackend(projectId string, network constants.Network) (BlockFrostChainContext.BlockFrostChainContext, error)
- func NewEmptyBackend() FixedChainContext.FixedChainContext
- func NewMaestroBackend(projectId string, network constants.Network) (MaestroChainContext.MaestroChainContext, error)
- func SortInputs(inputs []UTxO.UTxO) []UTxO.UTxO
- func SortUtxos(utxos []UTxO.UTxO) []UTxO.UTxO
- type Apollo
- func (b *Apollo) AddCollateral(utxo UTxO.UTxO) *Apollo
- func (b *Apollo) AddDatum(pd *PlutusData.PlutusData) *Apollo
- func (b *Apollo) AddInput(utxos ...UTxO.UTxO) *Apollo
- func (b *Apollo) AddInputAddress(address Address.Address) *Apollo
- func (b *Apollo) AddInputAddressFromBech32(address string) *Apollo
- func (b *Apollo) AddLoadedUTxOs(utxos ...UTxO.UTxO) *Apollo
- func (b *Apollo) AddPayment(payment PaymentI) *Apollo
- func (b *Apollo) AddReferenceInput(txHash string, index int) *Apollo
- func (b *Apollo) AddRequiredSigner(pkh serialization.PubKeyHash) *Apollo
- func (b *Apollo) AddRequiredSignerFromAddress(address Address.Address, addPaymentPart, addStakingPart bool) *Apollo
- func (b *Apollo) AddRequiredSignerFromBech32(address string, addPaymentPart, addStakingPart bool) *Apollo
- func (b *Apollo) AddVerificationKeyWitness(vkw VerificationKeyWitness.VerificationKeyWitness) *Apollo
- func (b *Apollo) AddWithdrawal(address Address.Address, amount int, redeemerData PlutusData.PlutusData) *Apollo
- func (b *Apollo) AttachDatum(datum *PlutusData.PlutusData) *Apollo
- func (b *Apollo) AttachV1Script(script PlutusData.PlutusV1Script) *Apollo
- func (b *Apollo) AttachV2Script(script PlutusData.PlutusV2Script) *Apollo
- func (b *Apollo) Clone() *Apollo
- func (b *Apollo) CollectFrom(inputUtxo UTxO.UTxO, redeemer Redeemer.Redeemer) *Apollo
- func (b *Apollo) Complete() (*Apollo, error)
- func (b *Apollo) CompleteExact(fee int) (*Apollo, error)
- func (b *Apollo) ConsumeAssetsFromUtxo(utxo UTxO.UTxO, payments ...PaymentI) *Apollo
- func (b *Apollo) ConsumeUTxO(utxo UTxO.UTxO, payments ...PaymentI) *Apollo
- func (b *Apollo) DisableExecutionUnitsEstimation() *Apollo
- func (b *Apollo) GetBurns() (burns Value.Value)
- func (b *Apollo) GetTx() *Transaction.Transaction
- func (b *Apollo) GetUsedUTxOs() []string
- func (b *Apollo) GetWallet() apollotypes.Wallet
- func (b *Apollo) LoadTxCbor(txCbor string) (*Apollo, error)
- func (b *Apollo) MintAssets(mintUnit Unit) *Apollo
- func (b *Apollo) MintAssetsWithRedeemer(mintUnit Unit, redeemer Redeemer.Redeemer) *Apollo
- func (b *Apollo) PayToAddress(address Address.Address, lovelace int, units ...Unit) *Apollo
- func (b *Apollo) PayToAddressBech32(address string, lovelace int, units ...Unit) *Apollo
- func (b *Apollo) PayToContract(contractAddress Address.Address, pd *PlutusData.PlutusData, lovelace int, ...) *Apollo
- func (b *Apollo) SetChangeAddress(address Address.Address) *Apollo
- func (b *Apollo) SetChangeAddressBech32(address string) *Apollo
- func (b *Apollo) SetEstimationExUnitsRequired() *Apollo
- func (b *Apollo) SetFeePadding(padding int64) *Apollo
- func (b *Apollo) SetShelleyMetadata(metadata Metadata.ShelleyMaryMetadata) *Apollo
- func (b *Apollo) SetTtl(ttl int64) *Apollo
- func (b *Apollo) SetValidityStart(invalidBefore int64) *Apollo
- func (b *Apollo) SetWalletAsChangeAddress() *Apollo
- func (a *Apollo) SetWalletFromBech32(address string) *Apollo
- func (a *Apollo) SetWalletFromKeypair(vkey string, skey string, network constants.Network) *Apollo
- func (a *Apollo) SetWalletFromMnemonic(mnemonic string) (*Apollo, error)
- func (b *Apollo) Sign() *Apollo
- func (b *Apollo) SignWithSkey(vkey Key.VerificationKey, skey Key.SigningKey) (*Apollo, error)
- func (b *Apollo) Submit() (serialization.TransactionId, error)
- func (b *Apollo) UtxoFromRef(txHash string, txIndex int) *UTxO.UTxO
- type Payment
- type PaymentI
- type Unit
Constants ¶
const ( EX_MEMORY_BUFFER = 0.2 EX_STEP_BUFFER = 0.2 )
Variables ¶
This section is empty.
Functions ¶
func NewBlockfrostBackend ¶
func NewBlockfrostBackend( projectId string, network constants.Network, ) (BlockFrostChainContext.BlockFrostChainContext, error)
*
NewBlockfrostBackend creates a BlockFrostChainContext instance based on the specified network and project ID. Params: projectId (string): The project ID to authenticate with BlockFrost. network (Network): The network to configure the BlockFrost context for. Returns: BlockFrostChainContext.BlockFrostChainContext: A BlockFrostChainContext instance configured for the specified network.
func NewEmptyBackend ¶ added in v1.0.3
func NewEmptyBackend() FixedChainContext.FixedChainContext
* NewEmptyBackend creates and returns an empty FixedChainContext instance, which is iused for cases where no specific backend context is required.
Returns:
FixedChainContext.FixedChainContext: An empty FixedChainContext instance.
func NewMaestroBackend ¶ added in v1.0.12
func NewMaestroBackend( projectId string, network constants.Network, ) (MaestroChainContext.MaestroChainContext, error)
NewMaestroBackend NewMaestroBackend creates a MaestroChainContext instance based on the specified network and project ID. Params: projectId (string): The project ID to authenticate with Maestro. network (Network): The network to configure the Maestro context for. Returns: MaestroChainContext.MaestroChainContext: A MaestroChainContext instance configured for the specified network.
func SortInputs ¶ added in v1.0.3
*
SortInputs sorts a slice of UTxO objects based on their strings. Params: inputs ([]UTxO.UTxO): A slice of UTxO objects to be sorted. Returns: []UTxO.UTxO: A new slice of UTxO objects sorted based on input strings.
Types ¶
type Apollo ¶
type Apollo struct { Context Base.ChainContext Fee int64 FeePadding int64 Ttl int64 ValidityStart int64 // contains filtered or unexported fields }
func New ¶
func New(cc Base.ChainContext) *Apollo
*
New creates and initializes a new Apollo instance with the specified chain context, in which sets up various internal data structures for building and handling transactions. Params: cc (Base.ChainContext): The chain context to use for transaction building. Returns: *Apollo: A pointer to the initialized Apollo instance.
func (*Apollo) AddCollateral ¶ added in v1.0.5
func (*Apollo) AddDatum ¶ added in v1.0.3
func (b *Apollo) AddDatum(pd *PlutusData.PlutusData) *Apollo
*
AddDatum appends a Plutus datum to the list of data associated with the Apollo instance. Params: pd (*PlutusData.PlutusData): The Plutus datum to be added. Returns: *Apollo: A pointer to the modified Apollo instance with the datum added.
func (*Apollo) AddInput ¶ added in v1.0.3
*
AddInput appends one or more UTxOs to the list of preselected UTxOs for transaction inputs. Params: utxos (...UTxO.UTxO): A set of UTxOs to be added as inputs. Returns: *Apollo: A pointer to the modified Apollo instance.
func (*Apollo) AddInputAddress ¶ added in v1.0.3
*
AddInputAddress appends an input address to the list of input addresses for the transaction. Params: address (Address.Address): The input address to be added. Returns: *Apollo: A pointer to the modified Apollo instance.
func (*Apollo) AddInputAddressFromBech32 ¶ added in v1.0.3
*
AddInputAddressFromBech32 decodes a Bech32 address and appends it to the list of input addresses for the transaction. Params: address (string): The Bech32 address to be decoded and added Returns: *Apollo: A pointer to the modified Apollo instance.
func (*Apollo) AddLoadedUTxOs ¶ added in v1.0.3
*
AddLoadedUTxOs appends one or more UTxOs to the list of loaded UTxOs. Params: utxos (...UTxO.UTxO): A set of UTxOs to be added to the loaded UTxOs. Returns: *Apollo: A pointer to the modified Apollo instance.
func (*Apollo) AddPayment ¶ added in v1.0.3
*
AddPayment appends a payment to the list of payments for the transaction. Params: payment (PaymentI): The payment to be added. Returns: *Apollo: A pointer to the modified Apollo instance with the payment added.
func (*Apollo) AddReferenceInput ¶ added in v1.0.3
*
AddReferenceInput adds a reference input to the transaction. Params: txHash (string): The hexadecimal representation of the reference transaction hash. index (int): The index of the reference input within its transaction. Returns: *Apollo: A pointer to the modified Apollo instance with the added reference input.
func (*Apollo) AddRequiredSigner ¶ added in v1.0.3
func (b *Apollo) AddRequiredSigner(pkh serialization.PubKeyHash) *Apollo
*
AddRequiredSigner appends a public key hash to the list of required signers. Params: pkh (serialization.PubKeyHash): The public key hash to add as a required signer. Returns: *Apollo: A pointer to the modified Apollo instance with the required signer added.
func (*Apollo) AddRequiredSignerFromAddress ¶ added in v1.0.3
func (b *Apollo) AddRequiredSignerFromAddress(address Address.Address, addPaymentPart, addStakingPart bool) *Apollo
*
AddRequiredSignerFromAddress extracts the payment and staking parts from an address and adds them as required signers. Params: address (Address.Address): The address from which to extract the parts and add them as required signers. addPaymentPart (bool): Indicates whether to add the payment part as a required signer. addStakingPart (bool): Indicates whether to add the staking part as a required signer. Returns: *Apollo: A pointer to the modified Apollo instance with the required signers added.
func (*Apollo) AddRequiredSignerFromBech32 ¶ added in v1.0.3
func (b *Apollo) AddRequiredSignerFromBech32(address string, addPaymentPart, addStakingPart bool) *Apollo
*
AddRequiredSignerFromBech32 decodes an address in Bech32 format and adds its payment and staking parts as required signers. Params: address (string): The Bech32-encoded address to decode and add its parts as required signers. addPaymentPart (bool): Indicates whether to add the payment part as a required signer. addStakingPart (bool): Indicates whether to add the staking part as a required signer. Returns: *Apollo: A pointer to the modified Apollo instance with the required signers added.
func (*Apollo) AddVerificationKeyWitness ¶ added in v1.0.3
func (b *Apollo) AddVerificationKeyWitness(vkw VerificationKeyWitness.VerificationKeyWitness) *Apollo
*
AddVerificationKeyWitness adds a verification key witness to the transaction. Params: vkw (VerificationKeyWitness.VerificationKeyWitness): The verification key witness to add. Returns: *Apollo: A pointer to the modified Apollo instance with the added verification key witness.
func (*Apollo) AddWithdrawal ¶ added in v1.0.5
func (b *Apollo) AddWithdrawal(address Address.Address, amount int, redeemerData PlutusData.PlutusData) *Apollo
func (*Apollo) AttachDatum ¶ added in v1.0.3
func (b *Apollo) AttachDatum(datum *PlutusData.PlutusData) *Apollo
*
AttachDatum attaches a datum to the transaction. Params: datum *PlutusData.PlutusData: The datum to attach. Returns: *Apollo: A pointer to the Apollo object with the datum added.
func (*Apollo) AttachV1Script ¶ added in v1.0.3
func (b *Apollo) AttachV1Script(script PlutusData.PlutusV1Script) *Apollo
*
Attach a Plutus V1 script to the Apollo transaction. Params: script: The Plutus V1 script to attach. Returns: *Apollo: A pointer to the Apollo objecy with the attached script.
func (*Apollo) AttachV2Script ¶ added in v1.0.3
func (b *Apollo) AttachV2Script(script PlutusData.PlutusV2Script) *Apollo
*
Attach a Plutus V2 script to the Apollo transaction. Params: script: The Plutus V2 script to attach. Returns: *Apollo: A pointer to the Apollo objecy with the attached script.
func (*Apollo) Clone ¶ added in v1.0.3
*
Clone creates a deep copy of the Apollo object. Returns: *Apollo: A pointer to the cloned Apollo object.
func (*Apollo) CollectFrom ¶ added in v1.0.3
*
Collect a UTXO and its associated redeemer for inclusion in the transaction. Params: inputUtxo: The UTXO to collect. redeemer: The redeemer associated with the UTXO. Returns: *Apollo: A pointer to the Apollo object with the collected UTXO and redeemer.
func (*Apollo) Complete ¶ added in v1.0.3
*
Complete assembles and finalizes the Apollo transaction, handling inputs, change, fees, collateral and witness data. Returns: *Apollo: A pointer to the Apollo object representing the completed transaction. error: An error if any issues are encountered during the process.
func (*Apollo) CompleteExact ¶ added in v1.0.10
func (*Apollo) ConsumeAssetsFromUtxo ¶ added in v1.0.3
*
ConsumeAssetsFromUtxo adds a UTxO as an input to the transaction and deducts the specified asset payments from it. Params: utxo (UTxO.UTxO): The UTxO to be consumed as an input. payments (...PaymentI): Asset payments to be deducted from the UTxO. Returns: *Apollo: A pointer to the modified Apollo instance.
func (*Apollo) ConsumeUTxO ¶ added in v1.0.3
*
ConsumeUTxO adds a UTxO as an input to the transaction and deducts the specified payments from it. Params: utxo (UTxO.UTxO): The UTxO to be consumed as an input. payments (...PaymentI): A sett of payments to be deducted from the UTxO. Returns: *Apollo: A pointer to the modified Apollo instance.
func (*Apollo) DisableExecutionUnitsEstimation ¶ added in v1.0.3
*
DisableExecutionUnitsEstimation disables the estimation of execution units for the transaction. Returns: *Apollo: A pointer to the modified Apollo instance with execution units estimation disabled.
func (*Apollo) GetTx ¶ added in v1.0.3
func (b *Apollo) GetTx() *Transaction.Transaction
*
GetTx returns the transaction associated with the Apollo object. Returns: *Transacction.Transaction: A pointer to the transaction.
func (*Apollo) GetUsedUTxOs ¶ added in v1.0.3
*
GetUsedUTxOs returns the list of used UTxOs in the transaction. Returns: []string: The list of used UTxOs as strings.
func (*Apollo) GetWallet ¶ added in v1.0.3
func (b *Apollo) GetWallet() apollotypes.Wallet
*
GetWallet returns the wallet associated with the Apollo instance. Returns: apollotypes.Wallet: The wallet associated with the Apollo instance.
func (*Apollo) LoadTxCbor ¶ added in v1.0.3
*
LoadTxCbor loads a transaction from its CBOR representation and updates the apollo instances. Params: txCbor (string): The CBOR-encoded representation of the transaction. Returns: *Apollo: A pointer to the modified Apollo instance with the loaded transaction. error: An error, if any, encountered during loading.
func (*Apollo) MintAssets ¶ added in v1.0.3
*
MintAssets adds a minting unit to the transaction's minting set. Params: mintUnit Unit: The minting unit to add. Returns: *Apollo: A pointer to the Apollo object to support method chaining.
func (*Apollo) MintAssetsWithRedeemer ¶ added in v1.0.3
*
MintAssetsWithRedeemer adds a minting unit with an associated redeemer to the transaction's minting set. Params: mintUnit Unit: The minting unit to add. redeemer Redeemer.Redeemer: The redeemer associated with the minting unit. Returns: *Apollo: A pointer to the Apollo object with the minting unit added.
func (*Apollo) PayToAddress ¶ added in v1.0.3
*
PayToAddress creates a payment to the specified address with the given lovelace and units, then adds it to the list of payment. Params: address (Address.Address): The recipient's address for the payment. lovelace (int): The amount in lovelace to send in the payment. units (...Unit): A set of units to include in the payment. Returns: *Apollo: A pointer to the modified Apollo instance with the payment added.
func (*Apollo) PayToAddressBech32 ¶ added in v1.0.3
*
PayToAddressBech32 creates a payment to the specified Bech32 address with the given lovelace and units. Params: address (string): The Bech32 address to which the payment will be made. lovelace (int): The amount in lovelace to be paid. units (...Unit): The units (assets) to be paid along with the lovelace. Returns: *Apollo: A pointer to the modified Apollo instance with the payment added.
func (*Apollo) PayToContract ¶ added in v1.0.3
func (b *Apollo) PayToContract(contractAddress Address.Address, pd *PlutusData.PlutusData, lovelace int, isInline bool, units ...Unit) *Apollo
*
PayToContract creates a payment to a smart contract address and includes a Plutus datum, which is added to the list of payments, and if a datum is provided, it is added to the data list. Params: contractAddress (Address.Address): The smart contract address to send the payment to. pd (*PlutusData.PlutusData): Plutus datum to include in the payment. lovelace (int): The amount in lovelace to send in the payment. isInline (bool): Indicates if the payment is inline with the datum. units (...Unit): A set of units to include in the payment. Returns: *Apollo: A pointer to the modified Apollo instance with the payment and datum added.
func (*Apollo) SetChangeAddress ¶ added in v1.0.3
*
SetChangeAddress sets the change address for the transaction using an Address object. Params: address (Address.Address): The Address object to set as the change address. Returns: *Apollo: A pointer to the modified Apollo instance with the change address set.
func (*Apollo) SetChangeAddressBech32 ¶ added in v1.0.3
*
SetChangeAddressBech32 sets the change address for the transaction using a Bech32-encoded address. Params: address (string): The Bech32-encoded address to set as the change address. Returns: *Apollo: A pointer to the modified Apollo instance with the change address set.
func (*Apollo) SetEstimationExUnitsRequired ¶ added in v1.0.3
*
SetEstimationExUnitsRequired enables the estimation of execution units for the transaction. Returns: *Apollo: A pointer to the modified Apollo instance with execution units estimation enabled.
func (*Apollo) SetFeePadding ¶ added in v1.0.5
func (*Apollo) SetShelleyMetadata ¶ added in v1.0.3
func (b *Apollo) SetShelleyMetadata(metadata Metadata.ShelleyMaryMetadata) *Apollo
*
SetShelleyMetadata function sets the Shelley Mary metadata for the transaction's auxiliary data. Params: metadata (Metadata.ShelleyMaryMetadata): The Shelley Mary metadat to set. Returns: *Apollo: A pointer to the modified Apollo instance with the Shelley Mary metadata set.
func (*Apollo) SetTtl ¶ added in v1.0.3
*
SetTtl function sets the time-to-live (TTL) for the transaction. Params: ttl (int64): The TTL value to set fro the transaction. Returns: *Apollo: A pointer to the modified Apollo instance with the TTl set.
func (*Apollo) SetValidityStart ¶ added in v1.0.3
*
SetValidityStart function sets the validity start for the transaction. Params: invalidBefore (int64): The validity start value to set for the transaction. Returns: *Apollo: A pointer to the modified Apollo instance with the validity start set.
func (*Apollo) SetWalletAsChangeAddress ¶ added in v1.0.3
*
Set the wallet as the change address for the Apollo transaction. Returns: *Apollo: A pointer to the Apollo object with the wallet set as the change address.
func (*Apollo) SetWalletFromBech32 ¶ added in v1.0.3
*
Set the wallet for the Apollo transaction using a Bech32 address. Params: address: The Bech32 address to use as the wallet. Returns: *Apollo: A pointer to the Apollo object with the wallet set.
func (*Apollo) SetWalletFromKeypair ¶ added in v1.0.5
For use with key pairs generated by cardano-cli
func (*Apollo) SetWalletFromMnemonic ¶
func (*Apollo) Sign ¶ added in v1.0.3
*
Sign the Apollo transaction using the wallet's keys. Returns: *Apollo: A pointer to the Apollo object with the transaction signed.
func (*Apollo) SignWithSkey ¶ added in v1.0.3
func (b *Apollo) SignWithSkey(vkey Key.VerificationKey, skey Key.SigningKey) (*Apollo, error)
*
Sign the Apollo transaction with the given verification key and signing key. Parameters: vkey: The verification key to sign with. skey: The signing key to sign with. Returns: *Apollo: A pointer to the Apollo object with the transaction signed. error: An error if the signing fails.
func (*Apollo) Submit ¶ added in v1.0.3
func (b *Apollo) Submit() (serialization.TransactionId, error)
*
Submit function submits the constructed transaction to the blockchain network using the associated chain context. Returns: serialization.TransactionId: The ID of the submitted transaction. error: An error, if any, encountered during transaction submission.
func (*Apollo) UtxoFromRef ¶ added in v1.0.3
*
UtxoFromRef retrieves a UTxO (Unspent Transaction Output) given its transaction hash and index. Params: txHash (string): The hexadecimal representation of the transaction hash. txIndex (int): The index of the UTxO within the transaction's outputs. Returns: *UTxO.UTxO: A pointer to the retrieved UTxO, or nil if not found.
type Payment ¶ added in v1.0.3
type Payment struct { Lovelace int Receiver Address.Address Units []Unit Datum *PlutusData.PlutusData DatumHash []byte IsInline bool }
func NewPayment ¶ added in v1.0.3
*
NewPayment creates a new Payment object. Params: receiver (string): The receiver's address. lovelace (int): The amount in Lovelace. units ([]Unit): The assets units to be included. Returns: *Payment: The newly created Payment object.
func NewPaymentFromValue ¶ added in v1.0.3
*
NewPaymentFromValue creates a new Payment object from an Address and Value object. Params: receiver (Address.Address): The receiver's address. value (Value.Value): The value object containing payment details. Returns: *Payment: The newly created Payment object.
func PaymentFromTxOut ¶ added in v1.0.3
func PaymentFromTxOut(txOut *TransactionOutput.TransactionOutput) *Payment
*
PaymentFromTxOut creates a Payment object from a TransactionOutput. Params: txOut (*TransactionOutput.TransactionOutput): The TransactionOutput to create the Payment. Returns: *Payment: The created Payment object.
func (*Payment) EnsureMinUTXO ¶ added in v1.0.3
func (p *Payment) EnsureMinUTXO(cc Base.ChainContext)
*
EnsureMinUTXO ensures that the payment amount meets the minimun UTXO requirement. Params: cc (Base.ChainContext): The chain context.
func (*Payment) ToTxOut ¶ added in v1.0.3
func (p *Payment) ToTxOut() *TransactionOutput.TransactionOutput
*
ToTxOut converts a Payment object to a TransactionOutput object. Returns: *TransactionOutput.TransactionOutput: The created TransactionOutput object.
type PaymentI ¶ added in v1.0.3
type PaymentI interface { EnsureMinUTXO(cc Base.ChainContext) ToTxOut() *TransactionOutput.TransactionOutput ToValue() Value.Value }