Skip to content

Commit

Permalink
feat: token-group interface js library (#6014)
Browse files Browse the repository at this point in the history
* feat: token-group interface js library

* remove Podu32 and use number

* tests: remove hard code bytes

* use getU32Codec

* remove unused deps

* remove unused import

* fix: update lock file
  • Loading branch information
qiweiii authored Jan 5, 2024
1 parent ddbb3d8 commit 480c6d9
Show file tree
Hide file tree
Showing 31 changed files with 1,086 additions and 13 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/pull-request-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'single-pool/js/**'
- 'stake-pool/js/**'
- 'token/js/**'
- 'token-group/js/**'
- 'token-lending/js/**'
- 'token-metadata/js/**'
- 'token-swap/js/**'
Expand All @@ -24,6 +25,7 @@ on:
- 'single-pool/js/**'
- 'stake-pool/js/**'
- 'token/js/**'
- 'token-group/js/**'
- 'token-lending/js/**'
- 'token-metadata/js/**'
- 'token-swap/js/**'
Expand All @@ -34,7 +36,20 @@ jobs:
js-test:
strategy:
matrix:
package: [account-compression, libraries, memo, name-service, single-pool, stake-pool, token, token-lending, token-metadata, token-swap]
package:
[
account-compression,
libraries,
memo,
name-service,
single-pool,
stake-pool,
token,
token-group,
token-lending,
token-metadata,
token-swap,
]
runs-on: ubuntu-latest
env:
NODE_VERSION: 20.5
Expand Down
39 changes: 31 additions & 8 deletions .github/workflows/pull-request-token-group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ name: Token-Group Pull Request
on:
pull_request:
paths:
- 'token-group/**'
- 'token/program-2022/**'
- 'ci/*-version.sh'
- '.github/workflows/pull-request-token-group.yml'
- 'token-group/**'
- 'token/program-2022/**'
- 'ci/*-version.sh'
- '.github/workflows/pull-request-token-group.yml'
- '!token-group/js/**'
push:
branches: [master]
paths:
- 'token-group/**'
- 'token/program-2022/**'
- 'ci/*-version.sh'
- '.github/workflows/pull-request-token-group.yml'
- 'token-group/**'
- 'token/program-2022/**'
- 'ci/*-version.sh'
- '.github/workflows/pull-request-token-group.yml'
- '!token-group/js/**'

jobs:
cargo-test-sbf:
Expand Down Expand Up @@ -64,3 +66,24 @@ jobs:
- name: Build and test example
run: ./ci/cargo-test-sbf.sh token-group/example

js-test:
runs-on: ubuntu-latest
env:
NODE_VERSION: 16.x
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/cache@v3
with:
path: ~/.npm
key: node-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
node-
- run: ./ci/js-test-token-group.sh
12 changes: 12 additions & 0 deletions ci/js-test-token-group.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e
cd "$(dirname "$0")/.."

set -x
pnpm install
pnpm build

cd token-group/js
pnpm lint
pnpm test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"single-pool/js",
"stake-pool/js",
"token/js",
"token-group/js",
"token-lending/js",
"token-metadata/js",
"token-swap/js"
Expand Down
133 changes: 129 additions & 4 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ packages:
- "single-pool/js/packages/*"
- "stake-pool/js"
- "token/js"
- "token-group/js"
- "token-lending/js"
- "token-metadata/js"
- "token-swap/js"
5 changes: 5 additions & 0 deletions token-group/js/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docs
lib
test-ledger

package-lock.json
34 changes: 34 additions & 0 deletions token-group/js/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:require-extensions/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier",
"require-extensions"
],
"rules": {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/consistent-type-imports": "error"
},
"overrides": [
{
"files": [
"examples/**/*",
"test/**/*"
],
"rules": {
"require-extensions/require-extensions": "off",
"require-extensions/require-index": "off"
}
}
]
}
13 changes: 13 additions & 0 deletions token-group/js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.idea
.vscode
.DS_Store

node_modules

pnpm-lock.yaml
yarn.lock

docs
lib
test-ledger
*.tsbuildinfo
5 changes: 5 additions & 0 deletions token-group/js/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extension": ["ts"],
"node-option": ["experimental-specifier-resolution=node", "loader=ts-node/esm"],
"timeout": 5000
}
Empty file added token-group/js/.nojekyll
Empty file.
5 changes: 5 additions & 0 deletions token-group/js/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docs
lib
test-ledger

package-lock.json
7 changes: 7 additions & 0 deletions token-group/js/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 120,
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true
}
Loading

0 comments on commit 480c6d9

Please sign in to comment.