-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into getOAppConfig
- Loading branch information
Showing
36 changed files
with
407 additions
and
213 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
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,17 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testTimeout: 15000, | ||
moduleNameMapper: { | ||
"^@/(.*)\\.js$": "<rootDir>/src/$1", | ||
}, | ||
transform: { | ||
// ts-jest does not yet work great with node16 module resolution | ||
// so we need to help it a little | ||
// | ||
// See https://github.com/kulshekhar/ts-jest/issues/4207 for the issue | ||
// And https://github.com/kulshekhar/ts-jest/issues/4198 for another one | ||
"^.+\\.tsx?$": ["ts-jest", { tsconfig: "tsconfig.test.json" }], | ||
}, | ||
}; |
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,31 +1,29 @@ | ||
import { expect } from 'chai' | ||
import { describe, it } from 'mocha' | ||
import { createExampleGitURL } from '../../src/utilities/cloning.js' | ||
import { createExampleGitURL } from '@/utilities/cloning.js' | ||
|
||
describe('utilities/cloning', () => { | ||
describe('createExampleGitURL', () => { | ||
const REPO_URL = '[email protected]:LayerZero-Labs/lz-utils' | ||
|
||
it('should return the repository field if directory and ref are not specified', () => { | ||
expect(createExampleGitURL({ repository: REPO_URL, id: 'dummy', label: 'Dummy' })).to.eql(REPO_URL) | ||
expect(createExampleGitURL({ repository: REPO_URL, id: 'dummy', label: 'Dummy' })).toEqual(REPO_URL) | ||
}) | ||
|
||
it('should return the repository field with directory if directory is specified', () => { | ||
expect(createExampleGitURL({ repository: REPO_URL, directory: 'dir', id: 'dummy', label: 'Dummy' })).to.eql( | ||
`${REPO_URL}/dir` | ||
) | ||
expect( | ||
createExampleGitURL({ repository: REPO_URL, directory: 'dir', id: 'dummy', label: 'Dummy' }) | ||
).toEqual(`${REPO_URL}/dir`) | ||
expect( | ||
createExampleGitURL({ repository: REPO_URL, directory: '/dir', id: 'dummy', label: 'Dummy' }) | ||
).to.eql(`${REPO_URL}/dir`) | ||
).toEqual(`${REPO_URL}/dir`) | ||
expect( | ||
createExampleGitURL({ repository: REPO_URL, directory: 'dir', ref: '', id: 'dummy', label: 'Dummy' }) | ||
).to.eql(`${REPO_URL}/dir`) | ||
).toEqual(`${REPO_URL}/dir`) | ||
}) | ||
|
||
it('should return the repository field with directory and ref if directory and ref are specified', () => { | ||
expect( | ||
createExampleGitURL({ repository: REPO_URL, directory: 'dir', ref: 'ref', id: 'dummy', label: 'Dummy' }) | ||
).to.eql(`${REPO_URL}/dir#ref`) | ||
).toEqual(`${REPO_URL}/dir#ref`) | ||
expect( | ||
createExampleGitURL({ | ||
repository: REPO_URL, | ||
|
@@ -34,14 +32,14 @@ describe('utilities/cloning', () => { | |
id: 'dummy', | ||
label: 'Dummy', | ||
}) | ||
).to.eql(`${REPO_URL}/dir#ref`) | ||
).toEqual(`${REPO_URL}/dir#ref`) | ||
}) | ||
|
||
it('should return the repository field with ref if only ref specified', () => { | ||
expect(createExampleGitURL({ repository: REPO_URL, ref: 'ref', id: 'dummy', label: 'Dummy' })).to.eql( | ||
expect(createExampleGitURL({ repository: REPO_URL, ref: 'ref', id: 'dummy', label: 'Dummy' })).toEqual( | ||
`${REPO_URL}#ref` | ||
) | ||
expect(createExampleGitURL({ repository: REPO_URL, ref: '#ref', id: 'dummy', label: 'Dummy' })).to.eql( | ||
expect(createExampleGitURL({ repository: REPO_URL, ref: '#ref', id: 'dummy', label: 'Dummy' })).toEqual( | ||
`${REPO_URL}#ref` | ||
) | ||
}) | ||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"moduleResolution": "Node10" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './filesystem' | ||
export * from './stdio' |
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 @@ | ||
export * from './prompts' |
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,18 @@ | ||
import assert from 'assert' | ||
import prompts from 'prompts' | ||
|
||
export const promptToContinue = async ( | ||
message: string = 'Do you want to continue?', | ||
defaultValue = true | ||
): Promise<boolean> => { | ||
const { value } = await prompts({ | ||
type: 'confirm', | ||
name: 'value', | ||
message, | ||
initial: defaultValue, | ||
}) | ||
|
||
assert(typeof value === 'boolean', `Invariant error: Expected a boolean response, got ${value}`) | ||
|
||
return value | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './sdk' | ||
export * from './types' |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { BigNumberish } from '@ethersproject/bignumber' | ||
import { Uln302ExecutorConfig, Uln302UlnConfig } from '@layerzerolabs/protocol-utils' | ||
|
||
export interface Uln302UlnConfigInput extends Omit<Uln302UlnConfig, 'confirmations'> { | ||
confirmations: BigNumberish | ||
} | ||
|
||
export interface Uln302ExecutorConfigInput extends Omit<Uln302ExecutorConfig, 'maxMessageSize'> { | ||
maxMessageSize: BigNumberish | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './schema' | ||
export * from './types' |
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,18 @@ | ||
import { | ||
createOmniEdgeHardhatSchema, | ||
createOmniGraphHardhatSchema, | ||
createOmniNodeHardhatSchema, | ||
} from '@layerzerolabs/utils-evm-hardhat' | ||
import { z } from 'zod' | ||
import type { OAppOmniGraphHardhat } from './types' | ||
|
||
/** | ||
* Validation schema for OApp configs in hardhat environment. | ||
* | ||
* Produces an `OAppOmniGraphHardhat` after successful parsing | ||
* the user input. | ||
*/ | ||
export const OAppOmniGraphHardhatSchema = createOmniGraphHardhatSchema( | ||
createOmniNodeHardhatSchema(z.unknown()), | ||
createOmniEdgeHardhatSchema(z.unknown()) | ||
) satisfies z.ZodSchema<OAppOmniGraphHardhat> |
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
Oops, something went wrong.