-
Notifications
You must be signed in to change notification settings - Fork 65
Surface relayer sponsorship signal end-to-end (additive, non-breaking) #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| '@0xsequence/dapp-client': minor | ||
| --- | ||
|
|
||
| Add `isSponsored` for explicit sponsorship checks. | ||
|
|
||
| `DappClient.isSponsored(chainId, transactions)` and | ||
| `ChainSessionManager.isSponsored(calls)` return `true` only when the relayer's | ||
| `/FeeOptions` endpoint explicitly reports sponsorship. Any error, network | ||
| failure, or absence of sponsorship returns `false`, so a `true` result is | ||
| always safe to surface as "free gas" in UI. | ||
|
|
||
| Prefer this over inferring sponsorship from an empty `getFeeOptions` array — a | ||
| swallowed `/FeeOptions` error also produces an empty array, so the inference | ||
| can misclassify a failed quote as a real subsidy. The new method uses the | ||
| positive `sponsored: boolean` signal from `@0xsequence/relayer`'s widened | ||
| `feeOptions` return. | ||
|
|
||
| `getFeeOptions` is unchanged. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| '@0xsequence/relayer': minor | ||
| --- | ||
|
|
||
| Surface explicit sponsorship signal on `feeOptions` and an error marker on | ||
| `feeOptions` / `feeTokens`. | ||
|
|
||
| - `RpcRelayer.feeOptions` now returns `sponsored: boolean`, forwarded from the | ||
| server's `FeeOptionsReturn.sponsored`. The `Relayer` interface and all | ||
| bundled implementations (`RpcRelayer`, `SequenceRelayer`, `LocalRelayer`, | ||
| `EIP6963Relayer`, `PkRelayer`) carry the new field. | ||
| - When `feeOptions` swallows a transport / server error it now returns | ||
| `{ options: [], sponsored: false, failed: true }` (was `{ options: [] }`). | ||
| - When `feeTokens` swallows an error it now returns | ||
| `{ isFeeRequired: false, failed: true }` (was `{ isFeeRequired: false }`). | ||
|
|
||
| These changes are additive — existing consumers that ignore the new fields are | ||
| unaffected. Consumers that classified sponsorship by "no fee option attached" | ||
| should migrate to `sponsored === true` to distinguish a real subsidy from a | ||
| swallowed `/FeeOptions` error. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| '@0xsequence/wallet-wdk': minor | ||
| --- | ||
|
|
||
| Carry `sponsored` / `failed` through `StandardRelayerOption`. | ||
|
|
||
| `StandardRelayerOption` now exposes two optional fields: | ||
|
|
||
| - `sponsored?: boolean` — populated from the relayer SDK's new `feeOptions` | ||
| return field. `true` means the server confirmed an active sponsorship policy | ||
| match; `false` means it did not (or the quote failed). | ||
| - `failed?: boolean` — `true` when the relayer's `feeOptions` call was swallowed | ||
| due to a transport or server error. | ||
|
|
||
| Both fields are populated on the empty-options construction branch and the | ||
| per-option mapping branch in `transactions.ts`. The new `isStandardRelayerOption` | ||
| and `isERC4337RelayerOption` runtime helpers are now re-exported from the | ||
| package root for consumers that need to narrow `RelayerOption` before reading | ||
| the new fields. | ||
|
|
||
| UI / wallet consumers that previously classified sponsorship by "no `feeOption` | ||
| attached" should switch to `sponsored === true` so a real subsidy is no longer | ||
| indistinguishable from a swallowed `/FeeOptions` error. |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.