chains

package
v0.0.1-gowrapper-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultStellarPassphrase is the default network passphrase for mainnet
	DefaultStellarPassphrase = "Public Global Stellar Network ; September 2015"

	// DefaultStellarFee is the default fee in stroops (0.00001 XLM)
	DefaultStellarFee = 100

	// Memo types supported by Stellar
	MemoTypeVoid = "void"
	MemoTypeText = "text"
	MemoTypeID   = "id"
	MemoTypeHash = "hash"
)

Constants for Stellar configuration

Variables

This section is empty.

Functions

This section is empty.

Types

type StellarAsset

type StellarAsset struct {
	Type   string
	Code   string
	Issuer string
}

func NewStellarAsset

func NewStellarAsset(assetType, code, issuer string) *StellarAsset

func (*StellarAsset) ToProtoAsset

func (a *StellarAsset) ToProtoAsset() *stellar.Asset

type StellarChain

type StellarChain struct {
	*chain_abstraction.BaseChain
}

StellarChain implements the Chain interface for Stellar

func NewStellarChain

func NewStellarChain() *StellarChain

NewStellarChain creates a new Stellar chain instance

func (*StellarChain) BuildSigningInput

func (s *StellarChain) BuildSigningInput(
	sourceAccount string,
	sequence int64,
	fee int32,
	passphrase string,
	destination string,
	amount int64,
	asset *stellar.Asset,
	memoType string,
	memoValue interface{},
) (*stellar.SigningInput, error)

BuildSigningInput creates a Stellar signing input for payment operations

func (*StellarChain) BuildSigningInputFromRequest

func (s *StellarChain) BuildSigningInputFromRequest(request *StellarPaymentRequest) (*stellar.SigningInput, error)

BuildSigningInputFromRequest creates a Stellar signing input from a payment request

func (*StellarChain) CompileTransaction

func (s *StellarChain) CompileTransaction(
	input *chain_abstraction.TransactionInput,
	signatures [][]byte,
	publicKeys [][]byte,
) ([]byte, error)

CompileTransaction compiles a Stellar transaction with signatures

func (*StellarChain) CreateAndSignTransaction

func (s *StellarChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)

CreateAndSignTransaction creates and signs a Stellar transaction

func (*StellarChain) GetPreimageHash

func (s *StellarChain) GetPreimageHash(input *chain_abstraction.TransactionInput) ([]byte, []byte, error)

GetPreimageHash gets the preimage hash for external signing

func (*StellarChain) GetPublicKeyFromPrivateKey

func (s *StellarChain) GetPublicKeyFromPrivateKey(privateKey []byte) ([]byte, error)

GetPublicKeyFromPrivateKey derives the public key from a private key

func (*StellarChain) GetTransactionHash

func (s *StellarChain) GetTransactionHash(encodedTx []byte) (string, error)

GetTransactionHash gets the transaction hash

func (*StellarChain) PrepareTransaction

func (s *StellarChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)

PrepareTransaction prepares a Stellar transaction for external signing

func (*StellarChain) Sign

func (s *StellarChain) Sign(preimage []byte, privateKey []byte) ([]byte, error)

Sign signs a preimage with a private key

func (*StellarChain) ValidateTransactionInput

func (s *StellarChain) ValidateTransactionInput(input interface{}) error

ValidateTransactionInput validates Stellar transaction input

type StellarConfig

type StellarConfig struct {
	Passphrase string
	Fee        int32
	TimeBounds int64
}

StellarConfig holds configuration for Stellar operations

func NewStellarConfig

func NewStellarConfig() *StellarConfig

func (*StellarConfig) WithFee

func (c *StellarConfig) WithFee(fee int32) *StellarConfig

func (*StellarConfig) WithPassphrase

func (c *StellarConfig) WithPassphrase(passphrase string) *StellarConfig

func (*StellarConfig) WithTimeBounds

func (c *StellarConfig) WithTimeBounds(timeBounds int64) *StellarConfig

type StellarMemo

type StellarMemo struct {
	Type  string
	Value interface{}
}

func NewStellarMemo

func NewStellarMemo(memoType string, value interface{}) *StellarMemo

type StellarPaymentRequest

type StellarPaymentRequest struct {
	SourceAccount string
	Destination   string
	Amount        int64
	Asset         *stellar.Asset
	Sequence      int64
	Fee           int32
	Passphrase    string
	MemoType      string
	MemoValue     interface{}
}

func NewStellarPaymentRequest

func NewStellarPaymentRequest(sourceAccount, destination string, amount int64) *StellarPaymentRequest

func (*StellarPaymentRequest) WithAsset

func (*StellarPaymentRequest) WithFee

func (*StellarPaymentRequest) WithMemo

func (r *StellarPaymentRequest) WithMemo(memoType string, memoValue interface{}) *StellarPaymentRequest

func (*StellarPaymentRequest) WithPassphrase

func (r *StellarPaymentRequest) WithPassphrase(passphrase string) *StellarPaymentRequest

func (*StellarPaymentRequest) WithSequence

func (r *StellarPaymentRequest) WithSequence(sequence int64) *StellarPaymentRequest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL