Skip to content

Commit 8d9cd07

Browse files
committed
♻️ Code Refactor
1 parent 0433cd1 commit 8d9cd07

File tree

6 files changed

+2364
-2420
lines changed

6 files changed

+2364
-2420
lines changed

.github/workflows/publish-sdk.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Publish Client SDK
2+
on:
3+
release:
4+
types: [published]
5+
env:
6+
solana_version: v1.14.18
7+
anchor_version: 0.27.0
8+
9+
jobs:
10+
install:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- uses: actions/cache@v3
16+
name: cache solana cli
17+
id: cache-solana
18+
with:
19+
path: |
20+
~/.cache/solana/
21+
~/.local/share/solana/
22+
key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
23+
24+
- uses: actions/setup-node@v3
25+
with:
26+
node-version: '16'
27+
28+
- name: Cache node dependencies
29+
uses: actions/cache@v3
30+
with:
31+
path: '**/node_modules'
32+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
33+
34+
- name: install node_modules
35+
run: |
36+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
37+
yarn --frozen-lockfile --network-concurrency 2
38+
39+
- uses: dtolnay/rust-toolchain@stable
40+
with:
41+
toolchain: stable
42+
43+
- name: Cache rust
44+
uses: Swatinem/rust-cache@v2
45+
46+
- name: install essentials
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y pkg-config build-essential libudev-dev
50+
51+
- name: install solana
52+
if: steps.cache-solana.outputs.cache-hit != 'true'
53+
run: |
54+
sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
55+
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
56+
solana --version
57+
58+
clippy-lint:
59+
needs: install
60+
runs-on: ubuntu-latest
61+
62+
steps:
63+
- uses: actions/checkout@v3
64+
- name: Cache rust
65+
uses: Swatinem/rust-cache@v2
66+
- name: Run fmt
67+
run: cargo fmt -- --check
68+
- name: Run clippy
69+
run: cargo clippy -- --deny=warnings
70+
71+
yarn-lint:
72+
needs: install
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v3
76+
- name: Use Node ${{ matrix.node }}
77+
uses: actions/setup-node@v3
78+
with:
79+
node-version: '16'
80+
81+
- name: Cache node dependencies
82+
uses: actions/cache@v3
83+
with:
84+
path: '**/node_modules'
85+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
86+
87+
- name: Run lint
88+
run: yarn lint
89+
90+
test-and-publish:
91+
needs: [clippy-lint, yarn-lint]
92+
runs-on: ubuntu-latest
93+
94+
steps:
95+
- uses: actions/checkout@v3
96+
97+
- name: Use Node ${{ matrix.node }}
98+
uses: actions/setup-node@v3
99+
with:
100+
node-version: '16'
101+
102+
- name: Cache node dependencies
103+
uses: actions/cache@v3
104+
with:
105+
path: '**/node_modules'
106+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
107+
- name: install node_modules
108+
run: |
109+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
110+
yarn --frozen-lockfile
111+
112+
- uses: actions/cache@v3
113+
name: cache solana cli
114+
id: cache-solana
115+
with:
116+
path: |
117+
~/.cache/solana/
118+
~/.local/share/solana/
119+
key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
120+
121+
- name: setup solana
122+
run: |
123+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
124+
solana --version
125+
solana-keygen new --silent --no-bip39-passphrase
126+
127+
- name: run tests
128+
run: |
129+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
130+
ls node_modules/.bin
131+
npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
132+
anchor test
133+
134+
- run: npm run lint:fix && npm publish -w client/sdk/
135+
env:
136+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Magicblock Labs Pte. Ltd.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

client/sdk/.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/lib
6+
/.pnp
7+
.pnp.js
8+
9+
# testing
10+
/coverage
11+
12+
# production
13+
/build
14+
15+
# misc
16+
.DS_Store
17+
.env.local
18+
.env.development.local
19+
.env.test.local
20+
.env.production.local
21+
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*
25+
126
src/idl/tens.ts

client/sdk/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Magicblock Labs Pte. Ltd.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

client/sdk/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"name": "@magicblock-labs/soar-sdk",
3-
"version": "0.1.9",
3+
"version": "0.1.15",
44
"description": "Sdk bindings for the SOAR smart contract.",
5+
"repository": {
6+
"type": "git",
7+
"url": "[email protected]:magicblock-labs/SOAR.git",
8+
"directory": "client/sdk"
9+
},
510
"main": "dist/index.js",
611
"module": "dist/index.mjs",
712
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)