diff --git a/src/bitcoinUtils/apiHelpers/createRevealTx.ts b/src/bitcoinUtils/apiHelpers/createRevealTx.ts index 16cb61b..8461c8e 100644 --- a/src/bitcoinUtils/apiHelpers/createRevealTx.ts +++ b/src/bitcoinUtils/apiHelpers/createRevealTx.ts @@ -26,7 +26,7 @@ export async function createRevealTx( fromChain: info.fromChain, txId: info.txId, vout: info.vout, - satsAmount: info.satsAmount, + satsAmount: info.satsAmount.toString(), orderDataHex: toHex(info.orderData), xlinkPegInAddress: { address: info.xlinkPegInAddress.address, diff --git a/src/utils/apiHelpers.ts b/src/utils/apiHelpers.ts index 34f8abb..703d28a 100644 --- a/src/utils/apiHelpers.ts +++ b/src/utils/apiHelpers.ts @@ -1,5 +1,6 @@ import { backendAPIPrefix } from "../config" import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal" +import { BigNumber } from "./BigNumber" export async function requestAPI( sdkContext: Pick, @@ -22,7 +23,15 @@ export async function requestAPI( "Content-Type": "application/json", "X-Xlink-Runtime-Env": sdkContext.backendAPI.runtimeEnv, }, - body: JSON.stringify(options.body), + body: JSON.stringify(options.body, (k, v) => { + if (typeof v === "bigint") { + return v.toString() + } + if (BigNumber.isBigNumber(v)) { + return BigNumber.toString(v) + } + return v + }), }, )