SIP
SIP Protocol API Reference v0.7.2
SIP Protocol API Reference / SIP
Class: SIP
Section titled “Class: SIP”Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2224
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
Examples
Section titled “Examples”import { SIP, PrivacyLevel } from '@sip-protocol/sdk'
// Initialize clientconst sip = new SIP({ network: 'testnet' })
// Create a shielded intentconst 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 solversconst quotes = await sip.getQuotes(intent)
// Execute with best quoteconst result = await sip.execute(intent, quotes[0])console.log('Swap completed:', result.txHash)import { SIP, PrivacyLevel, MockProofProvider } from '@sip-protocol/sdk'
// Initialize with production backendconst sip = new SIP({ network: 'mainnet', mode: 'production', proofProvider: new MockProofProvider(), // Use NoirProofProvider in prod intentsAdapter: { jwtToken: process.env.NEAR_INTENTS_JWT, },})
// Connect walletsip.connect(myWalletAdapter)
// Generate stealth keys for receivingconst stealthMetaAddress = sip.generateStealthKeys('ethereum', 'My Privacy Wallet')
// Create intent with stealth recipientconst 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 quotesconst quotes = await sip.getQuotes(intent)
// Execute with deposit callbackconst 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),})- SIPConfig for configuration options
- createShieldedIntent for intent creation
- PrivacyLevel for privacy modes
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SIP(
config):SIP
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2257
Create a new SIP SDK client
Parameters
Section titled “Parameters”config
Section titled “config”Configuration options for the client
Returns
Section titled “Returns”SIP
Throws
Section titled “Throws”If configuration is invalid
Examples
Section titled “Examples”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', },})Methods
Section titled “Methods”getMode()
Section titled “getMode()”getMode():
"demo"|"production"
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2261
Get the current mode
Returns
Section titled “Returns”"demo" | "production"
isProductionMode()
Section titled “isProductionMode()”isProductionMode():
boolean
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2265
Check if running in production mode with real NEAR Intents
Returns
Section titled “Returns”boolean
getIntentsAdapter()
Section titled “getIntentsAdapter()”getIntentsAdapter():
NEARIntentsAdapter|undefined
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2269
Get the NEAR Intents adapter
Returns
Section titled “Returns”NEARIntentsAdapter | undefined
setIntentsAdapter()
Section titled “setIntentsAdapter()”setIntentsAdapter(
adapter):void
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2273
Set the NEAR Intents adapter
Parameters
Section titled “Parameters”adapter
Section titled “adapter”NEARIntentsAdapter | NEARIntentsAdapterConfig
Returns
Section titled “Returns”void
getProofProvider()
Section titled “getProofProvider()”getProofProvider():
ProofProvider|undefined
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2277
Get the configured proof provider
Returns
Section titled “Returns”ProofProvider | undefined
setProofProvider()
Section titled “setProofProvider()”setProofProvider(
provider):void
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2281
Set or update the proof provider
Parameters
Section titled “Parameters”provider
Section titled “provider”Returns
Section titled “Returns”void
hasProofProvider()
Section titled “hasProofProvider()”hasProofProvider():
boolean
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2285
Check if proof provider is available and ready
Returns
Section titled “Returns”boolean
connect()
Section titled “connect()”connect(
wallet):void
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2289
Connect a wallet
Parameters
Section titled “Parameters”wallet
Section titled “wallet”Returns
Section titled “Returns”void
disconnect()
Section titled “disconnect()”disconnect():
void
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2293
Disconnect wallet
Returns
Section titled “Returns”void
isConnected()
Section titled “isConnected()”isConnected():
boolean
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2297
Check if wallet is connected
Returns
Section titled “Returns”boolean
getWallet()
Section titled “getWallet()”getWallet():
WalletAdapter|undefined
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2301
Get connected wallet
Returns
Section titled “Returns”WalletAdapter | undefined
generateStealthKeys()
Section titled “generateStealthKeys()”generateStealthKeys(
chain,label?):StealthMetaAddress
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2307
Generate and store stealth keys for this session
Parameters
Section titled “Parameters”label?
Section titled “label?”string
Returns
Section titled “Returns”Throws
Section titled “Throws”If chain is invalid
getStealthAddress()
Section titled “getStealthAddress()”getStealthAddress():
string|undefined
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2311
Get the encoded stealth meta-address for receiving
Returns
Section titled “Returns”string | undefined
intent()
Section titled “intent()”intent():
IntentBuilder
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2327
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.
Returns
Section titled “Returns”Example
Section titled “Example”const intent = await sip.intent() .input('near', 'NEAR', 100n) .output('zcash', 'ZEC', 95n) .privacy(PrivacyLevel.SHIELDED) .build()createIntent()
Section titled “createIntent()”createIntent(
params,options?):Promise<TrackedIntent>
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2334
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.
Parameters
Section titled “Parameters”params
Section titled “params”options?
Section titled “options?”allowPlaceholders?
Section titled “allowPlaceholders?”boolean
Allow placeholder signatures for proof generation (demo/testing only)
ownershipSignature?
Section titled “ownershipSignature?”Uint8Array<ArrayBufferLike>
Ownership signature proving wallet control
senderSecret?
Section titled “senderSecret?”Uint8Array<ArrayBufferLike>
Sender secret for nullifier derivation
authorizationSignature?
Section titled “authorizationSignature?”Uint8Array<ArrayBufferLike>
Authorization signature for this intent
Returns
Section titled “Returns”Promise<TrackedIntent>
getQuotes()
Section titled “getQuotes()”getQuotes(
params,recipientMetaAddress?,senderAddress?,transparentRecipient?):Promise<ProductionQuote[]>
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2356
Get quotes for an intent
In production mode: fetches real quotes from NEAR 1Click API In demo mode: returns mock quotes for testing
Parameters
Section titled “Parameters”params
Section titled “params”Intent parameters (CreateIntentParams for production, ShieldedIntent/CreateIntentParams for demo)
ShieldedIntent | CreateIntentParams
recipientMetaAddress?
Section titled “recipientMetaAddress?”Optional stealth meta-address for privacy modes
string | StealthMetaAddress
senderAddress?
Section titled “senderAddress?”string
Optional sender wallet address for cross-curve refunds
transparentRecipient?
Section titled “transparentRecipient?”string
Optional explicit recipient address for transparent mode (defaults to senderAddress)
Returns
Section titled “Returns”Promise<ProductionQuote[]>
Array of quotes (with deposit info in production mode)
execute()
Section titled “execute()”execute(
intent,quote,options?):Promise<FulfillmentResult>
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2368
Execute an intent with a selected quote
In production mode: initiates real swap via NEAR 1Click API In demo mode: returns mock result
Parameters
Section titled “Parameters”intent
Section titled “intent”The intent to execute
Selected quote from getQuotes()
options?
Section titled “options?”Execution options
onDepositRequired?
Section titled “onDepositRequired?”(depositAddress, amount) => Promise<string>
Callback when deposit is required
onStatusUpdate?
Section titled “onStatusUpdate?”(status) => void
Callback for status updates
timeout?
Section titled “timeout?”number
Timeout for waiting (ms)
Returns
Section titled “Returns”Promise<FulfillmentResult>
Fulfillment result with transaction hash (when available)
generateViewingKey()
Section titled “generateViewingKey()”generateViewingKey(
path?):ViewingKey
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2379
Generate a viewing key for compliant mode
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”deriveViewingKey()
Section titled “deriveViewingKey()”deriveViewingKey(
masterKey,childPath):ViewingKey
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2383
Derive a child viewing key
Parameters
Section titled “Parameters”masterKey
Section titled “masterKey”childPath
Section titled “childPath”string
Returns
Section titled “Returns”getNetwork()
Section titled “getNetwork()”getNetwork():
"testnet"|"mainnet"
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2387
Get network configuration
Returns
Section titled “Returns”"testnet" | "mainnet"
executeSameChain()
Section titled “executeSameChain()”executeSameChain(
chain,params):Promise<SameChainExecuteResult>
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2430
Execute a same-chain private transfer
Bypasses cross-chain settlement for direct on-chain privacy transfers. Currently supports Solana only.
Parameters
Section titled “Parameters”Chain to execute on (must be ‘solana’)
params
Section titled “params”Transfer parameters
Returns
Section titled “Returns”Promise<SameChainExecuteResult>
Transfer result with stealth address
Example
Section titled “Example”const result = await sip.executeSameChain('solana', { recipientMetaAddress: { chain: 'solana', spendingKey: '0x...', viewingKey: '0x...', }, amount: 5_000_000n, // 5 USDC token: 'USDC', connection, sender: wallet.publicKey, signTransaction: wallet.signTransaction,})
console.log('Sent to stealth:', result.stealthAddress)isSameChainSupported()
Section titled “isSameChainSupported()”isSameChainSupported(
chain):boolean
Defined in: @sip-protocol/sdk/dist/index-CzWPI6Le.d.ts:2434
Check if same-chain privacy is supported for a chain
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean