Skip to content

blinklabs-io/salvionied-apollo

 
 
apollo logo

Apollo: Pure Golang Cardano Building blocks

Pure Golang Cardano Serialization

The Objective of this library is to give Developers Access to each and every needed resource for cardano development. The final goal is to be able to have this library interact directly with the node without intermediaries.

Little Sample Usage:

package main

import (
    "encoding/hex"
    "fmt"

    "github.com/fxamacker/cbor/v2"
    "github.com/Salvionied/apollo"
    "github.com/Salvionied/apollo/txBuilding/Backend/BlockFrostChainContext"
    "github.com/Salvionied/apollo/constants"
)

func main() {
    bfc, err := BlockFrostChainContext.NewBlockfrostChainContext(constants.BLOCKFROST_BASE_URL_PREVIEW, int(constants.PREVIEW), "blockfrost_api_key")
    if err != nil {
        panic(err)
    }

    cc := apollo.NewEmptyBackend()
    SEED := "your mnemonic here"
    apollob := apollo.New(&cc)
    apollob, err = apollob.SetWalletFromMnemonic(SEED, constants.PREVIEW)
    if err != nil {
        panic(err)
    }
    apollob, err = apollob.SetWalletAsChangeAddress()
    if err != nil {
        panic(err)
    }
    utxos, err := bfc.Utxos(*apollob.GetWallet().GetAddress())
    if err != nil {
        panic(err)
    }
    apollob, err = apollob.AddLoadedUTxOs(utxos...).PayToAddressBech32("your address here", 1_000_000).
        Complete()
    if err != nil {
        panic(err)
    }
    apollob = apollob.Sign()
    tx := apollob.GetTx()
    cborred, err := cbor.Marshal(tx)
    if err != nil {
        panic(err)
    }
    fmt.Println(hex.EncodeToString(cborred))
    tx_id, err := bfc.SubmitTx(*tx)
    if err != nil {
		panic(err)
	}
    fmt.Println(hex.EncodeToString(tx_id.Payload))

}

If you have any questions or requests feel free to drop into this discord and ask :) https://discord.gg/MH4CmJcg49

By: Edoardo Salvioni - Zhaata

About

Cardano Pure Golang Building Blocks (Blink Labs' Version)

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Languages

  • Go 54.8%
  • HTML 45.2%