-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
address @pbio comments; expand on multi-protocol support + minor cleanup
- Loading branch information
1 parent
1ba8804
commit e2e4877
Showing
10 changed files
with
116 additions
and
101 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
typescript/sdk/src/providers/transactions/TransactionTypes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { | ||
EthersV5Transaction, | ||
EthersV5TransactionReceipt, | ||
} from '../ProviderType.js'; | ||
|
||
export type EV5Tx = EthersV5Transaction['transaction']; | ||
export type EV5Receipt = EthersV5TransactionReceipt['receipt']; |
25 changes: 16 additions & 9 deletions
25
typescript/sdk/src/providers/transactions/submitter/TxSubmitterInterface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
import { ProtocolType } from '@hyperlane-xyz/utils'; | ||
|
||
import { ChainName } from '../../../types.js'; | ||
import { MultiProvider } from '../../MultiProvider.js'; | ||
import { | ||
TypedTransaction, | ||
TypedTransactionReceipt, | ||
ProtocolTypedProvider, | ||
ProtocolTypedReceipt, | ||
ProtocolTypedTransaction, | ||
} from '../../ProviderType.js'; | ||
|
||
import { TxSubmitterType } from './TxSubmitterTypes.js'; | ||
|
||
export interface TxSubmitterInterface< | ||
TX extends TypedTransaction, | ||
TR extends TypedTransactionReceipt, | ||
> { | ||
export interface TxSubmitterInterface<TProtocol extends ProtocolType> { | ||
/** | ||
* Defines the type of tx submitter. | ||
*/ | ||
txSubmitterType: TxSubmitterType; | ||
multiProvider: MultiProvider; | ||
/** | ||
* The chain to submit transactions on. | ||
*/ | ||
chain: ChainName; | ||
/** | ||
* The provider to use for transaction submission. | ||
*/ | ||
provider?: ProtocolTypedProvider<TProtocol>['provider']; | ||
/** | ||
* Should execute all transactions and return their receipts. | ||
* @param txs The array of transactions to execute | ||
*/ | ||
submit(...txs: TX[]): Promise<TR[] | void>; | ||
submit( | ||
...txs: ProtocolTypedTransaction<TProtocol>['transaction'][] | ||
): Promise<ProtocolTypedReceipt<TProtocol>['receipt'][] | void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
typescript/sdk/src/providers/transactions/submitter/ethersV5/EV5TxSubmitterInterface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ProtocolType } from '@hyperlane-xyz/utils'; | ||
|
||
import { MultiProvider } from '../../../MultiProvider.js'; | ||
import { TxSubmitterInterface } from '../TxSubmitterInterface.js'; | ||
|
||
export interface EV5TxSubmitterInterface | ||
extends TxSubmitterInterface<ProtocolType.Ethereum> { | ||
/** | ||
* The EV5 multi-provider to use for transaction submission. | ||
*/ | ||
multiProvider: MultiProvider; | ||
} |
11 changes: 7 additions & 4 deletions
11
typescript/sdk/src/providers/transactions/transformer/TxTransformerInterface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import { TypedTransaction } from '../../ProviderType.js'; | ||
import { ProtocolType } from '@hyperlane-xyz/utils'; | ||
|
||
import { ProtocolTypedTransaction } from '../../ProviderType.js'; | ||
|
||
import { TxTransformerType } from './TxTransformerTypes.js'; | ||
|
||
export interface TxTransformerInterface<TX extends TypedTransaction> { | ||
export interface TxTransformerInterface<TProtocol extends ProtocolType> { | ||
/** | ||
* Defines the type of tx transformer. | ||
*/ | ||
txTransformerType: TxTransformerType; | ||
|
||
/** | ||
* Should transform all transactions of type TX into transactions of type TX. | ||
* @param txs The array of transactions to transform | ||
*/ | ||
transform(...txs: TX[]): Promise<TX[]>; | ||
transform( | ||
...txs: ProtocolTypedTransaction<TProtocol>['transaction'][] | ||
): Promise<ProtocolTypedTransaction<TProtocol>['transaction'][]>; | ||
} |
Oops, something went wrong.