ww_stellar

package
v0.0.0-...-1305305 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERROR_GET_STELLAR_ASSET            = 1
	ERROR_INSUFFICIENT_BALANCE         = 2
	ERROR_MAP_STELLAR_ADDRESS          = 3
	ERROR_ACCOUNT_DOES_NOT_TRUST_ASSET = 4
	ERROR_ACCOUNT_TRUST_LIMIT_EXCEEDED = 5
	ERROR_TIMEOUT                      = 6
	ERROR_SIGNING_TRANSACTION          = 7
	ERROR_MAP_STELLAR_ASSET            = 8
	ERROR_SUBMIT_TRANSACTION           = 9
	ERROR_AMOUNT_LESSTHEN_EQUAL_ZERO   = 10
	ERROR_NO_ISSUER_INVOLVED           = 11
	ERROR_ASSET_DOES_NOT_EXIST         = 12
)
View Source
var LOGGER = logging.MustGetLogger("onboarding")

Functions

func AppendSignature

func AppendSignature(transactionSigned xdr.TransactionEnvelope, txeB *b.TransactionEnvelopeBuilder) error

AppendSignature : Append signature from signed xdr to another transactionEnvelopBuilder

Types

type Account

type Account struct {
	ParticipantID string
	Account       string
}

type Balance

type Balance struct {
	Amount     decimal.Decimal
	TrustLimit decimal.Decimal // Amount <= TrustLimit
}

func GetBalance

func GetBalance(account Account, asset model.Asset, prc PRClient, hc *horizon.Client) (Balance, error)

type CheckResult

type CheckResult struct {
	Error Error
}

CheckResult : go channel result checking

func CheckTrustline

func CheckTrustline(paymentAccount Account, paymentAsset model.Asset, paymentAmount decimal.Decimal, prc PRClient, hc *horizon.Client) CheckResult

CheckTrustline : Check if trustline is established

type CryptoClientGlobal

type CryptoClientGlobal interface {
	RequestSigning(txeBase64 string, requestBase64 string, signedRequestBase64 string, accountName string, participant model.Participant) (string, error)
}

type Error

type Error interface {
	error
	Code() int
	Msg() string
}

func SanityCheck

func SanityCheck(payments []Payment, prc PRClient, hc *horizon.Client) Error

SanityCheck : Sanity check for payment in the following context: 1. trustline exist 2. trustlimit does not exceed 3. sufficient balance

type OutstandingBalance

type OutstandingBalance struct {
	Account Account
	Balance Balance
}

outstanding balance of an asset, ie the the account which holds the asset and its respective account

func GetOutstandingBalances

func GetOutstandingBalances(asset model.Asset, prc PRClient, nhc hClient.ClientInterface) ([]OutstandingBalance, error)

GetOutstandingBalances : GetsOutstanding Balances for specific asset

type PRClient

type PRClient interface {
	GetParticipantAccount(domain string, account string) (string, error) // return participant account address'
	GetAllParticipants() ([]model.Participant, error)                    // return all participants
}

type Payment

type Payment struct {
	SourceAccount Account
	TargetAccount Account
	Asset         model.Asset
	Amount        decimal.Decimal
}

type StellarTransactionConstructor

type StellarTransactionConstructor struct {
	// contains filtered or unexported fields
}

func (*StellarTransactionConstructor) AddOperation

func (self *StellarTransactionConstructor) AddOperation(operation b.TransactionMutator) error

AddOperation : add operation to transaction

func (*StellarTransactionConstructor) AddPayment

func (self *StellarTransactionConstructor) AddPayment(payment Payment, prc PRClient) error

AddPayment : Add Payment operation to transaction envelop

func (*StellarTransactionConstructor) AddPaymentWithSanityCheck

func (self *StellarTransactionConstructor) AddPaymentWithSanityCheck(payment Payment, prc PRClient, hc *horizon.Client) error

AddPaymentWithSanityCheck : AddPaymentWithSanityCheck

func (*StellarTransactionConstructor) Base64

func (self *StellarTransactionConstructor) Base64() string

func (*StellarTransactionConstructor) Bytes

func (self *StellarTransactionConstructor) Bytes() []byte

func (*StellarTransactionConstructor) GetTxeB

func (*StellarTransactionConstructor) ImportTransaction

func (self *StellarTransactionConstructor) ImportTransaction(txe xdr.TransactionEnvelope)

stellar specific

func (*StellarTransactionConstructor) InitTransaction

InitTransaction : Init Transaction

func (*StellarTransactionConstructor) SendTransaction

SendTransaction : send transaction to Gas service

func (*StellarTransactionConstructor) SetFee

func (self *StellarTransactionConstructor) SetFee() error

func (*StellarTransactionConstructor) SetTimeBound

func (self *StellarTransactionConstructor) SetTimeBound(lowerbound, upperbound int64) error

Set time-bounds using quote expiry date

func (*StellarTransactionConstructor) SetTxeB

func (*StellarTransactionConstructor) SignTransactionAndAppend

func (self *StellarTransactionConstructor) SignTransactionAndAppend(account string, cc crypto_client.CryptoServiceClient) error

SignTransactionAndAppend : sign the transaction, should be called after the transaction is finalized

func (*StellarTransactionConstructor) SignTransactionGlobalAndAppend

func (self *StellarTransactionConstructor) SignTransactionGlobalAndAppend(account string, cc CryptoClientGlobal, participant model.Participant, requestBase64 string, signedRequestBase64 string) error

SignTransactionGlobalAndAppend : sign the transaction, should be called after the transaction is finalized for global micro service like quote service.

Jump to

Keyboard shortcuts

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