Skip to content

feat: Support Sui Price Update with Coin Input #2861

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 6 commits into from
Jul 22, 2025
Merged

Conversation

darunrs
Copy link
Contributor

@darunrs darunrs commented Jul 17, 2025

Summary

Adds a new SDK function which takes coins as a function argument. This allows the price update calls to work without accessing the TX gas.

Rationale

Request from customer in this thread. They are using some gas station which supplies the correct amount of gas. But it seems that they require the SDK to not access TX.gas.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Configured the original function to generate the coins and then pass them to the new function. The feed updated correctly.

@darunrs darunrs requested a review from a team as a code owner July 17, 2025 17:35
Copy link

vercel bot commented Jul 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 5:06pm
7 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Skipped (Inspect) Jul 22, 2025 5:06pm
developer-hub ⬜️ Skipped (Inspect) Jul 22, 2025 5:06pm
entropy-debugger ⬜️ Skipped (Inspect) Jul 22, 2025 5:06pm
entropy-explorer ⬜️ Skipped (Inspect) Jul 22, 2025 5:06pm
insights ⬜️ Skipped (Inspect) Jul 22, 2025 5:06pm
proposals ⬜️ Skipped (Inspect) Jul 22, 2025 5:06pm
staking ⬜️ Skipped (Inspect) Jul 22, 2025 5:06pm

@vercel vercel bot temporarily deployed to Preview – entropy-debugger July 17, 2025 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer July 17, 2025 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals July 17, 2025 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library July 17, 2025 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – staking July 17, 2025 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – insights July 17, 2025 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub July 17, 2025 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger July 17, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library July 17, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – insights July 17, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub July 17, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals July 17, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer July 17, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – staking July 17, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library July 17, 2025 20:36 Inactive
@vercel vercel bot temporarily deployed to Preview – staking July 17, 2025 20:36 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer July 17, 2025 20:36 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub July 17, 2025 20:36 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals July 17, 2025 20:36 Inactive
@vercel vercel bot temporarily deployed to Preview – insights July 17, 2025 20:36 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger July 17, 2025 20:36 Inactive
@vercel vercel bot temporarily deployed to Preview – insights July 18, 2025 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library July 18, 2025 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger July 18, 2025 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals July 18, 2025 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer July 18, 2025 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – staking July 18, 2025 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub July 18, 2025 16:57 Inactive
const packageId = await this.getPythPackageId();

packageId: string,
): Promise<any> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please don't use any. if the type is not known and you can extract it later use unknown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha, will do!

@@ -6,6 +6,10 @@ import { HexString } from "@pythnetwork/price-service-client";
import { Buffer } from "buffer";

const MAX_ARGUMENT_SIZE = 16 * 1024;
type Coin = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

i wonder whether they had a type for this themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I couldn't find one myself. Their TS docs use the splitCoins function but they never provide an example of what explicit type it is. In their github repo, they have that function return this type: Extract<Argument, { Result: unknown }> & Extract<Argument, { NestedResult: unknown }>[]

In any case, I figured why not just use the type the IDE supplies me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So there is a TransactionResult type which almost matches this. But we seem to explicitly use the nestedResult version. So I just redefined it and use that. We can use the SDK type if we dont do [hotPotato] and such but I dont know what that would do and don't want to change things so drastically right now.

@vercel vercel bot temporarily deployed to Preview – entropy-explorer July 22, 2025 17:04 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub July 22, 2025 17:04 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals July 22, 2025 17:04 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library July 22, 2025 17:04 Inactive
@vercel vercel bot temporarily deployed to Preview – insights July 22, 2025 17:04 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger July 22, 2025 17:04 Inactive
@vercel vercel bot temporarily deployed to Preview – staking July 22, 2025 17:04 Inactive
@darunrs darunrs merged commit 29b9644 into main Jul 22, 2025
11 checks passed
@darunrs darunrs deleted the add-coin-input-sui branch July 22, 2025 18:20
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