-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
:feat: initialized coinforbarter-v1-node
- Loading branch information
Showing
57 changed files
with
7,044 additions
and
0 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,12 @@ | ||
PUBLIC_KEY= | ||
SECRET_KEY= | ||
ACCOUNT_NUMBER= | ||
ACCOUNT_BANK= | ||
ACCOUNT_NAME= | ||
ACCOUNT_NUMBER= | ||
ACCOUNT_BANK= | ||
ACCOUNT_NAME= | ||
BANK_CODE= | ||
BANK_ACCOUNT_ID= | ||
BANK_ACCOUNT_ID= | ||
COUNTRY_CODE= |
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,24 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}; |
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,11 @@ | ||
**What does this do?** | ||
|
||
Specify what this pr does | ||
|
||
**How can this be tested?** | ||
|
||
Specify how this pr can be tested as working | ||
|
||
**Provide Video/Image if applicable? (optional)** | ||
|
||
Provide an image or video showing how this pr works |
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,20 @@ | ||
name: Deploy to staging | ||
on: | ||
push: | ||
branches: | ||
- staging | ||
workflow_dispatch: | ||
branches: | ||
- staging | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js dependencies | ||
run: yarn | ||
|
||
- name: Run ESLint | ||
run: yarn lint |
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,17 @@ | ||
name: Linting and Test | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js dependencies | ||
run: yarn | ||
|
||
- name: Run ESLint | ||
run: yarn lint | ||
|
||
- name: Run Test | ||
run: yarn test |
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,4 @@ | ||
.env | ||
/node_modules | ||
/dist | ||
tsconfig.tsbuildinfo |
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 @@ | ||
_ |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint |
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,10 @@ | ||
/src | ||
/.husky | ||
/.github | ||
/.env | ||
/.env.sample | ||
/.eslintrc.js | ||
/.prettierrc | ||
/babel.config.js | ||
/tsconfig.build.json | ||
/tsconfig.json |
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,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
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,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "pwa-chrome", | ||
"request": "launch", | ||
"name": "Launch Chrome against localhost", | ||
"url": "http://localhost:8080", | ||
"webRoot": "${workspaceFolder}" | ||
} | ||
] | ||
} |
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,145 @@ | ||
# CoinForBarter V1 NodeJs Library | ||
|
||
### How to use | ||
|
||
<cd>npm install coinforbarter -node-sdk</cd> | ||
|
||
```bash | ||
const CoinForBarter = require('coinforbarter -node-v3'); | ||
|
||
const c4b = new CoinForBarter(PUBLIC_KEY, SECRET_KEY, SECRET_HASH); | ||
|
||
const customers = c4b.Customers.findAll(); | ||
``` | ||
|
||
For staging, Use TEST API Keys. For production, use LIVE API KEYS. You can get your PUBLIC_KEY and SECRET_KEY from the CoinForBarter dashboard. | ||
|
||
Go [here](https://dashboard.coinforbarter.com/settings/api) to get your API Keys. | ||
|
||
|
||
Turn on Test Mode to get TEST API KEYS and Turn off Test Mode to get LIVE API KEYS | ||
|
||
## CoinForBarter Services exposed by the library | ||
|
||
1. #### Customer | ||
##### Methods | ||
- findAll | ||
- findOne | ||
- create | ||
- update | ||
|
||
|
||
2. #### BankAccount | ||
##### Methods | ||
- getBankAccountName | ||
- create | ||
- findAll | ||
- findOne | ||
- makePrimary | ||
- getBanks | ||
|
||
|
||
3. #### Payment | ||
##### Methods | ||
- findOne | ||
- findAll | ||
- create | ||
- setCurrency | ||
- lockCurrency | ||
- getPaymentUpdates | ||
- cancel | ||
|
||
|
||
4. #### PaymentPlan | ||
##### Methods | ||
- findAll | ||
- findOne | ||
- create | ||
- update | ||
|
||
|
||
5. #### PaymentPlanSubscriber | ||
##### Methods | ||
- create | ||
- findOne | ||
- findAll | ||
- remove | ||
|
||
|
||
6. #### Payout | ||
##### Methods | ||
- findAll | ||
- findOne | ||
|
||
|
||
7. #### Transaction | ||
##### Methods | ||
- findAll | ||
- findOne | ||
- verify | ||
- events | ||
- getFee | ||
- webhook | ||
|
||
|
||
8. #### Transfer | ||
##### Methods | ||
- findAll | ||
- findOne | ||
- create | ||
- getFee | ||
|
||
|
||
9. #### WalletAddress | ||
##### Methods | ||
- create | ||
- findAll | ||
- findOne | ||
- makePrimary | ||
|
||
|
||
10. #### Webhook | ||
##### Methods | ||
- validate | ||
|
||
|
||
11. #### Misc | ||
##### Methods | ||
- getCountries | ||
- getBalance | ||
- getCurrencies | ||
|
||
|
||
All methods can be called this way | ||
|
||
```bash | ||
|
||
const customers = c4b.Customer.findAll(); | ||
|
||
``` | ||
i.e | ||
|
||
```bash | ||
|
||
c4b:{ | ||
[service]:method | ||
} | ||
|
||
|
||
``` | ||
<cd>Some methods may take body data or query params in objects</cd> | ||
|
||
For more information on the services listed above, visit the [CoinForBarter documentation](https://developers.coinforbarter.com) | ||
|
||
|
||
CoinForBarter V1 NodeJs Library is an MIT -licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://developers.coinforbarter.com). | ||
|
||
## Stay in touch | ||
|
||
- Author - [Nwachukwu, Kingsley Tochukwu](https://linkedin.com/in/t-kings) | ||
- Website - [https://coinforbarter.com](https://coinforbarter.com/) | ||
- Twitter - [@t-kings](https://twitter.com/t-kings) | ||
|
||
## License | ||
|
||
CoinForBarter is [MIT licensed](LICENSE). |
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,7 @@ | ||
// babel.config.js | ||
module.exports = { | ||
presets: [ | ||
['@babel/preset-env', { targets: { node: 'current' } }], | ||
'@babel/preset-typescript', | ||
], | ||
}; |
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,77 @@ | ||
{ | ||
"name": "coinforbarter-node-sdk", | ||
"version": "1.0.6", | ||
"description": "CoinForBarter NodeJs Library", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"repository": "https://github.com/t-kings/CoinForBarter-v1-NodeJs.git", | ||
"author": { | ||
"name": "Nwachukwu, Kingsley Tochukwu", | ||
"email": "[email protected]" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"axios": "^0.21.1", | ||
"websocket": "^1.0.34" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"prepublish": "npm run build", | ||
"dev": "tsc -w ", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"test:e2e": "jest --config ./test/jest-e2e.json", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" | ||
}, | ||
"engines": { | ||
"node": "<=14.17.1" | ||
}, | ||
"keywords": [ | ||
"bitcoin", | ||
"payments", | ||
"BTC", | ||
"crypto currency", | ||
"DOGE", | ||
"API", | ||
"Nodejs Crypto", | ||
"CoinForBarter", | ||
"Crypto Sdk" | ||
], | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.14.7", | ||
"@babel/preset-typescript": "^7.14.5", | ||
"@types/jest": "^26.0.23", | ||
"@typescript-eslint/eslint-plugin": "^4.19.0", | ||
"@typescript-eslint/parser": "^4.28.1", | ||
"eslint": "^7.22.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"husky": "^6.0.0", | ||
"jest": "^27.0.6", | ||
"prettier": "^2.2.1", | ||
"dotenv": "^10.0.0", | ||
"typescript": "^4.3.4" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"ts" | ||
], | ||
"rootDir": "src", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s$": "babel-jest" | ||
}, | ||
"collectCoverageFrom": [ | ||
"**/*.(t|j)s" | ||
], | ||
"setupFiles": [ | ||
"dotenv/config" | ||
], | ||
"coverageDirectory": "../coverage", | ||
"testEnvironment": "node" | ||
} | ||
} |
Oops, something went wrong.