ZcashShieldedService
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / ZcashShieldedService
Class: ZcashShieldedService
Section titled “Class: ZcashShieldedService”Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5334
Zcash Shielded Transaction Service
Provides high-level operations for Zcash shielded transactions with SIP Protocol integration.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ZcashShieldedService(
config):ZcashShieldedService
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5340
Parameters
Section titled “Parameters”config
Section titled “config”Returns
Section titled “Returns”ZcashShieldedService
Accessors
Section titled “Accessors”rpcClient
Section titled “rpcClient”Get Signature
Section titled “Get Signature”get rpcClient():
ZcashRPCClient
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5495
Get underlying RPC client for advanced operations
Returns
Section titled “Returns”currentAccount
Section titled “currentAccount”Get Signature
Section titled “Get Signature”get currentAccount():
number
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5499
Get current account number
Returns
Section titled “Returns”number
Methods
Section titled “Methods”initialize()
Section titled “initialize()”initialize():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5346
Initialize the service
Creates an account if needed and retrieves the default address.
Returns
Section titled “Returns”Promise<void>
getAddress()
Section titled “getAddress()”getAddress():
string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5354
Get the default shielded address
Returns
Section titled “Returns”string
generateNewAddress()
Section titled “generateNewAddress()”generateNewAddress():
Promise<string>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5360
Generate a new diversified address for the account
Each address is unlinkable but controlled by the same account.
Returns
Section titled “Returns”Promise<string>
validateAddress()
Section titled “validateAddress()”validateAddress(
address):Promise<ZcashAddressInfo>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5364
Validate an address
Parameters
Section titled “Parameters”address
Section titled “address”string
Returns
Section titled “Returns”Promise<ZcashAddressInfo>
isShieldedAddress()
Section titled “isShieldedAddress()”isShieldedAddress(
address):Promise<boolean>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5368
Check if an address is a shielded address
Parameters
Section titled “Parameters”address
Section titled “address”string
Returns
Section titled “Returns”Promise<boolean>
getBalance()
Section titled “getBalance()”getBalance(
minConf?):Promise<ShieldedBalance>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5372
Get shielded balance summary
Parameters
Section titled “Parameters”minConf?
Section titled “minConf?”number
Returns
Section titled “Returns”Promise<ShieldedBalance>
sendShielded()
Section titled “sendShielded()”sendShielded(
params):Promise<ShieldedSendResult>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5379
Send a shielded transaction
Parameters
Section titled “Parameters”params
Section titled “params”Send parameters
Returns
Section titled “Returns”Promise<ShieldedSendResult>
Send result with txid
sendWithPrivacy()
Section titled “sendWithPrivacy()”sendWithPrivacy(
to,amount,privacyLevel,memo?):Promise<ShieldedSendResult>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5385
Send shielded transaction with SIP integration
Higher-level method that handles privacy level mapping.
Parameters
Section titled “Parameters”string
amount
Section titled “amount”number
privacyLevel
Section titled “privacyLevel”string
Returns
Section titled “Returns”Promise<ShieldedSendResult>
getReceivedNotes()
Section titled “getReceivedNotes()”getReceivedNotes(
minConf?,onlySpendable?):Promise<ReceivedNote[]>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5392
Get received notes (incoming shielded transactions)
Parameters
Section titled “Parameters”minConf?
Section titled “minConf?”number
Minimum confirmations
onlySpendable?
Section titled “onlySpendable?”boolean
Only return spendable notes
Returns
Section titled “Returns”Promise<ReceivedNote[]>
getPendingNotes()
Section titled “getPendingNotes()”getPendingNotes():
Promise<ReceivedNote[]>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5396
Get pending (unconfirmed) incoming transactions
Returns
Section titled “Returns”Promise<ReceivedNote[]>
waitForNote()
Section titled “waitForNote()”waitForNote(
predicate,timeout?,pollInterval?):Promise<ReceivedNote>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5404
Wait for incoming note with specific criteria
Parameters
Section titled “Parameters”predicate
Section titled “predicate”(note) => boolean
Function to match the expected note
timeout?
Section titled “timeout?”number
Timeout in ms
pollInterval?
Section titled “pollInterval?”number
Poll interval in ms
Returns
Section titled “Returns”Promise<ReceivedNote>
exportViewingKey()
Section titled “exportViewingKey()”exportViewingKey(
address?):Promise<ExportedViewingKey>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5411
Export viewing key for an address
The viewing key allows monitoring incoming transactions without spending capability.
Parameters
Section titled “Parameters”address?
Section titled “address?”string
Returns
Section titled “Returns”Promise<ExportedViewingKey>
importViewingKey()
Section titled “importViewingKey()”importViewingKey(
viewingKey,rescan?,startHeight?):Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5417
Import viewing key for monitoring
Allows monitoring transactions to an address without spending.
Parameters
Section titled “Parameters”viewingKey
Section titled “viewingKey”string
rescan?
Section titled “rescan?”"yes" | "no" | "whenkeyisnew"
startHeight?
Section titled “startHeight?”number
Returns
Section titled “Returns”Promise<void>
exportForCompliance()
Section titled “exportForCompliance()”exportForCompliance():
Promise<{viewingKey:ExportedViewingKey;privacyLevel:PrivacyLevel;disclaimer:string; }>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5423
Export viewing key for compliance/audit
Specifically for SIP COMPLIANT privacy level.
Returns
Section titled “Returns”Promise<{ viewingKey: ExportedViewingKey; privacyLevel: PrivacyLevel; disclaimer: string; }>
getOperationStatus()
Section titled “getOperationStatus()”getOperationStatus(
operationId):Promise<ZcashOperation|null>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5431
Get status of an operation
Parameters
Section titled “Parameters”operationId
Section titled “operationId”string
Returns
Section titled “Returns”Promise<ZcashOperation | null>
listPendingOperations()
Section titled “listPendingOperations()”listPendingOperations():
Promise<ZcashOperation[]>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5435
List all pending operations
Returns
Section titled “Returns”Promise<ZcashOperation[]>
getBlockHeight()
Section titled “getBlockHeight()”getBlockHeight():
Promise<number>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5439
Get current block height
Returns
Section titled “Returns”Promise<number>
isTestnet()
Section titled “isTestnet()”isTestnet():
boolean
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5443
Check if connected to testnet
Returns
Section titled “Returns”boolean
estimateFee()
Section titled “estimateFee()”estimateFee(
recipients?,inputs?):number
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5476
Estimate transaction fee based on ZIP-317 conventional fee
The ZIP-317 fee is calculated as: fee = marginal_fee * max(grace_actions, logical_actions)
For shielded transactions:
- Each Sapling spend = 1 logical action
- Each Sapling output = 1 logical action
- Each Orchard action = 1 logical action (covers both spend and output)
Parameters
Section titled “Parameters”recipients?
Section titled “recipients?”number
Number of recipients (outputs)
inputs?
Section titled “inputs?”number
Estimated number of input notes (default: 1)
Returns
Section titled “Returns”number
Estimated fee in ZEC
Example
Section titled “Example”// Estimate fee for 1 recipientconst fee = service.estimateFee(1)
// Estimate fee for 3 recipients with 2 input notesconst fee = service.estimateFee(3, 2)getMinimumFee()
Section titled “getMinimumFee()”getMinimumFee():
number
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:5482
Get minimum fee for a shielded transaction
Returns
Section titled “Returns”number
Minimum fee in ZEC (ZIP-317 with grace actions)