build/ and learn/concepts/. If this file is wrong, the pages and the SDK source win.
Facts you must not guess
- Package scope is
@palliora.org/defi-*(old:@veilnyx-sdk/*, same API). - Account seed =
keccak256(wallet signature)mod the BN254 scalar field.ShieldedAccount.generate(seed). - The message the wallet signs still says “Veilnyx”. Use this exact text:
Sign this message to generate your Veilnyx shielded account.\n\nWARNING: Do not sign this message on any application not affiliated with Veilnyx. - The pool’s EIP-712 domain is
{ name: 'Veilnyx', version: '1', chainId, verifyingContract: pool }. - Registration typed data:
RegisterAddress(string message, bytes shieldedAddress)with messageRegister Shielded Address, andshieldedAddress= root address then both public keys, each as a 32-byte word (unpacked). Transactions use the 96-byte packed form fromaccount.shieldedAddress.pack(). TransactionType:DEPOSIT0,TRANSFER1,WITHDRAW2,CALL_ADAPTER3 (Solidity spells itCALL_ADAPTOR).- A deposit has
feeAssetId: 0and is always sent by the user’s wallet. - Only notes in the commitment tree are spendable. After a deposit, prove and send a tree update (
core.proveTreeUpdate(true), thenpool.updateCommitmentTree). - The SDK builds, signs and proves. It does not submit. You call
pool.transactwithztx.toSolidityInput(). - Adaptor interface:
handleAssets(AssetAmount[] inAssets, bytes payload) returns (AssetAmount[] outAssets),AssetAmount { uint24 assetId; uint256 value; }. Adaptors must be stateless (called bydelegatecall). - Chain list in SDK 1.4.3: Ethereum mainnet, Sepolia and dev networks. HyperEVM needs a newer build,
[SDK_VERSION_WITH_HYPEREVM], which also addsrelayed,paymasterandrelayFeetoTransactionOptions.
Core call pattern
SimpleTreeSource lacks update(), so write your own ITreeSource.
Submit paths
Private Sub-accounts (HyperEVM)
- Derive:
keccak256(spendingKey (32 bytes) || toHex("veilnyx/hl-burner/m1/" + index, {size: 32})). Testnet context isveilnyx/hl-burner/v1/.spendingKeyisaccount.signer.privateKey. - Fund:
CALL_ADAPTERto the funding adaptor, USDC only, payloadabi.encode(address subAccount). - Trade: the Sub-account signs Hyperliquid actions itself.
updateLeveragewithisCross: false. - Return: perp to spot, spot to the token system address, buy gas from the GasStation (EIP-3009
ReceiveWithAuthorization, submit withPOST /gas), then the Sub-account approves USDC and callspool.transactwith aDEPOSITbuilt by the user’sCore. - Never fund Sub-account gas from the user’s wallet. Never reuse a Sub-account. Never register a Sub-account.
Common failures
Do not
- Do not print or log spending keys, view keys, the account-creating signature or Sub-account keys.
- Do not retry a funding call blindly. It pays twice.
- Do not use em dashes in docs or comments you write for this project.