Common-model is a utility that aims to be a shared package to facilitate data manipulation across different APIs.
Run npm run generateReadme
to parse the code for JSDoc comment blocks and recreate this README.md file.
Run npm i @pillarwallet/common-models
Then npm i mongoose@5.x -E
Instantiate a model with options:
const options =
{
username: 'myUserName',
};
const { platform } = require('@pillarwallet/common-models');
// Create user model
const user = new platform.User(options);
- AccessTokenBackup :
object
AccessTokenBackup model maps to a MongoDB collection and defines the shape of the document.
- AccessTokenBlacklist :
object
AccessTokenBlacklist model maps to a MongoDB collection and defines the shape of the document.
- Asset :
object
Asset model maps to a MongoDB collection and defines the shape of the document.
- Badge :
object
Badge model maps to a MongoDB collection and defines the shape of the document.
- BadgeAward :
object
BadgeAward model maps to a MongoDB collection and defines the shape of the document.
- Blacklist :
object
Blacklist model maps to a MongoDB collection and defines the shape of the document.
- BlacklistedUsernames :
object
BlacklistedUsernames model maps to a MongoDB collection and defines the shape of the document.
- BtcDeposit :
object
BtcDeposit model maps to a MongoDB collection and defines the shape of the document.
- Connection :
object
Connection model maps to a MongoDB collection and defines the shape of the document.
- IpfsStorage :
object
IpfsStorage model maps to a MongoDB collection and defines the shape of the document.
- Notification :
object
Notification model maps to a MongoDB collection and defines the shape of the document.
- NotificationPreferences :
object
NotificationPreferences model maps to a MongoDB collection and defines the shape of the document.
- NotificationType :
object
NotificationType model maps to a MongoDB collection and defines the shape of the document.
- ReferralCampaign :
object
ReferralCampaign model maps to a MongoDB collection and defines the shape of the document.
- ReferralDevice :
object
ReferralDevice model maps to a MongoDB collection and defines the shape of the document.
- ReferralInvitation :
object
ReferralInvitation model maps to a MongoDB collection and defines the shape of the document.
- ReferralTransaction :
object
ReferralTransaction model maps to a MongoDB collection and defines the shape of the document.
- Register :
object
Register model
- Story :
object
Story model maps to a MongoDB collection and defines the shape of the document.
- StoryPage :
object
StoryPage model maps to a MongoDB collection and defines the shape of the document.
- User :
object
User model maps to a MongoDB collection and defines the shape of the document.
- UserFeatureFlags :
object
UserFeatureFlags model maps to a MongoDB collection and defines the shape of the document.
- Wallet :
object
Wallet model maps to a MongoDB collection and defines the shape of the document.
AccessTokenBackup model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- AccessTokenBackup :
object
- ~userId :
String
- ~contactId :
String
- ~accessKey :
String
- ~userId :
The user identifier.
Kind: inner property of AccessTokenBackup
Required:
The contact identifier.
Kind: inner property of AccessTokenBackup
Required:
Unique identifier for each connection.
Kind: inner property of AccessTokenBackup
Required:
AccessTokenBlacklist model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
A user's valid access token.
Kind: inner property of AccessTokenBlacklist
Required:
Asset model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- Asset :
object
- ~address :
String
- ~decimals :
Number
- ~description :
String
- ~name :
String
- ~symbol :
String
- ~wallpaperUrl :
String
- ~iconUrl :
String
- ~iconMonoUrl :
String
- ~patternUrl :
String
- ~email :
String
~telegram~twitter- ~socialMedia :
Array
- ~website :
String
- ~whitepaper :
String
- ~isDefault :
Boolean
- ~isPreferred :
Boolean
- ~totalSupply :
String
- ~icos :
Array
- ~isSynthetixAsset :
Boolean
- ~address :
The smart contract address.
Kind: inner property of Asset
Unique:
Required:
Refers to how divisible a token can be.
Kind: inner property of Asset
Required:
Simple description of one Token.
Kind: inner property of Asset
Name by which the token contract should be known.
Kind: inner property of Asset
Required:
Unique:
Symbol by which the token contract should be known, it is broadly equivalent to a stock ticker.
Kind: inner property of Asset
Required:
Unique:
The token's predefined background image.
Kind: inner property of Asset
The token's predefined icon image.
Kind: inner property of Asset
The token's predefined mono icon image.
Kind: inner property of Asset
The token's predefined icon image (bigger).
Kind: inner property of Asset
The token's email.
Kind: inner property of Asset
Deprecated
Kind: inner property of Asset
Deprecated
Kind: inner property of Asset
The token's social media.
Kind: inner property of Asset
The token's website.
Kind: inner property of Asset
The token's whitepaper.
Kind: inner property of Asset
One flag to check if the Token is default on the wallet.
Kind: inner property of Asset
A flag to indicate preferred tokens within the system.
Kind: inner property of Asset
Kind: inner property of Asset
Ico details of one Token.
Kind: inner property of Asset
A boolean flag to indicate whether this is a Synthetix asset
Kind: inner property of Asset
Badge model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- Badge :
object
- ~name :
String
- ~type :
String
- ~imageUrl :
String
- ~subtitle :
String
- ~description :
String
- ~selfAward :
Boolean
- ~name :
Name by which the badge should be known.
Kind: inner property of Badge
Required:
Badge type by which backend could find particular badge.
Kind: inner property of Badge
Required:
Unique:
Image url of the badge.
Kind: inner property of Badge
Optional subtitle of the badge.
Kind: inner property of Badge
Simple description of one badge.
Kind: inner property of Badge
A flag to indicate if the badge could be self awarded.
Kind: inner property of Badge
BadgeAward model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- BadgeAward :
object
- ~badge :
String
- ~badgeType :
String
- ~userId :
String
- ~walletId :
String
- ~badge :
Badge id.
Kind: inner property of BadgeAward
Required:
Badge type.
Kind: inner property of BadgeAward
Required:
User Id.
Kind: inner property of BadgeAward
Required:
Wallet Id.
Kind: inner property of BadgeAward
Required:
Blacklist model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- Blacklist :
object
- ~userId :
String
- ~targetUserId :
String
- ~userId :
The user identifier.
Kind: inner property of Blacklist
Required:
The blacklisted user identifier.
Kind: inner property of Blacklist
Required:
BlacklistedUsernames model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
The blacklisted username.
Kind: inner property of BlacklistedUsernames
Unique:
Required:
BtcDeposit model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- BtcDeposit :
object
- ~status :
String
- ~nonce :
String
- ~txHash :
String
- ~ethereumTxHash :
String
- ~method :
String
- ~amount :
Number
- ~exchangeRate :
Number
- ~slippage :
Number
- ~sender :
String
- ~destination :
String
- ~gateway :
String
- ~nHash :
String
- ~signature :
String
- ~vOut :
Number
- ~confirmations :
Number
- ~status :
The status of the deposit [awaiting, received, submitted].
Kind: inner property of BtcDeposit
Required:
The nonce of the deposit.
Kind: inner property of BtcDeposit
Required:
Hash of the transaction.
Kind: inner property of BtcDeposit
Required:
Hash of the ethereum transaction.
Kind: inner property of BtcDeposit
Required:
The method [mint, burn].
Kind: inner property of BtcDeposit
Required:
The transaction amount.
Kind: inner property of BtcDeposit
The minimum exchange rate.
Kind: inner property of BtcDeposit
The maximum slippage.
Kind: inner property of BtcDeposit
The sender address.
Kind: inner property of BtcDeposit
Required:
The destination address.
Kind: inner property of BtcDeposit
Required:
The gateway address.
Kind: inner property of BtcDeposit
Required:
The deposit nhash.
Kind: inner property of BtcDeposit
Required:
The deposit signature.
Kind: inner property of BtcDeposit
Required:
The deposit vOut.
Kind: inner property of BtcDeposit
Required:
The number of confirmations.
Kind: inner property of BtcDeposit
Required:
Connection model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- Connection :
object
- ~userId :
String
- ~accessKey :
String
- ~status :
String
- ~sourceIdentityKey :
String
- ~targetIdentityKey :
String
- ~targetUserId :
String
- ~direction :
String
- ~version :
String
- ~userId :
The user identifier.
Kind: inner property of Connection
Required:
Unique identifier for each connection.
Kind: inner property of Connection
Required:
The status of each connection.
Kind: inner property of Connection
Required:
The sourceIdentityKey of each connection.
Kind: inner property of Connection
Unique:
The targetIdentityKey of each connection.
Kind: inner property of Connection
Unique:
The target user identifier.
Kind: inner property of Connection
The direction of the connection.
Kind: inner property of Connection
Connections supoort version.
Kind: inner property of Connection
IpfsStorage model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- IpfsStorage :
object
- ~walletId :
String
- ~storageId :
String
- ~secretKey :
String
- ~walletId :
The id of the wallet.
Kind: inner property of IpfsStorage
Required:
The id of the IPFS storage.
Kind: inner property of IpfsStorage
Required:
Unique:
Secret key for the IPFS storage.
Kind: inner property of IpfsStorage
Required:
Unique:
Notification model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- Notification :
object
The type of one notification.
Kind: inner property of Notification
Required:
Additional important information about one notification.
Kind: inner property of Notification
Required:
The content of one notification.
Kind: inner property of Notification
Required:
NotificationPreferences model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- NotificationPreferences :
object
- ~userId :
String
- ~newOffer :
Boolean
- ~newReceipt :
Boolean
- ~paymentConfirmation :
Boolean
- ~paymentStatusUpdate :
Boolean
- ~profileUpdate :
Boolean
- ~fundsDeposit :
Boolean
- ~transactionEvent :
Boolean
- ~userId :
The user identifier.
Kind: inner property of NotificationPreferences
Required:
Unique:
One flag for newOffer notification.
Kind: inner property of NotificationPreferences
Required:
One flag for newReceipt notification.
Kind: inner property of NotificationPreferences
Required:
One flag for paymentConfirmation notification.
Kind: inner property of NotificationPreferences
Required:
One flag for paymentStatusUpdate notification.
Kind: inner property of NotificationPreferences
Required:
One flag for profileUpdate notification.
Kind: inner property of NotificationPreferences
Required:
One flag for fundsDeposit notification.
Kind: inner property of NotificationPreferences
Required:
One flag for transactionEvent notification.
Kind: inner property of NotificationPreferences
Required:
NotificationType model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- NotificationType :
object
The type of one notification.
Kind: inner property of NotificationType
Required:
Unique:
The name of one notification.
Kind: inner property of NotificationType
Required:
Actions related with one notification.
Kind: inner property of NotificationType
Required:
ReferralCampaign model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- ReferralCampaign :
object
- ~name :
String
- ~token :
String
- ~contractAddress :
String
- ~wallet :
Object
- ~logoUrl :
String
- ~badges :
Boolean
- ~isActive :
Boolean
- ~relatedCampaigns :
[ 'Array' ].<String>
- ~name :
Name of the campaign.
Kind: inner property of ReferralCampaign
Required:
Unique:
Default token issued for the campaign.
Kind: inner property of ReferralCampaign
Required:
Contract address of the default token.
Kind: inner property of ReferralCampaign
Required:
The reward wallet.
Kind: inner property of ReferralCampaign
Required:
Logo URL to S3.
Kind: inner property of ReferralCampaign
Flag indicating if the campaign should issue badges.
Kind: inner property of ReferralCampaign
Flag indicating if the campaign is active.
Kind: inner property of ReferralCampaign
An array of related campaigns.
Kind: inner property of ReferralCampaign
ReferralDevice model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- ReferralDevice :
object
- ~deviceInfo :
String
- ~deviceOs :
String
- ~firstInstall :
String
- ~deviceInfo :
Device info stored as checksum.
Kind: inner property of ReferralDevice
Unique:
Required:
Device OS.
Kind: inner property of ReferralDevice
Required:
Flag for first install.
Kind: inner property of ReferralDevice
Required:
ReferralInvitation model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- ReferralInvitation :
object
Default amount to reward.
Kind: inner property of ReferralInvitation
The user identifier of the inviter.
Kind: inner property of ReferralInvitation
Required:
Email of the invited person.
Kind: inner property of ReferralInvitation
Phone of the invited person.
Kind: inner property of ReferralInvitation
Flag indicating if the user claimed the reward.
Kind: inner property of ReferralInvitation
The user identifier of the invited user.
Kind: inner property of ReferralInvitation
Token generated by Platform-Core API, to validate Branch.io webhooks.
Kind: inner property of ReferralInvitation
Required:
Flag indicating if it is a partner campaign.
Kind: inner property of ReferralInvitation
The campaign identifier.
Kind: inner property of ReferralInvitation
The amount to reward.
Kind: inner property of ReferralInvitation
Flag indicating if the user has been notified when the campaign has been terminated.
Kind: inner property of ReferralInvitation
ReferralTransaction model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- ReferralTransaction :
object
- ~name :
String
- ~ethAddress :
String
- ~txHash :
String
- ~amount :
Number
- ~asset :
String
- ~name :
The status of the transaction [confirmed, failed].
Kind: inner property of ReferralTransaction
Required:
Address of the user to be rewarded.
Kind: inner property of ReferralTransaction
Required:
Hash of the transaction.
Kind: inner property of ReferralTransaction
Required:
The amount of PLR for the reward.
Kind: inner property of ReferralTransaction
Required:
Asset symbol.
Kind: inner property of ReferralTransaction
Register model
Kind: global namespace
- Register :
object
- ~authorizationCode :
String
- ~nonce :
String
- ~nonceExpiry :
String
- ~publicKey :
String
- ~uuid :
String
- ~walletId :
String
- ~authorizationCode :
Authorisation code generated by platform-authentication
Kind: inner property of Register
A one time code for a request between the wallet and platform-core
Kind: inner property of Register
Required:
The expiry of the nonce
Kind: inner property of Register
Required:
The public key of a wallet
Kind: inner property of Register
Required:
A random unique identifier used for the registration process
Kind: inner property of Register
Required:
The ID of a wallet that's created as part of the registration flow
Kind: inner property of Register
Story model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- Story :
object
- ~shortTitle :
String
- ~imageUrl :
String
- ~imageMonoUrl :
String
- ~active :
Boolean
- ~topic :
String
- ~title :
String
- ~likes :
Number
- ~shortTitle :
Short title of the story.
Kind: inner property of Story
Required:
The story's preview image.
Kind: inner property of Story
The story's preview mono image.
Kind: inner property of Story
Flag to enable/disable the story preview.
Kind: inner property of Story
Topic for the story page.
Kind: inner property of Story
Required:
Title of the story page.
Kind: inner property of Story
Required:
Counter for the likes of a story page.
Kind: inner property of Story
StoryPage model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- StoryPage :
object
- ~storyId :
String
- ~pageNumber :
Number
- ~body :
String
- ~imageUrl :
String
- ~imageMonoUrl :
String
- ~layoutType :
String
- ~backgroundColor :
String
- ~textContrast :
String
- ~storyId :
ID of the story to which the page belongs.
Kind: inner property of StoryPage
Number of the page in a story.
Kind: inner property of StoryPage
Body text of the story page.
Kind: inner property of StoryPage
The story's uploaded image.
Kind: inner property of StoryPage
The story's uploaded mono image.
Kind: inner property of StoryPage
Predefined layout type for the story page.
Kind: inner property of StoryPage
Required:
Background color value.
Kind: inner property of StoryPage
Text Contrast.
Kind: inner property of StoryPage
User model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- User :
object
- ~username :
String
- ~registrationId :
String
- ~firstName :
String
- ~lastName :
String
- ~email :
String
- ~isEmailVerified :
Boolean
- ~emailOneTimePassword :
String
- ~phone :
String
- ~isPhoneVerified :
Boolean
- ~phoneOneTimePassword :
String
- ~country :
String
- ~state :
String
- ~city :
String
- ~userSearchable :
Boolean
- ~tagline :
String
- ~taglineStatus :
Boolean
- ~profileImage :
String
- ~icoService :
Object
- ~status :
String
- ~secretId :
String
- ~betaProgramParticipant :
Boolean
- ~lastSeen :
Date
- ~username :
The username.
Kind: inner property of User
Required:
Unique:
The user's registration Id.
Kind: inner property of User
The user's first name.
Kind: inner property of User
The user's last name.
Kind: inner property of User
The user's email.
Kind: inner property of User
One flag to check user's email.
Kind: inner property of User
The user's email one time password.
Kind: inner property of User
The user's phone.
Kind: inner property of User
One flag to check user's phone.
Kind: inner property of User
The user's phone one time password.
Kind: inner property of User
The user's country.
Kind: inner property of User
The user's state.
Kind: inner property of User
The user's city.
Kind: inner property of User
One flag to check if user is searchable.
Kind: inner property of User
The user's tagline.
Kind: inner property of User
One flag to check if user's tagline is displayable.
Kind: inner property of User
The user's profileImage.
Kind: inner property of User
Information related to the user's account with a service provider for ICOs.
Kind: inner property of User
The user status in the system.
Kind: inner property of User
The user secretId.
Kind: inner property of User
Required:
One flag to check if user is beta program participant.
Kind: inner property of User
A timestamp with user last activity
Kind: inner property of User
UserFeatureFlags model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- UserFeatureFlags :
object
- ~userId :
String
- ~smartWallet :
Boolean
- ~bitcoin :
Boolean
- ~userId :
The user identifier.
Kind: inner property of UserFeatureFlags
Required:
Unique:
One flag for Smart Wallet support.
Kind: inner property of UserFeatureFlags
One flag for Bitcoin support.
Kind: inner property of UserFeatureFlags
Wallet model maps to a MongoDB collection and defines the shape of the document.
Kind: global namespace
Param |
---|
schema |
- Wallet :
object
- ~publicKey :
String
- ~userId :
String
- ~ethAddress :
String
- ~fcmToken :
String
- ~signalRegistrationId :
String
- ~bcxRegistered :
Boolean
- ~blocknativeRegistered :
Boolean
- ~type :
String
- ~disabled :
Boolean
- ~recovery :
Boolean
- ~publicKey :
The public Key of one user.
Kind: inner property of Wallet
Required:
The user identifier.
Kind: inner property of Wallet
Required:
The ethereum address of one user.
Kind: inner property of Wallet
Required:
Unique:
The fcm identifier of one user.
Kind: inner property of Wallet
The user's signal identifier.
Kind: inner property of Wallet
One flag to check BCX registration.
Kind: inner property of Wallet
One flag to check Blocknative address registration.
Kind: inner property of Wallet
The type of the wallet.
Kind: inner property of Wallet
A flag indicating if the wallet is disabled or not.
Kind: inner property of Wallet
Required:
A flag indicating if the wallet is recovery wallet or not.
Kind: inner property of Wallet
Required: