Skip to main content
The token namespace emits SauceScript for token operations: ERC-20 on an EVM compile target, SPL Token on svm. It is TypeScript that writes SauceScript for a host program; a SauceScript program imports the @sauce/token library instead. token.Token.transfer({ token, to, amount }).toSauceScript("evm") returns an object whose source is a program routes.compileSauceProgram compiles. token.Token is also the root export Token.
Generated from the type declarations of @eco-incorp/sauce.

token.TokenSauceScript

Interface · @eco-incorp/sauce

token.TokenCall

Interface · @eco-incorp/sauce

token.TokenBinding

Interface · @eco-incorp/sauce What Token(<addr>) yields inside a route body - the wrapper form, not the runtime API. Route-body calls are positional (Token(a).approve(spender, amt)) where the runtime [TokenApi] takes a spec object, because the body is compiled to Sauce bytecode rather than executed: token-rewrite.ts#rewriteTokenFactory lowers each write to @sauce/token’s function of the same name, which has OpenZeppelin SafeERC20 semantics, and each read to IERC20.at, before the compiler sees it. These signatures are what let a typed closure body typecheck on the way there. The writes return nothing: they revert the program unless the token accepted them. Nothing calls these at run time, which is why they live here rather than on TokenApi.

token.TokenFactory

Interface · @eco-incorp/sauce The call signature the package root’s Token export carries, intersected onto [TokenApi] by gen-route-globals.mjs - the same way each chain accessor is ChainGlobals[...] & ChainContracts. Deliberately NOT on TokenApi itself: the runtime Token value is a frozen object and is not callable, so typing it as callable would promise something that throws. It describes what is legal in a route BODY, where the call is rewritten before compiling and never survives to run.

token.TokenApi

Interface · @eco-incorp/sauce

token.Token

Variable · @eco-incorp/sauce The universal token interface - ERC20 on an EVM compile target, SPL Token on svm. Re-exported from the package root as Token; also available as the named export token.Token.