-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat(sdk): add action builders #134
base: main
Are you sure you want to change the base?
feat(sdk): add action builders #134
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
someone shouldn't be able to call `txBuilder.withProposal().withApproval().withProposal()`, Typescript should stop them
prelim tests passing
ex: `buildFromVaultTransaction` takes a key for a `VaultTransaction` account, deserializes it, and creates a builder instance from it
Looks great 🙌 Love the detailed docs above the individual functions, we should adopt this across the rest of the SDK as well 🔥 |
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.
ACK - nice work 👌
protected args: Omit<U, keyof BaseBuilderArgs>; | ||
private built: boolean = false; | ||
// Use this as an indicator to clear all instructions? | ||
private sent: boolean = false; |
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.
You may have already considered this, but if you want methods and properties to be "truly" private, meaning they can't be accessed with trickery, I recommend using the native JS private properties #send: boolean = false.
In case you're curious: MDN: Private Properties
Adds another export in the TS SDK called
actions
, containing builders for various common actions in the SDK. These are optimized for quick succession with as few lines of code as possible.A developer using these would simply initialize the builder (
createThing
) with minimal arguments, only covering what's required by the underlying instruction, with the ability to add-on more if needed for additional customization. From there, they can call it synchronously to chain methods for things like returning relevant inferred data (i.e transaction index), adding more complimentary instructions (like creating & voting on proposals), as well as returning a transaction or sending one like the base SDK.Actions include:
Examples: