-
Notifications
You must be signed in to change notification settings - Fork 277
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
7 Skipped Deployments
|
const packageId = await this.getPythPackageId(); | ||
|
||
packageId: string, | ||
): Promise<any> { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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?
Configured the original function to generate the coins and then pass them to the new function. The feed updated correctly.