Skip to main content
The Sauce SDK includes @sauce/* libraries for token operations and swaps. Import them inside a SauceScript program; the compiler includes the required code in your program. You do not install or deploy these libraries separately. Use these imports in .sauce.ts programs. For application code that compiles and submits programs, use the TypeScript SDK.

Importing a library

A program imports a library’s functions by name, like any module. This one imports @sauce/router’s uniswapV3 and calls @sauce/token’s transfer with no import:
swap-and-pay.sauce.ts
The CLI, MCP server, routes.compileSauceProgram and actions compiler resolve bundled @sauce/* imports automatically. When you use the raw compiler, configure a resolver with the package’s resolveSdkModule and resolveSdkPackage (Compiling programs).

@sauce/token with no import

The @sauce/token functions are in scope in every program the sauce command or routes.compileSauceProgram compiles, with the token as the first argument, as in transfer(USDC, to, received) above. The token methods, USDC.transfer(to, amount), Token(token).approve(spender, amount) and pot.USDC, compile to calls into the same functions (Names). A name the program declares or imports itself takes precedence over the library’s.

EVM and Solana implementations

Each library has an EVM implementation and a Solana implementation. The compiler selects the implementation for your target chain:
  • @sauce/token has the same reads and writes on both, with Solana’s taking the accounts they read or move through. ownerOf, transferChecked and approveChecked are Solana only; permit and permitTransferFrom are EVM only.
  • @sauce/router has a different set of functions on each target: the EVM venues on EVM chains, the Solana venues on Solana.
A function available on only one target produces a compile error on the other. For example, importing an EVM swap function in a Solana program fails at the import:
router-on-solana.sauce.ts
Called with no import, a @sauce/token function the target does not support fails with “permit is called but never declared” (here permit on Solana). A @sauce/router function needs its import on every chain: without one it fails with “uniswapV3 is called but never declared”.

Next steps