From 2e5860b8451e7c85aae82964c01a996fad685ad5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:14:00 +0000 Subject: [PATCH 1/2] chore: release master --- .release-please-manifest.json | 6 +++--- docs/CHANGELOG.md | 21 +++++++++++++++++++++ docs/package.json | 2 +- packages/react/CHANGELOG.md | 7 +++++++ packages/react/package.json | 2 +- packages/sdk/CHANGELOG.md | 12 ++++++++++++ packages/sdk/package.json | 2 +- 7 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 docs/CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8a125dc..63f3325 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,5 +1,5 @@ { - "docs": "0.0.1", - "packages/sdk": "1.1.2", - "packages/react": "1.1.2" + "docs": "1.0.0", + "packages/sdk": "1.2.0", + "packages/react": "1.2.0" } \ No newline at end of file diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md new file mode 100644 index 0000000..c5826d0 --- /dev/null +++ b/docs/CHANGELOG.md @@ -0,0 +1,21 @@ +# Changelog + +## [1.0.0](https://github.com/ChainSafe/sprinter-ts/compare/docs-v0.0.1...docs-v1.0.0) (2025-01-13) + + +### ⚠ BREAKING CHANGES + +* All functions renamed, different API and flows, please consult docs or reach out to us directly! + +### Features + +* add enableSwaps in `transferWithHook` and `transfer` ([#97](https://github.com/ChainSafe/sprinter-ts/issues/97)) ([bd21311](https://github.com/ChainSafe/sprinter-ts/commit/bd213119b2eb8f41d574cbf2fd81d63296d08816)), closes [#94](https://github.com/ChainSafe/sprinter-ts/issues/94) +* add relay to the docs ([#103](https://github.com/ChainSafe/sprinter-ts/issues/103)) ([310c506](https://github.com/ChainSafe/sprinter-ts/commit/310c5062dfbbcf25efd5bea012c03cb236b56547)) +* Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) +* cross chain contract call ([#21](https://github.com/ChainSafe/sprinter-ts/issues/21)) ([69c0128](https://github.com/ChainSafe/sprinter-ts/commit/69c0128862aa8013d349a615a45a360dd091585e)) +* depricate provider param from sdk ([#41](https://github.com/ChainSafe/sprinter-ts/issues/41)) ([72297fe](https://github.com/ChainSafe/sprinter-ts/commit/72297feaff4b98ffcb8ee8f3005f786c5cd9ae72)) +* docs POC ([#14](https://github.com/ChainSafe/sprinter-ts/issues/14)) ([8cd800d](https://github.com/ChainSafe/sprinter-ts/commit/8cd800d0729a2d03f7fca821f5f69ef6556b1ac1)) +* dynamic supported network and tokens in docs ([#32](https://github.com/ChainSafe/sprinter-ts/issues/32)) ([abe5618](https://github.com/ChainSafe/sprinter-ts/commit/abe5618f56a07548f26963d98bdbe9a7bb301655)), closes [#29](https://github.com/ChainSafe/sprinter-ts/issues/29) +* erc20 with contract call ([#39](https://github.com/ChainSafe/sprinter-ts/issues/39)) ([77e1d8d](https://github.com/ChainSafe/sprinter-ts/commit/77e1d8dceaa4ffa14931c4cddc7897048af9e607)), closes [#38](https://github.com/ChainSafe/sprinter-ts/issues/38) +* native tokens transfers ([#40](https://github.com/ChainSafe/sprinter-ts/issues/40)) ([d4edf35](https://github.com/ChainSafe/sprinter-ts/commit/d4edf3599f74ccce3827fc9291d1c2bcfcc5eea6)), closes [#36](https://github.com/ChainSafe/sprinter-ts/issues/36) +* refactor api ([#61](https://github.com/ChainSafe/sprinter-ts/issues/61)) ([d6b1e9c](https://github.com/ChainSafe/sprinter-ts/commit/d6b1e9caa9c4bf91442b119c19e8b7904a3f9af9)) diff --git a/docs/package.json b/docs/package.json index aac289b..9b315ac 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "0.0.1", + "version": "1.0.0", "private": true, "scripts": { "docusaurus": "docusaurus", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 8403170..32e6c5e 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.2.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v1.1.2...sprinter-react-v1.2.0) (2025-01-13) + + +### Features + +* Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) + ## [1.1.2](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v1.1.1...sprinter-react-v1.1.2) (2024-12-11) diff --git a/packages/react/package.json b/packages/react/package.json index a8d4f91..cf4375e 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/sprinter-react", - "version": "1.1.2", + "version": "1.2.0", "type": "module", "main": "dist/main.js", "types": "dist/main.d.ts", diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index c9da2f8..2a89250 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.2.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.1.2...sprinter-sdk-v1.2.0) (2025-01-13) + + +### Features + +* Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) + + +### Bug Fixes + +* webpack import meta error ([#114](https://github.com/ChainSafe/sprinter-ts/issues/114)) ([f5f6fcf](https://github.com/ChainSafe/sprinter-ts/commit/f5f6fcfda884cd70aa6ccd94f19b2641741b265b)) + ## [1.1.2](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.1.1...sprinter-sdk-v1.1.2) (2024-12-11) diff --git a/packages/sdk/package.json b/packages/sdk/package.json index f0fed57..0cf86c3 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/sprinter-sdk", - "version": "1.1.2", + "version": "1.2.0", "main": "dist/index.js", "license": "MIT", "scripts": { From 86248e177bb9b110211c6a24840598d04cacb6f3 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 16 Jan 2025 13:47:14 +0100 Subject: [PATCH 2/2] prettier --- .eslintrc.js | 4 +- .github/workflows/cd.yml | 5 +- .github/workflows/ci.yml | 8 +- .github/workflows/deploy-docs.yml | 9 +-- .release-please-manifest.json | 8 +- README.md | 23 ++++-- docs/CHANGELOG.md | 23 +++--- packages/react/.prettierrc | 8 +- packages/react/CHANGELOG.md | 34 +++----- packages/react/README.md | 16 ++-- packages/react/eslint.config.js | 24 +++--- .../react/lib/internal/useAsyncRequest.ts | 39 +++++---- packages/react/lib/internal/useBalances.ts | 65 +++++++++------ packages/react/lib/internal/useChains.ts | 6 +- packages/react/lib/internal/useTokens.ts | 6 +- packages/react/lib/main.ts | 2 +- packages/react/src/Action.tsx | 2 +- packages/react/src/main.tsx | 12 +-- packages/react/tsconfig.lib.json | 2 +- packages/react/vite.config.ts | 58 +++++++------- packages/sdk/.eslintrc.js | 2 +- packages/sdk/CHANGELOG.md | 79 ++++++++----------- packages/sdk/README.md | 11 +-- packages/sdk/tsconfig.json | 22 +++--- release-please-config.json | 60 +++++++------- 25 files changed, 276 insertions(+), 252 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 0f1bb3f..1e3787e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,5 @@ require("@rushstack/eslint-patch/modern-module-resolution"); module.exports = { - extends: "@chainsafe", -} + extends: "@chainsafe", +}; diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3080fe9..7b53092 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,7 +9,6 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - - uses: google-github-actions/release-please-action@v3 # it will analyze commits and create PR with new version and updated CHANGELOG:md file. On merging it will create github release page with changelog id: release with: @@ -26,7 +25,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" if: ${{ steps.release.outputs.releases_created }} - run: corepack enable @@ -82,4 +81,4 @@ jobs: gitHubToken: ${{ secrets.GITHUB_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: 2238a825c5aca59233eab1f221f7aefb - command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc \ No newline at end of file + command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0af9aee..6ce99fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - master pull_request: branches: - - '**' + - "**" jobs: unified: @@ -26,9 +26,9 @@ jobs: env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: "Unit Tests" - run: 'yarn run test:unit' + run: "yarn run test:unit" - name: "Integrations Tests" - run: 'yarn run test:integrations' + run: "yarn run test:integrations" - name: Set branch name for Cloudflare Pages id: cf-branch run: | @@ -90,4 +90,4 @@ jobs: gitHubToken: ${{ secrets.GITHUB_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: 2238a825c5aca59233eab1f221f7aefb - command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc --branch=${{ env.CF_BRANCH_NAME }} \ No newline at end of file + command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc --branch=${{ env.CF_BRANCH_NAME }} diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 640056b..a5e1931 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -3,9 +3,9 @@ on: workflow_dispatch: inputs: environment: - description: 'Select deployment environment' + description: "Select deployment environment" required: true - default: 'preview' + default: "preview" type: choice options: - production @@ -15,13 +15,12 @@ jobs: manual-deploy-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" - run: corepack enable @@ -52,4 +51,4 @@ jobs: gitHubToken: ${{ secrets.GITHUB_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: 2238a825c5aca59233eab1f221f7aefb - command: pages deploy ./docs/build --project-name=gopher-docs --branch=${{ env.CF_BRANCH_NAME }} \ No newline at end of file + command: pages deploy ./docs/build --project-name=gopher-docs --branch=${{ env.CF_BRANCH_NAME }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 63f3325..88ed5ff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,5 +1,5 @@ { - "docs": "1.0.0", - "packages/sdk": "1.2.0", - "packages/react": "1.2.0" -} \ No newline at end of file + "docs": "1.0.0", + "packages/sdk": "1.2.0", + "packages/react": "1.2.0" +} diff --git a/README.md b/README.md index 7ce8e92..a1b2076 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,17 @@ ## Table of Contents - [Sprinter TS - Cross-Chain Developer Toolkit](#sprinter-ts---cross-chain-developer-toolkit) - - [Introduction](#introduction) - - [Prerequisites](#prerequisites) - - [Getting Started](#getting-started) - - [Building](#building) - - [Testing](#testing) - - [Linting and Formatting](#linting-and-formatting) + - [Introduction](#introduction) + - [Prerequisites](#prerequisites) + - [Getting Started](#getting-started) + - [Building](#building) + - [Testing](#testing) + - [Linting and Formatting](#linting-and-formatting) --- + ## Introduction Sprinter TS is a powerful developer toolkit designed to simplify cross-chain integrations and enhance the developer experience. It includes: @@ -26,6 +27,7 @@ Whether you're building cross-chain applications or experimenting with decentral --- + ## Prerequisites Before you begin, ensure you have the following installed: @@ -36,26 +38,31 @@ Before you begin, ensure you have the following installed: --- + ## Getting Started To get started with the project: 1. Clone the repository: + ```shell git clone https://github.com/ChainSafe/sprinter-ts.git ``` 2. Navigate to the project root: + ```shell cd sprinter-ts ``` 3. Set Node.js to the compatible version _(skip if you use a manual approach)_: + ```shell nvm use ``` 4. Enable Corepack: + ```shell corepack enable ``` @@ -68,6 +75,7 @@ To get started with the project: --- + ## Building To build all packages, run: @@ -83,6 +91,7 @@ Here's the corrected and updated **Testing** and **Linting and Formatting** docu --- + ## Testing ### Run Unit Tests @@ -104,6 +113,7 @@ This command executes integration tests in all packages where they are defined. --- + ## Linting and Formatting This project uses [ESLint](https://eslint.org/) to enforce code style and formatting. To ensure consistent code quality, you can use the following command: @@ -115,4 +125,3 @@ yarn lint ``` This command runs the linter across all workspaces to identify any issues. - diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c5826d0..e74091f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,20 +2,19 @@ ## [1.0.0](https://github.com/ChainSafe/sprinter-ts/compare/docs-v0.0.1...docs-v1.0.0) (2025-01-13) - ### ⚠ BREAKING CHANGES -* All functions renamed, different API and flows, please consult docs or reach out to us directly! +- All functions renamed, different API and flows, please consult docs or reach out to us directly! ### Features -* add enableSwaps in `transferWithHook` and `transfer` ([#97](https://github.com/ChainSafe/sprinter-ts/issues/97)) ([bd21311](https://github.com/ChainSafe/sprinter-ts/commit/bd213119b2eb8f41d574cbf2fd81d63296d08816)), closes [#94](https://github.com/ChainSafe/sprinter-ts/issues/94) -* add relay to the docs ([#103](https://github.com/ChainSafe/sprinter-ts/issues/103)) ([310c506](https://github.com/ChainSafe/sprinter-ts/commit/310c5062dfbbcf25efd5bea012c03cb236b56547)) -* Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) -* cross chain contract call ([#21](https://github.com/ChainSafe/sprinter-ts/issues/21)) ([69c0128](https://github.com/ChainSafe/sprinter-ts/commit/69c0128862aa8013d349a615a45a360dd091585e)) -* depricate provider param from sdk ([#41](https://github.com/ChainSafe/sprinter-ts/issues/41)) ([72297fe](https://github.com/ChainSafe/sprinter-ts/commit/72297feaff4b98ffcb8ee8f3005f786c5cd9ae72)) -* docs POC ([#14](https://github.com/ChainSafe/sprinter-ts/issues/14)) ([8cd800d](https://github.com/ChainSafe/sprinter-ts/commit/8cd800d0729a2d03f7fca821f5f69ef6556b1ac1)) -* dynamic supported network and tokens in docs ([#32](https://github.com/ChainSafe/sprinter-ts/issues/32)) ([abe5618](https://github.com/ChainSafe/sprinter-ts/commit/abe5618f56a07548f26963d98bdbe9a7bb301655)), closes [#29](https://github.com/ChainSafe/sprinter-ts/issues/29) -* erc20 with contract call ([#39](https://github.com/ChainSafe/sprinter-ts/issues/39)) ([77e1d8d](https://github.com/ChainSafe/sprinter-ts/commit/77e1d8dceaa4ffa14931c4cddc7897048af9e607)), closes [#38](https://github.com/ChainSafe/sprinter-ts/issues/38) -* native tokens transfers ([#40](https://github.com/ChainSafe/sprinter-ts/issues/40)) ([d4edf35](https://github.com/ChainSafe/sprinter-ts/commit/d4edf3599f74ccce3827fc9291d1c2bcfcc5eea6)), closes [#36](https://github.com/ChainSafe/sprinter-ts/issues/36) -* refactor api ([#61](https://github.com/ChainSafe/sprinter-ts/issues/61)) ([d6b1e9c](https://github.com/ChainSafe/sprinter-ts/commit/d6b1e9caa9c4bf91442b119c19e8b7904a3f9af9)) +- add enableSwaps in `transferWithHook` and `transfer` ([#97](https://github.com/ChainSafe/sprinter-ts/issues/97)) ([bd21311](https://github.com/ChainSafe/sprinter-ts/commit/bd213119b2eb8f41d574cbf2fd81d63296d08816)), closes [#94](https://github.com/ChainSafe/sprinter-ts/issues/94) +- add relay to the docs ([#103](https://github.com/ChainSafe/sprinter-ts/issues/103)) ([310c506](https://github.com/ChainSafe/sprinter-ts/commit/310c5062dfbbcf25efd5bea012c03cb236b56547)) +- Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) +- cross chain contract call ([#21](https://github.com/ChainSafe/sprinter-ts/issues/21)) ([69c0128](https://github.com/ChainSafe/sprinter-ts/commit/69c0128862aa8013d349a615a45a360dd091585e)) +- depricate provider param from sdk ([#41](https://github.com/ChainSafe/sprinter-ts/issues/41)) ([72297fe](https://github.com/ChainSafe/sprinter-ts/commit/72297feaff4b98ffcb8ee8f3005f786c5cd9ae72)) +- docs POC ([#14](https://github.com/ChainSafe/sprinter-ts/issues/14)) ([8cd800d](https://github.com/ChainSafe/sprinter-ts/commit/8cd800d0729a2d03f7fca821f5f69ef6556b1ac1)) +- dynamic supported network and tokens in docs ([#32](https://github.com/ChainSafe/sprinter-ts/issues/32)) ([abe5618](https://github.com/ChainSafe/sprinter-ts/commit/abe5618f56a07548f26963d98bdbe9a7bb301655)), closes [#29](https://github.com/ChainSafe/sprinter-ts/issues/29) +- erc20 with contract call ([#39](https://github.com/ChainSafe/sprinter-ts/issues/39)) ([77e1d8d](https://github.com/ChainSafe/sprinter-ts/commit/77e1d8dceaa4ffa14931c4cddc7897048af9e607)), closes [#38](https://github.com/ChainSafe/sprinter-ts/issues/38) +- native tokens transfers ([#40](https://github.com/ChainSafe/sprinter-ts/issues/40)) ([d4edf35](https://github.com/ChainSafe/sprinter-ts/commit/d4edf3599f74ccce3827fc9291d1c2bcfcc5eea6)), closes [#36](https://github.com/ChainSafe/sprinter-ts/issues/36) +- refactor api ([#61](https://github.com/ChainSafe/sprinter-ts/issues/61)) ([d6b1e9c](https://github.com/ChainSafe/sprinter-ts/commit/d6b1e9caa9c4bf91442b119c19e8b7904a3f9af9)) diff --git a/packages/react/.prettierrc b/packages/react/.prettierrc index 60998ab..99c88b4 100644 --- a/packages/react/.prettierrc +++ b/packages/react/.prettierrc @@ -1,6 +1,6 @@ { - "useTabs": false, - "singleQuote": false, - "trailingComma": "all", - "printWidth": 80 + "useTabs": false, + "singleQuote": false, + "trailingComma": "all", + "printWidth": 80 } diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 32e6c5e..886ac0f 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -2,71 +2,61 @@ ## [1.2.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v1.1.2...sprinter-react-v1.2.0) (2025-01-13) - ### Features -* Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) +- Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) ## [1.1.2](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v1.1.1...sprinter-react-v1.1.2) (2024-12-11) - ### Bug Fixes -* docs deploy pipeline ([#106](https://github.com/ChainSafe/sprinter-ts/issues/106)) ([55d8b32](https://github.com/ChainSafe/sprinter-ts/commit/55d8b32919cb98693a7b5d653e10e11f3830a708)) +- docs deploy pipeline ([#106](https://github.com/ChainSafe/sprinter-ts/issues/106)) ([55d8b32](https://github.com/ChainSafe/sprinter-ts/commit/55d8b32919cb98693a7b5d653e10e11f3830a708)) ## [1.1.1](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v1.1.0...sprinter-react-v1.1.1) (2024-12-11) - ### Bug Fixes -* add docs urls to README ([#104](https://github.com/ChainSafe/sprinter-ts/issues/104)) ([bc94336](https://github.com/ChainSafe/sprinter-ts/commit/bc943369b89c860ef7a255da4102ef27f7dc57b4)) +- add docs urls to README ([#104](https://github.com/ChainSafe/sprinter-ts/issues/104)) ([bc94336](https://github.com/ChainSafe/sprinter-ts/commit/bc943369b89c860ef7a255da4102ef27f7dc57b4)) ## [1.1.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v1.0.0...sprinter-react-v1.1.0) (2024-12-11) - ### Features -* add enableSwaps in `transferWithHook` and `transfer` ([#97](https://github.com/ChainSafe/sprinter-ts/issues/97)) ([bd21311](https://github.com/ChainSafe/sprinter-ts/commit/bd213119b2eb8f41d574cbf2fd81d63296d08816)), closes [#94](https://github.com/ChainSafe/sprinter-ts/issues/94) - +- add enableSwaps in `transferWithHook` and `transfer` ([#97](https://github.com/ChainSafe/sprinter-ts/issues/97)) ([bd21311](https://github.com/ChainSafe/sprinter-ts/commit/bd213119b2eb8f41d574cbf2fd81d63296d08816)), closes [#94](https://github.com/ChainSafe/sprinter-ts/issues/94) ### Bug Fixes -* **PoC:** readme, some errors and other nits ([#90](https://github.com/ChainSafe/sprinter-ts/issues/90)) ([f4fb199](https://github.com/ChainSafe/sprinter-ts/commit/f4fb1996b4d42db90f3c96b5869971f21cdc973e)) +- **PoC:** readme, some errors and other nits ([#90](https://github.com/ChainSafe/sprinter-ts/issues/90)) ([f4fb199](https://github.com/ChainSafe/sprinter-ts/commit/f4fb1996b4d42db90f3c96b5869971f21cdc973e)) ## [1.0.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v0.2.1...sprinter-react-v1.0.0) (2024-10-24) - ### ⚠ BREAKING CHANGES -* All functions renamed, different API and flows, please consult docs or reach out to us directly! +- All functions renamed, different API and flows, please consult docs or reach out to us directly! ### Features -* get bridge history for an address ([#68](https://github.com/ChainSafe/sprinter-ts/issues/68)) ([4d524c6](https://github.com/ChainSafe/sprinter-ts/commit/4d524c668393f33c7c200a81f75cab87a3114e9d)) -* refactor api ([#61](https://github.com/ChainSafe/sprinter-ts/issues/61)) ([d6b1e9c](https://github.com/ChainSafe/sprinter-ts/commit/d6b1e9caa9c4bf91442b119c19e8b7904a3f9af9)) +- get bridge history for an address ([#68](https://github.com/ChainSafe/sprinter-ts/issues/68)) ([4d524c6](https://github.com/ChainSafe/sprinter-ts/commit/4d524c668393f33c7c200a81f75cab87a3114e9d)) +- refactor api ([#61](https://github.com/ChainSafe/sprinter-ts/issues/61)) ([d6b1e9c](https://github.com/ChainSafe/sprinter-ts/commit/d6b1e9caa9c4bf91442b119c19e8b7904a3f9af9)) ## [0.2.1](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v0.2.0...sprinter-react-v0.2.1) (2024-09-23) - ### Bug Fixes -* react package should not be private ([#54](https://github.com/ChainSafe/sprinter-ts/issues/54)) ([ed8a5e0](https://github.com/ChainSafe/sprinter-ts/commit/ed8a5e011661e0e18e0b50d360bb16406692d3da)) +- react package should not be private ([#54](https://github.com/ChainSafe/sprinter-ts/issues/54)) ([ed8a5e0](https://github.com/ChainSafe/sprinter-ts/commit/ed8a5e011661e0e18e0b50d360bb16406692d3da)) ## [0.2.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v0.1.0...sprinter-react-v0.2.0) (2024-09-23) - ### Features -* react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) - +- react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) ### Bug Fixes -* cd and rect hooks export ([#52](https://github.com/ChainSafe/sprinter-ts/issues/52)) ([33c0604](https://github.com/ChainSafe/sprinter-ts/commit/33c06042a798bd68c8d902ba141a4d02fd4fc23e)) +- cd and rect hooks export ([#52](https://github.com/ChainSafe/sprinter-ts/issues/52)) ([33c0604](https://github.com/ChainSafe/sprinter-ts/commit/33c06042a798bd68c8d902ba141a4d02fd4fc23e)) ## [0.1.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-react-v0.0.1...sprinter-react-v0.1.0) (2024-09-23) - ### Features -* react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) +- react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) diff --git a/packages/react/README.md b/packages/react/README.md index 748abac..358a4fe 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -19,8 +19,8 @@ Wrap your application in the `SprinterContext` to gain access to blockchain-rela ### Example ```tsx -import React from 'react'; -import { SprinterContext } from '@chainsafe/sprinter-react'; +import React from "react"; +import { SprinterContext } from "@chainsafe/sprinter-react"; const App = () => ( @@ -34,8 +34,11 @@ export default App; Inside your components, you can use the provided hooks to interact with blockchain data: ```tsx -import React, { useEffect } from 'react'; -import { useSprinterBalances, useSprinterTokens } from '@chainsafe/sprinter-react'; +import React, { useEffect } from "react"; +import { + useSprinterBalances, + useSprinterTokens, +} from "@chainsafe/sprinter-react"; const YourComponent = () => { const ownerAddress = "0xYourAddressHere"; @@ -74,12 +77,15 @@ The following hooks are provided by the SDK: You can pass custom fetch options when initializing the context: ```tsx - + ``` ## Documentation + For more detailed docs you can check out [SDK docs page](https://docs.sprinter.tech/docs/react-sdk/). ## Contributing diff --git a/packages/react/eslint.config.js b/packages/react/eslint.config.js index 092408a..79a552e 100644 --- a/packages/react/eslint.config.js +++ b/packages/react/eslint.config.js @@ -1,28 +1,28 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import tseslint from "typescript-eslint"; export default tseslint.config( - { ignores: ['dist'] }, + { ignores: ["dist"] }, { extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, plugins: { - 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, + "react-hooks": reactHooks, + "react-refresh": reactRefresh, }, rules: { ...reactHooks.configs.recommended.rules, - 'react-refresh/only-export-components': [ - 'warn', + "react-refresh/only-export-components": [ + "warn", { allowConstantExport: true }, ], }, }, -) +); diff --git a/packages/react/lib/internal/useAsyncRequest.ts b/packages/react/lib/internal/useAsyncRequest.ts index 6fa70c9..48e5279 100644 --- a/packages/react/lib/internal/useAsyncRequest.ts +++ b/packages/react/lib/internal/useAsyncRequest.ts @@ -1,4 +1,4 @@ -import {useCallback, useReducer} from "react"; +import { useCallback, useReducer } from "react"; const initialState = { data: null, @@ -7,24 +7,32 @@ const initialState = { }; export function useAsyncRequest() { - const [state, dispatch] = useReducer(fetchReducer, initialState as AsyncRequestState); + const [state, dispatch] = useReducer( + fetchReducer, + initialState as AsyncRequestState, + ); - const makeRequest = useCallback((request: Promise) => { - dispatch({ type: RequestAction.INIT }); + const makeRequest = useCallback( + (request: Promise) => { + dispatch({ type: RequestAction.INIT }); - request.then(result => { - dispatch({ type: RequestAction.SUCCESS, payload: result }); - }).catch((error: Error) => { - dispatch({ type: RequestAction.FAILURE, error: error.message }); - }); - }, [dispatch]); + request + .then((result) => { + dispatch({ type: RequestAction.SUCCESS, payload: result }); + }) + .catch((error: Error) => { + dispatch({ type: RequestAction.FAILURE, error: error.message }); + }); + }, + [dispatch], + ); return { state, makeRequest }; } enum RequestAction { - INIT = 'REQUEST_INIT', - SUCCESS = 'REQUEST_SUCCESS', + INIT = "REQUEST_INIT", + SUCCESS = "REQUEST_SUCCESS", FAILURE = "REQUEST_FAILURE", } @@ -39,7 +47,10 @@ type AsyncRequestActions = | { type: RequestAction.SUCCESS; payload: T } | { type: RequestAction.FAILURE; error: string }; -const fetchReducer = (state: AsyncRequestState, action: AsyncRequestActions): AsyncRequestState => { +const fetchReducer = ( + state: AsyncRequestState, + action: AsyncRequestActions, +): AsyncRequestState => { switch (action.type) { case RequestAction.INIT: return { @@ -60,6 +71,6 @@ const fetchReducer = (state: AsyncRequestState, action: AsyncRequestAction error: action.error, }; default: - throw new Error('Unknown action type'); + throw new Error("Unknown action type"); } }; diff --git a/packages/react/lib/internal/useBalances.ts b/packages/react/lib/internal/useBalances.ts index 6fef382..69d9070 100644 --- a/packages/react/lib/internal/useBalances.ts +++ b/packages/react/lib/internal/useBalances.ts @@ -1,27 +1,41 @@ -import {useCallback, useReducer} from "react"; -import {Address, AggregateBalances, Sprinter} from "@chainsafe/sprinter-sdk"; +import { useCallback, useReducer } from "react"; +import { Address, AggregateBalances, Sprinter } from "@chainsafe/sprinter-sdk"; const initialState: BalancesState = {}; export function useBalances(sprinter: Sprinter) { const [balances, dispatch] = useReducer(balancesReducer, initialState); - const getUserBalances = useCallback((account: Address) => { - dispatch({ type: BalanceAction.INIT, address: account }); + const getUserBalances = useCallback( + (account: Address) => { + dispatch({ type: BalanceAction.INIT, address: account }); - sprinter.getUserBalances(account).then(result => { - dispatch({ type: BalanceAction.SUCCESS, payload: result, address: account }); - }).catch((error: Error) => { - dispatch({ type: BalanceAction.FAILURE, error: error.message, address: account }); - }); - }, [sprinter, dispatch]); + sprinter + .getUserBalances(account) + .then((result) => { + dispatch({ + type: BalanceAction.SUCCESS, + payload: result, + address: account, + }); + }) + .catch((error: Error) => { + dispatch({ + type: BalanceAction.FAILURE, + error: error.message, + address: account, + }); + }); + }, + [sprinter, dispatch], + ); - return {balances, getUserBalances}; + return { balances, getUserBalances }; } enum BalanceAction { - INIT = 'REQUEST_INIT', - SUCCESS = 'REQUEST_SUCCESS', + INIT = "REQUEST_INIT", + SUCCESS = "REQUEST_SUCCESS", FAILURE = "REQUEST_FAILURE", } @@ -35,10 +49,17 @@ type BalancesState = Record; type BalanceActions = | { type: BalanceAction.INIT; address: Address } - | { type: BalanceAction.SUCCESS; payload: AggregateBalances; address: Address } + | { + type: BalanceAction.SUCCESS; + payload: AggregateBalances; + address: Address; + } | { type: BalanceAction.FAILURE; error: string; address: Address }; -function balancesReducer(state: BalancesState, action: BalanceActions): BalancesState { +function balancesReducer( + state: BalancesState, + action: BalanceActions, +): BalancesState { switch (action.type) { case BalanceAction.INIT: return { @@ -47,8 +68,8 @@ function balancesReducer(state: BalancesState, action: BalanceActions): Balances ...state[action.address], loading: true, error: null, - } - } + }, + }; case BalanceAction.SUCCESS: return { ...state, @@ -56,8 +77,8 @@ function balancesReducer(state: BalancesState, action: BalanceActions): Balances ...state[action.address], loading: false, data: action.payload, - } - } + }, + }; case BalanceAction.FAILURE: return { ...state, @@ -65,9 +86,9 @@ function balancesReducer(state: BalancesState, action: BalanceActions): Balances ...state[action.address], loading: false, error: action.error, - } - } + }, + }; default: - throw Error('Unknown action type'); + throw Error("Unknown action type"); } } diff --git a/packages/react/lib/internal/useChains.ts b/packages/react/lib/internal/useChains.ts index 06e0161..bc832d1 100644 --- a/packages/react/lib/internal/useChains.ts +++ b/packages/react/lib/internal/useChains.ts @@ -1,6 +1,6 @@ -import {type Chain, Sprinter} from "@chainsafe/sprinter-sdk"; -import {useCallback} from "react"; -import {useAsyncRequest} from "./useAsyncRequest.ts"; +import { type Chain, Sprinter } from "@chainsafe/sprinter-sdk"; +import { useCallback } from "react"; +import { useAsyncRequest } from "./useAsyncRequest.ts"; export function useChains(sprinter: Sprinter) { const { state: chains, makeRequest } = useAsyncRequest(); diff --git a/packages/react/lib/internal/useTokens.ts b/packages/react/lib/internal/useTokens.ts index 93c5180..1a1b941 100644 --- a/packages/react/lib/internal/useTokens.ts +++ b/packages/react/lib/internal/useTokens.ts @@ -1,6 +1,6 @@ -import {type FungibleToken, Sprinter} from "@chainsafe/sprinter-sdk"; -import {useCallback} from "react"; -import {useAsyncRequest} from "./useAsyncRequest.ts"; +import { type FungibleToken, Sprinter } from "@chainsafe/sprinter-sdk"; +import { useCallback } from "react"; +import { useAsyncRequest } from "./useAsyncRequest.ts"; export function useTokens(sprinter: Sprinter) { const { state: tokens, makeRequest } = useAsyncRequest(); diff --git a/packages/react/lib/main.ts b/packages/react/lib/main.ts index 2cd948c..1ee51f2 100644 --- a/packages/react/lib/main.ts +++ b/packages/react/lib/main.ts @@ -1,4 +1,4 @@ -export { SprinterContext } from './context'; +export { SprinterContext } from "./context"; export { useSprinterBalances, useSprinter, diff --git a/packages/react/src/Action.tsx b/packages/react/src/Action.tsx index d194ff6..f6a2ca4 100644 --- a/packages/react/src/Action.tsx +++ b/packages/react/src/Action.tsx @@ -2,7 +2,7 @@ import { useSprinterBalances } from "../lib/hooks.ts"; export function Action() { const hook = useSprinterBalances( - "0x3E101Ec02e7A48D16DADE204C96bFF842E7E2519" + "0x3E101Ec02e7A48D16DADE204C96bFF842E7E2519", ); return ( diff --git a/packages/react/src/main.tsx b/packages/react/src/main.tsx index 6f4ac9b..ef474bf 100644 --- a/packages/react/src/main.tsx +++ b/packages/react/src/main.tsx @@ -1,10 +1,10 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import App from './App.tsx' -import './index.css' +import { StrictMode } from "react"; +import { createRoot } from "react-dom/client"; +import App from "./App.tsx"; +import "./index.css"; -createRoot(document.getElementById('root')!).render( +createRoot(document.getElementById("root")!).render( , -) +); diff --git a/packages/react/tsconfig.lib.json b/packages/react/tsconfig.lib.json index 733a0de..5c83a22 100644 --- a/packages/react/tsconfig.lib.json +++ b/packages/react/tsconfig.lib.json @@ -1,4 +1,4 @@ { "extends": "./tsconfig.app.json", "include": ["lib"] -} \ No newline at end of file +} diff --git a/packages/react/vite.config.ts b/packages/react/vite.config.ts index a1a3055..b9842bd 100644 --- a/packages/react/vite.config.ts +++ b/packages/react/vite.config.ts @@ -1,41 +1,43 @@ -import { defineConfig } from 'vite' -import { extname, relative, resolve } from 'path' -import { fileURLToPath } from 'node:url' -import react from '@vitejs/plugin-react' -import dts from 'vite-plugin-dts' -import { glob } from 'glob' +import { defineConfig } from "vite"; +import { extname, relative, resolve } from "path"; +import { fileURLToPath } from "node:url"; +import react from "@vitejs/plugin-react"; +import dts from "vite-plugin-dts"; +import { glob } from "glob"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), dts({ tsconfigPath: resolve(__dirname, "tsconfig.lib.json"), })], + plugins: [ + react(), + dts({ tsconfigPath: resolve(__dirname, "tsconfig.lib.json") }), + ], build: { copyPublicDir: false, lib: { - entry: resolve(__dirname, 'lib/main.ts'), - formats: ['es'] + entry: resolve(__dirname, "lib/main.ts"), + formats: ["es"], }, rollupOptions: { - external: ['react', 'react/jsx-runtime'], + external: ["react", "react/jsx-runtime"], input: Object.fromEntries( // https://rollupjs.org/configuration-options/#input - glob.sync('lib/**/*.{ts,tsx}', { - ignore: ["lib/**/*.d.ts"], - }).map(file => [ - // 1. The name of the entry point - // lib/nested/foo.js becomes nested/foo - relative( - 'lib', - file.slice(0, file.length - extname(file).length) - ), - // 2. The absolute path to the entry file - // lib/nested/foo.ts becomes /project/lib/nested/foo.ts - fileURLToPath(new URL(file, import.meta.url)) - ]) + glob + .sync("lib/**/*.{ts,tsx}", { + ignore: ["lib/**/*.d.ts"], + }) + .map((file) => [ + // 1. The name of the entry point + // lib/nested/foo.js becomes nested/foo + relative("lib", file.slice(0, file.length - extname(file).length)), + // 2. The absolute path to the entry file + // lib/nested/foo.ts becomes /project/lib/nested/foo.ts + fileURLToPath(new URL(file, import.meta.url)), + ]), ), output: { - assetFileNames: 'assets/[name][extname]', - entryFileNames: '[name].js', - } - } + assetFileNames: "assets/[name][extname]", + entryFileNames: "[name].js", + }, + }, }, -}) +}); diff --git a/packages/sdk/.eslintrc.js b/packages/sdk/.eslintrc.js index 0c0eb3f..c86424a 100644 --- a/packages/sdk/.eslintrc.js +++ b/packages/sdk/.eslintrc.js @@ -1,3 +1,3 @@ module.exports = { extends: "../../.eslintrc.js", -} +}; diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index 2a89250..b809794 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -2,108 +2,95 @@ ## [1.2.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.1.2...sprinter-sdk-v1.2.0) (2025-01-13) - ### Features -* Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) - +- Add sweep function ([#115](https://github.com/ChainSafe/sprinter-ts/issues/115)) ([efaaa2b](https://github.com/ChainSafe/sprinter-ts/commit/efaaa2b3d8674e46b264caddcd373218c3f552c1)), closes [#110](https://github.com/ChainSafe/sprinter-ts/issues/110) ### Bug Fixes -* webpack import meta error ([#114](https://github.com/ChainSafe/sprinter-ts/issues/114)) ([f5f6fcf](https://github.com/ChainSafe/sprinter-ts/commit/f5f6fcfda884cd70aa6ccd94f19b2641741b265b)) +- webpack import meta error ([#114](https://github.com/ChainSafe/sprinter-ts/issues/114)) ([f5f6fcf](https://github.com/ChainSafe/sprinter-ts/commit/f5f6fcfda884cd70aa6ccd94f19b2641741b265b)) ## [1.1.2](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.1.1...sprinter-sdk-v1.1.2) (2024-12-11) - ### Bug Fixes -* docs deploy pipeline ([#106](https://github.com/ChainSafe/sprinter-ts/issues/106)) ([55d8b32](https://github.com/ChainSafe/sprinter-ts/commit/55d8b32919cb98693a7b5d653e10e11f3830a708)) +- docs deploy pipeline ([#106](https://github.com/ChainSafe/sprinter-ts/issues/106)) ([55d8b32](https://github.com/ChainSafe/sprinter-ts/commit/55d8b32919cb98693a7b5d653e10e11f3830a708)) ## [1.1.1](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.1.0...sprinter-sdk-v1.1.1) (2024-12-11) - ### Bug Fixes -* add docs urls to README ([#104](https://github.com/ChainSafe/sprinter-ts/issues/104)) ([bc94336](https://github.com/ChainSafe/sprinter-ts/commit/bc943369b89c860ef7a255da4102ef27f7dc57b4)) +- add docs urls to README ([#104](https://github.com/ChainSafe/sprinter-ts/issues/104)) ([bc94336](https://github.com/ChainSafe/sprinter-ts/commit/bc943369b89c860ef7a255da4102ef27f7dc57b4)) ## [1.1.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.0.2...sprinter-sdk-v1.1.0) (2024-12-11) - ### Features -* add enableSwaps in `transferWithHook` and `transfer` ([#97](https://github.com/ChainSafe/sprinter-ts/issues/97)) ([bd21311](https://github.com/ChainSafe/sprinter-ts/commit/bd213119b2eb8f41d574cbf2fd81d63296d08816)), closes [#94](https://github.com/ChainSafe/sprinter-ts/issues/94) +- add enableSwaps in `transferWithHook` and `transfer` ([#97](https://github.com/ChainSafe/sprinter-ts/issues/97)) ([bd21311](https://github.com/ChainSafe/sprinter-ts/commit/bd213119b2eb8f41d574cbf2fd81d63296d08816)), closes [#94](https://github.com/ChainSafe/sprinter-ts/issues/94) ## [1.0.2](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.0.1...sprinter-sdk-v1.0.2) (2024-11-21) - ### Bug Fixes -* trigger missed release ([#87](https://github.com/ChainSafe/sprinter-ts/issues/87)) ([db8d8d8](https://github.com/ChainSafe/sprinter-ts/commit/db8d8d8f09a2b4a47496a8cfa3ddc84c264f7066)) +- trigger missed release ([#87](https://github.com/ChainSafe/sprinter-ts/issues/87)) ([db8d8d8](https://github.com/ChainSafe/sprinter-ts/commit/db8d8d8f09a2b4a47496a8cfa3ddc84c264f7066)) ## [1.0.1](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v1.0.0...sprinter-sdk-v1.0.1) (2024-11-21) - ### Bug Fixes -* add make fetch options to `poolAssetOnDestination`, `poolAssetOnDestinationWithHook`, `transfer` ([#79](https://github.com/ChainSafe/sprinter-ts/issues/79)) ([2883aa7](https://github.com/ChainSafe/sprinter-ts/commit/2883aa791cbb13989b807a19f3119265707db73b)) -* trigger missed release ([#87](https://github.com/ChainSafe/sprinter-ts/issues/87)) ([db8d8d8](https://github.com/ChainSafe/sprinter-ts/commit/db8d8d8f09a2b4a47496a8cfa3ddc84c264f7066)) +- add make fetch options to `poolAssetOnDestination`, `poolAssetOnDestinationWithHook`, `transfer` ([#79](https://github.com/ChainSafe/sprinter-ts/issues/79)) ([2883aa7](https://github.com/ChainSafe/sprinter-ts/commit/2883aa791cbb13989b807a19f3119265707db73b)) +- trigger missed release ([#87](https://github.com/ChainSafe/sprinter-ts/issues/87)) ([db8d8d8](https://github.com/ChainSafe/sprinter-ts/commit/db8d8d8f09a2b4a47496a8cfa3ddc84c264f7066)) ## [1.0.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v0.3.0...sprinter-sdk-v1.0.0) (2024-10-24) - ### ⚠ BREAKING CHANGES -* All functions renamed, different API and flows, please consult docs or reach out to us directly! +- All functions renamed, different API and flows, please consult docs or reach out to us directly! ### Features -* get bridge history for an address ([#68](https://github.com/ChainSafe/sprinter-ts/issues/68)) ([4d524c6](https://github.com/ChainSafe/sprinter-ts/commit/4d524c668393f33c7c200a81f75cab87a3114e9d)) -* refactor api ([#61](https://github.com/ChainSafe/sprinter-ts/issues/61)) ([d6b1e9c](https://github.com/ChainSafe/sprinter-ts/commit/d6b1e9caa9c4bf91442b119c19e8b7904a3f9af9)) +- get bridge history for an address ([#68](https://github.com/ChainSafe/sprinter-ts/issues/68)) ([4d524c6](https://github.com/ChainSafe/sprinter-ts/commit/4d524c668393f33c7c200a81f75cab87a3114e9d)) +- refactor api ([#61](https://github.com/ChainSafe/sprinter-ts/issues/61)) ([d6b1e9c](https://github.com/ChainSafe/sprinter-ts/commit/d6b1e9caa9c4bf91442b119c19e8b7904a3f9af9)) ## [0.3.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v0.2.0...sprinter-sdk-v0.3.0) (2024-09-23) - ### Features -* api options ([#33](https://github.com/ChainSafe/sprinter-ts/issues/33)) ([ad1cb88](https://github.com/ChainSafe/sprinter-ts/commit/ad1cb887717a4fb8b30761d1f59054dcaedaeb4a)) -* cross chain contract call ([#21](https://github.com/ChainSafe/sprinter-ts/issues/21)) ([69c0128](https://github.com/ChainSafe/sprinter-ts/commit/69c0128862aa8013d349a615a45a360dd091585e)) -* depricate provider param from sdk ([#41](https://github.com/ChainSafe/sprinter-ts/issues/41)) ([72297fe](https://github.com/ChainSafe/sprinter-ts/commit/72297feaff4b98ffcb8ee8f3005f786c5cd9ae72)) -* docs POC ([#14](https://github.com/ChainSafe/sprinter-ts/issues/14)) ([8cd800d](https://github.com/ChainSafe/sprinter-ts/commit/8cd800d0729a2d03f7fca821f5f69ef6556b1ac1)) -* erc20 with contract call ([#39](https://github.com/ChainSafe/sprinter-ts/issues/39)) ([77e1d8d](https://github.com/ChainSafe/sprinter-ts/commit/77e1d8dceaa4ffa14931c4cddc7897048af9e607)), closes [#38](https://github.com/ChainSafe/sprinter-ts/issues/38) -* implement tracing url resolver ([#46](https://github.com/ChainSafe/sprinter-ts/issues/46)) ([efd1be3](https://github.com/ChainSafe/sprinter-ts/commit/efd1be3aaa4b64d6cd99642834714129845e4a35)), closes [#44](https://github.com/ChainSafe/sprinter-ts/issues/44) -* native tokens transfers ([#40](https://github.com/ChainSafe/sprinter-ts/issues/40)) ([d4edf35](https://github.com/ChainSafe/sprinter-ts/commit/d4edf3599f74ccce3827fc9291d1c2bcfcc5eea6)), closes [#36](https://github.com/ChainSafe/sprinter-ts/issues/36) -* react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) -* SDK POC ([#11](https://github.com/ChainSafe/sprinter-ts/issues/11)) ([6aca865](https://github.com/ChainSafe/sprinter-ts/commit/6aca865f062aa3d7e78d6b5ddbbc5c2e6e3f858c)) -* web poc (super basic basic) ([#3](https://github.com/ChainSafe/sprinter-ts/issues/3)) ([25a91f7](https://github.com/ChainSafe/sprinter-ts/commit/25a91f7660a38e7f849f1903416005324a829605)) - +- api options ([#33](https://github.com/ChainSafe/sprinter-ts/issues/33)) ([ad1cb88](https://github.com/ChainSafe/sprinter-ts/commit/ad1cb887717a4fb8b30761d1f59054dcaedaeb4a)) +- cross chain contract call ([#21](https://github.com/ChainSafe/sprinter-ts/issues/21)) ([69c0128](https://github.com/ChainSafe/sprinter-ts/commit/69c0128862aa8013d349a615a45a360dd091585e)) +- depricate provider param from sdk ([#41](https://github.com/ChainSafe/sprinter-ts/issues/41)) ([72297fe](https://github.com/ChainSafe/sprinter-ts/commit/72297feaff4b98ffcb8ee8f3005f786c5cd9ae72)) +- docs POC ([#14](https://github.com/ChainSafe/sprinter-ts/issues/14)) ([8cd800d](https://github.com/ChainSafe/sprinter-ts/commit/8cd800d0729a2d03f7fca821f5f69ef6556b1ac1)) +- erc20 with contract call ([#39](https://github.com/ChainSafe/sprinter-ts/issues/39)) ([77e1d8d](https://github.com/ChainSafe/sprinter-ts/commit/77e1d8dceaa4ffa14931c4cddc7897048af9e607)), closes [#38](https://github.com/ChainSafe/sprinter-ts/issues/38) +- implement tracing url resolver ([#46](https://github.com/ChainSafe/sprinter-ts/issues/46)) ([efd1be3](https://github.com/ChainSafe/sprinter-ts/commit/efd1be3aaa4b64d6cd99642834714129845e4a35)), closes [#44](https://github.com/ChainSafe/sprinter-ts/issues/44) +- native tokens transfers ([#40](https://github.com/ChainSafe/sprinter-ts/issues/40)) ([d4edf35](https://github.com/ChainSafe/sprinter-ts/commit/d4edf3599f74ccce3827fc9291d1c2bcfcc5eea6)), closes [#36](https://github.com/ChainSafe/sprinter-ts/issues/36) +- react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) +- SDK POC ([#11](https://github.com/ChainSafe/sprinter-ts/issues/11)) ([6aca865](https://github.com/ChainSafe/sprinter-ts/commit/6aca865f062aa3d7e78d6b5ddbbc5c2e6e3f858c)) +- web poc (super basic basic) ([#3](https://github.com/ChainSafe/sprinter-ts/issues/3)) ([25a91f7](https://github.com/ChainSafe/sprinter-ts/commit/25a91f7660a38e7f849f1903416005324a829605)) ### Bug Fixes -* process approvals from quote ([#26](https://github.com/ChainSafe/sprinter-ts/issues/26)) ([95d9ebf](https://github.com/ChainSafe/sprinter-ts/commit/95d9ebf631a933035a01d7593e735d26a7c2cf08)) +- process approvals from quote ([#26](https://github.com/ChainSafe/sprinter-ts/issues/26)) ([95d9ebf](https://github.com/ChainSafe/sprinter-ts/commit/95d9ebf631a933035a01d7593e735d26a7c2cf08)) ## [0.2.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v0.1.0...sprinter-sdk-v0.2.0) (2024-09-23) - ### Features -* implement tracing url resolver ([#46](https://github.com/ChainSafe/sprinter-ts/issues/46)) ([efd1be3](https://github.com/ChainSafe/sprinter-ts/commit/efd1be3aaa4b64d6cd99642834714129845e4a35)), closes [#44](https://github.com/ChainSafe/sprinter-ts/issues/44) -* react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) +- implement tracing url resolver ([#46](https://github.com/ChainSafe/sprinter-ts/issues/46)) ([efd1be3](https://github.com/ChainSafe/sprinter-ts/commit/efd1be3aaa4b64d6cd99642834714129845e4a35)), closes [#44](https://github.com/ChainSafe/sprinter-ts/issues/44) +- react sdk context ([#48](https://github.com/ChainSafe/sprinter-ts/issues/48)) ([39dbe7e](https://github.com/ChainSafe/sprinter-ts/commit/39dbe7e3cf2d1ec66f386b978a43c93208451f6e)), closes [#47](https://github.com/ChainSafe/sprinter-ts/issues/47) ## [0.1.0](https://github.com/ChainSafe/sprinter-ts/compare/sprinter-sdk-v0.0.1...sprinter-sdk-v0.1.0) (2024-09-12) - ### Features -* api options ([#33](https://github.com/ChainSafe/sprinter-ts/issues/33)) ([ad1cb88](https://github.com/ChainSafe/sprinter-ts/commit/ad1cb887717a4fb8b30761d1f59054dcaedaeb4a)) -* cross chain contract call ([#21](https://github.com/ChainSafe/sprinter-ts/issues/21)) ([69c0128](https://github.com/ChainSafe/sprinter-ts/commit/69c0128862aa8013d349a615a45a360dd091585e)) -* depricate provider param from sdk ([#41](https://github.com/ChainSafe/sprinter-ts/issues/41)) ([72297fe](https://github.com/ChainSafe/sprinter-ts/commit/72297feaff4b98ffcb8ee8f3005f786c5cd9ae72)) -* docs POC ([#14](https://github.com/ChainSafe/sprinter-ts/issues/14)) ([8cd800d](https://github.com/ChainSafe/sprinter-ts/commit/8cd800d0729a2d03f7fca821f5f69ef6556b1ac1)) -* erc20 with contract call ([#39](https://github.com/ChainSafe/sprinter-ts/issues/39)) ([77e1d8d](https://github.com/ChainSafe/sprinter-ts/commit/77e1d8dceaa4ffa14931c4cddc7897048af9e607)), closes [#38](https://github.com/ChainSafe/sprinter-ts/issues/38) -* native tokens transfers ([#40](https://github.com/ChainSafe/sprinter-ts/issues/40)) ([d4edf35](https://github.com/ChainSafe/sprinter-ts/commit/d4edf3599f74ccce3827fc9291d1c2bcfcc5eea6)), closes [#36](https://github.com/ChainSafe/sprinter-ts/issues/36) -* SDK POC ([#11](https://github.com/ChainSafe/sprinter-ts/issues/11)) ([6aca865](https://github.com/ChainSafe/sprinter-ts/commit/6aca865f062aa3d7e78d6b5ddbbc5c2e6e3f858c)) -* web poc (super basic basic) ([#3](https://github.com/ChainSafe/sprinter-ts/issues/3)) ([25a91f7](https://github.com/ChainSafe/sprinter-ts/commit/25a91f7660a38e7f849f1903416005324a829605)) - +- api options ([#33](https://github.com/ChainSafe/sprinter-ts/issues/33)) ([ad1cb88](https://github.com/ChainSafe/sprinter-ts/commit/ad1cb887717a4fb8b30761d1f59054dcaedaeb4a)) +- cross chain contract call ([#21](https://github.com/ChainSafe/sprinter-ts/issues/21)) ([69c0128](https://github.com/ChainSafe/sprinter-ts/commit/69c0128862aa8013d349a615a45a360dd091585e)) +- depricate provider param from sdk ([#41](https://github.com/ChainSafe/sprinter-ts/issues/41)) ([72297fe](https://github.com/ChainSafe/sprinter-ts/commit/72297feaff4b98ffcb8ee8f3005f786c5cd9ae72)) +- docs POC ([#14](https://github.com/ChainSafe/sprinter-ts/issues/14)) ([8cd800d](https://github.com/ChainSafe/sprinter-ts/commit/8cd800d0729a2d03f7fca821f5f69ef6556b1ac1)) +- erc20 with contract call ([#39](https://github.com/ChainSafe/sprinter-ts/issues/39)) ([77e1d8d](https://github.com/ChainSafe/sprinter-ts/commit/77e1d8dceaa4ffa14931c4cddc7897048af9e607)), closes [#38](https://github.com/ChainSafe/sprinter-ts/issues/38) +- native tokens transfers ([#40](https://github.com/ChainSafe/sprinter-ts/issues/40)) ([d4edf35](https://github.com/ChainSafe/sprinter-ts/commit/d4edf3599f74ccce3827fc9291d1c2bcfcc5eea6)), closes [#36](https://github.com/ChainSafe/sprinter-ts/issues/36) +- SDK POC ([#11](https://github.com/ChainSafe/sprinter-ts/issues/11)) ([6aca865](https://github.com/ChainSafe/sprinter-ts/commit/6aca865f062aa3d7e78d6b5ddbbc5c2e6e3f858c)) +- web poc (super basic basic) ([#3](https://github.com/ChainSafe/sprinter-ts/issues/3)) ([25a91f7](https://github.com/ChainSafe/sprinter-ts/commit/25a91f7660a38e7f849f1903416005324a829605)) ### Bug Fixes -* process approvals from quote ([#26](https://github.com/ChainSafe/sprinter-ts/issues/26)) ([95d9ebf](https://github.com/ChainSafe/sprinter-ts/commit/95d9ebf631a933035a01d7593e735d26a7c2cf08)) +- process approvals from quote ([#26](https://github.com/ChainSafe/sprinter-ts/issues/26)) ([95d9ebf](https://github.com/ChainSafe/sprinter-ts/commit/95d9ebf631a933035a01d7593e735d26a7c2cf08)) diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 6a66fad..ca51a31 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -34,10 +34,10 @@ Once installed, you can initialize and use the SDK to interact with blockchain d The `Sprinter` class provides an interface to interact with balances and chains. ```typescript -import { Sprinter } from '@chainsafe/sprinter-sdk'; +import { Sprinter } from "@chainsafe/sprinter-sdk"; const sprinter = new Sprinter({ - baseUrl: 'https://api.sprinter.buildwithsygma.com', + baseUrl: "https://api.sprinter.buildwithsygma.com", }); const ownerAddress = "0xYourAddressHere"; @@ -47,7 +47,7 @@ sprinter.getUserBalances(ownerAddress).then(console.log); ### Example: Fetch Available Tokens ```typescript -sprinter.getAvailableTokens().then(tokens => { +sprinter.getAvailableTokens().then((tokens) => { console.log(tokens); }); ``` @@ -55,7 +55,7 @@ sprinter.getAvailableTokens().then(tokens => { ### Example: Fetch Supported Chains ```typescript -sprinter.getAvailableChains().then(chains => { +sprinter.getAvailableChains().then((chains) => { console.log(chains); }); ``` @@ -65,12 +65,13 @@ sprinter.getAvailableChains().then(chains => { You can configure the SDK using environment variables to set the base URL for API requests: ```typescript -import { setBaseUrl } from '@chainsafe/sprinter-sdk'; +import { setBaseUrl } from "@chainsafe/sprinter-sdk"; setBaseUrl("https://api.sprinter.buildwithsygma.com"); ``` ## Documentation + For more detailed docs you can check out [SDK docs page](https://docs.sprinter.tech/docs/sdk/). ## API Documentation diff --git a/packages/sdk/tsconfig.json b/packages/sdk/tsconfig.json index b27439e..c5ccaa7 100644 --- a/packages/sdk/tsconfig.json +++ b/packages/sdk/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -25,9 +25,9 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "ESNext", /* Specify what module code is generated. */ - "rootDir": "./src", /* Specify the root folder within your source files. */ - "moduleResolution": "Bundler", /* Specify how TypeScript looks up a file from a given module specifier. */ + "module": "ESNext" /* Specify what module code is generated. */, + "rootDir": "./src" /* Specify the root folder within your source files. */, + "moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */, // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ @@ -44,12 +44,12 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, // "declarationMap": true, /* Create sourcemaps for d.ts files. */ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./dist", /* Specify an output folder for all emitted files. */ + "outDir": "./dist" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -71,14 +71,14 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */, // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ @@ -98,6 +98,6 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ } } diff --git a/release-please-config.json b/release-please-config.json index 3422cc5..8a281b3 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,32 +1,32 @@ { - "plugins": [], - "packages": { - "docs": { - "releaseType": "node", - "draft": false, - "prerelease": false, - "bumpMinorPreMajor": false, - "bumpPatchForMinorPreMajor": false, - "changelogPath": "CHANGELOG.md", - "versioning": "default" - }, - "packages/sdk": { - "releaseType": "node", - "draft": false, - "prerelease": false, - "bumpMinorPreMajor": false, - "bumpPatchForMinorPreMajor": false, - "changelogPath": "CHANGELOG.md", - "versioning": "default" - }, - "packages/react": { - "releaseType": "node", - "draft": false, - "prerelease": false, - "bumpMinorPreMajor": false, - "bumpPatchForMinorPreMajor": false, - "changelogPath": "CHANGELOG.md", - "versioning": "default" - } + "plugins": [], + "packages": { + "docs": { + "releaseType": "node", + "draft": false, + "prerelease": false, + "bumpMinorPreMajor": false, + "bumpPatchForMinorPreMajor": false, + "changelogPath": "CHANGELOG.md", + "versioning": "default" + }, + "packages/sdk": { + "releaseType": "node", + "draft": false, + "prerelease": false, + "bumpMinorPreMajor": false, + "bumpPatchForMinorPreMajor": false, + "changelogPath": "CHANGELOG.md", + "versioning": "default" + }, + "packages/react": { + "releaseType": "node", + "draft": false, + "prerelease": false, + "bumpMinorPreMajor": false, + "bumpPatchForMinorPreMajor": false, + "changelogPath": "CHANGELOG.md", + "versioning": "default" } - } \ No newline at end of file + } +}