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

SDK Publish and compatibility with Front-end #152

Merged
merged 35 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
27f01d2
Added PositionUtils class
piotrwitek Mar 22, 2024
569da63
Refactor
piotrwitek Mar 22, 2024
530c7d0
Refactor
piotrwitek Mar 22, 2024
a5f9119
Fixed review comments
piotrwitek Mar 26, 2024
d7973c4
Merge commit '3af2ac8af516d89fe19ea7c26d6bffe6eae9bf98' into pw/posit…
piotrwitek Mar 26, 2024
59596f7
Fixed merge issue
piotrwitek Mar 26, 2024
4c34314
Fixed type in test
piotrwitek Mar 26, 2024
6abbad8
Updated exports from common
piotrwitek Mar 27, 2024
55dde92
Updated bundle scripts
piotrwitek Mar 27, 2024
e2470a4
Deployed to npm
piotrwitek Mar 27, 2024
f9f62e7
Merge commit '94513f42aa7f421442d72a6d4c4d1c1542112822' into pw/posit…
piotrwitek Mar 28, 2024
e16c2c6
bump versions
piotrwitek Mar 28, 2024
0daee79
release
piotrwitek Mar 28, 2024
c212a0e
Merge commit 'be04e71cdd8d4575a69bd9a885812d80da50b49c' into pw/sdk-p…
piotrwitek Apr 2, 2024
9de44a3
Merge commit 'f0cc7a7d91d889a42a8224641c441af6455a033d' into pw/sdk-p…
piotrwitek Apr 3, 2024
1e54541
merge artifacts
piotrwitek Apr 3, 2024
d334be0
published 0.0.9
piotrwitek Apr 3, 2024
333f2c0
Merge commit 'bb19df1c5324da86626c6e42ac5c872721c15f4c' into pw/sdk-p…
piotrwitek Apr 3, 2024
250d5b2
updated bundle scripts to use tsconfig for build
piotrwitek Apr 3, 2024
397098b
Published a new package protocols-plugins
piotrwitek Apr 4, 2024
f3dcd2b
Added error handling to the sdk client
piotrwitek Apr 4, 2024
df4e23d
Updated npm packages bundling scripts and type definitions
piotrwitek Apr 4, 2024
3ae18b6
Added services to npm package
piotrwitek Apr 4, 2024
9b757bf
fixed tests config
piotrwitek Apr 4, 2024
f24a0a9
lock file
piotrwitek Apr 4, 2024
51b738b
Merge commit '86703fedcddfe683b3ef9cdd3c1a95fd7405101a' into pw/sdk-p…
piotrwitek Apr 4, 2024
d5f55dc
Publish packages to npmjs (#155)
cristidas Apr 5, 2024
8e01fd3
Merge commit 'ccd5120118c6bd4dcd2e06903932f11f83cc560b' into pw/sdk-p…
piotrwitek Apr 11, 2024
0667442
Merge remote-tracking branch 'origin/dev' into pw/sdk-publish-poc
piotrwitek Apr 12, 2024
66d8be2
Fixed envs
piotrwitek Apr 15, 2024
74301bc
Added logging
piotrwitek Apr 15, 2024
6fa74ad
fix: same token comparison
robercano Apr 16, 2024
28838a9
Added logging env variable
piotrwitek Apr 16, 2024
4887a9d
Merge commit '083d6a9c471c50ec370f6a7869597a54d7c8b907' into pw/sdk-p…
piotrwitek Apr 16, 2024
6c2558a
updated lock
piotrwitek Apr 16, 2024
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
38 changes: 38 additions & 0 deletions .github/workflows/publish-client-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Client Package

on:
workflow_call:
inputs:
npm_access_token:
required: true
type: secret
version_changed:
required: true
type: boolean

jobs:
publish-client-package:
if: ${{ inputs.version_changed }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
corepack: true

- name: Install pnpm
run: corepack enable && corepack prepare pnpm@latest --activate

- name: Install dependencies with pnpm
run: pnpm i

- name: Build with pnpm
run: pnpm build

- name: Publish package with pnpm
run: pnpm publish:npm
working-directory: sdk/sdk-client
env:
NPM_ACCESS_TOKEN: ${{ inputs.npm_access_token }}
38 changes: 38 additions & 0 deletions .github/workflows/publish-common-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Common Package

on:
workflow_call:
inputs:
npm_access_token:
required: true
type: secret
version_changed:
required: true
type: boolean

jobs:
publish-common-package:
if: ${{ inputs.version_changed }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
corepack: true

- name: Install pnpm
run: corepack enable && corepack prepare pnpm@latest --activate

- name: Install dependencies with pnpm
run: pnpm i

- name: Build with pnpm
run: pnpm build

- name: Publish package with pnpm
run: pnpm publish:npm
working-directory: sdk/sdk-common
env:
NPM_ACCESS_TOKEN: ${{ inputs.npm_access_token }}
72 changes: 72 additions & 0 deletions .github/workflows/publish-packages-manually.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Publish Packages

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: false

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch name'
required: true
type: choice
options:
- 'main'
- 'dev'
publish_option:
description: 'Select package(s) to publish'
required: true
type: choice
options:
- 'common'
- 'client'
- 'all'

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
common_changed: ${{ steps.common-version-check.outputs.changed }}
client_changed: ${{ steps.client-version-check.outputs.changed }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
ref: ${{ github.event.inputs.branch || github.ref_name }}
- id: common-version-check
run: |
if git diff HEAD^ HEAD -- sdk/sdk-common/bundle/package.json | grep '"version":'; then
echo "::set-output name=changed::true"
else
echo "::set-output name=changed::false"
fi
- id: client-version-check
run: |
if git diff HEAD^ HEAD -- sdk/sdk-client/bundle/package.json | grep '"version":'; then
echo "::set-output name=changed::true"
else
echo "::set-output name=changed::false"
fi

publish-common:
needs: prepare
if: >-
(needs.prepare.outputs.common_changed == 'true') &&
((github.event.inputs.publish_option == 'common') || (github.event.inputs.publish_option == 'all'))
uses: ./.github/workflows/publish-common-package.yaml
with:
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }}
version_changed: ${{ needs.prepare.outputs.common_changed }}

publish-client:
needs: prepare
if: >-
(needs.prepare.outputs.client_changed == 'true') &&
((github.event.inputs.publish_option == 'client') || (github.event.inputs.publish_option == 'all'))
uses: ./.github/workflows/publish-client-package.yaml
with:
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }}
version_changed: ${{ needs.prepare.outputs.client_changed }}
56 changes: 56 additions & 0 deletions .github/workflows/publish-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Packages

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: false

on:
push:
branches:
- main
paths:
- 'sdk/sdk-common/bundle/package.json'
- 'sdk/sdk-client/bundle/package.json'

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
common_changed: ${{ steps.common-version-check.outputs.changed }}
client_changed: ${{ steps.client-version-check.outputs.changed }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: common-version-check
run: |
if git diff HEAD^ HEAD -- sdk/sdk-common/bundle/package.json | grep '"version":'; then
echo "::set-output name=changed::true"
else
echo "::set-output name=changed::false"
fi
- id: client-version-check
run: |
if git diff HEAD^ HEAD -- sdk/sdk-client/bundle/package.json | grep '"version":'; then
echo "::set-output name=changed::true"
else
echo "::set-output name=changed::false"
fi

publish-common:
needs: prepare
if: ${{ needs.prepare.outputs.common_changed == 'true' }}
uses: ./.github/workflows/publish-common-package.yaml
with:
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }}
version_changed: ${{ needs.prepare.outputs.common_changed }}

publish-client:
needs: prepare
if: ${{ needs.prepare.outputs.client_changed == 'true' }}
uses: ./.github/workflows/publish-client-package.yaml
with:
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }}
version_changed: ${{ needs.prepare.outputs.client_changed }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ artifacts
.vscode

# private http envs
*.private.env.json
*.private.env.json
62 changes: 59 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion sdk/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ ONE_INCH_API_URL='https://api-oasis.1inch.io'
ONE_INCH_ALLOWED_SWAP_PROTOCOLS='UNISWAP_V3,PMM1,PMM2,PMM3,PMM4,UNISWAP_V2,SUSHI,CURVE,CURVE_V2,PSM,WSTETH,BALANCER,BALANCER_V2,BALANCER_V2_WRAPPER,ST_ETH,WETH,ROCKET_POOL'

# ChainIDs where 1Inch swaps are allowed (comma separated)
ONE_INCH_SWAP_CHAIN_IDS='1'
ONE_INCH_SWAP_CHAIN_IDS='1'

SDK_LOGGING_ENABLED=
18 changes: 18 additions & 0 deletions sdk/protocol-plugins/bundle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "summerfi-protocol-plugins",
"version": "0.0.9",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"packageManager": "yarn@1.22.21",
"scripts": {},
"dependencies": {
"@summerfi/sdk-common": "workspace:*",
"@summerfi/deployment-utils": "workspace:*",
"@summerfi/deployment-types": "workspace:*",
"@summerfi/protocol-plugins-common": "workspace:*",
"@summerfi/testing-utils": "workspace:*",
"@summerfi/swap-common": "workspace:*",
"bignumber.js": "9.0.1",
"zod": "^3.22.4"
}
}
8 changes: 7 additions & 1 deletion sdk/protocol-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "@summerfi/protocol-plugins",
"version": "0.0.1",
"exports": {
".": {
"import": "./src/index.ts",
"types": "./src/index.d.ts"
},
"./*": {
"import": "./src/*/index.ts",
"types": "./src/*/index.d.ts"
Expand All @@ -16,7 +20,9 @@
"testw:integration": "jest tests/integration --watch",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"build": "tsc -b -v tsconfig.build.json"
"build": "tsc -b -v tsconfig.build.json",
"bundle:npm": "esbuild src/index.ts --platform=neutral --target=es2020 --conditions= --main-fields=main --bundle --sourcemap --outfile=bundle/dist/index.js --external:crypto --external:tls --external:https --external:net --external:http --external:stream --external:zlib --external:assert --keep-names && tsc --emitDeclarationOnly --outDir bundle/dist -p tsconfig.build.json",
"publish:npm": "pnpm bundle:npm && cd bundle && npm publish && cd .."
},
"dependencies": {
"@summerfi/sdk-common": "workspace:*",
Expand Down
5 changes: 5 additions & 0 deletions sdk/protocol-plugins/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './plugins/aave-v3'
export * from './plugins/spark'
export * from './plugins/maker'
export * from './plugins/common'
export * from './implementation'
14 changes: 14 additions & 0 deletions sdk/sdk-client/bundle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "summerfi-sdk-client",
"version": "0.0.9",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"packageManager": "yarn@1.22.21",
"scripts": {},
"dependencies": {
"@trpc/client": "11.0.0-next-beta.264",
"bignumber.js": "^9.1.2",
"superjson": "^1.13.3",
"viem": "^2.7.9"
}
}
Loading
Loading