@sonarwatch/portfolio-plugins 0.14.11 → 0.14.13
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1640 -1632
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/cetus/types.d.ts +109 -0
- package/src/plugins/debridge/airdropFetcher.js +31 -11
- package/src/plugins/debridge/airdropFetcher.js.map +1 -1
- package/src/plugins/debridge/constants.d.ts +4 -1
- package/src/plugins/debridge/constants.js +8 -3
- package/src/plugins/debridge/constants.js.map +1 -1
- package/src/plugins/jupiter/exchange/constants.js +1 -1
- package/src/plugins/kriya/clmmsFetcher.d.ts +3 -0
- package/src/plugins/kriya/clmmsFetcher.js +81 -0
- package/src/plugins/kriya/clmmsFetcher.js.map +1 -0
- package/src/plugins/kriya/constants.d.ts +9 -4
- package/src/plugins/kriya/constants.js +48 -5
- package/src/plugins/kriya/constants.js.map +1 -1
- package/src/plugins/kriya/farmsFetcher.js.map +1 -1
- package/src/plugins/kriya/index.js +4 -0
- package/src/plugins/kriya/index.js.map +1 -1
- package/src/plugins/kriya/lpFetcher.d.ts +3 -0
- package/src/plugins/kriya/lpFetcher.js +80 -0
- package/src/plugins/kriya/lpFetcher.js.map +1 -0
- package/src/plugins/kriya/types/common.d.ts +46 -0
- package/src/plugins/kriya/types/common.js +9 -0
- package/src/plugins/kriya/types/common.js.map +1 -0
- package/src/plugins/kriya/types/farms.d.ts +55 -0
- package/src/plugins/kriya/{types.js → types/farms.js} +2 -1
- package/src/plugins/kriya/types/farms.js.map +1 -0
- package/src/plugins/kriya/types/pools.d.ts +131 -0
- package/src/plugins/kriya/types/pools.js +3 -0
- package/src/plugins/kriya/types/pools.js.map +1 -0
- package/src/plugins/kriya/{types.d.ts → types/vaults.d.ts} +104 -86
- package/src/plugins/kriya/types/vaults.js +3 -0
- package/src/plugins/kriya/types/vaults.js.map +1 -0
- package/src/plugins/kriya/vaultsFetcher.js +67 -59
- package/src/plugins/kriya/vaultsFetcher.js.map +1 -1
- package/src/plugins/kriya/vaultsJob.js +52 -16
- package/src/plugins/kriya/vaultsJob.js.map +1 -1
- package/src/plugins/native-stake/solana/solanaValidatorsJob.js +4 -0
- package/src/plugins/native-stake/solana/solanaValidatorsJob.js.map +1 -1
- package/src/plugins/native-stake/solana/types.d.ts +8 -0
- package/src/plugins/parcl/stakingFetcher.js +10 -24
- package/src/plugins/parcl/stakingFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/zeta/airdropFetcher.js +14 -14
- package/src/utils/elementbuilder/LiquidityBuilder.js +1 -1
- package/src/utils/elementbuilder/LiquidityBuilder.js.map +1 -1
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/plugins/kriya/types.js.map +0 -1
@@ -17,77 +17,85 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
17
17
|
const constants_1 = require("./constants");
|
18
18
|
const clients_1 = require("../../utils/clients");
|
19
19
|
const mulitpleGetBalances_1 = require("../../utils/sui/mulitpleGetBalances");
|
20
|
-
const constants_2 = require("../cetus/constants");
|
21
20
|
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
22
|
-
const
|
21
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
22
|
+
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
23
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
24
|
+
const vaultsPositionInfoMemo = new MemoizedCache_1.MemoizedCache(constants_1.vaultsInfoKey, {
|
25
|
+
prefix: constants_1.platformId,
|
26
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
27
|
+
});
|
23
28
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
29
|
+
var _a, _b;
|
24
30
|
const client = (0, clients_1.getClientSui)();
|
25
|
-
const
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
});
|
31
|
+
const [vaultsOldBalances, vaultBalances, vaultsPositionInfo] = yield Promise.all([
|
32
|
+
(0, mulitpleGetBalances_1.getMultipleBalances)(client, owner, constants_1.vaultsInfo.map((vault) => vault.tokenType)),
|
33
|
+
(0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
34
|
+
filter: { StructType: constants_1.vaultStakeReceipt },
|
35
|
+
}),
|
36
|
+
vaultsPositionInfoMemo.getItem(cache),
|
37
|
+
]);
|
33
38
|
if (!vaultsPositionInfo)
|
34
39
|
return [];
|
35
|
-
const
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
const
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
const vaultsByCoinType = new Map();
|
41
|
+
vaultsPositionInfo.forEach((vault) => vaultsByCoinType.set(vault.coinType, vault));
|
42
|
+
const vaultsByFarmId = new Map();
|
43
|
+
vaultsPositionInfo.forEach((vault) => vaultsByFarmId.set(vault.farmId, vault));
|
44
|
+
const registry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
45
|
+
const liquidities = registry.addElementLiquidity({
|
46
|
+
name: 'Vaults',
|
47
|
+
label: 'LiquidityPool',
|
48
|
+
});
|
49
|
+
for (let i = 0; i < vaultsOldBalances.length; i++) {
|
50
|
+
const liquidity = liquidities.addLiquidity();
|
51
|
+
const balance = vaultsOldBalances[i];
|
52
|
+
if (balance.totalBalance === '0')
|
53
|
+
continue;
|
54
|
+
const vault = vaultsByCoinType.get(balance.coinType);
|
55
|
+
if (!vault)
|
45
56
|
continue;
|
46
57
|
const totalSupply = new bignumber_js_1.default(vault.totalSupply);
|
47
|
-
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(vault.liquidity),
|
58
|
+
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(vault.liquidity), vault.currentTickIndex, vault.lowerTick, vault.upperTick, false);
|
48
59
|
const shares = new bignumber_js_1.default(balance.totalBalance).dividedBy(totalSupply);
|
49
|
-
const
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
60
|
+
const amountA = tokenAmountA.times(shares);
|
61
|
+
const amountB = tokenAmountB.times(shares);
|
62
|
+
liquidity.addAsset({
|
63
|
+
address: vault.mintA,
|
64
|
+
amount: amountA,
|
65
|
+
});
|
66
|
+
liquidity.addAsset({
|
67
|
+
address: vault.mintB,
|
68
|
+
amount: amountB,
|
69
|
+
});
|
70
|
+
}
|
71
|
+
for (let i = 0; i < vaultBalances.length; i++) {
|
72
|
+
const liquidity = liquidities.addLiquidity();
|
73
|
+
const stakeReceipt = (_b = (_a = vaultBalances[i].data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields;
|
74
|
+
if (!stakeReceipt || stakeReceipt.shares === '0')
|
54
75
|
continue;
|
55
|
-
const
|
56
|
-
|
57
|
-
.dividedBy(Math.pow(10, tokenPriceA.decimals));
|
58
|
-
const amountB = tokenAmountB
|
59
|
-
.times(shares)
|
60
|
-
.dividedBy(Math.pow(10, tokenPriceB.decimals));
|
61
|
-
if (amountA.isZero() && amountB.isZero())
|
76
|
+
const vault = vaultsByFarmId.get(stakeReceipt.farm_id);
|
77
|
+
if (!vault)
|
62
78
|
continue;
|
63
|
-
const
|
64
|
-
const
|
65
|
-
const
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
79
|
+
const totalSupply = new bignumber_js_1.default(vault.totalSupply);
|
80
|
+
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(vault.liquidity), 600, vault.lowerTick, vault.upperTick, false);
|
81
|
+
const useApiData = tokenAmountA.isLessThan(0) || tokenAmountB.isLessThan(0);
|
82
|
+
const shares = new bignumber_js_1.default(stakeReceipt.shares).dividedBy(totalSupply);
|
83
|
+
const amountA = useApiData
|
84
|
+
? new bignumber_js_1.default(vault.amountA).times(shares)
|
85
|
+
: tokenAmountA.times(shares);
|
86
|
+
const amountB = useApiData
|
87
|
+
? new bignumber_js_1.default(vault.amountB).times(shares)
|
88
|
+
: tokenAmountB.times(shares);
|
89
|
+
liquidity.addAsset({
|
90
|
+
address: vault.mintA,
|
91
|
+
amount: amountA,
|
92
|
+
});
|
93
|
+
liquidity.addAsset({
|
94
|
+
address: vault.mintB,
|
95
|
+
amount: amountB,
|
74
96
|
});
|
75
97
|
}
|
76
|
-
|
77
|
-
return [];
|
78
|
-
return [
|
79
|
-
{
|
80
|
-
type: 'liquidity',
|
81
|
-
data: {
|
82
|
-
liquidities,
|
83
|
-
},
|
84
|
-
label: 'LiquidityPool',
|
85
|
-
networkId: portfolio_core_1.NetworkId.sui,
|
86
|
-
platformId: constants_1.platformId,
|
87
|
-
value: totalValue,
|
88
|
-
name: 'Vaults',
|
89
|
-
},
|
90
|
-
];
|
98
|
+
return registry.getElements(cache);
|
91
99
|
});
|
92
100
|
const fetcher = {
|
93
101
|
id: `${constants_1.platformId}-vaults`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/vaultsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"vaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/vaultsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,6EAA0E;AAE1E,wFAAyF;AACzF,gFAA6E;AAC7E,qEAAkE;AAClE,kEAA+D;AAG/D,MAAM,sBAAsB,GAAG,IAA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;QAE/B,SAAS,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,KAAK,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;QACH,SAAS,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,KAAK,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -8,40 +8,76 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
13
17
|
const clients_1 = require("../../utils/clients");
|
14
|
-
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
15
|
-
const multipleGetDynamicFieldsObjects_1 = require("../../utils/sui/multipleGetDynamicFieldsObjects");
|
16
18
|
const constants_1 = require("./constants");
|
19
|
+
const common_1 = require("./types/common");
|
20
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
21
|
+
const getDynamicFieldObjects_1 = require("../../utils/sui/getDynamicFieldObjects");
|
22
|
+
const bitsToNumber_1 = require("../../utils/sui/bitsToNumber");
|
17
23
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
-
var _a, _b, _c, _d;
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
19
25
|
const client = (0, clients_1.getClientSui)();
|
20
|
-
const [vaultsObjects, vaultsDynamicFields] = yield Promise.all([
|
21
|
-
(0, multiGetObjects_1.multiGetObjects)(client, constants_1.vaultsInfo.map((vault) => vault.id)),
|
22
|
-
(0, multipleGetDynamicFieldsObjects_1.multipleGetDynamicFieldsObjects)(client, constants_1.vaultsInfo.map((vault) => vault.id)),
|
23
|
-
]);
|
24
26
|
const vaultsInfos = [];
|
25
|
-
|
26
|
-
|
27
|
+
const vaultsApiData = yield axios_1.default.get(constants_1.vaultsUrl);
|
28
|
+
for (const vaultInfo of constants_1.vaultsInfo) {
|
29
|
+
const [vaultOject, vaultDynamicFields] = yield Promise.all([
|
30
|
+
(0, getObject_1.getObject)(client, vaultInfo.id),
|
31
|
+
(0, getDynamicFieldObjects_1.getDynamicFieldObjects)(client, vaultInfo.id),
|
32
|
+
]);
|
33
|
+
const vault = (_b = (_a = vaultOject.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields;
|
27
34
|
if (!vault)
|
28
35
|
continue;
|
29
|
-
const
|
36
|
+
const vaultData = vaultsApiData.data.find((v) => v.id === vault.id.id);
|
37
|
+
if (!vaultData)
|
38
|
+
continue;
|
39
|
+
const isCetus = vaultInfo.underlyingDex === common_1.Dex.cetus;
|
40
|
+
const dynamicFieldType = isCetus
|
41
|
+
? constants_1.dynamicFieldPositionTypeCetus
|
42
|
+
: constants_1.dynamicFieldPositionTypeKriya;
|
30
43
|
let vaultPosition;
|
31
|
-
for (const fields of
|
32
|
-
if (((_c = fields.data) === null || _c === void 0 ? void 0 : _c.type) ===
|
33
|
-
vaultPosition =
|
44
|
+
for (const fields of vaultDynamicFields) {
|
45
|
+
if (((_c = fields.data) === null || _c === void 0 ? void 0 : _c.type) === dynamicFieldType) {
|
46
|
+
vaultPosition = isCetus
|
47
|
+
? (_d = fields.data.content) === null || _d === void 0 ? void 0 : _d.fields
|
48
|
+
: (_e = fields.data.content) === null || _e === void 0 ? void 0 : _e.fields;
|
49
|
+
}
|
34
50
|
}
|
35
51
|
if (!vaultPosition)
|
36
52
|
continue;
|
37
|
-
const
|
53
|
+
const vaultPositionCommon = {
|
38
54
|
id: vault.id.id,
|
55
|
+
farmId: vaultData.farmId,
|
56
|
+
coinType: vaultInfo.tokenType,
|
39
57
|
liquidity: vaultPosition.value.fields.liquidity,
|
40
58
|
lowerTick: vault.lower_tick,
|
41
59
|
upperTick: vault.upper_tick,
|
42
60
|
totalSupply: vault.treasury_cap.fields.total_supply.fields.value,
|
61
|
+
amountA: vaultData.coinA,
|
62
|
+
amountB: vaultData.coinB,
|
43
63
|
};
|
44
|
-
|
64
|
+
if (vaultInfo.underlyingDex === common_1.Dex.cetus) {
|
65
|
+
const poolInfo = yield (0, getObject_1.getObject)(client, vaultInfo.underlyingPool);
|
66
|
+
if ((_g = (_f = poolInfo.data) === null || _f === void 0 ? void 0 : _f.content) === null || _g === void 0 ? void 0 : _g.fields) {
|
67
|
+
const { keys } = (0, portfolio_core_1.parseTypeString)(poolInfo.data.type);
|
68
|
+
if (keys && keys.at(0) && keys.at(1)) {
|
69
|
+
const vaultPositionInfo = Object.assign(Object.assign({}, vaultPositionCommon), { currentTickIndex: (0, bitsToNumber_1.bitsToNumber)(poolInfo.data.content.fields.current_tick_index.fields.bits), mintA: keys[0].type, mintB: keys[1].type });
|
70
|
+
vaultsInfos.push(vaultPositionInfo);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
else if (vaultInfo.underlyingDex === common_1.Dex.kriya) {
|
75
|
+
const poolInfo = yield (0, getObject_1.getObject)(client, vaultInfo.underlyingPool);
|
76
|
+
if ((_j = (_h = poolInfo.data) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j.fields) {
|
77
|
+
const vaultPositionInfo = Object.assign(Object.assign({}, vaultPositionCommon), { currentTickIndex: (0, bitsToNumber_1.bitsToNumber)(poolInfo.data.content.fields.tick_index.fields.bits), mintA: poolInfo.data.content.fields.type_x.fields.name, mintB: poolInfo.data.content.fields.type_y.fields.name });
|
78
|
+
vaultsInfos.push(vaultPositionInfo);
|
79
|
+
}
|
80
|
+
}
|
45
81
|
}
|
46
82
|
yield cache.setItem(constants_1.vaultsInfoKey, vaultsInfos, {
|
47
83
|
prefix: constants_1.platformId,
|
@@ -51,7 +87,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
87
|
const job = {
|
52
88
|
id: `${constants_1.platformId}-vaults`,
|
53
89
|
executor,
|
54
|
-
label: '
|
90
|
+
label: 'realtime',
|
55
91
|
};
|
56
92
|
exports.default = job;
|
57
93
|
//# sourceMappingURL=vaultsJob.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vaultsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/vaultsJob.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"vaultsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/vaultsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAwE;AACxE,kDAA6C;AAG7C,iDAAmD;AACnD,2CAOqB;AAOrB,2CAAwD;AAExD,yDAAsD;AACtD,mFAAgF;AAChF,+DAA4D;AAG5D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,WAAW,GAAwB,EAAE,CAAC;IAE5C,MAAM,aAAa,GAA+B,MAAM,eAAK,CAAC,GAAG,CAAC,qBAAS,CAAC,CAAC;IAE7E,KAAK,MAAM,SAAS,IAAI,sBAAU,EAAE,CAAC;QACnC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACzD,IAAA,qBAAS,EAAQ,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;Y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AE,CAAC;gBACnC,MAAM,iBAAiB,mCAClB,mBAAmB,KACtB,gBAAgB,EAAE,IAAA,2BAAY,EAC5B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CACpD,EACD,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EACtD,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,GACvD,CAAC;gBACF,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,WAAW,EAAE;QAC9C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,QAAQ;IACR,KAAK,EAAE,UAAU;CAClB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -30,6 +30,10 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
voter: r.vote_identity,
|
31
31
|
name: r.name,
|
32
32
|
imageUri: r.image,
|
33
|
+
baseApy: r.apy_estimate,
|
34
|
+
jitoApy: r.jito_apy,
|
35
|
+
stakingApy: r.staking_apy,
|
36
|
+
totalApy: r.total_apy,
|
33
37
|
}));
|
34
38
|
yield cache.setItem(constants_1.validatorsKey, validators, {
|
35
39
|
prefix: constants_1.platformId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solanaValidatorsJob.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/native-stake/solana/solanaValidatorsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,4CAAyD;AACzD,2CAA0C;AAG1C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAgD,uBAAW,EAAE;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEnD,MAAM,UAAU,GAAgB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACnD,KAAK,EAAE,CAAC,CAAC,aAAa;QACtB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,QAAQ,EAAE,CAAC,CAAC,KAAK;
|
1
|
+
{"version":3,"file":"solanaValidatorsJob.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/native-stake/solana/solanaValidatorsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,4CAAyD;AACzD,2CAA0C;AAG1C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAgD,uBAAW,EAAE;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEnD,MAAM,UAAU,GAAgB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACnD,KAAK,EAAE,CAAC,CAAC,aAAa;QACtB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,QAAQ,EAAE,CAAC,CAAC,KAAK;QACjB,OAAO,EAAE,CAAC,CAAC,YAAY;QACvB,OAAO,EAAE,CAAC,CAAC,QAAQ;QACnB,UAAU,EAAE,CAAC,CAAC,WAAW;QACzB,QAAQ,EAAE,CAAC,CAAC,SAAS;KACtB,CAAC,CAAC,CAAC;IAEJ,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,UAAU,EAAE;QAC7C,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,oBAAoB;IACrC,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -3,9 +3,17 @@ export type ValidatorApiResponse = {
|
|
3
3
|
vote_identity: string;
|
4
4
|
name: string;
|
5
5
|
image: string;
|
6
|
+
apy_estimate: number;
|
7
|
+
jito_apy: number;
|
8
|
+
staking_apy: number;
|
9
|
+
total_apy: number;
|
6
10
|
};
|
7
11
|
export type Validator = {
|
8
12
|
voter: string;
|
9
13
|
name?: string;
|
10
14
|
imageUri?: string;
|
15
|
+
baseApy: number;
|
16
|
+
jitoApy: number;
|
17
|
+
stakingApy: number;
|
18
|
+
totalApy: number;
|
11
19
|
};
|
@@ -8,17 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
13
|
const web3_js_1 = require("@solana/web3.js");
|
17
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
14
|
const constants_1 = require("./constants");
|
19
15
|
const clients_1 = require("../../utils/clients");
|
20
16
|
const solana_1 = require("../../utils/solana");
|
21
|
-
const
|
17
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
22
18
|
const decodePosition = (buffer) => ({
|
23
19
|
amount: Number(buffer.readBigUInt64LE(1)),
|
24
20
|
activationEpoch: Number(buffer.readBigUInt64LE(1 + 8)),
|
@@ -58,34 +54,24 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
58
54
|
{
|
59
55
|
memcmp: {
|
60
56
|
offset: 8,
|
61
|
-
bytes: new web3_js_1.PublicKey(owner).
|
57
|
+
bytes: new web3_js_1.PublicKey(owner).toString(),
|
62
58
|
},
|
63
59
|
},
|
64
60
|
]);
|
65
61
|
if (accs.length === 0)
|
66
62
|
return [];
|
67
63
|
const positions = accs.map((acc) => acc && decodePositionAccount(acc.account.data));
|
68
|
-
const
|
69
|
-
|
70
|
-
|
71
|
-
|
64
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
65
|
+
const element = elementRegistry.addElementMultiple({
|
66
|
+
label: 'Staked',
|
67
|
+
});
|
72
68
|
positions.forEach((positionAccount) => {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
|
69
|
+
element.addAsset({
|
70
|
+
address: constants_1.prclMint,
|
71
|
+
amount: positionAccount.positions.reduce((sum, position) => sum + Number(position.amount), 0),
|
77
72
|
});
|
78
73
|
});
|
79
|
-
return
|
80
|
-
{
|
81
|
-
type: portfolio_core_1.PortfolioElementType.multiple,
|
82
|
-
label: 'Staked',
|
83
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
84
|
-
platformId: constants_1.platformId,
|
85
|
-
data: { assets },
|
86
|
-
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
87
|
-
},
|
88
|
-
];
|
74
|
+
return elementRegistry.getElements(cache);
|
89
75
|
});
|
90
76
|
const fetcher = {
|
91
77
|
id: `${constants_1.platformId}-staking`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/stakingFetcher.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAE5C,2CAAqE;AAErE,iDAAsD;AACtD,+CAAwD;AAExD,gFAA6E;AAE7E,MAAM,cAAc,GAAG,CAAC,MAAc,EAAY,EAAE,CAAC,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACzC,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1D,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAmB,EAAE;IAChE,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,CAAC,IAAI,CAAC,CAAC;IACP,MAAM,KAAK,GAAG,IAAI,mBAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;I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C1E,MAAM,OAAO,GAAG,eAAe,CAAC,kBAAkB,CAAC;QACjD,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;IAEH,SAAS,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;QACpC,OAAO,CAAC,QAAQ,CAAC;YACf,OAAO,EAAE,oBAAQ;YACjB,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,MAAM,CACtC,CAAC,GAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EACxD,CAAC,CACF;SACF,CAAC,CAAC;IACL,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,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
|
|
54
54
|
}
|
55
55
|
function getV3PairsAddresses(url, length = 300) {
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
57
|
-
const query = (0, graphql_request_1.gql) `
|
58
|
-
{
|
59
|
-
pools(
|
60
|
-
orderBy: totalValueLockedUSD
|
61
|
-
first: ${length}
|
62
|
-
orderDirection: desc
|
63
|
-
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
-
) {
|
65
|
-
id
|
66
|
-
token0Price
|
67
|
-
token1Price
|
68
|
-
liquidity
|
69
|
-
token0 {
|
70
|
-
id
|
71
|
-
totalSupply
|
72
|
-
decimals
|
73
|
-
}
|
74
|
-
token1 {
|
75
|
-
id
|
76
|
-
totalSupply
|
77
|
-
decimals
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
57
|
+
const query = (0, graphql_request_1.gql) `
|
58
|
+
{
|
59
|
+
pools(
|
60
|
+
orderBy: totalValueLockedUSD
|
61
|
+
first: ${length}
|
62
|
+
orderDirection: desc
|
63
|
+
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
+
) {
|
65
|
+
id
|
66
|
+
token0Price
|
67
|
+
token1Price
|
68
|
+
liquidity
|
69
|
+
token0 {
|
70
|
+
id
|
71
|
+
totalSupply
|
72
|
+
decimals
|
73
|
+
}
|
74
|
+
token1 {
|
75
|
+
id
|
76
|
+
totalSupply
|
77
|
+
decimals
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
81
|
`;
|
82
82
|
const res = yield (0, graphql_request_1.default)(url, query);
|
83
83
|
const pools = res.pools;
|
@@ -40,28 +40,28 @@ function getPairKey(version) {
|
|
40
40
|
exports.getPairKey = getPairKey;
|
41
41
|
function getPairsV2FromTheGraph(url, length = 300) {
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
43
|
-
const query = (0, graphql_request_1.gql) `
|
44
|
-
{
|
45
|
-
pairs(
|
46
|
-
orderBy: reserveUSD
|
47
|
-
first: ${length}
|
48
|
-
orderDirection: desc
|
49
|
-
where: { trackedReserveETH_not: "0" }
|
50
|
-
) {
|
51
|
-
id
|
52
|
-
reserve0
|
53
|
-
reserve1
|
54
|
-
totalSupply
|
55
|
-
token0 {
|
56
|
-
id
|
57
|
-
decimals
|
58
|
-
}
|
59
|
-
token1 {
|
60
|
-
id
|
61
|
-
decimals
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
43
|
+
const query = (0, graphql_request_1.gql) `
|
44
|
+
{
|
45
|
+
pairs(
|
46
|
+
orderBy: reserveUSD
|
47
|
+
first: ${length}
|
48
|
+
orderDirection: desc
|
49
|
+
where: { trackedReserveETH_not: "0" }
|
50
|
+
) {
|
51
|
+
id
|
52
|
+
reserve0
|
53
|
+
reserve1
|
54
|
+
totalSupply
|
55
|
+
token0 {
|
56
|
+
id
|
57
|
+
decimals
|
58
|
+
}
|
59
|
+
token1 {
|
60
|
+
id
|
61
|
+
decimals
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
65
|
`;
|
66
66
|
const res = yield (0, graphql_request_1.default)(url, query);
|
67
67
|
const pairs = res.pairs;
|
@@ -42,20 +42,20 @@ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/token
|
|
42
42
|
const clients_1 = require("../../utils/clients");
|
43
43
|
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
44
44
|
const helpers_1 = require("./helpers");
|
45
|
-
const query = (0, graphql_request_1.gql) `
|
46
|
-
query GetAirdropFinalFrontend($authority: String!) {
|
47
|
-
getAirdropFinalFrontend(authority: $authority) {
|
48
|
-
authority
|
49
|
-
community_allocation
|
50
|
-
eligibility
|
51
|
-
main_allocation
|
52
|
-
og_allocation
|
53
|
-
s1_allocation
|
54
|
-
s2_allocation
|
55
|
-
total_allocation
|
56
|
-
__typename
|
57
|
-
}
|
58
|
-
}
|
45
|
+
const query = (0, graphql_request_1.gql) `
|
46
|
+
query GetAirdropFinalFrontend($authority: String!) {
|
47
|
+
getAirdropFinalFrontend(authority: $authority) {
|
48
|
+
authority
|
49
|
+
community_allocation
|
50
|
+
eligibility
|
51
|
+
main_allocation
|
52
|
+
og_allocation
|
53
|
+
s1_allocation
|
54
|
+
s2_allocation
|
55
|
+
total_allocation
|
56
|
+
__typename
|
57
|
+
}
|
58
|
+
}
|
59
59
|
`;
|
60
60
|
const networkId = portfolio_core_1.NetworkId.solana;
|
61
61
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -36,7 +36,7 @@ class LiquidityBuilder {
|
|
36
36
|
const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value));
|
37
37
|
const rewardAssetsValue = (0, portfolio_core_1.getUsdValueSum)(rewardAssets.map((asset) => asset.value));
|
38
38
|
const value = (assetsValue || 0) + (rewardAssetsValue || 0);
|
39
|
-
if (value
|
39
|
+
if (value <= 0)
|
40
40
|
return null;
|
41
41
|
return {
|
42
42
|
assets,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LiquidityBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/LiquidityBuilder.ts"],"names":[],"mappings":";;;AAAA,+DAMoC;AAEpC,iDAA8C;AAG9C,MAAa,gBAAgB;IAK3B;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,MAA4B;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,cAAc,CAAC,MAA4B;QACzC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,QAAQ,CAAC,MAAa;QACpB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK;QACH,OAAO;YACL,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YACpC,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SAC3C,CAAC;IACJ,CAAC;IAED,GAAG,CACD,SAAwB,EACxB,WAA0B;QAE1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM;aACvB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;aAC/C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAqB,CAAC;QACjD,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY;aACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;aACzC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAqB,CAAC;QAEjD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAElE,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACvE,MAAM,iBAAiB,GAAG,IAAA,+BAAc,EACtC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CACzC,CAAC;QACF,MAAM,KAAK,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,CAAC,iBAAiB,IAAI,CAAC,CAAC,CAAC;QAE5D,IAAI,KAAK,
|
1
|
+
{"version":3,"file":"LiquidityBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/LiquidityBuilder.ts"],"names":[],"mappings":";;;AAAA,+DAMoC;AAEpC,iDAA8C;AAG9C,MAAa,gBAAgB;IAK3B;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,MAA4B;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,cAAc,CAAC,MAA4B;QACzC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,2BA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K,CAAC,KAAK,CAAC,CACzC,CAAC;QACF,MAAM,KAAK,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,CAAC,iBAAiB,IAAI,CAAC,CAAC,CAAC;QAE5D,IAAI,KAAK,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAE5B,OAAO;YACL,MAAM;YACN,WAAW;YACX,YAAY;YACZ,iBAAiB;YACjB,KAAK;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;SACE,CAAC;IAC1B,CAAC;CACF;AA5DD,4CA4DC"}
|
@@ -1,16 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
|
4
|
-
exports.infoQueryMsg = JSON.parse(`{
|
5
|
-
"info": {}
|
4
|
+
exports.infoQueryMsg = JSON.parse(`{
|
5
|
+
"info": {}
|
6
6
|
}`);
|
7
|
-
exports.tokenInfoQueryMsg = JSON.parse(`{
|
8
|
-
"token_info": {}
|
7
|
+
exports.tokenInfoQueryMsg = JSON.parse(`{
|
8
|
+
"token_info": {}
|
9
9
|
}`);
|
10
|
-
exports.minterQueryMsg = JSON.parse(`{
|
11
|
-
"minter": {}
|
10
|
+
exports.minterQueryMsg = JSON.parse(`{
|
11
|
+
"minter": {}
|
12
12
|
}`);
|
13
|
-
exports.poolQueryMsg = JSON.parse(`{
|
14
|
-
"pool": {}
|
13
|
+
exports.poolQueryMsg = JSON.parse(`{
|
14
|
+
"pool": {}
|
15
15
|
}`);
|
16
16
|
//# sourceMappingURL=constants.js.map
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
function getQueryBalanceByOwner(owner) {
|
4
|
-
return JSON.parse(`{
|
5
|
-
"balance": {
|
6
|
-
"address": "${owner}"
|
7
|
-
}
|
4
|
+
return JSON.parse(`{
|
5
|
+
"balance": {
|
6
|
+
"address": "${owner}"
|
7
|
+
}
|
8
8
|
}`);
|
9
9
|
}
|
10
10
|
exports.default = getQueryBalanceByOwner;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/types.ts"],"names":[],"mappings":";;;AA8IA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,wBAAU,CAAA;IACV,6BAAe,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,wCAA0B,CAAA;IAC1B,6BAAe,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
|