Skip to content

Commit

Permalink
convert bn to string in sui client (#86)
Browse files Browse the repository at this point in the history
* convert bn to string in sui client
  • Loading branch information
Yolley authored Aug 28, 2023
1 parent 84f833c commit 5381d7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/stream/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/stream",
"version": "5.2.0",
"version": "5.2.1",
"description": "JavaScript SDK to interact with Streamflow protocol.",
"main": "dist/index.js",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
Expand Down
18 changes: 10 additions & 8 deletions packages/stream/sui/StreamClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default class SuiStreamClient extends BaseStreamClient {
txb.object(withdrawData.id),
txb.object(this.configId),
txb.object(SUI_CLOCK_OBJECT_ID),
txb.pure(withdrawData.amount),
txb.pure(withdrawData.amount.toString()),
],
});

Expand Down Expand Up @@ -225,7 +225,7 @@ export default class SuiStreamClient extends BaseStreamClient {
txb.object(this.configId),
coinObject,
txb.gas,
txb.pure(topupData.amount),
txb.pure(topupData.amount.toString()),
],
});
this.returnSplittedCoinObject(txb, tokenId, coins, coinObject);
Expand Down Expand Up @@ -293,11 +293,13 @@ export default class SuiStreamClient extends BaseStreamClient {
"vector<bool>"
),
txb.pure(
updateData.withdrawFrequency !== undefined ? [updateData.withdrawFrequency] : [],
updateData.withdrawFrequency !== undefined
? [updateData.withdrawFrequency.toString()]
: [],
"vector<u64>"
),
txb.pure(
updateData.amountPerPeriod !== undefined ? [updateData.amountPerPeriod] : [],
updateData.amountPerPeriod !== undefined ? [updateData.amountPerPeriod.toString()] : [],
"vector<u64>"
),
],
Expand Down Expand Up @@ -349,11 +351,11 @@ export default class SuiStreamClient extends BaseStreamClient {
txb.object(SUI_CLOCK_OBJECT_ID),
coinObject,
txb.gas,
txb.pure(recipient.amount),
txb.pure(recipient.amount.toString()),
txb.pure(multipleStreamData.period),
txb.pure(recipient.amountPerPeriod),
txb.pure(recipient.amountPerPeriod.toString()),
txb.pure(multipleStreamData.start),
txb.pure(recipient.cliffAmount),
txb.pure(recipient.cliffAmount.toString()),
txb.pure(multipleStreamData.cancelableBySender),
txb.pure(multipleStreamData.cancelableByRecipient),
txb.pure(multipleStreamData.cancelableBySender),
Expand Down Expand Up @@ -421,7 +423,7 @@ export default class SuiStreamClient extends BaseStreamClient {
);
}
const sum = amount.mul(new BN(BASE_FEE)).div(new BN(1000000));
return txb.splitCoins(coinObject, [txb.pure(sum)])[0];
return txb.splitCoins(coinObject, [txb.pure(sum.toString())])[0];
}

/**
Expand Down

0 comments on commit 5381d7c

Please sign in to comment.