-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relay-kit): Improve general structure and follow other packs sty…
…le (#534)
- Loading branch information
Showing
11 changed files
with
214 additions
and
193 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import AccountAbstraction from './AccountAbstraction' | ||
|
||
export default AccountAbstraction | ||
export * from './types' |
This file was deleted.
Oops, something went wrong.
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,48 @@ | ||
import Safe from '@safe-global/protocol-kit' | ||
import { MetaTransactionOptions, SafeTransaction } from '@safe-global/safe-core-sdk-types' | ||
|
||
import { RelayKitTransaction } from './types' | ||
|
||
export abstract class RelayKitBasePack { | ||
protocolKit: Safe | ||
|
||
/** | ||
* The packs implemented using our SDK should extend this class and therefore provide a Safe SDK instance | ||
* @constructor | ||
* @param protocolKit The Safe SDK instance | ||
*/ | ||
constructor(protocolKit: Safe) { | ||
this.protocolKit = protocolKit | ||
} | ||
|
||
/** | ||
* Get an estimation of the fee that will be paid for a transaction | ||
* @param chainId The chain id | ||
* @param gasLimit Max amount of gas willing to consume | ||
* @param gasToken Token address (or 0 if ETH) that is used for the payment | ||
*/ | ||
abstract getEstimateFee(chainId: number, gasLimit: string, gasToken?: string): Promise<string> | ||
|
||
/** | ||
* Creates a Safe transaction designed to be executed using the relayer. | ||
* @param {RelayKitTransaction} RelayKitTransaction - Properties required to create the transaction. | ||
* @returns {Promise<SafeTransaction>} - Returns a Promise that resolves with a SafeTransaction object. | ||
*/ | ||
abstract createRelayedTransaction({ | ||
transactions, | ||
options, | ||
onlyCalls | ||
}: RelayKitTransaction): Promise<SafeTransaction> | ||
|
||
/** | ||
* Sends the Safe transaction to the relayer for execution. | ||
* If the Safe is not deployed, it creates a batch of transactions including the Safe deployment transaction. | ||
* @param {SafeTransaction} safeTransaction - The Safe transaction to be executed | ||
* @param {MetaTransactionOptions} options - The transaction options | ||
* @returns {Promise<RelayResponse>} Returns a Promise that resolves with a RelayResponse object. | ||
*/ | ||
abstract executeRelayTransaction( | ||
safeTransaction: SafeTransaction, | ||
options?: MetaTransactionOptions | ||
): Promise<unknown> | ||
} |
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,2 +1,5 @@ | ||
export * from './packs/gelato/GelatoRelayPack' | ||
export * from './packs/gelato/types' | ||
|
||
export * from './RelayKitBasePack' | ||
export * from './types' |
Oops, something went wrong.