Skip to content

Commit

Permalink
fix(connext): remove BigInt to avoid precision loss (#1893)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Ranna authored Sep 14, 2020
1 parent 3d56e6f commit d9ddd1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/connextclient/ConnextClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class ConnextClient extends SwapClient {
let secret;
if (deal.role === SwapRole.Maker) {
// we are the maker paying the taker
amount = BigInt(deal.takerUnits).toString();
amount = deal.takerUnits.toString();
tokenAddress = this.tokenAddresses.get(deal.takerCurrency)!;
const executeTransfer = this.executeHashLockTransfer({
amount,
Expand All @@ -369,7 +369,7 @@ class ConnextClient extends SwapClient {
secret = preimage;
} else {
// we are the taker paying the maker
amount = BigInt(deal.makerUnits).toString();
amount = deal.makerUnits.toString();
tokenAddress = this.tokenAddresses.get(deal.makerCurrency)!;
lockTimeout = deal.makerCltvDelta!;
secret = deal.rPreimage!;
Expand Down Expand Up @@ -668,7 +668,7 @@ class ConnextClient extends SwapClient {
const assetId = this.getTokenAddress(currency);
const depositResponse = await this.sendRequest('/deposit', 'POST', {
assetId,
amount: BigInt(units).toString(),
amount: units.toString(),
});
const { txhash } = await parseResponseBody<ConnextDepositResponse>(depositResponse);
const channelCollateralized$ = fromEvent(this, 'depositConfirmed').pipe(
Expand Down Expand Up @@ -706,7 +706,7 @@ class ConnextClient extends SwapClient {

const withdrawResponse = await this.sendRequest('/withdraw', 'POST', {
recipient: destination,
amount: BigInt(amount).toString(),
amount: amount.toString(),
assetId: this.tokenAddresses.get(currency),
});

Expand Down Expand Up @@ -741,7 +741,7 @@ class ConnextClient extends SwapClient {
): Promise<void> => {
await this.sendRequest('/hashlock-transfer', 'POST', {
assetId,
amount: BigInt(amount).toString(),
amount: amount.toString(),
});
}

Expand Down

0 comments on commit d9ddd1c

Please sign in to comment.