Skip to content

Commit 1352174

Browse files
authored
Merge pull request #2 from usherlabs/develop
added more methods for verity
2 parents 77aea3d + 3887e77 commit 1352174

File tree

10 files changed

+377
-12
lines changed

10 files changed

+377
-12
lines changed

.github/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# GitHub Actions
2+
3+
This directory contains GitHub Actions workflows for building and publishing the CCXT library.
4+
5+
## Workflows
6+
7+
### Build and Test (`build.yml`)
8+
- Runs on pull requests and pushes to main/master branches
9+
- Builds the project using TypeScript, Webpack, and Rollup
10+
- Verifies that all build artifacts are created successfully
11+
- Does not publish to NPM
12+
13+
### Build and Publish (`publish.yml`)
14+
- Runs when a new version tag is pushed (e.g., `v0.0.4`)
15+
- Verifies that the tag version matches the package.json version
16+
- Builds the project and all bundles
17+
- Publishes the package to NPM
18+
19+
## Setup
20+
21+
### NPM Token Setup
22+
23+
To enable automatic publishing to NPM, you need to set up an NPM authentication token:
24+
25+
1. **Create an NPM Access Token:**
26+
- Go to [npmjs.com](https://www.npmjs.com) and log in
27+
- Navigate to your profile settings
28+
- Go to "Access Tokens" section
29+
- Click "Generate New Token"
30+
- Select "Automation" token type
31+
- Copy the generated token
32+
33+
2. **Add the Token to GitHub Secrets:**
34+
- Go to your GitHub repository
35+
- Navigate to Settings → Secrets and variables → Actions
36+
- Click "New repository secret"
37+
- Name: `NPM_TOKEN`
38+
- Value: Paste your NPM access token
39+
- Click "Add secret"
40+
41+
### Publishing Process
42+
43+
1. **Prepare for Release:**
44+
- Update the version in `package.json`
45+
- Commit your changes
46+
- Push to the repository
47+
48+
2. **Create and Push Version Tag:**
49+
```bash
50+
git tag v0.0.4
51+
git push origin v0.0.4
52+
```
53+
54+
Or create the tag via GitHub:
55+
- Go to GitHub repository → Releases
56+
- Click "Create a new release"
57+
- Tag version (e.g., `v0.0.4`)
58+
- Write release notes
59+
- Click "Publish release"
60+
61+
3. **Automatic Publishing:**
62+
- The `publish.yml` workflow will automatically trigger when the tag is pushed
63+
- It will verify the version matches package.json
64+
- Build the project and publish to NPM
65+
- Check the Actions tab to monitor the process
66+
67+
## Build Process
68+
69+
The build process includes:
70+
71+
1. **TypeScript Compilation:** `npm run build`
72+
2. **Browser Bundle:** Webpack creates `dist/ccxt.browser.js`
73+
3. **CommonJS Bundle:** Rollup creates `dist/cjs/` directory
74+
4. **Minified Bundle:** Production webpack build
75+
76+
## Troubleshooting
77+
78+
- **Build Failures:** Check the Actions tab for detailed error logs
79+
- **NPM Publishing Issues:** Verify the NPM_TOKEN secret is correctly set
80+
- **Version Conflicts:** The workflow will automatically fail if the tag version doesn't match package.json version
81+
- **Tag Format:** Ensure tags follow the format `v*` (e.g., `v0.0.4`, `v1.2.3`)

.github/workflows/build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Test
2+
3+
on:
4+
pull_request:
5+
branches: [ main, master ]
6+
push:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '18'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build project
26+
run: npm run build
27+
28+
- name: Build browser bundle
29+
run: npx webpack --config webpack.config.js
30+
31+
- name: Build CommonJS bundle
32+
run: npx rollup --config rollup.config.js
33+
34+
- name: Create minified browser bundle
35+
run: npx webpack --config webpack.config.js --mode production
36+
37+
- name: Verify build artifacts
38+
run: |
39+
ls -la dist/
40+
echo "Build completed successfully!"

.github/workflows/publish.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and Publish to NPM
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '18'
20+
registry-url: 'https://registry.npmjs.org'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Verify version matches tag
26+
run: |
27+
# Extract version from tag (remove 'v' prefix)
28+
TAG_VERSION=${GITHUB_REF#refs/tags/}
29+
TAG_VERSION=${TAG_VERSION#v}
30+
31+
# Get version from package.json
32+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
33+
34+
echo "Tag version: $TAG_VERSION"
35+
echo "Package version: $PACKAGE_VERSION"
36+
37+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
38+
echo "Error: Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
39+
exit 1
40+
fi
41+
42+
echo "Version verification passed!"
43+
44+
- name: Build project
45+
run: npm run build
46+
47+
- name: Build browser bundle
48+
run: npx webpack --config webpack.config.js
49+
50+
- name: Build CommonJS bundle
51+
run: npx rollup --config rollup.config.js
52+
53+
- name: Create minified browser bundle
54+
run: npx webpack --config webpack.config.js --mode production
55+
56+
- name: Publish to NPM
57+
run: npm publish
58+
env:
59+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ tmp/
1818
coverage
1919
.nyc_output
2020
travis-keys.sh
21-
exchanges.json
2221
ccxt.sublime-workspace
2322
.idea
2423
yarn.lock

exchanges.json

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
{
2+
"ids": [
3+
"alpaca",
4+
"apex",
5+
"ascendex",
6+
"bequant",
7+
"bigone",
8+
"binance",
9+
"binancecoinm",
10+
"binanceus",
11+
"binanceusdm",
12+
"bingx",
13+
"bit2c",
14+
"bitbank",
15+
"bitbns",
16+
"bitfinex",
17+
"bitflyer",
18+
"bitget",
19+
"bithumb",
20+
"bitmart",
21+
"bitmex",
22+
"bitopro",
23+
"bitrue",
24+
"bitso",
25+
"bitstamp",
26+
"bitteam",
27+
"bittrade",
28+
"bitvavo",
29+
"blockchaincom",
30+
"blofin",
31+
"btcalpha",
32+
"btcbox",
33+
"btcmarkets",
34+
"btcturk",
35+
"bybit",
36+
"cex",
37+
"coinbase",
38+
"coinbaseadvanced",
39+
"coinbaseexchange",
40+
"coinbaseinternational",
41+
"coincatch",
42+
"coincheck",
43+
"coinex",
44+
"coinmate",
45+
"coinmetro",
46+
"coinone",
47+
"coinsph",
48+
"coinspot",
49+
"cryptocom",
50+
"cryptomus",
51+
"defx",
52+
"delta",
53+
"deribit",
54+
"derive",
55+
"digifinex",
56+
"ellipx",
57+
"exmo",
58+
"fmfwio",
59+
"gate",
60+
"gateio",
61+
"gemini",
62+
"hashkey",
63+
"hitbtc",
64+
"hollaex",
65+
"htx",
66+
"huobi",
67+
"hyperliquid",
68+
"independentreserve",
69+
"indodax",
70+
"kraken",
71+
"krakenfutures",
72+
"kucoin",
73+
"kucoinfutures",
74+
"latoken",
75+
"lbank",
76+
"luno",
77+
"mercado",
78+
"mexc",
79+
"modetrade",
80+
"myokx",
81+
"ndax",
82+
"novadax",
83+
"oceanex",
84+
"okcoin",
85+
"okx",
86+
"okxus",
87+
"onetrading",
88+
"oxfun",
89+
"p2b",
90+
"paradex",
91+
"paymium",
92+
"phemex",
93+
"poloniex",
94+
"probit",
95+
"timex",
96+
"tokocrypto",
97+
"tradeogre",
98+
"upbit",
99+
"vertex",
100+
"wavesexchange",
101+
"whitebit",
102+
"woo",
103+
"woofipro",
104+
"xt",
105+
"yobit",
106+
"zaif",
107+
"zonda"
108+
],
109+
"ws": [
110+
"alpaca",
111+
"apex",
112+
"ascendex",
113+
"bequant",
114+
"binance",
115+
"binancecoinm",
116+
"binanceus",
117+
"binanceusdm",
118+
"bingx",
119+
"bitfinex",
120+
"bitget",
121+
"bithumb",
122+
"bitmart",
123+
"bitmex",
124+
"bitopro",
125+
"bitrue",
126+
"bitstamp",
127+
"bittrade",
128+
"bitvavo",
129+
"blockchaincom",
130+
"blofin",
131+
"bybit",
132+
"cex",
133+
"coinbase",
134+
"coinbaseadvanced",
135+
"coinbaseexchange",
136+
"coinbaseinternational",
137+
"coincatch",
138+
"coincheck",
139+
"coinex",
140+
"coinone",
141+
"cryptocom",
142+
"defx",
143+
"deribit",
144+
"derive",
145+
"exmo",
146+
"gate",
147+
"gateio",
148+
"gemini",
149+
"hashkey",
150+
"hitbtc",
151+
"hollaex",
152+
"htx",
153+
"huobi",
154+
"hyperliquid",
155+
"independentreserve",
156+
"kraken",
157+
"krakenfutures",
158+
"kucoin",
159+
"kucoinfutures",
160+
"lbank",
161+
"luno",
162+
"mexc",
163+
"modetrade",
164+
"myokx",
165+
"ndax",
166+
"okcoin",
167+
"okx",
168+
"okxus",
169+
"onetrading",
170+
"oxfun",
171+
"p2b",
172+
"paradex",
173+
"phemex",
174+
"poloniex",
175+
"probit",
176+
"tradeogre",
177+
"upbit",
178+
"vertex",
179+
"whitebit",
180+
"woo",
181+
"woofipro",
182+
"xt"
183+
]
184+
}

js/src/base/Exchange.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export default class Exchange {
5959
httpsAgent: any;
6060
useVerity: boolean;
6161
verityProverUrl: string;
62+
verityMethods: string[];
6263
minFundingAddressLength: Int;
6364
substituteCommonCurrencyCodes: boolean;
6465
quoteJsonNumbers: boolean;

0 commit comments

Comments
 (0)