-
Notifications
You must be signed in to change notification settings - Fork 414
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: Modular Tx Submission – Create Transformer + Submitter + Builder Abstraction #3627
Conversation
🦋 Changeset detectedLatest commit: a9ecb22 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3627 +/- ##
=======================================
Coverage 74.28% 74.28%
=======================================
Files 108 108
Lines 1217 1217
Branches 132 132
=======================================
Hits 904 904
Misses 297 297
Partials 16 16
|
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'm a bit confused by the Tx type per submitter
ideally any TxSubmitter
can take output from any Module.update(config)
typescript/sdk/src/providers/transactions/GnosisSafeHyperlaneTx.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/GnosisSafeHyperlaneTx.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/GnosisSafeHyperlaneTx.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/GnosisSafeHyperlaneTx.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/transformer/ImpersonatedAccountTxTransformer.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/transformer/SignerTxTransformer.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/transformer/TxTransformer.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/transformer/TxTransformer.ts
Outdated
Show resolved
Hide resolved
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.
submitter and transformer implementations look good
I still think we need to streamline the builder interface a bit to be extensible to future implementations
typescript/sdk/src/providers/transactions/HyperlaneTxReceipt.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/TxSubmitterTypes.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilderTypes.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
… use protocol-defined tx types
Agreed– with the newest update you'll find:
|
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.
suggested use of ProtocolTypedTransaction
which could be useful across the submitter/builder classes
note: a drawback I can see of this is that if we decide to implement new submitter classes for different providers (e.g. viem/ethersv6), it would require tweaking some of the type maps - however I think this would be required to integrate these providers at the crud module level anyway
typescript/sdk/src/providers/transactions/submitter/TxSubmitter.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/TxSubmitter.ts
Outdated
Show resolved
Hide resolved
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.
mostly looks good, please replace the stack-typescript implemenetation
typescript/sdk/src/providers/transactions/GnosisSafeHyperlaneTx.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/GnosisSafeHyperlaneTx.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/TxSubmitter.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/transformer/TxTransformer.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/ethersV5/ImpersonatedAccountTxSubmitter.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/ethersV5/GnosisSafeTxSubmitter.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/builder/TxSubmitterBuilder.ts
Outdated
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/ethersV5/EV5GnosisSafeTxSubmitter.ts
Show resolved
Hide resolved
typescript/sdk/src/providers/transactions/submitter/ethersV5/EV5GnosisSafeTxSubmitter.ts
Outdated
Show resolved
Hide resolved
Note that this no longer builds due to registry work– merging this PR is therefore now blocked by migrating registry.ts to the SDK: #3689 |
…r Abstraction (#3627) ## Description - Adds modular transaction submission support for SDK clients, e.g. CLI. To-do: - [ ] Failing CI build due to linting Gnosis Safe package import - [ ] Export to `sdk/src/index.ts` Note: - Built to eventually expand to [Sealevel/CW support](https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/dc628476158672d08c766936ef4e2b150f86f566/typescript/sdk/src/providers/ProviderType.ts#L51-L85) ### Transformers - Input: `PopulatedTx[]` - Output: `HTX[]` (where `HTX extends HyperlaneTx`) - Purpose: Given a set of populated transactions, transform those transactions into a set a HyperlaneTxs (for the corresponding submitter), e.g. ``` ... const somePopulatedTxs = ... const transformer = new InterchainAccountTxTransformer(mp,o,d,p); const populatedTxs = transformer.transformTxs(somePopulatedTxs); ``` ### Submitters - Input: `HTX[]` (where `HTX extends HyperlaneTx`) - Output: `TxReceipt[] | ResponseData[]` - Purpose: Given a set of Hyperlane transactions, execute those transactions for the specified submitter (submitter of type HTX should enforce the transactions being passed are of type HTX), e.g. ``` ... const submitter = new GnosisSafeTxSubmitter(mp,c,p); const txReceipts = submitter.submitTxs(populatedTxs); --- Client-side example: for each gnosisTxReceipt display transactionHash ``` ### Builder (Utilizes both Submitters & Transformer) - Input: `(TxTransformer<HTX> | TxTransformerType & Chain) & (TxSubmitter<HTX,HTR> | TxSubmitterType & Chain) & HTX[]` (where `HTX extends HyperlaneTx`) - Output: `TxReceipt[] | *response data*` - Purpose: Given a submitter, an optional transformer, and a set of PopulatedTransactions, transform and submit all transactions, e.g. ``` ... const eV5builder = new TxSubmitterBuilder<EV5Transaction, EV5TransactionReceipt>(); let txReceipts = eV5builder.for( new GnosisSafeTxSubmitter(chainA) ).transform( InterchainAccountTxTransformer(chainB) ).submit( txs ); txReceipts = eV5builder.for( new ImpersonatedAccountTxSubmitter(chainA) ).submit(txs); txReceipts = eV5builder.for( new JsonRpcTxSubmitter(chainC) ).submit(txs); --- Client-side example: for each txReceipt display transactionHash | response data ``` ### Drive-by changes * None ### Related issues - Fixes #3547 ### Backward compatibility - Yes ### Testing - Testing through CLI unit testing
Description
To-do:
sdk/src/index.ts
Note:
Transformers
PopulatedTx[]
HTX[]
(whereHTX extends HyperlaneTx
)Submitters
HTX[]
(whereHTX extends HyperlaneTx
)TxReceipt[] | ResponseData[]
Builder (Utilizes both Submitters & Transformer)
(TxTransformer<HTX> | TxTransformerType & Chain) & (TxSubmitter<HTX,HTR> | TxSubmitterType & Chain) & HTX[]
(whereHTX extends HyperlaneTx
)TxReceipt[] | *response data*
Drive-by changes
Related issues
Backward compatibility
Testing