utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigFloatDiv

func BigFloatDiv(x *big.Float, y *big.Float) *big.Float

BigFloatDiv divides 2 big floats

func BigIntAdd

func BigIntAdd(x *big.Int, y *big.Int) *big.Int

BigIntAdd adds 2 big integers

func BigIntDiv

func BigIntDiv(x *big.Int, y *big.Int) *big.Int

BigIntDiv divides 2 big integers

func BigIntMul

func BigIntMul(x *big.Int, y *big.Int) *big.Int

BigIntMul multiplies 2 big integers

func BigIntSqrt

func BigIntSqrt(x *big.Int) *big.Int

BigIntSqrt returns ⌊√x⌋

func BigIntSub

func BigIntSub(x *big.Int, y *big.Int) *big.Int

BigIntSub subtracts 2 big integers

func EncodeValue

func EncodeValue(value any, valueType string) ([]byte, error)

EncodeVarInt encodes value to be used in program

func EncodeVarInt

func EncodeVarInt(number uint64) []byte

EncodeVarInt encodes 64-bit unsigned integer value

func ExcessAssetStateKey

func ExcessAssetStateKey(poolAddress string, assetID uint64) ([]byte, error)

ExcessAssetStateKey returns an excess key of the given asset id

func IntToBytes

func IntToBytes(n uint64) ([]byte, error)

IntToBytes convert int into 8-bit bytes

func OutstandingAssetStateKey

func OutstandingAssetStateKey(assetID uint64) ([]byte, error)

OutstandingAssetStateKey returns an outstanding key of the given asset id

func Program

func Program(definition types.Logic, variables map[string]uint64) ([]byte, error)

Program returns a program byte array to be used in LogicSig

func StateBytes

func StateBytes(state map[string]models.TealValue, key string) []byte

StateBytes returns bytes field from ApplicationLocalState local key-value mapping

func StateInt

func StateInt(state map[string]models.TealValue, key string) uint64

StateInt returns unsigned int field from ApplicationLocalState local key-value mapping

func ToBigFloat

func ToBigFloat(v uint64) *big.Float

ToBigFloat converts an unsigned 64-bit integer to big float

func ToBigUint

func ToBigUint(v uint64) *big.Int

ToBigUint converts an unsigned 64-bit integer to big integer

Types

type TransactionGroup

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

TransactionGroup is a group of transaction that can be executed atomically after signing

func NewTransactionGroup

func NewTransactionGroup(txs []types.Transaction) (*TransactionGroup, error)

NewTransactionGroup creates a new transaction group

func (*TransactionGroup) SetSignedTransactions added in v0.1.1

func (tg *TransactionGroup) SetSignedTransactions(index int, signedTx []byte) error

SetSignedTransactions sets a signed transaction at a given index

func (*TransactionGroup) Sign

func (tg *TransactionGroup) Sign(acc *crypto.Account) error

Sign signs a transaction group with an account

func (*TransactionGroup) SignWithLogicSig

func (tg *TransactionGroup) SignWithLogicSig(account *crypto.LogicSigAccount) error

SignWithLogicSig signs a transaction group with logic sig account

func (*TransactionGroup) SignWithPrivateKey added in v0.1.1

func (tg *TransactionGroup) SignWithPrivateKey(address string, sk ed25519.PrivateKey) error

SignWithPrivateKey signs a transaction group with a given private key if a given address matches

func (*TransactionGroup) SignedTransactions added in v0.1.1

func (tg *TransactionGroup) SignedTransactions() [][]byte

SignedTransactions returns signed transactions inside the transaction group

func (*TransactionGroup) Submit

func (tg *TransactionGroup) Submit(ctx context.Context, client *algod.Client, wait bool) (string, error)

Submit sends a signed transaction groups to the blockchain

func (*TransactionGroup) Transactions added in v0.1.1

func (tg *TransactionGroup) Transactions() []types.Transaction

Transactions returns transactions inside the transaction group

Jump to

Keyboard shortcuts

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