Turn Soroban smart contract specs into instant UI validation at runtime.
The biggest point of friction in Stellar development is the gap between a Smart Contract and a Browser Form.In a standard setup, you have to manually write code to ensure a user’s input matches the contract’s expectations (e.g., ensuring an “Amount” is a u128 or a “Recipient” is a valid Address). If the contract changes, your frontend validation breaks silently.
Sorokit eliminates manual mapping. When you provide a contractId, the SDK fetches the contract’s WASM spec and derives a Zod schema for every method automatically.
No Code Generation: There are no CLI commands to run and no generated files to manage.
Sync by Default: Your frontend validation is derived directly from the on-chain truth.
Developer Experience: Use the Zod ecosystem you already love (react-hook-form, zod-resolver) with zero manual glue code.
With Sorokit, creating a validated transfer form takes only a few lines. The to field and amount field are validated against the contract’s actual spec before a transaction is even built.
import { useSorobanForm } from "@sorokit/contract";function TransferForm() { const { register, formState } = useSorobanForm({ contractId: "CDLZ...", method: "transfer", }); return ( <form> {/* This input is automatically validated as a Stellar Address */} <input {...register("to")} /> {formState.errors.to && <p>{formState.errors.to.message}</p>} {/* This input is automatically validated as a BigInt u128 */} <input {...register("amount")} /> {formState.errors.amount && <p>{formState.errors.amount.message}</p>} </form> );}
Because the schema is derived at runtime, you can swap the contractId or target a different
network, and your form validation will update instantly without a single line of code changing.
Soroban handles large numbers (like i128) that exceed the safety limit of
JavaScript’s Number type (2^53 - 1). The Zod adapter enforces the use of bigint for these types,
ensuring that your app never suffers from silent precision loss when handling high-value
transactions.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Sorokit","colors":{"primary":"#16A34A","light":"#07C983","dark":"#15803D"},"logo":{"light":"https://mintcdn.com/odii/rGxWz8wR2KgWjlAs/logo/light.png?fit=max\u0026auto=format\u0026n=rGxWz8wR2KgWjlAs\u0026q=85\u0026s=8dfee127ab1382a72c3c2ed50a886ea8","dark":"https://mintcdn.com/odii/rGxWz8wR2KgWjlAs/logo/dark.png?fit=max\u0026auto=format\u0026n=rGxWz8wR2KgWjlAs\u0026q=85\u0026s=8c7605969af0a996edbc6198a4df7f5f"},"favicon":"https://mintcdn.com/odii/rGxWz8wR2KgWjlAs/favicon.png?fit=max\u0026auto=format\u0026n=rGxWz8wR2KgWjlAs\u0026q=85\u0026s=d9852b221711da092d6a1e49a669e718","navbar":{"links":[{"href":"https://github.com/payrouteshq/sorokit","label":"GitHub"}]},"footer":{"socials":{"github":"https://github.com/payrouteshq/sorokit"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"odii","hasAudioNarration":false,"actualSubdomain":"odii","customDomains":["docs.sorokit.xyz"],"gitSource":{"type":"github","owner":"payrouteshq","repo":"sorokit","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"latestBuiltDeploymentHistoryId":"6a9a9dc3b31e04775aee303a","collectionId":"45e04318-1a5f-4241-93a8-80629feaa97d","liveDeploymentHistoryId":"6a9a9dc3b31e04775aee303a","schemaVersion":"v3"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a9a9dc3b31e04775aee303a","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"Documentation","count":13},{"language":"default","tag":"The React Hooks","count":6},{"language":"default","tag":"The Toolkit","count":5},{"language":"default","tag":"Wallet Adapter","count":4},{"language":"default","tag":"Resources","count":4},{"language":"default","tag":"Reference","count":2},{"language":"default","tag":"Advanced Guides","count":2},{"language":"default","tag":"Getting Started","count":2},{"language":"default","tag":"Identity","count":2},{"language":"default","tag":"Starters","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","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":"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":"llms-txt-v2","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":"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":"byok-sep-25","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":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","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":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"tools/zod-adapter","slug":"/tools/zod-adapter","pageMetadata":{"title":"The Native Zod Adapter","description":"Turn Soroban smart contract specs into instant UI validation at runtime.","href":"/tools/zod-adapter"},"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: \"Turn Soroban smart contract specs into instant UI validation at runtime.\"\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={code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The biggest point of friction in Stellar development is the gap between a Smart Contract and a Browser Form.`}),`\n`,_jsxs(_components.p,{children:[`In a standard setup, you have to manually write code to ensure a user’s input matches the contract’s expectations (e.g., ensuring an “Amount” is a `,_jsx(_components.code,{children:`u128`}),` or a “Recipient” is a valid `,_jsx(_components.code,{children:`Address`}),`). If the contract changes, your frontend validation breaks silently.`]}),`\n`,_jsx(Heading,{level:`3`,id:`the-sorokit-way`,children:`The Sorokit Way`}),`\n`,_jsxs(_components.p,{children:[`Sorokit eliminates manual mapping. When you provide a `,_jsx(_components.code,{children:`contractId`}),`, the SDK fetches the contract’s WASM spec and derives a Zod schema for every method automatically.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`No Code Generation:`}),` There are no CLI commands to run and no generated files to manage.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Sync by Default:`}),` Your frontend validation is derived directly from the on-chain truth.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Developer Experience:`}),` Use the Zod ecosystem you already love (`,_jsx(_components.code,{children:`react-hook-form`}),`, `,_jsx(_components.code,{children:`zod-resolver`}),`) with zero manual glue code.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`how-it-works`,children:`How it works`}),`\n`,_jsxs(_components.p,{children:[`When you use `,_jsx(_components.code,{children:`useSorobanForm`}),` or `,_jsx(_components.code,{children:`useContractCall`}),`, Sorokit performs a runtime mapping of Soroban types to JavaScript types.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Soroban Type`}),_jsx(_components.th,{style:{textAlign:`left`},children:`JavaScript / Zod Type`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Validation Rule`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{style:{textAlign:`left`},children:[_jsx(_components.code,{children:`u32`}),` / `,_jsx(_components.code,{children:`i32`})]}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`number`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Standard JS Number`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:[_jsx(_components.code,{children:`u64`}),` / `,_jsx(_components.code,{children:`i128`}),` / `,_jsx(_components.code,{children:`u256`})]}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`bigint`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Automatic conversion to BigInt to prevent precision loss`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Address`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`string`})}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`Regex validation for `,_jsx(_components.code,{children:`G...`}),` or `,_jsx(_components.code,{children:`C...`}),` addresses`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Bytes`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Uint8Array`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Buffer-safe byte arrays`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Vec\u003cT>`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Array\u003cT>`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Recursive array validation`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Map\u003cK, V>`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Map\u003cK, V>`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Native JS Map support`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Enum`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`union`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Maps to the underlying numeric or string variants`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`example-instant-form-validation`,children:`Example: Instant Form Validation`}),`\n`,_jsxs(_components.p,{children:[`With Sorokit, creating a validated transfer form takes only a few lines. The `,_jsx(_components.code,{children:`to`}),` field and `,_jsx(_components.code,{children:`amount`}),` field are validated against the contract’s actual spec before a transaction is even built.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`20`,language:`tsx`,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:`tsx`,children:_jsxs(_components.code,{language:`tsx`,numberOfLines:`20`,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:`useSorobanForm`}),_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:` \"@sorokit/contract\"`}),_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:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` TransferForm`}),_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\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`register`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`formState`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` useSorobanForm`}),_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:` contractId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"CDLZ...\"`}),_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:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"transfer\"`}),_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\":`#C586C0`},children:` return`}),_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\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` {`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`/* This input is automatically validated as a Stellar Address */`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`input`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` {`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`register`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"to\"`}),_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\":`#808080`},children:` />`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`formState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`errors`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`to`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`p`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`formState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`errors`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`to`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`p`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` {`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`/* This input is automatically validated as a BigInt u128 */`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`input`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` {`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`register`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"amount\"`}),_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\":`#808080`},children:` />`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`formState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`errors`}),_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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`p`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`formState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`errors`}),_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:`message`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`p`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},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(Tip,{children:_jsxs(_components.p,{children:[`Because the schema is derived at runtime, you can swap the `,_jsx(_components.code,{children:`contractId`}),` or target a different\nnetwork, and your form validation will update instantly without a single line of code changing.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`deep-precision`,children:`Deep Precision`}),`\n`,_jsx(_components.p,{children:`Soroban handles large numbers (like i128) that exceed the safety limit of\nJavaScript’s Number type (2^53 - 1). The Zod adapter enforces the use of bigint for these types,\nensuring that your app never suffers from silent precision loss when handling high-value\ntransactions.`})]})}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":"The Native Zod Adapter","description":"Turn Soroban smart contract specs into instant UI validation at runtime.","href":"/tools/zod-adapter"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The Sorokit Way","slug":"the-sorokit-way","depth":3,"children":[]},{"title":"How it works","slug":"how-it-works","depth":3,"children":[]},{"title":"Example: Instant Form Validation","slug":"example-instant-form-validation","depth":3,"children":[]},{"title":"Deep Precision","slug":"deep-precision","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"odii","siteName":"Sorokit","title":"The Native Zod Adapter - Sorokit","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-03T17:33:26.457Z","originalFileLocation":"tools/zod-adapter.mdx"},"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=\"system\"}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=\"Turn Soroban smart contract specs into instant UI validation at runtime.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Sorokit\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/odii/YrF9jnVJMBqraKeu/_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/odii/YrF9jnVJMBqraKeu/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/odii/YrF9jnVJMBqraKeu/_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/odii/YrF9jnVJMBqraKeu/_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/odii/YrF9jnVJMBqraKeu/_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/odii/YrF9jnVJMBqraKeu/_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/odii/YrF9jnVJMBqraKeu/_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/odii/YrF9jnVJMBqraKeu/_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/odii/YrF9jnVJMBqraKeu/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"The Native Zod Adapter - Sorokit\">\u003cmeta data-mint-head property=\"og:description\" content=\"Turn Soroban smart contract specs into instant UI validation at runtime.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Sorokit\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.sorokit.xyz/tools/zod-adapter\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://odii.mintlify.app/_mintlify/api/og/v2?division=The+Toolkit\u0026amp;title=The+Native+Zod+Adapter\u0026amp;description=Turn+Soroban+smart+contract+specs+into+instant+UI+validation+at+runtime.\u0026amp;theme=28e9899eeec0b70bb5d73c37\u0026amp;signature=557e18aa75864eed5bcac2cb752dc421c96ce3c12b66b00ad0b1bb7b06ca66e7\">\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=\"The Native Zod Adapter - Sorokit\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Turn Soroban smart contract specs into instant UI validation at runtime.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://odii.mintlify.app/_mintlify/api/og/v2?division=The+Toolkit\u0026amp;title=The+Native+Zod+Adapter\u0026amp;description=Turn+Soroban+smart+contract+specs+into+instant+UI+validation+at+runtime.\u0026amp;theme=28e9899eeec0b70bb5d73c37\u0026amp;signature=557e18aa75864eed5bcac2cb752dc421c96ce3c12b66b00ad0b1bb7b06ca66e7\">\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/odii/YrF9jnVJMBqraKeu/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Sorokit\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#16A34A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.sorokit.xyz/tools/zod-adapter\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/tools/zod-adapter.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.sorokit.xyz/#organization\",\"name\":\"Sorokit\",\"url\":\"https://docs.sorokit.xyz\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/odii/rGxWz8wR2KgWjlAs/logo/light.png?fit=max\u0026auto=format\u0026n=rGxWz8wR2KgWjlAs\u0026q=85\u0026s=8dfee127ab1382a72c3c2ed50a886ea8\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.sorokit.xyz#website\",\"name\":\"Sorokit\",\"url\":\"https://docs.sorokit.xyz\",\"publisher\":{\"@id\":\"https://docs.sorokit.xyz/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.sorokit.xyz/tools/zod-adapter#webpage\",\"url\":\"https://docs.sorokit.xyz/tools/zod-adapter\",\"name\":\"The Native Zod Adapter\",\"description\":\"Turn Soroban smart contract specs into instant UI validation at runtime.\",\"dateModified\":\"2026-09-03T17:33:26.457Z\",\"isPartOf\":{\"@id\":\"https://docs.sorokit.xyz#website\"},\"breadcrumb\":{\"@id\":\"https://docs.sorokit.xyz/tools/zod-adapter#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.sorokit.xyz/tools/zod-adapter#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"The Toolkit\",\"item\":\"https://docs.sorokit.xyz/tools/devtools\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Native Zod Adapter\",\"item\":\"https://docs.sorokit.xyz/tools/zod-adapter\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.sorokit.xyz/tools/zod-adapter#article\",\"headline\":\"The Native Zod Adapter\",\"name\":\"The Native Zod Adapter\",\"description\":\"Turn Soroban smart contract specs into instant UI validation at runtime.\",\"url\":\"https://docs.sorokit.xyz/tools/zod-adapter\",\"mainEntityOfPage\":{\"@id\":\"https://docs.sorokit.xyz/tools/zod-adapter#webpage\"},\"dateModified\":\"2026-09-03T17:33:26.457Z\",\"publisher\":{\"@id\":\"https://docs.sorokit.xyz/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.sorokit.xyz#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Sorokit\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Sorokit","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Getting Started","pages":[{"title":"The Problem","href":""},{"title":"Quickstart","href":"/quickstart"}]},{"group":"The React Hooks","pages":[{"title":"useContractCall","href":"/hooks/use-contract-call"},{"title":"useContractSend","href":"/hooks/use-contract-send"},{"title":"useSorobanForm","href":"/hooks/use-soroban-form"},{"title":"useBalance","href":"/hooks/use-balance"},{"title":"useTransactionStatus","href":"/hooks/use-transaction-status"},{"title":"useNetworkStatus","href":"/hooks/use-network-status"}]},{"group":"The Toolkit","pages":[{"title":"Integrated DevTools","description":"Debugging is a feature, not an afterthought. Inspect your transactions right where you build them.","href":"/tools/devtools"},{"title":"The Native Zod Adapter","href":"/tools/zod-adapter"},{"title":"Transaction Sequencer","description":"Prevent sequence collisions and tx_bad_seq errors automatically.","href":"/tools/transaction-sequencer"},{"title":"Resumable Transactions","href":"/tools/resumable-transactions"},{"title":null,"href":"/tools/streaming"}]}]},{"tab":"Wallet Adapter","pages":[{"title":"Wallet Adapter","href":"/wallets/setup"}]},{"tab":"Resources","pages":[{"title":"Resources","href":"/guides/token-transfer-form"}]}]},"basePath":"","title":"The Native Zod Adapter - Sorokit","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":[],"chunks":[]}