Core SDK
PrivacyProtocolSDK is the low-level API for private deposits, actions, withdrawals, and relay metadata.
Constructor
new PrivacyProtocolSDK(provider, poolAddress);Optional override:
new PrivacyProtocolSDK(provider, poolAddress, undefined, {
relayer: {
url: "https://your-relayer.example.com",
relayerAddress: "0xYourRelayerAddress",
},
});Main Methods
deposit
const result = await sdk.deposit(token, amount, signer);Returns:
{
secret: string;
nullifier: string;
commitment: string;
txHash: string;
}executeAction
const result = await sdk.executeAction(
token,
amount,
target,
data,
actionId,
secret,
nullifier,
amountInPool,
leaves,
signer
);actionId must be keccak256(secret).
withdraw
const result = await sdk.withdraw(
token,
recipient,
amount,
secret,
nullifier,
amountInPool,
leaves,
signer
);getLeaves
const leaves = await sdk.getLeaves();getPrivateTransactionDetails
const details = await sdk.getPrivateTransactionDetails(txHashOrRelayId);Accepts both:
relay:<request_id>- on-chain
0x...hash
Last updated on