feat: add PermitSingle to TypedDataPrimaryTypes - #577
Merged
Merged
Conversation
Permit2's AllowanceTransfer message. A custom swap provider can return one on a quote step so the user signs an allowance for the provider's own spender — a Uniswap Universal Router, for example — after which the API embeds the signature in the step's calldata. The type is already reachable in practice: the SDK classifies it today through a string allowlist, because `primaryType === 'PermitSingle'` does not compile against this union (TS2367). Declaring it here lets the SDK compare against the union directly, and lets the backend and the widget name the type. `PermitBatch` is deliberately left out. It carries `PermitDetails[]` over several tokens, while the consuming allowance path is single-token, so declaring it would suggest support that does not exist. Ref: JUMADV-90
chybisov
deleted the
feat/jumadv-90-add-permitsingle-typed-data-type
branch
September 10, 2026 15:25
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Linear task is linked to this PR?
JUMADV-90 — Widget: native Permit2 (PermitSingle) signing for custom swap providers
Companion to lifinance/sdk#475. Neither PR blocks the other — see below.
Why was it implemented this way?
One line:
'PermitSingle'is appended toTypedDataPrimaryTypes.What the type is
Permit2's AllowanceTransfer message. A custom swap provider can return one on a quote step so the user signs an allowance for the provider's own spender — a Uniswap Universal Router, for example. The API then embeds that signature into the step's calldata, and the user sends the transaction themselves.
This is distinct from the
PermitWitnessTransferFrom/PermitTransferFromfamily already declared here, which is Permit2 SignatureTransfer and belongs to the gasless relayer path.Why declare it now
The type is already reachable in practice. sdk#475 classifies it today through a
readonly string[]allowlist rather than a union comparison, becauseprimaryType === 'PermitSingle'does not compile against this union —TS2367: This comparison appears to be unintentional.That allowlist is deliberate and stays correct either way: the API can introduce a primary type before this package knows it, so the SDK's classifier has to tolerate unknown values regardless. Declaring the member here adds three things:
Alternative considered: also add
PermitBatchLeft out on purpose.
PermitBatchcarriesPermitDetails[]across several tokens, while the consuming allowance path in the SDK is single-token — it readsstep.action.fromToken.address. DeclaringPermitBatchwould suggest support that does not exist. It currently falls to the SDK's default classification, which routes it to the relayer and is the safe answer.Placement
Appended to the end of the array, matching how
NonceMapping(#502) andHyperliquidTransaction:ApproveBuilderFee(#505) were added.Commit type
feat:rather than thechore:used by those two PRs. This is an API-surface addition that a consumer will pin against, so it should cut a minor and appear in the changelog.Visual showcase (Screenshots or Videos)
Not applicable — a type declaration.
Compatibility
Additive and non-breaking.
TypedDataPrimaryTypeis a union of string literals; widening it cannot invalidate existing code that produces those values.One note for consumers that consume the union: an exhaustive
switchor lookup overTypedDataPrimaryTypeswill now see a member it did not before. In the SDK this is intentional and already handled — its lane table asserts an entry exists for every declared primary type, andPermitSingleis already mapped, so the suite stays green after the pin is bumped.Verification
pnpm typecheck— clean.pnpm build— clean; the emitted declaration carries the new member.Checklist before requesting a review
The third item is unchecked deliberately: this declares a type the API can already emit, and
public-docshas no page enumerating typed-data primary types. Point me at one if I have missed it and I will update it.