Skip to content

feat: add fetchOptions to core and react so Origin header can be sent on RN#74

Merged
andrascodes merged 1 commit into
mainfrom
andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn
May 13, 2026
Merged

feat: add fetchOptions to core and react so Origin header can be sent on RN#74
andrascodes merged 1 commit into
mainfrom
andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn

Conversation

@andrascodes
Copy link
Copy Markdown
Collaborator

@andrascodes andrascodes commented Apr 1, 2026

This PR is part of a stack created with Aviator.

Part of FS-1971

fetch doesn't automatically send Origin headers on React Native as there's no concept of a domain there. (It sends an IP instead.) So I solved this by passing through the Origin headers instead configurable via the wallet-react and wallet-core entrypoints.
We definitely have to come up with a better solution to this, but for the purpose of testing this works. I'm totally fine not merging this.

@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from e94d813 to de941af Compare April 1, 2026 17:11
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 6d3fa6a to 49a2c93 Compare April 1, 2026 17:11
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from de941af to 6e07c19 Compare April 1, 2026 21:08
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 49a2c93 to 9631468 Compare April 1, 2026 21:08
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 9631468 to 5dfaff7 Compare April 7, 2026 11:21
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from 6e07c19 to ca5f62a Compare April 7, 2026 11:21
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 5dfaff7 to ed19d1b Compare April 7, 2026 16:17
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from ca5f62a to 4bcc9a3 Compare April 7, 2026 16:17
@andrascodes andrascodes marked this pull request as ready for review April 7, 2026 16:55
@andrascodes
Copy link
Copy Markdown
Collaborator Author

I'll actually change this so we pass in an appId only. Then inside the SDK I'll just create the Origin header from the appId. I think that will match better what the KMS is planning to accept.

@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from ed19d1b to 64aaa8d Compare April 20, 2026 10:11
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from 4bcc9a3 to 5b62471 Compare April 20, 2026 10:11
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from 5b62471 to 529ba6c Compare April 24, 2026 17:57
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 64aaa8d to 1be46e0 Compare April 24, 2026 17:57
Comment thread packages/react/src/connector.ts Outdated
Comment thread packages/react/src/connector.ts Outdated
Copy link
Copy Markdown
Collaborator

@SahilVasava SahilVasava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direction is right — fetchOptions is the right plumbing for RN's Origin-header use case, and the Omit<RequestInit, 'body' | 'method' | 'signal'> is the correct restriction (SDK builds body, sets method, controls signal).

Two cleanup suggestions inline:

  • Reuse CreateTransportOptions['fetchOptions'] instead of duplicating the Omit
  • Hoist { fetchOptions: params.fetchOptions } once instead of repeating it four times

(Out of scope: the user's fetchOptions.headers can override SDK's Content-Type due to merge order in rest.ts:52-56. Pre-existing, worth a follow-up but doesn't block this.)

@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 1be46e0 to 1609ff9 Compare May 4, 2026 13:12
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch 2 times, most recently from 0259805 to 5567f74 Compare May 4, 2026 16:56
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from 5567f74 to 6b4a7c0 Compare May 5, 2026 11:02
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch 2 times, most recently from 48228c1 to bacc73c Compare May 5, 2026 11:28
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from 6b4a7c0 to 87253c6 Compare May 5, 2026 11:28
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from 87253c6 to fd133a8 Compare May 5, 2026 13:22
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from bacc73c to 3bdb8a3 Compare May 5, 2026 13:22
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from fd133a8 to eb9665f Compare May 5, 2026 14:31
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 3bdb8a3 to 66555a7 Compare May 5, 2026 14:31
@andrascodes andrascodes requested a review from SahilVasava May 5, 2026 16:07
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 66555a7 to c6d9181 Compare May 6, 2026 12:18
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch 2 times, most recently from 9441987 to cb83a89 Compare May 6, 2026 13:26
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from c6d9181 to bdf379f Compare May 6, 2026 13:26
SahilVasava
SahilVasava previously approved these changes May 6, 2026
Copy link
Copy Markdown
Collaborator

@SahilVasava SahilVasava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — type duplication removed (uses CreateTransportOptions['fetchOptions']) and the repeated { fetchOptions: params.fetchOptions } is now a single httpOpts local.

@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from cb83a89 to 5ce572d Compare May 11, 2026 18:48
@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from bdf379f to 57273e4 Compare May 11, 2026 18:48
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zerodev-signer-demo Ready Ready Preview, Comment May 13, 2026 10:46am

Request Review

@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from 57273e4 to b980e22 Compare May 13, 2026 10:29
@andrascodes andrascodes force-pushed the andras/feat-react-expose-stamper-storage-and-shouldinit-params branch from 5ce572d to 9e9a6db Compare May 13, 2026 10:29
@andrascodes andrascodes changed the base branch from andras/feat-react-expose-stamper-storage-and-shouldinit-params to main May 13, 2026 10:44
@andrascodes andrascodes dismissed SahilVasava’s stale review May 13, 2026 10:44

The base branch was changed.

@andrascodes andrascodes force-pushed the andras/feat-add-fetchoptions-to-core-and-react-so-origin-header-can-be-sent-on-rn branch from b980e22 to 3752741 Compare May 13, 2026 10:45
@andrascodes andrascodes merged commit 18320e8 into main May 13, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants