deposit namespace emits deposit programs from protocol templates listed under DepositKey. Compile with baseDirs: [...deposit.DEPOSIT_BASE_DIRS], or COMPOSED_BASE_DIRS for a swap-then-deposit program.
sdk/dist/swap/types.d.ts, sdk/dist/deposit/types.d.ts, sdk/dist/deposit/params.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.deposit.Address
Type · sdk/dist/swap/types.d.ts
A 20-byte EVM address, as an ordinary 0x-prefixed hex string.
deposit.AddressInput
Type · sdk/dist/swap/types.d.ts
Anything toSwapParams accepts for an address-shaped field.
deposit.AmountInput
Type · sdk/dist/swap/types.d.ts
Anything toSwapParams accepts for a numeric-shaped field.
deposit.Hex
Type · sdk/dist/swap/types.d.ts
A 0x-prefixed hex byte string (used for SwapParams.callback).
deposit.ApprovalPolicy
Type · sdk/dist/deposit/types.d.ts
How much of spec.amount to approve, when funding === "erc20-approve".
deposit.BeneficiarySupport
Type · sdk/dist/deposit/types.d.ts
Whether a template’s protocol call accepts a caller-chosen beneficiary/recipient address.
deposit.DepositSpec
Interface · sdk/dist/deposit/types.d.ts
The chain-agnostic deposit SPEC a caller builds - the input to toDeposit /
depositCallStatement / depositSource.
token names the asset for a typed-ABI template. Omit it for WETH wrap/unwrap and Lido stake;
WETH unwrap uses target as its token address, while wrap and stake use native ETH.
beneficiary defaults to ctx.self() and must be omitted on a beneficiary: "unsupported"
template (every such protocol credits msg.sender unconditionally - accepting one would silently
send the position to the wrong account).
deposit.DepositSourceSpec
Type · sdk/dist/deposit/types.d.ts
The extra shapes depositCallStatement/depositSource accept beyond a concrete
DepositSpec:
amount: "balance"- emit a RUNTIME balance read instead of a baked-in literal (IERC20. balanceOf(ctx.self())ontokenor the WETH unwraptarget,ctx.selfBalance()for a native-funded template) - the shape a swap-then-deposit program needs when the deposit amount is an earlier leg’s (unknown at compile time) output.amount: "delta"- only meaningful insideswapThenDepositSource(it needs a pre-swap balance snapshot to compute against);depositCallStatement/depositSourcealone reject it.amount: "max"- only accepted on a template withallowsMaxAmount: true(Aave/Sparkwithdraw’s documentedtype(uint256).maxwithdraw-all sentinel); rejected everywhere else.
deposit.DepositTemplate
Interface · sdk/dist/deposit/types.d.ts
One per-protocol call template - data + a small pure emitter, deliberately not a class
hierarchy. See sdk/src/deposit/templates.ts for the concrete registry and
sdk/src/deposit/index.ts for which protocols are included/skipped and why.
deposit.ExtraFieldSpec
Interface · sdk/dist/deposit/types.d.ts
A single extra, protocol-specific field a template accepts beyond the common shape.
deposit.Funding
Type · sdk/dist/deposit/types.d.ts
How a template’s protocol call pulls in the token amount being deposited.
"erc20-approve"- an ERC20 asset;depositCallStatementemitsIERC20.approve(target, amount)immediately before the protocol call (seeApprovalPolicy)."native-value"- no ERC20 leg at all; the amount rides asmsg.valueon a rawevm.call(target, value, calldata)(a typed ABI binding can never attach value - seesdk/src/deposit/index.ts’s “native vs ERC20” note). No approve is ever emitted."none"- a redeem/withdraw leg that burns a balance this contract already holds (e.g. Aave’swithdraw, which burns aTokens). No approve, no value.
deposit.NormalizedDeposit
Interface · sdk/dist/deposit/types.d.ts
A DepositSpec, fully normalized - bigint scalars (+ the "self" sentinel for a defaulted
beneficiary, matching SwapParams’s own convention), plus the resolved DepositTemplate.
amount stays a passthrough of whatever toDeposit was handed for the runtime-amount shapes
("balance" etc.) so a caller can tell a concrete deposit from a source-only one apart.
deposit.SkippedProtocolNote
Interface · sdk/dist/deposit/types.d.ts
A short, human-readable note on a protocol considered but not registered as a template.
deposit.toDeposit
Function · sdk/dist/deposit/params.d.ts
The whole normalization/defaulting/guard decision: lowers a chain-agnostic DepositSpec
into a fully normalized NormalizedDeposit - plain bigints (+ the "self" sentinel for a
defaulted beneficiary), with its resolved DepositTemplate attached.
spec.amount may be "balance" | "delta" | "max" - see DepositSourceSpec - in which case
it passes through unresolved (the caller, depositCallStatement/swapThenDepositSource, decides
the actual amount EXPRESSION; this function only validates every OTHER field and, for "max",
checks allowsMaxAmount).
Throws (never emits a program that would misbehave on-chain) for: an unknown protocol:action;
token supplied to a raw-call template or omitted from a typed-ABI template;
beneficiary supplied to a beneficiary: "unsupported" template; amount: "max" on a template
with allowsMaxAmount: false; an unrecognized extra field name; an amount given as a number
that is not a safe integer (past 2^53-1 pass a bigint or a string, since the double has already
been rounded); and whatever the field’s own ExtraFieldSpec.normalize throws for an out-of-range
extra value.
