-
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.
Signed-off-by: Ryan Goulding <[email protected]>
- Loading branch information
1 parent
095c96e
commit fe860d7
Showing
32 changed files
with
665 additions
and
35 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,3 @@ | ||
.turbo | ||
dist | ||
node_modules |
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,3 @@ | ||
{ | ||
"extends": "../../.eslintrc.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<p align="center"> | ||
<a href="https://layerzero.network"> | ||
<img alt="LayerZero" style="max-width: 500px" src="https://d3a2dpnnrypp5h.cloudfront.net/bridge-app/lz.png"/> | ||
</a> | ||
</p> | ||
|
||
<h1 align="center">@layerzerolabs/omnicounter-utils-evm</h1> | ||
|
||
<!-- The badges section --> | ||
<p align="center"> | ||
<!-- Shields.io NPM published package version --> | ||
<a href="https://www.npmjs.com/package/@layerzerolabs/omnicounter-utils-evm"><img alt="NPM Version" src="https://img.shields.io/npm/v/@layerzerolabs/omnicounter-utils-evm"/></a> | ||
<!-- Shields.io NPM downloads --> | ||
<a href="https://www.npmjs.com/package/@layerzerolabs/omnicounter-utils-evm"><img alt="Downloads" src="https://img.shields.io/npm/dm/@layerzerolabs/omnicounter-utils-evm"/></a> | ||
<!-- Shields.io license badge --> | ||
<a href="https://www.npmjs.com/package/@layerzerolabs/omnicounter-utils-evm"><img alt="NPM License" src="https://img.shields.io/npm/l/@layerzerolabs/omnicounter-utils-evm"/></a> | ||
</p> | ||
|
||
## Installation | ||
|
||
```sh | ||
$ npm install @layerzerolabs/omnicounter-utils-evm | ||
``` |
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,8 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/src/$1', | ||
}, | ||
}; |
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,55 @@ | ||
{ | ||
"name": "@layerzerolabs/omnicounter-utils-evm", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "Utilities for working with LayerZero OmniCounter contract", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/LayerZero-Labs/lz-utils.git", | ||
"directory": "packages/ua-utils-evm" | ||
}, | ||
"license": "MIT", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/" | ||
], | ||
"scripts": { | ||
"prebuild": "tsc -noEmit", | ||
"build": "npx tsup", | ||
"clean": "rm -rf dist", | ||
"lint": "npx eslint '**/*.{js,ts,json}'", | ||
"test": "jest --passWithNoTests" | ||
}, | ||
"devDependencies": { | ||
"@layerzerolabs/lz-definitions": "~1.5.70", | ||
"@layerzerolabs/omnicounter-utils": "~0.0.1", | ||
"@layerzerolabs/ua-utils": "~0.1.0", | ||
"@layerzerolabs/ua-utils-evm": "~0.0.1", | ||
"@layerzerolabs/utils-evm": "~0.0.1", | ||
"@types/jest": "^29.5.10", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"tslib": "~2.6.2", | ||
"tsup": "~8.0.1", | ||
"typescript": "^5.2.2", | ||
"zod": "^3.22.4" | ||
}, | ||
"peerDependencies": { | ||
"@layerzerolabs/lz-definitions": "~1.5.70", | ||
"@layerzerolabs/omnicounter-utils": "~0.0.1", | ||
"@layerzerolabs/ua-utils": "~0.1.0", | ||
"@layerzerolabs/ua-utils-evm": "~0.0.1", | ||
"@layerzerolabs/utils-evm": "~0.0.1", | ||
"zod": "^3.22.4" | ||
} | ||
} |
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 './omnicounter' |
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 './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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { IOmniCounterApp } from '@layerzerolabs/omnicounter-utils' | ||
import { OApp } from '@layerzerolabs/ua-utils-evm' | ||
import { OmniTransaction } from '@layerzerolabs/utils' | ||
|
||
export class OmniCounterApp extends OApp implements IOmniCounterApp { | ||
public async increment(eid: number, type: number, options: string): Promise<OmniTransaction> { | ||
const data = this.contract.contract.interface.encodeFunctionData('increment', [eid, type, options]) | ||
return super.createTransaction(data) | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"exclude": ["dist", "node_modules"], | ||
"include": ["src", "test"], | ||
"compilerOptions": { | ||
"types": ["node", "jest"], | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
} | ||
} | ||
} |
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 { defineConfig } from 'tsup' | ||
|
||
export default defineConfig({ | ||
entry: ['src/index.ts'], | ||
outDir: './dist', | ||
clean: true, | ||
dts: true, | ||
sourcemap: true, | ||
splitting: false, | ||
treeshake: true, | ||
format: ['esm', 'cjs'], | ||
}) |
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,3 @@ | ||
.turbo | ||
dist | ||
node_modules |
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,3 @@ | ||
{ | ||
"extends": "../../.eslintrc.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<p align="center"> | ||
<a href="https://layerzero.network"> | ||
<img alt="LayerZero" style="max-width: 500px" src="https://d3a2dpnnrypp5h.cloudfront.net/bridge-app/lz.png"/> | ||
</a> | ||
</p> | ||
|
||
<h1 align="center">@layerzerolabs/omnicounter-utils</h1> | ||
|
||
<!-- The badges section --> | ||
<p align="center"> | ||
<!-- Shields.io NPM published package version --> | ||
<a href="https://www.npmjs.com/package/@layerzerolabs/omnicounter-utils"><img alt="NPM Version" src="https://img.shields.io/npm/v/@layerzerolabs/omnicounter-utils"/></a> | ||
<!-- Shields.io NPM downloads --> | ||
<a href="https://www.npmjs.com/package/@layerzerolabs/omnicounter-utils"><img alt="Downloads" src="https://img.shields.io/npm/dm/@layerzerolabs/omnicounter-utils"/></a> | ||
<!-- Shields.io license badge --> | ||
<a href="https://www.npmjs.com/package/@layerzerolabs/omnicounter-utils"><img alt="NPM License" src="https://img.shields.io/npm/l/@layerzerolabs/omnicounter-utils"/></a> | ||
</p> | ||
|
||
## Installation | ||
|
||
```sh | ||
$ npm install @layerzerolabs/omnicounter-utils | ||
``` |
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,8 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/src/$1', | ||
}, | ||
}; |
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,50 @@ | ||
{ | ||
"name": "@layerzerolabs/omnicounter-utils", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "Utilities for working with LayerZero OmniCounter contract", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/LayerZero-Labs/lz-utils.git", | ||
"directory": "packages/omnicounter-utils" | ||
}, | ||
"license": "MIT", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/", | ||
"LICENSE" | ||
], | ||
"scripts": { | ||
"prebuild": "tsc -noEmit", | ||
"build": "npx tsup", | ||
"clean": "rm -rf dist", | ||
"lint": "npx eslint '**/*.{js,ts,json}'", | ||
"test": "jest --passWithNoTests" | ||
}, | ||
"devDependencies": { | ||
"@layerzerolabs/lz-definitions": "~1.5.70", | ||
"@layerzerolabs/utils": "~0.0.1", | ||
"@types/jest": "^29.5.10", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"tslib": "~2.6.2", | ||
"tsup": "~8.0.1", | ||
"typescript": "^5.2.2", | ||
"zod": "^3.22.4" | ||
}, | ||
"peerDependencies": { | ||
"@layerzerolabs/lz-definitions": "~1.5.70", | ||
"@layerzerolabs/utils": "~0.0.1", | ||
"zod": "^3.22.4" | ||
} | ||
} |
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 './omnicounter/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,6 @@ | ||
import { OmniTransaction } from '@layerzerolabs/utils' | ||
import { EndpointId } from '@layerzerolabs/lz-definitions' | ||
|
||
export interface IOmniCounterApp { | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"exclude": ["dist", "node_modules"], | ||
"include": ["src", "test"], | ||
"compilerOptions": { | ||
"types": ["node", "jest"], | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
} | ||
} | ||
} |
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 { defineConfig } from 'tsup' | ||
|
||
export default defineConfig({ | ||
entry: ['src/index.ts'], | ||
outDir: './dist', | ||
clean: true, | ||
dts: true, | ||
sourcemap: true, | ||
splitting: false, | ||
treeshake: true, | ||
format: ['esm', 'cjs'], | ||
}) |
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,10 +1,8 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.22; | ||
|
||
contract DefaultOApp { | ||
mapping(uint256 => bytes32) public peers; | ||
import { OmniCounter as OmniCounterImpl } from "@layerzerolabs/lz-evm-oapp-v2/contracts/examples/OmniCounter.sol"; | ||
|
||
function setPeer(uint256 eid, bytes32 peer) external { | ||
peers[eid] = peer; | ||
} | ||
contract DefaultOApp is OmniCounterImpl { | ||
constructor(address _endpoint) OmniCounterImpl(_endpoint) {} | ||
} |
Oops, something went wrong.