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

Release 2025-02-25 12:19:30 +0900 #65

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e690f0a
Supported 'Shiden' network
SeiyaKobayashi Nov 20, 2024
9720d78
Updated package versions for 'core' package
SeiyaKobayashi Nov 20, 2024
2ce791e
Regenerated docs for 'core' package
SeiyaKobayashi Nov 20, 2024
50073eb
Merge pull request #64 from jcam1/feature/add-shiden-chain
SeiyaKobayashi Nov 20, 2024
7f02791
Bump cross-spawn from 7.0.3 to 7.0.6
dependabot[bot] Nov 21, 2024
57d6653
Bump micromatch from 4.0.7 to 4.0.8
dependabot[bot] Nov 21, 2024
47f1a46
Merge pull request #66 from jcam1/dependabot/npm_and_yarn/cross-spawn…
SeiyaKobayashi Nov 21, 2024
391b53a
Merge pull request #67 from jcam1/dependabot/npm_and_yarn/micromatch-…
SeiyaKobayashi Nov 21, 2024
b7d5263
fix: Update viem version to 2.21.48 in v1 package
Dec 3, 2024
ec6a462
Merge pull request #72 from jcam1/71-fix-version-mismatch-of-viem-pac…
Mameta29 Dec 3, 2024
6ed37d9
Merge 'v1' package into 'core' package
SeiyaKobayashi Dec 3, 2024
0bb8467
Fix workflows
SeiyaKobayashi Dec 3, 2024
d366b18
Regenerate docs
SeiyaKobayashi Dec 3, 2024
b097d45
Merge branch 'develop' into feature/merge-v1-into-core
SeiyaKobayashi Dec 3, 2024
f106b2d
Resolve conflicts in 'yarn.lock'
SeiyaKobayashi Dec 3, 2024
ffd86f6
Fix workflow to detect changes in root's 'package.json' & 'yarn.lock'
SeiyaKobayashi Dec 3, 2024
2482678
Add a missing json file
SeiyaKobayashi Dec 3, 2024
f525302
Add missing dev dependencies
SeiyaKobayashi Dec 3, 2024
dbc3a15
Merge pull request #73 from jcam1/feature/merge-v1-into-core
SeiyaKobayashi Dec 3, 2024
399ab83
Create deploy-docs.yml
Mameta29 Dec 4, 2024
ffbafb2
add error display in documentation generation workflow (#75)
Mameta29 Dec 4, 2024
a5cbe25
Update deploy-docs.yml (#76)
Mameta29 Dec 4, 2024
82ae207
Update deploy-docs.yml (#77)
Mameta29 Dec 4, 2024
1659b7e
Create index.html (#78)
Mameta29 Dec 4, 2024
74dff5e
two ways to make docs html and markdown (#81)
Mameta29 Dec 4, 2024
f5f85ed
Revert "two ways to make docs html and markdown (#81)"
SeiyaKobayashi Dec 5, 2024
416f74c
Revert "Create index.html (#78)"
SeiyaKobayashi Dec 5, 2024
50e101e
Revert "Update deploy-docs.yml (#77)"
SeiyaKobayashi Dec 5, 2024
f3215d4
Revert "Update deploy-docs.yml (#76)"
SeiyaKobayashi Dec 5, 2024
677e67c
Revert "add error display in documentation generation workflow (#75)"
SeiyaKobayashi Dec 5, 2024
85f958c
Revert "Create deploy-docs.yml"
SeiyaKobayashi Dec 5, 2024
4631d65
Merge pull request #85 from jcam1/fix/revert-unnecessary-commits
SeiyaKobayashi Dec 5, 2024
609dd89
auto generate docs and deploy to github pages
Dec 5, 2024
0d4ffe1
modify docs output directory
Dec 6, 2024
288e0c3
modify trigger and using composit action
Dec 6, 2024
5399afc
modify to separate format job from build job
Dec 6, 2024
69bc6aa
modify to generate docs for parallel
Dec 6, 2024
97d8a4b
modify node version
Dec 6, 2024
8f5b89c
modify trigger
Dec 6, 2024
4d07caf
modify removing process of generating docs
Dec 9, 2024
8a4eb26
Merge pull request #86 from jcam1/feature/auto-generate-docs
Mameta29 Dec 10, 2024
f6d95ef
fix(chains): replace baseSepolia with sepolia for Ethereum testnet
Feb 23, 2025
db771cf
Merge pull request #92 from jcam1/91-fix-incorrect-chain-configuratio…
Mameta29 Feb 25, 2025
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
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 20.12.0
registry-url: 'https://registry.npmjs.org'
scope: '@jpyc'
- name: Install dependencies
Expand Down
23 changes: 2 additions & 21 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
outputs:
root: ${{ steps.filter.outputs.root }}
core: ${{ steps.filter.outputs.core }}
v1: ${{ steps.filter.outputs.v1 }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
Expand All @@ -27,10 +26,10 @@ jobs:
- '.github/**'
- 'docs/**'
- 'README.md'
- 'package.json'
- 'yarn.lock'
core:
- 'packages/core/**'
v1:
- 'packages/v1/**'

check-root:
needs: detect-changes
Expand Down Expand Up @@ -65,21 +64,3 @@ jobs:
run: yarn run format:dry-run
- name: Run tests
run: yarn run test

check-v1:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.v1 == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/v1
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-dependencies
- name: Compile
run: yarn run compile
- name: Lint
run: yarn run lint:dry-run
- name: Format
run: yarn run format:dry-run
61 changes: 61 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: deploy documentation

on:
push:
branches:
- 'main'
paths:
- 'docs/**'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
cancel-in-progress: false

jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'

- uses: ./.github/actions/install-dependencies

- name: Check format
run: |
yarn run format:dry-run docs

build:
needs: format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs/core/html'

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
22 changes: 0 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
types: [closed]
paths:
- 'packages/core/**'
- 'packages/v1/**'

jobs:
detect-changes:
Expand All @@ -17,7 +16,6 @@ jobs:
pull-requests: read
outputs:
core: ${{ steps.filter.outputs.core }}
v1: ${{ steps.filter.outputs.v1 }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
Expand All @@ -26,8 +24,6 @@ jobs:
filters: |
core:
- 'packages/core/**'
v1:
- 'packages/v1/**'

push-git-tag:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -88,21 +84,3 @@ jobs:
with:
working-directory: ./packages/core
node-auth-token: ${{ secrets.NPM_TOKEN }}

publish-v1:
needs: [detect-changes, publish-release-note]
if: ${{ needs.detect-changes.outputs.v1 == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/v1
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-dependencies
- name: Build package
run: yarn run compile
- uses: ./.github/actions/publish-package
with:
working-directory: ./packages/v1
node-auth-token: ${{ secrets.NPM_TOKEN }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ dist
# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
# VS Code
.vscode
.vscode-test
cspell.json

# yarn v2
.yarn/cache
Expand All @@ -131,4 +133,3 @@ dist

# Misc
.DS_Store
.vscode
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# JPYC Node SDKs
# JPYC SDKs

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/jcam1/sdks/issues/new/choose)

Monorepo for JPYC Node SDKs.
Monorepo for JPYC SDKs.

## 🌈 Available SDKs

Expand All @@ -12,7 +12,6 @@ Please refer to `README`s of each SDK for the version specific details.
| SDK | `README` |
| -----: | :----------------------------------------- |
| `core` | [packages/core](./packages/core/README.md) |
| `v1` | [packages/v1](./packages/v1/README.md) |

## 🔨 Development

Expand Down Expand Up @@ -52,17 +51,20 @@ $ yarn workspace ${workspace_name} run ${command_name}

### Dependencies

To add dependencies, run one of the following. To prevent unexpected behaviors, always pin the exact versions of the dependencies to be installed.
To add dependencies, run one of the following.

```sh
# Add dependencies to the specified workspace
$ yarn workspace ${workspace_name} add -E ${dependencies}
$ yarn workspace ${workspace_name} add ${dependencies}

# Add dev dependencies to the specified workspace
$ yarn workspace ${workspace_name} add -E -D ${dependencies}
$ yarn workspace ${workspace_name} add -D ${dependencies}

# Add dependencies to the workspaces root
$ yarn add -W ${dependencies}

# Add dev dependencies to the workspaces root
$ yarn add -E -D -W ${dependencies}
$ yarn add -W -D ${dependencies}
```

To remove dependencies, run one of the following.
Expand Down Expand Up @@ -113,4 +115,4 @@ Now, write code to implement the proposed features and/or to fix bugs.

### 5. Open a Pull Request

Finally, open a new PR from your branch to `develop` branch to describe what you'll have done.
Finally, open a new PR from your branch to `develop` branch, and describe what you'll have done.
94 changes: 88 additions & 6 deletions docs/core/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,109 @@
**@jpyc/sdk-core** • [**Docs**](globals.md)
**@jpyc/sdk-core**

---

# JPYC Core SDK

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
![build](https://github.com/jcam1/sdks/actions/workflows/check.yml/badge.svg)
[![Node version](https://img.shields.io/node/v/@jpyc/sdk-core.svg?style=flat)](https://nodejs.org/download/)
[![npm version](https://badge.fury.io/js/@jpyc%2Fsdk-core.svg)](https://badge.fury.io/js/@jpyc%2Fsdk-core)

JPYC core SDK implements a set of constants, types and functions, commonly used across different SDK versions.
JPYC core SDK implements interfaces to interact with [JPYCv2 contracts](https://github.com/jcam1/JPYCv2) on different chains. Supported chains are Ethereum, Polygon, Gnosis, Avalanche, Astar and Shiden.

## 💡 How to Use

Please follow the following steps to configure the SDK.

#### 1. Install Packages

Install packages.

```sh
# yarn
$ yarn add @jpyc/sdk-core

# npm
$ npm i @jpyc/sdk-core
```

#### 2. Set Environment Variables

Some data, such as configuration variables (e.g., chain name) or sensitive data (e.g., private key), are embedded as environment variables. You need to set the following environment variables.

| Variable | Description & Instructions |
| --------------------: | :-------------------------------------------------------------------------------------------------------------------------------- |
| `SDK_ENV` | SDK environment. Set to `local` for local environment or any other sensible string for production environment. |
| `CHAIN_NAME` | Chain name. Set to one of the following\: `local`, `ethereum`, `polygon`, `gnosis`, `avalanche`, `astar` or `shiden`. |
| `NETWORK_NAME` | Network name within the specified chain. Set to one of the following\: `mainnet`, `goerli`, `sepolia`, `amoy`, `chiado` or `fuji` |
| `RPC_ENDPOINT` | RPC endpoint to send transactions. |
| `PRIVATE_KEY` | Private key of an account. |
| `LOCAL_PROXY_ADDRESS` | Proxy contract address in local environment. |

#### 3. Instantiate SDK

Initialize an SDK instance that implements abstracted interfaces to the JPYCv2 contracts.

```ts
import {
ChainName,
Endpoint,
IJPYC,
ISdkClient,
JPYC,
NetworkName,
SdkClient,
} from '@jpyc/sdk-core';

// 1. Initialize an SdkClient instance
const sdkClient: ISdkClient = new SdkClient({
chainName: process.env.CHAIN_NAME as ChainName,
networkName: process.env.NETWORK_NAME as NetworkName,
rpcEndpoint: process.env.RPC_ENDPOINT as Endpoint,
});

// 2. Generate an account from a private key
export const account = sdkClient.createPrivateKeyAccount({});

// 3. Generate a client with the account
export const client = sdkClient.createLocalClient({
account: account,
});

// 4. Initialize an SDK instance
export const jpyc: IJPYC = new JPYC({
client: client,
});
```

#### 4. Use SDK

Use the initialized SDK wherever you would like.

```ts
import { jpyc } from './YOUR/PATH/TO/INITIALIZATION/FILE';

// Fetch `totalSupply` from `JPYCv2` contract
const totalSupply = await jpyc.totalSupply();
console.log(`totalSupply: ${totalSupply.toString()}`);
```

## ✨ Code Examples

For your reference, we provide code examples in the separate [`sdk-examples` repository](https://github.com/jcam1/sdk-examples). Please follow the instructions specified in `README` files.

## 🤖 Available Commands

The following commands are available as yarn scripts for local development & testing.

| Command | Description |
| ---------------: | :---------------------------------------------------- |
| `docs` | Generate Markdown documents from TSDoc-style comments |
| `compile` | Compile (transpile) TypeScript files |
| `compile` | Compile (transpile) SDK |
| `test` | Run unit tests (using jest) |
| `lint` | Run Eslint |
| `lint:dry-run` | Run Eslint without fixing |
| `format` | Run Prettier |
| `format:dry-run` | Run Prettier without fixing |
| `test` | Run unit tests (via jest) |
| `docs` | Generate Markdown documents from TSDoc-style comments |

## 📚 Documentation

Expand Down
17 changes: 16 additions & 1 deletion docs/core/_media/globals.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
[**@jpyc/sdk-core**](README.md) • **Docs**
[**@jpyc/sdk-core**](README.md)

---

# @jpyc/sdk-core

## Classes

- [InvalidAddressError](classes/InvalidAddressError.md)
- [InvalidChainNameError](classes/InvalidChainNameError.md)
- [InvalidNetworkNameError](classes/InvalidNetworkNameError.md)
- [InvalidTransactionError](classes/InvalidTransactionError.md)
- [JPYC](classes/JPYC.md)
- [SdkClient](classes/SdkClient.md)

## Interfaces

- [IJPYC](interfaces/IJPYC.md)
- [ISdkClient](interfaces/ISdkClient.md)

## Type Aliases

- [Address](type-aliases/Address.md)
Expand All @@ -14,6 +28,7 @@

## Variables

- [JPYC_V2_ABI](variables/JPYC_V2_ABI.md)
- [LOCAL_PROXY_ADDRESS](variables/LOCAL_PROXY_ADDRESS.md)
- [SUPPORTED_CHAINS](variables/SUPPORTED_CHAINS.md)
- [V2_PROXY_ADDRESS](variables/V2_PROXY_ADDRESS.md)
Expand Down
Loading