Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.
@polygonlabs/oms-wallet-privacy adds a private balance to the active Ethereum wallet. Shielding moves tokens from the wallet into its private balance, unshielding moves them from the private balance to any address, and a private send pays a recipient with no onchain link to the sender.Every privacy operation requires an active Ethereum wallet session and acts for the wallet that was active when it was called.
Private balances exist only on mainnets. Every operation moves real funds and pays real fees.
The package is ESM-only and requires @polygonlabs/oms-wallet 0.5 or later. It runs in browsers through a bundler and in Node 22 without polyfills or bundler settings. It loads its privacy library, about 2 MB gzipped, on the first private-balance call.
Add the extension
Pass privacy() to OMSWallet.extend. It returns a new OMSWallet with an omsWallet.privacy member; wallet and indexer are the same objects as on the original instance.
import { OMSWallet } from '@polygonlabs/oms-wallet'import { privacy } from '@polygonlabs/oms-wallet-privacy'export const omsWallet = new OMSWallet({ publishableKey: 'YOUR_PUBLISHABLE_KEY',}).extend(privacy())
Authenticate and select an Ethereum wallet with omsWallet.wallet as described in authentication.
Supported networks and tokens
Private balances are available on Ethereum, BNB Chain, Polygon, Base, and Arbitrum. omsWallet.privacy.networks lists them as Network values.Tokens are contract addresses. Use 0x0000000000000000000000000000000000000000 for the network’s native token. Amounts are bigint values in the token’s base units.
Quote, then confirm
Every operation starts with a quote. Show the quote to the user, then pass it to the matching call.
amount is what arrives, fee is the privacy fee in the same token, and total is amount + fee: what leaves the wallet or the private balance. Shielding has no privacy fee. Network fees are separate.A quote is valid for 5 minutes, can be used once, and only for the wallet that was active when it was made. Otherwise the call fails with OMS_PRIVACY_QUOTE_INVALID; request a new quote.
Send privately
A private send deposits total from the wallet into the sender’s private balance and authorizes a payment of amount to to. The privacy service delivers it later.
const quote = await omsWallet.privacy.quotePrivateSend({ network: Networks.polygon, token: usdc, amount: 1_000_000n, to: '0x1111111111111111111111111111111111111111',})const sent = await omsWallet.privacy.privateSend(quote)console.log(sent.deliveryId)
Unshield
Unshielding pays from the private balance to to, or to the active wallet when to is omitted.
Unshielding sends no wallet transaction. The privacy service submits the withdrawal, and its fee is part of the quote.
Pay network fees
shield and privateSend send up to three wallet transactions: an allowance reset to 0, an approval of exactly total, and the deposit. Steps that are not needed are skipped, and native-token deposits need no approval. The result’s transactions lists every transaction sent, in order, with its networkFee when one was paid. Sponsored transactions have no networkFee.By default, each transaction’s network fee is paid in the token being moved. If the wallet cannot pay it on top of total, the call fails with OMS_PRIVACY_NETWORK_FEE before that transaction executes. Pass selectFeeOption to choose another fee token, as described in send transactions, or maxNetworkFee to cap the fee each transaction may pay in the moved token.
import { FeeOptionSelector } from '@polygonlabs/oms-wallet'await omsWallet.privacy.shield(quote, { selectFeeOption: FeeOptionSelector.firstAvailable,})
To store each transaction ID before it is submitted, pass onProgress. Each wallet transaction reports prepared with its txnId before execution and confirmed once it executed. The SDK awaits the callback for prepared events; if it throws or rejects, that transaction is not executed.
await omsWallet.privacy.shield(quote, { onProgress: (event) => { if (event.step !== 'delivery' && event.state === 'prepared') { // Store event.txnId durably. Return a promise to hold execution until it is stored. } },})
Track delivery
deliveryId identifies a private send’s delivery. Treat it as private, because it reveals the delivery. Check its status with getDeliveryStatus:
To wait for delivery instead, pass waitForDelivery: true. The SDK polls every 3 seconds for up to 15 minutes and returns the delivered status in delivery. Override these values with deliveryPolling.
While waiting, a failed delivery throws OMS_PRIVACY_DELIVERY_FAILED, and a delivery that does not finish in time throws OMS_PRIVACY_DELIVERY_TIMEOUT. A timed-out delivery can still finish; check it later with getDeliveryStatus.
Read balances and recover funds
getBalances returns the active wallet’s private balances with a non-zero amount, across every supported network unless you pass networks.
amount is spendable. recoverable holds private sends that were deposited but not delivered. When a delivery fails, its funds stay there until you call recover, which pays all recoverable funds of one token back to the active wallet:
Funds also show as recoverable while a delivery is pending. recover and the delivery spend the same funds, so only one of them goes through. Like unshielding, recover sends no wallet transaction.
Handle errors
Every failure is an OMSWalletPrivacyError. It has a code, the operation, the stage the operation reached, if any, and txnIds: every wallet transaction the operation created. When a private send fails after its deposit, the error can also carry its deliveryId.
For shield and privateSend, an empty txnIds means no wallet transaction was sent, and you can request a new quote and try again. Otherwise, check each ID with omsWallet.wallet.getTransactionStatus({ txnId }), then call getBalances for funds to recover. A failed or timed-out call never sends a deposit again on its own.Do not send a private send again when its error carries a deliveryId: the send went through, and only its delivery status is unknown. The same applies to an OMS_PRIVACY_SERVICE_ERROR at the delivery stage without a deliveryId: the deposit executed and the delivery may still happen.unshield and recover send no wallet transaction, so their txnIds is always empty. When the error message says the withdrawal may have been submitted, check getBalances before trying again.If the active wallet changes or signs out while an operation runs, even when the same wallet becomes active again, the operation stops with OMS_PRIVACY_WALLET_CHANGED. Balance reads and quotes fail the same way instead of returning results for a wallet that is no longer active.
Keys and trust
The private balance’s keys are derived from the wallet’s signature over a fixed message. A connected dApp, such as one using the wagmi connector, cannot request that signature; code running in your application can. Setting up keys sends no wallet transaction.The keys stay the same when the wallet is deployed or its configuration changes, for example when remote access is granted, revoked, or expires. The package stores a fingerprint of the derived keys and stops with OMS_PRIVACY_KEY_MISMATCH if they change, instead of showing an empty balance. It stores the fingerprint in localStorage in browsers and in memory elsewhere; pass privacy({ storage }) to use your own StorageManager. A change is detected only where a fingerprint was stored before.The privacy service generates proofs remotely and receives the private balance’s viewing key, so it can see private balances and history. It cannot move funds: withdrawals are authorized by a spending key that stays on the device and signs the recipient, amount, and fee. The service delivers private sends on its own schedule.Deposit transactions can only approve and call allowlisted contracts, and the approval is exactly total, so a deposit can move at most total. Operations for one wallet run one at a time within a page.
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Polygon Developer Docs","colors":{"primary":"#670DE5","light":"#9551F5","dark":"#500AB2"},"logo":{"light":"https://mintcdn.com/polygon-labs/ll1LL3IdpC3YxXZu/logo/light.svg?fit=max\u0026auto=format\u0026n=ll1LL3IdpC3YxXZu\u0026q=85\u0026s=d54ddb30492807a0eadf38093c075f2f","dark":"https://mintcdn.com/polygon-labs/ll1LL3IdpC3YxXZu/logo/dark.svg?fit=max\u0026auto=format\u0026n=ll1LL3IdpC3YxXZu\u0026q=85\u0026s=3b2b67f82ff1720328da11b176a86499"},"favicon":"https://mintcdn.com/polygon-labs/Xy_MJE0q00vmTroE/favicon.svg?fit=max\u0026auto=format\u0026n=Xy_MJE0q00vmTroE\u0026q=85\u0026s=3c26f9a9ab4a7a50ac3da5c9ad26c954","api":{"openapi":"api-reference/openapi.yaml","params":{"expanded":"all"},"playground":{"display":"interactive"},"mdx":{"server":["https://sandbox-api.polygon.technology/v0.13","https://api.polygon.technology/v0.13"]}},"appearance":{"default":"light"},"navbar":{"links":[{"href":"/resources/build-with-ai","label":"Build with AI"},{"href":"https://polygon.technology/get-access?utm_source=docs\u0026utm_medium=navbar\u0026utm_campaign=oms_access","label":"Request OMS Access"}]},"footer":{"socials":{"x":"https://x.com/0xPolygon","github":"https://github.com/0xPolygon","linkedin":"https://www.linkedin.com/company/polygonlabs","discord":"https://discord.com/invite/polygon-support-635865020172861441"},"links":[{"items":[{"label":"Support","href":"https://support.polygon.technology/support/home"}]}]},"fonts":{"family":"Fustat"},"integrations":{"ga4":{"measurementId":"G-RJ6JC0EEY5"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"polygon-labs","hasAudioNarration":false,"actualSubdomain":"polygon-labs","customDomains":["docs.polygon.technology"],"gitSource":{"type":"github","owner":"0xpolygon","repo":"new-polygon-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"contextualFeedback":{"allowEmail":true},"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b0040fc286e5a4832619fd8","clientVersion":"0.0.4227","searchFilterCounts":[{"language":"default","tag":"Developer Docs","count":489},{"language":"default","tag":"Polygon Chain","count":383},{"language":"default","tag":"Wallets","count":176},{"language":"default","tag":"Developer Tools","count":93},{"language":"default","tag":"API Reference","count":92},{"language":"default","tag":"Agglayer","count":73},{"language":"default","tag":"Platform","count":71},{"language":"default","tag":"Non-custodial","count":61},{"language":"default","tag":"Matic.js","count":59},{"language":"default","tag":"SDK","count":55}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@polygon.technology","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[{"_id":"69cbd3d67f226f107dbd9b72","deploymentId":"69a9bcc427671ec5a2e05f92","questionText":"Can I move assets between different chains with OMS?","status":"active","generatedBy":"manual","createdAt":"2026-03-31T14:01:58.134Z","updatedAt":"2026-03-31T14:01:58.134Z","__v":0},{"_id":"69cbd3b07f226f107dbd9a9b","deploymentId":"69a9bcc427671ec5a2e05f92","questionText":"What are my options for integrating a wallet?","status":"active","generatedBy":"manual","createdAt":"2026-03-31T14:01:20.206Z","updatedAt":"2026-03-31T14:01:20.206Z","__v":0},{"_id":"69cbd3737f226f107dbd9910","deploymentId":"69a9bcc427671ec5a2e05f92","questionText":"How does KYC / KYB work in OMS?","status":"active","generatedBy":"manual","createdAt":"2026-03-31T14:00:19.974Z","updatedAt":"2026-03-31T14:00:19.974Z","__v":0}],"googleFontsInlined":true},"customCss":[{"filePath":"custom.css","content":".nav-tabs{gap:0!important;align-items:center!important}div:has(>.nav-tabs){height:58px!important}.nav-tabs a.nav-tabs-item{padding:7px 12px!important;font-size:14px;font-weight:500;color:#64708F!important;transition:color 120ms ease, background 120ms ease}.nav-tabs a.nav-tabs-item:hover{color:#141635!important}html.dark .nav-tabs a.nav-tabs-item{color:rgba(255, 255, 255, 0.55)!important}html.dark .nav-tabs a.nav-tabs-item:hover{color:#fff!important}.fam-grp{display:inline-flex;align-items:center;gap:4px}.fam-gap{width:1px;height:22px;background:#DFE3F0;margin:0 16px;flex-shrink:0}.fam-grp .nav-tabs-item>div{display:none!important}.fam-grp .nav-tabs-item{padding:7px 12px!important;border-radius:8px;font-size:14px;font-weight:500;color:#64708F!important;white-space:nowrap;text-decoration:none;transition:color 120ms ease, background 120ms ease!important}.fam-grp .nav-tabs-item:hover{color:#141635!important}.fam-grp .nav-tabs-item.fam-active-tab{background:#EAE4F5!important;color:#500AB2!important;font-weight:500!important}.fam-grp .nav-tabs-item.fam-active-tab svg{color:#500AB2!important}html.dark .fam-gap{background:rgba(255, 255, 255, 0.14)}html.dark .fam-grp .nav-tabs-item{color:rgba(255, 255, 255, 0.55)!important}html.dark .fam-grp .nav-tabs-item:hover{color:#fff!important}html.dark .fam-grp .nav-tabs-item.fam-active-tab{background:rgba(103, 13, 229, 0.22)!important;color:#A78BFA!important}html.dark .fam-grp .nav-tabs-item.fam-active-tab svg{color:#A78BFA!important}#navbar a[href*=\"build-with-ai\"]{background:#fff!important;color:#141635!important;border:1px solid #C8CFE1!important;font-weight:600!important;transition:border-color 140ms ease, background 140ms ease!important}#navbar a[href*=\"build-with-ai\"]:hover{border-color:#141635!important;background:#F6F6FC!important}html.dark #navbar a[href*=\"build-with-ai\"]{background:transparent!important;color:#fff!important;border-color:rgba(255, 255, 255, 0.25)!important}html.dark #navbar a[href*=\"build-with-ai\"]:hover{border-color:#fff!important;background:rgba(255, 255, 255, 0.06)!important}#navbar a[href*=\"get-access\"]{background:#0B0814!important;color:#fff!important;border:1px solid #0B0814!important;transition:background 140ms ease!important}#navbar a[href*=\"get-access\"]:hover{background:#2A2640!important}html.dark #navbar a[href*=\"get-access\"]{background:#FFFFFF!important;color:#0B0814!important;border-color:#FFFFFF!important}html.dark #navbar a[href*=\"get-access\"]:hover{background:#E5E7EB!important;border-color:#E5E7EB!important}#sidebar-content a.text-primary,#sidebar-content a[class*=\"text-primary-light\"]{background-color:transparent!important}#sidebar-content a:not(.text-primary):not([class*=\"text-primary-light\"]):hover{background-color:rgba(103, 13, 229, 0.06)!important}#content-area:has(.api-section) #page-title{font-size:1.75rem;line-height:2.25rem}#content-area:has(.api-section) #header .prose{font-size:0.9375rem;line-height:1.6}@container page-header (min-width: 520px){#content-area:has(.api-section) #header:has(.eyebrow) .eyebrow{display:flex;align-items:center;min-height:2.25rem;padding-right:11rem}#content-area:has(.api-section) #header:has(.eyebrow) .eyebrow~div:has(#page-context-menu){position:static}#content-area:has(.api-section) #header:has(.eyebrow) .eyebrow~div #page-context-menu{position:absolute;top:0;right:0;margin:0}}.api-section[data-api-section=\"authorizations\"]:has(+.api-section[data-api-section=\"headers\"]) .api-section-heading-title{font-size:0}.api-section[data-api-section=\"authorizations\"]:has(+.api-section[data-api-section=\"headers\"]) .api-section-heading-title::after{content:\"Authorization and headers\";font-size:1.125rem}.api-section[data-api-section=\"authorizations\"]+.api-section[data-api-section=\"headers\"] .api-section-heading{display:none}.api-section[data-api-section=\"authorizations\"]:has(+.api-section[data-api-section=\"headers\"]) .primitive-param-field:last-child{border-bottom-width:1px}.api-section .api-section-heading .border-b,.api-section .primitive-param-field{border-color:#D1D5DB}html.dark .api-section .api-section-heading .border-b,html.dark .api-section .primitive-param-field{border-color:#374151}.api-section .primitive-param-field>.py-6{padding-top:0.875rem;padding-bottom:0.875rem}.api-section .primitive-param-field .mt-4{margin-top:0.5rem}@media (min-width: 1600px){#body-content:has(.api-section){max-width:1760px}#body-content:has(.api-section) #content-container{max-width:1440px}}"},{"filePath":"oms-visuals.css","content":"@font-face{font-family:\"Fustat\";src:url(\"/fonts/Fustat-VariableFont_wght.woff2\") format(\"woff2\");font-weight:200 900;font-style:normal;font-display:swap}@font-face{font-family:\"Geist Mono\";src:url(\"/fonts/GeistMono-VariableFont_wght.woff2\") format(\"woff2\");font-weight:100 900;font-style:normal;font-display:swap}.oms-v{--oms-purple-50: #f6f3fb;--oms-purple-100: #eae4f5;--oms-purple-200: #d5c4f2;--oms-purple-300: #b78eef;--oms-purple-400: #9551f5;--oms-purple-500: #670de5;--oms-purple-600: #500ab2;--oms-purple-700: #400a8e;--oms-slate-50: #f6f6fc;--oms-slate-100: #eef0f9;--oms-slate-200: #dfe3f0;--oms-slate-300: #c8cfe1;--oms-slate-400: #929eba;--oms-slate-500: #64708f;--oms-slate-600: #48526f;--oms-slate-700: #363e5c;--oms-slate-800: #222744;--oms-slate-900: #141635;--oms-slate-950: #090624;--oms-btn-primary: #090624;--oms-btn-primary-hover: #222744;--oms-btn-primary-text: #ffffff;--ss-font: \"Fustat\", \"Inter\", system-ui, sans-serif;--ss-mono: \"Geist Mono\", \"JetBrains Mono\", ui-monospace, monospace;--ss-accent: #670de5;--ss-accent-2: #9551f5;--ss-accent-soft: #eae4f5;--ss-accent-text: #500ab2;--ss-canvas: #f6f6fc;--ss-well: #f6f6fc;--ss-surface: #ffffff;--ss-raised: #ffffff;--ss-chrome: #ffffff;--ss-fill: #eef0f9;--ss-line: #c8cfe1;--ss-line-faint: #dfe3f0;--ss-text-strong: #141635;--ss-text: #48526f;--ss-text-faint: #64708f;--ss-icon: #48526f;--ss-icon-faint: #929eba;--ss-ink-1: rgba(20, 22, 53, 0.04);--ss-ink-2: rgba(20, 22, 53, 0.06);--ss-ink-3: rgba(20, 22, 53, 0.08);--ss-ink-4: rgba(20, 22, 53, 0.10);--ss-ink-5: rgba(20, 22, 53, 0.15);--ss-success: #10b981;--ss-success-soft: #ecfdf5;--ss-success-text: #047857;--ss-warning: #b45309;--ss-warning-soft: #fff7ed;--ss-warning-text: #b45309;--ss-danger: #dc2626;--ss-danger-soft: #fef2f2;--ss-danger-text: #b91c1c;--ss-radius-sm: 6px;--ss-radius-md: 8px;--ss-radius-lg: 12px;--ss-radius-window: 12px;--ss-radius-pill: 999px;--ss-shadow-window: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.08);--ss-shadow-float: 0px 4px 6px -4px rgba(0, 0, 0, 0.1), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--ss-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);--ss-shadow-hero: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 30px 60px -12px rgba(50, 50, 93, 0.25), 0 18px 36px -18px rgba(0, 0, 0, 0.3);--ss-shadow-lift: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 12px 28px -6px rgba(50, 50, 93, 0.28), 0 6px 12px -6px rgba(0, 0, 0, 0.16);--ss-shadow-satellite: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 14px 32px -8px rgba(50, 50, 93, 0.24), 0 4px 10px -4px rgba(0, 0, 0, 0.1);--ss-shadow-ground: 0 0 0 1px rgba(50, 50, 93, 0.06), 0 24px 48px -24px rgba(50, 50, 93, 0.18);--ss-ease: cubic-bezier(0.16, 1, 0.3, 1);font-family:var(--ss-font);color:var(--ss-text);-webkit-font-smoothing:antialiased}html.dark .oms-v{--oms-btn-primary: #ffffff;--oms-btn-primary-hover: #e5e7eb;--oms-btn-primary-text: #090624;--ss-accent: #9551f5;--ss-accent-2: #b78eef;--ss-accent-soft: rgba(149, 81, 245, 0.16);--ss-accent-text: #b78eef;--ss-canvas: #0b0a10;--ss-well: #131218;--ss-surface: #1a1922;--ss-raised: #23212d;--ss-chrome: #16151d;--ss-fill: #2a2834;--ss-line: rgba(255, 255, 255, 0.10);--ss-line-faint: rgba(255, 255, 255, 0.06);--ss-text-strong: #eef0f9;--ss-text: #c8cfe1;--ss-text-faint: #929eba;--ss-icon: #c8cfe1;--ss-icon-faint: #64708f;--ss-ink-1: rgba(255, 255, 255, 0.05);--ss-ink-2: rgba(255, 255, 255, 0.07);--ss-ink-3: rgba(255, 255, 255, 0.10);--ss-ink-4: rgba(255, 255, 255, 0.13);--ss-ink-5: rgba(255, 255, 255, 0.20);--ss-success: #34d399;--ss-success-soft: rgba(16, 185, 129, 0.16);--ss-success-text: #34d399;--ss-shadow-window: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 16px rgba(0, 0, 0, 0.4);--ss-shadow-float: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 4px 16px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.3);--ss-shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.05);--ss-shadow-hero: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 60px -12px rgba(0, 0, 0, 0.6);--ss-shadow-lift: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 12px 28px -6px rgba(0, 0, 0, 0.6);--ss-shadow-satellite: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 14px 32px -8px rgba(0, 0, 0, 0.7), 0 4px 10px -4px rgba(0, 0, 0, 0.5);--ss-shadow-ground: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 24px 48px -24px rgba(0, 0, 0, 0.6)}.oms-v-fit{position:relative;width:100%}.oms-v-stage{position:absolute;top:0;left:0;transform-origin:0 0;overflow:hidden}.oms-v *,.oms-v *::before,.oms-v *::after{box-sizing:border-box}.oms-v :where(h1,h2,h3,h4,p,ul,ol){margin:0}.oms-v .oms-badge{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:4px 8px;border-radius:16px;border:0.5px solid transparent;font-family:var(--ss-font);font-weight:500;font-size:12px;line-height:1;white-space:nowrap;text-box:trim-both cap alphabetic}.oms-v .oms-badge--info{background:#f6f3fb;border-color:#d5c4f2;color:#500ab2}.oms-v .oms-badge--neutral{background:#f6f6fc;border-color:#c8cfe1;color:#141635}.oms-v .oms-badge--success{background:#ecfdf5;border-color:#a7f3d0;color:#047857}.oms-v .oms-badge--warning{background:#fff7ed;border-color:#fed7aa;color:#b45309}.oms-v .oms-badge--danger{background:#fef2f2;border-color:#fecaca;color:#b91c1c}html.dark .oms-v .oms-badge--info{background:rgba(149, 81, 245, 0.14);border-color:rgba(183, 142, 239, 0.35);color:#c9b0f5}html.dark .oms-v .oms-badge--neutral{background:rgba(255, 255, 255, 0.05);border-color:rgba(255, 255, 255, 0.14);color:#c8cfe1}html.dark .oms-v .oms-badge--success{background:rgba(16, 185, 129, 0.14);border-color:rgba(52, 211, 153, 0.35);color:#6ee7b7}html.dark .oms-v .oms-badge--warning{background:rgba(251, 191, 36, 0.12);border-color:rgba(251, 191, 36, 0.3);color:#fcd34d}html.dark .oms-v .oms-badge--danger{background:rgba(248, 113, 113, 0.12);border-color:rgba(248, 113, 113, 0.3);color:#fca5a5}.oms-v .oms-phone{position:relative;flex-shrink:0;--oms-phone-glass: #0b0b0c;--oms-phone-rim: #2c2c2d;--oms-phone-band-1: #e3e3e6;--oms-phone-band-2: #9a9ba0;--oms-phone-band-3: #cfd0d4;--oms-phone-band-4: #85868b;--oms-phone-band-5: #c9cacd;box-shadow:0 calc(var(--ps) * 40) calc(var(--ps) * 80) calc(var(--ps) * -16) rgba(50, 50, 93, 0.25),\n 0 calc(var(--ps) * 24) calc(var(--ps) * 48) calc(var(--ps) * -24) rgba(0, 0, 0, 0.3)}html.dark .oms-v .oms-phone{--oms-phone-band-1: #5b5c61;--oms-phone-band-2: #2b2c2f;--oms-phone-band-3: #48494d;--oms-phone-band-4: #232427;--oms-phone-band-5: #404145}.oms-v .oms-phone__bands{position:absolute;inset:0;overflow:visible;pointer-events:none}.oms-v .oms-phone__glass{position:relative;height:100%}.oms-v .oms-phone__window{position:relative;overflow:hidden;isolation:isolate}.oms-v .oms-phone__screen{position:absolute;top:0;left:0;width:402px;height:874px;display:flex;flex-direction:column;overflow:hidden;background:#fff;color:#000;font-family:-apple-system, system-ui, sans-serif;font-size:15px;letter-spacing:-0.015em;transform-origin:0 0;-webkit-font-smoothing:antialiased}.oms-v .oms-phone[data-dark] .oms-phone__screen{background:#000;color:#fff}.oms-v .oms-phone__status{position:absolute;top:0;right:0;left:0;z-index:2;height:62px;transition:color 0.3s ease;will-change:transform}.oms-v .oms-phone__time{position:absolute;top:21.5px;left:0;width:138.5px;line-height:22px;text-align:center;font-family:\"SF Pro Text\", -apple-system, system-ui, sans-serif;font-variation-settings:\"opsz\" 17;font-size:17.67px;font-weight:590;letter-spacing:0}.oms-v .oms-phone__glyphs{position:absolute;top:25.33px;left:285.25px;display:flex;align-items:flex-start;gap:8px}.oms-v .oms-phone__glyphs svg{display:block}.oms-v .oms-phone__signal{margin-top:1px}.oms-v .oms-phone__battery{margin-top:0.33px}.oms-v .oms-phone__island{position:absolute;top:14px;left:50%;z-index:3;width:95px;height:37px;border-radius:18.5px;background:#000;transform:translateX(-50%)}.oms-v .oms-phone__content{position:relative;flex:1;min-height:0;padding-top:62px}.oms-v .oms-phone__home{position:absolute;bottom:8px;left:50%;z-index:2;width:144px;height:5px;border-radius:2.5px;background:currentColor;transform:translateX(-50%);transition:color 0.3s ease;will-change:transform}.obz{overflow:hidden;border-radius:14px;background:linear-gradient(110deg, rgba(255, 255, 255, 0.18) 0%, transparent 22%, transparent 32%, rgba(255, 255, 255, 0.1) 44%, transparent 60%),\n linear-gradient(135deg, var(--obz-from) 0%, var(--obz-to) 100%);--obz-ink: var(--ss-text-strong);--obz-faint: var(--oms-slate-500);--obz-app: var(--oms-slate-50);--obz-card: #fff;--obz-rule: var(--oms-slate-200)}.obz--payouts{--obz-from: #7c3aed;--obz-to: #3b0764}.obz--rewards{--obz-from: #10b981;--obz-to: #064e3b}html.dark .obz{--obz-faint: var(--oms-slate-400);--obz-app: #0b0a10;--obz-card: #1a1922;--obz-rule: rgba(255, 255, 255, 0.08)}.obz .obz-phone{position:absolute;top:30px;left:30px}.obz .obz-app{position:absolute;inset:0;padding-top:62px;background:var(--obz-app);color:var(--obz-ink);text-align:left;font-family:var(--ss-font)}.obz .obz-btn .obz-states,.obz .obz-status,.obz .obz-big--count{transition:opacity 0.38s ease}.obz .obz-app[data-fade] :is(.obz-btn .obz-states,.obz-status,.obz-big--count){opacity:0}.obz .obz-title{transition:opacity 0.2s ease}.obz .obz-app[data-notif] .obz-title{opacity:0}.obz .obz-head{display:flex;align-items:baseline;justify-content:space-between;padding:8px 36px 14px}.obz--payouts .obz-head{padding-bottom:10px}.obz--rewards .obz-head{padding-bottom:34px}.obz .obz-title{font-size:32px;font-weight:700;line-height:38px;letter-spacing:-0.02em;color:var(--obz-ink)}.obz .obz-head__meta{font-size:19px;line-height:25px;color:var(--obz-faint)}.obz .obz-card{display:block;margin:0 16px 12px;border-radius:22px;background:var(--obz-card);box-shadow:0 0 0 0.5px var(--obz-rule)}.obz .obz-batch,.obz .obz-balance{display:grid;justify-items:start;padding:18px 20px 20px}.obz--payouts .obz-batch{padding-bottom:16px}.obz .obz-label{font-size:19px;line-height:25px;color:var(--obz-faint)}.obz .obz-big{margin-top:2px;font-size:50px;font-weight:700;line-height:58px;letter-spacing:-0.03em;color:var(--obz-ink)}.obz .obz-big--count{margin:4px 0 2px;font-size:60px;line-height:68px}.obz .obz-count{display:inline-flex;align-items:baseline;white-space:nowrap;font-variant-numeric:tabular-nums}.obz .obz-count__char{display:inline-block;font-variant-numeric:normal}.obz .obz-count__digit{display:inline-block;height:1em;overflow:hidden;line-height:1;vertical-align:baseline;mask-image:linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent)}.obz .obz-count__strip{display:flex;flex-direction:column;will-change:transform;transition:transform 900ms cubic-bezier(0.3, 0.75, 0.1, 1)}.obz .obz-count__strip>span{display:block;height:1em;line-height:1}.obz .obz-count__unit{display:inline-block;margin-left:8px;font-size:22px;font-weight:600;letter-spacing:0;color:var(--obz-faint)}.obz .obz-btn{position:relative;isolation:isolate;display:grid;place-items:center;justify-self:stretch;height:58px;margin-top:14px;border-radius:16px;color:var(--oms-btn-primary-text);font-size:20px;font-weight:600}.obz .obz-btn::before{content:\"\";position:absolute;inset:0;z-index:-1;border-radius:inherit;background:var(--oms-btn-primary);transition:transform 0.15s ease, background-color 0.2s ease}.obz .obz-btn[data-pressed]::before{transform:scale(0.97);background:var(--oms-btn-primary-hover)}.obz .obz-btn__group{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:180px;height:26px}.obz .obz-btn__group--icon{justify-content:flex-start;padding-left:44px}.obz .obz-btn__group svg{flex:none}.obz .obz-spin{animation:obz-spin 0.8s linear infinite}@keyframes obz-spin{to{transform:rotate(360deg)}}.obz .obz-touch{position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-22px 0 0 -22px;border-radius:50%;background:rgba(255, 255, 255, 0.35);box-shadow:0 0 0 1.5px rgba(255, 255, 255, 0.55);opacity:0;transform:scale(0.6);transition:opacity 0.3s ease, transform 0.3s ease;pointer-events:none}.obz .obz-touch[data-on]{opacity:1;transform:scale(1);transition:opacity 0.08s ease, transform 0.12s ease}.obz .obz-states{display:inline-grid;align-items:center;justify-items:center}.obz .obz-states__item{display:inline-flex;grid-area:1 / 1;align-items:center;opacity:0;filter:blur(2px);will-change:transform;transform:translate3d(0, 4px, 0);transition:opacity 0.15s ease, filter 0.15s ease, transform 0s 0.15s}.obz .obz-states__item[data-on]{opacity:1;filter:none;transform:translate3d(0, 0, 0);transition:opacity 0.25s ease-out 0.07s, filter 0.25s ease-out 0.07s, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.07s}.obz .obz-status{display:inline-grid;justify-items:end;margin-right:10px;flex:none}.obz--payouts .obz-status{margin-right:6px}.obz--rewards .obz-status{width:96px}.obz .obz-list{padding:4px 0}.obz .obz-row{display:flex;align-items:center;gap:14px;padding:14px;will-change:transform}.obz .obz-list>.obz-row+.obz-row,.obz .obz-list>.obz-collapse+.obz-row{box-shadow:0 -0.5px 0 var(--obz-rule)}.obz .obz-row__body{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.obz .obz-row__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:21px;font-weight:600;line-height:28px;color:var(--obz-ink)}.obz .obz-row__sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:19px;line-height:28px;color:var(--ss-text)}.obz--payouts .obz-row__sub{font-size:18px}.obz .obz-bar{display:block;border-radius:5px;background:var(--ss-ink-3)}.obz .obz-bar--title{height:11px;margin:8.5px 0;background:var(--ss-ink-4)}.obz .obz-bar--sub{height:9px;margin:9.5px 0}.obz .obz-avatar{display:inline-grid;flex:none;place-items:center;width:48px;height:48px;border-radius:50%;color:#fff;font-size:20px;font-weight:600;line-height:1;will-change:transform}.obz .obz-avatar>span{display:block;text-box:trim-both cap alphabetic}.obz .obz-avatar--plain{background:var(--ss-fill)}.obz .obz-tile{display:grid;flex:none;place-items:center;width:48px;height:48px;border-radius:14px;background:var(--ss-success-soft);color:var(--ss-success-text)}.obz .obz-tile--plain{background:var(--ss-ink-1)}html.dark .obz .obz-tile{background:rgba(16, 185, 129, 0.14);color:#34d399}html.dark .obz .obz-tile--plain{background:rgba(255, 255, 255, 0.06)}.obz .oms-badge.obz-badge{padding:5px 12px;border-radius:16px;font-size:19px;line-height:22px}.obz .obz-collapse{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows 0.42s cubic-bezier(0.4, 0, 0.2, 1) 0.05s, opacity 0.42s cubic-bezier(0, 0.8, 0.5, 1)}.obz .obz-collapse[data-open]{grid-template-rows:1fr;opacity:1;transition:grid-template-rows 0.5s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.3s ease 0.24s}.obz .obz-collapse__inner{min-height:0;overflow:visible}.obz .obz-collapse__inner>*{transform:translateY(-10px);transition:transform 0.3s ease}.obz .obz-collapse[data-open]>.obz-collapse__inner>*{transform:none;transition:transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.2s}.obz .obz-banner{position:absolute;inset:0;z-index:2;pointer-events:none;will-change:transform;transform:translateY(-52px) scale(0.96);opacity:0;transition:transform 0.45s cubic-bezier(0.4, 0, 0.6, 1), opacity 0.3s ease 0.1s}.obz .obz-banner[data-show]{transform:none;opacity:1;transition:transform 0.55s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.2s ease}.obz .obz-notif{position:absolute;top:56px;left:18px;right:18px;display:flex;align-items:center;gap:13px;padding:14px 17px 14px 14px;border-radius:23px;background:rgba(255, 255, 255, 0.92);box-shadow:0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.12);color:#000;text-align:left;will-change:transform}.obz .obz-banner[data-dark] .obz-notif{background:rgba(252, 252, 253, 0.76);backdrop-filter:blur(30px) saturate(1.25);box-shadow:0 4px 24px rgba(0, 0, 0, 0.06)}.obz .obz-notif__icon{display:grid;flex:none;place-items:center;width:38px;height:38px;border-radius:9px;overflow:hidden;background:linear-gradient(160deg, #10b981, #047857);color:#fff}.obz .obz-notif__text{display:flex;flex:1;flex-direction:column;min-width:0;font-size:15px;line-height:18px;letter-spacing:-0.016em}.obz .obz-notif__head{display:flex;align-items:baseline;gap:8px}.obz .obz-notif__title{flex:1;min-width:0;overflow:hidden;font-weight:600;white-space:nowrap;text-overflow:ellipsis}.obz .obz-notif__time{flex:none;font-size:12px;letter-spacing:-0.005em;color:rgba(60, 60, 67, 0.6)}.obz .obz-notif__body{display:-webkit-box;overflow:hidden;-webkit-line-clamp:3;-webkit-box-orient:vertical}@media (prefers-reduced-motion: reduce){.obz .obz-spin{animation:none}}"}]}
{"page":{"pagePath":"wallets/sdk/typescript/private-balances","slug":"/wallets/sdk/typescript/private-balances","pageMetadata":{"title":"Private balances with TypeScript","sidebarTitle":"Private balances","description":"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.","href":"/wallets/sdk/typescript/private-balances"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.code,{children:`@polygonlabs/oms-wallet-privacy`}),` adds a private balance to the active Ethereum wallet. Shielding moves tokens from the wallet into its private balance, unshielding moves them from the private balance to any address, and a private send pays a recipient with no onchain link to the sender.`]}),`\n`,_jsx(_components.p,{children:`Every privacy operation requires an active Ethereum wallet session and acts for the wallet that was active when it was called.`}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Private balances exist only on mainnets. Every operation moves real funds and pays real fees.`})}),`\n`,_jsx(Heading,{level:`2`,id:`install`,children:`Install`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @polygonlabs/oms-wallet`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @polygonlabs/oms-wallet-privacy`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` viem`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The package is ESM-only and requires `,_jsx(_components.code,{children:`@polygonlabs/oms-wallet`}),` 0.5 or later. It runs in browsers through a bundler and in Node 22 without polyfills or bundler settings. It loads its privacy library, about 2 MB gzipped, on the first private-balance call.`]}),`\n`,_jsx(Heading,{level:`2`,id:`add-the-extension`,children:`Add the extension`}),`\n`,_jsxs(_components.p,{children:[`Pass `,_jsx(_components.code,{children:`privacy()`}),` to `,_jsx(_components.code,{children:`OMSWallet.extend`}),`. It returns a new `,_jsx(_components.code,{children:`OMSWallet`}),` with an `,_jsx(_components.code,{children:`omsWallet.privacy`}),` member; `,_jsx(_components.code,{children:`wallet`}),` and `,_jsx(_components.code,{children:`indexer`}),` are the same objects as on the original instance.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`OMSWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@polygonlabs/oms-wallet'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@polygonlabs/oms-wallet-privacy'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OMSWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` publishableKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_PUBLISHABLE_KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`extend`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`())`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Authenticate and select an Ethereum wallet with `,_jsx(_components.code,{children:`omsWallet.wallet`}),` as described in `,_jsx(_components.a,{href:`/wallets/sdk/typescript/authentication`,children:`authentication`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`supported-networks-and-tokens`,children:`Supported networks and tokens`}),`\n`,_jsxs(_components.p,{children:[`Private balances are available on Ethereum, BNB Chain, Polygon, Base, and Arbitrum. `,_jsx(_components.code,{children:`omsWallet.privacy.networks`}),` lists them as `,_jsx(_components.code,{children:`Network`}),` values.`]}),`\n`,_jsxs(_components.p,{children:[`Tokens are contract addresses. Use `,_jsx(_components.code,{children:`0x0000000000000000000000000000000000000000`}),` for the network’s native token. Amounts are `,_jsx(_components.code,{children:`bigint`}),` values in the token’s base units.`]}),`\n`,_jsx(Heading,{level:`2`,id:`quote-then-confirm`,children:`Quote, then confirm`}),`\n`,_jsx(_components.p,{children:`Every operation starts with a quote. Show the quote to the user, then pass it to the matching call.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Networks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@polygonlabs/oms-wallet'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` usdc`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` quote`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`quoteShield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` network:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Networks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`polygon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` token:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` usdc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` amount:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1_000_000`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`amount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`fee`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`total`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`expiresAt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`shield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`amount`}),` is what arrives, `,_jsx(_components.code,{children:`fee`}),` is the privacy fee in the same token, and `,_jsx(_components.code,{children:`total`}),` is `,_jsx(_components.code,{children:`amount + fee`}),`: what leaves the wallet or the private balance. Shielding has no privacy fee. Network fees are separate.`]}),`\n`,_jsxs(_components.p,{children:[`A quote is valid for 5 minutes, can be used once, and only for the wallet that was active when it was made. Otherwise the call fails with `,_jsx(_components.code,{children:`OMS_PRIVACY_QUOTE_INVALID`}),`; request a new quote.`]}),`\n`,_jsx(Heading,{level:`3`,id:`send-privately`,children:`Send privately`}),`\n`,_jsxs(_components.p,{children:[`A private send deposits `,_jsx(_components.code,{children:`total`}),` from the wallet into the sender’s private balance and authorizes a payment of `,_jsx(_components.code,{children:`amount`}),` to `,_jsx(_components.code,{children:`to`}),`. The privacy service delivers it later.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` quote`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`quotePrivateSend`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` network:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Networks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`polygon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` token:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` usdc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` amount:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1_000_000`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` to:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0x1111111111111111111111111111111111111111'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` sent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`privateSend`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`deliveryId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`unshield`,children:`Unshield`}),`\n`,_jsxs(_components.p,{children:[`Unshielding pays from the private balance to `,_jsx(_components.code,{children:`to`}),`, or to the active wallet when `,_jsx(_components.code,{children:`to`}),` is omitted.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` quote`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`quoteUnshield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` network:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Networks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`polygon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` token:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` usdc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` amount:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500_000`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`txnHash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`unshield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Unshielding sends no wallet transaction. The privacy service submits the withdrawal, and its fee is part of the quote.`}),`\n`,_jsx(Heading,{level:`2`,id:`pay-network-fees`,children:`Pay network fees`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`shield`}),` and `,_jsx(_components.code,{children:`privateSend`}),` send up to three wallet transactions: an allowance reset to 0, an approval of exactly `,_jsx(_components.code,{children:`total`}),`, and the deposit. Steps that are not needed are skipped, and native-token deposits need no approval. The result’s `,_jsx(_components.code,{children:`transactions`}),` lists every transaction sent, in order, with its `,_jsx(_components.code,{children:`networkFee`}),` when one was paid. Sponsored transactions have no `,_jsx(_components.code,{children:`networkFee`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`By default, each transaction’s network fee is paid in the token being moved. If the wallet cannot pay it on top of `,_jsx(_components.code,{children:`total`}),`, the call fails with `,_jsx(_components.code,{children:`OMS_PRIVACY_NETWORK_FEE`}),` before that transaction executes. Pass `,_jsx(_components.code,{children:`selectFeeOption`}),` to choose another fee token, as described in `,_jsx(_components.a,{href:`/wallets/sdk/typescript/send-transactions#select-fees-accurately`,children:`send transactions`}),`, or `,_jsx(_components.code,{children:`maxNetworkFee`}),` to cap the fee each transaction may pay in the moved token.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`FeeOptionSelector`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@polygonlabs/oms-wallet'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`shield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` selectFeeOption:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` FeeOptionSelector`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`firstAvailable`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`To store each transaction ID before it is submitted, pass `,_jsx(_components.code,{children:`onProgress`}),`. Each wallet transaction reports `,_jsx(_components.code,{children:`prepared`}),` with its `,_jsx(_components.code,{children:`txnId`}),` before execution and `,_jsx(_components.code,{children:`confirmed`}),` once it executed. The SDK awaits the callback for `,_jsx(_components.code,{children:`prepared`}),` events; if it throws or rejects, that transaction is not executed.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`shield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onProgress`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`step`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'delivery'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`state`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'prepared'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Store event.txnId durably. Return a promise to hold execution until it is stored.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`track-delivery`,children:`Track delivery`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`deliveryId`}),` identifies a private send’s delivery. Treat it as private, because it reveals the delivery. Check its status with `,_jsx(_components.code,{children:`getDeliveryStatus`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` delivery`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getDeliveryStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` deliveryId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`deliveryId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delivery`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 'pending', 'delivered', or 'failed'`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`To wait for delivery instead, pass `,_jsx(_components.code,{children:`waitForDelivery: true`}),`. The SDK polls every 3 seconds for up to 15 minutes and returns the delivered status in `,_jsx(_components.code,{children:`delivery`}),`. Override these values with `,_jsx(_components.code,{children:`deliveryPolling`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` sent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`privateSend`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` waitForDelivery:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` deliveryPolling:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`timeoutMs:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 5`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60_000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`While waiting, a failed delivery throws `,_jsx(_components.code,{children:`OMS_PRIVACY_DELIVERY_FAILED`}),`, and a delivery that does not finish in time throws `,_jsx(_components.code,{children:`OMS_PRIVACY_DELIVERY_TIMEOUT`}),`. A timed-out delivery can still finish; check it later with `,_jsx(_components.code,{children:`getDeliveryStatus`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`read-balances-and-recover-funds`,children:`Read balances and recover funds`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`getBalances`}),` returns the active wallet’s private balances with a non-zero amount, across every supported network unless you pass `,_jsx(_components.code,{children:`networks`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` balances`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getBalances`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` balance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` balances`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`network`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`amount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`recoverable`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`amount`}),` is spendable. `,_jsx(_components.code,{children:`recoverable`}),` holds private sends that were deposited but not delivered. When a delivery fails, its funds stay there until you call `,_jsx(_components.code,{children:`recover`}),`, which pays all recoverable funds of one token back to the active wallet:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`txnHashes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`recover`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` network:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Networks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`polygon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` token:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` usdc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Funds also show as `,_jsx(_components.code,{children:`recoverable`}),` while a delivery is pending. `,_jsx(_components.code,{children:`recover`}),` and the delivery spend the same funds, so only one of them goes through. Like unshielding, `,_jsx(_components.code,{children:`recover`}),` sends no wallet transaction.`]}),`\n`,_jsx(Heading,{level:`2`,id:`handle-errors`,children:`Handle errors`}),`\n`,_jsxs(_components.p,{children:[`Every failure is an `,_jsx(_components.code,{children:`OMSWalletPrivacyError`}),`. It has a `,_jsx(_components.code,{children:`code`}),`, the `,_jsx(_components.code,{children:`operation`}),`, the `,_jsx(_components.code,{children:`stage`}),` the operation reached, if any, and `,_jsx(_components.code,{children:`txnIds`}),`: every wallet transaction the operation created. When a private send fails after its deposit, the error can also carry its `,_jsx(_components.code,{children:`deliveryId`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`isOMSWalletPrivacyError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@polygonlabs/oms-wallet-privacy'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` omsWallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`privacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`privateSend`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`isOMSWalletPrivacyError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`stage`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txnIds`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`deliveryId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` error`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`For `,_jsx(_components.code,{children:`shield`}),` and `,_jsx(_components.code,{children:`privateSend`}),`, an empty `,_jsx(_components.code,{children:`txnIds`}),` means no wallet transaction was sent, and you can request a new quote and try again. Otherwise, check each ID with `,_jsx(_components.code,{children:`omsWallet.wallet.getTransactionStatus({ txnId })`}),`, then call `,_jsx(_components.code,{children:`getBalances`}),` for funds to recover. A failed or timed-out call never sends a deposit again on its own.`]}),`\n`,_jsxs(_components.p,{children:[`Do not send a private send again when its error carries a `,_jsx(_components.code,{children:`deliveryId`}),`: the send went through, and only its delivery status is unknown. The same applies to an `,_jsx(_components.code,{children:`OMS_PRIVACY_SERVICE_ERROR`}),` at the `,_jsx(_components.code,{children:`delivery`}),` stage without a `,_jsx(_components.code,{children:`deliveryId`}),`: the deposit executed and the delivery may still happen.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`unshield`}),` and `,_jsx(_components.code,{children:`recover`}),` send no wallet transaction, so their `,_jsx(_components.code,{children:`txnIds`}),` is always empty. When the error message says the withdrawal may have been submitted, check `,_jsx(_components.code,{children:`getBalances`}),` before trying again.`]}),`\n`,_jsxs(_components.p,{children:[`If the active wallet changes or signs out while an operation runs, even when the same wallet becomes active again, the operation stops with `,_jsx(_components.code,{children:`OMS_PRIVACY_WALLET_CHANGED`}),`. Balance reads and quotes fail the same way instead of returning results for a wallet that is no longer active.`]}),`\n`,_jsx(Heading,{level:`2`,id:`keys-and-trust`,children:`Keys and trust`}),`\n`,_jsxs(_components.p,{children:[`The private balance’s keys are derived from the wallet’s signature over a fixed message. A connected dApp, such as one using the `,_jsx(_components.a,{href:`/wallets/sdk/typescript/using-with-wagmi-connector`,children:`wagmi connector`}),`, cannot request that signature; code running in your application can. Setting up keys sends no wallet transaction.`]}),`\n`,_jsxs(_components.p,{children:[`The keys stay the same when the wallet is deployed or its configuration changes, for example when remote access is granted, revoked, or expires. The package stores a fingerprint of the derived keys and stops with `,_jsx(_components.code,{children:`OMS_PRIVACY_KEY_MISMATCH`}),` if they change, instead of showing an empty balance. It stores the fingerprint in `,_jsx(_components.code,{children:`localStorage`}),` in browsers and in memory elsewhere; pass `,_jsx(_components.code,{children:`privacy({ storage })`}),` to use your own `,_jsx(_components.code,{children:`StorageManager`}),`. A change is detected only where a fingerprint was stored before.`]}),`\n`,_jsx(_components.p,{children:`The privacy service generates proofs remotely and receives the private balance’s viewing key, so it can see private balances and history. It cannot move funds: withdrawals are authorized by a spending key that stays on the device and signs the recipient, amount, and fee. The service delivers private sends on its own schedule.`}),`\n`,_jsxs(_components.p,{children:[`Deposit transactions can only approve and call allowlisted contracts, and the approval is exactly `,_jsx(_components.code,{children:`total`}),`, so a deposit can move at most `,_jsx(_components.code,{children:`total`}),`. Operations for one wallet run one at a time within a page.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Private balances with TypeScript","sidebarTitle":"Private balances","description":"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.","href":"/wallets/sdk/typescript/private-balances"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Install","slug":"install","depth":2,"children":[]},{"title":"Add the extension","slug":"add-the-extension","depth":2,"children":[]},{"title":"Supported networks and tokens","slug":"supported-networks-and-tokens","depth":2,"children":[]},{"title":"Quote, then confirm","slug":"quote-then-confirm","depth":2,"children":[{"title":"Send privately","slug":"send-privately","depth":3,"children":[]},{"title":"Unshield","slug":"unshield","depth":3,"children":[]}]},{"title":"Pay network fees","slug":"pay-network-fees","depth":2,"children":[]},{"title":"Track delivery","slug":"track-delivery","depth":2,"children":[]},{"title":"Read balances and recover funds","slug":"read-balances-and-recover-funds","depth":2,"children":[]},{"title":"Handle errors","slug":"handle-errors","depth":2,"children":[]},{"title":"Keys and trust","slug":"keys-and-trust","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/polygon-labs/3aef159c73509324/analytics.js","/_mintlify/custom/polygon-labs/0db36164dbb10780/custom.js"],"subdomain":"polygon-labs","siteName":"Polygon Developer Docs","title":"Private balances with TypeScript - Polygon Developer Docs","contextualStarterQuestions":[{"_id":"6b004109868584fdc2259d4b","deploymentId":"69a9bcc427671ec5a2e05f92","questionText":"How do I shield tokens privately?","status":"active","generatedBy":"contextual","path":"wallets/sdk/typescript/private-balances","createdAt":"2026-11-20T12:46:01.710Z","updatedAt":"2026-11-20T12:46:01.710Z","__v":0},{"_id":"6b004109868584fdc2259d4d","deploymentId":"69a9bcc427671ec5a2e05f92","questionText":"How do I set up the privacy extension?","status":"active","generatedBy":"contextual","path":"wallets/sdk/typescript/private-balances","createdAt":"2026-11-20T12:46:01.710Z","updatedAt":"2026-11-20T12:46:01.710Z","__v":0},{"_id":"6b004109868584fdc2259d4c","deploymentId":"69a9bcc427671ec5a2e05f92","questionText":"Which networks support private balances?","status":"active","generatedBy":"contextual","path":"wallets/sdk/typescript/private-balances","createdAt":"2026-11-20T12:46:01.710Z","updatedAt":"2026-11-20T12:46:01.710Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-20T12:45:57.122Z","originalFileLocation":"wallets/sdk/typescript/private-balances.md"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Polygon Developer Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Private balances with TypeScript - Polygon Developer Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Polygon Developer Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://polygon-labs.mintlify.site/_mintlify/api/og/v2?division=TypeScript\u0026amp;title=Private+balances+with+TypeScript\u0026amp;description=Shield+tokens+into+a+private+balance%2C+send+privately%2C+unshield%2C+and+recover+undelivered+sends+from+an+OMS+Ethereum+wallet.\u0026amp;theme=b36bd2d42ef34b1589e85268\u0026amp;signature=4f6b8e08bdf9296b1a9861cda87fa82c3e4764adf50adee549118a7b0d94ab86\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Private balances with TypeScript - Polygon Developer Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://polygon-labs.mintlify.site/_mintlify/api/og/v2?division=TypeScript\u0026amp;title=Private+balances+with+TypeScript\u0026amp;description=Shield+tokens+into+a+private+balance%2C+send+privately%2C+unshield%2C+and+recover+undelivered+sends+from+an+OMS+Ethereum+wallet.\u0026amp;theme=b36bd2d42ef34b1589e85268\u0026amp;signature=4f6b8e08bdf9296b1a9861cda87fa82c3e4764adf50adee549118a7b0d94ab86\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/polygon-labs/mGaxVdHZf09e3t79/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Polygon Developer Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#670DE5\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/wallets/sdk/typescript/private-balances.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.polygon.technology/#organization\",\"name\":\"Polygon Developer Docs\",\"url\":\"https://docs.polygon.technology\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/polygon-labs/ll1LL3IdpC3YxXZu/logo/light.svg?fit=max\u0026auto=format\u0026n=ll1LL3IdpC3YxXZu\u0026q=85\u0026s=d54ddb30492807a0eadf38093c075f2f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.polygon.technology#website\",\"name\":\"Polygon Developer Docs\",\"url\":\"https://docs.polygon.technology\",\"publisher\":{\"@id\":\"https://docs.polygon.technology/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances#webpage\",\"url\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances\",\"name\":\"Private balances with TypeScript\",\"description\":\"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.\",\"dateModified\":\"2026-11-20T12:45:57.122Z\",\"isPartOf\":{\"@id\":\"https://docs.polygon.technology#website\"},\"breadcrumb\":{\"@id\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Wallets\",\"item\":\"https://docs.polygon.technology/wallets/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Non-custodial\",\"item\":\"https://docs.polygon.technology/wallets/non-custodial-wallets\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SDK\",\"item\":\"https://docs.polygon.technology/wallets/sdk/overview\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"TypeScript\",\"item\":\"https://docs.polygon.technology/wallets/sdk/typescript/quickstart\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Private balances with TypeScript\",\"item\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances#article\",\"headline\":\"Private balances with TypeScript\",\"name\":\"Private balances with TypeScript\",\"description\":\"Shield tokens into a private balance, send privately, unshield, and recover undelivered sends from an OMS Ethereum wallet.\",\"url\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances\",\"mainEntityOfPage\":{\"@id\":\"https://docs.polygon.technology/wallets/sdk/typescript/private-balances#webpage\"},\"dateModified\":\"2026-11-20T12:45:57.122Z\",\"publisher\":{\"@id\":\"https://docs.polygon.technology/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.polygon.technology#website\"}}]}\u003c/script>","agentPointerHref":"/wallets/sdk/typescript/private-balances.md","siteName":"Polygon Developer Docs","nav":{"global":null,"products":[{"product":"Developer Docs","icon":"code","description":"APIs, SDKs, and infrastructure guides for builders","tabs":[{"tab":"Platform","icon":"layer-group","pages":[{"title":"Platform","href":""}]},{"tab":"Payments","pages":[{"title":"Payments","href":"/payments/overview"}]},{"tab":"Wallets","groups":[{"group":"Wallets","expanded":true,"pages":[{"title":"OMS wallets","sidebarTitle":"Overview","href":"/wallets/overview"},{"group":"Custodial","expanded":true,"pages":[{"title":"OMS Custodial Wallets","sidebarTitle":"Overview","href":"/wallets/custodial-wallets"},{"title":"Custodial wallet quickstart","sidebarTitle":"Quickstart","href":"/wallets/custodial-wallets-quickstart"},{"title":"OMS fiat wallets","sidebarTitle":"Fiat wallets","href":"/wallets/fiat-wallets"},{"group":"Server Wallets","pages":[{"title":"Server Wallets","sidebarTitle":"Overview","href":"/wallets/server-wallets"},{"group":"SDK","pages":[{"title":"Server Wallet SDK quickstart","sidebarTitle":"Quickstart","href":"/wallets/sdk/server/quickstart"},{"title":"Identity and credentials","sidebarTitle":"Identity and credentials","href":"/wallets/sdk/server/identity-and-credentials"},{"title":"Storage and concurrency","sidebarTitle":"Storage and concurrency","href":"/wallets/sdk/server/storage-and-concurrency"},{"title":"Transfers","sidebarTitle":"Transfers","href":"/wallets/sdk/server/transfers"},{"title":"Swaps","sidebarTitle":"Swaps","href":"/wallets/sdk/server/swaps"},{"title":"Sign and verify","sidebarTitle":"Sign and verify","href":"/wallets/sdk/server/sign-and-verify"},{"title":"Balances","sidebarTitle":"Balances","href":"/wallets/sdk/server/balances"}]}]}]},{"group":"Non-custodial","expanded":true,"pages":[{"title":"OMS Non-Custodial Wallets","sidebarTitle":"Overview","href":"/wallets/non-custodial-wallets"},{"title":"SDK Quickstart","sidebarTitle":"Quickstart","href":"/wallets/quickstart"},{"group":"Features","pages":[{"title":"Authentication","href":"/wallets/authentication"},{"title":"Wallet Operations","href":"/wallets/wallet-operations"},{"title":"Gas Sponsorship","href":"/wallets/gas-sponsorship"},{"title":"Smart Sessions","href":"/wallets/smart-sessions"},{"title":"Private Send","href":"/wallets/private-send"},{"title":"Recovery","href":"/wallets/recovery"},{"title":"Security","href":"/wallets/security"}]},{"group":"SDK","pages":[{"title":"OMS Wallet SDKs","sidebarTitle":"Overview","href":"/wallets/sdk/overview"},{"group":"Guides","pages":[{"title":"Send USDC","sidebarTitle":"Send USDC","href":"/wallets/sdk/guides/send-usdc"},{"title":"Swap wallet assets","sidebarTitle":"Swap","href":"/wallets/sdk/guides/swap"},{"title":"Earn with Trails","sidebarTitle":"Earn","href":"/wallets/sdk/guides/earn"},{"title":"Backend wallet verification","sidebarTitle":"Backend verification","href":"/wallets/sdk/guides/backend-wallet-verification"},{"title":"Manage smart sessions from a backend","sidebarTitle":"Backend smart sessions","href":"/wallets/sdk/guides/backend-smart-sessions"},{"title":"Preallocate and claim wallets","sidebarTitle":"Claimable wallets","href":"/wallets/sdk/guides/claimable-wallets"}]},{"group":"TypeScript","pages":[{"title":"TypeScript SDK quickstart","sidebarTitle":"Quickstart","href":"/wallets/sdk/typescript/quickstart"},{"title":"TypeScript SDK authentication","sidebarTitle":"Authentication","href":"/wallets/sdk/typescript/authentication"},{"title":"TypeScript sessions and access","sidebarTitle":"Sessions and access","href":"/wallets/sdk/typescript/sessions-and-access"},{"title":"Send transactions with TypeScript","sidebarTitle":"Send transactions","href":"/wallets/sdk/typescript/send-transactions"},{"title":"Sign and verify with TypeScript","sidebarTitle":"Sign and verify","href":"/wallets/sdk/typescript/sign-and-verify"},{"title":"TypeScript balances and history","sidebarTitle":"Balances and history","href":"/wallets/sdk/typescript/balances-and-history"},{"title":"TypeScript networks","sidebarTitle":"Networks","href":"/wallets/sdk/typescript/networks-and-reference"},{"title":"Migrate the TypeScript SDK from 0.3 to 0.4","sidebarTitle":"Migrate from 0.3","href":"/wallets/sdk/typescript/migrate-from-0-3"},{"title":"TypeScript API reference","sidebarTitle":"API reference","href":"/wallets/sdk/typescript/api-reference"},{"title":"Use the TypeScript SDK with wagmi","sidebarTitle":"Using with wagmi","description":"Connect an active OMS Wallet session to wagmi for signing and transaction submission.","href":"/wallets/sdk/typescript/using-with-wagmi-connector"},{"title":"Private balances with TypeScript","sidebarTitle":"Private balances","href":"/wallets/sdk/typescript/private-balances"}]},{"group":"React Native","pages":[{"title":"React Native SDK quickstart","sidebarTitle":"Quickstart","description":"Install the React Native OMS Wallet SDK, authenticate a wallet, and send a test transaction.","href":"/wallets/sdk/react-native/quickstart"},{"title":"React Native authentication","sidebarTitle":"Authentication","href":"/wallets/sdk/react-native/authentication"},{"title":"React Native sessions and access","sidebarTitle":"Sessions and access","href":"/wallets/sdk/react-native/sessions-and-access"},{"title":"Send transactions with React Native","sidebarTitle":"Send transactions","href":"/wallets/sdk/react-native/send-transactions"},{"title":"Sign and verify with React Native","sidebarTitle":"Sign and verify","href":"/wallets/sdk/react-native/sign-and-verify"},{"title":"React Native balances and history","sidebarTitle":"Balances and history","href":"/wallets/sdk/react-native/balances-and-history"},{"title":"React Native networks","sidebarTitle":"Networks","href":"/wallets/sdk/react-native/networks-and-reference"},{"title":"Migrate the React Native SDK from 0.3 to 0.4","sidebarTitle":"Migrate from 0.3","href":"/wallets/sdk/react-native/migrate-from-0-3"},{"title":"React Native API reference","sidebarTitle":"API reference","href":"/wallets/sdk/react-native/api-reference"}]},{"group":"Swift","pages":[{"title":"Swift SDK quickstart","sidebarTitle":"Quickstart","href":"/wallets/sdk/swift/quickstart"},{"title":"Swift SDK authentication","sidebarTitle":"Authentication","href":"/wallets/sdk/swift/authentication"},{"title":"Swift sessions and access","sidebarTitle":"Sessions and access","href":"/wallets/sdk/swift/sessions-and-access"},{"title":"Send transactions with Swift","sidebarTitle":"Send transactions","href":"/wallets/sdk/swift/send-transactions"},{"title":"Sign and verify with Swift","sidebarTitle":"Sign and verify","href":"/wallets/sdk/swift/sign-and-verify"},{"title":"Swift balances and history","sidebarTitle":"Balances and history","href":"/wallets/sdk/swift/balances-and-history"},{"title":"Swift networks","sidebarTitle":"Networks","href":"/wallets/sdk/swift/networks-and-reference"},{"title":"Migrate the Swift SDK from 0.3 to 0.4","sidebarTitle":"Migrate from 0.3","href":"/wallets/sdk/swift/migrate-from-0-3"},{"title":"Swift API reference","sidebarTitle":"API reference","href":"/wallets/sdk/swift/api-reference"}]},{"group":"Kotlin","pages":[{"title":"Kotlin SDK quickstart","sidebarTitle":"Quickstart","href":"/wallets/sdk/kotlin/quickstart"},{"title":"Kotlin SDK authentication","sidebarTitle":"Authentication","href":"/wallets/sdk/kotlin/authentication"},{"title":"Kotlin SDK sessions and access","sidebarTitle":"Sessions and access","href":"/wallets/sdk/kotlin/sessions-and-access"},{"title":"Kotlin SDK send transactions","sidebarTitle":"Send transactions","href":"/wallets/sdk/kotlin/send-transactions"},{"title":"Kotlin SDK sign and verify","sidebarTitle":"Sign and verify","href":"/wallets/sdk/kotlin/sign-and-verify"},{"title":"Kotlin SDK balances and history","sidebarTitle":"Balances and history","href":"/wallets/sdk/kotlin/balances-and-history"},{"title":"Kotlin SDK networks","sidebarTitle":"Networks","href":"/wallets/sdk/kotlin/networks-and-reference"},{"title":"Migrate the Kotlin SDK from 0.3 to 0.4","sidebarTitle":"Migrate from 0.3","href":"/wallets/sdk/kotlin/migrate-from-0-3"},{"title":"Kotlin API reference","sidebarTitle":"API reference","href":"/wallets/sdk/kotlin/api-reference"}]}]},{"group":"Examples","pages":[{"title":"Interactive Demo","mode":"wide","href":"/wallets/examples/interactive-demo"},{"title":"Neobank iOS Demo","href":"/wallets/examples/neobank-ios"},{"title":"Hosted Wallet","href":"/wallets/hosted-wallet"},{"title":"Custom Wallet","href":"/wallets/custom-wallet"},{"title":"Automate USDC collection with a Treasury Wallet","sidebarTitle":"Treasury Wallet","href":"/wallets/treasury-wallet"},{"title":"Offer Yield Accounts to Your Users","sidebarTitle":"Offer Yield Accounts","href":"/wallets/morpho-vault-deposit"},{"title":"Agentic Wallets","href":"/wallets/agentic-wallets-overview"}]}]},{"group":"Technical Reference","expanded":true,"pages":[{"title":"OMS Wallet Architecture","href":"/wallets/architecture"},{"title":"Smart Sessions: Technical Deep Dive","href":"/wallets/smart-sessions-deep-dive"},{"title":"Wallet Configuration","href":"/wallets/wallet-configuration"},{"title":"Guard Firewall","href":"/wallets/guard-firewall"},{"title":"OMS Wallet Infrastructure","href":"/wallets/infrastructure"},{"title":"Timed Recovery: Technical Reference","href":"/wallets/timed-recovery-technical"},{"title":"Multi-Auth Linking","href":"/wallets/multi-auth-linking"},{"title":"Supported networks","sidebarTitle":"Supported networks","mode":"wide","href":"/wallets/supported-networks"}]}]}]},{"tab":"Cross-chain","pages":[{"title":"Cross-chain","href":"/cross-chain"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/overview"}]},{"tab":"Infrastructure","icon":"server","pages":[{"title":"Infrastructure","href":"/infrastructure"}]},{"tab":"Polygon Chain","pages":[{"title":"Polygon Chain","href":"/pos/overview"}]},{"tab":"Polygon CDK","pages":[{"title":"Polygon CDK","href":"/chain-development/cdk"}]},{"tab":"Agglayer","pages":[{"title":"Agglayer","href":"/interoperability/overview"}]},{"tab":"Agentic","pages":[{"title":"Agentic","href":"/payment-services/agentic-payments/agent-integration/intro"}]}]},{"product":"Help Center","icon":"life-ring","description":"Dashboard how-tos for admins and business teams","pages":[{"title":"Help Center","href":"/help-center"}]}]},"basePath":"","title":"Private balances with TypeScript - Polygon Developer Docs","deploymentId":"dpl_vSEmv961Ncyvz1psVwgUnTXQMSYk","buildId":"dpl_vSEmv961Ncyvz1psVwgUnTXQMSYk","dynamics":[],"chunks":[]}