Skip to content

Commit

Permalink
chore: Add IOmniSDK base interface for all SDKs
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista committed Dec 11, 2023
1 parent 9e4cb71 commit a0f5f36
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/protocol-utils/src/endpoint/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Address, OmniGraph, OmniPointBasedFactory, OmniTransaction } from '@layerzerolabs/utils'
import type { Address, OmniGraph, OmniPointBasedFactory, OmniTransaction, IOmniSDK } from '@layerzerolabs/utils'
import type { EndpointId } from '@layerzerolabs/lz-definitions'

export interface IEndpoint {
export interface IEndpoint extends IOmniSDK {
getDefaultReceiveLibrary(eid: EndpointId): Promise<Address | undefined>
setDefaultReceiveLibrary(
eid: EndpointId,
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol-utils/src/uln302/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Address, OmniGraph, OmniPointBasedFactory, OmniTransaction } from '@layerzerolabs/utils'
import type { Address, OmniGraph, OmniPointBasedFactory, OmniTransaction, IOmniSDK } from '@layerzerolabs/utils'
import type { EndpointId } from '@layerzerolabs/lz-definitions'

export interface IUln302 {
export interface IUln302 extends IOmniSDK {
getUlnConfig(eid: EndpointId, address?: Address | null | undefined): Promise<Uln302UlnConfig>
getExecutorConfig(eid: EndpointId, address?: Address | null | undefined): Promise<Uln302ExecutorConfig>
setDefaultExecutorConfig(eid: EndpointId, config: Uln302ExecutorConfig): Promise<OmniTransaction>
Expand Down
4 changes: 2 additions & 2 deletions packages/ua-utils/src/oapp/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { EndpointId } from '@layerzerolabs/lz-definitions'
import type { IEndpoint } from '@layerzerolabs/protocol-utils'
import type { Address, OmniGraph, OmniTransaction } from '@layerzerolabs/utils'
import type { Address, OmniGraph, OmniTransaction, IOmniSDK } from '@layerzerolabs/utils'
import type { Bytes32 } from '@layerzerolabs/utils'
import type { OmniPointBasedFactory } from '@layerzerolabs/utils'

export interface IOApp {
export interface IOApp extends IOmniSDK {
getEndpoint(): Promise<IEndpoint>
getPeer(eid: EndpointId): Promise<Bytes32 | undefined>
hasPeer(eid: EndpointId, address: Bytes32 | Address | null | undefined): Promise<boolean>
Expand Down
7 changes: 7 additions & 0 deletions packages/utils/src/omnigraph/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@ export type OmniPointBasedFactory<TValue> = (point: OmniPoint) => TValue | Promi
* Helper type that adds eid property to an underlying type
*/
export type WithEid<TValue> = TValue & { eid: EndpointId }

/**
* Base interface for all SDKs
*/
export interface IOmniSDK {
point: OmniPoint
}

0 comments on commit a0f5f36

Please sign in to comment.