@sonarwatch/portfolio-plugins 0.11.152 → 0.11.153
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1327 -1323
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/orphanPlatorms.js +9 -1
- package/src/orphanPlatorms.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/phoenix/constants.d.ts +8 -0
- package/src/plugins/phoenix/constants.js +18 -0
- package/src/plugins/phoenix/constants.js.map +1 -0
- package/src/plugins/phoenix/helpers/deserializeMarketData.d.ts +5 -0
- package/src/plugins/phoenix/helpers/deserializeMarketData.js +213 -0
- package/src/plugins/phoenix/helpers/deserializeMarketData.js.map +1 -0
- package/src/plugins/phoenix/helpers/misc.d.ts +6 -0
- package/src/plugins/phoenix/helpers/misc.js +46 -0
- package/src/plugins/phoenix/helpers/misc.js.map +1 -0
- package/src/plugins/phoenix/index.d.ts +6 -0
- package/src/plugins/phoenix/index.js +12 -0
- package/src/plugins/phoenix/index.js.map +1 -0
- package/src/plugins/phoenix/positionsFetcher.d.ts +3 -0
- package/src/plugins/phoenix/positionsFetcher.js +118 -0
- package/src/plugins/phoenix/positionsFetcher.js.map +1 -0
- package/src/plugins/phoenix/structs/marketHeader.d.ts +40 -0
- package/src/plugins/phoenix/structs/marketHeader.js +39 -0
- package/src/plugins/phoenix/structs/marketHeader.js.map +1 -0
- package/src/plugins/phoenix/structs/misc.d.ts +47 -0
- package/src/plugins/phoenix/structs/misc.js +44 -0
- package/src/plugins/phoenix/structs/misc.js.map +1 -0
- package/src/plugins/phoenix/structs/seat.d.ts +11 -0
- package/src/plugins/phoenix/structs/seat.js +14 -0
- package/src/plugins/phoenix/structs/seat.js.map +1 -0
- package/src/plugins/phoenix/types.d.ts +45 -0
- package/src/plugins/phoenix/types.js +3 -0
- package/src/plugins/phoenix/types.js.map +1 -0
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/solana/getParsedProgramAccounts.js +2 -2
- package/src/utils/solana/getParsedProgramAccounts.js.map +1 -1
- package/src/utils/solana/getProgramAccounts.d.ts +2 -0
- package/src/utils/solana/{getProgramAccountsSafe.js → getProgramAccounts.js} +5 -5
- package/src/utils/solana/getProgramAccounts.js.map +1 -0
- package/src/utils/solana/index.d.ts +1 -1
- package/src/utils/solana/index.js +1 -1
- package/src/utils/solana/index.js.map +1 -1
- package/src/utils/solana/getProgramAccountsSafe.d.ts +0 -2
- package/src/utils/solana/getProgramAccountsSafe.js.map +0 -1
@@ -0,0 +1,118 @@
|
|
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 bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const solana_1 = require("../../utils/solana");
|
20
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const seat_1 = require("./structs/seat");
|
22
|
+
const marketHeader_1 = require("./structs/marketHeader");
|
23
|
+
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
24
|
+
const deserializeMarketData_1 = require("./helpers/deserializeMarketData");
|
25
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
+
const connection = (0, clients_1.getClientSolana)();
|
27
|
+
const accounts = yield (0, solana_1.getParsedProgramAccounts)(connection, seat_1.seatStruct, constants_1.phoenixPid, [
|
28
|
+
{
|
29
|
+
dataSize: seat_1.seatStruct.byteSize,
|
30
|
+
},
|
31
|
+
{
|
32
|
+
memcmp: {
|
33
|
+
bytes: owner,
|
34
|
+
offset: 40,
|
35
|
+
},
|
36
|
+
},
|
37
|
+
]);
|
38
|
+
if (accounts.length === 0)
|
39
|
+
return [];
|
40
|
+
const marketAddresses = accounts.map((acc) => acc.market);
|
41
|
+
const marketsAccounts = yield (0, getMultipleAccountsInfoSafe_1.getMultipleAccountsInfoSafe)(connection, marketAddresses);
|
42
|
+
const marketHeaders = marketsAccounts.map((acc) => acc ? marketHeader_1.marketHeaderStruct.deserialize(acc.data)[0] : null);
|
43
|
+
const mints = [];
|
44
|
+
const decimals = new Map();
|
45
|
+
marketHeaders.forEach((mh) => {
|
46
|
+
if (!mh)
|
47
|
+
return;
|
48
|
+
const quoteMint = mh.quoteParams.mintKey.toString();
|
49
|
+
const baseMint = mh.baseParams.mintKey.toString();
|
50
|
+
mints.push(quoteMint, baseMint);
|
51
|
+
decimals.set(quoteMint, mh.quoteParams.decimals);
|
52
|
+
decimals.set(baseMint, mh.baseParams.decimals);
|
53
|
+
});
|
54
|
+
if (mints.length === 0)
|
55
|
+
return [];
|
56
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.solana);
|
57
|
+
const liquidities = [];
|
58
|
+
for (let i = 0; i < accounts.length; i++) {
|
59
|
+
const marketAcc = marketsAccounts.at(i);
|
60
|
+
const marketHeader = marketHeaders.at(i);
|
61
|
+
if (!marketAcc || !marketHeader)
|
62
|
+
continue;
|
63
|
+
const traderState = (0, deserializeMarketData_1.getTraderState)(marketAcc.data, owner);
|
64
|
+
if (!traderState)
|
65
|
+
continue;
|
66
|
+
const baseMint = marketHeader.baseParams.mintKey.toString();
|
67
|
+
const baseDecimals = decimals.get(baseMint);
|
68
|
+
const quoteMint = marketHeader.quoteParams.mintKey.toString();
|
69
|
+
const quoteDecimals = decimals.get(quoteMint);
|
70
|
+
if (baseDecimals === undefined || quoteDecimals === undefined)
|
71
|
+
continue;
|
72
|
+
const baseAmount = new bignumber_js_1.default(traderState.baseLotsFree.toString())
|
73
|
+
.plus(traderState.baseLotsLocked.toString())
|
74
|
+
.div(Math.pow(10, baseDecimals))
|
75
|
+
.times(marketHeader.baseLotSize)
|
76
|
+
.toNumber();
|
77
|
+
const quoteAmount = new bignumber_js_1.default(traderState.quoteLotsFree.toString())
|
78
|
+
.plus(traderState.quoteLotsLocked.toString())
|
79
|
+
.div(Math.pow(10, quoteDecimals))
|
80
|
+
.times(marketHeader.quoteLotSize)
|
81
|
+
.toNumber();
|
82
|
+
if (baseAmount === 0 && quoteAmount === 0)
|
83
|
+
continue;
|
84
|
+
const baseAsset = (0, tokenPriceToAssetToken_1.default)(baseMint, baseAmount, portfolio_core_1.NetworkId.solana, tokenPrices.get(baseMint));
|
85
|
+
const quoteAsset = (0, tokenPriceToAssetToken_1.default)(quoteMint, quoteAmount, portfolio_core_1.NetworkId.solana, tokenPrices.get(quoteMint));
|
86
|
+
const value = (0, portfolio_core_1.getUsdValueSum)([baseAsset.value, quoteAsset.value]);
|
87
|
+
const liquidity = {
|
88
|
+
assets: [baseAsset, quoteAsset],
|
89
|
+
assetsValue: value,
|
90
|
+
rewardAssets: [],
|
91
|
+
rewardAssetsValue: 0,
|
92
|
+
value,
|
93
|
+
yields: [],
|
94
|
+
};
|
95
|
+
liquidities.push(liquidity);
|
96
|
+
}
|
97
|
+
if (liquidities.length === 0)
|
98
|
+
return [];
|
99
|
+
return [
|
100
|
+
{
|
101
|
+
type: portfolio_core_1.PortfolioElementType.liquidity,
|
102
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
103
|
+
platformId: constants_1.platformId,
|
104
|
+
label: 'Deposit',
|
105
|
+
value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((l) => l.value)),
|
106
|
+
data: {
|
107
|
+
liquidities,
|
108
|
+
},
|
109
|
+
},
|
110
|
+
];
|
111
|
+
});
|
112
|
+
const fetcher = {
|
113
|
+
id: `${constants_1.platformId}-positions`,
|
114
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
115
|
+
executor,
|
116
|
+
};
|
117
|
+
exports.default = fetcher;
|
118
|
+
//# 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,+DAKoC;AACpC,gEAAqC;AAErC,2CAAqD;AAErD,iDAAsD;AACtD,+CAA8D;AAC9D,qGAA6E;AAC7E,yCAA4C;AAC5C,yDAA4D;AAC5D,gGAA6F;AAC7F,2EAAiE;AAEjE,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,iBAAU,EACV,sBAAU,EACV;QACE;YACE,QAAQ,EAAE,iBAAU,CAAC,QAAQ;SAC9B;QACD;YACE,MAAM,EAAE;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,EAAE;aACX;SACF;KACF,CACF,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,eAAe,GAA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E,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import BigNumber from 'bignumber.js';
|
4
|
+
import { PublicKey } from '@solana/web3.js';
|
5
|
+
export type TokenParams = {
|
6
|
+
decimals: number;
|
7
|
+
vaultBump: number;
|
8
|
+
mintKey: PublicKey;
|
9
|
+
vaultKey: PublicKey;
|
10
|
+
};
|
11
|
+
export declare const tokenParamsStruct: BeetStruct<TokenParams, Partial<TokenParams>>;
|
12
|
+
export type MarketSizeParams = {
|
13
|
+
bidsSize: BigNumber;
|
14
|
+
asksSize: BigNumber;
|
15
|
+
numSeats: BigNumber;
|
16
|
+
};
|
17
|
+
export declare const marketSizeParamsBeet: BeetStruct<MarketSizeParams, Partial<MarketSizeParams>>;
|
18
|
+
export type MarketHeaderAccount = {
|
19
|
+
discriminant: BigNumber;
|
20
|
+
status: BigNumber;
|
21
|
+
marketSizeParams: MarketSizeParams;
|
22
|
+
baseParams: TokenParams;
|
23
|
+
baseLotSize: BigNumber;
|
24
|
+
quoteParams: TokenParams;
|
25
|
+
quoteLotSize: BigNumber;
|
26
|
+
tickSizeInQuoteAtomsPerBaseUnit: BigNumber;
|
27
|
+
authority: PublicKey;
|
28
|
+
feeRecipient: PublicKey;
|
29
|
+
marketSequenceNumber: BigNumber;
|
30
|
+
successor: PublicKey;
|
31
|
+
rawBaseUnitsPerBaseUnit: number;
|
32
|
+
padding1: number;
|
33
|
+
padding2: BigNumber[];
|
34
|
+
};
|
35
|
+
export declare const marketHeaderStruct: BeetStruct<MarketHeaderAccount, Partial<MarketHeaderAccount>>;
|
36
|
+
export type PartialMarketHeaderAccount = {
|
37
|
+
buffer: Buffer;
|
38
|
+
marketSizeParams: MarketSizeParams;
|
39
|
+
};
|
40
|
+
export declare const partialMarketHeaderStruct: BeetStruct<PartialMarketHeaderAccount, Partial<PartialMarketHeaderAccount>>;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.partialMarketHeaderStruct = exports.marketHeaderStruct = exports.marketSizeParamsBeet = exports.tokenParamsStruct = 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.tokenParamsStruct = new beet_1.BeetStruct([
|
8
|
+
['decimals', beet_1.u32],
|
9
|
+
['vaultBump', beet_1.u32],
|
10
|
+
['mintKey', beet_solana_1.publicKey],
|
11
|
+
['vaultKey', beet_solana_1.publicKey],
|
12
|
+
], (args) => args);
|
13
|
+
exports.marketSizeParamsBeet = new beet_1.BeetStruct([
|
14
|
+
['bidsSize', solana_1.u64],
|
15
|
+
['asksSize', solana_1.u64],
|
16
|
+
['numSeats', solana_1.u64],
|
17
|
+
], (args) => args);
|
18
|
+
exports.marketHeaderStruct = new beet_1.BeetStruct([
|
19
|
+
['discriminant', solana_1.u64],
|
20
|
+
['status', solana_1.u64],
|
21
|
+
['marketSizeParams', exports.marketSizeParamsBeet],
|
22
|
+
['baseParams', exports.tokenParamsStruct],
|
23
|
+
['baseLotSize', solana_1.u64],
|
24
|
+
['quoteParams', exports.tokenParamsStruct],
|
25
|
+
['quoteLotSize', solana_1.u64],
|
26
|
+
['tickSizeInQuoteAtomsPerBaseUnit', solana_1.u64],
|
27
|
+
['authority', beet_solana_1.publicKey],
|
28
|
+
['feeRecipient', beet_solana_1.publicKey],
|
29
|
+
['marketSequenceNumber', solana_1.u64],
|
30
|
+
['successor', beet_solana_1.publicKey],
|
31
|
+
['rawBaseUnitsPerBaseUnit', beet_1.u32],
|
32
|
+
['padding1', beet_1.u32],
|
33
|
+
['padding2', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 32)],
|
34
|
+
], (args) => args);
|
35
|
+
exports.partialMarketHeaderStruct = new beet_1.BeetStruct([
|
36
|
+
['buffer', (0, solana_1.blob)(16)],
|
37
|
+
['marketSizeParams', exports.marketSizeParamsBeet],
|
38
|
+
], (args) => args);
|
39
|
+
//# sourceMappingURL=marketHeader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketHeader.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/phoenix/structs/marketHeader.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,kDAAkD;AASrC,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;AAQW,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;IACjC,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,aAAa,EAAE,yBAAiB,CAAC;IAClC,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,iCAAiC,EAAE,YAAG,CAAC;IACxC,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,cAAc,EAAE,uBAAS,CAAC;IAC3B,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,yBAAyB,EAAE,UAAG,CAAC;IAChC,CAAC,UAAU,EAAE,UAAG,CAAC;IACjB,CAAC,UAAU,EAAE,IAAA,4BAAqB,EAAC,YAAG,EAAE,EAAE,CAAC,CAAC;CAC7C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAA2B,CACtC,CAAC;AAOW,QAAA,yBAAyB,GACpC,IAAI,iBAAU,CACZ;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,EAAE,CAAC,CAAC;IACpB,CAAC,kBAAkB,EAAE,4BAAoB,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAkC,CAC7C,CAAC"}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { BeetArgsStruct, BeetStruct, COption, FixableBeetStruct, bignum } from '@metaplex-foundation/beet';
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
3
|
+
import BigNumber from 'bignumber.js';
|
4
|
+
export type PubkeyWrapper = {
|
5
|
+
publicKey: PublicKey;
|
6
|
+
};
|
7
|
+
export declare const publicKeyBeet: BeetArgsStruct<PubkeyWrapper>;
|
8
|
+
export type TraderState = {
|
9
|
+
quoteLotsLocked: bignum;
|
10
|
+
quoteLotsFree: bignum;
|
11
|
+
baseLotsLocked: bignum;
|
12
|
+
baseLotsFree: bignum;
|
13
|
+
padding: bignum[];
|
14
|
+
};
|
15
|
+
export declare const traderStateBeet: BeetArgsStruct<TraderState>;
|
16
|
+
export type CondensedOrder = {
|
17
|
+
priceInTicks: BigNumber;
|
18
|
+
sizeInBaseLots: BigNumber;
|
19
|
+
lastValidSlot: COption<BigNumber>;
|
20
|
+
lastValidUnixTimestampInSeconds: COption<BigNumber>;
|
21
|
+
};
|
22
|
+
export declare const condensedOrderBeet: FixableBeetStruct<CondensedOrder, Partial<CondensedOrder>>;
|
23
|
+
export declare enum FailedMultipleLimitOrderBehavior {
|
24
|
+
FailOnInsufficientFundsAndAmendOnCross = 0,
|
25
|
+
FailOnInsufficientFundsAndFailOnCross = 1,
|
26
|
+
SkipOnInsufficientFundsAndAmendOnCross = 2,
|
27
|
+
SkipOnInsufficientFundsAndFailOnCross = 3
|
28
|
+
}
|
29
|
+
export type MultipleOrderPacket = {
|
30
|
+
bids: CondensedOrder[];
|
31
|
+
asks: CondensedOrder[];
|
32
|
+
clientOrderId: COption<BigNumber>;
|
33
|
+
failedMultipleLimitOrderBehavior: FailedMultipleLimitOrderBehavior;
|
34
|
+
};
|
35
|
+
export declare const multipleOrderPacketStruct: FixableBeetStruct<MultipleOrderPacket, Partial<MultipleOrderPacket>>;
|
36
|
+
export type OrderId = {
|
37
|
+
priceInTicks: BigNumber;
|
38
|
+
orderSequenceNumber: BigNumber;
|
39
|
+
};
|
40
|
+
export declare const orderIdBeet: BeetArgsStruct<OrderId>;
|
41
|
+
export type RestingOrder = {
|
42
|
+
traderIndex: BigNumber;
|
43
|
+
numBaseLots: BigNumber;
|
44
|
+
lastValidSlot: BigNumber;
|
45
|
+
lastValidUnixTimestampInSeconds: BigNumber;
|
46
|
+
};
|
47
|
+
export declare const restingOrderBeet: BeetStruct<RestingOrder, Partial<RestingOrder>>;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.restingOrderBeet = exports.orderIdBeet = exports.multipleOrderPacketStruct = exports.FailedMultipleLimitOrderBehavior = exports.condensedOrderBeet = exports.traderStateBeet = exports.publicKeyBeet = 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.publicKeyBeet = new beet_1.BeetArgsStruct([['publicKey', beet_solana_1.publicKey]], 'PubkeyWrapper');
|
8
|
+
exports.traderStateBeet = new beet_1.BeetArgsStruct([
|
9
|
+
['quoteLotsLocked', beet_1.u64],
|
10
|
+
['quoteLotsFree', beet_1.u64],
|
11
|
+
['baseLotsLocked', beet_1.u64],
|
12
|
+
['baseLotsFree', beet_1.u64],
|
13
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u64, 8)],
|
14
|
+
], 'TraderState');
|
15
|
+
exports.condensedOrderBeet = new beet_1.FixableBeetStruct([
|
16
|
+
['priceInTicks', solana_1.u64],
|
17
|
+
['sizeInBaseLots', solana_1.u64],
|
18
|
+
['lastValidSlot', (0, beet_1.coption)(solana_1.u64)],
|
19
|
+
['lastValidUnixTimestampInSeconds', (0, beet_1.coption)(solana_1.u64)],
|
20
|
+
], (args) => args);
|
21
|
+
var FailedMultipleLimitOrderBehavior;
|
22
|
+
(function (FailedMultipleLimitOrderBehavior) {
|
23
|
+
FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["FailOnInsufficientFundsAndAmendOnCross"] = 0] = "FailOnInsufficientFundsAndAmendOnCross";
|
24
|
+
FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["FailOnInsufficientFundsAndFailOnCross"] = 1] = "FailOnInsufficientFundsAndFailOnCross";
|
25
|
+
FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["SkipOnInsufficientFundsAndAmendOnCross"] = 2] = "SkipOnInsufficientFundsAndAmendOnCross";
|
26
|
+
FailedMultipleLimitOrderBehavior[FailedMultipleLimitOrderBehavior["SkipOnInsufficientFundsAndFailOnCross"] = 3] = "SkipOnInsufficientFundsAndFailOnCross";
|
27
|
+
})(FailedMultipleLimitOrderBehavior || (exports.FailedMultipleLimitOrderBehavior = FailedMultipleLimitOrderBehavior = {}));
|
28
|
+
exports.multipleOrderPacketStruct = new beet_1.FixableBeetStruct([
|
29
|
+
['bids', (0, beet_1.array)(exports.condensedOrderBeet)],
|
30
|
+
['asks', (0, beet_1.array)(exports.condensedOrderBeet)],
|
31
|
+
['clientOrderId', (0, beet_1.coption)(solana_1.u128)],
|
32
|
+
['failedMultipleLimitOrderBehavior', beet_1.u8],
|
33
|
+
], (args) => args);
|
34
|
+
exports.orderIdBeet = new beet_1.BeetArgsStruct([
|
35
|
+
['priceInTicks', solana_1.u64],
|
36
|
+
['orderSequenceNumber', solana_1.u64],
|
37
|
+
], 'fIFOOrderId');
|
38
|
+
exports.restingOrderBeet = new beet_1.BeetStruct([
|
39
|
+
['traderIndex', solana_1.u64],
|
40
|
+
['numBaseLots', solana_1.u64],
|
41
|
+
['lastValidSlot', solana_1.u64],
|
42
|
+
['lastValidUnixTimestampInSeconds', solana_1.u64],
|
43
|
+
], (args) => args);
|
44
|
+
//# sourceMappingURL=misc.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/phoenix/structs/misc.ts"],"names":[],"mappings":";;;AAAA,oDAWmC;AACnC,kEAA6D;AAG7D,kDAAkD;AAMrC,QAAA,aAAa,GAAG,IAAI,qBAAc,CAC7C,CAAC,CAAC,WAAW,EAAE,uBAAS,CAAC,CAAC,EAC1B,eAAe,CAChB,CAAC;AAUW,QAAA,eAAe,GAAG,IAAI,qBAAc,CAC/C;IACE,CAAC,iBAAiB,EAAE,UAAO,CAAC;IAC5B,CAAC,eAAe,EAAE,UAAO,CAAC;IAC1B,CAAC,gBAAgB,EAAE,UAAO,CAAC;IAC3B,CAAC,cAAc,EAAE,UAAO,CAAC;IACzB,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,UAAO,EAAE,CAAC,CAAC,CAAC;CAC/C,EACD,aAAa,CACd,CAAC;AASW,QAAA,kBAAkB,GAAG,IAAI,wBAAiB,CACrD;IACE,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,eAAe,EAAE,IAAA,cAAO,EAAC,YAAG,CAAC,CAAC;IAC/B,CAAC,iCAAiC,EAAE,IAAA,cAAO,EAAC,YAAG,CAAC,CAAC;CAClD,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC;AAEF,IAAY,gCAKX;AALD,WAAY,gCAAgC;IAC1C,2JAAsC,CAAA;IACtC,yJAAqC,CAAA;IACrC,2JAAsC,CAAA;IACtC,yJAAqC,CAAA;AACvC,CAAC,EALW,gCAAgC,gDAAhC,gCAAgC,QAK3C;AASY,QAAA,yBAAyB,GACpC,IAAI,wBAAiB,CACnB;IACE,CAAC,MAAM,EAAE,IAAA,YAAK,EAAC,0BAAkB,CAAC,CAAC;IACnC,CAAC,MAAM,EAAE,IAAA,YAAK,EAAC,0BAAkB,CAAC,CAAC;IACnC,CAAC,eAAe,EAAE,IAAA,cAAO,EAAC,aAAI,CAAC,CAAC;IAChC,CAAC,kCAAkC,EAAE,SAAE,CAAC;CACzC,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAA2B,CACtC,CAAC;AAOS,QAAA,WAAW,GAAG,IAAI,qBAAc,CAC3C;IACE,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,qBAAqB,EAAE,YAAG,CAAC;CAC7B,EACD,aAAa,CACd,CAAC;AASW,QAAA,gBAAgB,GAAG,IAAI,iBAAU,CAC5C;IACE,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,iCAAiC,EAAE,YAAG,CAAC;CACzC,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAoB,CAC/B,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
2
|
+
import BigNumber from 'bignumber.js';
|
3
|
+
import { PublicKey } from '@solana/web3.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>>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
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
|
+
//# sourceMappingURL=seat.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"seat.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/phoenix/structs/seat.ts"],"names":[],"mappings":";;;AAAA,oDAA8E;AAC9E,kEAA6D;AAG7D,kDAA4C;AAU/B,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"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { MarketHeaderAccount } from './structs/marketHeader';
|
2
|
+
import { OrderId, RestingOrder, TraderState } from './structs/misc';
|
3
|
+
export type MarketHeader = {
|
4
|
+
discriminant: string;
|
5
|
+
status: string;
|
6
|
+
marketSizeParams: {
|
7
|
+
bidsSize: string;
|
8
|
+
asksSize: string;
|
9
|
+
numSeats: string;
|
10
|
+
};
|
11
|
+
baseParams: {
|
12
|
+
decimals: number;
|
13
|
+
vaultBump: number;
|
14
|
+
mintKey: string;
|
15
|
+
vaultKey: string;
|
16
|
+
};
|
17
|
+
baseLotSize: string;
|
18
|
+
quoteParams: {
|
19
|
+
decimals: number;
|
20
|
+
vaultBump: number;
|
21
|
+
mintKey: string;
|
22
|
+
vaultKey: string;
|
23
|
+
};
|
24
|
+
quoteLotSize: string;
|
25
|
+
tickSizeInQuoteAtomsPerBaseUnit: string;
|
26
|
+
authority: string;
|
27
|
+
feeRecipient: string;
|
28
|
+
marketSequenceNumber: string;
|
29
|
+
successor: string;
|
30
|
+
rawBaseUnitsPerBaseUnit: number;
|
31
|
+
};
|
32
|
+
export type Market = {
|
33
|
+
header: MarketHeaderAccount;
|
34
|
+
baseLotsPerBaseUnit: number;
|
35
|
+
quoteLotsPerBaseUnitPerTick: number;
|
36
|
+
orderSequenceNumber: number;
|
37
|
+
takerFeeBps: number;
|
38
|
+
collectedQuoteLotFees: number;
|
39
|
+
unclaimedQuoteLotFees: number;
|
40
|
+
bids: [OrderId, Partial<RestingOrder>][];
|
41
|
+
asks: [OrderId, Partial<RestingOrder>][];
|
42
|
+
traders: Map<string, TraderState>;
|
43
|
+
traderPubkeyToTraderIndex: Map<string, number>;
|
44
|
+
traderIndexToTraderPubkey: Map<number, string>;
|
45
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/types.ts"],"names":[],"mappings":""}
|
@@ -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;
|
@@ -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;
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.getParsedProgramAccounts = void 0;
|
13
|
-
const
|
13
|
+
const getProgramAccounts_1 = require("./getProgramAccounts");
|
14
14
|
function getParsedProgramAccounts(connection, beetStruct, programId, filters = undefined, maxAccounts = -1) {
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
16
|
-
const accountsRes = yield (0,
|
16
|
+
const accountsRes = yield (0, getProgramAccounts_1.getProgramAccounts)(connection, programId, filters, maxAccounts);
|
17
17
|
return accountsRes.map((accountRes) => (Object.assign({ pubkey: accountRes.pubkey, lamports: accountRes.account.lamports }, beetStruct.deserialize(accountRes.account.data)[0])));
|
18
18
|
});
|
19
19
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getParsedProgramAccounts.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getParsedProgramAccounts.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"getParsedProgramAccounts.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getParsedProgramAccounts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,6DAA0D;AAG1D,SAAsB,wBAAwB,CAC5C,UAAsB,EACtB,UAA+B,EAC/B,SAAoB,EACpB,UAAkD,SAAS,EAC3D,WAAW,GAAG,CAAC,CAAC;;QAEhB,MAAM,WAAW,GAAG,MAAM,IAAA,uCAAkB,EAC1C,UAAU,EACV,SAAS,EACT,OAAO,EACP,WAAW,CACZ,CAAC;QACF,OAAO,WAAW,CAAC,GAAG,CACpB,CAAC,UAAU,EAAE,EAAE,CACb,CAAC,gBACC,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,IAClC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACjC,CAAA,CACzB,CAAC;IACJ,CAAC;CAAA;AArBD,4DAqBC"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import { Connection, GetProgramAccountsFilter, PublicKey } from '@solana/web3.js';
|
2
|
+
export declare function getProgramAccounts(connection: Connection, programId: PublicKey, filters?: GetProgramAccountsFilter[], maxAccounts?: number): Promise<import("@solana/web3.js").GetProgramAccountsResponse>;
|
@@ -9,15 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.
|
13
|
-
function
|
12
|
+
exports.getProgramAccounts = void 0;
|
13
|
+
function getProgramAccounts(connection, programId, filters, maxAccounts = 0) {
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
15
15
|
const config = {
|
16
16
|
commitment: 'confirmed',
|
17
17
|
encoding: 'base64',
|
18
18
|
filters,
|
19
19
|
};
|
20
|
-
if (maxAccounts
|
20
|
+
if (maxAccounts <= 0)
|
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)
|
@@ -25,5 +25,5 @@ function getProgramAccountsSafe(connection, maxAccounts, programId, filters = un
|
|
25
25
|
return connection.getProgramAccounts(programId, config);
|
26
26
|
});
|
27
27
|
}
|
28
|
-
exports.
|
29
|
-
//# sourceMappingURL=
|
28
|
+
exports.getProgramAccounts = getProgramAccounts;
|
29
|
+
//# sourceMappingURL=getProgramAccounts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getProgramAccounts.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getProgramAccounts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,SAAsB,kBAAkB,CACtC,UAAsB,EACtB,SAAoB,EACpB,OAAoC,EACpC,WAAW,GAAG,CAAC;;QAEf,MAAM,MAAM,GAA6B;YACvC,UAAU,EAAE,WAAW;YACvB,QAAQ,EAAE,QAAQ;YAClB,OAAO;SACR,CAAC;QAEF,IAAI,WAAW,IAAI,CAAC;YAAE,OAAO,UAAU,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE9E,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,gDAsBC"}
|
@@ -3,7 +3,7 @@ export * from './beets/numbers';
|
|
3
3
|
export * from './constants';
|
4
4
|
export * from './getParsedProgramAccounts';
|
5
5
|
export * from './getParsedMultipleAccountsInfo';
|
6
|
-
export * from './
|
6
|
+
export * from './getProgramAccounts';
|
7
7
|
export * from './getTokenAccountsByOwner';
|
8
8
|
export * from './u8ArrayToString';
|
9
9
|
export * from './structs';
|
@@ -19,7 +19,7 @@ __exportStar(require("./beets/numbers"), exports);
|
|
19
19
|
__exportStar(require("./constants"), exports);
|
20
20
|
__exportStar(require("./getParsedProgramAccounts"), exports);
|
21
21
|
__exportStar(require("./getParsedMultipleAccountsInfo"), exports);
|
22
|
-
__exportStar(require("./
|
22
|
+
__exportStar(require("./getProgramAccounts"), exports);
|
23
23
|
__exportStar(require("./getTokenAccountsByOwner"), exports);
|
24
24
|
__exportStar(require("./u8ArrayToString"), exports);
|
25
25
|
__exportStar(require("./structs"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,6DAA2C;AAC3C,kEAAgD;AAChD,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,6DAA2C;AAC3C,kEAAgD;AAChD,uDAAqC;AACrC,4DAA0C;AAC1C,oDAAkC;AAClC,4CAA0B;AAC1B,0CAAwB"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
import { Connection, GetProgramAccountsFilter, PublicKey } from '@solana/web3.js';
|
2
|
-
export declare function getProgramAccountsSafe(connection: Connection, maxAccounts: number, programId: PublicKey, filters?: GetProgramAccountsFilter[] | undefined): Promise<import("@solana/web3.js").GetProgramAccountsResponse>;
|
@@ -1 +0,0 @@
|
|
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"}
|