@sonarwatch/portfolio-plugins 0.14.145 → 0.14.151
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/CHANGELOG.md +24 -0
- package/package.json +1 -1
- package/src/plugins/ratex/getPool.d.ts +1 -2
- package/src/plugins/ratex/getPool.js +4 -3
- package/src/plugins/ratex/getPool.js.map +1 -1
- package/src/plugins/ratex/helpers.d.ts +7 -4
- package/src/plugins/ratex/helpers.js +11 -31
- package/src/plugins/ratex/helpers.js.map +1 -1
- package/src/plugins/ratex/marketsJob.js +4 -9
- package/src/plugins/ratex/marketsJob.js.map +1 -1
- package/src/plugins/ratex/positionsFetcher.js +2 -2
- package/src/plugins/ratex/positionsFetcher.js.map +1 -1
- package/src/plugins/ratex/structs.d.ts +211 -0
- package/src/plugins/ratex/structs.js +203 -0
- package/src/plugins/ratex/structs.js.map +1 -0
- package/src/plugins/ratex/types.d.ts +5 -76
- package/src/plugins/zeta/constants.d.ts +0 -2
- package/src/plugins/zeta/constants.js +1 -7
- package/src/plugins/zeta/constants.js.map +1 -1
- package/src/plugins/zeta/stakingFetcher.js +6 -3
- package/src/plugins/zeta/stakingFetcher.js.map +1 -1
- package/src/plugins/zeta/structs.d.ts +24 -1
- package/src/plugins/zeta/structs.js +30 -1
- package/src/plugins/zeta/structs.js.map +1 -1
- package/src/plugins/zeta/types.d.ts +0 -26
- package/src/plugins/zeta/types.js +0 -7
- package/src/plugins/zeta/types.js.map +1 -1
- package/src/plugins/ratex/idl.json +0 -8806
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.14.151](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.150...plugins-0.14.151) (2025-03-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [0.14.150](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.149...plugins-0.14.150) (2025-03-20)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [0.14.149](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.148...plugins-0.14.149) (2025-03-20)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.14.148](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.147...plugins-0.14.148) (2025-03-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [0.14.147](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.146...plugins-0.14.147) (2025-03-20)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.14.146](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.145...plugins-0.14.146) (2025-03-20)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
5
29
|
## [0.14.145](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.144...plugins-0.14.145) (2025-03-18)
|
|
6
30
|
|
|
7
31
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
|
2
2
|
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
|
3
|
-
import { IdlItem } from '@solanafm/explorer-kit-idls';
|
|
4
3
|
import { PublicKey } from '@solana/web3.js';
|
|
5
4
|
import { Cache } from '../../Cache';
|
|
6
5
|
import { YieldMarketWithOracle } from './types';
|
|
7
|
-
export declare const getPool: (poolId: PublicKey,
|
|
6
|
+
export declare const getPool: (poolId: PublicKey, cache: Cache) => Promise<YieldMarketWithOracle | undefined>;
|
|
@@ -15,7 +15,8 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
15
15
|
const constants_1 = require("./constants");
|
|
16
16
|
const solana_1 = require("../../utils/solana");
|
|
17
17
|
const clients_1 = require("../../utils/clients");
|
|
18
|
-
const
|
|
18
|
+
const structs_1 = require("./structs");
|
|
19
|
+
const getPool = (poolId, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
20
|
const cacheOpts = {
|
|
20
21
|
prefix: constants_1.poolPrefix,
|
|
21
22
|
networkId: portfolio_core_1.NetworkId.solana,
|
|
@@ -24,10 +25,10 @@ const getPool = (poolId, idlItem, cache) => __awaiter(void 0, void 0, void 0, fu
|
|
|
24
25
|
if (cachedPool)
|
|
25
26
|
return cachedPool;
|
|
26
27
|
const connection = (0, clients_1.getClientSolana)();
|
|
27
|
-
const pools = yield (0, solana_1.
|
|
28
|
+
const pools = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.yieldMarketStruct, [poolId]);
|
|
28
29
|
if (!pools[0])
|
|
29
30
|
return undefined;
|
|
30
|
-
const oracles = yield (0, solana_1.
|
|
31
|
+
const oracles = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.oracleStruct, [new web3_js_1.PublicKey(pools[0].oracle)]);
|
|
31
32
|
if (!oracles[0])
|
|
32
33
|
return undefined;
|
|
33
34
|
const poolWithOracle = Object.assign(Object.assign({}, pools[0]), { rate: oracles[0].rate });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPool.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/getPool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAuD;
|
|
1
|
+
{"version":3,"file":"getPool.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/getPool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAE5C,2CAAyC;AACzC,+CAAmE;AACnE,iDAAsD;AACtD,uCAA4D;AAGrD,MAAM,OAAO,GAAG,CACrB,MAAiB,EACjB,KAAY,EACgC,EAAE;IAC9C,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,OAAO,CACpC,MAAM,CAAC,QAAQ,EAAE,EACjB,SAAS,CACV,CAAC;IACF,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAElC,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,KAAK,GAAG,MAAM,IAAA,sCAA6B,EAC/C,UAAU,EACV,2BAAiB,EACjB,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAEhC,MAAM,OAAO,GAAG,MAAM,IAAA,sCAA6B,EACjD,UAAU,EACV,sBAAY,EACZ,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CACjC,CAAC;IAEF,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAElC,MAAM,cAAc,mCACf,KAAK,CAAC,CAAC,CAAC,KACX,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GACtB,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,cAAc,CAAC;AACxB,CAAC,CAAA,CAAC;AAxCW,QAAA,OAAO,WAwClB"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
|
2
|
+
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
4
|
import { ParsedAccount } from '../../utils/solana';
|
|
3
|
-
import {
|
|
5
|
+
import { Program, YieldMarketWithOracle } from './types';
|
|
4
6
|
import { Cache } from '../../Cache';
|
|
7
|
+
import { LP, User, UserStats } from './structs';
|
|
5
8
|
export declare const getUserStatsByProgram: (programs: Program[], owner: string) => Promise<Map<string, UserStats>>;
|
|
6
9
|
export declare const getUsersByProgram: (programs: Program[], userStatsByProgram: Map<string, UserStats>, owner: string) => Promise<Map<string, ParsedAccount<User>[]>>;
|
|
7
10
|
export declare const getLpDatasByProgram: (programs: Program[], userStatsByProgram: Map<string, UserStats>, owner: string) => Promise<Map<string, ParsedAccount<LP>[]>>;
|
|
8
11
|
export declare const getPools: (programs: Program[], lpDatasByProgram: Map<string, ParsedAccount<LP>[]>, cache: Cache) => Promise<Map<string, YieldMarketWithOracle>>;
|
|
9
|
-
export declare const getUsers: (owner: string, numberOfSubAccountsCreated: number,
|
|
10
|
-
export declare const getLpDatas: (owner: string, numberOfSubAccountsCreated: number,
|
|
12
|
+
export declare const getUsers: (owner: string, numberOfSubAccountsCreated: number, program: PublicKey) => Promise<(ParsedAccount<User> | null)[]>;
|
|
13
|
+
export declare const getLpDatas: (owner: string, numberOfSubAccountsCreated: number, programId: PublicKey) => Promise<(ParsedAccount<LP> | null)[]>;
|
|
@@ -17,19 +17,15 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
17
17
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
18
18
|
const solana_1 = require("../../utils/solana");
|
|
19
19
|
const clients_1 = require("../../utils/clients");
|
|
20
|
-
const idl_json_1 = __importDefault(require("./idl.json"));
|
|
21
20
|
const getPool_1 = require("./getPool");
|
|
21
|
+
const structs_1 = require("./structs");
|
|
22
22
|
const getUserStatsByProgram = (programs, owner) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
const connection = (0, clients_1.getClientSolana)();
|
|
24
24
|
const userStatsPdas = programs.map((program) => {
|
|
25
25
|
const [userStatsPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('user_stats'), new web3_js_1.PublicKey(owner).toBuffer()], new web3_js_1.PublicKey(program.programId));
|
|
26
26
|
return userStatsPda;
|
|
27
27
|
});
|
|
28
|
-
const userStatss = yield (0, solana_1.
|
|
29
|
-
programId: programs[0].programId,
|
|
30
|
-
idl: idl_json_1.default,
|
|
31
|
-
idlType: 'anchor',
|
|
32
|
-
}, userStatsPdas);
|
|
28
|
+
const userStatss = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.userStatsStruct, userStatsPdas);
|
|
33
29
|
const userStatsByProgram = new Map();
|
|
34
30
|
programs.forEach((program, i) => {
|
|
35
31
|
const userStats = userStatss[i];
|
|
@@ -45,12 +41,7 @@ const getUsersByProgram = (programs, userStatsByProgram, owner) => __awaiter(voi
|
|
|
45
41
|
const userStats = userStatsByProgram.get(program.programId);
|
|
46
42
|
if (!userStats || userStats.numberOfSubAccountsCreated === 0)
|
|
47
43
|
return null;
|
|
48
|
-
|
|
49
|
-
programId: program.programId,
|
|
50
|
-
idl: idl_json_1.default,
|
|
51
|
-
idlType: 'anchor',
|
|
52
|
-
};
|
|
53
|
-
return (0, exports.getUsers)(owner, userStats.numberOfSubAccountsCreated, idlItem);
|
|
44
|
+
return (0, exports.getUsers)(owner, userStats.numberOfSubAccountsCreated, new web3_js_1.PublicKey(program.programId));
|
|
54
45
|
}));
|
|
55
46
|
const usersByProgram = new Map();
|
|
56
47
|
programs.forEach((program, i) => {
|
|
@@ -67,12 +58,7 @@ const getLpDatasByProgram = (programs, userStatsByProgram, owner) => __awaiter(v
|
|
|
67
58
|
const userStats = userStatsByProgram.get(program.programId);
|
|
68
59
|
if (!userStats || userStats.numberOfSubAccountsCreated === 0)
|
|
69
60
|
return null;
|
|
70
|
-
|
|
71
|
-
programId: program.programId,
|
|
72
|
-
idl: idl_json_1.default,
|
|
73
|
-
idlType: 'anchor',
|
|
74
|
-
};
|
|
75
|
-
return (0, exports.getLpDatas)(owner, userStats.numberOfSubAccountsCreated, idlItem);
|
|
61
|
+
return (0, exports.getLpDatas)(owner, userStats.numberOfSubAccountsCreated, new web3_js_1.PublicKey(program.programId));
|
|
76
62
|
}));
|
|
77
63
|
const lpDatasByProgram = new Map();
|
|
78
64
|
programs.forEach((program, i) => {
|
|
@@ -90,13 +76,7 @@ const getPools = (programs, lpDatasByProgram, cache) => __awaiter(void 0, void 0
|
|
|
90
76
|
const lpDatas = lpDatasByProgram.get(program.programId);
|
|
91
77
|
if (!lpDatas)
|
|
92
78
|
return null;
|
|
93
|
-
|
|
94
|
-
programId: program.programId,
|
|
95
|
-
idl: idl_json_1.default,
|
|
96
|
-
idlType: 'anchor',
|
|
97
|
-
};
|
|
98
|
-
return Promise.all(lpDatas.map((lpData) => lpData &&
|
|
99
|
-
(0, getPool_1.getPool)(new web3_js_1.PublicKey(lpData.ammPosition.ammpool), idlItem, cache))).then((lpDatasPools) => {
|
|
79
|
+
return Promise.all(lpDatas.map((lpData) => lpData && (0, getPool_1.getPool)(new web3_js_1.PublicKey(lpData.ammPosition.ammpool), cache))).then((lpDatasPools) => {
|
|
100
80
|
lpDatasPools.forEach((p) => {
|
|
101
81
|
if (p) {
|
|
102
82
|
pools.set(p.pubkey.toString(), p);
|
|
@@ -107,32 +87,32 @@ const getPools = (programs, lpDatasByProgram, cache) => __awaiter(void 0, void 0
|
|
|
107
87
|
return pools;
|
|
108
88
|
});
|
|
109
89
|
exports.getPools = getPools;
|
|
110
|
-
const getUsers = (owner, numberOfSubAccountsCreated,
|
|
90
|
+
const getUsers = (owner, numberOfSubAccountsCreated, program) => {
|
|
111
91
|
const userPdas = [];
|
|
112
92
|
for (let subaccountId = 0; subaccountId < numberOfSubAccountsCreated; subaccountId++) {
|
|
113
93
|
const [userPda] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
114
94
|
Buffer.from('user'),
|
|
115
95
|
new web3_js_1.PublicKey(owner).toBuffer(),
|
|
116
96
|
new bn_js_1.default(subaccountId).toArrayLike(Buffer, 'le', 2),
|
|
117
|
-
],
|
|
97
|
+
], program);
|
|
118
98
|
userPdas.push(userPda);
|
|
119
99
|
}
|
|
120
100
|
const connection = (0, clients_1.getClientSolana)();
|
|
121
|
-
return (0, solana_1.
|
|
101
|
+
return (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.userStruct, userPdas);
|
|
122
102
|
};
|
|
123
103
|
exports.getUsers = getUsers;
|
|
124
|
-
const getLpDatas = (owner, numberOfSubAccountsCreated,
|
|
104
|
+
const getLpDatas = (owner, numberOfSubAccountsCreated, programId) => {
|
|
125
105
|
const lpPdas = [];
|
|
126
106
|
for (let subaccountId = 0; subaccountId < numberOfSubAccountsCreated; subaccountId++) {
|
|
127
107
|
const [lpPda] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
128
108
|
Buffer.from('lp'),
|
|
129
109
|
new web3_js_1.PublicKey(owner).toBuffer(),
|
|
130
110
|
new bn_js_1.default(subaccountId).toArrayLike(Buffer, 'le', 2),
|
|
131
|
-
],
|
|
111
|
+
], programId);
|
|
132
112
|
lpPdas.push(lpPda);
|
|
133
113
|
}
|
|
134
114
|
const connection = (0, clients_1.getClientSolana)();
|
|
135
|
-
return (0, solana_1.
|
|
115
|
+
return (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.lpStruct, lpPdas);
|
|
136
116
|
};
|
|
137
117
|
exports.getLpDatas = getLpDatas;
|
|
138
118
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAAuB;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAAuB;AACvB,+CAG4B;AAE5B,iDAAsD;AACtD,uCAAoC;AAEpC,uCAOmB;AAEZ,MAAM,qBAAqB,GAAG,CACnC,QAAmB,EACnB,KAAa,EACoB,EAAE;IACnC,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,aAAa,GAAG,QA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AM,CAAC,CAAC;AACrE,CAAC,CAAC;AAvBW,QAAA,UAAU,cAuBrB"}
|
|
@@ -17,8 +17,8 @@ const bn_js_1 = __importDefault(require("bn.js"));
|
|
|
17
17
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
18
18
|
const constants_1 = require("./constants");
|
|
19
19
|
const clients_1 = require("../../utils/clients");
|
|
20
|
-
const idl_json_1 = __importDefault(require("./idl.json"));
|
|
21
20
|
const solana_1 = require("../../utils/solana");
|
|
21
|
+
const structs_1 = require("./structs");
|
|
22
22
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
const connection = (0, clients_1.getClientSolana)();
|
|
24
24
|
const addressLookupTable = (yield connection.getAddressLookupTable(constants_1.programIdLookupTable)).value;
|
|
@@ -27,12 +27,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
27
27
|
const programs = [];
|
|
28
28
|
for (const programId of addressLookupTable.state.addresses) {
|
|
29
29
|
const [statePda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('ratex_state')], programId);
|
|
30
|
-
const
|
|
31
|
-
programId: programId.toString(),
|
|
32
|
-
idl: idl_json_1.default,
|
|
33
|
-
idlType: 'anchor',
|
|
34
|
-
};
|
|
35
|
-
const states = yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, idlItem, [statePda]);
|
|
30
|
+
const states = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.stateStruct, [statePda]);
|
|
36
31
|
if (!states[0])
|
|
37
32
|
continue;
|
|
38
33
|
const marketIndexStart = states[0]['marketIndexStart'];
|
|
@@ -40,12 +35,12 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
40
35
|
Buffer.from('margin_market'),
|
|
41
36
|
new bn_js_1.default(marketIndexStart).toArrayLike(Buffer, 'le', 4),
|
|
42
37
|
], programId);
|
|
43
|
-
const marginMarkets = yield (0, solana_1.
|
|
38
|
+
const marginMarkets = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.marginMarketStruct, [marginMarketPda]);
|
|
44
39
|
if (!marginMarkets[0])
|
|
45
40
|
continue;
|
|
46
41
|
programs.push({
|
|
47
42
|
programId: programId.toString(),
|
|
48
|
-
mint: marginMarkets[0].mint,
|
|
43
|
+
mint: marginMarkets[0].mint.toString(),
|
|
49
44
|
});
|
|
50
45
|
}
|
|
51
46
|
yield cache.setItem(constants_1.programsCacheKey, programs, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAA4C;
|
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAAuB;AACvB,+DAAuD;AAGvD,2CAIqB;AACrB,iDAAsD;AACtD,+CAAmE;AACnE,uCAKmB;AAEnB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,kBAAkB,GAAG,CACzB,MAAM,UAAU,CAAC,qBAAqB,CAAC,gCAAoB,CAAC,CAC7D,CAAC,KAAK,CAAC;IAER,IAAI,CAAC,kBAAkB;QAAE,OAAO;IAEhC,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,KAAK,MAAM,SAAS,IAAI,kBAAkB,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3D,MAAM,CAAC,QAAQ,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACjD,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAC5B,SAAS,CACV,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAA,sCAA6B,EAChD,UAAU,EACV,qBAAW,EACX,CAAC,QAAQ,CAAC,CACX,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAAE,SAAS;QAEzB,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAW,CAAC;QAEjE,MAAM,CAAC,eAAe,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACxD;YACE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;YAC5B,IAAI,eAAE,CAAC,gBAAgB,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACtD,EACD,SAAS,CACV,CAAC;QAEF,MAAM,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACvD,UAAU,EACV,4BAAkB,EAClB,CAAC,eAAe,CAAC,CAClB,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YAAE,SAAS;QAEhC,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE;YAC/B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,4BAAgB,EAAE,QAAQ,EAAE;QAC9C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
|
@@ -42,7 +42,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
42
42
|
if (!user)
|
|
43
43
|
return;
|
|
44
44
|
user.marginPositions.forEach((marginPosition) => {
|
|
45
|
-
if (marginPosition.balance
|
|
45
|
+
if (!marginPosition.balance.isZero()) {
|
|
46
46
|
const element = elementRegistry.addElementMultiple({
|
|
47
47
|
label: 'Margin',
|
|
48
48
|
link: 'https://app.rate-x.io/trade',
|
|
@@ -61,7 +61,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
61
61
|
lpDatas.forEach((lpData) => {
|
|
62
62
|
if (!lpData)
|
|
63
63
|
return;
|
|
64
|
-
const ammpool = pools.get(lpData.ammPosition.ammpool);
|
|
64
|
+
const ammpool = pools.get(lpData.ammPosition.ammpool.toString());
|
|
65
65
|
if (!ammpool)
|
|
66
66
|
return;
|
|
67
67
|
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(lpData.ammPosition.liquidity), ammpool.pool.tickCurrentIndex, lpData.ammPosition.tickLowerIndex, lpData.ammPosition.tickUpperIndex, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAErC,2CAA2D;AAE3D,gFAA6E;AAC7E,kEAA+D;AAE/D,wFAAyF;AACzF,uCAKmB;AACnB,8EAA2E;AAE3E,MAAM,YAAY,GAAG,IAAI,6BAAa,CAAY,4BAAgB,EAAE;IAClE,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEtD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAq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eAAe;oBACtB,IAAI,EAAE,iCAAiC;oBACvC,GAAG,EAAE,MAAM,CAAC,MAAM;oBAClB,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,MAAM;4BACZ,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;yBACnC;qBACF;iBACF,CAAC,CAAC;gBACH,OAAO,CAAC,QAAQ,CAAC;oBACf,OAAO,EAAE,OAAO,CAAC,IAAI;oBACrB,MAAM,EAAE,eAAe;yBACpB,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;yBACnB,IAAI,CAAC,gBAAgB,CAAC;yBACtB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;oBAC1B,cAAc,EAAE,IAAI;iBACrB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,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,211 @@
|
|
|
1
|
+
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
|
2
|
+
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
|
4
|
+
import BigNumber from 'bignumber.js';
|
|
5
|
+
import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
|
|
6
|
+
export type State = {
|
|
7
|
+
accountDiscriminator: number[];
|
|
8
|
+
admin: PublicKey;
|
|
9
|
+
signer: PublicKey;
|
|
10
|
+
numberOfAuthorities: BigNumber;
|
|
11
|
+
numberOfSubAccounts: BigNumber;
|
|
12
|
+
collateralRatioInitial: BigNumber;
|
|
13
|
+
collateralRatioMaintenance: BigNumber;
|
|
14
|
+
collateralRatioInitialPreExpiry: BigNumber;
|
|
15
|
+
numberOfYieldMarkets: number;
|
|
16
|
+
numberOfMarginMarkets: number;
|
|
17
|
+
signerNonce: number;
|
|
18
|
+
twapDuration: number;
|
|
19
|
+
marginIndexStart: number;
|
|
20
|
+
marketIndexStart: number;
|
|
21
|
+
keepers: PublicKey[];
|
|
22
|
+
keeperFeePerTx: BigNumber[];
|
|
23
|
+
keeperFee: BigNumber[];
|
|
24
|
+
};
|
|
25
|
+
export declare const stateStruct: FixableBeetStruct<State, Partial<State>>;
|
|
26
|
+
export type MarginMarket = {
|
|
27
|
+
accountDiscriminator: number[];
|
|
28
|
+
pubkey: PublicKey;
|
|
29
|
+
mint: PublicKey;
|
|
30
|
+
};
|
|
31
|
+
export declare const marginMarketStruct: FixableBeetStruct<MarginMarket, Partial<MarginMarket>>;
|
|
32
|
+
export type AmmpoolRewardInfo = {
|
|
33
|
+
mint: PublicKey;
|
|
34
|
+
vault: PublicKey;
|
|
35
|
+
authority: PublicKey;
|
|
36
|
+
emissionsPerSecondX64: BigNumber;
|
|
37
|
+
growthGlobalX64: BigNumber;
|
|
38
|
+
};
|
|
39
|
+
export declare const ammPoolRewardInfoStruct: BeetStruct<AmmpoolRewardInfo, Partial<AmmpoolRewardInfo>>;
|
|
40
|
+
export type Ammpool = {
|
|
41
|
+
ammpoolsConfig: PublicKey;
|
|
42
|
+
liquidity: BigNumber;
|
|
43
|
+
sqrtPrice: BigNumber;
|
|
44
|
+
protocolFeeOwedA: BigNumber;
|
|
45
|
+
protocolFeeOwedB: BigNumber;
|
|
46
|
+
tokenMintBase: PublicKey;
|
|
47
|
+
tokenVaultBase: PublicKey;
|
|
48
|
+
feeGrowthGlobalA: BigNumber;
|
|
49
|
+
tokenMintQuote: PublicKey;
|
|
50
|
+
tokenVaultQuote: PublicKey;
|
|
51
|
+
feeGrowthGlobalB: BigNumber;
|
|
52
|
+
rewardLastUpdatedTimestamp: BigNumber;
|
|
53
|
+
rewardInfos: AmmpoolRewardInfo[];
|
|
54
|
+
oracle: PublicKey;
|
|
55
|
+
tickCurrentIndex: number;
|
|
56
|
+
observationIndex: number;
|
|
57
|
+
observationUpdateDuration: number;
|
|
58
|
+
tickSpacing: number;
|
|
59
|
+
tickSpacingSeed: number[];
|
|
60
|
+
feeRate: number;
|
|
61
|
+
protocolFeeRate: number;
|
|
62
|
+
};
|
|
63
|
+
export declare const ammpoolStruct: BeetStruct<Ammpool, Partial<Ammpool>>;
|
|
64
|
+
export declare enum MarginType {
|
|
65
|
+
NonYieldBearing = 0,
|
|
66
|
+
YieldBearing = 1
|
|
67
|
+
}
|
|
68
|
+
export type YieldMarket = {
|
|
69
|
+
accountDiscriminator: number[];
|
|
70
|
+
pubkey: PublicKey;
|
|
71
|
+
oracle: PublicKey;
|
|
72
|
+
name: number[];
|
|
73
|
+
quoteAssetVault: PublicKey;
|
|
74
|
+
baseAssetVault: PublicKey;
|
|
75
|
+
pool: Ammpool;
|
|
76
|
+
startTs: BigNumber;
|
|
77
|
+
expireTs: BigNumber;
|
|
78
|
+
orderStepSize: BigNumber;
|
|
79
|
+
minOrderSize: BigNumber;
|
|
80
|
+
minLpAmount: BigNumber;
|
|
81
|
+
minLiquidationSize: BigNumber;
|
|
82
|
+
marketIndex: number;
|
|
83
|
+
marginIndex: number;
|
|
84
|
+
lpMarginIndex: number;
|
|
85
|
+
marginType: MarginType;
|
|
86
|
+
lpMarginType: MarginType;
|
|
87
|
+
marginDecimals: number;
|
|
88
|
+
lpMarginDecimals: number;
|
|
89
|
+
};
|
|
90
|
+
export declare const yieldMarketStruct: FixableBeetStruct<YieldMarket, Partial<YieldMarket>>;
|
|
91
|
+
export type Oracle = {
|
|
92
|
+
accountDiscriminator: number[];
|
|
93
|
+
admin: PublicKey;
|
|
94
|
+
name: number[];
|
|
95
|
+
lastRate: BigNumber;
|
|
96
|
+
rate: BigNumber;
|
|
97
|
+
marketRate: BigNumber;
|
|
98
|
+
ts: BigNumber;
|
|
99
|
+
decimals: number;
|
|
100
|
+
padding: number[];
|
|
101
|
+
epochStartTimestamp: BigNumber;
|
|
102
|
+
lastEpochStartTimestamp: BigNumber;
|
|
103
|
+
padding1: number[];
|
|
104
|
+
};
|
|
105
|
+
export declare const oracleStruct: FixableBeetStruct<Oracle, Partial<Oracle>>;
|
|
106
|
+
export type YieldPosition = {
|
|
107
|
+
baseAssetAmount: BigNumber;
|
|
108
|
+
quoteAssetAmount: BigNumber;
|
|
109
|
+
lastRate: BigNumber;
|
|
110
|
+
marketIndex: number;
|
|
111
|
+
padding1: number[];
|
|
112
|
+
padding2: number[];
|
|
113
|
+
};
|
|
114
|
+
export declare const yieldPositionStruct: BeetStruct<YieldPosition, Partial<YieldPosition>>;
|
|
115
|
+
export declare enum OrderStatus {
|
|
116
|
+
Init = 0,
|
|
117
|
+
Open = 1,
|
|
118
|
+
Filled = 2,
|
|
119
|
+
Canceled = 3
|
|
120
|
+
}
|
|
121
|
+
export declare enum OrderType {
|
|
122
|
+
Market = 0,
|
|
123
|
+
Limit = 1
|
|
124
|
+
}
|
|
125
|
+
export type Order = {
|
|
126
|
+
slot: BigNumber;
|
|
127
|
+
priceLimit: BigNumber;
|
|
128
|
+
baseAssetAmount: BigNumber;
|
|
129
|
+
baseAssetAmountFilled: BigNumber;
|
|
130
|
+
quoteAssetAmountFilled: BigNumber;
|
|
131
|
+
expireTs: BigNumber;
|
|
132
|
+
orderIndex: number;
|
|
133
|
+
orderId: number;
|
|
134
|
+
isolatedMarginAmount: BigNumber;
|
|
135
|
+
marketIndex: number;
|
|
136
|
+
status: OrderStatus;
|
|
137
|
+
orderType: OrderType;
|
|
138
|
+
isClose: boolean;
|
|
139
|
+
padding1: number[];
|
|
140
|
+
padding2: number[];
|
|
141
|
+
};
|
|
142
|
+
export declare const orderStruct: BeetStruct<Order, Partial<Order>>;
|
|
143
|
+
export type MarginPosition = {
|
|
144
|
+
balance: BigNumber;
|
|
145
|
+
marketIndex: number;
|
|
146
|
+
decimals: number;
|
|
147
|
+
padding2: number[];
|
|
148
|
+
};
|
|
149
|
+
export declare const marginPositionStruct: BeetStruct<MarginPosition, Partial<MarginPosition>>;
|
|
150
|
+
export type User = {
|
|
151
|
+
accountDiscriminator: number[];
|
|
152
|
+
authority: PublicKey;
|
|
153
|
+
marginPositions: MarginPosition[];
|
|
154
|
+
orders: Order[];
|
|
155
|
+
yieldPositions: YieldPosition[];
|
|
156
|
+
lastActiveSlot: BigNumber;
|
|
157
|
+
lastOrderId: number;
|
|
158
|
+
subAccountId: number;
|
|
159
|
+
idle: boolean;
|
|
160
|
+
padding2: boolean;
|
|
161
|
+
isIsolated: boolean;
|
|
162
|
+
isExpiryOn: boolean;
|
|
163
|
+
padding1: number[];
|
|
164
|
+
};
|
|
165
|
+
export declare const userStruct: FixableBeetStruct<User, Partial<User>>;
|
|
166
|
+
export type UserStats = {
|
|
167
|
+
accountDiscriminator: number[];
|
|
168
|
+
authority: PublicKey;
|
|
169
|
+
referrer: PublicKey;
|
|
170
|
+
numberOfSubAccounts: number;
|
|
171
|
+
numberOfSubAccountsCreated: number;
|
|
172
|
+
padding: number[];
|
|
173
|
+
};
|
|
174
|
+
export declare const userStatsStruct: BeetStruct<UserStats, Partial<UserStats>>;
|
|
175
|
+
export type PositionRewardInfo = {
|
|
176
|
+
growthInsideCheckpoint: BigNumber;
|
|
177
|
+
amountOwed: BigNumber;
|
|
178
|
+
};
|
|
179
|
+
export declare const positionrewardinfoStruct: BeetStruct<PositionRewardInfo, Partial<PositionRewardInfo>>;
|
|
180
|
+
export type AmmPosition = {
|
|
181
|
+
ammpool: PublicKey;
|
|
182
|
+
liquidity: BigNumber;
|
|
183
|
+
tickLowerIndex: number;
|
|
184
|
+
tickUpperIndex: number;
|
|
185
|
+
lowerRate: BigNumber;
|
|
186
|
+
upperRate: BigNumber;
|
|
187
|
+
feeGrowthCheckpointA: BigNumber;
|
|
188
|
+
feeOwedA: BigNumber;
|
|
189
|
+
feeGrowthCheckpointB: BigNumber;
|
|
190
|
+
feeOwedB: BigNumber;
|
|
191
|
+
rewardInfos: PositionRewardInfo[];
|
|
192
|
+
};
|
|
193
|
+
export declare const positionStruct: BeetStruct<AmmPosition, Partial<AmmPosition>>;
|
|
194
|
+
export declare enum LpStatus {
|
|
195
|
+
Active = 0,
|
|
196
|
+
Updating = 1
|
|
197
|
+
}
|
|
198
|
+
export type LP = {
|
|
199
|
+
accountDiscriminator: number[];
|
|
200
|
+
authority: PublicKey;
|
|
201
|
+
ammPosition: AmmPosition;
|
|
202
|
+
reserveQuoteAmount: BigNumber;
|
|
203
|
+
reserveBaseAmount: BigNumber;
|
|
204
|
+
lastActiveSlot: BigNumber;
|
|
205
|
+
subAccountId: BigNumber;
|
|
206
|
+
idle: boolean;
|
|
207
|
+
state: LpStatus;
|
|
208
|
+
padding1: number[];
|
|
209
|
+
padding2: number[];
|
|
210
|
+
};
|
|
211
|
+
export declare const lpStruct: BeetStruct<LP, Partial<LP>>;
|