Full Documentation

This lists the full functionality available in the Node SDK, Version 0.2.0

For simplicity and consistency, all API calls return a Promise. Example usage:

// Initialize SDK
sila = require('sila-sdk/lib/index.js');
// Set the app authentication for signing messages
sila.configure( {handle: 'myapp', key: '0x123...7890'} );
// Switch to production
sila.disableSandbox();
// Use the SDK
sila.register( data )
.then(res => {
/* Handle response */
if (res.status === 'SUCCESS') {
// User was successfully registered
} else {
alert(res.message);
}
})
.catch(err => {
/* Handle errors */
alert(err);
});

All success and failure responses are passed into the .then() callback method.

Only unhandled errors such as network issues, etc, are handled in the .catch() callback.

Configure

sila.configure(app);

Sets up the private key and handle for the SDK to use for signing subsequent request. The other SDK functionality will not be available until this configuration is completed. The SDK does not store this information outside of the instance that is configured. It is never transmitted over the network or stored outside the scope of this instance.

  • app (required): (JSON) The authentication data for your application as registered in the Developer Console, as defined below:

{
handle: 'apphandle', // Required: The application handle authorizing the requests. May optionally include `.silamoney.eth` at the end
key: '0x123...7890', // Required: The private key of the application authorizing the requests
}

Check Handle

Checks the specified handle to see if it is available or has already been registered.

sila.checkHandle(handle)
.then(res => { /* Handle response */ })
.catch(err => { /* Handle errors */ });
  • handle (required): (String) The handle for the user to check handle availability

Register

Registers a new user with the specified data. Address must pass USPS verification. SSN will be used for KYC when requested.

sila.register(user)
.then(res => { /* Handle response */ })
.catch(err => { /* Handle errors */ });
  • user (required): (JSON) The user data to register, as defined below:

{
handle: 'userhandle', // Required: Must not be already in use
first_name: 'First', // Required
last_name: 'Last', // Required
name: 'My Company', // Optional: defaults to `first_name last_name`
address: '123 Main St.', // Required: must be a valid USPS mailing address
address_2: 'Suite 101', // Optional: required if USPS requires it
city: 'Anytown', // Required: Must be a valid US City matching the zip
state: 'OR', // Required: Must be a 2 character US State abbr.
zip: '12345', // Required: Must be a valid US Postal Code
phone: '123-456-7890' // Required: Must be a valid phone number (format not enforced)
}

Request KYC

Request KYC process for the specified user.

sila.requestKYC(user, key)
.then(res => { /* Handle response */ })
.catch(err => { /* Handle errors */ });
  • user (required): (JSON) The user data to register, as defined below (same as Register):

  • key (required): (String) The private key associated with that user. Used to sign the message for authentication

{
handle: 'userhandle', // Required: Must not be already in use
first_name: 'First', // Required
last_name: 'Last', // Required
name: 'My Company', // Optional: defaults to `first_name last_name`
address: '123 Main St.', // Required: must be a valid USPS mailing address
address_2: 'Suite 101', // Optional: required if USPS requires it
city: 'Anytown', // Required: Must be a valid US City matching the zip
state: 'OR', // Required: Must be a 2 character US State abbr.
zip: '12345', // Required: Must be a valid US Postal Code
phone: '123-456-7890' // Required: Must be a valid phone number (format not enforced)
}

Check KYC

Checks the KYC status of the specified user.

sila.checkKYC(handle, key)
.then(res => { /* Handle response */ })
.catch(err => { /* Handle errors */ });
  • handle (required): (String) The handle for the user to check KYC status

  • key (required): (String) The private key associated with that user. Used to sign the message for authentication

Link Account

Links a payment account to the specified handle using a Plaid public token.

sila.linkAccount(handle, key, publicToken)
.then(res => { /* Handle response res */ })
.catch(err => { /* Handle errors err */ });
  • handle (required): (String) The handle for the user to check KYC status

  • key (required): (String) The private key associated with that user. Used to sign the message before transmission

  • publicToken (required): (String) A valid Plaid public token (see the Plaid Quickstart)

Get Accounts

Get an array of payment accounts for the specified user. Returns an empty array if no accounts have been linked.

sila.getAccounts(handle, key)
.then((res) => { /* Handle response res */ })
.catch((err) => { /* Handle error `err` */ });
  • handle (required): (String) The handle for the user to check KYC status

  • key (required): (String) The private key associated with that user. Used to sign the message for authentication

Issue Sila

Converts the corresponding amount of USD into sila for the specified user. USD is deducted from the primary linked account. Sila is credited to the primary crypto wallet.

sila.issueSila(amount, handle, key)
.then((res) => { /* Handle response res */ })
.catch((err) => { /* Handle error `err` */ });
  • amount (required): (Integer|min:1000) The amount (in sila) to deduct from the linked account and issue to the linked ethereum wallet

  • handle (required): (String) The handle for the user to issue sila to

  • key (required): (String) The private key associated with that user. Used to sign the message for authentication

Redeem Sila

Converts the sila into the corresponding amount of USD for the specified user. USD is credited to the primary linked account. Sila is deducted from the primary crypto wallet.

sila.redeemSila(amount, handle, key)
.then((res) => { /* Handle response res */ })
.catch((err) => { /* Handle error `err` */ });
  • amount (required): (Integer|min:1000) The amount (in sila) to deduct from the linked ethereum wallet and issue to the linked account

  • handle (required): (String) The handle for the user to issue sila to

  • key (required): (String) The private key associated with that user. Used to sign the message for authentication

Transfer Sila

Moves the specified amount of sila from one user to another. Sila is deducted from and credited to the primary crypto wallets of the specified users.

sila.transferSila(amount, handle, key, destinationHandle)
.then((res) => { /* Handle response res */ })
.catch((err) => { /* Handle error `err` */ });
  • amount (required): (Integer|min:1000) The amount (in sila) to deduct from the linked ethereum wallet and issue to the linked account

  • handle (required): (String) The source handle for the sila transfer. This user must sign the message

  • key (required): (String) The private key associated with that user. Used to sign the message before transmission

  • destinationHandle (required): (String) The destination handle for the sila transfer

Get Transactions

Returns a list of all transactions for the specified user, including transaction status.

sila.getTransactions(handle, key)
.then((res) => { /* Handle response res */ })
.catch((err) => { /* Handle error `err` */ });

Add Crypto

Adds an additional crypto account to the specified user.

sila.addCrypto(handle, key, address, alias)
.then((res) => { /* Handle response res */ })
.catch((err) => { /* Handle error `err` */ });
  • handle (required): (String) The handle for the user

  • key (required): (String) The private key associated with that user. Used to sign the message for authentication

  • address (required): (String) The ethereum address to add to the specified user

  • alias (required): (String) The identifier of the account to add. When registering, a default alias is added. These must be unique to the user.

Sandbox

Sila offers a Sandbox environment for development. All ACH transactions in the Sandbox are simulated, and sila transactions are made on the rinkeby testnet.

NOTE: The sandbox environment is enabled by default after initialization.

Enable

sila.enableSandbox()

Disable

sila.disableSandbox()

Generate Wallet

Don't want to require your users to generate their wallets offline? No problem! You can use the Sila SDK's generateWallet() function to return a new Ethereum account using the web3 eth library. This is simply an alias for web3.eth.accounts.create().

wallet = sila.generateWallet()