@triadxyz/triad-protocol 2.6.4-beta → 2.6.6-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/helpers.js +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -810,7 +810,7 @@ class TriadProtocolClient {
|
|
|
810
810
|
const sortedOrders = orders.sort((a, b) => Number(a.price) - Number(b.price));
|
|
811
811
|
const tokenProgram = (0, helpers_1.getTokenProgram)(mint);
|
|
812
812
|
for (const order of sortedOrders) {
|
|
813
|
-
if (remainingUSDC.
|
|
813
|
+
if (remainingUSDC.lt(new bn_js_1.default(1000000)))
|
|
814
814
|
break;
|
|
815
815
|
if (order.authority === this.program.provider.publicKey.toBase58()) {
|
|
816
816
|
continue;
|
|
@@ -827,13 +827,11 @@ class TriadProtocolClient {
|
|
|
827
827
|
.div(new bn_js_1.default(1000000));
|
|
828
828
|
adjustedPrice = orderPrice.add(fee);
|
|
829
829
|
}
|
|
830
|
-
console.log('remainingUSDC', remainingUSDC.toString());
|
|
831
830
|
const maxSharesForPrice = remainingUSDC
|
|
832
831
|
.mul(new bn_js_1.default(Math.pow(10, this.decimals)))
|
|
833
832
|
.div(adjustedPrice);
|
|
834
833
|
const sharesToBuy = bn_js_1.default.min(maxSharesForPrice, availableShares);
|
|
835
|
-
|
|
836
|
-
if (sharesToBuy.lte(new bn_js_1.default(0)))
|
|
834
|
+
if (sharesToBuy.lt(new bn_js_1.default(1000000)))
|
|
837
835
|
continue;
|
|
838
836
|
const usdcAmount = sharesToBuy
|
|
839
837
|
.mul(adjustedPrice)
|
|
@@ -862,7 +860,6 @@ class TriadProtocolClient {
|
|
|
862
860
|
if (userTradeIxs.length > 0) {
|
|
863
861
|
ixs.unshift(...userTradeIxs);
|
|
864
862
|
}
|
|
865
|
-
console.log('ixs', ixs.length);
|
|
866
863
|
if (ixs.length === 0) {
|
|
867
864
|
throw new Error('No matching orders found to fill the requested amount');
|
|
868
865
|
}
|
package/dist/types/index.d.ts
CHANGED
package/dist/utils/helpers.js
CHANGED
|
@@ -231,7 +231,8 @@ const formatRefer = (account) => {
|
|
|
231
231
|
id: account.id.toNumber(),
|
|
232
232
|
authority: account.authority.toString(),
|
|
233
233
|
feeBps: account.feeBps,
|
|
234
|
-
feeClaimed: account.feeClaimed.toNumber()
|
|
234
|
+
feeClaimed: account.feeClaimed.toNumber(),
|
|
235
|
+
usersReferred: account.usersReferred.toNumber()
|
|
235
236
|
};
|
|
236
237
|
};
|
|
237
238
|
exports.formatRefer = formatRefer;
|