@sonarwatch/portfolio-plugins 0.14.143 → 0.14.145
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 +8 -0
- package/package.json +1 -1
- package/src/plugins/banx/constants.d.ts +14 -8
- package/src/plugins/banx/constants.js +25 -13
- package/src/plugins/banx/constants.js.map +1 -1
- package/src/plugins/banx/index.js +12 -2
- package/src/plugins/banx/index.js.map +1 -1
- package/src/plugins/banx/loansFetcher.js +108 -123
- package/src/plugins/banx/loansFetcher.js.map +1 -1
- package/src/plugins/banx/marketsJob.js +40 -0
- package/src/plugins/banx/marketsJob.js.map +1 -0
- package/src/plugins/banx/offersFetcher.js +61 -70
- package/src/plugins/banx/offersFetcher.js.map +1 -1
- package/src/plugins/banx/stakingFetcher.js +6 -3
- package/src/plugins/banx/stakingFetcher.js.map +1 -1
- package/src/plugins/banx/structs.d.ts +222 -2
- package/src/plugins/banx/structs.js +216 -2
- package/src/plugins/banx/structs.js.map +1 -1
- package/src/plugins/banx/types.d.ts +50 -258
- package/src/plugins/banx/vaultsFetcher.d.ts +3 -0
- package/src/plugins/banx/vaultsFetcher.js +74 -0
- package/src/plugins/banx/vaultsFetcher.js.map +1 -0
- package/src/plugins/banx/vaultsJob.d.ts +3 -0
- package/src/plugins/banx/{collectionsJob.js → vaultsJob.js} +5 -16
- package/src/plugins/banx/vaultsJob.js.map +1 -0
- package/src/plugins/bskt/constants.d.ts +1 -0
- package/src/plugins/bskt/constants.js +2 -1
- package/src/plugins/bskt/constants.js.map +1 -1
- package/src/plugins/bskt/index.js +5 -1
- package/src/plugins/bskt/index.js.map +1 -1
- package/src/plugins/bskt/stakingFetcher.d.ts +3 -0
- package/src/plugins/bskt/stakingFetcher.js +58 -0
- package/src/plugins/bskt/stakingFetcher.js.map +1 -0
- package/src/plugins/bskt/structs.d.ts +12 -0
- package/src/plugins/bskt/structs.js +12 -1
- package/src/plugins/bskt/structs.js.map +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.js +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/plugins/orca/types.d.ts +6 -2
- package/src/plugins/orca/whirlpoolsStatsJob.js +7 -3
- package/src/plugins/orca/whirlpoolsStatsJob.js.map +1 -1
- package/src/plugins/banx/collectionsJob.js.map +0 -1
- package/src/plugins/banx/filters.d.ts +0 -6
- package/src/plugins/banx/filters.js +0 -39
- package/src/plugins/banx/filters.js.map +0 -1
- package/src/plugins/banx/helpers.d.ts +0 -5
- package/src/plugins/banx/helpers.js +0 -64
- package/src/plugins/banx/helpers.js.map +0 -1
- package/src/plugins/banx/idl.d.ts +0 -123
- package/src/plugins/banx/idl.js +0 -2187
- package/src/plugins/banx/idl.js.map +0 -1
- /package/src/plugins/banx/{collectionsJob.d.ts → marketsJob.d.ts} +0 -0
@@ -15,30 +15,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
17
17
|
const constants_1 = require("./constants");
|
18
|
-
/**
|
19
|
-
* @deprecated
|
20
|
-
* this job has been deprecated following protocol changes
|
21
|
-
*/
|
22
18
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
-
const
|
24
|
-
|
25
|
-
timeout: 5000,
|
26
|
-
})
|
27
|
-
.catch((err) => {
|
28
|
-
throw Error(`BANX_API ERR: ${err}`);
|
19
|
+
const resSpl = yield axios_1.default.get(constants_1.banxApiVaultsUrl, {
|
20
|
+
timeout: 3000,
|
29
21
|
});
|
30
|
-
|
31
|
-
throw Error(`BANX_API NO RESPONSE`);
|
32
|
-
}
|
33
|
-
yield cache.setItem(constants_1.collectionsCacheKey, res.data.data, {
|
22
|
+
yield cache.setItem(constants_1.vaultsCacheKey, resSpl.data.data, {
|
34
23
|
prefix: constants_1.cachePrefix,
|
35
24
|
networkId: portfolio_core_1.NetworkId.solana,
|
36
25
|
});
|
37
26
|
});
|
38
27
|
const job = {
|
39
|
-
id: `${constants_1.platformId}-
|
28
|
+
id: `${constants_1.platformId}-vaults`,
|
40
29
|
executor,
|
41
30
|
labels: ['normal'],
|
42
31
|
};
|
43
32
|
exports.default = job;
|
44
|
-
//# sourceMappingURL=
|
33
|
+
//# sourceMappingURL=vaultsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vaultsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/banx/vaultsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA0B;AAG1B,2CAKqB;AAGrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,MAAM,eAAK,CAAC,GAAG,CAAoB,4BAAgB,EAAE;QAClE,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,OAAO,CAAC,0BAAc,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QACpD,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -6,4 +6,5 @@ export declare const platformId = "bskt";
|
|
6
6
|
export declare const bsktMint = "6gnCPhXtLnUD76HjQuSYPENLSZdG8RvDB1pTLM5aLSJA";
|
7
7
|
export declare const platform: Platform;
|
8
8
|
export declare const bsktPid: PublicKey;
|
9
|
+
export declare const bsktStakingPid: PublicKey;
|
9
10
|
export declare const bsktDecimals = 5;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.bsktDecimals = exports.bsktPid = exports.platform = exports.bsktMint = exports.platformId = void 0;
|
3
|
+
exports.bsktDecimals = exports.bsktStakingPid = exports.bsktPid = exports.platform = exports.bsktMint = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'bskt';
|
6
6
|
exports.bsktMint = '6gnCPhXtLnUD76HjQuSYPENLSZdG8RvDB1pTLM5aLSJA';
|
@@ -18,5 +18,6 @@ exports.platform = {
|
|
18
18
|
tokens: [exports.bsktMint],
|
19
19
|
};
|
20
20
|
exports.bsktPid = new web3_js_1.PublicKey('BSKTvA6XG9QyqhW5Hgq8pG8pm5NnvuYyc4pYefSzM62X');
|
21
|
+
exports.bsktStakingPid = new web3_js_1.PublicKey('DF8vgzUDH2CGywD7Gd9jd9Y5Kwmrx97h4Viumjo4rrr6');
|
21
22
|
exports.bsktDecimals = 5;
|
22
23
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EACH,0EAA0E;IAC5E,qEAAqE;IACrE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,+BAA+B;IACxC,QAAQ,EAAE,cAAc;IACxB,WAAW,EACT,mEAAmE;IACrE,aAAa,EAAE,yCAAyC;IACxD,MAAM,EAAE,CAAC,gBAAQ,CAAC;CACnB,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,YAAY,GAAG,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EACH,0EAA0E;IAC5E,qEAAqE;IACrE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,+BAA+B;IACxC,QAAQ,EAAE,cAAc;IACxB,WAAW,EACT,mEAAmE;IACrE,aAAa,EAAE,yCAAyC;IACxD,MAAM,EAAE,CAAC,gBAAQ,CAAC;CACnB,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,YAAY,GAAG,CAAC,CAAC"}
|
@@ -1,8 +1,12 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
4
7
|
const constants_1 = require("./constants");
|
8
|
+
const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
|
5
9
|
exports.platforms = [constants_1.platform];
|
6
10
|
exports.jobs = [];
|
7
|
-
exports.fetchers = [];
|
11
|
+
exports.fetchers = [stakingFetcher_1.default];
|
8
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,58 @@
|
|
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 structs_1 = require("./structs");
|
16
|
+
const clients_1 = require("../../utils/clients");
|
17
|
+
const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
|
18
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
19
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
const client = (0, clients_1.getClientSolana)();
|
21
|
+
const accounts = yield ParsedGpa_1.ParsedGpa.build(client, structs_1.stakingAccountStruct, constants_1.bsktStakingPid)
|
22
|
+
.addFilter('accountDiscriminator', [210, 98, 254, 196, 151, 68, 235, 0])
|
23
|
+
.addFilter('owner', new web3_js_1.PublicKey(owner))
|
24
|
+
.run();
|
25
|
+
if (!accounts.length)
|
26
|
+
return [];
|
27
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
28
|
+
accounts.forEach((account) => {
|
29
|
+
const element = elementRegistry.addElementMultiple({
|
30
|
+
label: 'Staked',
|
31
|
+
ref: account.pubkey,
|
32
|
+
sourceRefs: [
|
33
|
+
{
|
34
|
+
name: 'Vault',
|
35
|
+
address: account.stakePool.toString(),
|
36
|
+
},
|
37
|
+
],
|
38
|
+
link: 'https://staking.bskt.fi/',
|
39
|
+
});
|
40
|
+
element.addAsset({
|
41
|
+
address: constants_1.bsktMint,
|
42
|
+
amount: account.depositAmount,
|
43
|
+
attributes: {
|
44
|
+
lockedUntil: account.depositTimestamp
|
45
|
+
.plus(account.lockupDuration)
|
46
|
+
.toNumber(),
|
47
|
+
},
|
48
|
+
});
|
49
|
+
});
|
50
|
+
return elementRegistry.getElements(cache);
|
51
|
+
});
|
52
|
+
const fetcher = {
|
53
|
+
id: `${constants_1.platformId}-staking`,
|
54
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
55
|
+
executor,
|
56
|
+
};
|
57
|
+
exports.default = fetcher;
|
58
|
+
//# sourceMappingURL=stakingFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAG5C,2CAAmE;AACnE,uCAAiD;AACjD,iDAAsD;AACtD,kEAA+D;AAC/D,gFAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,QAAQ,GAAG,MAAM,qBAAS,CAAC,KAAK,CACpC,MAAM,EACN,8BAAoB,EAC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 @@ export type VestingAccount = {
|
|
13
13
|
isCanceled: boolean;
|
14
14
|
};
|
15
15
|
export declare const vestingAccountStruct: BeetStruct<VestingAccount, Partial<VestingAccount>>;
|
16
|
+
export type StakingAccount = {
|
17
|
+
accountDiscriminator: number[];
|
18
|
+
owner: PublicKey;
|
19
|
+
payer: PublicKey;
|
20
|
+
stakePool: PublicKey;
|
21
|
+
lockupDuration: BigNumber;
|
22
|
+
depositTimestamp: BigNumber;
|
23
|
+
depositAmount: BigNumber;
|
24
|
+
effectiveStake: BigNumber;
|
25
|
+
claimedAmounts: BigNumber[];
|
26
|
+
};
|
27
|
+
export declare const stakingAccountStruct: BeetStruct<StakingAccount, Partial<StakingAccount>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.vestingAccountStruct = void 0;
|
3
|
+
exports.stakingAccountStruct = exports.vestingAccountStruct = void 0;
|
4
4
|
const beet_1 = require("@metaplex-foundation/beet");
|
5
5
|
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
6
|
const solana_1 = require("../../utils/solana");
|
@@ -12,4 +12,15 @@ exports.vestingAccountStruct = new beet_1.BeetStruct([
|
|
12
12
|
['amountClaimed', solana_1.u64],
|
13
13
|
['isCanceled', beet_1.bool],
|
14
14
|
], (args) => args);
|
15
|
+
exports.stakingAccountStruct = new beet_1.BeetStruct([
|
16
|
+
['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
17
|
+
['owner', beet_solana_1.publicKey],
|
18
|
+
['payer', beet_solana_1.publicKey],
|
19
|
+
['stakePool', beet_solana_1.publicKey],
|
20
|
+
['lockupDuration', solana_1.u64],
|
21
|
+
['depositTimestamp', solana_1.i64],
|
22
|
+
['depositAmount', solana_1.u64],
|
23
|
+
['effectiveStake', solana_1.u128],
|
24
|
+
['claimedAmounts', (0, beet_1.uniformFixedSizeArray)(solana_1.u128, 10)],
|
25
|
+
], (args) => args);
|
15
26
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/structs.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/structs.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAG7D,+CAA0D;AAW7C,QAAA,oBAAoB,GAAG,IAAI,iBAAU,CAChD;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,YAAY,EAAE,WAAI,CAAC;CACrB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC;AAcW,QAAA,oBAAoB,GAAG,IAAI,iBAAU,CAChD;IACE,CAAC,sBAAsB,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,gBAAgB,EAAE,aAAI,CAAC;IACxB,CAAC,gBAAgB,EAAE,IAAA,4BAAqB,EAAC,aAAI,EAAE,EAAE,CAAC,CAAC;CACpD,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC"}
|
@@ -96,7 +96,7 @@ function getOrcaNftFetcher(platformId, programId) {
|
|
96
96
|
poolLiquidity: whirlpoolInfo.liquidity,
|
97
97
|
feeRate: (Number(whirlpoolInfo.feeRate) / 10000) *
|
98
98
|
(1 - whirlpoolInfo.protocolFeeRate / 10000),
|
99
|
-
swapVolume24h: (_a = allWhirlpoolsStats.find((p) => (p === null || p === void 0 ? void 0 : p.address) === positionInfo.whirlpool.toString())) === null || _a === void 0 ? void 0 : _a.
|
99
|
+
swapVolume24h: (_a = allWhirlpoolsStats.find((p) => (p === null || p === void 0 ? void 0 : p.address) === positionInfo.whirlpool.toString())) === null || _a === void 0 ? void 0 : _a.stats['24h'].volume,
|
100
100
|
});
|
101
101
|
const feesAndRewards = (0, helpers_fees_1.calcFeesAndRewards)(whirlpoolInfo, positionInfo, tickArrays);
|
102
102
|
if (feesAndRewards) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAEhE,iDAAwE;AACxE,gFAA6E;AAGhE,QAAA,qBAAqB,GAAG,iBAAiB,CACpD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAoB;IAEpB,OAAO,CACL,KAAY,EACZ,IAAiC,EACJ,EAAE;;QAC/B,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,MAAM,uBAAuB,GAAgB,EAAE,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhD,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,OAA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E,MAAM;wBACZ,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE;qBACzC;iBACF;aACF,CAAC,CAAC;YACH,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;gBACrC,QAAQ,EAAE,aAAa,CAAC,UAAU;gBAClC,QAAQ,EAAE,aAAa,CAAC,UAAU;gBAClC,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;gBAChD,cAAc,EAAE,YAAY,CAAC,cAAc;gBAC3C,cAAc,EAAE,YAAY,CAAC,cAAc;gBAC3C,gBAAgB,EAAE,aAAa,CAAC,SAAS;gBACzC,aAAa,EAAE,aAAa,CAAC,SAAS;gBACtC,OAAO,EACL,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;oBACvC,CAAC,CAAC,GAAG,aAAa,CAAC,eAAe,GAAG,KAAK,CAAC;gBAC7C,aAAa,EAAE,MAAA,kBAAkB,CAAC,IAAI,CACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,OAAO,MAAK,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,CACxD,0CAAE,
|
1
|
+
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAEhE,iDAAwE;AACxE,gFAA6E;AAGhE,QAAA,qBAAqB,GAAG,iBAAiB,CACpD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAoB;IAEpB,OAAO,CACL,KAAY,EACZ,IAAiC,EACJ,EAAE;;QAC/B,MAAM,MAAM,GAAG,IAAA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S,CAAC,cAAc,CAAC;oBACvB,OAAO,EAAE,aAAa,CAAC,UAAU;oBACjC,MAAM,EAAE,cAAc,CAAC,QAAQ;iBAChC,CAAC,CAAC;gBAEH,SAAS,CAAC,cAAc,CAAC;oBACvB,OAAO,EAAE,aAAa,CAAC,UAAU;oBACjC,MAAM,EAAE,cAAc,CAAC,QAAQ;iBAChC,CAAC,CAAC;gBAEH,SAAS,CAAC,cAAc,CAAC;oBACvB,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;oBAC1C,MAAM,EAAE,cAAc,CAAC,WAAW;iBACnC,CAAC,CAAC;gBAEH,SAAS,CAAC,cAAc,CAAC;oBACvB,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;oBAC1C,MAAM,EAAE,cAAc,CAAC,WAAW;iBACnC,CAAC,CAAC;gBAEH,SAAS,CAAC,cAAc,CAAC;oBACvB,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;oBAC1C,MAAM,EAAE,cAAc,CAAC,WAAW;iBACnC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAA,CAAC;AACJ,CAAC;AA9ID,8CA8IC"}
|
@@ -21,15 +21,19 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
21
|
let cursor;
|
22
22
|
const cacheItems = [];
|
23
23
|
do {
|
24
|
-
const apiRes = yield axios_1.default.get(`https://
|
24
|
+
const apiRes = yield axios_1.default.get(`https://api.orca.so/v2/solana/pools?limit=1000&after=${cursor || ''}`);
|
25
25
|
apiRes.data.data.forEach((p) => {
|
26
26
|
cacheItems.push({
|
27
27
|
key: `${p.address}-stats`,
|
28
28
|
value: {
|
29
29
|
address: p.address,
|
30
|
-
|
30
|
+
stats: {
|
31
|
+
'24h': {
|
32
|
+
volume: p.stats['24h'].volume,
|
33
|
+
fees: p.stats['24h'].fees,
|
34
|
+
},
|
35
|
+
},
|
31
36
|
tvlUsdc: p.tvlUsdc,
|
32
|
-
feesUsdc24h: p.feesUsdc24h,
|
33
37
|
},
|
34
38
|
});
|
35
39
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"whirlpoolsStatsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/whirlpoolsStatsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,2CAA0D;AAE1D,mEAA2C;AAY3C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,MAAiC,CAAC;IAEtC,MAAM,UAAU,GAA4C,EAAE,CAAC;IAE/D,GAAG,CAAC;QACF,MAAM,MAAM,GAAgC,MAAM,eAAK,CAAC,GAAG,CACzD,
|
1
|
+
{"version":3,"file":"whirlpoolsStatsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/whirlpoolsStatsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,2CAA0D;AAE1D,mEAA2C;AAY3C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,MAAiC,CAAC;IAEtC,MAAM,UAAU,GAA4C,EAAE,CAAC;IAE/D,GAAG,CAAC;QACF,MAAM,MAAM,GAAgC,MAAM,eAAK,CAAC,GAAG,CACzD,wDAAwD,MAAM,IAAI,EAAE,EAAE,CACvE,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC7B,UAAU,CAAC,IAAI,CAAC;gBACd,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,QAAQ;gBACzB,KAAK,EAAE;oBACL,OAAO,EAAE,CAAC,CAAC,OAAO;oBAClB,KAAK,EAAE;wBACL,KAAK,EAAE;4BACL,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM;4BAC7B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI;yBAC1B;qBACF;oBACD,OAAO,EAAE,CAAC,CAAC,OAAO;iBACnB;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QACtC,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;QAEvB,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC;IACpB,CAAC,QAAQ,WAAW,EAAE;IAEtB,MAAM,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE;QAC/B,MAAM,EAAE,2BAAe;QACvB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,mBAAmB;IACpC,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"collectionsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/banx/collectionsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA0B;AAG1B,2CAKqB;AAGrB;;;GAGG;AACH,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAyB,iCAAqB,EAAE;QAClD,OAAO,EAAE,IAAI;KACd,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,+BAAmB,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;QACtD,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
2
|
-
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
3
|
-
import { GetProgramAccountsFilter } from '@solana/web3.js';
|
4
|
-
export declare const stakeFilters: (owner: string) => GetProgramAccountsFilter[];
|
5
|
-
export declare const loanFiltersA: (owner: string) => GetProgramAccountsFilter[];
|
6
|
-
export declare const loanFiltersB: (owner: string) => GetProgramAccountsFilter[];
|
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.loanFiltersB = exports.loanFiltersA = exports.stakeFilters = void 0;
|
4
|
-
const constants_1 = require("./constants");
|
5
|
-
const stakeFilters = (owner) => [
|
6
|
-
{
|
7
|
-
memcmp: {
|
8
|
-
offset: 9,
|
9
|
-
bytes: owner,
|
10
|
-
},
|
11
|
-
},
|
12
|
-
{ dataSize: 160 },
|
13
|
-
];
|
14
|
-
exports.stakeFilters = stakeFilters;
|
15
|
-
const loanFiltersA = (owner) => [
|
16
|
-
{
|
17
|
-
dataSize: constants_1.bondTradeTransactionV3DataSize,
|
18
|
-
},
|
19
|
-
{
|
20
|
-
memcmp: {
|
21
|
-
bytes: owner,
|
22
|
-
offset: 41,
|
23
|
-
},
|
24
|
-
},
|
25
|
-
];
|
26
|
-
exports.loanFiltersA = loanFiltersA;
|
27
|
-
const loanFiltersB = (owner) => [
|
28
|
-
{
|
29
|
-
dataSize: constants_1.bondTradeTransactionV3DataSize,
|
30
|
-
},
|
31
|
-
{
|
32
|
-
memcmp: {
|
33
|
-
bytes: owner,
|
34
|
-
offset: 147,
|
35
|
-
},
|
36
|
-
},
|
37
|
-
];
|
38
|
-
exports.loanFiltersB = loanFiltersB;
|
39
|
-
//# sourceMappingURL=filters.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/banx/filters.ts"],"names":[],"mappings":";;;AACA,2CAA6D;AAEtD,MAAM,YAAY,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACzE;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AARW,QAAA,YAAY,gBAQvB;AAEK,MAAM,YAAY,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACzE;QACE,QAAQ,EAAE,0CAA8B;KACzC;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC;AAVW,QAAA,YAAY,gBAUvB;AAEK,MAAM,YAAY,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACzE;QACE,QAAQ,EAAE,0CAA8B;KACzC;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,GAAG;SACZ;KACF;CACF,CAAC;AAVW,QAAA,YAAY,gBAUvB"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
2
|
-
import { ParsedAccount } from '../../utils/solana';
|
3
|
-
import { BondTradeTransactionV3 } from './types';
|
4
|
-
export declare const calculateLoanRepayValue: (acc: ParsedAccount<BondTradeTransactionV3>) => BigNumber;
|
5
|
-
export declare const calculateDebtValue: (acc: ParsedAccount<BondTradeTransactionV3>) => BigNumber;
|
@@ -1,64 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.calculateDebtValue = exports.calculateLoanRepayValue = void 0;
|
7
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
|
-
const BONDS = {
|
9
|
-
PROGRAM_PUBKEY: '4tdmkuY6EStxbS6Y8s5ueznL3VPMSugrvQuDeAHGZhSt',
|
10
|
-
ADMIN_PUBKEY: 'revJ8QJgQ3xCcZ6CMykjsmGMYdg8Pj9WnqgJZBHBwSK',
|
11
|
-
PROTOCOL_FEE_PERCENT: 100, // ? Base points
|
12
|
-
PROTOCOL_REPAY_FEE: 620, // ? Base points
|
13
|
-
};
|
14
|
-
const SOL_WAD = 1e9;
|
15
|
-
const SECONDS_IN_YEAR = 31536000;
|
16
|
-
const BASE_POINTS = 10000;
|
17
|
-
const wadMul = (x, y) => Math.floor((x * y) / SOL_WAD);
|
18
|
-
const wadDiv = (x, y) => Math.floor((x * SOL_WAD) / y);
|
19
|
-
const basePointsToWads = (basePoints) => Math.floor((basePoints * SOL_WAD) / BASE_POINTS);
|
20
|
-
const calculateCurrentInterestSolPure = ({ loanValue, startTime, currentTime, rateBasePoints, }) => {
|
21
|
-
const loanTime = currentTime - startTime;
|
22
|
-
const secondsInYearWad = SECONDS_IN_YEAR * SOL_WAD;
|
23
|
-
const yearsWad = wadDiv(loanTime * SOL_WAD, secondsInYearWad);
|
24
|
-
return wadMul(loanValue, wadMul(yearsWad, basePointsToWads(rateBasePoints)));
|
25
|
-
};
|
26
|
-
const calculateLoanRepayValue = (acc) => {
|
27
|
-
const loanValue = Number(acc.solAmount);
|
28
|
-
const calculatedInterest = calculateCurrentInterestSolPure({
|
29
|
-
loanValue,
|
30
|
-
startTime: Number(acc.soldAt),
|
31
|
-
currentTime: Date.now() / 1000,
|
32
|
-
rateBasePoints: Number(acc.amountOfBonds) + BONDS.PROTOCOL_REPAY_FEE,
|
33
|
-
});
|
34
|
-
return new bignumber_js_1.default(loanValue).plus(calculatedInterest);
|
35
|
-
};
|
36
|
-
exports.calculateLoanRepayValue = calculateLoanRepayValue;
|
37
|
-
const getInterestRepaid = (acc) => {
|
38
|
-
const currentLoanValue = Number(acc.solAmount) + Number(acc.feeAmount);
|
39
|
-
return new bignumber_js_1.default(acc.redeemedAt !== '0'
|
40
|
-
? calculateCurrentInterestSolPure({
|
41
|
-
loanValue: currentLoanValue,
|
42
|
-
startTime: acc.soldAt,
|
43
|
-
currentTime: Number(acc.redeemedAt),
|
44
|
-
rateBasePoints: acc.amountOfBonds,
|
45
|
-
})
|
46
|
-
: 0);
|
47
|
-
};
|
48
|
-
const calculateDebtValue = (acc) => {
|
49
|
-
const loanValue = Number(acc.solAmount);
|
50
|
-
const calculatedInterest = calculateCurrentInterestSolPure({
|
51
|
-
loanValue,
|
52
|
-
startTime: Number(acc.soldAt),
|
53
|
-
currentTime: Date.now() / 1000,
|
54
|
-
rateBasePoints: Number(acc.amountOfBonds) + BONDS.PROTOCOL_REPAY_FEE,
|
55
|
-
});
|
56
|
-
const repaid = getInterestRepaid(acc);
|
57
|
-
const principal = new bignumber_js_1.default(acc.solAmount);
|
58
|
-
return principal
|
59
|
-
.minus(repaid.toNumber())
|
60
|
-
.plus(calculatedInterest)
|
61
|
-
.plus(Number(acc.feeAmount));
|
62
|
-
};
|
63
|
-
exports.calculateDebtValue = calculateDebtValue;
|
64
|
-
//# sourceMappingURL=helpers.js.map
|
@@ -1 +0,0 @@
|
|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AI,CAAC,GAAG,EAAE,GAAG,IAAI;QAC9B,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,kBAAkB;KACrE,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAEtC,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAE/C,OAAO,SAAS;SACb,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;SACxB,IAAI,CAAC,kBAAkB,CAAC;SACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B"}
|
@@ -1,123 +0,0 @@
|
|
1
|
-
export declare const BanxIDL: {
|
2
|
-
version: string;
|
3
|
-
name: string;
|
4
|
-
accounts: {
|
5
|
-
name: string;
|
6
|
-
type: {
|
7
|
-
kind: string;
|
8
|
-
fields: ({
|
9
|
-
name: string;
|
10
|
-
type: {
|
11
|
-
defined: string;
|
12
|
-
array?: undefined;
|
13
|
-
};
|
14
|
-
} | {
|
15
|
-
name: string;
|
16
|
-
type: {
|
17
|
-
array: (string | number)[];
|
18
|
-
defined?: undefined;
|
19
|
-
};
|
20
|
-
} | {
|
21
|
-
name: string;
|
22
|
-
type: string;
|
23
|
-
})[];
|
24
|
-
};
|
25
|
-
}[];
|
26
|
-
types: ({
|
27
|
-
name: string;
|
28
|
-
type: {
|
29
|
-
kind: string;
|
30
|
-
fields: ({
|
31
|
-
name: string;
|
32
|
-
type: {
|
33
|
-
array: (string | number)[];
|
34
|
-
};
|
35
|
-
} | {
|
36
|
-
name: string;
|
37
|
-
type: string;
|
38
|
-
})[];
|
39
|
-
variants?: undefined;
|
40
|
-
};
|
41
|
-
} | {
|
42
|
-
name: string;
|
43
|
-
type: {
|
44
|
-
kind: string;
|
45
|
-
fields: ({
|
46
|
-
name: string;
|
47
|
-
type: string;
|
48
|
-
} | {
|
49
|
-
name: string;
|
50
|
-
type: {
|
51
|
-
defined: string;
|
52
|
-
};
|
53
|
-
})[];
|
54
|
-
variants?: undefined;
|
55
|
-
};
|
56
|
-
} | {
|
57
|
-
name: string;
|
58
|
-
type: {
|
59
|
-
kind: string;
|
60
|
-
fields: {
|
61
|
-
name: string;
|
62
|
-
type: {
|
63
|
-
vec: {
|
64
|
-
defined: string;
|
65
|
-
};
|
66
|
-
};
|
67
|
-
}[];
|
68
|
-
variants?: undefined;
|
69
|
-
};
|
70
|
-
} | {
|
71
|
-
name: string;
|
72
|
-
type: {
|
73
|
-
kind: string;
|
74
|
-
fields: {
|
75
|
-
name: string;
|
76
|
-
docs: string[];
|
77
|
-
type: {
|
78
|
-
vec: string;
|
79
|
-
};
|
80
|
-
}[];
|
81
|
-
variants?: undefined;
|
82
|
-
};
|
83
|
-
} | {
|
84
|
-
name: string;
|
85
|
-
type: {
|
86
|
-
kind: string;
|
87
|
-
fields: {
|
88
|
-
name: string;
|
89
|
-
docs: string[];
|
90
|
-
type: {
|
91
|
-
vec: {
|
92
|
-
array: (string | number)[];
|
93
|
-
};
|
94
|
-
};
|
95
|
-
}[];
|
96
|
-
variants?: undefined;
|
97
|
-
};
|
98
|
-
} | {
|
99
|
-
name: string;
|
100
|
-
type: {
|
101
|
-
kind: string;
|
102
|
-
variants: {
|
103
|
-
name: string;
|
104
|
-
}[];
|
105
|
-
fields?: undefined;
|
106
|
-
};
|
107
|
-
} | {
|
108
|
-
name: string;
|
109
|
-
type: {
|
110
|
-
kind: string;
|
111
|
-
variants: ({
|
112
|
-
name: string;
|
113
|
-
fields: string[];
|
114
|
-
} | {
|
115
|
-
name: string;
|
116
|
-
fields: {
|
117
|
-
defined: string;
|
118
|
-
}[];
|
119
|
-
})[];
|
120
|
-
fields?: undefined;
|
121
|
-
};
|
122
|
-
})[];
|
123
|
-
};
|