computebudget

package
v0.0.0-...-689bf79 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Deprecated
	// after feature remove_deprecated_request_unit_ix::id() is activated
	Instruction_RequestUnitsDeprecated uint8 = iota

	// Request a specific transaction-wide program heap region size in bytes.
	// The value requested must be a multiple of 1024. This new heap region
	// size applies to each program executed in the transaction, including all
	// calls to CPIs.
	Instruction_RequestHeapFrame

	// Set a specific compute unit limit that the transaction is allowed to consume.
	Instruction_SetComputeUnitLimit

	// Set a compute unit price in "micro-lamports" to pay a higher transaction
	// fee for higher transaction prioritization.
	Instruction_SetComputeUnitPrice
)
View Source
const MAX_COMPUTE_UNIT_LIMIT = 1400000
View Source
const MAX_HEAP_FRAME_BYTES uint32 = 256 * 1024
View Source
const ProgramName = "ComputeBudget"

Variables

View Source
var InstructionImplDef = ag_binary.NewVariantDefinition(
	ag_binary.Uint8TypeIDEncoding,
	[]ag_binary.VariantType{
		{
			"RequestUnitsDeprecated", (*RequestUnitsDeprecated)(nil),
		},
		{
			"RequestHeapFrame", (*RequestHeapFrame)(nil),
		},
		{
			"SetComputeUnitLimit", (*SetComputeUnitLimit)(nil),
		},
		{
			"SetComputeUnitPrice", (*SetComputeUnitPrice)(nil),
		},
	},
)

Functions

func InstructionIDToName

func InstructionIDToName(id uint8) string

InstructionIDToName returns the name of the instruction given its ID.

func SetProgramID

func SetProgramID(pubkey ag_solanago.PublicKey)

Types

type Instruction

type Instruction struct {
	ag_binary.BaseVariant
}

func DecodeInstruction

func DecodeInstruction(accounts []*ag_solanago.AccountMeta, data []byte) (*Instruction, error)

func (*Instruction) Accounts

func (inst *Instruction) Accounts() (out []*ag_solanago.AccountMeta)

func (*Instruction) Data

func (inst *Instruction) Data() ([]byte, error)

func (*Instruction) EncodeToTree

func (inst *Instruction) EncodeToTree(parent ag_treeout.Branches)

func (Instruction) MarshalWithEncoder

func (inst Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error

func (*Instruction) ProgramID

func (inst *Instruction) ProgramID() ag_solanago.PublicKey

func (*Instruction) TextEncode

func (inst *Instruction) TextEncode(encoder *ag_text.Encoder, option *ag_text.Option) error

func (*Instruction) UnmarshalWithDecoder

func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type RequestHeapFrame

type RequestHeapFrame struct {
	HeapSize uint32
}

func NewRequestHeapFrameInstruction

func NewRequestHeapFrameInstruction(

	heapSize uint32,
) *RequestHeapFrame

NewRequestHeapFrameInstruction declares a new RequestHeapFrame instruction with the provided parameters and accounts.

func NewRequestHeapFrameInstructionBuilder

func NewRequestHeapFrameInstructionBuilder() *RequestHeapFrame

NewRequestHeapFrameInstructionBuilder creates a new `RequestHeapFrame` instruction builder.

func (RequestHeapFrame) Build

func (inst RequestHeapFrame) Build() *Instruction

func (*RequestHeapFrame) EncodeToTree

func (inst *RequestHeapFrame) EncodeToTree(parent ag_treeout.Branches)

func (RequestHeapFrame) GetAccounts

func (slice RequestHeapFrame) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (RequestHeapFrame) MarshalWithEncoder

func (obj RequestHeapFrame) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*RequestHeapFrame) SetAccounts

func (obj *RequestHeapFrame) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*RequestHeapFrame) SetHeapSize

func (inst *RequestHeapFrame) SetHeapSize(heapSize uint32) *RequestHeapFrame

Request heap frame in bytes

func (*RequestHeapFrame) UnmarshalWithDecoder

func (obj *RequestHeapFrame) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*RequestHeapFrame) Validate

func (inst *RequestHeapFrame) Validate() error

func (RequestHeapFrame) ValidateAndBuild

func (inst RequestHeapFrame) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

type RequestUnitsDeprecated

type RequestUnitsDeprecated struct {
	// Units to request
	Units uint32

	// Additional fee to add
	AdditionalFee uint32
}

func NewRequestUnitsDeprecatedInstruction

func NewRequestUnitsDeprecatedInstruction(

	units uint32,
	additionalFee uint32,
) *RequestUnitsDeprecated

NewRequestUnitsDeprecatedInstruction declares a new RequestUnitsDeprecated instruction with the provided parameters and accounts.

func NewRequestUnitsDeprecatedInstructionBuilder

func NewRequestUnitsDeprecatedInstructionBuilder() *RequestUnitsDeprecated

NewRequestUnitsDeprecatedInstructionBuilder creates a new `RequestUnitsDeprecated` instruction builder.

func (RequestUnitsDeprecated) Build

func (inst RequestUnitsDeprecated) Build() *Instruction

func (*RequestUnitsDeprecated) EncodeToTree

func (inst *RequestUnitsDeprecated) EncodeToTree(parent ag_treeout.Branches)

func (RequestUnitsDeprecated) GetAccounts

func (slice RequestUnitsDeprecated) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (RequestUnitsDeprecated) MarshalWithEncoder

func (obj RequestUnitsDeprecated) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*RequestUnitsDeprecated) SetAccounts

func (obj *RequestUnitsDeprecated) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*RequestUnitsDeprecated) SetAdditionalFee

func (inst *RequestUnitsDeprecated) SetAdditionalFee(additionalFee uint32) *RequestUnitsDeprecated

Additional fee to add

func (*RequestUnitsDeprecated) SetUnits

func (inst *RequestUnitsDeprecated) SetUnits(units uint32) *RequestUnitsDeprecated

Units to request

func (*RequestUnitsDeprecated) UnmarshalWithDecoder

func (obj *RequestUnitsDeprecated) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*RequestUnitsDeprecated) Validate

func (inst *RequestUnitsDeprecated) Validate() error

func (RequestUnitsDeprecated) ValidateAndBuild

func (inst RequestUnitsDeprecated) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

type SetComputeUnitLimit

type SetComputeUnitLimit struct {
	Units uint32
}

func NewSetComputeUnitLimitInstruction

func NewSetComputeUnitLimitInstruction(

	units uint32,
) *SetComputeUnitLimit

NewSetComputeUnitLimitInstruction declares a new SetComputeUnitLimit instruction with the provided parameters and accounts.

func NewSetComputeUnitLimitInstructionBuilder

func NewSetComputeUnitLimitInstructionBuilder() *SetComputeUnitLimit

NewSetComputeUnitLimitInstructionBuilder creates a new `SetComputeUnitLimit` instruction builder.

func (SetComputeUnitLimit) Build

func (inst SetComputeUnitLimit) Build() *Instruction

func (*SetComputeUnitLimit) EncodeToTree

func (inst *SetComputeUnitLimit) EncodeToTree(parent ag_treeout.Branches)

func (SetComputeUnitLimit) GetAccounts

func (slice SetComputeUnitLimit) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (SetComputeUnitLimit) MarshalWithEncoder

func (obj SetComputeUnitLimit) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*SetComputeUnitLimit) SetAccounts

func (obj *SetComputeUnitLimit) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*SetComputeUnitLimit) SetUnits

func (inst *SetComputeUnitLimit) SetUnits(units uint32) *SetComputeUnitLimit

Unit limit

func (*SetComputeUnitLimit) UnmarshalWithDecoder

func (obj *SetComputeUnitLimit) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*SetComputeUnitLimit) Validate

func (inst *SetComputeUnitLimit) Validate() error

func (SetComputeUnitLimit) ValidateAndBuild

func (inst SetComputeUnitLimit) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

type SetComputeUnitPrice

type SetComputeUnitPrice struct {
	MicroLamports uint64
}

func NewSetComputeUnitPriceInstruction

func NewSetComputeUnitPriceInstruction(

	microLamports uint64,
) *SetComputeUnitPrice

NewSetComputeUnitPriceInstruction declares a new SetComputeUnitPrice instruction with the provided parameters and accounts.

func NewSetComputeUnitPriceInstructionBuilder

func NewSetComputeUnitPriceInstructionBuilder() *SetComputeUnitPrice

NewSetComputeUnitPriceInstructionBuilder creates a new `SetComputeUnitPrice` instruction builder.

func (SetComputeUnitPrice) Build

func (inst SetComputeUnitPrice) Build() *Instruction

func (*SetComputeUnitPrice) EncodeToTree

func (inst *SetComputeUnitPrice) EncodeToTree(parent ag_treeout.Branches)

func (SetComputeUnitPrice) GetAccounts

func (slice SetComputeUnitPrice) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (SetComputeUnitPrice) MarshalWithEncoder

func (obj SetComputeUnitPrice) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*SetComputeUnitPrice) SetAccounts

func (obj *SetComputeUnitPrice) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*SetComputeUnitPrice) SetMicroLamports

func (inst *SetComputeUnitPrice) SetMicroLamports(microLamports uint64) *SetComputeUnitPrice

func (*SetComputeUnitPrice) UnmarshalWithDecoder

func (obj *SetComputeUnitPrice) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*SetComputeUnitPrice) Validate

func (inst *SetComputeUnitPrice) Validate() error

func (SetComputeUnitPrice) ValidateAndBuild

func (inst SetComputeUnitPrice) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

Jump to

Keyboard shortcuts

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