Handle the signatures some zap routes need before they can be built, such as Aave’s credit delegation for a borrow, with the DZap SDK.
Most zaps go quote → approve → build → send. Some routes need something extra in the middle: a signature from the user that has to exist before DZap can build the transaction, because it gets embedded in the transaction itself. Those are pre-execution steps.A borrow is the usual example. The zap contract borrows on the user’s behalf, and a lending market won’t let anyone take on debt in someone’s name without permission. On Aave v3 that permission is a credit-delegation signature (DelegationWithSig). In plain terms it says “the DZap zap contract may borrow up to this much USDC against my account, until this deadline.” DZap can’t produce that signature itself, and the transaction can’t exist without it, so the quote asks for it first.
The quote comes back with preExecutionSteps, a list of things to sign. Quotes never need the signatures, so you can show a quote before asking the user for anything.
You have the user sign each one.
You send the signatures back as preExecutionStepsData on the build request. The build puts them into the transaction.
prepareZapPreExecutionData asks the wallet to sign each step’s typed data, one at a time and in order. On success, preExecutionStepsData holds { id, type, signature, message } for every step, which is exactly what the build expects. If the quote asked for nothing, you get success with an empty list, so you can call it on every quote without checking first.It doesn’t throw. Like approve() and zap(), it returns a result with a status. If the user cancels a signature you get status: 'rejected', and any other failure comes back as error, both with an errorMsg you can show and a code. It stops at the first step that fails, so a partial list never reaches the build.
If you don’t need to show anything between signing and sending, zap() can do all of it in one call. Pass the request and preExecutionSteps: quote.preExecutionSteps, leave out steps, and it signs, builds and sends.
// What the quote asks for, on quote.preExecutionSteps (and on buildZapTxn / buildZapBundleTx responses)type ZapPreExecutionStep = { id: string; // send it back unchanged; it's how the build matches the signature to the step type: 'sign'; // the only kind today data: ZapTypedDataPayload; // { domain, types, primaryType, message }, ready for signTypedData};// What you send back, on the request's preExecutionStepsDatatype ZapPreExecutionStepData = { id: string; type: 'sign'; signature: HexString; message: Record<string, unknown>; // the step's data.message, unchanged};// What prepareZapPreExecutionData returnstype ZapPreExecutionResult = | { status: TxnStatus.success; code: StatusCodes | number; preExecutionStepsData: ZapPreExecutionStepData[] } | { status: Exclude<TxnStatus, TxnStatus.success>; code: StatusCodes; errorMsg: string; error: any };
preExecutionStepsData is accepted on both ZapBundleRequest and ZapBuildTxnRequest, so single zaps can use it as well as bundles.
It’s a signature, not a transaction. No gas, and the wallet shows it as a typed-data request. Nothing happens on-chain until the built transaction is sent.
Sign everything in the list, and don’t count on its length. An Aave v3 borrow asks for one signature today. Other markets ask for their own (Aave v4 and Morpho each have an authorization), and most routes return an empty list. If your code loops over whatever comes back, it keeps working when that changes.
The signature can pin parts of the route. For an Aave borrow, the signed message.valueis the amount the build borrows. Change destAmount between quote and build and the build is rejected. Quote again and sign again.
It expires. The Aave delegation is valid for an hour and tied to the user’s current delegation nonce on that debt token, so any other delegation signed in the meantime invalidates it. Ask for the signature when the user is about to confirm, not when the page loads, and don’t reuse it for a later transaction.
Building without it fails. The build won’t fall back to something else. It errors until the signatures are there.
Over REST, the quote returns the same list in data.preExecutionSteps. Each sign step’s data is a ready-made EIP-712 payload (domain, types, primaryType, message). Pass it to eth_signTypedData_v4, or to viem’s signTypedData, and add this to the build body:
Send the message back exactly as you received it, without rebuilding it. The backend reads values like the amount and deadline from it, and anything that differs from what was signed invalidates the signature.
No signature provided for borrow delegation: the build had no preExecutionStepsData, or it had signatures from a different quote. Sign what the latest quote returned.
Signed credit delegation (…) does not match the borrow amount: the signed amount and the built amount differ. Either destAmount changed after signing, or you left destAmount out and the maximum dropped below what was signed. Quote and sign again.
The signature stopped working after a while: it expired, or another delegation used up its nonce. Quote again right before asking the user to sign.
For a full walkthrough of both borrow flows, see the Borrow recipe.
Last modified on October 10, 2026
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"DZap","description":"DZap is zapping infrastructure for DeFi aggregation and intent execution across EVM, Solana, Bitcoin, and Sui.","colors":{"primary":"#93E900","light":"#B4F23F","dark":"#5FA500"},"logo":{"light":"https://mintcdn.com/dzap-38a4978a/LXTGoBwwZWs1T77l/logo/light.svg?fit=max\u0026auto=format\u0026n=LXTGoBwwZWs1T77l\u0026q=85\u0026s=95b5cc0a4313de9d446eb798727974b8","dark":"https://mintcdn.com/dzap-38a4978a/LXTGoBwwZWs1T77l/logo/dark.svg?fit=max\u0026auto=format\u0026n=LXTGoBwwZWs1T77l\u0026q=85\u0026s=b631853712879a55a5e3f1d6334a2f2c"},"favicon":"https://mintcdn.com/dzap-38a4978a/ehfQxAfyTUZNILZh/favicon.ico?fit=max\u0026auto=format\u0026n=ehfQxAfyTUZNILZh\u0026q=85\u0026s=eb0474eeeeafd7c797c258b7031ab34e","navbar":{"links":[{"href":"https://calendly.com/dzap-bd/30min","label":"Talk to Us"},{"href":"https://discord.com/invite/aRHESJB9md","label":"Discord"},{"href":"https://github.com/DZapIO","label":"GitHub"}],"primary":{"type":"button","label":"Launch App","href":"https://app.dzap.io"}},"footer":{"socials":{"x":"https://x.com/dzap_io","discord":"https://discord.com/invite/aRHESJB9md","github":"https://github.com/DZapIO"}},"seo":{"metatags":{"canonical":"https://docs.dzap.io","og:type":"website","og:image":"https://docs.dzap.io/images/og-image.png","og:image:width":"1200","og:image:height":"630","og:description":"DZap is zapping infrastructure for DeFi aggregation and intent execution across EVM, Solana, Bitcoin, and Sui.","twitter:card":"summary_large_image","twitter:image":"https://docs.dzap.io/images/og-image.png"}},"metadata":{"timestamp":true},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"dzap-38a4978a","hasAudioNarration":false,"actualSubdomain":"dzap-38a4978a","customDomains":["docs.dzap.io"],"gitSource":{"type":"github","owner":"dzapio","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad055cab04e7ebc7375057e","collectionId":"2b30472c-e7ef-47ca-91c7-32cabbcb2b18","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad055cab04e7ebc7375057e"},"entitlements":{},"buildId":"6ad055cab04e7ebc7375057e","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"SDK","count":37},{"language":"default","tag":"Overview","count":25},{"language":"default","tag":"API","count":25},{"language":"default","tag":"Reference","count":16},{"language":"default","tag":"Widget","count":16},{"language":"default","tag":"Trade API","count":11},{"language":"default","tag":"Learn About DZap","count":10},{"language":"default","tag":"Fuse API","count":10},{"language":"default","tag":"Cookbook","count":9},{"language":"default","tag":"Recipes","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"sdk/zap/pre-execution-steps","slug":"/sdk/zap/pre-execution-steps","pageMetadata":{"title":"Pre-execution Steps","description":"Handle the signatures some zap routes need before they can be built, such as Aave's credit delegation for a borrow, with the DZap SDK.","icon":"signature","href":"/sdk/zap/pre-execution-steps"},"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: \"Handle the signatures some zap routes need before they can be built, such as Aave’s credit delegation for a borrow, with the DZap SDK.\"\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`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Most zaps go quote → approve → build → send. Some routes need something extra in the middle: a signature from the user that has to exist `,_jsx(_components.strong,{children:`before`}),` DZap can build the transaction, because it gets embedded in the transaction itself. Those are pre-execution steps.`]}),`\n`,_jsxs(_components.p,{children:[`A borrow is the usual example. The zap contract borrows `,_jsx(_components.em,{children:`on the user’s behalf`}),`, and a lending market won’t let anyone take on debt in someone’s name without permission. On Aave v3 that permission is a credit-delegation signature (`,_jsx(_components.code,{children:`DelegationWithSig`}),`). In plain terms it says “the DZap zap contract may borrow up to this much USDC against my account, until this deadline.” DZap can’t produce that signature itself, and the transaction can’t exist without it, so the quote asks for it first.`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How it works`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`The quote comes back with `,_jsx(_components.code,{children:`preExecutionSteps`}),`, a list of things to sign. Quotes never need the signatures, so you can show a quote before asking the user for anything.`]}),`\n`,_jsx(_components.li,{children:`You have the user sign each one.`}),`\n`,_jsxs(_components.li,{children:[`You send the signatures back as `,_jsx(_components.code,{children:`preExecutionStepsData`}),` on the build request. The build puts them into the transaction.`]}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,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:`15`,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:` dzap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getZapBundleQuote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// [{ id: 'aave-delegation-with-sig-8453-0x…', type: 'sign', data: { domain, types, primaryType, message } }]`})}),`\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:`preExecutionSteps`}),_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:` prepared`}),_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:` dzap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`prepareZapPreExecutionData`}),_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:` preExecutionSteps:`}),_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:`preExecutionSteps`}),_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:` signer:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` walletClient`}),_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:` account:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` account`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// optional, read from the signer when left out`})]}),`\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:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`prepared`}),_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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` TxnStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`success`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_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:`prepared`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`errorMsg`}),_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:` buildRequest`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`preExecutionStepsData:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` prepared`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`preExecutionStepsData`}),_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:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` route`}),_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:` dzap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`buildZapBundleTx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`buildRequest`}),_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:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_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:` dzap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`zap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buildRequest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`steps:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` route`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`steps`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`signer:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` walletClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`prepareZapPreExecutionData`}),` asks the wallet to sign each step’s typed data, one at a time and in order. On success, `,_jsx(_components.code,{children:`preExecutionStepsData`}),` holds `,_jsx(_components.code,{children:`{ id, type, signature, message }`}),` for every step, which is exactly what the build expects. If the quote asked for nothing, you get `,_jsx(_components.code,{children:`success`}),` with an empty list, so you can call it on every quote without checking first.`]}),`\n`,_jsxs(_components.p,{children:[`It doesn’t throw. Like `,_jsx(_components.code,{children:`approve()`}),` and `,_jsx(_components.code,{children:`zap()`}),`, it returns a result with a `,_jsx(_components.code,{children:`status`}),`. If the user cancels a signature you get `,_jsx(_components.code,{children:`status: 'rejected'`}),`, and any other failure comes back as `,_jsx(_components.code,{children:`error`}),`, both with an `,_jsx(_components.code,{children:`errorMsg`}),` you can show and a `,_jsx(_components.code,{children:`code`}),`. It stops at the first step that fails, so a partial list never reaches the build.`]}),`\n`,_jsxs(Tip,{children:[_jsxs(_components.p,{children:[`If you don’t need to show anything between signing and sending, `,_jsx(_components.code,{children:`zap()`}),` can do all of it in one call. Pass the request and `,_jsx(_components.code,{children:`preExecutionSteps: quote.preExecutionSteps`}),`, leave out `,_jsx(_components.code,{children:`steps`}),`, and it signs, builds and sends.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,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:`1`,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:` result`}),_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:` dzap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`zap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`preExecutionSteps:`}),_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:`preExecutionSteps`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`signer:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` walletClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`types`,children:`Types`}),`\n`,_jsxs(_components.p,{children:[`All exported from `,_jsx(_components.code,{children:`@dzapio/sdk`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`19`,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:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// What the quote asks for, on quote.preExecutionSteps (and on buildZapTxn / buildZapBundleTx responses)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ZapPreExecutionStep`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// send it back unchanged; it's how the build matches the signature to the step`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'sign'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the only kind today`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ZapTypedDataPayload`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// { domain, types, primaryType, message }, ready for signTypedData`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// What you send back, on the request's preExecutionStepsData`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ZapPreExecutionStepData`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'sign'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` signature`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` HexString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` message`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Record`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`unknown`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the step's data.message, unchanged`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// What prepareZapPreExecutionData returns`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ZapPreExecutionResult`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` TxnStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`success`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StatusCodes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`preExecutionStepsData`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ZapPreExecutionStepData`}),_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\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Exclude`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TxnStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TxnStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`success`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StatusCodes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`errorMsg`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` any`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` };`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`preExecutionStepsData`}),` is accepted on both `,_jsx(_components.code,{children:`ZapBundleRequest`}),` and `,_jsx(_components.code,{children:`ZapBuildTxnRequest`}),`, so single zaps can use it as well as bundles.`]}),`\n`,_jsx(Heading,{level:`2`,id:`things-to-know-before-you-ship-it`,children:`Things to know before you ship it`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`It’s a signature, not a transaction.`}),` No gas, and the wallet shows it as a typed-data request. Nothing happens on-chain until the built transaction is sent.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Sign everything in the list, and don’t count on its length.`}),` An Aave v3 borrow asks for one signature today. Other markets ask for their own (Aave v4 and Morpho each have an authorization), and most routes return an empty list. If your code loops over whatever comes back, it keeps working when that changes.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`The signature can pin parts of the route.`}),` For an Aave borrow, the signed `,_jsx(_components.code,{children:`message.value`}),` `,_jsx(_components.em,{children:`is`}),` the amount the build borrows. Change `,_jsx(_components.code,{children:`destAmount`}),` between quote and build and the build is rejected. Quote again and sign again.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`It expires.`}),` The Aave delegation is valid for an hour and tied to the user’s current delegation nonce on that debt token, so any other delegation signed in the meantime invalidates it. Ask for the signature when the user is about to confirm, not when the page loads, and don’t reuse it for a later transaction.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Building without it fails.`}),` The build won’t fall back to something else. It errors until the signatures are there.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`without-the-sdk`,children:`Without the SDK`}),`\n`,_jsxs(_components.p,{children:[`Over REST, the quote returns the same list in `,_jsx(_components.code,{children:`data.preExecutionSteps`}),`. Each `,_jsx(_components.code,{children:`sign`}),` step’s `,_jsx(_components.code,{children:`data`}),` is a ready-made EIP-712 payload (`,_jsx(_components.code,{children:`domain`}),`, `,_jsx(_components.code,{children:`types`}),`, `,_jsx(_components.code,{children:`primaryType`}),`, `,_jsx(_components.code,{children:`message`}),`). Pass it to `,_jsx(_components.code,{children:`eth_signTypedData_v4`}),`, or to viem’s `,_jsx(_components.code,{children:`signTypedData`}),`, and add this to the build body:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"preExecutionStepsData\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cthe step's id>\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sign\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"signature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0x…\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"…\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"the step's data.message, unchanged\"`}),_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:[`Send the `,_jsx(_components.code,{children:`message`}),` back exactly as you received it, without rebuilding it. The backend reads values like the amount and deadline from it, and anything that differs from what was signed invalidates the signature.`]}),`\n`,_jsx(Heading,{level:`2`,id:`errors`,children:`Errors`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`No signature provided for borrow delegation`})}),`: the build had no `,_jsx(_components.code,{children:`preExecutionStepsData`}),`, or it had signatures from a different quote. Sign what the latest quote returned.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`Signed credit delegation (…) does not match the borrow amount`})}),`: the signed amount and the built amount differ. Either `,_jsx(_components.code,{children:`destAmount`}),` changed after signing, or you left `,_jsx(_components.code,{children:`destAmount`}),` out and the maximum dropped below what was signed. Quote and sign again.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`The signature stopped working after a while`}),`: it expired, or another delegation used up its nonce. Quote again right before asking the user to sign.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`For a full walkthrough of both borrow flows, see the `,_jsx(_components.a,{href:`/cookbook/zap/borrow`,children:`Borrow`}),` recipe.`]})]})}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":"Pre-execution Steps","description":"Handle the signatures some zap routes need before they can be built, such as Aave's credit delegation for a borrow, with the DZap SDK.","icon":"signature","href":"/sdk/zap/pre-execution-steps"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"How it works","slug":"how-it-works","depth":2,"children":[]},{"title":"Types","slug":"types","depth":2,"children":[]},{"title":"Things to know before you ship it","slug":"things-to-know-before-you-ship-it","depth":2,"children":[]},{"title":"Without the SDK","slug":"without-the-sdk","depth":2,"children":[]},{"title":"Errors","slug":"errors","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"dzap-38a4978a","siteName":"DZap","title":"Pre-execution Steps - DZap","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-10T08:43:09.828Z","gitLastModified":"2026-10-10T08:42:56.000Z","originalFileLocation":"sdk/zap/pre-execution-steps.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=\"Handle the signatures some zap routes need before they can be built, such as Aave\u0026#x27;s credit delegation for a borrow, with the DZap SDK.\">\u003cmeta data-mint-head name=\"application-name\" content=\"DZap\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/dzap-38a4978a/_axGAa6qZdKkPQjz/_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/dzap-38a4978a/_axGAa6qZdKkPQjz/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/dzap-38a4978a/_axGAa6qZdKkPQjz/_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/dzap-38a4978a/_axGAa6qZdKkPQjz/_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/dzap-38a4978a/_axGAa6qZdKkPQjz/_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/dzap-38a4978a/_axGAa6qZdKkPQjz/_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/dzap-38a4978a/_axGAa6qZdKkPQjz/_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/dzap-38a4978a/_axGAa6qZdKkPQjz/_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/dzap-38a4978a/_axGAa6qZdKkPQjz/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Pre-execution Steps - DZap\">\u003cmeta data-mint-head property=\"og:description\" content=\"DZap is zapping infrastructure for DeFi aggregation and intent execution across EVM, Solana, Bitcoin, and Sui.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"DZap\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.dzap.io/sdk/zap/pre-execution-steps\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.dzap.io/images/og-image.png\">\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=\"Pre-execution Steps - DZap\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"DZap is zapping infrastructure for DeFi aggregation and intent execution across EVM, Solana, Bitcoin, and Sui.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.dzap.io/images/og-image.png\">\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/dzap-38a4978a/_axGAa6qZdKkPQjz/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"DZap\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#93E900\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.dzap.io/sdk/zap/pre-execution-steps\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk/zap/pre-execution-steps.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.dzap.io/#organization\",\"name\":\"DZap\",\"url\":\"https://docs.dzap.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/dzap-38a4978a/LXTGoBwwZWs1T77l/logo/light.svg?fit=max\u0026auto=format\u0026n=LXTGoBwwZWs1T77l\u0026q=85\u0026s=95b5cc0a4313de9d446eb798727974b8\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.dzap.io#website\",\"name\":\"DZap\",\"url\":\"https://docs.dzap.io\",\"publisher\":{\"@id\":\"https://docs.dzap.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps#webpage\",\"url\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps\",\"name\":\"Pre-execution Steps\",\"description\":\"Handle the signatures some zap routes need before they can be built, such as Aave's credit delegation for a borrow, with the DZap SDK.\",\"dateModified\":\"2026-10-10T08:42:56.000Z\",\"isPartOf\":{\"@id\":\"https://docs.dzap.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Zap\",\"item\":\"https://docs.dzap.io/sdk/zap/request-quotes\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pre-execution Steps\",\"item\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps#article\",\"headline\":\"Pre-execution Steps\",\"name\":\"Pre-execution Steps\",\"description\":\"Handle the signatures some zap routes need before they can be built, such as Aave's credit delegation for a borrow, with the DZap SDK.\",\"url\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps\",\"mainEntityOfPage\":{\"@id\":\"https://docs.dzap.io/sdk/zap/pre-execution-steps#webpage\"},\"image\":\"https://docs.dzap.io/images/og-image.png\",\"dateModified\":\"2026-10-10T08:42:56.000Z\",\"publisher\":{\"@id\":\"https://docs.dzap.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.dzap.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"DZap\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"DZap","nav":{"global":null,"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":""}]},{"tab":"API","pages":[{"title":"API","href":"/api/introduction"}]},{"tab":"SDK","groups":[{"group":"@dzapio/sdk","pages":[{"title":"SDK Overview","sidebarTitle":"Overview","icon":"js","href":"/sdk/overview"},{"title":"Installation","sidebarTitle":"Installation","icon":"download","href":"/sdk/installation"},{"title":"DZapClient","sidebarTitle":"Client","icon":"cube","href":"/sdk/client"},{"title":"Gasless Trading","sidebarTitle":"Intents","icon":"signature","href":"/sdk/intents"}]},{"group":"Trade","pages":[{"title":"Request Trade Quotes","icon":"chart-line","href":"/sdk/trade/request-quotes"},{"title":"Execute Trade","icon":"rocket","href":"/sdk/trade/execute-trade"},{"title":"Track Trade Status","icon":"radar","href":"/sdk/trade/status-tracking"}]},{"group":"Zap","pages":[{"title":"Request Zap Quotes","icon":"bolt","href":"/sdk/zap/request-quotes"},{"title":"Execute Zap","description":"Execute complex multi-step zap transactions using the DZap SDK","icon":"rocket","href":"/sdk/zap/execute-zap"},{"title":"Pre-execution Steps","icon":"signature","href":"/sdk/zap/pre-execution-steps"},{"title":"Track Zap Status","description":"Monitor and track complex zap transaction status using the DZap SDK","icon":"radar","href":"/sdk/zap/status-tracking"}]},{"group":"Tokens \u0026 Balances","pages":[{"title":"Get Tokens","icon":"coins","href":"/sdk/tokens/get-tokens"},{"title":"Token Balances","icon":"wallet","href":"/sdk/tokens/token-balances"},{"title":"Token Prices","icon":"chart-line","href":"/sdk/tokens/token-prices"}]},{"group":"Chains","pages":[{"title":"Supported Chains","icon":"link","href":"/sdk/chains/supported-chains"}]},{"group":"Approvals","pages":[{"title":"Check Allowance","sidebarTitle":"Check Allowance","icon":"check","href":"/sdk/approvals/check-allowance"},{"title":"Approve","sidebarTitle":"Approve","icon":"check","href":"/sdk/approvals/approve"},{"title":"Sign","sidebarTitle":"Sign","icon":"check","href":"/sdk/approvals/sign"},{"title":"Approval Mechanisms","icon":"shield-check","href":"/sdk/approval-mechanisms"}]},{"group":"Utilities","pages":[{"title":"decodeTxnData","sidebarTitle":"decodeTxnData","icon":"wrench","href":"/sdk/utilities/decode-txn-data"},{"title":"calculatePoints","sidebarTitle":"calculatePoints","icon":"wrench","href":"/sdk/utilities/calculate-points"},{"title":"Batch Calls","sidebarTitle":"Batch Calls","icon":"wrench","href":"/sdk/utilities/batch-calls"},{"title":"Chain Helpers","sidebarTitle":"Chain Helpers","icon":"wrench","href":"/sdk/utilities/chain-helpers"}]},{"group":"Reference","pages":[{"title":"Trade Quotes Types","icon":"code","href":"/sdk/reference/types/trade-quotes"},{"title":"Trade Build \u0026 Execute Types","icon":"code","href":"/sdk/reference/types/trade-build-execute"},{"title":"Allowance Type","icon":"code","href":"/sdk/reference/types/allowance"},{"title":"HexString Type","icon":"code","href":"/sdk/reference/types/hex-string"},{"title":"Services","icon":"list","href":"/sdk/reference/enums/services"},{"title":"TxnStatus","icon":"list","href":"/sdk/reference/enums/txn-status"},{"title":"ApprovalModes","icon":"list","href":"/sdk/reference/enums/approval-modes"},{"title":"PermitTypes","icon":"list","href":"/sdk/reference/enums/permit-types"},{"title":"contractErrorActions","icon":"list","href":"/sdk/reference/enums/contract-error-actions"},{"title":"Native Token Address","icon":"list","href":"/sdk/reference/enums/native-token-address"},{"title":"StatusCodes","icon":"circle-exclamation","href":"/sdk/reference/errors/status-codes"},{"title":"Trade Failure Actions","icon":"circle-exclamation","href":"/sdk/reference/errors/trade-failure-actions"},{"title":"DZapTransactionResponse","icon":"circle-exclamation","href":"/sdk/reference/errors/dzap-transaction-response"}]},{"group":"Examples","pages":[{"title":"Batch Swap (Multi-Token)","icon":"layer-group","href":"/sdk/examples/batch-swap"}]}]},{"tab":"Widget","pages":[{"title":"Widget","href":"/widget/overview"}]},{"tab":"Cookbook","pages":[{"title":"Cookbook","href":"/cookbook/trade/swap"}]},{"tab":"Resources","pages":[{"title":"Resources","href":"/resources/glossary"}]}]},"basePath":"","title":"Pre-execution Steps - DZap","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":[],"chunks":[]}