Instructions

The program's 8 instructions, in the order a book lives through them.

InstructionSigned byWhat it does
open_bookOwnerOpens a book and its empty vault.
depositOwnerFunds the shared balance.
add_agentOwnerIssues a wallet to an agent's key, with its limits.
set_limitsOwnerChanges a wallet's limits, what it may pay for, or freezes it.
spendAgentPays a payee from the shared balance, inside the wallet's limits.
earnAnyonePays an agent; the money lands in the shared balance.
sealAnyonePins the chain's head over every entry since the last seal.
withdrawOwnerTakes money back out of the shared balance.

open_book

Open a book for `owner`, with an empty vault for `mint`. Signed by: owner.

Takes no arguments.

AccountSignerWritable
owneryesyes
bookyes
mint
vaultyes
token_program
system_program

Has no refusals of its own beyond the account checks.

deposit

Owner funds the shared balance. Signed by: owner.

ArgumentType
amountu64
AccountSignerWritable
owneryes
bookyes
mint
vaultyes
owner_tokenyes
token_program

Refuses with: ZeroAmount.

add_agent

Owner issues a wallet to an agent's key, with its limits. Signed by: owner.

ArgumentType
namestring
per_tx_limitu64
daily_limitu64
allowu8
AccountSignerWritable
owneryesyes
bookyes
agent
walletyes
system_program

Refuses with: NameTooLong.

set_limits

Owner changes a wallet's limits, what it may pay for, or freezes it. Signed by: owner.

ArgumentType
per_tx_limitu64
daily_limitu64
allowu8
frozenbool
AccountSignerWritable
owneryes
book
walletyes

Has no refusals of its own beyond the account checks.

spend

An agent pays `payee` from the shared balance, inside its limits. `memo` is the hash of the offchain receipt (the routed call, the invoice). Signed by: agent.

ArgumentType
amountu64
categoryu8
memo[u8; 32]
AccountSignerWritable
authorityyes
bookyes
walletyes
mint
vaultyes
payeeyes
token_program

Refuses with: ZeroAmount, UnknownCategory, Frozen, CategoryNotAllowed, OverPerTxLimit, OverDailyLimit, InsufficientBalance, Overflow.

earn

Anyone pays an agent for its work. The money lands in the shared balance and is credited to the agent's wallet in the books. Signed by: anyone.

ArgumentType
amountu64
memo[u8; 32]
AccountSignerWritable
payeryes
bookyes
walletyes
mint
vaultyes
payer_tokenyes
token_program

Refuses with: ZeroAmount.

seal

Pin the chain's head. Anyone may seal; a seal covers every entry since the one before it. Signed by: anyone.

Takes no arguments.

AccountSignerWritable
payeryesyes
bookyes
sealyes
system_program

Refuses with: NothingToSeal.

withdraw

Owner takes money back out of the shared balance. Signed by: owner.

ArgumentType
amountu64
AccountSignerWritable
owneryes
bookyes
mint
vaultyes
owner_tokenyes
token_program

Refuses with: ZeroAmount, InsufficientBalance.

Program address

Not deployed. The localnet build uses BDo5gccbqTxuo9gWXnXA6Fu9HU9GBVj6gNMYMkUNurTH.

NextAccounts