Exchanges
Exchanges are Transactions that move amounts between balances in the same Wallet. They can be used, for example, to exchange a cash balance for gems or the other way around.
The Exchange Object
id string
createdAt string
ISO 8601
Exchange Funds
- TypeScript / JavaScript
let exchange = await solidtx.transactions.exchange({
walletId: 'wallet_yxeh6q5mmpik8w6cyvc9zcnn',
sourceBalanceId: 'cash',
sourceAmount: '-10',
destinationBalanceId: 'gems',
destinationAmount: '500'
})
Parameters
sourceAmount stringRequired
The amount to add to the source balance
destinationAmount stringRequired
The amount to add to the destination balance
Returns
Creates and returns an Exchange object.
{
"id": "exchange_cm8p6demf00040cl6228g3k44",
"walletId": "wallet_yxeh6q5mmpik8w6cyvc9zcnn",
"createdAt": "2025-01-01T12:00:00Z",
"sourceTransaction": {
"id": "transaction_cm8p024g600010cl77lq6ahqa",
"walletId": "wallet_yxeh6q5mmpik8w6cyvc9zcnn",
"balanceId": "cash",
"type": "EXCHANGE",
"amount": "-10"
},
"destinationTransaction": {
"id": "transaction_cm8p6bhjg00030cl65yp07f0h",
"walletId": "wallet_yxeh6q5mmpik8w6cyvc9zcnn",
"balanceId": "gems",
"type": "EXCHANGE",
"amount": "100"
}
}
Get an Exchange
- TypeScript / JavaScript
let exchange = await solidtx.exchanges.get('exchange_cm8p6demf00040cl6228g3k44')
Parameters
No Parameters
Returns
Returns the Exchange object.
{
"id": "exchange_cm8p6demf00040cl6228g3k44",
"walletId": "wallet_yxeh6q5mmpik8w6cyvc9zcnn",
"createdAt": "2025-01-01T12:00:00Z",
"sourceTransaction": {
"id": "transaction_cm8p024g600010cl77lq6ahqa",
"walletId": "wallet_yxeh6q5mmpik8w6cyvc9zcnn",
"balanceId": "cash",
"type": "EXCHANGE",
"amount": "-10"
},
"destinationTransaction": {
"id": "transaction_cm8p6bhjg00030cl65yp07f0h",
"walletId": "wallet_yxeh6q5mmpik8w6cyvc9zcnn",
"balanceId": "gems",
"type": "EXCHANGE",
"amount": "100"
}
}
Search Exchanges
- TypeScript / JavaScript
// Search all Exchanges in a Wallet
let exchanges = await solidtx.exchanges.search({
walletId: 'wallet_yxeh6q5mmpik8w6cyvc9zcnn'
})
Parameters
walletId stringRequired
Returns
Returns a list of Exchange objects with Pagination information.
{
"pageInfo": {
"endCursor": "...",
"totalCount": 17
},
"data": [
// Exchange objects
]
}