Skip to content

Commit

Permalink
:feat: initialized coinforbarter-v1-node
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kings committed Sep 10, 2021
1 parent 7250eba commit d4c9c72
Show file tree
Hide file tree
Showing 57 changed files with 7,044 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .env.sample
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=
24 changes: 24 additions & 0 deletions .eslintrc.js
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',
},
};
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
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
20 changes: 20 additions & 0 deletions .github/workflows/deployment.yml
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
17 changes: 17 additions & 0 deletions .github/workflows/linting and test.yml
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
/node_modules
/dist
tsconfig.tsbuildinfo
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint
10 changes: 10 additions & 0 deletions .npmignore
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
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
15 changes: 15 additions & 0 deletions .vscode/launch.json
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}"
}
]
}
145 changes: 145 additions & 0 deletions README.md
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).
7 changes: 7 additions & 0 deletions babel.config.js
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',
],
};
77 changes: 77 additions & 0 deletions package.json
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"
}
}
Loading

0 comments on commit d4c9c72

Please sign in to comment.