feat(suins): migrate to Pyth Pro [SUIP-1111] - #1158
Draft
John-Atha wants to merge 14 commits into
Draft
Conversation
Add an optional `pyth` config (`endpoint`, `accessToken`) to SuinsClient and forward it to the Pyth price-service connection, sending the token as an `Authorization: Bearer` header for keyed endpoints. Move the price-update fetch from the deprecated Hermes v1 (`/api/latest_vaas`) to v2 (`/v2/updates/price/latest`). Read the Pyth and Wormhole on-chain state via layout-agnostic JSON fields instead of BCS struct decoding, so a single build works against both the current and Pro-compatible Pyth package layouts. Verified end-to-end on mainnet against the keyed Pro endpoint + Pro state objects, and against the current public endpoint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The upgraded (Core->Pro) Pyth and Wormhole State structs have the same layout as the current ones, so the existing generated BCS bindings decode them unchanged. Revert the layout-agnostic JSON state reads added earlier; they are unnecessary. Verified end-to-end on mainnet: the current BCS bindings plus the upgraded Pyth/ Wormhole state ids verify keyed Pro price updates on-chain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…1111] Hard-code the single keyed Pyth Pro Hermes endpoint and drop the public host; the Pyth config collapses to a `pythAccessToken` on both `SuinsClient` and the `suins()` extension, sent as an `Authorization: Bearer` header. Point the Pyth/Wormhole state ids at the upgraded (Pro-compatible) deployments and converge the testnet price feeds to the global feed ids. Wire the live test to read `VITE_PYTH_ACCESS_TOKEN` from env (skipping when absent) and add a `.env.example`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 22, 2026 13:23 — with
GitHub Actions
Inactive
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
John-Atha
marked this pull request as draft
July 22, 2026 13:23
…-interface-for-pyth-endpoints-v2
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 22, 2026 14:08 — with
GitHub Actions
Inactive
- bump testnet payments/bbb package ids to the upgraded published-at - add payments.packageIdV1 to keep the original id for PaymentsConfig type identity, since an in-place upgrade moves only the call target - regenerate the payments binding with handle_payment_pro/calculate_price_pro - call the _pro entrypoints in the non-base register/renew path Testnet e2e reaches calculate_price_pro and aborts only on EPriceFeedIdMismatch, pending the on-chain feed-id admin update. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 27, 2026 14:57 — with
GitHub Actions
Inactive
The two cases only asserted the code calls axios the way it calls axios (change-detectors against mocks). The real Pyth Pro path is covered by the live e2e, so this added no behavioral coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Keep the endpoint where it was on main (a local in getPriceInfoObject) instead of a module constant, to minimize the diff. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 27, 2026 17:52 — with
GitHub Actions
Inactive
…p-1111-suins-sdk-update-interface-for-pyth-endpoints-v2
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 27, 2026 17:58 — with
GitHub Actions
Inactive
getPriceInfoObject is the only consumer of the token; guard it so a missing token fails fast with a clear message instead of an opaque 401 from the keyed Pro Hermes endpoint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 28, 2026 08:36 — with
GitHub Actions
Inactive
It's a credential only read inside the class; readonly prevents reassignment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 28, 2026 08:48 — with
GitHub Actions
Inactive
natalypeyioti
approved these changes
Jul 28, 2026
Throw a legible error if `binary.data` is missing instead of a bare "Cannot read properties of undefined" TypeError when the shape drifts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 28, 2026 09:01 — with
GitHub Actions
Inactive
Testnet NS now points at the global NS feed (same as mainnet), so the "using the HFT feed since NS feed on testnet is not available" note no longer applies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
John-Atha
temporarily deployed
to
sui-typescript-aws-kms-test-env
July 28, 2026 09:05 — with
GitHub Actions
Inactive
12 tasks
natalypeyioti
had a problem deploying
to
sui-typescript-aws-kms-test-env
August 18, 2026 21:24 — with
GitHub Actions
Failure
natalypeyioti
marked this pull request as ready for review
August 18, 2026 21:43
natalypeyioti
had a problem deploying
to
sui-typescript-aws-kms-test-env
August 18, 2026 21:43 — with
GitHub Actions
Failure
hayes-mysten
approved these changes
Aug 18, 2026
natalypeyioti
marked this pull request as draft
August 18, 2026 22:09
natalypeyioti
had a problem deploying
to
sui-typescript-aws-kms-test-env
August 18, 2026 22:17 — with
GitHub Actions
Failure
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.
Description
Pyth is retiring the public Hermes endpoint in favour of a keyed Pyth Pro endpoint and upgrading the on-chain Pyth/Wormhole packages (Core→Pro cutover, see https://docs.pyth.network/price-feeds/core/upgrade/preparing/sui). This migrates the SuiNS SDK's Pyth integration to Pro.
Scoped to testnet for now; mainnet follows once its contracts are upgraded (see Pending).
Price fetching
/v2/updates/price/latest), replacing the deprecated public v1 (/api/latest_vaas) host. A single host serves all networks.pythAccessTokentoSuinsClientand thesuins()extension, sent as anAuthorization: Bearerheader. It is required for non-base-currency registrations/renewals (the base currency does not use the oracle).On-chain wiring
payments/bbbpackage ids to their upgraded versions. Addpayments.packageIdV1(the original id) so thePaymentsConfigtype identity stays keyed by the original package while calls target the latest one.paymentsbinding and switch the non-base register/renew path to the Pro_proentrypoints (calculate_price_pro/handle_payment_pro). The old Core entrypoints now abort on-chain (ECoreFeedDeprecated).Pending (mainnet, follow-up)
_proentrypoints unconditionally, so the mainnet flow works only once mainnet is upgraded and its ids are bumped (mirroring testnet). Kept as a draft until then.Test plan
status: success,SuinsRegistrationNFT minted, andpyth+paymentsevents emitted (a live Pyth Pro price update settled on-chain, consumed byhandle_payment_pro). TxFFc4iJqJ67kyCNTgEvH23fkoUwr1GqpJVsSwwYov94k8.live.test.tstestnet dry-run green against the Pro endpoint + Pro contracts (skips whenVITE_PYTH_ACCESS_TOKENis unset). Reproducing requires the testnetPaymentsConfigfeed ids aligned to the updated Pyth Pro feed ids (related discussion here); that on-chain admin step is tracked on the contracts side (SUIP-1105) and is temporarily reverted on testnet now to avoid blocking users that are still on the previous package versions.401without a token and200with a valid one.AI Assistance Notice