@sonarwatch/portfolio-plugins 0.11.143 → 0.11.144
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/accessprotocol/structs.d.ts +1 -1
- package/src/plugins/bonkrewards/structs.d.ts +1 -1
- package/src/plugins/foo/positionsSolanaFetcher.d.ts +3 -0
- package/src/plugins/foo/positionsSolanaFetcher.js +68 -0
- package/src/plugins/foo/positionsSolanaFetcher.js.map +1 -0
- package/src/plugins/foo/structs.d.ts +19 -0
- package/src/plugins/foo/structs.js +22 -0
- package/src/plugins/foo/structs.js.map +1 -0
- package/src/plugins/goosefx/structs.d.ts +1 -1
- package/src/plugins/jupiter/index.js +2 -1
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/jupiter/pricingJob.d.ts +3 -0
- package/src/plugins/jupiter/pricingJob.js +57 -0
- package/src/plugins/jupiter/pricingJob.js.map +1 -0
- package/src/plugins/jupiter/structs/aidrop.d.ts +1 -1
- package/src/plugins/jupiter/structs/valueAverage.d.ts +1 -1
- package/src/plugins/jupiter/structs/vote.d.ts +1 -1
- package/src/plugins/lifinity/structs.d.ts +1 -1
- package/src/plugins/native-stake/activeValidatorsJob.js +5 -5
- package/src/plugins/native-stake/activeValidatorsJob.js.map +1 -1
- package/src/plugins/native-stake/types.d.ts +6 -9
- package/src/plugins/phoenix/constants.d.ts +7 -0
- package/src/plugins/phoenix/constants.js +17 -0
- package/src/plugins/phoenix/constants.js.map +1 -0
- package/src/plugins/phoenix/helpers.d.ts +6 -0
- package/src/plugins/phoenix/helpers.js +46 -0
- package/src/plugins/phoenix/helpers.js.map +1 -0
- package/src/plugins/phoenix/helpers2.d.ts +0 -0
- package/src/plugins/phoenix/helpers2.js +179 -0
- package/src/plugins/phoenix/helpers2.js.map +1 -0
- package/src/plugins/phoenix/index.d.ts +6 -0
- package/src/plugins/phoenix/index.js +10 -0
- package/src/plugins/phoenix/index.js.map +1 -0
- package/src/plugins/phoenix/marketsJob.d.ts +3 -0
- package/src/plugins/phoenix/marketsJob.js +39 -0
- package/src/plugins/phoenix/marketsJob.js.map +1 -0
- package/src/plugins/phoenix/positionsFetcher.d.ts +3 -0
- package/src/plugins/phoenix/positionsFetcher.js +64 -0
- package/src/plugins/phoenix/positionsFetcher.js.map +1 -0
- package/src/plugins/phoenix/structs.d.ts +67 -0
- package/src/plugins/phoenix/structs.js +82 -0
- package/src/plugins/phoenix/structs.js.map +1 -0
- package/src/plugins/phoenix/types.d.ts +29 -0
- package/src/plugins/phoenix/types.js +3 -0
- package/src/plugins/phoenix/types.js.map +1 -0
- package/src/plugins/zeta/structs.d.ts +1 -1
- package/src/utils/solana/getProgramAccountsSafe.js +1 -1
- package/src/utils/solana/getProgramAccountsSafe.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.11.144](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.143...plugins-0.11.144) (2024-03-23)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.11.143](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.142...plugins-0.11.143) (2024-03-22)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.144",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"web3-v1": "npm:web3@^1.5.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.144"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -96,6 +96,7 @@ const kai_1 = require("./plugins/kai");
|
|
96
96
|
const suilend_1 = require("./plugins/suilend");
|
97
97
|
const symmetry_1 = require("./plugins/symmetry");
|
98
98
|
const staratlas_1 = require("./plugins/staratlas");
|
99
|
+
const phoenix_1 = require("./plugins/phoenix");
|
99
100
|
var constants_1 = require("./plugins/tokens/constants");
|
100
101
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
101
102
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -185,6 +186,7 @@ exports.platforms = [
|
|
185
186
|
...suilend_1.platforms,
|
186
187
|
...symmetry_1.platforms,
|
187
188
|
...staratlas_1.platforms,
|
189
|
+
...phoenix_1.platforms,
|
188
190
|
];
|
189
191
|
// JOBS //
|
190
192
|
exports.jobs = [
|
@@ -257,6 +259,7 @@ exports.jobs = [
|
|
257
259
|
...suilend_1.jobs,
|
258
260
|
...symmetry_1.jobs,
|
259
261
|
...staratlas_1.jobs,
|
262
|
+
...phoenix_1.jobs,
|
260
263
|
];
|
261
264
|
// FETCHERS //
|
262
265
|
exports.fetchers = [
|
@@ -331,6 +334,7 @@ exports.fetchers = [
|
|
331
334
|
...suilend_1.fetchers,
|
332
335
|
...symmetry_1.fetchers,
|
333
336
|
...staratlas_1.fetchers,
|
337
|
+
...phoenix_1.fetchers,
|
334
338
|
];
|
335
339
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
336
340
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;A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ACpB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,cAAe;IAClB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,kBAAe;IAClB,GAAG,qBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,kBAAe;IAClB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,sBAAmB;IACtB,GAAG,yBAAsB;IACzB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,sBAAkB;IACrB,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,kBAAe;CACnB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export type StakeDepositReceipt = {
|
6
6
|
buffer: Buffer;
|
@@ -0,0 +1,68 @@
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const web3_js_1 = require("@solana/web3.js");
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const solana_1 = require("../../utils/solana");
|
20
|
+
const structs_1 = require("./structs");
|
21
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const connection = (0, clients_1.getClientSolana)();
|
24
|
+
const accounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.liquidityStruct, new web3_js_1.PublicKey('pid'), [
|
25
|
+
{
|
26
|
+
dataSize: structs_1.liquidityStruct.byteSize,
|
27
|
+
},
|
28
|
+
{
|
29
|
+
memcmp: {
|
30
|
+
bytes: owner,
|
31
|
+
offset: 40,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
]);
|
35
|
+
if (accounts.length === 0)
|
36
|
+
return [];
|
37
|
+
const solTokenPrice = yield cache.getTokenPrice(portfolio_core_1.solanaNativeAddress, portfolio_core_1.NetworkId.solana);
|
38
|
+
const assets = [];
|
39
|
+
accounts.forEach((acc) => {
|
40
|
+
if (acc.amountDeposited.isZero())
|
41
|
+
return;
|
42
|
+
const amount = acc.amountDeposited
|
43
|
+
.div(Math.pow(10, portfolio_core_1.solanaNativeDecimals))
|
44
|
+
.toNumber();
|
45
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.solanaNativeAddress, amount, portfolio_core_1.NetworkId.solana, solTokenPrice);
|
46
|
+
assets.push(asset);
|
47
|
+
});
|
48
|
+
if (assets.length === 0)
|
49
|
+
return [];
|
50
|
+
const element = {
|
51
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
52
|
+
label: 'Deposit',
|
53
|
+
platformId: constants_1.platformId,
|
54
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
55
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
|
56
|
+
data: {
|
57
|
+
assets,
|
58
|
+
},
|
59
|
+
};
|
60
|
+
return [element];
|
61
|
+
});
|
62
|
+
const fetcher = {
|
63
|
+
id: `${constants_1.platformId}-positions-solana`,
|
64
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
65
|
+
executor,
|
66
|
+
};
|
67
|
+
exports.default = fetcher;
|
68
|
+
//# sourceMappingURL=positionsSolanaFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"positionsSolanaFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/positionsSolanaFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,6CAA4C;AAE5C,2CAAyC;AAEzC,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA4C;AAC5C,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,UAAU,EACV,yBAAe,EACf,IAAI,mBAAS,CAAC,KAAK,CAAC,EACpB;QACE;YACE,QAAQ,EAAE,yBA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GAAG,sBAAU,mBAAmB;IACpC,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export declare enum State {
|
6
|
+
Uninitialized = 0,
|
7
|
+
StakePool = 1,
|
8
|
+
InactiveStakePool = 2,
|
9
|
+
StakeAccount = 3
|
10
|
+
}
|
11
|
+
export type Liquidity = {
|
12
|
+
buffer: Buffer;
|
13
|
+
state: State;
|
14
|
+
mint: PublicKey;
|
15
|
+
owner: PublicKey;
|
16
|
+
amountDeposited: BigNumber;
|
17
|
+
space: number[];
|
18
|
+
};
|
19
|
+
export declare const liquidityStruct: BeetStruct<Liquidity, Partial<Liquidity>>;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.liquidityStruct = exports.State = 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
|
+
var State;
|
8
|
+
(function (State) {
|
9
|
+
State[State["Uninitialized"] = 0] = "Uninitialized";
|
10
|
+
State[State["StakePool"] = 1] = "StakePool";
|
11
|
+
State[State["InactiveStakePool"] = 2] = "InactiveStakePool";
|
12
|
+
State[State["StakeAccount"] = 3] = "StakeAccount";
|
13
|
+
})(State || (exports.State = State = {}));
|
14
|
+
exports.liquidityStruct = new beet_1.BeetStruct([
|
15
|
+
['buffer', (0, solana_1.blob)(8)],
|
16
|
+
['state', beet_1.u8],
|
17
|
+
['mint', beet_solana_1.publicKey],
|
18
|
+
['owner', beet_solana_1.publicKey],
|
19
|
+
['amountDeposited', solana_1.u64],
|
20
|
+
['space', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 128)],
|
21
|
+
], (args) => args);
|
22
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/structs.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,+CAA+C;AAE/C,IAAY,KAKX;AALD,WAAY,KAAK;IACf,mDAAa,CAAA;IACb,2CAAS,CAAA;IACT,2DAAiB,CAAA;IACjB,iDAAY,CAAA;AACd,CAAC,EALW,KAAK,qBAAL,KAAK,QAKhB;AAWY,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,SAAE,CAAC;IACb,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,OAAO,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,GAAG,CAAC,CAAC;CAC1C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export type Liquidity = {
|
6
6
|
buffer: Buffer;
|
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
const perpetualFetcher_1 = __importDefault(require("./perpetualFetcher"));
|
8
8
|
const custodiesJob_1 = __importDefault(require("./custodiesJob"));
|
9
|
+
const pricingJob_1 = __importDefault(require("./pricingJob"));
|
9
10
|
const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
10
11
|
const voteFetcher_1 = __importDefault(require("./voteFetcher"));
|
11
12
|
const constants_1 = require("./constants");
|
12
13
|
const valueAverageFetcher_1 = __importDefault(require("./valueAverageFetcher"));
|
13
14
|
exports.platforms = [constants_1.jupiterPlatform];
|
14
|
-
exports.jobs = [custodiesJob_1.default];
|
15
|
+
exports.jobs = [custodiesJob_1.default, pricingJob_1.default];
|
15
16
|
exports.fetchers = [
|
16
17
|
perpetualFetcher_1.default,
|
17
18
|
airdropFetcher_1.default,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;AAC9C,gFAAwD;AAE3C,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC;AAC1C,QAAA,IAAI,GAAU,CAAC,sBAAY,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,8DAAsC;AACtC,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;AAC9C,gFAAwD;AAE3C,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC;AAC1C,QAAA,IAAI,GAAU,CAAC,sBAAY,EAAE,oBAAU,CAAC,CAAC;AACzC,QAAA,QAAQ,GAAc;IACjC,0BAAgB;IAChB,wBAAc;IACd,qBAAW;IACX,6BAAmB;CACpB,CAAC"}
|
@@ -0,0 +1,57 @@
|
|
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 web3_js_1 = require("@solana/web3.js");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const helpers_1 = require("./helpers");
|
16
|
+
const constants_2 = require("../tokens/constants");
|
17
|
+
const getMultipleDecimalsAsMap_1 = require("../../utils/solana/getMultipleDecimalsAsMap");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const mints = [
|
20
|
+
'HUBsveNpjo5pWqNkH57QzxjQASdTVXcSK7bVKTSZtcSX', // SolanaHub staked SOL
|
21
|
+
'xLfNTYy76B8Tiix3hA51Jyvc1kMSFV4sPdR7szTZsRu', // xLifinity
|
22
|
+
];
|
23
|
+
const vsToken = portfolio_core_1.solanaNativeWrappedAddress;
|
24
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
const connection = (0, clients_1.getClientSolana)();
|
26
|
+
const solTokenPrice = yield cache.getTokenPrice(vsToken, portfolio_core_1.NetworkId.solana);
|
27
|
+
if (!solTokenPrice)
|
28
|
+
return;
|
29
|
+
const mintsPk = mints.map((m) => new web3_js_1.PublicKey(m));
|
30
|
+
const prices = yield (0, helpers_1.getJupiterPrices)(mintsPk, new web3_js_1.PublicKey(vsToken));
|
31
|
+
const decimalsMap = yield (0, getMultipleDecimalsAsMap_1.getMultipleDecimalsAsMap)(connection, mintsPk);
|
32
|
+
const sources = [];
|
33
|
+
prices.forEach((price, mint) => {
|
34
|
+
const decimals = decimalsMap.get(mint);
|
35
|
+
if (!decimals)
|
36
|
+
return;
|
37
|
+
const source = {
|
38
|
+
address: mint,
|
39
|
+
decimals,
|
40
|
+
id: 'jupiter-api',
|
41
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
42
|
+
timestamp: Date.now(),
|
43
|
+
price: solTokenPrice.price * price,
|
44
|
+
platformId: constants_2.walletTokensPlatform.id,
|
45
|
+
weight: 0.1,
|
46
|
+
};
|
47
|
+
sources.push(source);
|
48
|
+
});
|
49
|
+
yield cache.setTokenPriceSources(sources);
|
50
|
+
});
|
51
|
+
const job = {
|
52
|
+
id: `${constants_1.platformId}-pricing`,
|
53
|
+
executor,
|
54
|
+
label: 'coingecko',
|
55
|
+
};
|
56
|
+
exports.default = job;
|
57
|
+
//# sourceMappingURL=pricingJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pricingJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/pricingJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAG5C,2CAAyC;AACzC,uCAA6C;AAC7C,mDAA2D;AAC3D,0FAAuF;AACvF,iDAAsD;AAEtD,MAAM,KAAK,GAAG;IACZ,8CAA8C,EAAE,uBAAuB;IACvE,6CAA6C,EAAE,YAAY;CAC5D,CAAC;AACF,MAAM,OAAO,GAAG,2CAA0B,CAAC;AAE3C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAC3E,IAAI,CAAC,aAAa;QAAE,OAAO;IAE3B,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,mBAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAgB,EAAC,OAAO,EAAE,IAAI,mBAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,MAAM,IAAA,mDAAwB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxE,MAAM,OAAO,GAAuB,EAAE,CAAC;IACvC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC7B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,MAAM,MAAM,GAAqB;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,EAAE,EAAE,aAAa;YACjB,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,KAAK;YAClC,UAAU,EAAE,gCAAoB,CAAC,EAAE;YACnC,MAAM,EAAE,GAAG;SACZ,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,WAAW;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export type ClaimStatus = {
|
6
6
|
buffer: Buffer;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
3
|
import BigNumber from 'bignumber.js';
|
4
|
-
import { PublicKey } from '@
|
4
|
+
import { PublicKey } from '@solana/web3.js';
|
5
5
|
export type ValueAverage = {
|
6
6
|
buffer: Buffer;
|
7
7
|
isStale: boolean;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export type Escrow = {
|
6
6
|
buffer: Buffer;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export type Locker = {
|
6
6
|
buffer: Buffer;
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
13
|
const clients_1 = require("../../utils/clients");
|
14
14
|
const constants_1 = require("./constants");
|
15
|
+
const aptos_1 = require("../../utils/aptos");
|
15
16
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
16
17
|
const client = (0, clients_1.getClientAptos)();
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const activeValidators = resources.data.active_validators;
|
18
|
+
const resource = yield (0, aptos_1.getAccountResource)(client, '0x1', '0x1::stake::ValidatorSet');
|
19
|
+
const activeValidators = resource === null || resource === void 0 ? void 0 : resource.active_validators;
|
20
|
+
if (!activeValidators)
|
21
|
+
return;
|
22
22
|
const validatorsWithStake = [];
|
23
23
|
for (let i = 0; i < activeValidators.length; i++) {
|
24
24
|
const validator = activeValidators[i];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"activeValidatorsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/activeValidatorsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAqD;AACrD,2CAA0E;
|
1
|
+
{"version":3,"file":"activeValidatorsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/activeValidatorsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAqD;AACrD,2CAA0E;AAE1E,6CAAuD;AAEvD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;IAChC,MAAM,QAAQ,GAAG,MAAM,IAAA,0BAAkB,EACvC,MAAM,EACN,KAAK,EACL,0BAA0B,CAC3B,CAAC;IACF,MAAM,gBAAgB,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,iBAAiB,CAAC;IACrD,IAAI,CAAC,gBAAgB;QAAE,OAAO;IAC9B,MAAM,mBAAmB,GAAa,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,MAAM;aAC1B,IAAI,CAAC;YACJ,OAAO,EAAE;gBACP,QAAQ,EAAE,sDAAsD;gBAChE,aAAa,EAAE,EAAE;gBACjB,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;aACpC;SACF,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACnB,IAAI,QAAQ;YAAE,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,mBAAmB,EAAE;QACtD,MAAM,EAAE,4BAAgB;QACxB,SAAS,EAAE,0BAAS,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,oBAAoB;IACrC,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -9,15 +9,12 @@ export type ValidatorInfo = {
|
|
9
9
|
voting_power: string;
|
10
10
|
};
|
11
11
|
export type ValidatorSet = {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
total_joining_power: string;
|
19
|
-
total_voting_power: string;
|
20
|
-
};
|
12
|
+
active_validators: ValidatorInfo[];
|
13
|
+
consensus_scheme: string;
|
14
|
+
pending_active: string[];
|
15
|
+
pending_inactive: string[];
|
16
|
+
total_joining_power: string;
|
17
|
+
total_voting_power: string;
|
21
18
|
};
|
22
19
|
export type DelegationResponse = {
|
23
20
|
delegation: {
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
2
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
3
|
+
export declare const platformId = "phoenix";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const marketsCachePrefix = "phoenix-markets";
|
6
|
+
export declare const phoenixPid: PublicKey;
|
7
|
+
export declare const phoenixSeatManagerPid: PublicKey;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.phoenixSeatManagerPid = exports.phoenixPid = exports.marketsCachePrefix = exports.platform = exports.platformId = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
exports.platformId = 'phoenix';
|
6
|
+
exports.platform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'Phoenix',
|
9
|
+
image: 'https://sonar.watch/img/platforms/phoenix.webp',
|
10
|
+
website: 'https://www.phoenix.trade/',
|
11
|
+
twitter: 'https://twitter.com/PhoenixTrade',
|
12
|
+
defiLlamaId: 'phoenix', // from https://defillama.com/docs/api
|
13
|
+
};
|
14
|
+
exports.marketsCachePrefix = `${exports.platformId}-markets`;
|
15
|
+
exports.phoenixPid = new web3_js_1.PublicKey('PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY');
|
16
|
+
exports.phoenixSeatManagerPid = new web3_js_1.PublicKey('PSMxQbAoDWDbvd9ezQJgARyq6R9L5kJAasaLDVcZwf1');
|
17
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,kCAAkC;IAC3C,WAAW,EAAE,SAAS,EAAE,sCAAsC;CAC/D,CAAC;AACW,QAAA,kBAAkB,GAAG,GAAG,kBAAU,UAAU,CAAC;AAC7C,QAAA,UAAU,GAAG,IAAI,mBAAS,CACrC,6CAA6C,CAC9C,CAAC;AACW,QAAA,qBAAqB,GAAG,IAAI,mBAAS,CAChD,6CAA6C,CAC9C,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
2
|
+
import { MarketHeaderAccount } from './structs';
|
3
|
+
import { MarketHeader } from './types';
|
4
|
+
export declare function marketHeaderAccountToMarketHeader(marketHeaderAccount: MarketHeaderAccount): MarketHeader;
|
5
|
+
export declare function getSeatManagerAddress(market: PublicKey): PublicKey;
|
6
|
+
export declare function getSeatAddress(market: PublicKey, trader: PublicKey): PublicKey;
|
@@ -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":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG5C,2CAAgE;AAEhE,SAAgB,iCAAiC,CAC/C,mBAAwC;IAExC,OAAO;QACL,YAAY,EAAE,mBAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE;QACzD,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC7C,gBAAgB,EAAE;YAChB,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClE,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClE,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;SACnE;QACD,UAAU,EAAE;YACV,QAA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B;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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F,oDAAoD;AACpD,oCAAoC;AACpC,6DAA6D;AAC7D,SAAS;AACT,mCAAmC;AACnC,gCAAgC;AAChC,QAAQ;AACR,mBAAmB;AACnB,2EAA2E;AAC3E,SAAS;AACT,QAAQ;AAER,oDAAoD;AACpD,4DAA4D;AAC5D,oBAAoB;AACpB,qBAAqB;AACrB,sBAAsB;AACtB,SAAS;AACT,wDAAwD;AACxD,MAAM;AAEN,iEAAiE;AACjE,iEAAiE;AACjE,6CAA6C;AAC7C,oBAAoB;AACpB,qBAAqB;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,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,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,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,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,UAAU,EACV,oBAAU,EACV,sBAAU,EACV;QACE;YACE,QAAQ,EAAE,oBAAU,CAAC,QAAQ;SAC9B;QACD;YACE,MAAM,EAAE;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,EAAE;aACX;SACF;KACF,CACF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACnC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAwB,EAC5C,UAAU,EACV,4BAAkB,EAClB,sBAAU,EACV;QACE;YACE,QAAQ,EAAE,MAAM;SACjB;KACF,CACF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,4BAAkB,CAAC,QAAQ,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAC7C,oCAAmB,EACnB,0BAAS,CAAC,MAAM,CACjB,CAAC;IACF,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,MAAM,OAAO,GAA6B;QACxC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,SAAS;QAChB,UAAU,EAAV,sBAAU;QACV,IAAI,EAAE,qCAAoB,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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CAAkC,EAAE,SAAE,CAAC;CACzC,EACD,CAAC,IAAI,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 @@
|
|
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 '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export declare enum MarginAccountType {
|
6
6
|
Normal = 0,
|
@@ -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(
|
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;
|
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"}
|