1.48.1899 • Published 4 years ago

@pillarwallet/pillarwallet-nodejs-sdk v1.48.1899

Weekly downloads
24
License
ISC
Repository
github
Last release
4 years ago

Pillar Wallet SDK

The Pillar Wallet SDK aims to make it easy for developers to get started using Pillar Wallet backend services.

Contents

Get Started

Install the npm package:

npm i @pillarwallet/pillarwallet-nodejs-sdk

In your project:

const { PillarSdk } = require('@pillarwallet/pillarwallet-nodejs-sdk');

A quick note on versioning

During the pipeline process, we need to automatically ensure that our version number is unique. To do this, we replace the last patch digit of the package.json's version setting with the current circle CI build number. It's a bit of a hack but it means we don't need to think about the version number before committing + pushing.

For example, if you give us version=2.3.1, and this is picked up by circle's 492nd build job, your package is published as version=2.3.492

Config

IMPORTANT! Complete these steps to use this SDK:

1 - Create An Instance

Instantiate the Pillar SDK, then set the apiUrl (optional) and notificationsUrl (optional).

const pillarSdk = new PillarSdk({
  apiUrl: 'https://localhost:8080',
  notificationsUrl: 'https://localhost:8081',
  investmentsUrl: 'https://localhost:8082',
});

Input Parameters

NameDescriptionTypeRequired
apiUrlURL where API is hosted. String with URL format. e.g. "http://".StringOptional
notificationsUrlURL where the Notifications Service is hosted. String with URL format. e.g. "http://".StringOptional
investmentsUrlURL where the Investments Service is hosted. String with URL format. e.g. "http://".StringOptional

2 - Register the Wallet

To use backend services, register the wallet:

pillarSdk.wallet.registerAuthServer(inputParams)

Register the wallet in the backend, create the UserProfile table, and register the wallet in BCX(Blockchain Explorer). Wallet can not be created without username.

const inputParams = {
  fcmToken: 'cMctpybZfwyFTyRJBo4omxpgoF2JWf-tlJc8fB0Swrq0z7',
  privateKey: '3eA19bddb978Db62344Ffba5d37Ba41C83C579173eA19bddb978Db62344Ffba5d37Ba41C83C57917',
  username: 'bob123',
};

Input Parameters

NameDescriptionTypeRequired
fcmTokenThe Firebase Cloud Message Token of One Wallet.StringRequired
privateKeyHexadecimal string and 64 characters in length.StringRequired
usernameThe Username of One Wallet.StringRequired

Expected Output

NameOutputType
result'success'String
accessTokeneg. 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiVlx1MDAxNcKbwoNUwoonbFPCu8KhwrYiLCJpYXQiOjE0NDQyNjI1NDMsImV4cCI6MTQ0NDI2MjU2M30.MldruS1PvZaRZIJR4legQaauQ3_DYKxxP2rFnD37Ip4'String
accessTokenExpiresAt'YYYY-mm-ddTHH:MM:ssZ'String
refreshTokeneg. 'fdb8fdbecf1d03ce5e6125c067733c0d51de209c'String,
refreshTokenExpiresAt'YYYY-mm-ddTHH:MM:ssZ'String
fcmTokeneg. 'cMctpybZfwk:APA9arnIbla0UDSDGs_w7buoP2apxFIzI6YUdSFPLe2ANR-OrFiaAvJ'String
walletIde.g. '6e081b82-dbed-4485-bdbc-a808ad911758'UUID
userIde.g. '7e081b82-cabd-3321-aadd-b443212378bd'UUID

Response And Error

To get the response and error for these methods, use:

try {
 const response = await pillarSdk.wallet.registerAuthServer({
   fcmToken: 'cMctpybZfwyFTyRJBo4omxpgoF2JWf-tlJc8fB0Swrq0z7',
   privateKey: '3eA19bddb978Db62344Ffba5d37Ba41C83C579173eA19bddb978Db62344Ffba5d37Ba41C83C57917',
   username: 'bob123'
 });
 // Use successful response
} catch (e) {
 // Handle unsuccessful response
}

Methods

IMPORTANT! All methods return promises.

Wallet Update

pillarSdk.wallet.update(inputParams)

Updates Fcm Token in the backend.

Input Parameters

NameDescriptionTypeRequired
fcmTokenThe Firebase Cloud Message Token of One Wallet.String
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'OK'String

Wallet Register Auth Server

pillarSdk.wallet.registerAuthServer(inputParams)

Register the wallet in the backend, authentication server(OAuth), create the UserProfile table, and register the wallet in BCX(Blockchain Explorer). Wallet can not be created without username.

Input Parameters

NameDescriptionTypeRequired
privateKeyHexadecimal string and 64 characters in length.StringRequired
fcmTokenThe Firebase Cloud Message Token of One Wallet.String
usernameThe Username of One Wallet.StringRequired

Expected Output

NameOutputType
result'success'String
accessTokeneg. 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiVlx1MDAxNcKbwoNUwoonbFPCu8KhwrYiLCJpYXQiOjE0NDQyNjI1NDMsImV4cCI6MTQ0NDI2MjU2M30.MldruS1PvZaRZIJR4legQaauQ3_DYKxxP2rFnD37Ip4'String
accessTokenExpiresAt'YYYY-mm-ddTHH:MM:ssZ'String
refreshTokeneg. 'fdb8fdbecf1d03ce5e6125c067733c0d51de209c'String,
refreshTokenExpiresAt'YYYY-mm-ddTHH:MM:ssZ'String
fcmTokeneg. 'cMctpybZfwk:APA9arnIbla0UDSDGs_w7buoP2apxFIzI6YUdSFPLe2ANR-OrFiaAvJ'String
walletIde.g. '6e081b82-dbed-4485-bdbc-a808ad911758'UUID
userIde.g. '7e081b82-cabd-3321-aadd-b443212378bd'UUID

Wallet Register Address

pillarSdk.wallet.registerAddress(inputParams)

Register the specified blockchain address for notifications and for BCX monitoring

Input Parameters

NameDescriptionTypeRequired
fcmTokenThe Firebase Cloud Message Token of One Wallet.String
walletIdThe Wallet Identifier.UUIDRequired
blockchainAddressThe blockchain address of one walletStringRequired
blockchainThe blockchain environmentString

Expected Output

NameOutputType
result'success'String
message'Successfully registered address on BCX'String

Wallet Unregister Address

pillarSdk.wallet.unregisterAddress(inputParams)

Unregister the specified blockchain address for notifications and for BCX monitoring

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
blockchainAddressThe blockchain address of one walletStringRequired
blockchainThe blockchain environmentString

Expected Output

NameOutputType
result'success'String
message'Successfully unregistered address on BCX'String

Asset Defaults

pillarSdk.asset.defaults(inputParams)

Returns a list of assets that are marked as default assets.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

JSON collection of objects with respective values:

ElementDescriptionType
addressThe Token AddressString
decimalsThe Number of DecimalsInteger
descriptionThe Token DescriptionString
nameThe Token NameString
symbolThe Token Ticker SymbolString
wallpaperUrlOne Predefined Wallpaper For TokenString
iconUrlThe Token IconString
patternUrlThe Token Icon (bigger)String
emailThe Token EmailString
socialMediaThe token's social media.Array
telegramThe Token TelegramString
twitterThe Token TwitterString
websiteThe Token WebsiteString
whitepaperThe Token WhitepaperString
isDefaultisDefault Flag for TokenBoolean
icosIco details of one Token.Array

Smart Wallet Register

pillarSdk.wallet.registerSmartWallet(inputParams)

Register a second wallet in the Backend and register in BCX.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
publicKeyHexadecimal string and 64 characters in length.StringRequired
fcmTokenThe Firebase Cloud Message Token of One Wallet.String
ethAddressThe ethereum Address of target userStringRequired

Expected Output

JSON collection of objects with respective values:

NameOutput/DescriptionType
result'success'String
message'Wallet registered successfully.'String
walletIdThe Wallet IdentifierString
userIdThe User IdentifierInteger
fcmTokenThe Firebase Cloud Message Token of One Wallet.String

Asset Search

pillarSdk.asset.search(inputParams)

Returns a list of assets that contain the search criteria for name, token symbol, or smart contract hexadecimal address.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
querySearch CriteriaStringRequired

Expected Output

JSON collection of objects with respective values:

ElementDescriptionType
addressThe Token AddressString
decimalsThe Number of DecimalsInteger
descriptionThe Token DescriptionString
nameThe Token NameString
symbolThe Token Ticker SymbolString
wallpaperUrlOne Predefined Wallpaper For TokenString
iconUrlThe Token IconString
patternUrlThe Token Icon (bigger)String
emailThe Token EmailString
socialMediaThe token's social media.Array
telegramThe Token TelegramString
twitterThe Token TwitterString
websiteThe Token WebsiteString
whitepaperThe Token WhitepaperString
isDefaultisDefault Flag for TokenBoolean
icosIco details of one Token.Array

Asset List

pillarSdk.asset.list(inputParams)

Returns the full list of assets.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

JSON collection of objects with respective values:

ElementDescriptionType
addressThe Token AddressString
decimalsThe Number of DecimalsInteger
descriptionThe Token DescriptionString
nameThe Token NameString
symbolThe Token Ticker SymbolString
wallpaperUrlOne Predefined Wallpaper For TokenString
iconUrlThe Token IconString
patternUrlThe Token Icon (bigger)String
emailThe Token EmailString
socialMediaThe token's social media.Array
telegramThe Token TelegramString
twitterThe Token TwitterString
websiteThe Token WebsiteString
whitepaperThe Token WhitepaperString
isDefaultisDefault Flag for TokenBoolean
icosIco details of one Token.Array

Connection Invite

pillarSdk.connection.invite(inputParams)

Creates a connection invitation for a user to create a relationship with another contact.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection invitation was successfully sent'String

Connection v2 Invite

pillarSdk.connectionV2.invite(inputParams)

Creates a connection invitation for a user to create a relationship with another contact.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection invitation was successfully sent'String

Connection Accept

pillarSdk.connection.accept(inputParams)

Accepts a connection invitation from another user.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
walletIdThe Wallet Identifier.UUIDRequired
targetUserAccessKeyTarget User Access Key.StringRequired

Expected Output

NameOutputType
result'success'String
message'Connection invitation accepted'String

Connection v2 Accept

pillarSdk.connectionV2.accept(inputParams)

Accepts a connection invitation from another user.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection invitation accepted'String

Connection Reject

pillarSdk.connection.reject(inputParams)

Rejects a connection invitation from another user.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
accessKeyThe Access Key.StringRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection invitation rejected'String

Connection v2 Reject

pillarSdk.connectionV2.reject(inputParams)

Rejects a connection invitation from another user.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection invitation rejected'String

Connection Cancel

pillarSdk.connection.cancel(inputParams)

Cancels a connection invitation from another user.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
accessKeyThe Access Key.StringRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection canceled'String

Connection v2 Cancel

pillarSdk.connectionV2.cancel(inputParams)

Cancels a connection invitation from another user.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection canceled'String

Connection Block

pillarSdk.connection.block(inputParams)

Blocks/unblocks a connection request from another user.

Input Parameters

NameDescriptionTypeRequired
accessKeyThe Access Key.StringRequired
walletIdThe Wallet Identifier.UUIDRequired
targetUserIdThe Contact User Identifier.UUIDRequired
blockTrue/false to block/unblock the connection.BooleanRequired

Expected Output

NameOutputType
result'success'String
message'Connection blocked/accepted'String

Connection v2 Block

pillarSdk.connectionV2.block(inputParams)

Blocks/unblocks future communication from another contact.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
targetUserIdThe Contact User Identifier.UUIDRequired
blockTrue/false to block/unblock the connection.BooleanRequired

Expected Output

NameOutputType
result'success'String
message'Connection status is updated to blocked/accepted'String

Connection v2 Blacklist

pillarSdk.connectionV2.blacklist(inputParams)

Adds/removes a user from another user's blacklist.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
targetUserIdThe Contact User Identifier.UUIDRequired
blacklistTrue/false to add/remove a user to another user's blacklist.BooleanRequired

Expected Output

NameOutputType
result'success'String
message'User successfully added to blacklist.'String

Connection Mute

pillarSdk.connection.mute(inputParams)

Mutes/unmutes future communication from another contact.

Input Parameters

NameDescriptionTypeRequired
accessKeyThe Access Key.StringRequired
walletIdThe Wallet Identifier.UUIDRequired
targetUserIdThe Contact User Identifier.UUIDRequired
muteTrue/false to mute/unmute the connection.BooleanRequired

Expected Output

NameOutputType
result'success'String
message'Connection status is updated to muted/accepted'String

Connection v2 Mute

pillarSdk.connectionV2.mute(inputParams)

Mutes/unmutes future communication from another contact.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
targetUserIdThe Contact User Identifier.UUIDRequired
muteTrue/false to mute/unmute the connection.BooleanRequired

Expected Output

NameOutputType
result'success'String
message'Connection status is updated to muted/accepted'String

Connection Disconnect

pillarSdk.connection.disconnect(inputParams)

Disconnects a connection between two users.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
sourceUserAccessKeySource User Access Key.StringRequired
targetUserAccessKeyTarget User Access Key.StringRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection is successfully disconnected'String

Connection v2 Disconnect

pillarSdk.connectionV2.disconnect(inputParams)

Disconnects a connection between two users.

Input Parameters

NameDescriptionTypeRequired
targetUserIdThe Contact User Identifier.UUIDRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Connection is successfully disconnected'String

Connection Count

pillarSdk.connection.count(inputParams)

Returns the number of connections a user has

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
userIdThe User IdentifierString
currentConnectionsCountThe number of connections with sourceIdentityKeyNumber
oldConnectionsCountThe number of connections to be updated with identity keysNumber
newReceivedConnectonsCountThe number of connections to not be updated with identity keysNumber

Connection Map Identity Keys

pillarSdk.connection.mapIdentityKeys(inputParams)

Returns an array of user's connection mapped by identity keys

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
identityKeysThe Identity Keys of a user.ArrayRequired

Expected Output

NameOutputType
resultA list of connectionsArray

Connection Update Identity Keys

pillarSdk.connection.updateIdentityKeys(inputParams)

Updates the connection's identity keys

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
connectionsThe Connections of a user.ArrayRequired

Expected Output

NameOutputType
resultA list of connectionsArray

Notification List

pillarSdk.notification.list(inputParams);

Provides a list of notifications for a specific wallet user.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
fromTimestampStamp of Date/TimeString (ISO 8601 timestamp format)
typeThe notification typeString
fetchLatestA flag for fetching latest notificationBoolean

Expected Output

NameOutputType
result'success'String

JSON Notifications with respective values::

NameDescriptionType
typeThe User Identifier.UUID
metaThe Sources keys support the payload
payloadThe payload of one notification
createdAtThe unix timestamp of one notification

Investments ICO List

pillarSdk.investments.icoList(inputParams);

Fetch a list of ICOs for a given user.

Input Parameters

NameDescriptionTypeRequired
userIdThe User's IDStringRequired

Expected Output

NameDescriptionType
result'success'String
dataList of ICOs[Asset]

Investments Deposit Request

pillarSdk.investments.depositRequest(inputParams);

Request deposit account information/credentials from service provider.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
currencyThe Currency ticker symbolsStringRequired
serviceProviderThe ICO providersString

Expected Output

JSON Investments with respective values::

NameDescriptionType
accountAccount numberNumber
ibanInternational bank account numberString
bicA bank identifier codeString
referenceReference of bank transferString
beneficiaryThe person or entity who will receive a paymentString
bankNameThe name of the bankString
currencyThe Currency ticker symbolsString

User Create One Time Password

pillarSdk.user.createOneTimePassword(inputParams);

Create a one-time password for email or phone store it on the user record, then send an email or sms to the wallet user.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
smsNotificationIndicates if corresponds sms notification or not. If not present email notification is sendBoolean

Expected Output

NameOutputType
result'success'String
message'One-time password sent.'String
userIdThe User Identifier.UUIDRequired

User Update

pillarSdk.user.update(inputParams);

Updates data elements on a wallet user.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
firstNameThe User's First NameStringOptional
lastNameThe User's Last NameStringOptional
countryThe User's Country Or ResidenceStringOptional
stateThe User's State Of ResidenceStringOptional
cityThe User's City of ResidenceStringOptional
emailThe User's Email AddressStringOptional
phoneThe User's Phone NumberStringOptional
taglineThe User's profile taglineStringOptional
taglineStatusWhether the user has completed a tagline for their profileBooleanOptional
userSearchableWhether the user's profile is searchable in the address bookBooleanOptional
profileImageThe Profile Image of the userString(Url)Optional
betaProgramParticipantFlag to check if user is beta program participantBooleanOptional

Expected Output

NameOutputType
result'success'String
message'User was successfully updated'String

JSON collection of objects with respective values:

ElementDescriptionType
idThe User IdentifierUUID
usernameThe UsernameString
firstNameThe User's First NameString
lastNameThe User's Last NameString
emailThe User's Email AddressString
isEmailVerifiedFlag to Determine If Email Address Is VerifiedBoolean
emailOneTimePasswordFive Digit One Time PasswordString
phoneThe User's PhoneString
isPhoneVerifiedFlag to Determine If Phone Number Is VerifiedString
phoneOneTimePasswordFive Digit One Time PasswordBoolean
countryThe user's country or residenceString
stateThe user's state of residenceString
cityThe user's city of residenceString
phoneThe user's phone numberString
taglineThe user's profile taglineString
taglineStatusWhether the user has completed a tagline for their profileBoolean
userSearchableWhether the user's profile is searchable in the address bookBoolean
profileImageThe profile image of the userString(Url)
icoServiceInformation related to the user's account with a service provider for ICOs.Object
statusThe user status in the system.String
betaProgramParticipantFlag to check if user is beta program participantBoolean

User Update Notification Preferences

pillarSdk.user.updateNotificationPreferences(inputParams);

Update notification preferences for given user.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
newOfferActivate/Deactivate notification when user receives offersBooleanOptional
newReceiptActivate/Deactivate notification when user receives receiptBooleanOptional
paymentConfirmationActivate/Deactivate notification when payment is confirmedBooleanOptional
paymentStatusUpdateActivate/Deactivate notification whenever the status of payment changesBooleanOptional
profileUpdateActivate/Deactivate notification when user profile where updatedBooleanOptional
fundsDepositActivate/Deactivate notification when funds were deposited in user accountBooleanOptional
transactionEventActivate/Deactivate notification for user transactionsBooleanOptional

Expected Output

NameOutputType
result'success'String
message'Notification preferences were successfully created'String

JSON object with respective values:

ElementDescriptionType
userIdThe User IdentifierUUID
newOfferActivate/Deactivate notification when user receives offersBooleanOptional
newReceiptActivate/Deactivate notification when user receives receiptBooleanOptional
paymentConfirmationActivate/Deactivate notification when payment is confirmedBooleanOptional
paymentStatusUpdateActivate/Deactivate notification whenever the status of payment changesBooleanOptional
profileUpdateActivate/Deactivate notification when user profile where updatedBooleanOptional
fundsDepositActivate/Deactivate notification when funds were deposited in user accountBooleanOptional
transactionEventActivate/Deactivate notification for user transactionsBooleanOptional

User Map Contacts Addresses

pillarSdk.user.mapContactsAddresses(inputParams);

Maps contacts smart wallet addresses for given user.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
contactsAn array of contact user information object (contactId, accessKeys?, connectionKeys?)ArrayOptional

Expected Output

JSON array with respective values:

ElementDescriptionType
userIdThe Contact User IdentifierUUID
smartWalletsAn array of smart wallet addresses for the contact userArrayRequired

User Image by User Id

 pillarSdk.user.imageByUserId(inputParams);

Get user's profile image using user's ID

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
userIdThe User IdentifierUUIDRequired

Expected Output

Redirects to an hosted image.

User Upload Profile Image

 pillarSdk.user.uploadProfileImage(inputParams);

Saves or updates user's profile image.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'Profile image was successfully uploaded'String
profileImageImage UrlString

User Profile Image

 pillarSdk.user.profileImage(inputParams);

Get user's profile image.

Input Parameters

NameDescriptionTypeRequired
imageNameThe User Image Identifier.StringRequired

Expected Output

Redirects to an hosted image.

User Info

pillarSdk.user.info(inputParams);

Retrieves information on an existing wallet user.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

JSON collection of objects with respective values:

ElementDescriptionType
idThe User IdentifierUUID
usernameThe UsernameString
firstNameThe User's First NameString
lastNameThe User's Last NameString
emailThe User's Email AddressString
isEmailVerifiedFlag to Determine If Email Address Is VerifiedBoolean
phoneThe User's PhoneString
isPhoneVerifiedFlag to Determine If Phone Number Is VerifiedString
countryThe user's country or residenceString
stateThe user's state of residenceString
cityThe user's city of residenceString
emailThe user's email addressString
taglineThe user's profile taglineString
taglineStatusWhether the user has completed a tagline for their profileBoolean
userSearchableWhether the user's profile is searchable in the address bookBoolean
profileImageThe profile image of the userString(Url)
betaProgramParticipantFlag to check if user is beta program participantBoolean
featureFlagsObject with features flagsObject

User Info Smart Wallet

pillarSdk.user.infoSmartWallet(inputParams);

Retrieve information from a user and his wallets

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

JSON collection of objects with respective values:

ElementDescriptionType
userAn object with information related to the userObject
walletsAn array containing the user's walletsArray

User Info by Id

 pillarSdk.user.infoById(inputParams);

Provides the user data by the target user id and users access keys

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
userAccessKeyThe current user access keystringRequired
targetUserAccessKeyThe current user access keystringRequired

Expected Output

NameOutputType
ethAddressThe ethereum Address of target userString
idThe target user IdentifierUUID
usernameThe target user UsernameString
firstNameThe target user's First NameString
lastNameThe target user's Last NameString
countryThe target user's country or residenceString
stateThe target user's state of residenceString
cityThe target user's city of residenceString
profileImageThe profile image of the userString(Url)

User Search

pillarSdk.user.search(inputParams);

Provides a list of users that contain the search criteria for first or last name, and is not the current wallet user. Also checks if the search string term is at least two characters and if the user allows their profile to be searched.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired
queryThe Search StringStringRequired

Expected Output

ElementDescriptionType
idThe User IdentifierUUID
usernameThe UsernameString
firstNameThe User's First NameString
lastNameThe User's Last NameString
countryThe user's country or residenceString
stateThe user's state of residenceString
cityThe user's city of residenceString
profileImageThe profile image of the userString(Url)

User Delete

 pillarSdk.user.delete(inputParams);

Removes a wallet user profile from the database.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

NameOutputType
result'success'String
message'User was successfully deleted'String

User Delete Profile Image

 pillarSdk.user.deleteProfileImage(inputParams);

Removes user profile Image from the database.

Input Parameters

NameDescriptionTypeRequired
walletIdThe Wallet Identifier.UUIDRequired

Expected Output

HTTP status 204: No Content

User Username Search

pillarSdk.user.usernameSearch(inputParams);

Retrieve the userId of an existing wallet user or return not-found. Returns an error message if the username is Inappropriate.

Input Parameters

NameDescriptionTypeRequired
usernameWallet UsernameStringRequired

Expected Output

NameDescriptionTypeRequired
userIdThe User IdentifierUUIDRequired

Expected Output for Inappropriate username

NameValue
errorBad Request
messageInappropriate username
statusCode400

User Validate (deprecated)

pillarSdk.user.validate(inputParams);

Retrieve the id of an validated wallet user.

Input Parameters

NameDescriptionTypeRequired
usernameWallet UsernameStringOne of username/blockchainAddress required
blockchainAddressUser's blockchainAddressStringOne of username/blockchainAddress required

Expected Output

NameDescriptionType
idThe wallet IdentifierUUID
usernameThe UsernameString
walletIdThe wallet IdentifierUUID

User v2 Validate

pillarSdk.userV2.validate(inputParams, privateKey);

Validates a blockchain address, and returns user and wallet information

Input Parameters

NameDescriptionTypeRequired
publicKeyWallet's publicKeyStringrequired
blockchainAddressUser's blockchainAddressStringrequired
privateKeyWallet's privateKeyStringrequired

Expected Output

NameDescriptionType
usernameThe UsernameString
walletIdThe wallet IdentifierUUID
profileImageUser's profile imageString

User Validate Email

pillarSdk.user.validateEmail(inputParams);

Validate a one-time password sent via email.

Input Parameters

NameDescriptionTypeRequired
walletIdThe wallet IdentifierUUIDRequired
oneTimePasswordUser's one time passwordStringRequired

Expected Output

NameDescriptionType
result'success'String
message'Email validated.'String
userIdThe user IdentifierUUID

User Validate Phone

pillarSdk.user.validatePhone(inputParams);

Validate a one-time password sent via SMS.

Input Parameters

NameDescriptionTypeRequired
walletIdThe wallet IdentifierUUIDRequired
oneTimePasswordUser's one time passwordStringRequired

Expected Output

NameDescriptionType
result'success'String
message'Phone validated.'String
userIdThe user IdentifierUUID

User Support Hmac

pillarSdk.user.supportHmac(inputParams);

Input Parameters

NameDescriptionTypeRequired
projectIdentifies the app project, "android" or ios"StringRequired

Expected Output

NameDescriptionType
status'success'String
hmacHMAC for Intercom'String

Referral List

pillarSdk.referral.list(inputParams);

Returns a list of referral invitations

Input Parameters

NameDescriptionTypeRequired
walletIdThe wallet IdentifierUUIDRequired

Expected Output

NameDescriptionType
result'success'String
dataList of Referral InvitationsArray

Referral Send Invitation

pillarSdk.referral.sendInvitation(inputParams);

Sends an invitation through Email or SMS

Input Parameters

NameDescriptionTypeRequired
walletIdThe wallet IdentifierUUIDRequired
referralLinkThe Branch.io link to invite the userStringRequired
emailThe user's email address to send the invitationStringOptional
phoneThe user's phone to send the invitationStringOptional

Expected Output

NameDescriptionType
result'success'String
message'Invitation sent'String
rewardObject with token and amountObject

Referral Generate Token

pillarSdk.referral.generateToken(inputParams);

Generates a referral token invitation

Input Parameters

NameDescriptionTypeRequired
walletIdThe wallet IdentifierUUIDRequired

Expected Output

NameDescriptionType
result'success'String
token'Generated Token'String

Types

Asset

NameDescriptionType
idAsset IDUUID
nameAsset nameString
symbolAsset symbolString
addressEthereum address of the AssetString
decimalsThe number of decimals of the AssetNumber
descriptionAsset descriptionString
wallpaperUrlAsset wallpaper URLString (URL)
iconUrlIcon URLString (URL)
emailContact email address for AssetString (Email)
socialMediaA list of social media services[SocialMedia]
websiteWebsite address of AssetString (URL)
whitepaperAsset whitepaperString (URL)
isDefaultDefault token ???Boolean
icosList of ICO phases[ICO]

SocialMedia

NameDescriptionType
serviceThe social network serviceString
usernameThe social network accountString

ICO

NameDescriptionType
icoStatus'PENING', 'ACTIVE', 'CLOSED'String
icoPhaseThe phase of the ICOString
icoAddressThe smart contract address of the ICOString
minimumContributionThe minimum contribution in the base currency needed to invest in the ICONumber
maximumContributionThe maximum contribution in the base currency allowed to invest in the ICONumber
baseCurrencyThe currency of the ICOString
unitPriceThe price per unit in the base currencyNumber
totalSupplyThe total number of units availableNumber
totalLockedThe total number of units reserved and purchasedNumber
supportedCurrenciesA comma separated list of accepted currenciesString
icoStartingBlockNumberThe ICO's starting block numberNumber
plannedOpeningDateThe planned opening date of the ICODate
icoEndingBlockNumberThe ICO's ending block numberNumber
plannedClosingDateThe planned closing date of the ICODate
nationalityRestrictionIndicates if there's a nationality restrictionBoolean
nivauraProjectIdThe ICO ID in the ICO ServiceNumber
linksICO related links[ICOLink]

ICOLink

NameDescriptionType
nameThe name of the resource, i.e. WhitepaperString
urlThe link to the resourceString (URL)

Tests

Run the test:

npm test

or:

jest

Coding Style Guide

We use the TSLint Config Airbnb Style Guide.

Versioning

We use Swagger for versioning.

License

This project is licensed under the MIT license.

Acknowledgments

We use the Pillar Authentication SDK to create signatures.

1.48.1899

4 years ago

1.48.1890

5 years ago

1.48.1885

5 years ago

1.48.1880

5 years ago

0.0.8-133

7 years ago

0.0.8-125

7 years ago

0.0.8-122

7 years ago

0.0.8-110

7 years ago

0.0.8

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago