Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OpSolanaGrantRole = operations.NewOperation( "solana-grant-role", semver.MustParse("1.0.0"), "Grants a timelock role to one Solana address via the MCMS SDK timelock configurer", func(b operations.Bundle, deps cldfsol.Chain, in OpSolanaGrantRoleInput) (OpSolanaGrantRoleOutput, error) { if err := validateGrantRoleTarget(in.Target); err != nil { return OpSolanaGrantRoleOutput{}, err } if deps.DeployerKey == nil { return OpSolanaGrantRoleOutput{}, fmt.Errorf("missing deployer key for chain %d", deps.Selector) } if deps.Client == nil { return OpSolanaGrantRoleOutput{}, fmt.Errorf("missing rpc client for chain %d", deps.Selector) } configurer := newGrantRoleTimelockConfigurer(deps, in) res, err := configurer.GrantRole(b.GetContext(), in.Target.Timelock, in.Target.Role, in.Target.Address) if err != nil { return OpSolanaGrantRoleOutput{}, fmt.Errorf("grant role %s to %s on %s: %w", in.Target.Role.String(), in.Target.Address, in.Target.Timelock, err) } if in.NoSend { tx, ok := res.RawData.(mcmstypes.Transaction) if !ok { return OpSolanaGrantRoleOutput{}, fmt.Errorf("unexpected raw data type %T from GrantRole", res.RawData) } return OpSolanaGrantRoleOutput{ BatchOperation: mcmstypes.BatchOperation{ ChainSelector: mcmstypes.ChainSelector(deps.Selector), Transactions: []mcmstypes.Transaction{tx}, }, }, nil } b.Logger.Infow("GrantRole confirmed", "chainSelector", deps.Selector, "timelock", in.Target.Timelock, "role", in.Target.Role.String(), "address", in.Target.Address, "signature", res.Hash, ) return OpSolanaGrantRoleOutput{Confirmed: true, Signature: res.Hash}, nil }, )
OpSolanaGrantRole grants a timelock role via the MCMS SDK timelock configurer.
Functions ¶
func AddressesNeedingGrant ¶
func AddressesNeedingGrant( ctx context.Context, inspector mcmssdk.TimelockInspector, timelockAddress string, grant grantrole.RoleGrant, ) ([]solanago.PublicKey, error)
AddressesNeedingGrant returns grant addresses that do not yet hold the role.
func Registration ¶
func Registration() grantrole.Registration
Types ¶
type GrantRoleTarget ¶
type GrantRoleTarget struct {
Timelock string `json:"timelock"`
Role mcmssdk.TimelockRole `json:"role"`
Address string `json:"address"`
}
GrantRoleTarget identifies one timelock role grant on Solana.
type OpSolanaGrantRoleInput ¶
type OpSolanaGrantRoleInput struct {
Target GrantRoleTarget `json:"target"`
NoSend bool `json:"noSend"`
AuthorityAccount solanago.PublicKey `json:"authorityAccount"`
}
OpSolanaGrantRoleInput is the input for granting one timelock role on Solana.
type OpSolanaGrantRoleOutput ¶
type OpSolanaGrantRoleOutput struct {
Confirmed bool `json:"confirmed"`
BatchOperation mcmstypes.BatchOperation `json:"batchOperation"`
Signature string `json:"signature,omitempty"`
}
OpSolanaGrantRoleOutput is the output of a Solana grant-role operation.
Click to show internal directories.
Click to hide internal directories.