The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hyperlane-monorepo/.changeset/blue-kings-compare.md

6 lines
108 B

feat: Modular Tx Submission – Create Transformer + Submitter + Builder 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 https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/3547 ### Backward compatibility - Yes ### Testing - Testing through CLI unit testing
7 months ago
---
'@hyperlane-xyz/sdk': minor
---
Adds modular transaction submission support for SDK clients, e.g. CLI.