mirror of
https://github.com/Brotocol-xyz/bro-sdk.git
synced 2026-01-12 14:54:21 +08:00
fix: creation of reveal tx failed due to trying stringify bigint
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { backendAPIPrefix } from "../config"
|
||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
||||
import { BigNumber } from "./BigNumber"
|
||||
|
||||
export async function requestAPI<T>(
|
||||
sdkContext: Pick<SDKGlobalContext, "backendAPI">,
|
||||
@@ -22,7 +23,15 @@ export async function requestAPI<T>(
|
||||
"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
|
||||
}),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user