Balances
Balances are global and apply to every Wallet. When a new Balance is created, it is immediately available to all Wallets with an initial amount of 0 if not otherwise specified.
The Balance Object
A slug of the balance or some other unique identifier. Used to easily reference the balance.
Examples: "cash", "pendingCash", "credits", "goldCoins", "gems". Must be unique.
The name of the balance for display purposes.
Examples: "Cash", "Pending Cash", "Credits", "Gold Coins", or "Gems". Must be unique.
The initial amount set for all wallets. (Default: 0)
ISO 8601
ISO 8601
Create a Balance
- TypeScript / JavaScript
let balance = await solidtx.balances.create({
id: 'gems',
name: 'Gems',
currencyCode: 'GEM',
initialAmount: '1000'
})
Parameters
The currency code for the balance.
An initial amount to set for all wallets. (Default: 0)
Returns
Creates and returns a new Balance object.
{
"id": "gems",
"name": "Gems",
"currencyCode": "GEM",
"initialAmount": "1000"
}
Get a Balance
- TypeScript / JavaScript
let balance = await solidtx.balances.get('gems')
Parameters
No Parameters
Returns
Returns the Balance object.
{
"id": "gems",
"name": "Gems",
"currencyCode": "GEM",
"initialAmount": "1000"
}
Update a Balance
- TypeScript / JavaScript
let balance = await solidtx.balances.update({
id: 'gems',
initialAmount: '1000'
})
Parameters
The amount new Wallets will receive
Returns
Returns the Balance object.
{
"id": "gems",
"name": "Gems",
"currencyCode": "GEM",
"initialAmount": "1000"
}