Wrapped Thru
Use thru wthru when the task involves wrapped Thru rather than generic token-account operations.
Commands
Section titled “Commands”| Command | Use it for |
|---|---|
initialize | Initialize the wrapped Thru mint and vault accounts. |
deposit <dest_token_account> <amount> | Wrap native Thru into wrapped Thru. |
withdraw <wthru_token_account> <recipient> <amount> | Burn wrapped Thru and receive native Thru. |
High-Signal Flags
Section titled “High-Signal Flags”| Flag | Why it matters |
|---|---|
--program | Override the configured wrapped Thru program ID. |
--token-program | Override the token program ID used by wrapped Thru flows. |
--skip-transfer | On deposit, skip the native transfer and only run the deposit instruction, crediting whatever unaccounted balance the vault already holds. Fails if there is none, and the credited delta is whatever anyone transferred in, not necessarily your funds. |
Minimal Pattern
Section titled “Minimal Pattern”thru wthru initializethru wthru deposit ta...[dest_token_account] 1000000Deposits Must Be Atomic With Their Funding Transfer
Section titled “Deposits Must Be Atomic With Their Funding Transfer”The deposit instruction does not move native Thru itself. It mints the vault’s unaccounted native balance — the vault’s current balance minus the balance it last accounted for — to the destination token account named by the instruction. The program cannot pull the funds on its own, because the runtime only lets a program transfer out of accounts it owns.
Funding the vault is therefore the client’s responsibility, and the native
transfer into the vault must be in the same transaction as the deposit
instruction (for example batched through the multicall program). If the
transfer and the deposit are submitted as separate transactions, the transferred
amount sits unattributed on-chain in between and whichever caller runs deposit
first is credited it.
thru wthru deposit does not yet satisfy this requirement: it submits the
native transfer and the deposit instruction as two separate transactions. Use it
only where a competing deposit between the two is acceptable (local
development and test networks); build the batched single transaction yourself for
anything else.
- Use this family instead of
tokenwhen the goal is wrapping or unwrapping native Thru. - The program and token program IDs can both be overridden explicitly.