token namespace emits SauceScript for token operations: ERC-20 on an EVM compile target, SPL Token on svm. token.Token is also installed as the default global Token.
sdk/dist/token/types.d.ts, sdk/dist/token/params.d.ts, sdk/dist/token/source.d.ts.
Generated from the type declarations shipped in
@eco-incorp/sauce 0.99.4. Each entry shows the package authors’ JSDoc and declaration for this SDK version. For runtime compatibility and deployed addresses, see architecture and deployments.token.Address
Type · sdk/dist/token/types.d.ts
A 20-byte EVM address, as an ordinary 0x-prefixed hex string.
token.AddressInput
Type · sdk/dist/token/types.d.ts
Anything the token normalizers accept for an address-shaped field.
token.TokenTarget
Type · sdk/dist/token/types.d.ts
"evm" is a target-agnostic alias for the ERC20 arm - the emitted SauceScript text is byte-
identical for "evm"/"v1"/"v12" (only compile()’s own target option, not this module,
decides which Huff runtime the text lowers against). "svm" selects the SPL Token arm.
token.TokenOp
Type · sdk/dist/token/types.d.ts
token.SPL_TRANSFER_CHECKED
Variable · sdk/dist/token/types.d.ts
SPL Token TransferChecked instruction discriminant.
token.SPL_APPROVE_CHECKED
Variable · sdk/dist/token/types.d.ts
SPL Token ApproveChecked instruction discriminant.
token.SPL_AMOUNT_OFFSET
Variable · sdk/dist/token/types.d.ts
Offset of the SPL token account’s u64 amount field (identical in classic SPL + Token-2022).
token.MINT_DECIMALS_OFFSET
Variable · sdk/dist/token/types.d.ts
Offset of the mint’s decimals byte (identical in the first 82 bytes of both programs’ mints).
token.SvmTokenRefs
Interface · sdk/dist/token/types.d.ts
SVM account refs a token op needs, as caller-named strings resolved at EXECUTION time (the same
contract svmSettleRefs establishes) - never resolved addresses baked into the source. Defaults
cover the common single-op case; a multi-op program must pass distinct names per op.
token.SvmTokenProgramInput
Type · sdk/dist/token/types.d.ts
The SVM CPI target VALUE - a well-known program id by name, or a raw pubkey as a bigint. Always a
LITERAL: every account identity a program touches is an attach slot, so a caller-supplied identity
belongs in SvmTokenRefs.tokenProgram (the ref this value is pinned against), never in the value.
token.TokenTransferSpec
Interface · sdk/dist/token/types.d.ts
token.TokenApproveSpec
Interface · sdk/dist/token/types.d.ts
token.TokenBalanceSpec
Interface · sdk/dist/token/types.d.ts
token.TokenSpec
Type · sdk/dist/token/types.d.ts
token.isEvmTarget
Function · sdk/dist/token/params.d.ts
token.toAddressBigint
Function · sdk/dist/token/params.d.ts
token.assertU64Range
Function · sdk/dist/token/params.d.ts
Any literal (non-"balance") amount destined for SVM must fit the SPL u64 amount field.
token.toAmountBigint
Function · sdk/dist/token/params.d.ts
token.ownerRef
Function · sdk/dist/token/params.d.ts
owner/tokenProgram default names - shared/reused across ops in one program by design (the
SPL CPI-target intern is meant to dedupe across ops, unlike per-op instance refs).
token.tokenProgramRef
Function · sdk/dist/token/params.d.ts
token.validateTransferSpec
Function · sdk/dist/token/params.d.ts
token.validateApproveSpec
Function · sdk/dist/token/params.d.ts
token.validateBalanceSpec
Function · sdk/dist/token/params.d.ts
token.assertNoDuplicateSvmRefs
Function · sdk/dist/token/params.d.ts
Rejects a duplicate SVM instance ref name across DIFFERENT ops in one Token.program(...) call - a collision would silently merge two distinct AccountPlan slots. owner/tokenProgram are
exempt (shared by design).
token.tokenImportLines
Function · sdk/dist/token/source.d.ts
The import lines a tokenSource(specs, target) program needs. On an EVM target: IERC20, iff
any spec is transfer/approve/balanceOf (always - every op needs the binding). On svm:
none (SVM ops use only the built-in svm.sload/svm.call globals).
token.tokenCallStatement
Function · sdk/dist/token/source.d.ts
One statement (transfer/approve) or undefined (balanceOf has no statement form - see
tokenExpression) for spec on target, for splicing into a larger, hand-written
program. Runs the full per-op/per-target validation. svmState threads dedup across multiple
ops in one program (tokenSource’s own concern) - omit it to get a fresh, single-op program.
token.tokenExpression
Function · sdk/dist/token/source.d.ts
The expression form of Token.balanceOf(spec) - the only op with one. Throws (named) for
transfer/approve, which have no meaningful expression form.
token.tokenAccountRefs
Function · sdk/dist/token/source.d.ts
The account-manifest refs a transfer/approve spec attaches, in order - mirrors
svmSettleRefs. Throws for balanceOf (a pure read; its only ref is the caller-supplied
source) and for an EVM-target spec (no account manifest on that target).
token.tokenSource
Function · sdk/dist/token/source.d.ts
A complete, compilable function main() { ... } program: one statement per transfer/approve
spec (in order), plus, if the LAST spec is a balanceOf, a trailing return <expr>; - because
Token.program’s only consumer (V12Pot.cook) executes the one program it is handed and wants
its result, if any, as the return value. A balanceOf in any OTHER position is spliced as a discarded
expression statement.
token.TOKEN_BASE_DIRS
Variable · sdk/dist/token/source.d.ts
baseDirs for compiling any program tokenSource/tokenCallStatement produces - resolves the
generated import { IERC20 } from "./artifacts/IERC20.json" against this installed package’s
dist root. Same value/pattern as swap/source.ts’s SWAP_BASE_DIRS.
token.TokenSourceOptions
Interface · sdk/dist/token/source.d.ts
