Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: omnicounter-utils #92

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/omnicounter-utils-evm/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.turbo
dist
node_modules
3 changes: 3 additions & 0 deletions packages/omnicounter-utils-evm/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json"
}
23 changes: 23 additions & 0 deletions packages/omnicounter-utils-evm/README.md
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
```
8 changes: 8 additions & 0 deletions packages/omnicounter-utils-evm/jest.config.js
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',
},
};
55 changes: 55 additions & 0 deletions packages/omnicounter-utils-evm/package.json
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"
}
}
1 change: 1 addition & 0 deletions packages/omnicounter-utils-evm/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './omnicounter'
1 change: 1 addition & 0 deletions packages/omnicounter-utils-evm/src/omnicounter/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './sdk'
10 changes: 10 additions & 0 deletions packages/omnicounter-utils-evm/src/omnicounter/sdk.ts
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)
}
}
11 changes: 11 additions & 0 deletions packages/omnicounter-utils-evm/tsconfig.json
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/*"]
}
}
}
12 changes: 12 additions & 0 deletions packages/omnicounter-utils-evm/tsup.config.ts
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'],
})
3 changes: 3 additions & 0 deletions packages/omnicounter-utils/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.turbo
dist
node_modules
3 changes: 3 additions & 0 deletions packages/omnicounter-utils/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json"
}
23 changes: 23 additions & 0 deletions packages/omnicounter-utils/README.md
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
```
8 changes: 8 additions & 0 deletions packages/omnicounter-utils/jest.config.js
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',
},
};
50 changes: 50 additions & 0 deletions packages/omnicounter-utils/package.json
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"
}
}
1 change: 1 addition & 0 deletions packages/omnicounter-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './omnicounter/types'
6 changes: 6 additions & 0 deletions packages/omnicounter-utils/src/omnicounter/types.ts
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>
}
11 changes: 11 additions & 0 deletions packages/omnicounter-utils/tsconfig.json
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/*"]
}
}
}
12 changes: 12 additions & 0 deletions packages/omnicounter-utils/tsup.config.ts
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'],
})
Loading