Instructions
The program's 8 instructions, in the order a book lives through them.
| Instruction | Signed by | What it does |
|---|---|---|
| open_book | Owner | Opens a book and its empty vault. |
| deposit | Owner | Funds the shared balance. |
| add_agent | Owner | Issues a wallet to an agent's key, with its limits. |
| set_limits | Owner | Changes a wallet's limits, what it may pay for, or freezes it. |
| spend | Agent | Pays a payee from the shared balance, inside the wallet's limits. |
| earn | Anyone | Pays an agent; the money lands in the shared balance. |
| seal | Anyone | Pins the chain's head over every entry since the last seal. |
| withdraw | Owner | Takes 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.
| Account | Signer | Writable |
|---|---|---|
| owner | yes | yes |
| book | yes | |
| mint | ||
| vault | yes | |
| token_program | ||
| system_program |
Has no refusals of its own beyond the account checks.
deposit
Owner funds the shared balance. Signed by: owner.
| Argument | Type |
|---|---|
| amount | u64 |
| Account | Signer | Writable |
|---|---|---|
| owner | yes | |
| book | yes | |
| mint | ||
| vault | yes | |
| owner_token | yes | |
| token_program |
Refuses with: ZeroAmount.
add_agent
Owner issues a wallet to an agent's key, with its limits. Signed by: owner.
| Argument | Type |
|---|---|
| name | string |
| per_tx_limit | u64 |
| daily_limit | u64 |
| allow | u8 |
| Account | Signer | Writable |
|---|---|---|
| owner | yes | yes |
| book | yes | |
| agent | ||
| wallet | yes | |
| system_program |
Refuses with: NameTooLong.
set_limits
Owner changes a wallet's limits, what it may pay for, or freezes it. Signed by: owner.
| Argument | Type |
|---|---|
| per_tx_limit | u64 |
| daily_limit | u64 |
| allow | u8 |
| frozen | bool |
| Account | Signer | Writable |
|---|---|---|
| owner | yes | |
| book | ||
| wallet | yes |
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.
| Argument | Type |
|---|---|
| amount | u64 |
| category | u8 |
| memo | [u8; 32] |
| Account | Signer | Writable |
|---|---|---|
| authority | yes | |
| book | yes | |
| wallet | yes | |
| mint | ||
| vault | yes | |
| payee | yes | |
| 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.
| Argument | Type |
|---|---|
| amount | u64 |
| memo | [u8; 32] |
| Account | Signer | Writable |
|---|---|---|
| payer | yes | |
| book | yes | |
| wallet | yes | |
| mint | ||
| vault | yes | |
| payer_token | yes | |
| 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.
| Account | Signer | Writable |
|---|---|---|
| payer | yes | yes |
| book | yes | |
| seal | yes | |
| system_program |
Refuses with: NothingToSeal.
withdraw
Owner takes money back out of the shared balance. Signed by: owner.
| Argument | Type |
|---|---|
| amount | u64 |
| Account | Signer | Writable |
|---|---|---|
| owner | yes | |
| book | yes | |
| mint | ||
| vault | yes | |
| owner_token | yes | |
| token_program |
Refuses with: ZeroAmount, InsufficientBalance.
Program address
Not deployed. The localnet build uses BDo5gccbqTxuo9gWXnXA6Fu9HU9GBVj6gNMYMkUNurTH.
NextAccounts