Skip to content

SIP

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / SIP

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2228

Main SIP SDK client for privacy-preserving cross-chain transactions

The SIP class is the primary interface for interacting with the Shielded Intents Protocol. It provides methods for:

  • Creating shielded intents with privacy guarantees
  • Fetching quotes from solvers/market makers
  • Executing cross-chain swaps via settlement backends
  • Managing stealth addresses and viewing keys
  • Generating zero-knowledge proofs

Key Concepts:

  • Intent: A declaration of desired output (e.g., “I want 95+ ZEC on Zcash”)
  • Privacy Levels: transparent (public), shielded (private), compliant (private + auditable)
  • Stealth Address: One-time recipient address for unlinkable transactions
  • Commitment: Cryptographic hiding of amounts using Pedersen commitments
  • Viewing Key: Selective disclosure key for compliance/auditing
import { SIP, PrivacyLevel } from '@sip-protocol/sdk'
// Initialize client
const sip = new SIP({ network: 'testnet' })
// Create a shielded intent
const intent = await sip.createIntent({
input: {
asset: { chain: 'solana', symbol: 'SOL', address: null, decimals: 9 },
amount: 10n * 10n**9n, // 10 SOL
},
output: {
asset: { chain: 'ethereum', symbol: 'ETH', address: null, decimals: 18 },
minAmount: 0n, // Accept any amount
maxSlippage: 0.01, // 1%
},
privacy: PrivacyLevel.SHIELDED,
})
// Get quotes from solvers
const quotes = await sip.getQuotes(intent)
// Execute with best quote
const result = await sip.execute(intent, quotes[0])
console.log('Swap completed:', result.txHash)
import { SIP, PrivacyLevel, MockProofProvider } from '@sip-protocol/sdk'
// Initialize with production backend
const sip = new SIP({
network: 'mainnet',
mode: 'production',
proofProvider: new MockProofProvider(), // Use NoirProofProvider in prod
intentsAdapter: {
jwtToken: process.env.NEAR_INTENTS_JWT,
},
})
// Connect wallet
sip.connect(myWalletAdapter)
// Generate stealth keys for receiving
const stealthMetaAddress = sip.generateStealthKeys('ethereum', 'My Privacy Wallet')
// Create intent with stealth recipient
const intent = await sip.createIntent({
input: { asset: { chain: 'near', symbol: 'NEAR', address: null, decimals: 24 }, amount: 100n },
output: { asset: { chain: 'zcash', symbol: 'ZEC', address: null, decimals: 8 }, minAmount: 0n, maxSlippage: 0.01 },
privacy: PrivacyLevel.SHIELDED,
recipientMetaAddress: sip.getStealthAddress(),
})
// Get real quotes
const quotes = await sip.getQuotes(intent)
// Execute with deposit callback
const result = await sip.execute(intent, quotes[0], {
onDepositRequired: async (depositAddr, amount) => {
console.log(`Deposit ${amount} to ${depositAddr}`)
const tx = await wallet.transfer(depositAddr, amount)
return tx.hash
},
onStatusUpdate: (status) => console.log('Status:', status),
})

new SIP(config): SIP

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2261

Create a new SIP SDK client

SIPConfig

Configuration options for the client

SIP

If configuration is invalid

const sip = new SIP({ network: 'testnet' })
const sip = new SIP({
network: 'mainnet',
mode: 'production',
defaultPrivacy: PrivacyLevel.COMPLIANT,
proofProvider: await NoirProofProvider.create(),
intentsAdapter: { jwtToken: process.env.JWT },
rpcEndpoints: {
ethereum: 'https://eth-mainnet.g.alchemy.com/v2/KEY',
},
})

getMode(): "demo" | "production"

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2265

Get the current mode

"demo" | "production"


isProductionMode(): boolean

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2269

Check if running in production mode with real NEAR Intents

boolean


getIntentsAdapter(): NEARIntentsAdapter | undefined

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2273

Get the NEAR Intents adapter

NEARIntentsAdapter | undefined


setIntentsAdapter(adapter): void

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2277

Set the NEAR Intents adapter

NEARIntentsAdapter | NEARIntentsAdapterConfig

void


getProofProvider(): ProofProvider | undefined

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2281

Get the configured proof provider

ProofProvider | undefined


setProofProvider(provider): void

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2285

Set or update the proof provider

ProofProvider

void


hasProofProvider(): boolean

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2289

Check if proof provider is available and ready

boolean


connect(wallet): void

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2293

Connect a wallet

WalletAdapter

void


disconnect(): void

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2297

Disconnect wallet

void


isConnected(): boolean

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2301

Check if wallet is connected

boolean


getWallet(): WalletAdapter | undefined

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2305

Get connected wallet

WalletAdapter | undefined


generateStealthKeys(chain, label?): StealthMetaAddress

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2311

Generate and store stealth keys for this session

ChainId

string

StealthMetaAddress

If chain is invalid


getStealthAddress(): string | undefined

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2315

Get the encoded stealth meta-address for receiving

string | undefined


intent(): IntentBuilder

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2331

Create a new intent builder

The builder is automatically configured with the SIP client’s proof provider (if one is set), so proofs will be generated automatically when .build() is called.

IntentBuilder

const intent = await sip.intent()
.input('near', 'NEAR', 100n)
.output('zcash', 'ZEC', 95n)
.privacy(PrivacyLevel.SHIELDED)
.build()

createIntent(params, options?): Promise<TrackedIntent>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2338

Create a shielded intent directly

Uses the SIP client’s configured proof provider (if any) to generate proofs automatically for SHIELDED and COMPLIANT privacy levels.

CreateIntentParams

boolean

Allow placeholder signatures for proof generation (demo/testing only)

Uint8Array<ArrayBufferLike>

Ownership signature proving wallet control

Uint8Array<ArrayBufferLike>

Sender secret for nullifier derivation

Uint8Array<ArrayBufferLike>

Authorization signature for this intent

Promise<TrackedIntent>


getQuotes(params, recipientMetaAddress?, senderAddress?, transparentRecipient?): Promise<ProductionQuote[]>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2360

Get quotes for an intent

In production mode: fetches real quotes from NEAR 1Click API In demo mode: returns mock quotes for testing

Intent parameters (CreateIntentParams for production, ShieldedIntent/CreateIntentParams for demo)

ShieldedIntent | CreateIntentParams

Optional stealth meta-address for privacy modes

string | StealthMetaAddress

string

Optional sender wallet address for cross-curve refunds

string

Optional explicit recipient address for transparent mode (defaults to senderAddress)

Promise<ProductionQuote[]>

Array of quotes (with deposit info in production mode)


execute(intent, quote, options?): Promise<FulfillmentResult>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2372

Execute an intent with a selected quote

In production mode: initiates real swap via NEAR 1Click API In demo mode: returns mock result

TrackedIntent

The intent to execute

Selected quote from getQuotes()

Quote | ProductionQuote

Execution options

(depositAddress, amount) => Promise<string>

Callback when deposit is required

(status) => void

Callback for status updates

number

Timeout for waiting (ms)

Promise<FulfillmentResult>

Fulfillment result with transaction hash (when available)


generateViewingKey(path?): ViewingKey

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2383

Generate a viewing key for compliant mode

string

ViewingKey


deriveViewingKey(masterKey, childPath): ViewingKey

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2387

Derive a child viewing key

ViewingKey

string

ViewingKey


getNetwork(): "testnet" | "mainnet"

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:2391

Get network configuration

"testnet" | "mainnet"