Crate smart_wallet

Source
Expand description

Multisig Solana wallet with Timelock capabilities.

This program can be used to allow a smart wallet to govern anything a regular Pubkey can govern. One can use the smart wallet as a BPF program upgrade authority, a mint authority, etc.

To use, one must first create a SmartWallet account, specifying two important parameters:

  1. Owners - the set of addresses that sign transactions for the smart wallet.
  2. Threshold - the number of signers required to execute a transaction.
  3. Minimum Delay - the minimum amount of time that must pass before a Transaction can be executed. If 0, this is ignored.

Once the SmartWallet account is created, one can create a Transaction account, specifying the parameters for a normal Solana instruction.

To sign, owners should invoke the smart_wallet::approve instruction, and finally, smart_wallet::execute_transaction, once enough (i.e. SmartWallet::threshold) of the owners have signed.

Modules§

accounts
An Anchor generated module, providing a set of structs mirroring the structs deriving Accounts, where each field is a Pubkey. This is useful for specifying accounts for a client.
approve
Instruction handler for smart_wallet::approve.
instruction
An Anchor generated module containing the program’s set of instructions, where each method handler in the #[program] mod is associated with a struct defining the input arguments to the method. These should be used directly, when one wants to serialize Anchor instruction data, for example, when speciying instructions on a client.
program
Module representing the program.
smart_wallet
Goki smart wallet program.
unapprove
Instruction handler for smart_wallet::unapprove.

Structs§

Approve
Accounts for smart_wallet::approve.
Auth
Accounts for smart_wallet::set_owners and smart_wallet::change_threshold.
CreateSmartWallet
Accounts for smart_wallet::create_smart_wallet.
CreateSubaccountInfo
Accounts for smart_wallet::create_subaccount_info.
CreateTransaction
Accounts for smart_wallet::create_transaction.
ExecuteTransaction
Accounts for smart_wallet::execute_transaction.
OwnerInvokeInstruction
Accounts for smart_wallet::owner_invoke_instruction.
SmartWallet
A SmartWallet is a multisig wallet with Timelock capabilities.
SubaccountInfo
Mapping of a Subaccount to its SmartWallet.
TXAccountMeta
Account metadata used to define TXInstructions
TXInstruction
Instruction.
Transaction
A Transaction is a series of instructions that may be executed by a SmartWallet.
TransactionApproveEvent
Emitted when a Transaction is approved.
TransactionCreateEvent
Emitted when a Transaction is proposed.
TransactionExecuteEvent
Emitted when a Transaction is executed.
TransactionUnapproveEvent
Emitted when a Transaction is unapproved.
WalletChangeThresholdEvent
Emitted when the threshold of a SmartWallet is changed.
WalletCreateEvent
Emitted when a SmartWallet is created.
WalletSetOwnersEvent
Emitted when the owners of a SmartWallet are changed.

Enums§

ErrorCode
Program errors.
SubaccountType
Type of Subaccount.

Constants§

DEFAULT_GRACE_PERIOD
Default number of seconds until a transaction expires.
MAX_DELAY_SECONDS
Maximum timelock delay.
NO_ETA
Constant declaring that there is no ETA of the transaction.
SECONDS_PER_DAY
Number of seconds in a day.

Statics§

ID
The static program ID

Functions§

check_id
Confirms that a given pubkey is equivalent to the program ID
entry
The Anchor codegen exposes a programming model where a user defines a set of methods inside of a #[program] module in a way similar to writing RPC request handlers. The macro then generates a bunch of code wrapping these user defined methods into something that can be executed on Solana.
entrypoint
Safety
handler
Instruction handler for smart_wallet::approve.
handler
Instruction handler for smart_wallet::unapprove.
id
Returns the program ID