@sonarwatch/portfolio-plugins 0.14.125 → 0.14.127
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 +2106 -2098
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -1
- package/src/index.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/jupiter/index.d.ts +1 -0
- package/src/plugins/jupiter/index.js +7 -1
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/kamino/constants.d.ts +1 -0
- package/src/plugins/kamino/constants.js +6 -1
- package/src/plugins/kamino/constants.js.map +1 -1
- package/src/plugins/kamino/index.js +7 -1
- package/src/plugins/kamino/index.js.map +1 -1
- package/src/plugins/kamino/ordersFetcher.d.ts +3 -0
- package/src/plugins/kamino/ordersFetcher.js +78 -0
- package/src/plugins/kamino/ordersFetcher.js.map +1 -0
- package/src/plugins/kamino/structs/order.d.ts +30 -0
- package/src/plugins/kamino/structs/order.js +30 -0
- package/src/plugins/kamino/structs/order.js.map +1 -0
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/triad/constants.d.ts +1 -0
- package/src/plugins/triad/constants.js +2 -1
- package/src/plugins/triad/constants.js.map +1 -1
- package/src/plugins/triad/helpers.d.ts +4 -0
- package/src/plugins/triad/helpers.js +31 -0
- package/src/plugins/triad/helpers.js.map +1 -0
- package/src/plugins/triad/index.js +4 -2
- package/src/plugins/triad/index.js.map +1 -1
- package/src/plugins/triad/marketsFetcher.d.ts +3 -0
- package/src/plugins/triad/marketsFetcher.js +108 -0
- package/src/plugins/triad/marketsFetcher.js.map +1 -0
- package/src/plugins/triad/marketsJob.d.ts +3 -0
- package/src/plugins/triad/marketsJob.js +41 -0
- package/src/plugins/triad/marketsJob.js.map +1 -0
- package/src/plugins/triad/structs.d.ts +75 -2
- package/src/plugins/triad/structs.js +76 -2
- package/src/plugins/triad/structs.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/zeta/airdropFetcher.js +14 -14
- package/src/plugins/zeta/stakingFetcher.js +1 -3
- package/src/plugins/zeta/stakingFetcher.js.map +1 -1
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
@@ -0,0 +1,108 @@
|
|
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 ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
18
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
19
|
+
const helpers_1 = require("./helpers");
|
20
|
+
const marketsMemo = new MemoizedCache_1.MemoizedCache(constants_1.marketsCacheKey, {
|
21
|
+
prefix: constants_1.platformId,
|
22
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
23
|
+
});
|
24
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
const connection = (0, clients_1.getClientSolana)();
|
26
|
+
const accounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.userTradeV2Struct, constants_1.programId, [
|
27
|
+
{
|
28
|
+
memcmp: {
|
29
|
+
bytes: 'S3hFCmKfRYh',
|
30
|
+
offset: 0,
|
31
|
+
},
|
32
|
+
},
|
33
|
+
{
|
34
|
+
memcmp: {
|
35
|
+
bytes: owner,
|
36
|
+
offset: 9,
|
37
|
+
},
|
38
|
+
},
|
39
|
+
{
|
40
|
+
dataSize: 1064,
|
41
|
+
},
|
42
|
+
]);
|
43
|
+
if (accounts.length === 0)
|
44
|
+
return [];
|
45
|
+
const markets = yield marketsMemo.getItem(cache);
|
46
|
+
if (!markets)
|
47
|
+
throw new Error('Markets not cached');
|
48
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
49
|
+
accounts.forEach((acc) => {
|
50
|
+
acc.orders.forEach((order) => {
|
51
|
+
if (order.status === structs_1.OrderStatus.Init)
|
52
|
+
return;
|
53
|
+
const market = markets.find((m) => m && m.market_id.toString() === order.market_id.toString());
|
54
|
+
if (!market)
|
55
|
+
return;
|
56
|
+
const element = elementRegistry.addElementMultiple({
|
57
|
+
label: 'Deposit',
|
58
|
+
ref: acc.pubkey,
|
59
|
+
sourceRefs: [
|
60
|
+
{
|
61
|
+
name: 'Market',
|
62
|
+
address: market.pubkey.toString(),
|
63
|
+
},
|
64
|
+
],
|
65
|
+
link: `https://app.triadfi.co/market/${market.market_id.toString()}`,
|
66
|
+
name: `${(0, solana_1.u8ArrayToString)(market.question)} ${structs_1.OrderDirection[order.direction]}`,
|
67
|
+
});
|
68
|
+
// bet is over
|
69
|
+
if (market.winning_direction !== structs_1.WinningDirection.None) {
|
70
|
+
if ((market.winning_direction === structs_1.WinningDirection.Hype &&
|
71
|
+
order.direction === structs_1.OrderDirection.Hype) ||
|
72
|
+
(market.winning_direction === structs_1.WinningDirection.Flop &&
|
73
|
+
order.direction === structs_1.OrderDirection.Flop)) {
|
74
|
+
// win
|
75
|
+
element.addAsset({
|
76
|
+
address: market.mint,
|
77
|
+
amount: order.total_shares,
|
78
|
+
attributes: {
|
79
|
+
isClaimable: true,
|
80
|
+
},
|
81
|
+
});
|
82
|
+
}
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
// bet is running
|
86
|
+
element.addAsset({
|
87
|
+
address: market.mint,
|
88
|
+
amount: order.total_amount,
|
89
|
+
});
|
90
|
+
element.addAsset({
|
91
|
+
address: market.mint,
|
92
|
+
amount: (0, helpers_1.calculatePnL)(market, order),
|
93
|
+
attributes: {
|
94
|
+
tags: ['PnL'],
|
95
|
+
},
|
96
|
+
});
|
97
|
+
}
|
98
|
+
});
|
99
|
+
});
|
100
|
+
return elementRegistry.getElements(cache);
|
101
|
+
});
|
102
|
+
const fetcher = {
|
103
|
+
id: `${constants_1.platformId}-markets`,
|
104
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
105
|
+
executor,
|
106
|
+
};
|
107
|
+
exports.default = fetcher;
|
108
|
+
//# sourceMappingURL=marketsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/triad/marketsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAEvD,2CAAqE;AAErE,iDAAsD;AACtD,+CAI4B;AAC5B,uCAMmB;AACnB,gFAA6E;AAC7E,kEAA+D;AAC/D,uCAAyC;AAEzC,MAAM,WAAW,GAAG,IAAI,6BAAa,CACnC,2BAAe,EACf;IACE,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,CACF,CAAC;AAEF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,UAAU,EACV,2BAAiB,EACjB,qBAAS,EACT;QACE;YACE,MAAM,EAA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EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,41 @@
|
|
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 solana_1 = require("../../utils/solana");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const structs_1 = require("./structs");
|
17
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
+
const connection = (0, clients_1.getClientSolana)();
|
19
|
+
const markets = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.marketV2Struct, constants_1.programId, [
|
20
|
+
{
|
21
|
+
memcmp: {
|
22
|
+
bytes: '5ZDUFgFupuY',
|
23
|
+
offset: 0,
|
24
|
+
},
|
25
|
+
},
|
26
|
+
{
|
27
|
+
dataSize: 400,
|
28
|
+
},
|
29
|
+
]);
|
30
|
+
yield cache.setItem(constants_1.marketsCacheKey, markets, {
|
31
|
+
prefix: constants_1.platformId,
|
32
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
33
|
+
});
|
34
|
+
});
|
35
|
+
const job = {
|
36
|
+
id: `${constants_1.platformId}-markets`,
|
37
|
+
executor,
|
38
|
+
labels: ['normal'],
|
39
|
+
};
|
40
|
+
exports.default = job;
|
41
|
+
//# sourceMappingURL=marketsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/triad/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAAqE;AACrE,+CAA8D;AAC9D,iDAAsD;AACtD,uCAA2C;AAE3C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAwB,EAC5C,UAAU,EACV,wBAAc,EACd,qBAAS,EACT;QACE;YACE,MAAM,EAAE;gBACN,KAAK,EAAE,aAAa;gBACpB,MAAM,EAAE,CAAC;aACV;SACF;QACD;YACE,QAAQ,EAAE,GAAG;SACd;KACF,CACF,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,2BAAe,EAAE,OAAO,EAAE;QAC5C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
3
3
|
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
4
|
-
import {
|
4
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
5
5
|
import { PublicKey } from '@solana/web3.js';
|
6
6
|
import BigNumber from 'bignumber.js';
|
7
7
|
export type StakeV2 = {
|
@@ -20,4 +20,77 @@ export type StakeV2 = {
|
|
20
20
|
available: BigNumber;
|
21
21
|
amount: BigNumber;
|
22
22
|
};
|
23
|
-
export declare const stakeV2Struct:
|
23
|
+
export declare const stakeV2Struct: BeetStruct<StakeV2, Partial<StakeV2>>;
|
24
|
+
export declare enum OrderStatus {
|
25
|
+
Init = 0,
|
26
|
+
Open = 1,
|
27
|
+
Closed = 2
|
28
|
+
}
|
29
|
+
export declare enum OrderDirection {
|
30
|
+
Hype = 0,
|
31
|
+
Flop = 1
|
32
|
+
}
|
33
|
+
export declare enum OrderType {
|
34
|
+
Market = 0,
|
35
|
+
Limit = 1
|
36
|
+
}
|
37
|
+
export type Order = {
|
38
|
+
ts: BigNumber;
|
39
|
+
order_id: BigNumber;
|
40
|
+
question_id: BigNumber;
|
41
|
+
market_id: BigNumber;
|
42
|
+
status: OrderStatus;
|
43
|
+
price: BigNumber;
|
44
|
+
total_amount: BigNumber;
|
45
|
+
total_shares: BigNumber;
|
46
|
+
type: OrderType;
|
47
|
+
direction: OrderDirection;
|
48
|
+
user_nonce: BigNumber;
|
49
|
+
padding: number[];
|
50
|
+
};
|
51
|
+
export declare const orderStruct: BeetStruct<Order, Partial<Order>>;
|
52
|
+
export type UserTrade = {
|
53
|
+
buffer: Buffer;
|
54
|
+
bump: number;
|
55
|
+
authority: PublicKey;
|
56
|
+
total_deposits: BigNumber;
|
57
|
+
total_withdraws: BigNumber;
|
58
|
+
opened_orders: BigNumber;
|
59
|
+
orders: Order[];
|
60
|
+
};
|
61
|
+
export declare const userTradeV2Struct: BeetStruct<UserTrade, Partial<UserTrade>>;
|
62
|
+
export declare enum WinningDirection {
|
63
|
+
None = 0,
|
64
|
+
Hype = 1,
|
65
|
+
Flop = 2,
|
66
|
+
Draw = 3
|
67
|
+
}
|
68
|
+
export type MarketV2 = {
|
69
|
+
buffer: Buffer;
|
70
|
+
bump: number;
|
71
|
+
authority: PublicKey;
|
72
|
+
market_id: BigNumber;
|
73
|
+
hype_price: BigNumber;
|
74
|
+
flop_price: BigNumber;
|
75
|
+
hype_liquidity: BigNumber;
|
76
|
+
flop_liquidity: BigNumber;
|
77
|
+
hype_shares: BigNumber;
|
78
|
+
flop_shares: BigNumber;
|
79
|
+
volume: BigNumber;
|
80
|
+
mint: PublicKey;
|
81
|
+
update_ts: BigNumber;
|
82
|
+
opened_orders: BigNumber;
|
83
|
+
next_order_id: BigNumber;
|
84
|
+
fee_bps: BigNumber;
|
85
|
+
nft_holders_fee_available: BigNumber;
|
86
|
+
nft_holders_fee_claimed: BigNumber;
|
87
|
+
market_fee_available: BigNumber;
|
88
|
+
market_fee_claimed: BigNumber;
|
89
|
+
is_allowed_to_payout: boolean;
|
90
|
+
market_start: boolean;
|
91
|
+
market_end: boolean;
|
92
|
+
question: number[];
|
93
|
+
winning_direction: WinningDirection;
|
94
|
+
market_liquidity_at_start: BigNumber[];
|
95
|
+
};
|
96
|
+
export declare const marketV2Struct: BeetStruct<MarketV2, Partial<MarketV2>>;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.stakeV2Struct = void 0;
|
3
|
+
exports.marketV2Struct = exports.WinningDirection = exports.userTradeV2Struct = exports.orderStruct = exports.OrderType = exports.OrderDirection = exports.OrderStatus = exports.stakeV2Struct = 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");
|
7
|
-
exports.stakeV2Struct = new beet_1.
|
7
|
+
exports.stakeV2Struct = new beet_1.BeetStruct([
|
8
8
|
['buffer', (0, solana_1.blob)(8)],
|
9
9
|
['bump', beet_1.u8],
|
10
10
|
['authority', beet_solana_1.publicKey],
|
@@ -20,4 +20,78 @@ exports.stakeV2Struct = new beet_1.FixableBeetStruct([
|
|
20
20
|
['available', solana_1.u64],
|
21
21
|
['amount', solana_1.u64],
|
22
22
|
], (args) => args);
|
23
|
+
var OrderStatus;
|
24
|
+
(function (OrderStatus) {
|
25
|
+
OrderStatus[OrderStatus["Init"] = 0] = "Init";
|
26
|
+
OrderStatus[OrderStatus["Open"] = 1] = "Open";
|
27
|
+
OrderStatus[OrderStatus["Closed"] = 2] = "Closed";
|
28
|
+
})(OrderStatus || (exports.OrderStatus = OrderStatus = {}));
|
29
|
+
var OrderDirection;
|
30
|
+
(function (OrderDirection) {
|
31
|
+
OrderDirection[OrderDirection["Hype"] = 0] = "Hype";
|
32
|
+
OrderDirection[OrderDirection["Flop"] = 1] = "Flop";
|
33
|
+
})(OrderDirection || (exports.OrderDirection = OrderDirection = {}));
|
34
|
+
var OrderType;
|
35
|
+
(function (OrderType) {
|
36
|
+
OrderType[OrderType["Market"] = 0] = "Market";
|
37
|
+
OrderType[OrderType["Limit"] = 1] = "Limit";
|
38
|
+
})(OrderType || (exports.OrderType = OrderType = {}));
|
39
|
+
exports.orderStruct = new beet_1.BeetStruct([
|
40
|
+
['ts', solana_1.i64],
|
41
|
+
['order_id', solana_1.u64],
|
42
|
+
['question_id', solana_1.u64],
|
43
|
+
['market_id', solana_1.u64],
|
44
|
+
['status', beet_1.i8],
|
45
|
+
['price', solana_1.u64],
|
46
|
+
['total_amount', solana_1.u64],
|
47
|
+
['total_shares', solana_1.u64],
|
48
|
+
['type', beet_1.u8],
|
49
|
+
['direction', beet_1.u8],
|
50
|
+
['user_nonce', beet_1.u32],
|
51
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 28)],
|
52
|
+
], (args) => args);
|
53
|
+
exports.userTradeV2Struct = new beet_1.BeetStruct([
|
54
|
+
['buffer', (0, solana_1.blob)(8)],
|
55
|
+
['bump', beet_1.u8],
|
56
|
+
['authority', beet_solana_1.publicKey],
|
57
|
+
['total_deposits', solana_1.u64],
|
58
|
+
['total_withdraws', solana_1.u64],
|
59
|
+
['opened_orders', solana_1.u64],
|
60
|
+
['orders', (0, beet_1.uniformFixedSizeArray)(exports.orderStruct, 10)],
|
61
|
+
], (args) => args);
|
62
|
+
var WinningDirection;
|
63
|
+
(function (WinningDirection) {
|
64
|
+
WinningDirection[WinningDirection["None"] = 0] = "None";
|
65
|
+
WinningDirection[WinningDirection["Hype"] = 1] = "Hype";
|
66
|
+
WinningDirection[WinningDirection["Flop"] = 2] = "Flop";
|
67
|
+
WinningDirection[WinningDirection["Draw"] = 3] = "Draw";
|
68
|
+
})(WinningDirection || (exports.WinningDirection = WinningDirection = {}));
|
69
|
+
exports.marketV2Struct = new beet_1.BeetStruct([
|
70
|
+
['buffer', (0, solana_1.blob)(8)],
|
71
|
+
['bump', beet_1.u8],
|
72
|
+
['authority', beet_solana_1.publicKey],
|
73
|
+
['market_id', solana_1.u64],
|
74
|
+
['hype_price', solana_1.u64],
|
75
|
+
['flop_price', solana_1.u64],
|
76
|
+
['hype_liquidity', solana_1.u64],
|
77
|
+
['flop_liquidity', solana_1.u64],
|
78
|
+
['hype_shares', solana_1.u64],
|
79
|
+
['flop_shares', solana_1.u64],
|
80
|
+
['volume', solana_1.u64],
|
81
|
+
['mint', beet_solana_1.publicKey],
|
82
|
+
['update_ts', solana_1.i64],
|
83
|
+
['opened_orders', solana_1.u64],
|
84
|
+
['next_order_id', solana_1.u64],
|
85
|
+
['fee_bps', beet_1.u16],
|
86
|
+
['nft_holders_fee_available', solana_1.u64],
|
87
|
+
['nft_holders_fee_claimed', solana_1.u64],
|
88
|
+
['market_fee_available', solana_1.u64],
|
89
|
+
['market_fee_claimed', solana_1.u64],
|
90
|
+
['is_allowed_to_payout', beet_1.bool],
|
91
|
+
['market_start', solana_1.i64],
|
92
|
+
['market_end', solana_1.i64],
|
93
|
+
['question', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 80)],
|
94
|
+
['winning_direction', beet_1.u8],
|
95
|
+
['market_liquidity_at_start', solana_1.u64],
|
96
|
+
], (args) => args);
|
23
97
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/triad/structs.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/triad/structs.ts"],"names":[],"mappings":";;;AAAA,oDAQmC;AACnC,kEAA6D;AAG7D,+CAAoD;AAmBvC,QAAA,aAAa,GAAG,IAAI,iBAAU,CACzC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,SAAS,EAAE,YAAG,CAAC;IAChB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,MAAM,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,OAAO,EAAE,WAAI,CAAC;IACf,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,SAAS,EAAE,YAAG,CAAC;IAChB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,QAAQ,EAAE,YAAG,CAAC;CAChB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC;AAEF,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,6CAAI,CAAA;IACJ,6CAAI,CAAA;IACJ,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mDAAI,CAAA;IACJ,mDAAI,CAAA;AACN,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,6CAAM,CAAA;IACN,2CAAK,CAAA;AACP,CAAC,EAHW,SAAS,yBAAT,SAA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AC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,SAAS,EAAE,UAAG,CAAC;IAChB,CAAC,2BAA2B,EAAE,YAAG,CAAC;IAClC,CAAC,yBAAyB,EAAE,YAAG,CAAC;IAChC,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,oBAAoB,EAAE,YAAG,CAAC;IAC3B,CAAC,sBAAsB,EAAE,WAAI,CAAC;IAC9B,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,UAAU,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,EAAE,CAAC,CAAC;IAC3C,CAAC,mBAAmB,EAAE,SAAE,CAAC;IACzB,CAAC,2BAA2B,EAAE,YAAG,CAAC;CACnC,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAgB,CAC3B,CAAC"}
|
@@ -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;
|
@@ -40,20 +40,20 @@ const clients_1 = require("../../utils/clients");
|
|
40
40
|
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
41
41
|
const helpers_1 = require("./helpers");
|
42
42
|
const AirdropFetcher_1 = require("../../AirdropFetcher");
|
43
|
-
const query = (0, graphql_request_1.gql) `
|
44
|
-
query GetAirdropFinalFrontend($authority: String!) {
|
45
|
-
getAirdropFinalFrontend(authority: $authority) {
|
46
|
-
authority
|
47
|
-
community_allocation
|
48
|
-
eligibility
|
49
|
-
main_allocation
|
50
|
-
og_allocation
|
51
|
-
s1_allocation
|
52
|
-
s2_allocation
|
53
|
-
total_allocation
|
54
|
-
__typename
|
55
|
-
}
|
56
|
-
}
|
43
|
+
const query = (0, graphql_request_1.gql) `
|
44
|
+
query GetAirdropFinalFrontend($authority: String!) {
|
45
|
+
getAirdropFinalFrontend(authority: $authority) {
|
46
|
+
authority
|
47
|
+
community_allocation
|
48
|
+
eligibility
|
49
|
+
main_allocation
|
50
|
+
og_allocation
|
51
|
+
s1_allocation
|
52
|
+
s2_allocation
|
53
|
+
total_allocation
|
54
|
+
__typename
|
55
|
+
}
|
56
|
+
}
|
57
57
|
`;
|
58
58
|
const networkId = portfolio_core_1.NetworkId.solana;
|
59
59
|
const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -40,9 +40,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
40
40
|
if (!account)
|
41
41
|
continue;
|
42
42
|
const name = (0, solana_1.u8ArrayToString)(account.name);
|
43
|
-
const amount = new bignumber_js_1.default(account.amountStillStaked)
|
44
|
-
.dividedBy(Math.pow(10, constants_1.zexDecimals))
|
45
|
-
.toNumber();
|
43
|
+
const amount = new bignumber_js_1.default(account.amountStillStaked).toNumber();
|
46
44
|
const attributes = {
|
47
45
|
lockedUntil: account.stakeState.vesting
|
48
46
|
? (0, helpers_1.getTimestamp)(account.stakeDurationEpochs, account.stakeState.vesting.stakeStartEpoch)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/zeta/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAGoC;AACpC,gEAAqC;AAGrC,
|
1
|
+
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/zeta/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAGoC;AACpC,gEAAqC;AAGrC,2CAA+D;AAC/D,iDAAsD;AACtD,uCAAoE;AACpE,+CAG4B;AAE5B,gFAA6E;AAE7E,MAAM,SAAS,GA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mB,EAC3B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,eAAe,CAC3C;gBACH,CAAC,CAAC,CAAC,CAAC;YACN,IAAI,EAAE,CAAC,IAAI,CAAC;SACb,CAAC;QAEF,cAAc,CAAC,QAAQ,CAAC;YACtB,OAAO,EAAE,mBAAO;YAChB,MAAM;YACN,UAAU;YACV,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;SAC/B,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,UAAU;IAC3B,SAAS;IACT,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -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;
|