Skip to content

init react-hooks #1

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

Merged
merged 15 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
47 changes: 47 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const { resolve } = require('node:path');

const project = resolve(process.cwd(), 'tsconfig.json');

/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: [
'@vercel/style-guide/eslint/browser',
'@vercel/style-guide/eslint/typescript',
'@vercel/style-guide/eslint/react',
].map(require.resolve),
parserOptions: {
project,
},
globals: {
JSX: true,
},
settings: {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
'node_modules/',
'dist/',
'*.config.*',
'src/lib/codegen/',
'src/lib/trade-interfaces/',
'**/*.cjs',
'docs',
'coverage',
'test',
'*.test.ts*',
],
rules: {
'unicorn/filename-case': 'off',
'import/no-extraneous-dependencies': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
},
};
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
release:
types: [released]

permissions:
contents: write # for github pages

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Install packages, compile SDK, and build docs
run: |
pnpm i
pnpm build
pnpm gen-docs

- name: Deploy Docs to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs

- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: pnpm audit signatures

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm publish --access public --no-git-checks
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
branches:
- main
- 'v**'
- 'releases/v**'
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- 'v**'
- 'releases/v**'

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Install packages, build, lint, and test
run: |
pnpm i
pnpm build
pnpm lint
pnpm test
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.log
.DS_Store
node_modules
dist

coverage

src/lib/codegen
src/lib/trade-interfaces

docs
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "trade-interfaces"]
path = src/lib/trade-interfaces
url = https://github.com/valorem-labs-inc/trade-interfaces.git
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Valorem React Hooks

Valorem is a DeFi protocol enabling physically settled or cash settled, American, European, and Exotic options.
The Valorem React Hooks package wraps Valorem's signature relay, Seaport and Clear contract interfaces into hooks consumable by any React frontend.

## Documentation

- TODO: Link documentation here

## Installation

Install the package:

```bash
yarn add @valorem/react-hooks
```

## Getting Started

Utilizing the reat-hooks package requires an RPC provider:

```js
import ValoremReactHooks, { Network } from '@valorem/react-hooks';

const hooksProvider = new ValoremHooks({
network: Network.Ethereum,
provider: 'https://eth-archival.gateway.pokt.network/v1/lb/<APP_ID>',
});
```

## Development
10 changes: 10 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1
plugins:
- plugin: es
out: src/lib/codegen
opt:
- target=ts
- name: connect-query
out: src/lib/codegen
opt:
- target=ts
3 changes: 3 additions & 0 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: v1
directories:
- src/lib/trade-interfaces/proto/valorem/trade/v1
94 changes: 94 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name": "@valorem-labs-inc/react-hooks",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/valorem-labs-inc/react-hooks.git"
},
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"/dist"
],
"scripts": {
"build": "pnpm clean && pnpm codegen && pnpm tsup",
"clean": "rm -rf ./dist",
"codegen": "rm -rf ./src/lib/codegen && wagmi generate && npx buf generate",
"format": "prettier --write \"**/*.{ts,tsx,md,json}\"",
"gen-docs": "typedoc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepare": "git submodule update --init --recursive && pnpm codegen",
"prepublish": "pnpm build",
"semantic-release": "semantic-release",
"test": "vitest run --coverage"
},
"prettier": "@vercel/style-guide/prettier",
"dependencies": {
"@bufbuild/protobuf": "^1.3.3",
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect-query": "^0.5.3",
"@connectrpc/connect-web": "^1.1.2",
"@tanstack/query-core": "^4.36.1",
"@tanstack/react-query": "^4.36.1",
"@valorem-labs-inc/sdk": "^0.0.1",
"@wagmi/cli": "^1.5.2",
"@wagmi/core": "^1.4.5",
"abitype": "0.8.7",
"connectkit": "^1.5.3",
"siwe": "^2.1.4",
"viem": "^1.16.6",
"wagmi": "^1.4.5"
},
"devDependencies": {
"@bufbuild/buf": "^1.27.1",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/protoc-gen-connect-query": "^0.5.3",
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@types/node": "^20.8.7",
"@types/react": "^18.2.31",
"@types/react-dom": "^18.2.14",
"@vercel/style-guide": "^5.0.1",
"@vitest/coverage-v8": "^0.34.6",
"eslint": "^8.52.0",
"happy-dom": "^12.9.1",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^22.1.0",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"semantic-release": "^22.0.5",
"ts-node": "^10.9.1",
"tsup": "^7.2.0",
"typedoc": "^0.25.2",
"typedoc-plugin-missing-exports": "^2.1.0",
"typescript": "^5.2.2",
"vitest": "^0.34.6",
"zod": "^3.22.4"
},
"peerDependencies": {
"react": ">=17.0.0",
"typescript": ">=5.0.4",
"viem": ">=0.3.35"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"packageManager": "pnpm@8.6.10",
"engines": {
"node": ">=18"
}
}
Loading