@sonarwatch/portfolio-plugins 0.11.142 → 0.11.144

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/src/Cache.d.ts +4 -0
  4. package/src/Cache.js +5 -0
  5. package/src/Cache.js.map +1 -1
  6. package/src/index.js +4 -0
  7. package/src/index.js.map +1 -1
  8. package/src/plugins/accessprotocol/structs.d.ts +1 -1
  9. package/src/plugins/bonkrewards/structs.d.ts +1 -1
  10. package/src/plugins/cetus/poolsJob.js +10 -5
  11. package/src/plugins/cetus/poolsJob.js.map +1 -1
  12. package/src/plugins/foo/positionsSolanaFetcher.d.ts +3 -0
  13. package/src/plugins/foo/positionsSolanaFetcher.js +68 -0
  14. package/src/plugins/foo/positionsSolanaFetcher.js.map +1 -0
  15. package/src/plugins/foo/structs.d.ts +19 -0
  16. package/src/plugins/foo/structs.js +22 -0
  17. package/src/plugins/foo/structs.js.map +1 -0
  18. package/src/plugins/goosefx/structs.d.ts +1 -1
  19. package/src/plugins/jupiter/index.js +2 -1
  20. package/src/plugins/jupiter/index.js.map +1 -1
  21. package/src/plugins/jupiter/pricingJob.d.ts +3 -0
  22. package/src/plugins/jupiter/pricingJob.js +57 -0
  23. package/src/plugins/jupiter/pricingJob.js.map +1 -0
  24. package/src/plugins/jupiter/structs/aidrop.d.ts +1 -1
  25. package/src/plugins/jupiter/structs/valueAverage.d.ts +1 -1
  26. package/src/plugins/jupiter/structs/vote.d.ts +1 -1
  27. package/src/plugins/lifinity/structs.d.ts +1 -1
  28. package/src/plugins/native-stake/activeValidatorsJob.js +5 -5
  29. package/src/plugins/native-stake/activeValidatorsJob.js.map +1 -1
  30. package/src/plugins/native-stake/types.d.ts +6 -9
  31. package/src/plugins/phoenix/constants.d.ts +7 -0
  32. package/src/plugins/phoenix/constants.js +17 -0
  33. package/src/plugins/phoenix/constants.js.map +1 -0
  34. package/src/plugins/phoenix/helpers.d.ts +6 -0
  35. package/src/plugins/phoenix/helpers.js +46 -0
  36. package/src/plugins/phoenix/helpers.js.map +1 -0
  37. package/src/plugins/phoenix/helpers2.d.ts +0 -0
  38. package/src/plugins/phoenix/helpers2.js +179 -0
  39. package/src/plugins/phoenix/helpers2.js.map +1 -0
  40. package/src/plugins/phoenix/index.d.ts +6 -0
  41. package/src/plugins/phoenix/index.js +10 -0
  42. package/src/plugins/phoenix/index.js.map +1 -0
  43. package/src/plugins/phoenix/marketsJob.d.ts +3 -0
  44. package/src/plugins/phoenix/marketsJob.js +39 -0
  45. package/src/plugins/phoenix/marketsJob.js.map +1 -0
  46. package/src/plugins/phoenix/positionsFetcher.d.ts +3 -0
  47. package/src/plugins/phoenix/positionsFetcher.js +64 -0
  48. package/src/plugins/phoenix/positionsFetcher.js.map +1 -0
  49. package/src/plugins/phoenix/structs.d.ts +67 -0
  50. package/src/plugins/phoenix/structs.js +82 -0
  51. package/src/plugins/phoenix/structs.js.map +1 -0
  52. package/src/plugins/phoenix/types.d.ts +29 -0
  53. package/src/plugins/phoenix/types.js +3 -0
  54. package/src/plugins/phoenix/types.js.map +1 -0
  55. package/src/plugins/zeta/structs.d.ts +1 -1
  56. package/src/utils/clmm/tokenPricesFromSqrt.js +1 -3
  57. package/src/utils/clmm/tokenPricesFromSqrt.js.map +1 -1
  58. package/src/utils/solana/getProgramAccountsSafe.js +1 -1
  59. package/src/utils/solana/getProgramAccountsSafe.js.map +1 -1
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSeatAddress = exports.getSeatManagerAddress = exports.marketHeaderAccountToMarketHeader = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ const constants_1 = require("./constants");
6
+ function marketHeaderAccountToMarketHeader(marketHeaderAccount) {
7
+ return {
8
+ discriminant: marketHeaderAccount.discriminant.toString(),
9
+ status: marketHeaderAccount.status.toString(),
10
+ marketSizeParams: {
11
+ bidsSize: marketHeaderAccount.marketSizeParams.bidsSize.toString(),
12
+ asksSize: marketHeaderAccount.marketSizeParams.asksSize.toString(),
13
+ numSeats: marketHeaderAccount.marketSizeParams.numSeats.toString(),
14
+ },
15
+ baseParams: {
16
+ decimals: marketHeaderAccount.baseParams.decimals,
17
+ vaultBump: marketHeaderAccount.baseParams.vaultBump,
18
+ mintKey: marketHeaderAccount.baseParams.mintKey.toString(),
19
+ vaultKey: marketHeaderAccount.baseParams.vaultKey.toString(),
20
+ },
21
+ baseLotSize: marketHeaderAccount.baseLotSize.toString(),
22
+ quoteParams: {
23
+ decimals: marketHeaderAccount.quoteParams.decimals,
24
+ vaultBump: marketHeaderAccount.quoteParams.vaultBump,
25
+ mintKey: marketHeaderAccount.quoteParams.mintKey.toString(),
26
+ vaultKey: marketHeaderAccount.quoteParams.vaultKey.toString(),
27
+ },
28
+ quoteLotSize: marketHeaderAccount.quoteLotSize.toString(),
29
+ tickSizeInQuoteAtomsPerBaseUnit: marketHeaderAccount.tickSizeInQuoteAtomsPerBaseUnit.toString(),
30
+ authority: marketHeaderAccount.authority.toString(),
31
+ feeRecipient: marketHeaderAccount.feeRecipient.toString(),
32
+ marketSequenceNumber: marketHeaderAccount.marketSequenceNumber.toString(),
33
+ successor: marketHeaderAccount.successor.toString(),
34
+ rawBaseUnitsPerBaseUnit: marketHeaderAccount.rawBaseUnitsPerBaseUnit,
35
+ };
36
+ }
37
+ exports.marketHeaderAccountToMarketHeader = marketHeaderAccountToMarketHeader;
38
+ function getSeatManagerAddress(market) {
39
+ return web3_js_1.PublicKey.findProgramAddressSync([market.toBuffer()], constants_1.phoenixSeatManagerPid)[0];
40
+ }
41
+ exports.getSeatManagerAddress = getSeatManagerAddress;
42
+ function getSeatAddress(market, trader) {
43
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('seat'), market.toBuffer(), trader.toBuffer()], constants_1.phoenixPid)[0];
44
+ }
45
+ exports.getSeatAddress = getSeatAddress;
46
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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Q,EAAE;QAChE,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC,QAAQ,EAAE;QACnD,YAAY,EAAE,mBAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE;QACzD,oBAAoB,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,QAAQ,EAAE;QACzE,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC,QAAQ,EAAE;QACnD,uBAAuB,EAAE,mBAAmB,CAAC,uBAAuB;KACrE,CAAC;AACJ,CAAC;AAjCD,8EAiCC;AAED,SAAgB,qBAAqB,CAAC,MAAiB;IACrD,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EACnB,iCAAqB,CACtB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AALD,sDAKC;AAED,SAAgB,cAAc,CAC5B,MAAiB,EACjB,MAAiB;IAEjB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,EAC3D,sBAAU,CACX,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AARD,wCAQC"}
File without changes
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ // import { BeetArgsStruct } from '@metaplex-foundation/beet';
3
+ // import { TraderState, marketHeaderStruct, orderIdBeet } from './structs';
4
+ // export function deserializeRedBlackTree<Key, Value>(
5
+ // data: Buffer,
6
+ // keyDeserializer: BeetArgsStruct<Key>,
7
+ // valueDeserializer: BeetArgsStruct<Value>
8
+ // ): Map<Key, Value> {
9
+ // const tree = new Map<Key, Value>();
10
+ // const treeNodes = deserializeRedBlackTreeNodes(
11
+ // data,
12
+ // keyDeserializer,
13
+ // valueDeserializer
14
+ // );
15
+ // const nodes = treeNodes[0];
16
+ // const freeNodes = treeNodes[1];
17
+ // for (const [index, [key, value]] of nodes.entries()) {
18
+ // if (!freeNodes.has(index)) {
19
+ // tree.set(key, value);
20
+ // }
21
+ // }
22
+ // return tree;
23
+ // }
24
+ // function deserializeRedBlackTreeNodes<Key, Value>(
25
+ // data: Buffer,
26
+ // keyDeserializer: BeetArgsStruct<Key>,
27
+ // valueDeserializer: BeetArgsStruct<Value>
28
+ // ): [Array<[Key, Value]>, Set<number>] {
29
+ // let offset = 0;
30
+ // const keySize = keyDeserializer.byteSize;
31
+ // const valueSize = valueDeserializer.byteSize;
32
+ // const nodes = new Array<[Key, Value]>();
33
+ // // Skip RBTree header
34
+ // offset += 16;
35
+ // // Skip node allocator size
36
+ // offset += 8;
37
+ // const bumpIndex = data.readInt32LE(offset);
38
+ // offset += 4;
39
+ // let freeListHead = data.readInt32LE(offset);
40
+ // offset += 4;
41
+ // const freeListPointers = new Array<[number, number]>();
42
+ // for (let index = 0; offset < data.length && index < bumpIndex - 1; index++) {
43
+ // const registers = new Array<number>();
44
+ // for (let i = 0; i < 4; i++) {
45
+ // registers.push(data.readInt32LE(offset)); // skip padding
46
+ // offset += 4;
47
+ // }
48
+ // const [key] = keyDeserializer.deserialize(
49
+ // data.subarray(offset, offset + keySize)
50
+ // );
51
+ // offset += keySize;
52
+ // const [value] = valueDeserializer.deserialize(
53
+ // data.subarray(offset, offset + valueSize)
54
+ // );
55
+ // offset += valueSize;
56
+ // nodes.push([key, value]);
57
+ // freeListPointers.push([index, registers[0]]);
58
+ // }
59
+ // const freeNodes = new Set<number>();
60
+ // let indexToRemove = freeListHead - 1;
61
+ // let counter = 0;
62
+ // // If there's an infinite loop here, that means that the state is corrupted
63
+ // while (freeListHead < bumpIndex) {
64
+ // // We need to subtract 1 because the node allocator is 1-indexed
65
+ // const next = freeListPointers[freeListHead - 1];
66
+ // [indexToRemove, freeListHead] = next;
67
+ // freeNodes.add(indexToRemove);
68
+ // counter += 1;
69
+ // if (counter > bumpIndex) {
70
+ // throw new Error('Infinite loop detected');
71
+ // }
72
+ // }
73
+ // return [nodes, freeNodes];
74
+ // }
75
+ // export function deserializeMarketData(data: Buffer) {
76
+ // // Deserialize the market header
77
+ // let offset = marketHeaderStruct.byteSize;
78
+ // const [header] = marketHeaderStruct.deserialize(data.subarray(0, offset));
79
+ // // Parse market data
80
+ // const paddingLen = 8 * 32;
81
+ // let remaining = data.subarray(offset + paddingLen);
82
+ // offset = 0;
83
+ // const baseLotsPerBaseUnit = Number(remaining.readBigUInt64LE(offset));
84
+ // offset += 8;
85
+ // const quoteLotsPerBaseUnitPerTick = Number(remaining.readBigUInt64LE(offset));
86
+ // offset += 8;
87
+ // const sequenceNumber = Number(remaining.readBigUInt64LE(offset));
88
+ // offset += 8;
89
+ // const takerFeeBps = Number(remaining.readBigUInt64LE(offset));
90
+ // offset += 8;
91
+ // const collectedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
92
+ // offset += 8;
93
+ // const unclaimedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
94
+ // offset += 8;
95
+ // remaining = remaining.subarray(offset);
96
+ // // Parse bids, asks and traders
97
+ // const numBids = header.marketSizeParams.bidsSize.toNumber();
98
+ // const numAsks = header.marketSizeParams.asksSize.toNumber();
99
+ // const numTraders = header.marketSizeParams.numSeats.toNumber();
100
+ // const bidsSize =
101
+ // 16 + 16 + (16 + orderIdBeet.byteSize + restingOrderBeet.byteSize) * numBids;
102
+ // const asksSize =
103
+ // 16 + 16 + (16 + orderIdBeet.byteSize + restingOrderBeet.byteSize) * numAsks;
104
+ // const tradersSize =
105
+ // 16 + 16 + (16 + 32 + traderStateBeet.byteSize) * numTraders;
106
+ // offset = 0;
107
+ // const bidBuffer = remaining.subarray(offset, offset + bidsSize);
108
+ // offset += bidsSize;
109
+ // const askBuffer = remaining.subarray(offset, offset + asksSize);
110
+ // offset += asksSize;
111
+ // const traderBuffer = remaining.subarray(offset, offset + tradersSize);
112
+ // const bidsUnsorted = deserializeRedBlackTree(
113
+ // bidBuffer,
114
+ // orderIdBeet,
115
+ // restingOrderBeet
116
+ // );
117
+ // const asksUnsorted = deserializeRedBlackTree(
118
+ // askBuffer,
119
+ // orderIdBeet,
120
+ // restingOrderBeet
121
+ // );
122
+ // // Sort bids in descending order of price, and ascending order of sequence number
123
+ // const bids = [...bidsUnsorted].sort((a, b) => {
124
+ // const priceComparison = sign(
125
+ // toBN(b[0].priceInTicks).sub(toBN(a[0].priceInTicks))
126
+ // );
127
+ // if (priceComparison !== 0) {
128
+ // return priceComparison;
129
+ // }
130
+ // return sign(
131
+ // getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0]))
132
+ // );
133
+ // });
134
+ // // Sort asks in ascending order of price, and ascending order of sequence number
135
+ // const asks = [...asksUnsorted].sort((a, b) => {
136
+ // const priceComparison = sign(
137
+ // toBN(a[0].priceInTicks).sub(toBN(b[0].priceInTicks))
138
+ // );
139
+ // if (priceComparison !== 0) {
140
+ // return priceComparison;
141
+ // }
142
+ // return sign(
143
+ // getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0]))
144
+ // );
145
+ // });
146
+ // const traders = new Map<string, TraderState>();
147
+ // for (const [k, traderState] of deserializeRedBlackTree(
148
+ // traderBuffer,
149
+ // publicKeyBeet,
150
+ // traderStateBeet
151
+ // )) {
152
+ // traders.set(k.publicKey.toString(), traderState);
153
+ // }
154
+ // const traderPubkeyToTraderIndex = new Map<string, number>();
155
+ // const traderIndexToTraderPubkey = new Map<number, string>();
156
+ // for (const [k, index] of getNodeIndices(
157
+ // traderBuffer,
158
+ // publicKeyBeet,
159
+ // traderStateBeet
160
+ // )) {
161
+ // traderPubkeyToTraderIndex.set(k.publicKey.toString(), index);
162
+ // traderIndexToTraderPubkey.set(index, k.publicKey.toString());
163
+ // }
164
+ // return {
165
+ // header,
166
+ // baseLotsPerBaseUnit,
167
+ // quoteLotsPerBaseUnitPerTick,
168
+ // orderSequenceNumber: sequenceNumber,
169
+ // takerFeeBps,
170
+ // collectedQuoteLotFees,
171
+ // unclaimedQuoteLotFees,
172
+ // bids,
173
+ // asks,
174
+ // traders,
175
+ // traderPubkeyToTraderIndex,
176
+ // traderIndexToTraderPubkey,
177
+ // };
178
+ // }
179
+ //# sourceMappingURL=helpers2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers2.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/helpers2.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,4EAA4E;AAE5E,uDAAuD;AACvD,kBAAkB;AAClB,0CAA0C;AAC1C,6CAA6C;AAC7C,uBAAuB;AACvB,wCAAwC;AACxC,oDAAoD;AACpD,YAAY;AACZ,uBAAuB;AACvB,wBAAwB;AACxB,OAAO;AAEP,gCAAgC;AAChC,oCAAoC;AAEpC,2DAA2D;AAC3D,mCAAmC;AACnC,8BAA8B;AAC9B,QAAQ;AACR,MAAM;AAEN,iBAAiB;AACjB,IAAI;AAEJ,qDAAqD;AACrD,kBAAkB;AAClB,0CAA0C;AAC1C,6CAA6C;AAC7C,0CAA0C;AAC1C,oBAAoB;AACpB,8CAA8C;AAC9C,kDAAkD;AAElD,6CAA6C;AAE7C,0BAA0B;AAC1B,kBAAkB;AAElB,gCAAgC;AAChC,iBAAiB;AACjB,gDAAgD;AAChD,iBAAiB;AACjB,iDAAiD;AACjD,iBAAiB;AAEjB,4DAA4D;AAE5D,kFAAkF;AAClF,6CAA6C;AAC7C,oCAAoC;AACpC,kEAAkE;AAClE,qBAAqB;AACrB,QAAQ;AACR,iDAAiD;AACjD,gDAAgD;AAChD,SAAS;AACT,yBAAyB;AACzB,qDAAqD;AACrD,kDAAkD;AAClD,SAAS;AACT,2BAA2B;AAC3B,gCAAgC;AAChC,oDAAoD;AACpD,MAAM;AACN,yCAAyC;AACzC,0CAA0C;AAE1C,qBAAqB;AACrB,gFAAgF;AAChF,uCAAuC;AACvC,uEAAuE;AACvE,uDAAuD;AACvD,4CAA4C;AAC5C,oCAAoC;AACpC,oBAAoB;AACpB,iCAAiC;AACjC,mDAAmD;AACnD,QAAQ;AACR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;AACrB,sBAAsB;AACtB,SAAS;AACT,oEAAoE;AACpE,oEAAoE;AACpE,MAAM;AAEN,aAAa;AACb,cAAc;AACd,2BAA2B;AAC3B,mCAAmC;AACnC,2CAA2C;AAC3C,mBAAmB;AACnB,6BAA6B;AAC7B,6BAA6B;AAC7B,YAAY;AACZ,YAAY;AACZ,eAAe;AACf,iCAAiC;AACjC,iCAAiC;AACjC,OAAO;AACP,IAAI"}
@@ -0,0 +1,6 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { Fetcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ export declare const platforms: Platform[];
5
+ export declare const jobs: Job[];
6
+ export declare const fetchers: Fetcher[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchers = exports.jobs = exports.platforms = void 0;
4
+ // export const platforms: Platform[] = [platform];
5
+ // export const jobs: Job[] = [marketsJob];
6
+ // export const fetchers: Fetcher[] = [positionsFetcher];
7
+ exports.platforms = [];
8
+ exports.jobs = [];
9
+ exports.fetchers = [];
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/index.ts"],"names":[],"mappings":";;;AAOA,mDAAmD;AACnD,2CAA2C;AAC3C,yDAAyD;AAE5C,QAAA,SAAS,GAAe,EAAE,CAAC;AAC3B,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
+ const constants_1 = require("./constants");
14
+ const structs_1 = require("./structs");
15
+ const solana_1 = require("../../utils/solana");
16
+ const helpers_1 = require("./helpers");
17
+ const clients_1 = require("../../utils/clients");
18
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
19
+ const connection = (0, clients_1.getClientSolana)();
20
+ const marketsHeadersAccounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.marketHeaderStruct, constants_1.phoenixPid, [
21
+ {
22
+ dataSize: 445536,
23
+ },
24
+ ]);
25
+ yield cache.setItems(marketsHeadersAccounts.map((mha) => ({
26
+ key: mha.pubkey.toString(),
27
+ value: (0, helpers_1.marketHeaderAccountToMarketHeader)(mha),
28
+ })), {
29
+ prefix: constants_1.marketsCachePrefix,
30
+ networkId: portfolio_core_1.NetworkId.solana,
31
+ });
32
+ });
33
+ const job = {
34
+ id: `${constants_1.platformId}-markets`,
35
+ executor,
36
+ label: 'normal',
37
+ };
38
+ exports.default = job;
39
+ //# sourceMappingURL=marketsJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAAyE;AACzE,uCAA+C;AAC/C,+CAA8D;AAC9D,uCAA8D;AAC9D,iDAAsD;AAEtD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,sBAAsB,GAAG,MAAM,IAAA,iCAAwB,EAC3D,UAAU,EACV,4BAAkB,EAClB,sBAAU,EACV;QACE;YACE,QAAQ,EAAE,MAAM;SACjB;KACF,CACF,CAAC;IAEF,MAAM,KAAK,CAAC,QAAQ,CAClB,sBAAsB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACnC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC1B,KAAK,EAAE,IAAA,2CAAiC,EAAC,GAAG,CAAC;KAC9C,CAAC,CAAC,EACH;QACE,MAAM,EAAE,8BAAkB;QAC1B,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CACF,CAAC;AACJ,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
+ const constants_1 = require("./constants");
14
+ const clients_1 = require("../../utils/clients");
15
+ const solana_1 = require("../../utils/solana");
16
+ const structs_1 = require("./structs");
17
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const connection = (0, clients_1.getClientSolana)();
19
+ const accounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.seatStruct, constants_1.phoenixPid, [
20
+ {
21
+ dataSize: structs_1.seatStruct.byteSize,
22
+ },
23
+ {
24
+ memcmp: {
25
+ bytes: owner,
26
+ offset: 40,
27
+ },
28
+ },
29
+ ]);
30
+ console.log('accounts:', accounts);
31
+ if (accounts.length === 0)
32
+ return [];
33
+ const markets = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.marketHeaderStruct, constants_1.phoenixPid, [
34
+ {
35
+ dataSize: 445536,
36
+ },
37
+ ]);
38
+ console.log('marketHeaderStruct.byteSize:', structs_1.marketHeaderStruct.byteSize);
39
+ console.log('markets:', markets);
40
+ console.log('markets:', markets.length);
41
+ const solTokenPrice = yield cache.getTokenPrice(portfolio_core_1.solanaNativeAddress, portfolio_core_1.NetworkId.solana);
42
+ const assets = [];
43
+ accounts.forEach((acc) => { });
44
+ if (assets.length === 0)
45
+ return [];
46
+ const element = {
47
+ networkId: portfolio_core_1.NetworkId.solana,
48
+ label: 'Deposit',
49
+ platformId: constants_1.platformId,
50
+ type: portfolio_core_1.PortfolioElementType.multiple,
51
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
52
+ data: {
53
+ assets,
54
+ },
55
+ };
56
+ return [element];
57
+ });
58
+ const fetcher = {
59
+ id: `${constants_1.platformId}-positions`,
60
+ networkId: portfolio_core_1.NetworkId.solana,
61
+ executor,
62
+ };
63
+ exports.default = fetcher;
64
+ //# sourceMappingURL=positionsFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAQoC;AAGpC,2CAA4E;AAE5E,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA2D;AAG3D,MAAM,QA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CAAC,QAAQ;QACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,EAAE;YACJ,MAAM;SACP;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { BeetArgsStruct, BeetStruct, COption, FixableBeetStruct } from '@metaplex-foundation/beet';
2
+ import { PublicKey } from '@solana/web3.js';
3
+ import BigNumber from 'bignumber.js';
4
+ export type Seat = {
5
+ discriminant: BigNumber;
6
+ market: PublicKey;
7
+ trader: PublicKey;
8
+ approvalStatus: BigNumber;
9
+ padding: BigNumber[];
10
+ };
11
+ export declare const seatStruct: BeetStruct<Seat, Partial<Seat>>;
12
+ export type TokenParams = {
13
+ decimals: number;
14
+ vaultBump: number;
15
+ mintKey: PublicKey;
16
+ vaultKey: PublicKey;
17
+ };
18
+ export declare const tokenParamsStruct: BeetStruct<TokenParams, Partial<TokenParams>>;
19
+ export type MarketSizeParams = {
20
+ bidsSize: BigNumber;
21
+ asksSize: BigNumber;
22
+ numSeats: BigNumber;
23
+ };
24
+ export declare const marketSizeParamsBeet: BeetStruct<MarketSizeParams, Partial<MarketSizeParams>>;
25
+ export type MarketHeaderAccount = {
26
+ discriminant: BigNumber;
27
+ status: BigNumber;
28
+ marketSizeParams: MarketSizeParams;
29
+ baseParams: TokenParams;
30
+ baseLotSize: BigNumber;
31
+ quoteParams: TokenParams;
32
+ quoteLotSize: BigNumber;
33
+ tickSizeInQuoteAtomsPerBaseUnit: BigNumber;
34
+ authority: PublicKey;
35
+ feeRecipient: PublicKey;
36
+ marketSequenceNumber: BigNumber;
37
+ successor: PublicKey;
38
+ rawBaseUnitsPerBaseUnit: number;
39
+ padding1: number;
40
+ padding2: BigNumber[];
41
+ };
42
+ export declare const marketHeaderStruct: BeetStruct<MarketHeaderAccount, Partial<MarketHeaderAccount>>;
43
+ export type CondensedOrder = {
44
+ priceInTicks: BigNumber;
45
+ sizeInBaseLots: BigNumber;
46
+ lastValidSlot: COption<BigNumber>;
47
+ lastValidUnixTimestampInSeconds: COption<BigNumber>;
48
+ };
49
+ export declare const condensedOrderBeet: FixableBeetStruct<CondensedOrder, Partial<CondensedOrder>>;
50
+ export declare enum FailedMultipleLimitOrderBehavior {
51
+ FailOnInsufficientFundsAndAmendOnCross = 0,
52
+ FailOnInsufficientFundsAndFailOnCross = 1,
53
+ SkipOnInsufficientFundsAndAmendOnCross = 2,
54
+ SkipOnInsufficientFundsAndFailOnCross = 3
55
+ }
56
+ export type MultipleOrderPacket = {
57
+ bids: CondensedOrder[];
58
+ asks: CondensedOrder[];
59
+ clientOrderId: COption<BigNumber>;
60
+ failedMultipleLimitOrderBehavior: FailedMultipleLimitOrderBehavior;
61
+ };
62
+ export declare const multipleOrderPacketStruct: FixableBeetStruct<MultipleOrderPacket, Partial<MultipleOrderPacket>>;
63
+ export type OrderId = {
64
+ priceInTicks: BigNumber;
65
+ orderSequenceNumber: BigNumber;
66
+ };
67
+ export declare const orderIdBeet: BeetArgsStruct<OrderId>;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.orderIdBeet = exports.multipleOrderPacketStruct = exports.FailedMultipleLimitOrderBehavior = exports.condensedOrderBeet = exports.marketHeaderStruct = exports.marketSizeParamsBeet = exports.tokenParamsStruct = exports.seatStruct = void 0;
4
+ const beet_1 = require("@metaplex-foundation/beet");
5
+ const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
+ const solana_1 = require("../../utils/solana");
7
+ exports.seatStruct = new beet_1.BeetStruct([
8
+ ['discriminant', solana_1.u64],
9
+ ['market', beet_solana_1.publicKey],
10
+ ['trader', beet_solana_1.publicKey],
11
+ ['approvalStatus', solana_1.u64],
12
+ ['padding', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 6)],
13
+ ], (args) => args);
14
+ exports.tokenParamsStruct = new beet_1.BeetStruct([
15
+ ['decimals', beet_1.u32],
16
+ ['vaultBump', beet_1.u32],
17
+ ['mintKey', beet_solana_1.publicKey],
18
+ ['vaultKey', beet_solana_1.publicKey],
19
+ ], (args) => args);
20
+ exports.marketSizeParamsBeet = new beet_1.BeetStruct([
21
+ ['bidsSize', solana_1.u64],
22
+ ['asksSize', solana_1.u64],
23
+ ['numSeats', solana_1.u64],
24
+ ], (args) => args);
25
+ exports.marketHeaderStruct = new beet_1.BeetStruct([
26
+ ['discriminant', solana_1.u64],
27
+ ['status', solana_1.u64],
28
+ ['marketSizeParams', exports.marketSizeParamsBeet],
29
+ ['baseParams', exports.tokenParamsStruct],
30
+ ['baseLotSize', solana_1.u64],
31
+ ['quoteParams', exports.tokenParamsStruct],
32
+ ['quoteLotSize', solana_1.u64],
33
+ ['tickSizeInQuoteAtomsPerBaseUnit', solana_1.u64],
34
+ ['authority', beet_solana_1.publicKey],
35
+ ['feeRecipient', beet_solana_1.publicKey],
36
+ ['marketSequenceNumber', solana_1.u64],
37
+ ['successor', beet_solana_1.publicKey],
38
+ ['rawBaseUnitsPerBaseUnit', beet_1.u32],
39
+ ['padding1', beet_1.u32],
40
+ ['padding2', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 32)],
41
+ ], (args) => args);
42
+ exports.condensedOrderBeet = new beet_1.FixableBeetStruct([
43
+ ['priceInTicks', solana_1.u64],
44
+ ['sizeInBaseLots', solana_1.u64],
45
+ ['lastValidSlot', (0, beet_1.coption)(solana_1.u64)],
46
+ ['lastValidUnixTimestampInSeconds', (0, beet_1.coption)(solana_1.u64)],
47
+ ], (args) => args);
48
+ var FailedMultipleLimitOrderBehavior;
49
+ (function (FailedMultipleLimitOrderBehavior) {
50
+ FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["FailOnInsufficientFundsAndAmendOnCross"] = 0] = "FailOnInsufficientFundsAndAmendOnCross";
51
+ FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["FailOnInsufficientFundsAndFailOnCross"] = 1] = "FailOnInsufficientFundsAndFailOnCross";
52
+ FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["SkipOnInsufficientFundsAndAmendOnCross"] = 2] = "SkipOnInsufficientFundsAndAmendOnCross";
53
+ FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["SkipOnInsufficientFundsAndFailOnCross"] = 3] = "SkipOnInsufficientFundsAndFailOnCross";
54
+ })(FailedMultipleLimitOrderBehavior || (exports.FailedMultipleLimitOrderBehavior = FailedMultipleLimitOrderBehavior = {}));
55
+ exports.multipleOrderPacketStruct = new beet_1.FixableBeetStruct([
56
+ ['bids', (0, beet_1.array)(exports.condensedOrderBeet)],
57
+ ['asks', (0, beet_1.array)(exports.condensedOrderBeet)],
58
+ ['clientOrderId', (0, beet_1.coption)(solana_1.u128)],
59
+ ['failedMultipleLimitOrderBehavior', beet_1.u8],
60
+ ], (args) => args);
61
+ exports.orderIdBeet = new beet_1.BeetArgsStruct([
62
+ ['priceInTicks', solana_1.u64],
63
+ ['orderSequenceNumber', solana_1.u64],
64
+ ], 'fIFOOrderId');
65
+ // export type TraderState = {
66
+ // quoteLotsLocked: bignum;
67
+ // quoteLotsFree: bignum;
68
+ // baseLotsLocked: bignum;
69
+ // baseLotsFree: bignum;
70
+ // padding: bignum[]; // size: 8
71
+ // };
72
+ // export const traderStateBeet = new BeetStruct<TraderState>(
73
+ // [
74
+ // ['quoteLotsLocked', u64],
75
+ // ['quoteLotsFree', u64],
76
+ // ['baseLotsLocked', u64],
77
+ // ['baseLotsFree', u64],
78
+ // ['padding', uniformFixedSizeArray(u64, 8)],
79
+ // ],
80
+ // (args) => args as TraderState
81
+ // );
82
+ //# sourceMappingURL=structs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/structs.ts"],"names":[],"mappings":";;;AAAA,oDAWmC;AACnC,kEAA6D;AAG7D,+CAA+C;AAUlC,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,YAAG,EAAE,CAAC,CAAC,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AAQW,QAAA,iBAAiB,GAAG,IAAI,iBAAU,CAC7C;IACE,CAAC,UAAU,EAAE,UAAG,CAAC;IACjB,CAAC,WAAW,EAAE,UAAG,CAAC;IAClB,CAAC,SAAS,EAAE,uBAAS,CAAC;IACtB,CAAC,UAAU,EAAE,uBAAS,CAAC;CACxB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC;AAMW,QAAA,oBAAoB,GAAG,IAAI,iBAAU,CAChD;IACE,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,UAAU,EAAE,YAAG,CAAC;CAClB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAwB,CACnC,CAAC;AAmBW,QAAA,kBAAkB,GAAG,IAAI,iBAAU,CAC9C;IACE,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,kBAAkB,EAAE,4BAAoB,CAAC;IAC1C,CAAC,YAAY,EAAE,yBAAiB,CAAC;IACjC,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,C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AI,EAAE,EAAE,CAAC,IAA2B,CACtC,CAAC;AAMS,QAAA,WAAW,GAAG,IAAI,qBAAc,CAC3C;IACE,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,qBAAqB,EAAE,YAAG,CAAC;CAC7B,EACD,aAAa,CACd,CAAC;AAEF,8BAA8B;AAC9B,6BAA6B;AAC7B,2BAA2B;AAC3B,4BAA4B;AAC5B,0BAA0B;AAC1B,kCAAkC;AAClC,KAAK;AACL,8DAA8D;AAC9D,MAAM;AACN,gCAAgC;AAChC,8BAA8B;AAC9B,+BAA+B;AAC/B,6BAA6B;AAC7B,kDAAkD;AAClD,OAAO;AACP,kCAAkC;AAClC,KAAK"}
@@ -0,0 +1,29 @@
1
+ export type MarketHeader = {
2
+ discriminant: string;
3
+ status: string;
4
+ marketSizeParams: {
5
+ bidsSize: string;
6
+ asksSize: string;
7
+ numSeats: string;
8
+ };
9
+ baseParams: {
10
+ decimals: number;
11
+ vaultBump: number;
12
+ mintKey: string;
13
+ vaultKey: string;
14
+ };
15
+ baseLotSize: string;
16
+ quoteParams: {
17
+ decimals: number;
18
+ vaultBump: number;
19
+ mintKey: string;
20
+ vaultKey: string;
21
+ };
22
+ quoteLotSize: string;
23
+ tickSizeInQuoteAtomsPerBaseUnit: string;
24
+ authority: string;
25
+ feeRecipient: string;
26
+ marketSequenceNumber: string;
27
+ successor: string;
28
+ rawBaseUnitsPerBaseUnit: number;
29
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/types.ts"],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
3
- import { PublicKey } from '@metaplex-foundation/js';
3
+ import { PublicKey } from '@solana/web3.js';
4
4
  import BigNumber from 'bignumber.js';
5
5
  export declare enum MarginAccountType {
6
6
  Normal = 0,
@@ -24,9 +24,7 @@ function storeTokenPricesFromSqrt(cache, networkId, source, reserveX, reserveY,
24
24
  if (!getLpUnderlyingTokenSource_1.defaultAcceptedPairs.includes(mintX) &&
25
25
  !getLpUnderlyingTokenSource_1.defaultAcceptedPairs.includes(mintY))
26
26
  return undefined;
27
- const tokensPrices = yield cache.getTokenPrices([mintX, mintY], networkId);
28
- const tokenPriceX = tokensPrices[0];
29
- const tokenPriceY = tokensPrices[1];
27
+ const [tokenPriceX, tokenPriceY] = yield cache.getTokenPrices([mintX, mintY], networkId);
30
28
  if (!tokenPriceX && !tokenPriceY)
31
29
  return undefined;
32
30
  const decimalsX = tempDecimalsX || (yield (0, getDecimalsForToken_1.getDecimalsForToken)(cache, mintX, networkId));
@@ -1 +1 @@
1
- {"version":3,"file":"tokenPricesFromSqrt.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/clmm/tokenPricesFromSqrt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,4DAAiC;AAEjC,qEAAkE;AAClE,8DAAsE;AACtE,8EAAsD;AACtD,2EAAkE;AAClE,mFAA0E;AAE1E,SAA8B,wBAAwB,CACpD,KAAY,EACZ,SAAwB,EACxB,MAAc,EACd,QAAmB,EACnB,QAAmB,EACnB,SAAoB,EACpB,KAAa,EACb,KAAa,EACb,aAAsB,EACtB,aAAsB;;QAEtB,IACE,CAAC,iDAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC;YACrC,CAAC,iDAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC;YAErC,OAAO,SAAS,CAAC;QAEnB,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;QAC3E,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,WAAW,GAAG,YAA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AAI,oBAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;SACxD,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,oBAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;AACjD,CAAC;AARD,kDAQC"}
1
+ {"version":3,"file":"tokenPricesFromSqrt.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/clmm/tokenPricesFromSqrt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,4DAAiC;AAEjC,qEAAkE;AAClE,8DAAsE;AACtE,8EAAsD;AACtD,2EAAkE;AAClE,mFAA0E;AAE1E,SAA8B,wBAAwB,CACpD,KAAY,EACZ,SAAwB,EACxB,MAAc,EACd,QAAmB,EACnB,QAAmB,EACnB,SAAoB,EACpB,KAAa,EACb,KAAa,EACb,aAAsB,EACtB,aAAsB;;QAEtB,IACE,CAAC,iDAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC;YACrC,CAAC,iDAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC;YAErC,OAAO,SAAS,CAAC;QAEnB,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,MAAM,KAAK,CAAC,cAAc,CAC3D,CAAC,KAAK,EAAE,KAAK,CAAC,EACd,SAAS,CACV,CAAC;QACF,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW;YAAE,OAAO,SAAS,CAAC;QAEnD,MAAM,SAAS,GACb,aAAa,IAAI,CAAC,MAAM,IAAA,yCAAmB,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;QACxE,MAAM,SAAS,GACb,aAAa,IAAI,CAAC,MAAM,IAAA,yCAAmB,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS;YAAE,OAAO,SAAS,CAAC;QAC/C,MAAM,SAAS,GAAG,mBAAmB,CAA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,CAAC,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,GAAG,CAAC,CAAC;YACpC,IAAI,GAAG,CAAC,UAAU,CAAC,yCAAgB,CAAC;gBAAE,OAAO,SAAS,CAAC;YACvD,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,EAAE,MAAM;gBACV,MAAM;gBACN,OAAO,EAAE,KAAK;gBACd,SAAS;gBACT,UAAU,EAAE,gCAAoB,CAAC,EAAE;gBACnC,QAAQ,EAAE,SAAS;gBACnB,KAAK;gBACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB,CAAC;YACF,MAAM,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;YAClD,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CAAA;AA5ED,2CA4EC;AAED,MAAM,cAAc,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAExE,SAAgB,mBAAmB,CACjC,YAAuB,EACvB,SAAiB,EACjB,SAAiB;IAEjB,OAAO,cAAc,CAAC,IAAI,oBAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;SACxD,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,oBAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;AACjD,CAAC;AARD,kDAQC"}
@@ -21,7 +21,7 @@ function getProgramAccountsSafe(connection, maxAccounts, programId, filters = un
21
21
  return connection.getProgramAccounts(programId, config);
22
22
  const accountsRes = yield connection.getProgramAccounts(programId, Object.assign(Object.assign({}, config), { dataSlice: { offset: 0, length: 0 } }));
23
23
  if (accountsRes.length > maxAccounts)
24
- throw new Error('Too much accounts to get');
24
+ throw new Error(`Too much accounts to get (${accountsRes.length})`);
25
25
  return connection.getProgramAccounts(programId, config);
26
26
  });
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getProgramAccountsSafe.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getProgramAccountsSafe.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,SAAsB,sBAAsB,CAC1C,UAAsB,EACtB,WAAmB,EACnB,SAAoB,EACpB,UAAkD,SAAS;;QAE3D,MAAM,MAAM,GAA6B;YACvC,UAAU,EAAE,WAAW;YACvB,QAAQ,EAAE,QAAQ;YAClB,OAAO;SACR,CAAC;QAEF,IAAI,WAAW,GAAG,CAAC;YAAE,OAAO,UAAU,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE7E,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC,SAAS,kCAC5D,MAAM,KACT,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IACnC,CAAC;QACH,IAAI,WAAW,CAAC,MAAM,GAAG,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAElF,OAAO,UAAU,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;CAAA;AArBD,wDAqBC"}
1
+ {"version":3,"file":"getProgramAccountsSafe.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getProgramAccountsSafe.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,SAAsB,sBAAsB,CAC1C,UAAsB,EACtB,WAAmB,EACnB,SAAoB,EACpB,UAAkD,SAAS;;QAE3D,MAAM,MAAM,GAA6B;YACvC,UAAU,EAAE,WAAW;YACvB,QAAQ,EAAE,QAAQ;YAClB,OAAO;SACR,CAAC;QAEF,IAAI,WAAW,GAAG,CAAC;YAAE,OAAO,UAAU,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE7E,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC,SAAS,kCAC5D,MAAM,KACT,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IACnC,CAAC;QACH,IAAI,WAAW,CAAC,MAAM,GAAG,WAAW;YAClC,MAAM,IAAI,KAAK,CAAC,6BAA6B,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;QAEtE,OAAO,UAAU,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;CAAA;AAtBD,wDAsBC"}