StarkZap
The main SDK class for initializing and managing wallet connections.Constructor
Methods
| Method | Returns | Description |
|---|---|---|
connectWallet(options) | Promise<Wallet> | Connect with signer + account preset |
connectCartridge(options?) | Promise<CartridgeWalletInterface> | Connect via Cartridge Controller popup (web only) |
onboard(options) | Promise<OnboardResult> | Onboard with strategy selection |
stakingTokens() | Promise<Token[]> | Get stakeable tokens |
getStakerPools(staker) | Promise<Pool[]> | Get validator’s delegation pools |
getBridgingTokens(chain?) | Promise<BridgeToken[]> | Get bridgeable tokens by source chain |
getProvider() | RpcProvider | Get the underlying RPC provider |
callContract(call) | Promise<CallContractResponse> | Call a contract read function |
Configuration
ConnectWalletOptions
Wallet / WalletInterface
The wallet interface provides access to account operations, transactions, and token management.Properties
| Property | Type | Description |
|---|---|---|
address | Address | Wallet address |
Methods
| Method | Returns | Description |
|---|---|---|
isDeployed() | Promise<boolean> | Check deployment status |
ensureReady(options?) | Promise<void> | Deploy if needed |
deploy(options?) | Promise<Tx> | Deploy account contract |
execute(calls, options?) | Promise<Tx> | Execute contract calls |
signMessage(typedData) | Promise<Signature> | Sign typed data |
preflight(options) | Promise<PreflightResult> | Simulate transaction |
tx() | TxBuilder | Create a transaction builder |
balanceOf(token) | Promise<Amount> | Get token balance |
transfer(token, transfers, options?) | Promise<Tx> | Transfer ERC20 tokens |
stake(pool, amount, options?) | Promise<Tx> | Smart stake (enter or add) |
enterPool(pool, amount, options?) | Promise<Tx> | Enter staking pool |
addToPool(pool, amount, options?) | Promise<Tx> | Add to existing stake |
claimPoolRewards(pool, options?) | Promise<Tx> | Claim staking rewards |
exitPoolIntent(pool, amount, options?) | Promise<Tx> | Start exit process |
exitPool(pool, options?) | Promise<Tx> | Complete exit |
isPoolMember(pool) | Promise<boolean> | Check pool membership |
getPoolPosition(pool) | Promise<PoolMember | null> | Get staking position |
getPoolCommission(pool) | Promise<number> | Get pool commission rate |
estimateFee(calls) | Promise<EstimateFeeResponse> | Estimate execution fee |
getAccount() | Account | Get starknet.js Account |
getProvider() | RpcProvider | Get RPC provider |
getChainId() | ChainId | Get chain ID |
getFeeMode() | FeeMode | Get default fee mode |
erc20(token) | Erc20 | Get ERC20 helper for token |
getClassHash() | string | Get account class hash |
getQuote(request) | Promise<SwapQuote> | Get swap quote |
prepareSwap(request) | Promise<PreparedSwap> | Prepare swap calls |
swap(request, options?) | Promise<Tx> | Execute a token swap |
registerSwapProvider(provider, makeDefault?) | void | Register a swap provider |
setDefaultSwapProvider(providerId) | void | Set the default swap provider |
getSwapProvider(providerId) | SwapProvider | Get a registered swap provider |
getDefaultSwapProvider() | SwapProvider | Get the default swap provider |
listSwapProviders() | string[] | List registered swap provider IDs |
dca() | DcaClientInterface | Get DCA (recurring buy) client |
lending() | LendingClient | Get lending client |
staking(poolAddress) | Promise<Staking> | Get staking helper for a pool |
stakingInStaker(stakerAddress, token) | Promise<Staking> | Get staking helper from a staker |
lstStaking(asset, options?) | EndurStaking | Get Endur liquid staking helper for an asset |
troves(options?) | Troves | Get Troves strategy client |
callContract(call) | Promise<CallContractResponse> | Read-only contract call |
disconnect() | Promise<void> | Disconnect wallet |
deposit(recipient, amount, token, externalWallet, options?) | Promise<{ hash: string }> | Bridge deposit from external chain |
getDepositBalance(token, externalWallet) | Promise<Amount> | Get source-chain available balance |
getAllowance(token, externalWallet) | Promise<Amount | null> | Get source-chain allowance (if applicable) |
getDepositFeeEstimate(token, externalWallet, options?) | Promise<BridgeDepositFeeEstimation> | Estimate bridge route fees |
initiateWithdraw(recipient, amount, token, externalWallet, options?) | Promise<Tx> | Initiate withdrawal from Starknet to external chain |
completeWithdraw(recipient, amount, token, externalWallet, options?) | Promise<{ hash: string }> | Complete withdrawal on external chain (Canonical & CCTP only) |
getWithdrawBalance(token, externalWallet) | Promise<Amount> | Get L2 balance available to withdraw |
getInitiateWithdrawFeeEstimate(token, externalWallet, options?) | Promise<BridgeInitiateWithdrawFeeEstimation> | Estimate L2 fee for initiating withdrawal |
getCompleteWithdrawFeeEstimate(amount, recipient, token, externalWallet, options?) | Promise<BridgeCompleteWithdrawFeeEstimation> | Estimate L1 gas for completing withdrawal |
monitorDeposit(token, externalTxHash, starknetTxHash?) | Promise<DepositMonitorResult> | Get full deposit status snapshot |
monitorWithdrawal(token, snTxHash, externalTxHash?) | Promise<WithdrawMonitorResult> | Get full withdrawal status snapshot (includes CCTP attestation data) |
getDepositState(token, param) | Promise<DepositState> | Simplified deposit state for UI |
getWithdrawalState(token, param) | Promise<WithdrawalState> | Simplified withdrawal state for UI |
Tx
Transaction object returned fromexecute(), deploy(), and transfer().
Properties
| Property | Type | Description |
|---|---|---|
hash | string | Transaction hash |
explorerUrl | string | Block explorer URL |
Methods
| Method | Returns | Description |
|---|---|---|
wait(options?) | Promise<void> | Wait for confirmation |
watch(callback, options?) | TxUnsubscribe | Watch status changes (options: pollIntervalMs, timeoutMs, onError) |
receipt() | Promise<TxReceipt> | Get transaction receipt |
TxBuilder
Fluent API for building and executing batched transactions.Properties
| Property | Type | Description |
|---|---|---|
length | number | Number of queued call groups |
isEmpty | boolean | Whether the builder has no calls |
isSent | boolean | Whether send() has been called |
Methods
| Method | Returns | Description |
|---|---|---|
.add(...calls) | TxBuilder | Add raw Call objects |
.approve(token, spender, amount) | TxBuilder | ERC20 approval |
.transfer(token, transfers) | TxBuilder | ERC20 transfer(s) |
.stake(pool, amount) | TxBuilder | Smart stake (enter or add based on membership) |
.enterPool(pool, amount) | TxBuilder | Enter pool as new member |
.addToPool(pool, amount) | TxBuilder | Add to existing pool position |
.claimPoolRewards(pool) | TxBuilder | Claim staking rewards |
.exitPoolIntent(pool, amount) | TxBuilder | Start exit process |
.exitPool(pool) | TxBuilder | Complete exit after window |
.swap(request) | TxBuilder | Provider-driven token swap |
.lendDeposit(request) | TxBuilder | Lending deposit (supply) |
.lendWithdraw(request) | TxBuilder | Lending withdraw |
.lendWithdrawMax(request) | TxBuilder | Lending max withdraw |
.lendBorrow(request) | TxBuilder | Lending borrow |
.lendRepay(request) | TxBuilder | Lending repay |
.trovesDeposit(params) | TxBuilder | Troves strategy deposit |
.trovesWithdraw(params) | TxBuilder | Troves strategy withdraw |
.dcaCreate(request) | TxBuilder | Create a DCA (recurring buy) order |
.dcaCancel(request) | TxBuilder | Cancel a DCA order |
.confidentialFund(confidential, details) | TxBuilder | Fund confidential account |
.confidentialTransfer(confidential, details) | TxBuilder | Confidential transfer |
.confidentialWithdraw(confidential, details) | TxBuilder | Withdraw from confidential to public address |
.calls() | Promise<Call[]> | Resolve all calls without sending |
.estimateFee() | Promise<EstimateFeeResponse> | Estimate gas cost |
.preflight() | Promise<PreflightResult> | Simulate the transaction |
.send(options?) | Promise<Tx> | Execute all calls atomically |
Amount
Type-safe amount handling for token values.Static Methods
| Method | Returns | Description |
|---|---|---|
Amount.parse(value, token) | Amount | From human-readable value |
Amount.fromRaw(value, token) | Amount | From raw blockchain value |
Instance Methods
| Method | Returns | Description |
|---|---|---|
toUnit() | string | Human-readable string |
toBase() | bigint | Raw value for contracts |
toFormatted(compressed?) | string | Locale-formatted with symbol |
getDecimals() | number | Token decimal places |
getSymbol() | string | undefined | Token symbol |
add(other) | Amount | Addition |
subtract(other) | Amount | Subtraction |
multiply(scalar) | Amount | Multiplication |
divide(scalar) | Amount | Division |
eq(other) | boolean | Equal |
gt(other) | boolean | Greater than |
gte(other) | boolean | Greater than or equal |
lt(other) | boolean | Less than |
lte(other) | boolean | Less than or equal |
isZero() | boolean | Is zero |
isPositive() | boolean | Is positive |
Signers
StarkSigner
Local Stark curve signer for private key management.PrivySigner
Privy server-side key management signer.SignerInterface
Custom signer interface for implementing your own key management.Types
Address
Branded string type for Starknet addresses.ChainId
Chain ID utilities and constants.FeeMode
Transaction fee payment mode.DeployMode
Account deployment policy.OnboardStrategy
Onboarding strategy selection.Interfaces
Token
BridgingConfig
ExternalChain
BridgeToken
WithdrawalState
Simplified withdrawal state for use in UI polling.| Value | Meaning |
|---|---|
PENDING | Bridging in progress — no user action needed |
READY_TO_CLAIM | Ready to finalize on L1 — call completeWithdraw (CCTP/Canonical) |
COMPLETED | Bridge flow fully complete |
ERROR | Unrecoverable error |
DepositState
Simplified deposit state for use in UI polling.InitiateBridgeWithdrawOptions
Discriminated union byprotocol:
CompleteBridgeWithdrawOptions
Options required for the L1 completion step (CCTP only). The attestation data is returned bymonitorWithdrawal.