-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e4e529c
Showing
36 changed files
with
9,094 additions
and
0 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,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
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 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
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 @@ | ||
# .github/actions | ||
|
||
Reusable actions that are used in other actions are here | ||
|
||
## setup | ||
|
||
Setups forge pnpm node and caches 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,17 @@ | ||
name: Setup | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 9.12.0 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
registry-url: https://registry.npmjs.org | ||
cache: pnpm | ||
|
||
- name: Install node modules | ||
run: pnpm install --frozen-lockfile | ||
shell: bash |
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,46 @@ | ||
name: Version | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
version: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
environment: release | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: "Setup" | ||
uses: ./.github/actions/setup | ||
|
||
- name: Build | ||
shell: bash | ||
run: pnpm build | ||
|
||
- name: Set deployment token | ||
run: npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}" | ||
|
||
- name: Handle Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
title: "chore: version packages" | ||
commit: "chore: version packages" | ||
publish: pnpm release:publish | ||
version: pnpm release:version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
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,61 @@ | ||
name: Verify | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: pnpm | ||
node-version: 18 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Lint code | ||
run: pnpm format && pnpm lint | ||
|
||
types: | ||
name: Types | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: pnpm | ||
node-version: 18 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Check types | ||
run: pnpm typecheck |
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,34 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
bench | ||
_lib | ||
_cjs | ||
_esm | ||
_types | ||
dist | ||
cache | ||
node_modules | ||
tsconfig*.tsbuildinfo | ||
*.tgz | ||
vitest.config.ts.timestamp* |
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,2 @@ | ||
ignore-workspace-root-check=true | ||
|
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.12.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,83 @@ | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import { glob } from 'fast-glob' | ||
|
||
// Get all package.json files | ||
const packagePaths = await glob('**/package.json', { | ||
ignore: ['**/dist/**', '**/node_modules/**'], | ||
}) | ||
|
||
let _count = 0 | ||
for (const packagePath of packagePaths) { | ||
type Package = { | ||
bin?: Record<string, string> | undefined | ||
exports?: | ||
| Record<string, { types: string; default: string } | string> | ||
| undefined | ||
name?: string | undefined | ||
private?: boolean | undefined | ||
} | ||
const file = Bun.file(packagePath) | ||
const packageJson = (await file.json()) as Package | ||
|
||
// Skip private packages | ||
if (packageJson.private) continue | ||
if (!packageJson.exports) continue | ||
|
||
_count += 1 | ||
|
||
const dir = path.resolve(path.dirname(packagePath)) | ||
|
||
// Empty dist directory | ||
const distDirName = '_lib' | ||
const dist = path.resolve(dir, distDirName) | ||
let files: string[] = [] | ||
try { | ||
files = await fs.readdir(dist) | ||
} catch { | ||
await fs.mkdir(dist) | ||
} | ||
|
||
const promises: Promise<void>[] = [] | ||
for (const file of files) { | ||
promises.push( | ||
fs.rm(path.join(dist, file), { recursive: true, force: true }), | ||
) | ||
} | ||
await Promise.all(promises) | ||
|
||
// Link exports to dist locations | ||
for (const [key, exports] of Object.entries(packageJson.exports)) { | ||
// Skip `package.json` exports | ||
if (/package\.json$/.test(key)) continue | ||
|
||
let entries: any | ||
if (typeof exports === 'string') | ||
entries = [ | ||
['default', exports], | ||
['types', exports.replace('.js', '.d.ts')], | ||
] | ||
else entries = Object.entries(exports) | ||
|
||
// Link exports to dist locations | ||
for (const [, value] of entries as [ | ||
type: 'types' | 'default', | ||
value: string, | ||
][]) { | ||
const srcDir = path.resolve( | ||
dir, | ||
path.dirname(value).replace(distDirName, ''), | ||
) | ||
const srcFilePath = path.resolve(srcDir, 'index.ts') | ||
|
||
const distDir = path.resolve(dir, path.dirname(value)) | ||
const distFileName = path.basename(value) | ||
const distFilePath = path.resolve(distDir, distFileName) | ||
|
||
await fs.mkdir(distDir, { recursive: true }) | ||
|
||
// Symlink src to dist file | ||
await fs.symlink(srcFilePath, distFilePath, 'file').catch(() => {}) | ||
} | ||
} | ||
} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023-present Vladyslav Dalechyn | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,40 @@ | ||
<p align="center"> | ||
<a href="https://viem-quoter.vercel.app/"> | ||
<h1>Viem Quoter</h1> | ||
</a> | ||
</p> | ||
|
||
<p align="center"> | ||
Viem extension for quoting prices from different DEXes across all chains | ||
<p> | ||
|
||
<br> | ||
|
||
## Features | ||
|
||
- Get UniswapV3 ETH price or any other pool quote. | ||
- Seamless extension to [Viem](https://github.com/wagmi-dev/viem) | ||
- TypeScript ready | ||
|
||
## Overview | ||
|
||
```ts | ||
import { publicViemQuoterActions } from 'viem-quoter' | ||
import { createPublicClient, http } from 'viem' | ||
import { mainnet } from 'viem/chains' | ||
|
||
const publicClient = createPublicClient({ | ||
chain: mainnet, | ||
transport: http(), | ||
}).extend(publicViemQuoterActions) | ||
|
||
console.log(await publicClient.getUniswapV3EthPrice()) | ||
``` | ||
|
||
## Authors | ||
|
||
- [@dalechyn](https://github.com/dalechyn) (dalechyn.eth [Twitter](https://twitter.com/dalechyn) [Warpcast](https://warpcast.com/dalechyn.eth)) | ||
|
||
## License | ||
|
||
[MIT](LICENSE.md) License |
Oops, something went wrong.