transaction

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KreAppIndex = 268
)

Variables

View Source
var (
	ErrNoAvailableNonces = errors.New("no available nonces")
)

Functions

func GetTipMemoValue added in v1.10.0

func GetTipMemoValue(platform transactionpb.TippedUser_Platform, username string) (string, error)

GetTipMemoValue gets the string value provided in a memo for tips

func MakeCloseAccountWithBalanceTransaction

func MakeCloseAccountWithBalanceTransaction(
	nonce *common.Account,
	bh solana.Blockhash,

	source *common.TimelockAccounts,
	destination *common.Account,

	additionalMemo *string,
) (solana.Transaction, error)

func MakeCloseEmptyAccountTransaction

func MakeCloseEmptyAccountTransaction(
	nonce *common.Account,
	bh solana.Blockhash,
	timelockAccounts *common.TimelockAccounts,
) (solana.Transaction, error)

func MakeKreMemoInstruction

func MakeKreMemoInstruction() (solana.Instruction, error)

MakeKreMemoInstruction makes the KRE memo instruction required for KRE payouts

todo: Deprecate this with KRE gone

func MakeNoncedTransaction

func MakeNoncedTransaction(nonce *common.Account, bh solana.Blockhash, instructions ...solana.Instruction) (solana.Transaction, error)

MakeNoncedTransaction makes a transaction that's backed by a nonce. The returned transaction is not signed.

func MakeOpenAccountTransaction

func MakeOpenAccountTransaction(
	nonce *common.Account,
	bh solana.Blockhash,

	timelockAccounts *common.TimelockAccounts,
) (solana.Transaction, error)

func MakeTransferWithAuthorityTransaction

func MakeTransferWithAuthorityTransaction(
	nonce *common.Account,
	bh solana.Blockhash,

	source *common.TimelockAccounts,
	destination *common.Account,
	kinAmountInQuarks uint64,
) (solana.Transaction, error)

func MakeTreasuryAdvanceTransaction

func MakeTreasuryAdvanceTransaction(
	nonce *common.Account,
	bh solana.Blockhash,

	treasuryPool *common.Account,
	treasuryPoolVault *common.Account,
	destination *common.Account,
	commitment *common.Account,
	treasuryPoolBump uint8,
	kinAmountInQuarks uint64,
	transcript []byte,
	recentRoot []byte,
) (solana.Transaction, error)

Types

type SelectedNonce

type SelectedNonce struct {
	Account   *common.Account
	Blockhash solana.Blockhash
	// contains filtered or unexported fields
}

SelectedNonce is a nonce that is available and selected for use in a transaction. Implementations should unlock the lock after using the nonce. If used, its state must be updated as reserved.

func SelectAvailableNonce

func SelectAvailableNonce(ctx context.Context, data code_data.Provider, useCase nonce.Purpose) (*SelectedNonce, error)

SelectAvailableNonce selects an available from the nonce pool for the specified use case. The returned nonce is marked as reserved without a signature, so it cannot be selected again. It's the responsibility of the external caller to make it available again if it doesn't get assigned a fulfillment.

func SelectNonceFromFulfillmentToUpgrade

func SelectNonceFromFulfillmentToUpgrade(ctx context.Context, data code_data.Provider, fulfillmentRecord *fulfillment.Record) (*SelectedNonce, error)

SelectNonceFromFulfillmentToUpgrade selects a nonce from a fulfillment that is going to be upgraded.

func (*SelectedNonce) MarkReservedWithSignature

func (n *SelectedNonce) MarkReservedWithSignature(ctx context.Context, sig string) error

MarkReservedWithSignature marks the nonce as reserved with a signature

func (*SelectedNonce) ReleaseIfNotReserved

func (n *SelectedNonce) ReleaseIfNotReserved() error

ReleaseIfNotReserved makes a nonce available if it hasn't been reserved with a signature. It's recommended to call this in tandem with Unlock when the caller knows it's safe to go from the reserved to available state (ie. don't use this in uprade flows!).

func (*SelectedNonce) Unlock

func (n *SelectedNonce) Unlock()

func (*SelectedNonce) UpdateSignature

func (n *SelectedNonce) UpdateSignature(ctx context.Context, sig string) error

UpdateSignature updates the signature for a reserved nonce. The use case here being transactions that share a nonce, and the new transaction being designated as the one to submit to the blockchain.

Jump to

Keyboard shortcuts

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