diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 463aff6..5595cd9 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -1,10 +1,11 @@
-name: Build and Test
+# This name appears on the "build" badge on README.
+name: build
on:
pull_request:
jobs:
- build-and-test:
+ build:
runs-on: ubuntu-latest
steps:
diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml
new file mode 100644
index 0000000..08edf86
--- /dev/null
+++ b/.github/workflows/deploy-docs.yml
@@ -0,0 +1,55 @@
+name: deploy-docs
+
+on:
+ release:
+ types: [published]
+ workflow_dispatch:
+
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+# Allow one concurrent deployment
+concurrency:
+ group: 'pages'
+ cancel-in-progress: true
+
+jobs:
+ deploy-docs:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20.x
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v3
+ with:
+ version: latest
+ run_install: true
+
+ - name: Build docs
+ run: pnpm docs:build
+
+ - name: Setup Pages
+ uses: actions/configure-pages@v5
+
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: docs/build
+
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 5a531e0..c0f62cb 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,4 +1,4 @@
-name: Publish Package
+name: publish-package
on:
workflow_dispatch:
@@ -16,7 +16,7 @@ on:
- prepatch
jobs:
- build:
+ publish-package:
runs-on: ubuntu-latest
permissions:
@@ -30,7 +30,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- registry-url: 'https://npm.pkg.github.com'
+ registry-url: 'https://registry.npmjs.org'
# Defaults to the user or organization that owns the workflow file
# scope: '@pufferfinance'
@@ -42,14 +42,18 @@ jobs:
- name: Setup git
run: |
- git config --global user.name "github-actions[bot]"
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
+ git config user.name "${GITHUB_ACTOR}"
+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- - name: Build
+ - name: Build package
run: pnpm build
+ # This makes the API reference docs part of the release commit.
+ - name: Build docs
+ run: pnpm docs:build
+
- name: Publish package
run: pnpm release --increment ${{ inputs.increment }}
env:
- NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.release-it.json b/.release-it.json
index dee20f0..3f7835c 100644
--- a/.release-it.json
+++ b/.release-it.json
@@ -1,6 +1,7 @@
{
"git": {
- "commitMessage": "[Github Actions] Release v${version}"
+ "commitMessage": "[Github Actions] Release v${version}",
+ "requireCleanWorkingDir": false
},
"github": {
"release": true,
@@ -8,6 +9,6 @@
"releaseName": "v${version}"
},
"hooks": {
- "after:git:bump": "git add dist -f"
+ "after:npm:bump": "git add -A"
}
}
diff --git a/README.md b/README.md
index 472521e..b17d823 100644
--- a/README.md
+++ b/README.md
@@ -1,63 +1,81 @@
-
Puffer SDK
-
-SDK for interacting with the puffer smart contracts
+
+
Puffer SDK
+
+

+

+

+

+
+
+
SDK to seamlessly interact with puffer smart contracts
+
## Usage
-There are multiple ways to use the package.
+Install the package.
-- [GitHub (Recommended)](#github-recommended)
-- [GitHub Packages](#github-packages)
-- [Local](#local)
+```sh
+npm install @pufferfinance/puffer-sdk
+```
-### GitHub (Recommended)
+Example code to check pufETH balance.
-> Note: You must have access to the [PufferFinance](https://github.com/PufferFinance) GitHub organization and [SSH setup for GitHub](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) for this to work.
+```ts
+import {
+ PufferClientHelpers,
+ PufferClient,
+ Chain,
+} from '@pufferfinance/puffer-sdk';
-Install the dependency through GitHub URL.
+const walletClient = PufferClientHelpers.createWalletClient({
+ chain: Chain.Holesky,
+ provider: window.ethereum,
+});
+const pufferClient = new PufferClient(Chain.Holesky, walletClient);
+const [walletAddress] = await pufferClient.requestAddresses();
-```sh
-npm install github:pufferfinance/puffer-sdk
-pnpm install github:pufferfinance/puffer-sdk
-yarn add github:pufferfinance/puffer-sdk
+const balance = await pufferClient.vault.balanceOf(walletAddress);
```
-Add `#` (for example, `github:pufferfinance/puffer-sdk#1.0.0`) at the end to use a different published tag from GitHub ().
+## Features
-### GitHub Packages
+- Interact with puffer smart contracts.
+- Deposit ETH to mint pufETH.
+- Deposit stETH to mint pufETH.
+- Check pufETH balance.
+- Get latest rate of pufETH compared to ETH.
+- and much more.
-The package is published privately to GitHub Packages. It can be installed by authenticating to GitHub Packages. Please check [GitHub guide for installing a private package](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#installing-a-package).
+## Documentation
-Use `@pufferfinance` as the organization name and `@pufferfinance/puffer-sdk` as the complete dependency name.
+Check the [documentation website](https://pufferfinance.github.io/puffer-sdk/) for detailed documentation and guides.
-### Local
+## Development
-Clone this repository and locally link this package so it can used by other projects.
+Install dependencies.
```sh
-pnpm link --global
+pnpm install
```
-In the project where you want to use this package as a dependency, run the following command.
+Start the package in watch mode.
```sh
-pnpm link --global @pufferfinance/puffer-sdk
+pnpm dev
```
-## Setup
-
-Install dependencies.
+Setup linking so the package can be linked to other projects locally.
```sh
-pnpm install
+pnpm link --global
```
-Start the package in watch mode.
+To link the package to a local project, run the following command.
```sh
-pnpm dev
+pnpm link --global @pufferfinance/puffer-sdk
```
## Release
-The release is automated using [release-it](https://github.com/release-it/release-it) and the [`publish.yml`](./.github/workflows/publish.yml) GitHub action. The action can be [dispatched manually](https://github.com/PufferFinance/puffer-sdk/actions/workflows/publish.yml) to make the release.
+The release is automated using [release-it](https://github.com/release-it/release-it) and the [publish.yml](./.github/workflows/publish.yml) GitHub action. The action can be [dispatched manually](https://github.com/PufferFinance/puffer-sdk/actions/workflows/publish.yml) to make the release.
diff --git a/dist/main.cjs b/dist/main.cjs
deleted file mode 100644
index 771f044..0000000
--- a/dist/main.cjs
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=(e,t)=>e+t;exports.add=d;
diff --git a/dist/main.d.ts b/dist/main.d.ts
deleted file mode 100644
index 6285581..0000000
--- a/dist/main.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export declare const add: (a: number, b: number) => number;
diff --git a/dist/main.js b/dist/main.js
deleted file mode 100644
index f49fa11..0000000
--- a/dist/main.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const t = (d, o) => d + o;
-export {
- t as add
-};
diff --git a/docs/README.md b/docs/README.md
index 1db4759..0456422 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -30,16 +30,4 @@ This command generates static content into the `build` directory and can be serv
### Deployment
-Using SSH:
-
-```sh
-USE_SSH=true pnpm docs:deploy
-```
-
-Not using SSH:
-
-```sh
-GIT_USER= pnpm docs:deploy
-```
-
-If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
+The deployment of the docs is automated with each release. See the [deploy-docs.yml](../.github/workflows/deploy-docs.yml) GitHub action.
diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts
index ce21012..04b2d38 100644
--- a/docs/docusaurus.config.ts
+++ b/docs/docusaurus.config.ts
@@ -8,10 +8,10 @@ const config: Config = {
favicon: 'img/favicon.ico',
// Set the production url of your site here
- url: 'https://your-docusaurus-site.example.com',
+ url: 'https://pufferfinance.github.io',
// Set the // pathname under which your site is served
// For GitHub pages deployment, it is often '//'
- baseUrl: '/',
+ baseUrl: '/puffer-sdk/',
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
@@ -137,14 +137,21 @@ const config: Config = {
},
} satisfies Preset.ThemeConfig,
plugins: [
- '@easyops-cn/docusaurus-search-local',
+ [
+ '@easyops-cn/docusaurus-search-local',
+ {
+ // For docs-only mode.
+ docsRouteBasePath: '/',
+ },
+ ],
// Plugin for generating API docs.
[
'docusaurus-plugin-typedoc',
// https://typedoc-plugin-markdown.org/plugins/docusaurus/options
// https://typedoc-plugin-markdown.org/docs/options
{
- entryPoints: '../lib/api',
+ // Consider all files in subdirectories of the `lib` directory.
+ entryPoints: '../lib/*/**',
exclude: '**/*+(test|spec|index).ts',
entryPointStrategy: 'expand',
tsconfig: '../tsconfig.json',
diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css
index 2bc6a4c..2ab1adf 100644
--- a/docs/src/css/custom.css
+++ b/docs/src/css/custom.css
@@ -6,25 +6,25 @@
/* You can override the default Infima variables here. */
:root {
- --ifm-color-primary: #2e8555;
- --ifm-color-primary-dark: #29784c;
- --ifm-color-primary-darker: #277148;
- --ifm-color-primary-darkest: #205d3b;
- --ifm-color-primary-light: #33925d;
- --ifm-color-primary-lighter: #359962;
- --ifm-color-primary-lightest: #3cad6e;
+ --ifm-color-primary: #874fff;
+ --ifm-color-primary-dark: #7141d8;
+ --ifm-color-primary-darker: #5d36b3;
+ --ifm-color-primary-darkest: #492a8d;
+ --ifm-color-primary-light: #8f5ef8;
+ --ifm-color-primary-lighter: #a07af1;
+ --ifm-color-primary-lightest: #ac8dee;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}
/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
- --ifm-color-primary: #25c2a0;
- --ifm-color-primary-dark: #21af90;
- --ifm-color-primary-darker: #1fa588;
- --ifm-color-primary-darkest: #1a8870;
- --ifm-color-primary-light: #29d5b0;
- --ifm-color-primary-lighter: #32d8b4;
- --ifm-color-primary-lightest: #4fddbf;
+ --ifm-color-primary: #41ff54;
+ --ifm-color-primary-dark: #3be74c;
+ --ifm-color-primary-darker: #31d141;
+ --ifm-color-primary-darkest: #28b136;
+ --ifm-color-primary-light: #66e973;
+ --ifm-color-primary-lighter: #78f084;
+ --ifm-color-primary-lightest: #88e692;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
diff --git a/package.json b/package.json
index 2511b1a..796beab 100644
--- a/package.json
+++ b/package.json
@@ -21,8 +21,7 @@
"dist"
],
"publishConfig": {
- "access": "restricted",
- "registry": "https://npm.pkg.github.com"
+ "access": "public"
},
"scripts": {
"build": "vite build",