flash-sdk 10.10.6 → 10.100.2-alpha.0

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.
Files changed (57) hide show
  1. package/dist/CustodyAccount.d.ts +2 -2
  2. package/dist/MarketAccount.d.ts +2 -2
  3. package/dist/MarketAccount.js +1 -1
  4. package/dist/OraclePrice.d.ts +4 -2
  5. package/dist/OraclePrice.js +23 -4
  6. package/dist/OrderAccount.d.ts +1 -1
  7. package/dist/PerpetualsClient.d.ts +385 -4332
  8. package/dist/PerpetualsClient.js +6254 -4927
  9. package/dist/PoolAccount.d.ts +3 -0
  10. package/dist/PoolConfig.d.ts +9 -2
  11. package/dist/PoolConfig.js +67 -4
  12. package/dist/PoolConfig.json +87 -4032
  13. package/dist/PoolDataClient.js +12 -11
  14. package/dist/PositionAccount.d.ts +6 -3
  15. package/dist/TokenStakeAccount.d.ts +24 -4
  16. package/dist/TokenStakeAccount.js +44 -2
  17. package/dist/TokenVaultAccount.d.ts +1 -0
  18. package/dist/ViewHelper.d.ts +2 -1
  19. package/dist/ViewHelper.js +17 -20
  20. package/dist/backupOracle.d.ts +0 -1
  21. package/dist/backupOracle.js +26 -5
  22. package/dist/constants/index.d.ts +1 -0
  23. package/dist/constants/index.js +2 -1
  24. package/dist/idl/perpetuals.d.ts +29203 -11085
  25. package/dist/idl/perpetuals.js +0 -16293
  26. package/dist/idl/perpetuals.json +34411 -0
  27. package/dist/index.d.ts +4 -2
  28. package/dist/index.js +7 -3
  29. package/dist/remoraTokensWithPriceIds.d.ts +13 -0
  30. package/dist/remoraTokensWithPriceIds.js +265 -0
  31. package/dist/testPublkey.d.ts +0 -0
  32. package/dist/testPublkey.js +0 -0
  33. package/dist/testSize.d.ts +0 -0
  34. package/dist/testSize.js +0 -0
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/dist/types/generated.d.ts +2556 -0
  37. package/dist/types/generated.js +2 -0
  38. package/dist/types/index.d.ts +52 -144
  39. package/dist/types/index.js +22 -4
  40. package/dist/utils/IdlCoder.d.ts +3 -2
  41. package/dist/utils/IdlCoder.js +4 -2
  42. package/dist/utils/anchorCpiEvents.d.ts +1 -2
  43. package/dist/utils/anchorCpiEvents.js +10 -6
  44. package/dist/utils/getReferralAccounts.d.ts +1 -1
  45. package/dist/utils/getReferralAccounts.js +3 -8
  46. package/dist/xstocksTokensWithPriceIds.d.ts +13 -0
  47. package/dist/xstocksTokensWithPriceIds.js +369 -0
  48. package/package.json +9 -5
  49. package/readme.md +37 -3
  50. package/dist/TradingAccount.d.ts +0 -24
  51. package/dist/TradingAccount.js +0 -17
  52. package/dist/idl/fbnft_rewards.d.ts +0 -290
  53. package/dist/idl/fbnft_rewards.js +0 -292
  54. package/dist/idl/perp_composability.d.ts +0 -760
  55. package/dist/idl/perp_composability.js +0 -762
  56. package/dist/idl/reward_distribution.d.ts +0 -347
  57. package/dist/idl/reward_distribution.js +0 -349
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,190 +1,83 @@
1
1
  /// <reference types="bn.js" />
2
- import { MethodsNamespace, IdlTypes, IdlAccounts, BN, IdlEvents } from "@coral-xyz/anchor";
3
- import { Perpetuals } from "../idl/perpetuals";
4
- import { FbnftRewards } from "../idl/fbnft_rewards";
2
+ import { BN } from "@coral-xyz/anchor";
5
3
  import { OraclePrice } from "../OraclePrice";
4
+ export * from "./generated";
5
+ import { Custody as GeneratedCustody, Market as GeneratedMarket, Pool as GeneratedPool, Position as GeneratedPosition, Order as GeneratedOrder, Perpetuals as GeneratedPerpetuals, Referral as GeneratedReferral, Whitelist as GeneratedWhitelist, FlpStake as GeneratedFlpStake, TokenVault as GeneratedTokenVault, TokenStake as GeneratedTokenStake, ProtocolVault as GeneratedProtocolVault } from "./generated";
6
6
  export type PositionSide = "long" | "short";
7
- export type Methods = MethodsNamespace<Perpetuals>;
8
- export type Accounts = IdlAccounts<Perpetuals>;
9
- export type Types = IdlTypes<Perpetuals>;
10
- export type Events = IdlEvents<Perpetuals>;
11
- export type FbnftRewardsAccounts = IdlAccounts<FbnftRewards>;
12
- export type OpenPositionParams = Types["OpenPositionParams"];
13
- export type InitParams = Types["InitParams"];
14
- export type OracleParams = Types["OracleParams"];
15
- export type PricingParams = Types["PricingParams"];
16
- export type Permissions = Types["Permissions"];
17
- export type Fees = Types["Fees"];
18
- export type BorrowRateParams = Types["BorrowRateParams"];
19
- export type TokenRatios = Types["TokenRatios"];
20
- export type SetCustomOraclePriceParams = Types["SetCustomOraclePriceParams"];
21
- export type AmountAndFee = Types["AmountAndFee"];
22
- export type NewPositionPricesAndFee = Types["NewPositionPricesAndFee"];
23
- export type PriceAndFee = Types["PriceAndFee"];
24
- export type ProfitAndLoss = Types["ProfitAndLoss"];
25
- export type SwapAmountAndFees = Types["SwapAmountAndFees"];
26
- export type RatioFee = Types["RatioFees"];
27
- export type PermissionlessPythCache = Types["PermissionlessPythCache"];
28
- export type BackupOracle = Types["BackupOracle"];
29
- export type MarketPermissions = Types["MarketPermissions"];
30
- export type ContractOraclePrice = Types["OraclePrice"];
31
- export type StakeStats = Types["StakeStats"];
32
- export type CompoundingStats = Types["CompoundingStats"];
33
- export type VoltageStats = Types["VoltageStats"];
34
- export type LimitOrder = Types["LimitOrder"];
35
- export type TriggerOrder = Types["TriggerOrder"];
36
- export type Assets = Types["Assets"];
37
- export type FeesStats = Types["FeesStats"];
38
- export type PositionStats = Types["PositionStats"];
39
- export type BorrowRateState = Types["BorrowRateState"];
40
- export type TokenPermissions = Types["TokenPermissions"];
41
- export type InternalPrice = Types["InternalPrice"];
42
- export type InternalEmaPrice = Types["InternalEmaPrice"];
43
- export type Custody = Accounts["custody"];
44
- export type Market = Accounts["market"];
45
- export type Pool = Accounts["pool"];
46
- export type Position = Accounts["position"];
47
- export type Order = Accounts["order"];
48
- export type PerpetualsAccount = Accounts["perpetuals"];
49
- export type Referral = Accounts["referral"];
50
- export type Trading = Accounts["trading"];
51
- export type FlpStake = Accounts["flpStake"];
52
- export type TokenVault = Accounts["tokenVault"];
53
- export type TokenStake = Accounts["tokenStake"];
54
- export type ProtocolVault = Accounts["protocolVault"];
55
- export type RewardRecord = FbnftRewardsAccounts["rewardRecord"];
56
- export type RewardVault = FbnftRewardsAccounts["rewardVault"];
57
- export type AddCollateralLog = Events["AddCollateralLog"];
58
- export type AddLiquidityLog = Events["AddLiquidityLog"];
59
- export type ClosePositionLog = Events["ClosePositionLog"];
60
- export type DecreaseSizeLog = Events["DecreaseSizeLog"];
61
- export type LiquidateLog = Events["LiquidateLog"];
62
- export type IncreaseSizeLog = Events["IncreaseSizeLog"];
63
- export type OpenPositionLog = Events["OpenPositionLog"];
64
- export type RemoveCollateralLog = Events["RemoveCollateralLog"];
65
- export type RemoveLiquidityLog = Events["RemoveLiquidityLog"];
66
- export type SwapLog = Events["SwapLog"];
67
- export type AddCollateralLogV2 = Events["AddCollateralLogV2"];
68
- export type ClosePositionLogV2 = Events["ClosePositionLogV2"];
69
- export type DecreaseSizeLogV2 = Events["DecreaseSizeLogV2"];
70
- export type LiquidateLogV2 = Events["LiquidateLogV2"];
71
- export type IncreaseSizeLogV2 = Events["IncreaseSizeLogV2"];
72
- export type OpenPositionLogV2 = Events["OpenPositionLogV2"];
73
- export type RemoveCollateralLogV2 = Events["RemoveCollateralLogV2"];
74
- export type AddCollateralLogV3 = Events["AddCollateralLogV3"];
75
- export type ClosePositionLogV3 = Events["ClosePositionLogV3"];
76
- export type DecreaseSizeLogV3 = Events["DecreaseSizeLogV3"];
77
- export type LiquidateLogV3 = Events["LiquidateLogV3"];
78
- export type IncreaseSizeLogV3 = Events["IncreaseSizeLogV3"];
79
- export type OpenPositionLogV3 = Events["OpenPositionLogV3"];
80
- export type RemoveCollateralLogV3 = Events["RemoveCollateralLogV3"];
81
- export type IncreaseSizeLogV4 = Events["IncreaseSizeLogV4"];
82
- export type OpenPositionLogV4 = Events["OpenPositionLogV4"];
83
- export type ExecuteLimitOrderLogV2 = Events["ExecuteLimitOrderLogV2"];
84
- export type ExecuteLimitWithSwapLogV2 = Events["ExecuteLimitWithSwapLogV2"];
85
- export type SwapAndOpenLogV2 = Events["SwapAndOpenLogV2"];
86
- export type AddLiquidityLogV2 = Events["AddLiquidityLogV2"];
87
- export type RemoveLiquidityLogV2 = Events["RemoveLiquidityLogV2"];
88
- export type AddCompoundingLiquidityLog = Events["AddCompoundingLiquidityLog"];
89
- export type AddLiquidityAndStakeLog = Events["AddLiquidityAndStakeLog"];
90
- export type DepositStakeLog = Events["DepositStakeLog"];
91
- export type MigrateStakeLog = Events["MigrateStakeLog"];
92
- export type RefreshStakeLog = Events["RefreshStakeLog"];
93
- export type RefreshStakeUserLog = Events["RefreshStakeUserLog"];
94
- export type CompoundingFeesLog = Events["CompoundingFeesLog"];
95
- export type RemoveCompoundingLiquidityLog = Events["RemoveCompoundingLiquidityLog"];
96
- export type SwapFeeInternalLog = Events["SwapFeeInternalLog"];
97
- export type UnstakeInstantLog = Events["UnstakeInstantLog"];
98
- export type UnstakeRequestLog = Events["UnstakeRequestLog"];
99
- export type WithdrawStakeLog = Events["WithdrawStakeLog"];
100
- export type EditLimitOrderLog = Events["EditLimitOrderLog"];
101
- export type EditTriggerOrderLog = Events["EditTriggerOrderLog"];
102
- export type ExecuteLimitOrderLog = Events["ExecuteLimitOrderLog"];
103
- export type ExecuteTriggerOrderLog = Events["ExecuteTriggerOrderLog"];
104
- export type PlaceLimitOrderLog = Events["PlaceLimitOrderLog"];
105
- export type PlaceTriggerOrderLog = Events["PlaceTriggerOrderLog"];
106
- export type CancelLimitOrderLog = Events["CancelLimitOrderLog"];
107
- export type CancelTriggerOrderLog = Events["CancelTriggerOrderLog"];
108
- export type ExecuteLimitWithSwapLog = Events["ExecuteLimitWithSwapLog"];
109
- export type ExecuteTriggerWithSwapLog = Events["ExecuteTriggerWithSwapLog"];
110
- export type SwapAndOpenLog = Events["SwapAndOpenLog"];
111
- export type CloseAndSwapLog = Events["CloseAndSwapLog"];
112
- export type SwapAndAddCollateralLog = Events["SwapAndAddCollateralLog"];
113
- export type RemoveCollateralAndSwapLog = Events["RemoveCollateralAndSwapLog"];
114
- export type BurnAndClaimLog = Events["BurnAndClaimLog"];
115
- export type BurnAndStakeLog = Events["BurnAndStakeLog"];
116
- export type CancelUnstakeTokenRequestLog = Events["CancelUnstakeTokenRequestLog"];
117
- export type DepositTokenStakeLog = Events["DepositTokenStakeLog"];
118
- export type UnstakeTokenInstantLog = Events["UnstakeTokenInstantLog"];
119
- export type UnstakeTokenRequestLog = Events["UnstakeTokenRequestLog"];
120
- export type WithdrawTokenLog = Events["WithdrawTokenLog"];
121
- export type DistributeTokenRewardLog = Events["DistributeTokenRewardLog"];
122
- export type SetTokenRewardLog = Events["SetTokenRewardLog"];
123
- export type CollectTokenRewardLog = Events["CollectTokenRewardLog"];
124
- export type CollectRevenueLog = Events["CollectRevenueLog"];
125
- export type MoveProtocolFeesLog = Events["MoveProtocolFeesLog"];
126
- export type VoltagePointsLog = Events["VoltagePointsLog"];
7
+ export type Custody = GeneratedCustody;
8
+ export type Market = GeneratedMarket;
9
+ export type Pool = GeneratedPool;
10
+ export type Position = GeneratedPosition;
11
+ export type Order = GeneratedOrder;
12
+ export type PerpetualsAccount = GeneratedPerpetuals;
13
+ export type Referral = GeneratedReferral;
14
+ export type Whitelist = GeneratedWhitelist;
15
+ export type Trading = Record<string, never>;
16
+ export type FlpStake = GeneratedFlpStake;
17
+ export type TokenVault = GeneratedTokenVault;
18
+ export type TokenStake = GeneratedTokenStake;
19
+ export type ProtocolVault = GeneratedProtocolVault;
127
20
  export declare function isVariant(object: any, type: string): any;
128
21
  export declare function isOneOfVariant(object: any, types: string[]): any;
129
22
  export declare class Privilege {
130
23
  static None: {
131
- none: {};
24
+ none: Record<string, never>;
132
25
  };
133
26
  static Stake: {
134
- stake: {};
27
+ stake: Record<string, never>;
135
28
  };
136
29
  static Referral: {
137
- referral: {};
30
+ referral: Record<string, never>;
138
31
  };
139
32
  }
140
33
  export declare class Side {
141
34
  static None: {
142
- none: {};
35
+ none: Record<string, never>;
143
36
  };
144
37
  static Long: {
145
- long: {};
38
+ long: Record<string, never>;
146
39
  };
147
40
  static Short: {
148
- short: {};
41
+ short: Record<string, never>;
149
42
  };
150
43
  }
151
44
  export declare class OracleType {
152
45
  static None: {
153
- none: {};
46
+ none: Record<string, never>;
154
47
  };
155
- static Test: {
156
- test: {};
48
+ static Custom: {
49
+ custom: Record<string, never>;
157
50
  };
158
51
  static Pyth: {
159
- pyth: {};
52
+ pyth: Record<string, never>;
160
53
  };
161
54
  }
162
55
  export declare class FeesMode {
163
56
  static Fixed: {
164
- fixed: {};
57
+ fixed: Record<string, never>;
165
58
  };
166
59
  static Linear: {
167
- linear: {};
60
+ linear: Record<string, never>;
168
61
  };
169
62
  }
170
63
  export declare class FeesAction {
171
64
  static AddLiquidity: {
172
- addLiquidity: {};
65
+ addLiquidity: Record<string, never>;
173
66
  };
174
67
  static RemoveLiquidity: {
175
- removeLiquidity: {};
68
+ removeLiquidity: Record<string, never>;
176
69
  };
177
70
  static SwapIn: {
178
- swapIn: {};
71
+ swapIn: Record<string, never>;
179
72
  };
180
73
  static SwapOut: {
181
- swapOut: {};
74
+ swapOut: Record<string, never>;
182
75
  };
183
76
  static StableSwapIn: {
184
- stableSwapIn: {};
77
+ stableSwapIn: Record<string, never>;
185
78
  };
186
79
  static StableSwapOut: {
187
- stableSwapOut: {};
80
+ stableSwapOut: Record<string, never>;
188
81
  };
189
82
  }
190
83
  export declare const DEFAULT_POSITION: Position;
@@ -211,7 +104,8 @@ export interface EntryPriceAndFee {
211
104
  liquidationPrice: OraclePrice;
212
105
  }
213
106
  export interface EntryPriceAndFeeV2 {
214
- entryOraclePrice: OraclePrice;
107
+ entryDeltaOraclePrice: OraclePrice;
108
+ entryAvgOraclePrice: OraclePrice;
215
109
  feeUsd: BN;
216
110
  feeAmount: BN;
217
111
  feeUsdAfterDiscount: BN;
@@ -226,8 +120,9 @@ export interface RemoveCollateralData {
226
120
  lockAndUnsettledFeeUsd: BN;
227
121
  newLev: BN;
228
122
  liquidationPrice: OraclePrice;
229
- collateralAmountRecieved: BN;
230
- newCollateralAmount: BN;
123
+ collateralAmountReceived: BN;
124
+ collateralAmountReceivedUsd: BN;
125
+ newCollateralUsd: BN;
231
126
  newPnl: BN;
232
127
  }
233
128
  export interface AddLiquidityAmountAndFee {
@@ -238,3 +133,16 @@ export interface RemoveLiquidityAmountAndFee {
238
133
  tokenAmountOut: BN;
239
134
  fee: BN;
240
135
  }
136
+ import { RatioFees } from "./generated";
137
+ export type RatioFee = RatioFees;
138
+ export interface BackupOracle {
139
+ price: BN;
140
+ expo: number;
141
+ conf: BN;
142
+ emaPrice: BN;
143
+ publishTime: BN;
144
+ }
145
+ export interface PermissionlessPythCache {
146
+ backupCache: BackupOracle[];
147
+ }
148
+ export type VoltageStats = Record<string, never>;
@@ -1,8 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.DEFAULT_POSITION = exports.FeesAction = exports.FeesMode = exports.OracleType = exports.Side = exports.Privilege = exports.isOneOfVariant = exports.isVariant = void 0;
4
18
  var web3_js_1 = require("@solana/web3.js");
5
19
  var constants_1 = require("../constants");
20
+ __exportStar(require("./generated"), exports);
6
21
  function isVariant(object, type) {
7
22
  return object.hasOwnProperty(type);
8
23
  }
@@ -35,7 +50,7 @@ var OracleType = (function () {
35
50
  function OracleType() {
36
51
  }
37
52
  OracleType.None = { none: {} };
38
- OracleType.Test = { test: {} };
53
+ OracleType.Custom = { custom: {} };
39
54
  OracleType.Pyth = { pyth: {} };
40
55
  return OracleType;
41
56
  }());
@@ -71,13 +86,16 @@ exports.DEFAULT_POSITION = {
71
86
  sizeUsd: constants_1.BN_ZERO,
72
87
  lockedAmount: constants_1.BN_ZERO,
73
88
  lockedUsd: constants_1.BN_ZERO,
74
- collateralAmount: constants_1.BN_ZERO,
89
+ priceImpactUsd: constants_1.BN_ZERO,
75
90
  collateralUsd: constants_1.BN_ZERO,
76
- unsettledAmount: constants_1.BN_ZERO,
91
+ unsettledValueUsd: constants_1.BN_ZERO,
77
92
  unsettledFeesUsd: constants_1.BN_ZERO,
78
93
  cumulativeLockFeeSnapshot: constants_1.BN_ZERO,
79
94
  degenSizeUsd: constants_1.BN_ZERO,
80
- buffer: constants_1.BN_ZERO,
95
+ referencePrice: { price: constants_1.BN_ZERO, exponent: 0 },
96
+ isActive: false,
97
+ buffer: [0, 0],
98
+ priceImpactSet: 0,
81
99
  sizeDecimals: 0,
82
100
  lockedDecimals: 0,
83
101
  collateralDecimals: 0,
@@ -1,8 +1,9 @@
1
1
  import { Layout } from 'buffer-layout';
2
- import { IdlField, IdlTypeDef } from '@coral-xyz/anchor/dist/cjs/idl';
2
+ import { IdlTypeDef } from '@coral-xyz/anchor/dist/cjs/idl';
3
3
  export declare class IdlCoder {
4
4
  static fieldLayout(field: {
5
5
  name?: string;
6
- } & Pick<IdlField, 'type'>, types?: IdlTypeDef[]): Layout;
6
+ type: any;
7
+ }, types?: IdlTypeDef[]): Layout;
7
8
  static typeDefLayout(typeDef: IdlTypeDef, types?: IdlTypeDef[], name?: string): Layout;
8
9
  }
@@ -87,7 +87,8 @@ var IdlCoder = (function () {
87
87
  case 'string': {
88
88
  return borsh.str(fieldName);
89
89
  }
90
- case 'publicKey': {
90
+ case 'publicKey':
91
+ case 'pubkey': {
91
92
  return borsh.publicKey(fieldName);
92
93
  }
93
94
  default: {
@@ -104,7 +105,8 @@ var IdlCoder = (function () {
104
105
  }, types), fieldName);
105
106
  }
106
107
  else if ('defined' in field.type) {
107
- var defined_1 = field.type.defined;
108
+ var definedType = field.type.defined;
109
+ var defined_1 = typeof definedType === 'string' ? definedType : definedType.name;
108
110
  if (types === undefined) {
109
111
  throw new anchor_1.IdlError('User defined types not provided');
110
112
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Event, EventCoder, web3 } from "@coral-xyz/anchor";
3
- export declare function getAndValidateEvent(previousProgram: web3.PublicKey, currentProgram: web3.PublicKey, eventAuthority: web3.PublicKey, eventCoder: EventCoder, ixData: Buffer): Event;
2
+ export declare function getAndValidateEvent(previousProgram: web3.PublicKey, currentProgram: web3.PublicKey, eventAuthority: web3.PublicKey, eventCoder: EventCoder, ixData: Uint8Array): Event;
4
3
  export declare const getCpiEventsFromTransaction: (response: web3.VersionedTransactionResponse) => Promise<Event[]>;
@@ -35,21 +35,25 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
42
  exports.getCpiEventsFromTransaction = exports.getAndValidateEvent = void 0;
40
43
  var anchor_1 = require("@coral-xyz/anchor");
41
- var perpetuals_1 = require("../idl/perpetuals");
44
+ var perpetuals_json_1 = __importDefault(require("../idl/perpetuals.json"));
42
45
  var bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
43
46
  function getAndValidateEvent(previousProgram, currentProgram, eventAuthority, eventCoder, ixData) {
44
- var eventTag = Buffer.from([0x1d, 0x9a, 0xcb, 0x51, 0x2e, 0xa5, 0x45, 0xe4].reverse());
45
- if (!ixData.slice(0, 8).equals(eventTag)) {
47
+ var eventTag = new Uint8Array([0x1d, 0x9a, 0xcb, 0x51, 0x2e, 0xa5, 0x45, 0xe4].reverse());
48
+ var ixTag = ixData.slice(0, 8);
49
+ if (ixTag.length !== eventTag.length || !ixTag.every(function (val, i) { return val === eventTag[i]; })) {
46
50
  throw new Error("Invalid CPI Event: Event tag mismatch");
47
51
  }
48
52
  var expectedAuthority = anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], currentProgram)[0];
49
53
  if (expectedAuthority.toString() !== eventAuthority.toString()) {
50
54
  throw new Error("Invalid CPI Event: Event authority does not match");
51
55
  }
52
- var event = eventCoder.decode(bytes_1.base64.encode(ixData.slice(8)));
56
+ var event = eventCoder.decode(bytes_1.base64.encode(Buffer.from(ixData.slice(8))));
53
57
  if (!event) {
54
58
  throw new Error("Invalid CPI Event: Failed to decode event");
55
59
  }
@@ -65,12 +69,12 @@ var getCpiEventsFromTransaction = function (response) { return __awaiter(void 0,
65
69
  accounts = response.transaction.message.staticAccountKeys
66
70
  .concat((_a = response.meta.loadedAddresses.writable) !== null && _a !== void 0 ? _a : [])
67
71
  .concat((_b = response.meta.loadedAddresses.readonly) !== null && _b !== void 0 ? _b : []);
68
- eventCoder = new anchor_1.BorshEventCoder(perpetuals_1.IDL);
72
+ eventCoder = new anchor_1.BorshEventCoder(perpetuals_json_1.default);
69
73
  events = [];
70
74
  _loop_1 = function (packet) {
71
75
  var previousProgram = accounts[instructions[packet.index].programIdIndex];
72
76
  packet.instructions.forEach(function (instruction, indexofInnerIns) {
73
- var bytes = bytes_1.bs58.decode(instruction.data);
77
+ var bytes = new Uint8Array(bytes_1.bs58.decode(instruction.data));
74
78
  var currentProgram = accounts[instruction.programIdIndex];
75
79
  var eventAuthority = accounts[instruction.accounts[0]];
76
80
  try {
@@ -1,6 +1,6 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import { Privilege } from "../types";
3
- export declare const getReferralAccounts: (tokenStakeAccount: PublicKey, userReferralAccount: PublicKey, rebateTokenAccount: PublicKey, privilege: Privilege) => {
3
+ export declare const getReferralAccounts: (tokenStakeAccount: PublicKey, userReferralAccount: PublicKey, privilege: Privilege) => {
4
4
  pubkey: PublicKey;
5
5
  isSigner: boolean;
6
6
  isWritable: boolean;
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getReferralAccounts = void 0;
4
4
  var web3_js_1 = require("@solana/web3.js");
5
5
  var types_1 = require("../types");
6
- var getReferralAccounts = function (tokenStakeAccount, userReferralAccount, rebateTokenAccount, privilege) {
6
+ var getReferralAccounts = function (tokenStakeAccount, userReferralAccount, privilege) {
7
7
  if ((0, types_1.isVariant)(privilege, 'none')) {
8
8
  return [];
9
9
  }
10
- if (tokenStakeAccount.equals(web3_js_1.PublicKey.default) || userReferralAccount.equals(web3_js_1.PublicKey.default) || rebateTokenAccount.equals(web3_js_1.PublicKey.default)) {
10
+ if (tokenStakeAccount.equals(web3_js_1.PublicKey.default) || userReferralAccount.equals(web3_js_1.PublicKey.default)) {
11
11
  console.log("skipping refferals");
12
12
  return [];
13
13
  }
@@ -22,12 +22,7 @@ var getReferralAccounts = function (tokenStakeAccount, userReferralAccount, reba
22
22
  pubkey: tokenStakeAccount,
23
23
  isSigner: false,
24
24
  isWritable: true,
25
- },
26
- {
27
- pubkey: rebateTokenAccount,
28
- isSigner: false,
29
- isWritable: !isStake,
30
- },
25
+ }
31
26
  ];
32
27
  };
33
28
  exports.getReferralAccounts = getReferralAccounts;
@@ -0,0 +1,13 @@
1
+ export declare const XSTOCKS_TOKENS_WITH_PRICE_IDS: {
2
+ symbol: string;
3
+ mintKey: string;
4
+ decimals: number;
5
+ usdPrecision: number;
6
+ tokenPrecision: number;
7
+ isStable: boolean;
8
+ isVirtual: boolean;
9
+ lazerId: number;
10
+ pythTicker: string;
11
+ pythPriceId: string;
12
+ isToken2022: boolean;
13
+ }[];