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

Introduces SuiNS SDK #99

Merged
merged 8 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions scripts/.eslintrc.cjs → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ module.exports = {
'external-crates',
'storybook-static',
'.next',
'documentation',
'packages',
],
rules: {
'no-case-declarations': 'off',
Expand Down
86 changes: 43 additions & 43 deletions .github/workflows/move_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,58 @@ name: Move Test CI

on:
pull_request:
paths:
- '.github/workflows/**'
- 'packages/**'
paths:
- '.github/workflows/move_test.yml'
- 'packages/**'
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH

- name: Install Sui using Homebrew
run: brew install sui

- name: Run move tests in all package subdirectories, with exclusions
run: |
exclude_dirs=(governance) # Add excluded directories to this array
for dir in packages/*; do
dir_name=$(basename "$dir")
if [[ ! " ${exclude_dirs[@]} " =~ " ${dir_name} " ]] && [ -d "$dir" ]; then
echo "Running sui move test in $dir"
(cd "$dir" && sui move test)
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH

- name: Install Sui using Homebrew
run: brew install sui

- name: Run move tests in all package subdirectories, with exclusions
run: |
exclude_dirs=(governance) # Add excluded directories to this array
for dir in packages/*; do
dir_name=$(basename "$dir")
if [[ ! " ${exclude_dirs[@]} " =~ " ${dir_name} " ]] && [ -d "$dir" ]; then
echo "Running sui move test in $dir"
(cd "$dir" && sui move test)
fi
done

- name: Run documentation script
run: |
bash ./scripts/docgen.sh
shell: bash

- name: Check for changes in move-docs directories
run: |
output=$(git status --porcelain | grep ' packages/.*/move-docs/' || true)
echo "Filtered git status output: $output"
if [[ -n "$output" ]]; then
echo "Changes in move-docs directories are not committed. Please commit these changes by running scripts/docgen.sh before merging."
exit 1 # Fail the job to indicate that documentation is not up-to-date
else
echo "No changes in move-docs directories. Documentation is up-to-date."
fi
done

- name: Run documentation script
run: |
bash ./scripts/docgen.sh
shell: bash

- name: Check for changes in move-docs directories
run: |
output=$(git status --porcelain | grep ' packages/.*/move-docs/' || true)
echo "Filtered git status output: $output"
if [[ -n "$output" ]]; then
echo "Changes in move-docs directories are not committed. Please commit these changes by running scripts/docgen.sh before merging."
exit 1 # Fail the job to indicate that documentation is not up-to-date
else
echo "No changes in move-docs directories. Documentation is up-to-date."
fi
shell: bash
shell: bash
32 changes: 28 additions & 4 deletions .github/workflows/sdk_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: SDK Tests CI
on:
pull_request:
paths:
- '.github/workflows/**'
- '.github/workflows/sdk_test.yml'
- 'sdk/**'
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
sdk_test:
Expand All @@ -23,3 +23,27 @@ jobs:
with:
fetch-depth: 1

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Do a global PNPM install
run: |
npm install -g pnpm

- name: Install Dependencies
run: |
pnpm install

- name: Download & Extract latest SUI binary
run: |
url=$(curl -s https://api.github.com/repos/mystenlabs/sui/releases/latest | jq -r '.assets[] | select(.name | contains("ubuntu")) | .browser_download_url')
filename="sui-x86-64.tgz"
wget $url -O $filename
tar -xzf $filename
ls
./sui -V

- name: Prepare local network & run SDK tests
run: |
./sui-test-validator --epoch-duration-ms 300000 > /dev/null 2>&1 & cd sdk && VITE_SUI_BIN="../sui" pnpm test:e2e
8 changes: 4 additions & 4 deletions .github/workflows/suins-build-tx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:

- name: Set up working directory
run: |
cd scripts && pnpm install
pnpm install

- name: Main Package Upgrade
if: ${{ inputs.transaction_type == 'Main package upgrade' }}
Expand All @@ -93,7 +93,7 @@ jobs:
NETWORK: mainnet
ORIGIN: gh_action
run: |
cd scripts && pnpm transactions::main_package::upgrade
cd scripts && pnpm transactions::main_package::upgrade

- name: Transfer Reserved Names
if: ${{ inputs.transaction_type == 'Transfer Reserved Names' }}
Expand All @@ -104,7 +104,7 @@ jobs:
ORIGIN: gh_action
run: |
cd scripts && pnpm transfer::names

- name: Profits to Treasury
if: ${{ inputs.transaction_type == 'Profits to Treasury' }}
env:
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
ORIGIN: gh_action
run: |
cd scripts && pnpm disable-free-claims

- name: Disable Discounts
if: ${{ inputs.transaction_type == 'Disable Discounts' }}
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ tx-data.txt*
.DS_STORE*
published.json
constants.sdk.json
dist
4 changes: 1 addition & 3 deletions scripts/.prettierignore → .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ build/
coverage/
dist/
out/
playwright-report/
storybook-static/
CHANGELOG.md

documentation/
6 changes: 0 additions & 6 deletions documentation/pages/subnames.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,3 @@ The following table provides more details on the differences between the two typ

Similar to regular names, you can look up subnames through JSON-RPC and GraphQL. You can also look up subnames on chain, as described in [Integrations](./integration.mdx).


{/* ## Creating subnames

TODO: Show how someone could create subnames through the SDK (being the parent).

TODO: Show how someone can integrate with the subdomains package to create subnames. */}
36 changes: 36 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "suins-monorepo",
"version": "1.0.0",
"description": "This repository holds the SuiNS contracts (both the core and all system packages).",
"main": "index.js",
"devDependencies": {
"typescript": "^5.4.5",
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-require-extensions": "^0.1.3",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-unused-imports": "^3.1.0",
"prettier": "^3.2.5",
"ts-node": "^10.9.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prettier:check": "prettier -c --ignore-unknown .",
"prettier:fix": "prettier -w --ignore-unknown .",
"prettier:fix:watch": "onchange '**' -i -f add -f change -j 5 -- prettier -w --ignore-unknown {{file}}",
"eslint:check": "eslint --max-warnings=0 .",
"eslint:fix": "pnpm run eslint:check --fix",
"lint": "pnpm run eslint:check && pnpm run prettier:check",
"lint:fix": "pnpm run eslint:fix && pnpm run prettier:fix"
},
"author": "",
"license": "Apache-2.0"
}
Loading
Loading