@lavarage/sdk 6.0.2 → 6.0.3

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.mts CHANGED
@@ -2506,5 +2506,23 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
2506
2506
  };
2507
2507
  quoteResponse: any;
2508
2508
  }, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, profitFeeMarkup?: number) => Promise<VersionedTransaction>;
2509
+ declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
2510
+ parsed: {
2511
+ tpPrice: any;
2512
+ tpThreshold: any;
2513
+ };
2514
+ publicKey: PublicKey;
2515
+ account: {
2516
+ delegateType: number;
2517
+ field1: BN;
2518
+ field2: BN;
2519
+ field3: BN;
2520
+ field4: PublicKey;
2521
+ field5: PublicKey;
2522
+ originalOperator: PublicKey;
2523
+ delegateOperator: PublicKey;
2524
+ account: PublicKey;
2525
+ };
2526
+ }[]>;
2509
2527
 
2510
- export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, removeTpDelegate };
2528
+ export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getDelegateAccounts, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, removeTpDelegate };
package/dist/index.d.ts CHANGED
@@ -2506,5 +2506,23 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
2506
2506
  };
2507
2507
  quoteResponse: any;
2508
2508
  }, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, profitFeeMarkup?: number) => Promise<VersionedTransaction>;
2509
+ declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
2510
+ parsed: {
2511
+ tpPrice: any;
2512
+ tpThreshold: any;
2513
+ };
2514
+ publicKey: PublicKey;
2515
+ account: {
2516
+ delegateType: number;
2517
+ field1: BN;
2518
+ field2: BN;
2519
+ field3: BN;
2520
+ field4: PublicKey;
2521
+ field5: PublicKey;
2522
+ originalOperator: PublicKey;
2523
+ delegateOperator: PublicKey;
2524
+ account: PublicKey;
2525
+ };
2526
+ }[]>;
2509
2527
 
2510
- export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, removeTpDelegate };
2528
+ export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getDelegateAccounts, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, removeTpDelegate };
package/dist/index.js CHANGED
@@ -1,10 +1,27 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
9
  var __getProtoOf = Object.getPrototypeOf;
7
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8
25
  var __export = (target, all) => {
9
26
  for (var name in all)
10
27
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -57,6 +74,7 @@ __export(index_exports, {
57
74
  createTpDelegate: () => createTpDelegate,
58
75
  getAllPositions: () => getAllPositions,
59
76
  getClosedPositions: () => getClosedPositions,
77
+ getDelegateAccounts: () => getDelegateAccounts,
60
78
  getLiquidatedPositions: () => getLiquidatedPositions,
61
79
  getOffers: () => getOffers,
62
80
  getOpenPositions: () => getOpenPositions,
@@ -3033,6 +3051,20 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
3033
3051
  const tx = new import_web3.VersionedTransaction(messageV0);
3034
3052
  return tx;
3035
3053
  });
3054
+ var getDelegateAccounts = (lavarageProgram, userPubKey) => __async(void 0, null, function* () {
3055
+ const delegateAccounts = yield lavarageProgram.account.delegate.all(userPubKey ? [{
3056
+ memcmp: {
3057
+ offset: 104,
3058
+ bytes: userPubKey.toBase58()
3059
+ }
3060
+ }] : void 0);
3061
+ return delegateAccounts.map((d) => __spreadProps(__spreadValues({}, d), {
3062
+ parsed: {
3063
+ tpPrice: new import_anchor.BN(d.account.field1),
3064
+ tpThreshold: new import_anchor.BN(d.account.field2)
3065
+ }
3066
+ }));
3067
+ });
3036
3068
  // Annotate the CommonJS export names for ESM import in node:
3037
3069
  0 && (module.exports = {
3038
3070
  IDL,
@@ -3042,6 +3074,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
3042
3074
  createTpDelegate,
3043
3075
  getAllPositions,
3044
3076
  getClosedPositions,
3077
+ getDelegateAccounts,
3045
3078
  getLiquidatedPositions,
3046
3079
  getOffers,
3047
3080
  getOpenPositions,