mcms

package
v0.0.0-...-c9d69aa Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMinDelayHours   = 3
	DefaultValidUntilHours = 72
)

Variables

View Source
var SendOrPlan = cldf_ops.NewOperation(
	"ton/ops/mcms/send-or-plan",
	semver.MustParse("0.1.0"),
	"Sends messages or proposes them as a BatchOperation if the destination is ownable and the sender is not the owner",
	func(b cldf_ops.Bundle, dp *dep.DependencyProvider, in SendOrPlanInput) (sequences.OnChainOutput, error) {
		if len(in.Messages) > 0 {
			_, err := cldf_ops.ExecuteOperation(b, opston.SendMessagesRaw, dp, opston.SendMessagesRawInput{Messages: in.Messages})
			if err != nil {
				return sequences.OnChainOutput{}, fmt.Errorf("failed to send messages: %w", err)
			}
		}

		out := sequences.OnChainOutput{}

		return WithOperationOutput(out, in.Plans, in.ChainSelector, in.Metadata)
	},
)
View Source
var TimelockAnySequence = operations.NewSequence(
	"ton/sequences/mcms/timelock/any",
	semver.MustParse("0.1.0"),
	"Executes and/or plans (via MCMS/Timelock) a sequence of operations as defined by the inputs",
	timelockAnySeqHandler,
)

Functions

func BuildTimelockProposal

func BuildTimelockProposal(ctx context.Context, client ton.APIClientWrapped, batchOps []types.BatchOperation, opts TimelockOpts) (mcms.TimelockProposal, error)

func RawPlanCellsToBatch

func RawPlanCellsToBatch(selector types.ChainSelector, plans []*tlbe.Cell[tlb.InternalMessage], meta []types.OperationMetadata) (types.BatchOperation, error)

RawPlanCellsToBatch converts raw message plan cells (TON) to MCMS batch operation type.

func RawPlansToBatch

func RawPlansToBatch(selector types.ChainSelector, plans []opston.MessagePlanRaw, meta []types.OperationMetadata) (types.BatchOperation, error)

RawPlansToBatch converts raw message plans (TON) to MCMS batch operation type.

func WithOperationOutput

func WithOperationOutput(out sequences.OnChainOutput, _out any, selector types.ChainSelector, meta []types.OperationMetadata) (sequences.OnChainOutput, error)

WithOperationOutput is a helper to extract plans from operation output and map them to batch operations.

Types

type Messages

type Messages struct {
	Messages []*tlbe.Cell[tlb.InternalMessage] `json:"messages"`
	Plans    []*tlbe.Cell[tlb.InternalMessage] `json:"plans"`
	Metadata []types.OperationMetadata         `json:"metadata"`
}

type SendOrPlanInput

type SendOrPlanInput struct {
	ChainSelector types.ChainSelector `json:"chainSelector"`

	Messages []*tlbe.Cell[tlb.InternalMessage] `json:"messages"`
	Plans    []*tlbe.Cell[tlb.InternalMessage] `json:"plans"`
	Metadata []types.OperationMetadata         `json:"metadata"`
}

func NewSendOrPlanInput

func NewSendOrPlanInput(chainSelector types.ChainSelector) SendOrPlanInput

func (*SendOrPlanInput) Add

func (in *SendOrPlanInput) Add(msgs []*tlbe.Cell[tlb.InternalMessage], plan bool, meta []types.OperationMetadata)

type TimelockAnySequenceInput

type TimelockAnySequenceInput struct {
	AnySequenceIn opston.AnySequenceInput `json:"anySequenceIn"`
	Options       TimelockOpts            `json:"options"`
}

type TimelockAnySequenceOutput

type TimelockAnySequenceOutput struct {
	Proposals    []mcms.TimelockProposal
	Transactions []*tlbe.Cell[tlb.Transaction]
}

func (TimelockAnySequenceOutput) GetPlans

type TimelockOpts

type TimelockOpts struct {
	ChainSelector types.ChainSelector `json:"chainSelector"`
	MCMSAddr      *address.Address    `json:"mcmsAddr"`
	TimelockAddr  *address.Address    `json:"timelockAddr"`

	OpsMetadata []types.OperationMetadata

	Description string               `json:"description"`
	Action      types.TimelockAction `json:"action"`
	Value       tlb.Coins            `json:"value"`
	Delay       *types.Duration      `json:"delay,omitempty"`
}

Jump to

Keyboard shortcuts

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