Skip to main content

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

walletId string

ID of the Wallet


createdAt string

ISO 8601


sourceTransaction Transaction

The Transaction object created on the source Balance


destinationTransaction Transaction

The Transaction object created on the destination Balance

Exchange Funds

let exchange = await solidtx.transactions.exchange({
walletId: 'wallet_yxeh6q5mmpik8w6cyvc9zcnn',

sourceBalanceId: 'cash',
sourceAmount: '-10',

destinationBalanceId: 'gems',
destinationAmount: '500'
})

Parameters


walletId stringRequired

ID of the Wallet


sourceBalanceId stringRequired

ID of the source Balance


sourceAmount stringRequired
The amount to add to the source balance

destinationBalanceId stringRequired

ID of the destination 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

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

// Search all Exchanges in a Wallet
let exchanges = await solidtx.exchanges.search({
walletId: 'wallet_yxeh6q5mmpik8w6cyvc9zcnn'
})

Parameters


walletId stringRequired

after string

The previous endCursor.

See Pagination.


take number

The maximum number of results to return. Default: 50

See Pagination.

Returns

Returns a list of Exchange objects with Pagination information.

{
"pageInfo": {
"endCursor": "...",
"totalCount": 17
},
"data": [
// Exchange objects
]
}