Skip to main content

Constructor

new CavosSDK(config: CavosConfig)

CavosConfig

interface CavosConfig {
  appId: string;
  network?: 'sepolia' | 'mainnet';
  paymasterApiKey?: string;
  starknetRpcUrl?: string;
  enableLogging?: boolean;
  passkeyModal?: {
    title?: string;
    description?: string;
    buttonText?: string;
  };
}

Initialization

init()

async init(): Promise<void>
Initialize SDK and restore existing session.

Authentication

login(provider, redirectUri?)

async login(provider: 'google' | 'apple', redirectUri?: string): Promise<void>
Start OAuth authentication flow.

loginWithGoogle(redirectUri?)

async loginWithGoogle(redirectUri?: string): Promise<void>

loginWithApple(redirectUri?)

async loginWithApple(redirectUri?: string): Promise<void>

handleCallback(authDataString)

async handleCallback(authDataString: string): Promise<void>
Handle OAuth callback data.

logout()

async logout(): Promise<void>
Clear session and wallet data.

isAuthenticated()

isAuthenticated(): boolean

getUserInfo()

getUserInfo(): UserInfo | null

deleteAccount()

async deleteAccount(): Promise<void>
Permanently delete user account.

Wallet

createWallet()

async createWallet(): Promise<void>
Create or recover wallet (smart flow).

getAddress()

getAddress(): string | null

hasWallet()

async hasWallet(): Promise<boolean>
Check if wallet exists on backend.

getBalance()

async getBalance(): Promise<string>
Get ETH balance in wei.

getFundingAddress()

getFundingAddress(): string | null

isAccountDeployed()

async isAccountDeployed(): Promise<boolean>

deployAccount()

async deployAccount(): Promise<string>
Manually deploy account. Returns transaction hash.

retryWalletUnlock()

async retryWalletUnlock(): Promise<void>
Retry biometric unlock after cancellation.

Passkey-Only

hasPasskeyOnlyWallet()

async hasPasskeyOnlyWallet(): Promise<boolean>

loadPasskeyOnlyWallet()

async loadPasskeyOnlyWallet(): Promise<void>

recoverWalletWithPasskey()

async recoverWalletWithPasskey(): Promise<void>

clearPasskeyOnlyWallet()

async clearPasskeyOnlyWallet(): Promise<void>

Transactions

execute(calls, options?)

async execute(
  calls: Call | Call[],
  options?: { gasless?: boolean }
): Promise<string>
Execute transaction(s). Returns transaction hash.

signMessage(message)

async signMessage(message: string | TypedData): Promise<Signature>

Session

hasActiveSession()

hasActiveSession(): boolean

createSession()

async createSession(): Promise<void>
Note: Session keys not supported with ArgentX accounts.

Onramp

getOnramp(provider)

getOnramp(provider: 'RAMP_NETWORK'): string
Get fiat onramp URL.

Advanced

getAccount()

getAccount(): Account | null
Get starknet.js Account instance.

getSessionAccount()

getSessionAccount(): Account | null

deleteWallet()

async deleteWallet(): Promise<void>
Delete wallet from cloud storage.