-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into testsUpdate
- Loading branch information
Showing
15 changed files
with
755 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Update README.md templates | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write # Grant write permissions to the contents | ||
|
||
env: | ||
FILE_NAME: README.md | ||
|
||
jobs: | ||
update-readme: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
registry-url: https://registry.npmjs.org/ | ||
cache: 'npm' | ||
|
||
- name: Install | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Get the current date and time | ||
id: datetime | ||
run: echo "BRANCH_NAME=$(date +'actions_templates_%Y_%m_%d_%H%M%S')" >> $GITHUB_ENV | ||
|
||
- name: Create update-template.sh script | ||
run: | | ||
cat << 'EOF' > update-template.sh | ||
#!/bin/bash | ||
TEMPLATE_VALUE=$(curl -s $TEMPLATE_URL) | ||
perl -0777 -i -pe " | ||
my \$tag = quotemeta('<!-- template_${TEMPLATE_TAG} -->'); | ||
my \$end_tag = quotemeta('<!-- template_${TEMPLATE_TAG}_end -->'); | ||
my \$replacement = '${TEMPLATE_VALUE}'; | ||
# Match the tag, then any amount of whitespace (including newlines), then the replacement, then any amount of whitespace, then the end tag. | ||
s/(\$tag)(\s*)(.*?)(\s*)(\$end_tag)/\$1\n\$replacement\n\$5/s; | ||
" "$FILE_NAME" | ||
EOF | ||
chmod +x update-template.sh | ||
cat update-template.sh | ||
- name: Fetch and update RELATED PROJECTS template | ||
run: ./update-template.sh | ||
env: | ||
TEMPLATE_URL: https://raw.githubusercontent.com/wiki/tiagosiebler/awesome-crypto-examples/Related-projects.md | ||
TEMPLATE_TAG: related_projects | ||
|
||
- name: Fetch and update CONTRIBUTIONS template | ||
run: ./update-template.sh | ||
env: | ||
TEMPLATE_URL: https://raw.githubusercontent.com/wiki/tiagosiebler/awesome-crypto-examples/Contributions-%26-Thanks.md | ||
TEMPLATE_TAG: contributions | ||
|
||
- name: Fetch and update STAR HISTORY template | ||
run: ./update-template.sh | ||
env: | ||
TEMPLATE_URL: https://raw.githubusercontent.com/wiki/tiagosiebler/awesome-crypto-examples/Star-History.md | ||
TEMPLATE_TAG: star_history | ||
|
||
- name: Check for changes before running linter | ||
run: git diff | ||
|
||
- name: Check for changes | PR URL HERE | ||
id: commitIfChanged | ||
run: | | ||
npx prettier -w README.md | ||
if git diff --quiet; then | ||
echo "No changes to commit" | ||
exit 0 | ||
fi | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git checkout -b ${{ env.BRANCH_NAME }} | ||
git add $FILE_NAME | ||
git commit -m 'chore(): ${{ env.FILE_NAME }} template sections' | ||
git push origin ${{ env.BRANCH_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { RestClientV5 } = require('bybit-api'); | ||
|
||
const client = new RestClientV5({ | ||
testnet: true, | ||
key: 'apikey', | ||
secret: 'apisecret', | ||
}); | ||
|
||
client | ||
.getClassicTransactionLogs({ | ||
limit: 1, | ||
symbol: 'BTCUSD', | ||
}) | ||
.then((response) => { | ||
console.log(response); | ||
}) | ||
.catch((error) => { | ||
console.error(error); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { RestClientV5 } from '../src/index'; | ||
|
||
// or | ||
// import { RestClientV5 } from 'bybit-api'; | ||
|
||
/** | ||
* The first parameter of the REST client allows you to pass any configuration parameters supported by the SDK. | ||
* | ||
* These include API keys, if you wish to use private endpoints, but also expose other features such as | ||
* setting a custom base URL (e.g. for Turkish users). | ||
* | ||
* Refer to the API documentation for a complete list of domains: https://bybit-exchange.github.io/docs/v5/guide#authentication | ||
*/ | ||
const client = new RestClientV5({ | ||
/** | ||
* You can pass a completely custom base URL, | ||
* e.g. if you're trying to use a domain that hasn't been added yet (please let us know) | ||
*/ | ||
// baseUrl: 'https://api5.bybit.com', | ||
// | ||
// | ||
/** | ||
* | ||
* There are also predefined API regions, which you can easily use with the "apiRegion" property: | ||
* | ||
*/ | ||
// | ||
// | ||
// default: routes to api.bybit.com | ||
// apiRegion: 'default', | ||
// | ||
// | ||
// bytick: routes to api.bytick.com | ||
// apiRegion: 'bytick', | ||
// | ||
// | ||
// NL: routes to api.bybit.nl (for Netherland users) | ||
// apiRegion: 'NL', | ||
// | ||
// | ||
// HK: routes to api.byhkbit.com (for Hong Kong users) | ||
// apiRegion: 'HK', | ||
// | ||
// | ||
// TK: routes to api.bybit-tr.com (for Turkey users) | ||
// apiRegion: 'TK', | ||
}); | ||
|
||
(async () => { | ||
try { | ||
const time1 = await client.getServerTime(); | ||
|
||
console.log('time res: ', { time1 }); | ||
} catch (e) { | ||
console.error('request failed: ', e); | ||
} | ||
})(); |
Oops, something went wrong.