carbonfiber-node
v1.4.2
Published
Node module for Carbon Fiber
Downloads
7
Readme
Carbon Module
Carbon Fiber API which implements generic Carbon Fiber functionality. Availabe as a node module on npm.
Getting Started
Before using carbonfiber-node, please have a jwt token to initialize. You can receive jwt tokens from calling,
fiber.account_getJWT(<email>, <password>)
Installing
npm install carbonfiber-node
then include atop files:
let CarbonFiber = require('carbonfiber-node')
// Get token to initialize fiber.
let token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI4MTY1NzgzZC02MDcyLTQ4YzItOGI2My0wMmU5YzA3NWNlNDIiLCJzdXBlclVzZXIiOnRydWUsImNvbnRhY3QiOmZhbHNlLCJlbWFpbCI6ImdtYWk5NWhAZ21haWwuY29tIiwiaWF0IjoxNTUzNjA2MDQ5fQ.qypcRxarvmpcJmyJTEo5EjtuWLpm_TMegHWwx3PYe8g'
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox', token)
Usage
Methods return promises to complete described actions.
I.E:
// Method to get a jwt token.
fiber.account_getJWT(<email_address>, <password>)
Returns a single token for use.
Account Methods
All Account functions available for Carbon Fiber.
fiber.account_getJWT(email_address, password)
Get a jwt token from the email address, and password.
Parameters
| Param | Type | Required | |----------|:-------------:|------:| | email_address | string | true | | password | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getToken = async function(){
let jwt_Token = await fiber.account_getJWT('email', 'password')
return jwt_token
}
// Returns jwt token to be used.
getToken()
fiber.account_currentSuperUser()
Get current data for super user.
Parameters
| Param | Type | Required | |----------|:-------------:|------:|
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let createSuper = async function(){
return await fiber.account_currentSuperUser()
}
// Returns a super user after being created.
createSuper()
fiber.account_changePassword(new_password, email_address)
Change password for the super user.
Parameters
| Param | Type | Required | |----------|:-------------:|------:| | new_password | string | true | | email_address | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let changePassword = async function(){
return await fiber.account_changePassword('new_password', 'email')
}
// Changes password and returns adequate response messages.
changePassword()
KYC Methods
All KYC functions available for Carbon Fiber.
fiber.kyc_createContact(contact_body)
Create a KYC Contact.
Parameters
Object keys to be pushed into kyc_createContact
| Param | Type | Required | |----------|:-------------:|------:| | email_address | string | true | | first_name | string | true | | last_name | string | true | | dob | string | true | | phone_number | number | true | | street | string | true | | city | string | true | | region | string | true | | postal_code | string | true | | country | string | true | | tax-country | string | true | | tax_id | number | true | | sex | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let createContact = async function(){
return await fiber.kyc_createContact({})
}
// Creates a kyc contact and returns the results.
createContact()
fiber.kyc_uploadDocument(upload_body)
Upload a document(image, png, etc.)
Parameters
Object keys to be pushed into kyc_uploadDocument
| Param | Type | Required | |----------|:-------------:|------:| | contactId | string | true | | file | Buffer | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let uploadDocument = async function(){
let document = "<Buffer>"
return await fiber.kyc_uploadDocument(document)
}
// Uploads a document.
uploadDocument()
fiber.kyc_updateContact(update_body)
Update KYC Status.
Parameters
Object keys to be pushed into kyc_updateContact
| Param | Type | Required | |----------|:-------------:|------:| | contactId | string | true | | email_address | string | true | | first_name | string | true | | last_name | string | true | | dob | string | true | | phone_number | number | true | | street | string | true | | city | string | true | | region | string | true | | postal_code | string | true | | country | string | true | | tax-country | string | true | | tax_id | number | true | | sex | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let updateKYC = async function(){
return await fiber.account_changePassword({})
}
// Updates the kyc status.
updateKYC()
fiber.kyc_getContactStatus(id)
Get KYC contact status.
Parameters
Object keys to be pushed into kyc_getContactStatus
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getAccount = async function(){
return await fiber.kyc_getContactStatus('sdfwefwefwefwefwefwefwef')
}
// Get account from id.
getAccount()
fiber.kyc_deleteContact(id)
Delete KYC Contact.
Parameters
Object keys to be pushed into kyc_deleteContact
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let deleteAccount = async function(){
return await fiber.kyc_deleteContact('sdfwefwefwefwefwefwefwef')
}
// Deletes account
deleteAccount()
fiber.kyc_getContacts()
Get all KYC contacts.
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getContacts = async function(){
return await fiber.kyc_getContacts()
}
// Get all the kYC contacts
getContacts()
Payment Methods
All Payment functions available for Carbon Fiber.
fiber.payment_addWireMethod(wire_body)
Method to add a wire method.
Parameters
Object keys to be pushed into payment_addWireMethod
| Param | Type | Required | |----------|:-------------:|------:| | is_bank_international | bool | true | | contact-id | string | true | | bank_name | string | true | | bank_account_number | number | true | | beneficiary-address | string | true | | routing-number | number | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let addWire = async function(){
return await fiber.payment_addWireMethod({})
}
addWire()
fiber.payment_getAllMethods(payment_body)
Get all payment methods.
Parameters
Object keys to be pushed into payment_getPaymentMethod
| Param | Type | Required | |----------|:-------------:|------:| | contactId | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getAll = async function(){
return await fiber.payment_getAllMethods({})
}
getAll()
fiber.payment_getPaymentMethod(id)
Get a single payment method by id.
Parameters
Object keys to be pushed into payment_getPaymentMethod
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getID = async function(){
return await fiber.payment_getPaymentMethod('wefwefwefwefwef')
}
getID()
fiber.payment_deletePaymentMethod(id)
Delete a payment method by the id.
Parameters
Object keys to be pushed into payment_deletePaymentMethod
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let deleteID = async function(){
return await fiber.payment_deletePaymentMethod('wefwefwefwefwef')
}
deleteID()
fiber.payment_addACH(ach_body)
Add ACH to fiber account.
Parameters
Object keys to be pushed into payment_addACH
| Param | Type | Required | |----------|:-------------:|------:| | contact-id | string | true | | routing-number | string | true | | bank-account-number | number | true | | bank-name | string | true | | bank-account-type | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let addACH = async function(){
return await fiber.payment_addACH({})
}
addACH()
Deposit Methods
All Deposit functions available for Carbon Fiber.
fiber.deposit_createWireDeposit(deposit_body)
Create a wire deposit.
Parameters
Object keys to be pushed into deposit_createWireDeposit
| Param | Type | Required | |----------|:-------------:|------:| | amount | number | true | | chain | string | true | | contact-id | string | true | | address | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let createDeposit = async function(){
return await fiber.deposit_createWireDeposit({})
}
createDeposit()
fiber.deposit_deleteDeposit(id)
Delete a deposit request.
Parameters
Object keys to be pushed into deposit_deleteDeposit
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let deleteDeposit = async function(){
return await fiber.deposit_deleteDeposit('wefwefwef')
}
deleteDeposit()
fiber.deposit_ID(id)
Get a deposit by ID.
Parameters
Object keys to be pushed into deposit_ID
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let deleteDepositID = async function(){
return await fiber.deposit_ID('wefwefwef')
}
deleteDepositID()
fiber.deposit_getAll(deposit_body)
Get all deposits.
Parameters
Object keys to be pushed into deposit_getAll
| Param | Type | Required | |----------|:-------------:|------:| | contactId | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getDeposits = async function(){
return await fiber.deposit_getAll('wefwefwefwefwef')
}
getDeposits()
fiber.deposit_createACH(ach_body)
Create a new ACH deposit.
Parameters
Object keys to be pushed into deposit_createACH
| Param | Type | Required | |----------|:-------------:|------:| | contact-id | string | true | | chain | string | true | | address | string | true | | amount | number | true | | routing-number | number | true | | bank-account-number | number | true | | bank-name | string | true | | bank-account-type | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let createACH = async function(){
return await fiber.deposit_createACH({})
}
createACH()
Withdraw Methods
All Withdraw functions available for Carbon Fiber.
fiber.withdraw_createWithdrawal(withdraw_body)
Create a Withdraw request.
Parameters
Object keys to be pushed into withdraw_createWithdrawal
| Param | Type | Required | |----------|:-------------:|------:| | contact-id | string | true | | chain | string | true | | amount | number | true | | paymentMethodId | string | true | | address | string | true | | txHash | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let newRequest = async function(){
return await fiber.withdraw_createWithdrawal({})
}
newRequest()
fiber.withdraw_deleteWithdrawal(id)
Delete a withdraw request.
Parameters
Object keys to be pushed into withdraw_deleteWithdrawal
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let delete = async function(){
return await fiber.withdraw_deleteWithdrawal('fwefwewefwefwef')
}
delete()
fiber.withdraw_getAll(contact_body)
Get all withdrawals.
Parameters
String to be pushed into withdraw_getAll
| Param | Type | Required | |----------|:-------------:|------:| | contactId | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getWithdrawals = async function(){
return await fiber.withdraw_getAll('wefwefwef')
}
getWithdrawals()
fiber.withdraw_getByID(id)
Get a single withdrawal by ID.
Parameters
String to be pushed into withdraw_getByID
| Param | Type | Required | |----------|:-------------:|------:| | id | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let getWithdrawalID = async function(){
return await fiber.withdraw_getByID('wefwefwefwef')
}
getWithdrawalID()
fiber.withdraw_createACH(ach_body)
Create ACH withdrawal.
Parameters
String to be pushed into withdraw_createACH
| Param | Type | Required | |----------|:-------------:|------:| | contact-id | string | true | | chain | string | true | | amount | number | true | | paymentMethodId | string | true | | address | string | true | | txHash | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let createACH = async function(){
return await fiber.withdraw_createACH({})
}
createACH()
Webhook Methods
All Webhook functions available for Carbon Fiber.
fiber.webhook_subscribe(webhook_body)
Subscribe to a webhook.
Parameters
Object to be pushed into webhook_subscribe
| Param | Type | Required | |----------|:-------------:|------:| | action | string | true | | url | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let webhook = async function(){
return await fiber.webhook_subscribe({})
}
webhook()
fiber.webhook_unsubscribe(webhook_body)
Unsubscribe from a webhook.
Parameters
String to be pushed into webhook_unsubscribe
| Param | Type | Required | |----------|:-------------:|------:| | action | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let webhook = async function(){
return await fiber.webhook_unsubscribe({})
}
webhook()
fiber.webhook_removeCallbackURL(webhook_body, action)
Remove a callback url from a webhook.
Parameters
Parameters to be pushed into webhook_removeCallbackURL
| Param | Type | Required | |----------|:-------------:|------:| | webhook_body | object | true | | action | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let webhook = async function(){
return await fiber.webhook_removeCallbackURL({}, 'ETHMINT')
}
webhook()
fiber.webhook_viewSubscription(action)
View a subscription via the action.
Parameters
String to be pushed into webhook_viewSubscription
| Param | Type | Required | |----------|:-------------:|------:| | action | string | true |
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let webhook = async function(){
return await fiber.webhook_viewSubscription('EOSMINT')
}
webhook()
fiber.webhook_allSubscriptions()
View all Webhook Subscriptions.
// Require carbon fiber module.
let CarbonFiber = require('carbonfiber-node')
// Call an instance of CarbonFiber, make sure to state whether it's "sandbox", or "main"
let fiber = new CarbonFiber('sandbox')
let webhook = async function(){
return await fiber.webhook_allSubscriptions()
}
webhook()
Contributing
License
ISC