-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- rename everything to OmniCounter, dropping App. - adapt to new OApp super constructor. - make endpointFactory protected in OApp so it can be inherited. Signed-off-by: Ryan Goulding <[email protected]>
- Loading branch information
1 parent
878f278
commit 70d8b12
Showing
5 changed files
with
33 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pMemoize from 'p-memoize' | ||
import { OmniCounter } from '@/omnicounter/sdk' | ||
import { createEndpointFactory } from '@layerzerolabs/protocol-utils-evm' | ||
import { EndpointFactory } from '@layerzerolabs/protocol-utils' | ||
import { OAppFactory } from '@layerzerolabs/ua-utils' | ||
import { OmniContractFactory } from '@layerzerolabs/utils-evm' | ||
|
||
/** | ||
* Syntactic sugar that creates an instance of EVM `OmniCounter` SDK based on an `OmniPoint` with help of an | ||
* `OmniContractFactory` and an (optional) `EndpointFactory` | ||
* | ||
* @param {OmniContractFactory} contractFactory | ||
* @param {EndpointFactory} [endpointFactory] | ||
* @returns {EndpointFactory<Endpoint>} | ||
*/ | ||
export const createOmniCounterFactory = ( | ||
contractFactory: OmniContractFactory, | ||
endpointFactory: EndpointFactory = createEndpointFactory(contractFactory) | ||
): OAppFactory<OmniCounter> => pMemoize(async (point) => new OmniCounter(await contractFactory(point), endpointFactory)) |
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 +1,2 @@ | ||
export * from './factory' | ||
export * from './sdk' |
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,6 +1,6 @@ | ||
import { OmniTransaction } from '@layerzerolabs/utils' | ||
import { EndpointId } from '@layerzerolabs/lz-definitions' | ||
|
||
export interface IOmniCounterApp { | ||
export interface IOmniCounter { | ||
increment(eid: EndpointId, type: number, options: string): Promise<OmniTransaction> | ||
} |
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