Skip to content

Commit d461bee

Browse files
committed
Update sideshift plugin with new optional API fields
Sideshift's API now returns optional settledAt, deposit/settle contract addresses, deposit/settle hashes, and deposit/settle EVM chain IDs. Capture these in the asSideshiftTx cleaner and wire depositTxid/payoutTxid from the new deposit/settle hashes. The remaining new fields are available on rawTx. Recreates #208 (external fork PR) onto current master.
1 parent 458438a commit d461bee

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/partners/sideshift.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
asArray,
33
asMaybe,
4+
asNumber,
45
asObject,
56
asOptional,
67
asString,
@@ -156,14 +157,21 @@ const asSideshiftTx = asObject({
156157
prevDepositAddresses: asMaybe(asObject({ address: asMaybe(asString) })),
157158
depositAsset: asString,
158159
depositNetwork: asOptional(asString),
160+
depositHash: asOptional(asString),
161+
depositContractAddress: asOptional(asString),
162+
depositEvmChainId: asOptional(asNumber),
159163
invoiceAmount: asString,
160164
settleAddress: asObject({
161165
address: asString
162166
}),
163167
settleAmount: asString,
164168
settleAsset: asString,
165169
settleNetwork: asOptional(asString),
166-
createdAt: asString
170+
settleHash: asOptional(asString),
171+
settleContractAddress: asOptional(asString),
172+
settleEvmChainId: asOptional(asNumber),
173+
createdAt: asString,
174+
settledAt: asOptional(asString)
167175
})
168176

169177
const asSideshiftPluginParams = asObject({
@@ -363,7 +371,7 @@ export async function processSideshiftTx(
363371
status: statusMap[tx.status],
364372
orderId: tx.id,
365373
countryCode: null,
366-
depositTxid: undefined,
374+
depositTxid: tx.depositHash,
367375
depositAddress,
368376
depositCurrency: tx.depositAsset,
369377
depositChainPluginId: depositAsset.chainPluginId,
@@ -373,7 +381,7 @@ export async function processSideshiftTx(
373381
direction: null,
374382
exchangeType: 'swap',
375383
paymentType: null,
376-
payoutTxid: undefined,
384+
payoutTxid: tx.settleHash,
377385
payoutAddress: tx.settleAddress.address,
378386
payoutCurrency: tx.settleAsset,
379387
payoutChainPluginId: payoutAsset.chainPluginId,

0 commit comments

Comments
 (0)