-
Notifications
You must be signed in to change notification settings - Fork 300
feat(pyth-lazer-sui-js): Init Lazer Sui SDK #3017
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
…dsa_update; add workspace entry and docs Co-Authored-By: Tejas Badadare <[email protected]>
…ModuleInterop/skipLibCheck Co-Authored-By: Tejas Badadare <[email protected]>
…t-config Co-Authored-By: Tejas Badadare <[email protected]>
…int-config Co-Authored-By: Tejas Badadare <[email protected]>
…-config path Co-Authored-By: Tejas Badadare <[email protected]>
…JS and eslint.config.js in lint Co-Authored-By: Tejas Badadare <[email protected]>
…fig and in-file ignores Co-Authored-By: Tejas Badadare <[email protected]>
…; fix types/imports; remove deprecated .eslintignore Co-Authored-By: Tejas Badadare <[email protected]>
… Lazer update -> Sui PTB composition Co-Authored-By: Tejas Badadare <[email protected]>
…dd runnable example instructions Co-Authored-By: Tejas Badadare <[email protected]>
…tion to SuiRelay example Co-Authored-By: Tejas Badadare <[email protected]>
…x imports and README flags Co-Authored-By: Tejas Badadare <[email protected]>
…te script and README Co-Authored-By: Tejas Badadare <[email protected]>
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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'd suggest referring to a newer package like the component library or the sessions sdk for a good example of scaffolding a new package. It looks like a lot of what's in this PR is copied out of legacy packages that aren't well configured and have a lot of small issues. Let me know if it would help to pair up on this and I'm happy to lend a hand
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.
Make sure to change the subpath exports so that you're also exporting the cjs you build but other than that looks great!
import { Transaction } from "@mysten/sui/transactions"; | ||
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils"; | ||
|
||
const MAX_ARGUMENT_SIZE = 16 * 1024; |
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.
Super minor and not worth changing, but one thing I really like to do with consts like this is break them down with units so it's super easy to understand where the numbers come from, e.g. something like this:
const ONE_KIBIBYTE_IN_BYTES = 1024;
const MAX_ARGUMENT_SIZE_IN_BYTES = 16 * ONE_KIBIBYTE_IN_BYTES;
(I'm assuming that's where 1024 comes from but I don't know where 16 comes from)
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.
Actually realized this might be an old requirement imposed by WH, idt we need it anymore
tx: Transaction; | ||
packageId: string; | ||
stateObjectId: string; | ||
updateBytes: Buffer; |
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.
Note that Buffer
is not available in browsers without a polyfill, you might want to consider using Uint8Array
instead which is a superclass of Buffer
and would make the code more easily isomorphic, if that's something you care about and you aren't using anything specific to Buffer
(I don't think you are)
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.
Ahhh ok cool. Sui examples use Buffer but idt it's actually needed by their API.
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.
LGTM
Summary
Create a Lazer Sui SDK to enable users to create txns to parse and verify Lazer payloads on-chain.
packageId
isn't automatically handled by the SDK. This will be added once we handle upgrades in the Sui contract.Testing