@triadxyz/triad-protocol 2.7.9-beta → 2.8.1-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.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Connection, PublicKey, TransactionInstruction, Commitment } from '@sola
2
2
  import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
3
3
  import BN from 'bn.js';
4
4
  import { TriadProtocol } from './types/triad_protocol';
5
- import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs, BookOrder, MarketAskOrderArgs, RpcOptions, UpdateCustomerFeeArgs, Order, OrderDirection } from './types';
5
+ import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs, BookOrder, MarketAskOrderArgs, RpcOptions, UpdateCustomerFeeArgs, OrderDirection } from './types';
6
6
  import Stake from './stake';
7
7
  import Poseidon from './poseidon';
8
8
  export * from './types';
@@ -37,14 +37,14 @@ export default class TriadProtocolClient {
37
37
  * @param wallet - User wallet PublicKey
38
38
  *
39
39
  */
40
- getUserOrders(wallet: PublicKey): Promise<Order[]>;
40
+ getUserOrders(wallet: PublicKey): Promise<import("./types").Order[]>;
41
41
  /**
42
42
  * Get User Orders By Market ID
43
43
  * @param wallet - User wallet PublicKey
44
44
  * @param marketId - The ID of the market
45
45
  *
46
46
  */
47
- getUserOrdersByMarketId(wallet: PublicKey, marketId: number): Promise<Order[]>;
47
+ getUserOrdersByMarketId(wallet: PublicKey, marketId: number): Promise<import("./types").Order[]>;
48
48
  /**
49
49
  * Get Pool By ID
50
50
  * @param poolId - The ID of the pool
package/dist/index.js CHANGED
@@ -889,11 +889,14 @@ class TriadProtocolClient {
889
889
  .mul(new bn_js_1.default(Math.pow(10, this.decimals)))
890
890
  .div(adjustedPrice);
891
891
  const sharesToBuy = bn_js_1.default.min(maxSharesForPrice, availableShares);
892
+ console.log('sharesToBuy', sharesToBuy.toNumber());
892
893
  if (sharesToBuy.lte(new bn_js_1.default(0)))
893
894
  continue;
894
895
  const usdcAmount = sharesToBuy
895
896
  .mul(adjustedPrice)
896
897
  .div(new bn_js_1.default(Math.pow(10, this.decimals)));
898
+ console.log('usdcAmount', usdcAmount.toNumber());
899
+ console.log('--------------------------------');
897
900
  totalUSDCNeeded = totalUSDCNeeded.add(usdcAmount);
898
901
  tempRemainingUSDC = tempRemainingUSDC.sub(usdcAmount);
899
902
  }
@@ -24,7 +24,7 @@ const swap = ({ connection, wallet, inToken, outToken, amount }) => __awaiter(vo
24
24
  throw new Error('Token not found');
25
25
  }
26
26
  const formattedAmountIn = amount * Math.pow(10, token.decimals);
27
- const quoteResponse = yield axios_1.default.get(`https://lite-api.jup.ag/swap/v1/quote?inputMint=${inToken}&outputMint=${outToken}&amount=${formattedAmountIn}&slippageBps=50&onlyDirectRoutes=true&platformFeeBps=60`);
27
+ const quoteResponse = yield axios_1.default.get(`https://lite-api.jup.ag/swap/v1/quote?inputMint=${inToken}&outputMint=${outToken}&amount=${formattedAmountIn}&slippageBps=20&onlyDirectRoutes=true&platformFeeBps=60`);
28
28
  const { data: quoteData } = quoteResponse;
29
29
  const swapResponse = yield axios_1.default.post('https://lite-api.jup.ag/swap/v1/swap-instructions', {
30
30
  quoteResponse: quoteData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.7.9-beta",
3
+ "version": "2.8.1-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",