@sonarwatch/portfolio-plugins 0.14.132 → 0.14.133
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 +4 -0
- package/package.json +1 -1
- package/src/plugins/citrus/loansFetcher.js +34 -68
- package/src/plugins/citrus/loansFetcher.js.map +1 -1
- package/src/plugins/debridge/dlmmVaultsFetcher.js +1 -0
- package/src/plugins/debridge/dlmmVaultsFetcher.js.map +1 -1
- package/src/plugins/jupiter/exchange/valueAverageFetcher.js +1 -1
- package/src/plugins/jupiter/exchange/valueAverageFetcher.js.map +1 -1
- package/src/plugins/rain/banksFetcher.js +47 -0
- package/src/plugins/rain/banksFetcher.js.map +1 -0
- package/src/plugins/rain/collectionsJob.js +9 -7
- package/src/plugins/rain/collectionsJob.js.map +1 -1
- package/src/plugins/rain/constants.d.ts +7 -2
- package/src/plugins/rain/constants.js +11 -3
- package/src/plugins/rain/constants.js.map +1 -1
- package/src/plugins/rain/defiBorrowsFetcher.d.ts +3 -0
- package/src/plugins/rain/defiBorrowsFetcher.js +52 -0
- package/src/plugins/rain/defiBorrowsFetcher.js.map +1 -0
- package/src/plugins/rain/index.js +10 -3
- package/src/plugins/rain/index.js.map +1 -1
- package/src/plugins/rain/nftBorrowsFetcher.d.ts +3 -0
- package/src/plugins/rain/nftBorrowsFetcher.js +76 -0
- package/src/plugins/rain/nftBorrowsFetcher.js.map +1 -0
- package/src/plugins/rain/poolsFetcher.js +79 -42
- package/src/plugins/rain/poolsFetcher.js.map +1 -1
- package/src/plugins/rain/structs.d.ts +455 -0
- package/src/plugins/rain/structs.js +425 -0
- package/src/plugins/rain/structs.js.map +1 -0
- package/src/plugins/rain/types.d.ts +18 -144
- package/src/plugins/sharky/loansFetcher.js +38 -73
- package/src/plugins/sharky/loansFetcher.js.map +1 -1
- package/src/utils/elementbuilder/AssetCollectibleBuilder.d.ts +10 -0
- package/src/utils/elementbuilder/AssetCollectibleBuilder.js +53 -0
- package/src/utils/elementbuilder/AssetCollectibleBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.d.ts +9 -1
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +41 -3
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -1
- package/src/utils/elementbuilder/ElementRegistry.js +9 -1
- package/src/utils/elementbuilder/ElementRegistry.js.map +1 -1
- package/src/utils/elementbuilder/Params.d.ts +14 -0
- package/src/utils/solana/das/heliusAssetToAssetCollectible.js +3 -2
- package/src/utils/solana/das/heliusAssetToAssetCollectible.js.map +1 -1
- package/src/plugins/rain/filters.d.ts +0 -7
- package/src/plugins/rain/filters.js +0 -53
- package/src/plugins/rain/filters.js.map +0 -1
- package/src/plugins/rain/helpers.d.ts +0 -9
- package/src/plugins/rain/helpers.js +0 -66
- package/src/plugins/rain/helpers.js.map +0 -1
- package/src/plugins/rain/loansFetcher.js +0 -139
- package/src/plugins/rain/loansFetcher.js.map +0 -1
- package/src/plugins/rain/structs/loan.d.ts +0 -86
- package/src/plugins/rain/structs/loan.js +0 -86
- package/src/plugins/rain/structs/loan.js.map +0 -1
- package/src/plugins/rain/structs/pool.d.ts +0 -79
- package/src/plugins/rain/structs/pool.js +0 -76
- package/src/plugins/rain/structs/pool.js.map +0 -1
- /package/src/plugins/rain/{loansFetcher.d.ts → banksFetcher.d.ts} +0 -0
@@ -17,19 +17,15 @@ 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 solana_1 = require("../../utils/solana");
|
20
|
-
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
-
const getAssetBatchDas_1 = require("../../utils/solana/das/getAssetBatchDas");
|
22
|
-
const getSolanaDasEndpoint_1 = __importDefault(require("../../utils/clients/getSolanaDasEndpoint"));
|
23
|
-
const heliusAssetToAssetCollectible_1 = require("../../utils/solana/das/heliusAssetToAssetCollectible");
|
24
20
|
const filters_1 = require("./filters");
|
25
21
|
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
26
22
|
const arrayToMap_1 = require("../../utils/misc/arrayToMap");
|
23
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
27
24
|
const collectionsMemo = new MemoizedCache_1.MemoizedCache(constants_1.collectionsCacheKey, {
|
28
25
|
prefix: constants_1.cachePrefix,
|
29
26
|
networkId: portfolio_core_1.NetworkId.solana,
|
30
27
|
}, (arr) => (0, arrayToMap_1.arrayToMap)(arr || [], 'orderBook'));
|
31
28
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
32
|
-
const dasUrl = (0, getSolanaDasEndpoint_1.default)();
|
33
29
|
const connection = (0, clients_1.getClientSolana)();
|
34
30
|
const [filterA, filterB, filterC] = (0, filters_1.getLoanFilters)(owner);
|
35
31
|
const accounts = (yield Promise.all([
|
@@ -39,104 +35,73 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
39
35
|
])).flat();
|
40
36
|
if (accounts.length === 0)
|
41
37
|
return [];
|
42
|
-
const [solTokenPrice,
|
38
|
+
const [solTokenPrice, collections] = yield Promise.all([
|
43
39
|
cache.getTokenPrice(portfolio_core_1.solanaNativeAddress, portfolio_core_1.NetworkId.solana),
|
44
|
-
(0, getAssetBatchDas_1.getAssetBatchDasAsMap)(dasUrl, accounts
|
45
|
-
.map((acc) => { var _a; return (_a = acc.loanState.taken) === null || _a === void 0 ? void 0 : _a.taken.nftCollateralMint; })
|
46
|
-
.filter((mint) => mint)),
|
47
40
|
collectionsMemo.getItem(cache),
|
48
41
|
]);
|
49
|
-
if (!
|
50
|
-
|
51
|
-
|
42
|
+
if (!collections)
|
43
|
+
throw new Error('Collections not cached');
|
44
|
+
if (!solTokenPrice)
|
45
|
+
throw new Error('Sol price not cached');
|
46
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
52
47
|
accounts.forEach((acc) => {
|
53
48
|
var _a;
|
54
49
|
const collection = collections.get(acc.orderBook);
|
55
50
|
if (!collection)
|
56
51
|
return;
|
57
|
-
const
|
58
|
-
|
52
|
+
const element = elementRegistry.addElementBorrowlend({
|
53
|
+
label: 'Lending',
|
54
|
+
});
|
59
55
|
let mintAsset = null;
|
60
56
|
if ((_a = acc.loanState.taken) === null || _a === void 0 ? void 0 : _a.taken.nftCollateralMint) {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
.
|
65
|
-
.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
name: collection.name,
|
70
|
-
floorPrice: assetValue,
|
71
|
-
},
|
72
|
-
});
|
73
|
-
}
|
57
|
+
mintAsset = {
|
58
|
+
address: acc.loanState.taken.taken.nftCollateralMint,
|
59
|
+
collection: {
|
60
|
+
name: collection.name,
|
61
|
+
floorPrice: new bignumber_js_1.default(collection.floor).multipliedBy(solTokenPrice.price),
|
62
|
+
},
|
63
|
+
attributes: { tags: [portfolio_core_1.collectibleFreezedTag] },
|
64
|
+
};
|
74
65
|
}
|
75
|
-
const solAsset =
|
76
|
-
|
77
|
-
|
66
|
+
const solAsset = {
|
67
|
+
address: portfolio_core_1.solanaNativeAddress,
|
68
|
+
amount: acc.principalLamports,
|
69
|
+
};
|
78
70
|
let name;
|
79
71
|
if (acc.loanState.offer) {
|
80
72
|
// LENDER
|
81
|
-
|
73
|
+
element.addSuppliedAsset(solAsset);
|
82
74
|
name = `Lend Offer on ${collection.name}`;
|
83
75
|
}
|
84
76
|
else if (acc.loanState.taken) {
|
85
77
|
if (acc.loanState.taken.taken.lenderNoteMint === owner.toString()) {
|
86
78
|
// LENDER
|
87
|
-
|
79
|
+
element.addSuppliedAsset(solAsset);
|
88
80
|
if (mintAsset)
|
89
|
-
|
81
|
+
element.addBorrowedCollectibleAsset(mintAsset);
|
90
82
|
name = `Active Loan`;
|
91
83
|
}
|
92
84
|
else {
|
93
85
|
// BORROWER
|
94
86
|
if (mintAsset) {
|
95
|
-
|
87
|
+
element.addSuppliedCollectibleAsset(mintAsset);
|
96
88
|
}
|
97
|
-
|
89
|
+
element.addBorrowedAsset(solAsset);
|
98
90
|
name = `Active Loan`;
|
99
91
|
}
|
100
92
|
}
|
101
|
-
if (
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
(acc.loanState.taken
|
109
|
-
|
110
|
-
|
111
|
-
});
|
112
|
-
elements.push({
|
113
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
114
|
-
label: 'Lending',
|
115
|
-
platformId: constants_1.platformId,
|
116
|
-
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
117
|
-
value,
|
118
|
-
name,
|
119
|
-
data: {
|
120
|
-
borrowedAssets,
|
121
|
-
borrowedValue,
|
122
|
-
borrowedYields: [],
|
123
|
-
suppliedAssets,
|
124
|
-
suppliedValue,
|
125
|
-
suppliedYields: [],
|
126
|
-
rewardAssets: [],
|
127
|
-
rewardValue,
|
128
|
-
healthRatio: null,
|
129
|
-
value,
|
130
|
-
ref: acc.pubkey.toString(),
|
131
|
-
expireOn: acc.loanState.taken
|
132
|
-
? (Number(acc.loanState.taken.taken.terms.time.start) +
|
133
|
-
Number(acc.loanState.taken.taken.terms.time.duration)) *
|
134
|
-
1000
|
135
|
-
: undefined,
|
136
|
-
},
|
137
|
-
});
|
93
|
+
if (name)
|
94
|
+
element.setName(name);
|
95
|
+
element.setFixedTerms(acc.loanState.offer !== undefined ||
|
96
|
+
(acc.loanState.taken
|
97
|
+
? acc.loanState.taken.taken.lenderNoteMint === owner.toString()
|
98
|
+
: false), acc.loanState.taken
|
99
|
+
? (Number(acc.loanState.taken.taken.terms.time.start) +
|
100
|
+
Number(acc.loanState.taken.taken.terms.time.duration)) *
|
101
|
+
1000
|
102
|
+
: undefined);
|
138
103
|
});
|
139
|
-
return
|
104
|
+
return elementRegistry.getElements(cache);
|
140
105
|
});
|
141
106
|
const fetcher = {
|
142
107
|
id: `${constants_1.platformId}-loans`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sharky/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sharky/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAErC,2CAKqB;AAErB,iDAAsD;AACtD,+CAG4B;AAE5B,uCAA2C;AAC3C,kEAA+D;AAC/D,4DAAyD;AACzD,gFAA6E;AAG7E,MAAM,eAAe,GAAG,IAAI,6BAAa,CAIvC,+BAAmB,EACnB;IACE,MAAM,EAAE,uBAAW;IACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,IAAI,EAAE,EAAE,WAAW,CAAC,CAC5C,CAAC;AAEF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,IAAA,wBAAc,EAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,CACf,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,qCAA4B,EAAO,UAAU,EAAE,yBAAa,EAAE,OAAO,CAAC;QACtE,IAAA,qCAA4B,EAAO,UAAU,EAAE,yBAAa,EAAE,OAAO,CAAC;QACtE,IAAA,qCAA4B,EAAO,UAAU,EAAE,yBAAa,EAAE,OAAO,CAAC;KACvE,CAAC,CACH,CAAC,IAAI,EAAE,CAAC;IACT,IAAI,QAAQ,CAAC,MAAM,KAA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AAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;gBACjD,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtD,IAAI;YACR,CAAC,CAAC,SAAS,CACd,CAAC;IACJ,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,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { NetworkIdType, PortfolioAssetCollectible } from '@sonarwatch/portfolio-core';
|
2
|
+
import { TokenPriceMap } from '../../TokenPriceMap';
|
3
|
+
import { AssetBuilder } from './AssetBuilder';
|
4
|
+
import { PortfolioAssetCollectibleParams } from './Params';
|
5
|
+
export declare class AssetCollectibleBuilder extends AssetBuilder {
|
6
|
+
params: PortfolioAssetCollectibleParams;
|
7
|
+
constructor(params: PortfolioAssetCollectibleParams);
|
8
|
+
tokenAddresses(): string[];
|
9
|
+
get(networkId: NetworkIdType, tokenPrices: TokenPriceMap): PortfolioAssetCollectible | null;
|
10
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.AssetCollectibleBuilder = void 0;
|
7
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
9
|
+
const AssetBuilder_1 = require("./AssetBuilder");
|
10
|
+
class AssetCollectibleBuilder extends AssetBuilder_1.AssetBuilder {
|
11
|
+
constructor(params) {
|
12
|
+
super();
|
13
|
+
this.params = params;
|
14
|
+
}
|
15
|
+
// eslint-disable-next-line class-methods-use-this
|
16
|
+
tokenAddresses() {
|
17
|
+
return [];
|
18
|
+
}
|
19
|
+
get(networkId,
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
21
|
+
tokenPrices) {
|
22
|
+
var _a;
|
23
|
+
return {
|
24
|
+
type: portfolio_core_1.PortfolioAssetType.collectible,
|
25
|
+
networkId,
|
26
|
+
value: new bignumber_js_1.default(this.params.collection.floorPrice)
|
27
|
+
.multipliedBy(new bignumber_js_1.default(this.params.amount || 1))
|
28
|
+
.toNumber(),
|
29
|
+
name: this.params.name || this.params.collection.name,
|
30
|
+
data: {
|
31
|
+
address: this.params.address.toString(),
|
32
|
+
amount: new bignumber_js_1.default(this.params.amount || 1).toNumber(),
|
33
|
+
price: new bignumber_js_1.default(this.params.collection.floorPrice).toNumber(),
|
34
|
+
name: this.params.name || this.params.collection.name,
|
35
|
+
imageUri: this.params.collection.imageUri,
|
36
|
+
/* dataUri: asset.content.json_uri,
|
37
|
+
attributes: asset.content.metadata.attributes, */
|
38
|
+
collection: {
|
39
|
+
name: this.params.collection.name,
|
40
|
+
floorPrice: new bignumber_js_1.default(this.params.collection.floorPrice).toNumber(),
|
41
|
+
},
|
42
|
+
},
|
43
|
+
imageUri: this.params.collection.imageUri,
|
44
|
+
attributes: this.params.attributes || {},
|
45
|
+
link: this.params.link ||
|
46
|
+
`https://www.tensor.trade/item/${this.params.address}`,
|
47
|
+
sourceRefs: this.params.sourceRefs,
|
48
|
+
ref: (_a = this.params.ref) === null || _a === void 0 ? void 0 : _a.toString(),
|
49
|
+
};
|
50
|
+
}
|
51
|
+
}
|
52
|
+
exports.AssetCollectibleBuilder = AssetCollectibleBuilder;
|
53
|
+
//# sourceMappingURL=AssetCollectibleBuilder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AssetCollectibleBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/AssetCollectibleBuilder.ts"],"names":[],"mappings":";;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAErC,iDAA8C;AAG9C,MAAa,uBAAwB,SAAQ,2BAAY;IAGvD,YAAY,MAAuC;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,kDAAkD;IAClD,cAAc;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,GAAG,CACD,SAAwB;IACxB,6DAA6D;IAC7D,WAA0B;;QAE1B,OAAO;YACL,IAAI,EAAE,mCAAkB,CAAC,WAAW;YACpC,SAAS;YACT,KAAK,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;iBACpD,YAAY,CAAC,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;iBACpD,QAAQ,EAAE;YACb,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI;YACrD,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACvC,MAAM,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE;gBACzD,KAAK,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;gBAClE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI;gBACrD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ;gBACzC;iEACiD;gBACjD,UAAU,EAAE;oBACV,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI;oBACjC,UAAU,EAAE,IAAI,sBAAS,CACvB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAClC,CAAC,QAAQ,EAAE;iBACb;aACF;YACD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ;YACzC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE;YACxC,IAAI,EACF,IAAI,CAAC,MAAM,CAAC,IAAI;gBAChB,iCAAiC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACxD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;YAClC,GAAG,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,GAAG,0CAAE,QAAQ,EAAE;SACjC,CAAC;IACJ,CAAC;CACF;AAjDD,0DAiDC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { NetworkIdType, PortfolioElementBorrowLend, Yield } from '@sonarwatch/portfolio-core';
|
2
|
+
import BigNumber from 'bignumber.js';
|
2
3
|
import { ElementBuilder } from './ElementBuilder';
|
3
|
-
import { Params, PortfolioAssetGenericParams, PortfolioAssetTokenParams } from './Params';
|
4
|
+
import { Params, PortfolioAssetCollectibleParams, PortfolioAssetGenericParams, PortfolioAssetTokenParams } from './Params';
|
4
5
|
import { TokenPriceMap } from '../../TokenPriceMap';
|
5
6
|
import { AssetBuilder } from './AssetBuilder';
|
6
7
|
import { AssetGenericBuilder } from './AssetGenericBuilder';
|
@@ -13,11 +14,17 @@ export declare class ElementBorrowlendBuilder extends ElementBuilder {
|
|
13
14
|
suppliedYields: Yield[][];
|
14
15
|
suppliedLtvs: number[];
|
15
16
|
borrowedWeights: number[];
|
17
|
+
fixedTerms?: {
|
18
|
+
expireOn?: number;
|
19
|
+
isLender: boolean;
|
20
|
+
};
|
16
21
|
constructor(params: Params);
|
17
22
|
addBorrowedAsset(params: PortfolioAssetTokenParams): void;
|
18
23
|
addBorrowedGenericAsset(params: PortfolioAssetGenericParams): void;
|
24
|
+
addBorrowedCollectibleAsset(params: PortfolioAssetCollectibleParams): void;
|
19
25
|
addSuppliedAsset(params: PortfolioAssetTokenParams): void;
|
20
26
|
addSuppliedGenericAsset(params: PortfolioAssetGenericParams): void;
|
27
|
+
addSuppliedCollectibleAsset(params: PortfolioAssetCollectibleParams): void;
|
21
28
|
addRewardAsset(params: PortfolioAssetTokenParams): void;
|
22
29
|
addRewardGenericAsset(params: PortfolioAssetGenericParams): void;
|
23
30
|
addUnsettledGenericAsset(params: PortfolioAssetGenericParams): void;
|
@@ -25,6 +32,7 @@ export declare class ElementBorrowlendBuilder extends ElementBuilder {
|
|
25
32
|
addSuppliedYield(ayield: Yield[]): void;
|
26
33
|
addSuppliedLtv(ltv: number): void;
|
27
34
|
addBorrowedWeight(borrowedWeight: number): void;
|
35
|
+
setFixedTerms(isLender: boolean, expireOn?: number | BigNumber): void;
|
28
36
|
tokenAddresses(): string[];
|
29
37
|
get(networkId: NetworkIdType, platformId: string, tokenPrices: TokenPriceMap): PortfolioElementBorrowLend | null;
|
30
38
|
}
|
@@ -1,10 +1,15 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.ElementBorrowlendBuilder = void 0;
|
4
7
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
5
9
|
const ElementBuilder_1 = require("./ElementBuilder");
|
6
10
|
const AssetTokenBuilder_1 = require("./AssetTokenBuilder");
|
7
11
|
const AssetGenericBuilder_1 = require("./AssetGenericBuilder");
|
12
|
+
const AssetCollectibleBuilder_1 = require("./AssetCollectibleBuilder");
|
8
13
|
class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
|
9
14
|
constructor(params) {
|
10
15
|
super(params);
|
@@ -23,12 +28,18 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
|
|
23
28
|
addBorrowedGenericAsset(params) {
|
24
29
|
this.borrowedAssets.push(new AssetGenericBuilder_1.AssetGenericBuilder(params));
|
25
30
|
}
|
31
|
+
addBorrowedCollectibleAsset(params) {
|
32
|
+
this.borrowedAssets.push(new AssetCollectibleBuilder_1.AssetCollectibleBuilder(params));
|
33
|
+
}
|
26
34
|
addSuppliedAsset(params) {
|
27
35
|
this.suppliedAssets.push(new AssetTokenBuilder_1.AssetTokenBuilder(params));
|
28
36
|
}
|
29
37
|
addSuppliedGenericAsset(params) {
|
30
38
|
this.suppliedAssets.push(new AssetGenericBuilder_1.AssetGenericBuilder(params));
|
31
39
|
}
|
40
|
+
addSuppliedCollectibleAsset(params) {
|
41
|
+
this.suppliedAssets.push(new AssetCollectibleBuilder_1.AssetCollectibleBuilder(params));
|
42
|
+
}
|
32
43
|
addRewardAsset(params) {
|
33
44
|
this.rewardAssets.push(new AssetTokenBuilder_1.AssetTokenBuilder(params));
|
34
45
|
}
|
@@ -50,6 +61,12 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
|
|
50
61
|
addBorrowedWeight(borrowedWeight) {
|
51
62
|
this.borrowedWeights.push(borrowedWeight);
|
52
63
|
}
|
64
|
+
setFixedTerms(isLender, expireOn) {
|
65
|
+
this.fixedTerms = {
|
66
|
+
expireOn: expireOn ? new bignumber_js_1.default(expireOn).toNumber() : undefined,
|
67
|
+
isLender,
|
68
|
+
};
|
69
|
+
}
|
53
70
|
tokenAddresses() {
|
54
71
|
return [
|
55
72
|
...this.borrowedAssets.map((a) => a.tokenAddresses()),
|
@@ -59,7 +76,7 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
|
|
59
76
|
].flat();
|
60
77
|
}
|
61
78
|
get(networkId, platformId, tokenPrices) {
|
62
|
-
var _a;
|
79
|
+
var _a, _b;
|
63
80
|
const suppliedAssets = this.suppliedAssets
|
64
81
|
.map((sAB, i) => {
|
65
82
|
const sA = sAB.get(networkId, tokenPrices);
|
@@ -102,6 +119,26 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
|
|
102
119
|
: undefined,
|
103
120
|
unsettledAssets,
|
104
121
|
});
|
122
|
+
let fixedTermsValue = 0;
|
123
|
+
if (this.fixedTerms) {
|
124
|
+
// Total value
|
125
|
+
if (borrowedValue === null || borrowedValue === 0) {
|
126
|
+
// it's an offer
|
127
|
+
fixedTermsValue = suppliedValue;
|
128
|
+
}
|
129
|
+
else if (suppliedValue !== null && suppliedValue !== 0) {
|
130
|
+
if (this.fixedTerms.isLender) {
|
131
|
+
// supplied sol, nft as collat
|
132
|
+
fixedTermsValue = Math.min(suppliedValue, borrowedValue);
|
133
|
+
}
|
134
|
+
else {
|
135
|
+
// supplied nft as collat, borrow sol
|
136
|
+
fixedTermsValue = Math.max(suppliedValue - borrowedValue, 0);
|
137
|
+
}
|
138
|
+
}
|
139
|
+
if (rewardValue !== null && value !== null)
|
140
|
+
fixedTermsValue = (fixedTermsValue || 0) + rewardValue;
|
141
|
+
}
|
105
142
|
if (!suppliedValue && !borrowedValue && !rewardValue)
|
106
143
|
return null;
|
107
144
|
return {
|
@@ -123,12 +160,13 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
|
|
123
160
|
assets: unsettledAssets,
|
124
161
|
value: unsettledValue,
|
125
162
|
},
|
126
|
-
value,
|
163
|
+
value: this.fixedTerms ? fixedTermsValue : value,
|
127
164
|
ref: (_a = this.ref) === null || _a === void 0 ? void 0 : _a.toString(),
|
128
165
|
sourceRefs: this.sourceRefs,
|
129
166
|
link: this.link,
|
167
|
+
expireOn: (_b = this.fixedTerms) === null || _b === void 0 ? void 0 : _b.expireOn,
|
130
168
|
},
|
131
|
-
value,
|
169
|
+
value: this.fixedTerms ? fixedTermsValue : value,
|
132
170
|
name: this.name,
|
133
171
|
tags: this.tags,
|
134
172
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ElementBorrowlendBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementBorrowlendBuilder.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"ElementBorrowlendBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementBorrowlendBuilder.ts"],"names":[],"mappings":";;;;;;AAAA,+DASoC;AACpC,gEAAqC;AACrC,qDAAkD;AASlD,2DAAwD;AACxD,+DAA4D;AAC5D,uEAAoE;AAEpE,MAAa,wBAAyB,SAAQ,+BAAc;IAc1D,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED,gBAAgB,CAAC,MAAiC;QAChD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,qCAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,uBAAuB,CAAC,MAAmC;QACzD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,yCAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,2BAA2B,CAAC,MAAuC;QACjE,IAAI,CAAC,cAAc,CAAC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EAAE,IAAI,CAAC,KAAK;YACjB,SAAS;YACT,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,UAAU;YACzC,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,cAAc;gBACd,aAAa;gBACb,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,YAAY;gBACZ,WAAW;gBACX,WAAW;gBACX,SAAS,EAAE;oBACT,MAAM,EAAE,eAAe;oBACvB,KAAK,EAAE,cAAc;iBACtB;gBACD,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK;gBAChD,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,0CAAE,QAAQ,EAAE;gBACzB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,QAAQ;aACpC;YACD,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK;YAChD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AAjND,4DAiNC"}
|
@@ -59,7 +59,15 @@ class ElementRegistry {
|
|
59
59
|
const tokenPrices = yield cache.getTokenPricesAsMap(mints, this.networkId);
|
60
60
|
return this.elements
|
61
61
|
.map((e) => e.get(this.networkId, this.platformId, tokenPrices))
|
62
|
-
.filter((e) => e !== null
|
62
|
+
.filter((e) => e !== null)
|
63
|
+
.filter((e) => {
|
64
|
+
if (e &&
|
65
|
+
e.type === portfolio_core_1.PortfolioElementType.borrowlend &&
|
66
|
+
e.data.expireOn) {
|
67
|
+
return true;
|
68
|
+
}
|
69
|
+
return e && e.value && e.value > 0;
|
70
|
+
});
|
63
71
|
});
|
64
72
|
}
|
65
73
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ElementRegistry.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementRegistry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAKoC;AAIpC,qEAAkE;AAClE,uEAAoE;AACpE,yEAAsE;AACtE,qEAAkE;AAClE,+FAA4F;AAC5F,+DAA4D;AAE5D,MAAa,eAAe;IAK1B,YAAY,SAAwB,EAAE,UAAkB;QACtD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,kBAAkB,CAAC,MAA4B;QAC7C,MAAM,cAAc,GAAG,IAAI,+CAAsB,iCAC5C,MAAM,KACT,IAAI,EAAE,qCAAoB,CAAC,QAAQ,IACnC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,mBAAmB,CAAC,MAA4B;QAC9C,MAAM,cAAc,GAAG,IAAI,iDAAuB,iCAC7C,MAAM,KACT,IAAI,EAAE,qCAAoB,CAAC,SAAS,IACpC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,+BAA+B,CAC7B,aAEC;QAED,MAAM,cAAc,GAAG,IAAI,yEAAmC,iCACzD,aAAa,KAChB,IAAI,EAAE,qCAAoB,CAAC,SAAS,EACpC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,KAAI,EAAE,CAAC,EAAE,cAAc,CAAC,EACtD,KAAK,EAAE,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,KAAI,eAAe,IAC9C,CAAC;QACH,IAAI,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version":3,"file":"ElementRegistry.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementRegistry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAKoC;AAIpC,qEAAkE;AAClE,uEAAoE;AACpE,yEAAsE;AACtE,qEAAkE;AAClE,+FAA4F;AAC5F,+DAA4D;AAE5D,MAAa,eAAe;IAK1B,YAAY,SAAwB,EAAE,UAAkB;QACtD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,kBAAkB,CAAC,MAA4B;QAC7C,MAAM,cAAc,GAAG,IAAI,+CAAsB,iCAC5C,MAAM,KACT,IAAI,EAAE,qCAAoB,CAAC,QAAQ,IACnC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,mBAAmB,CAAC,MAA4B;QAC9C,MAAM,cAAc,GAAG,IAAI,iDAAuB,iCAC7C,MAAM,KACT,IAAI,EAAE,qCAAoB,CAAC,SAAS,IACpC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,+BAA+B,CAC7B,aAEC;QAED,MAAM,cAAc,GAAG,IAAI,yEAAmC,iCACzD,aAAa,KAChB,IAAI,EAAE,qCAAoB,CAAC,SAAS,EACpC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,KAAI,EAAE,CAAC,EAAE,cAAc,CAAC,EACtD,KAAK,EAAE,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,KAAI,eAAe,IAC9C,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,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AK,IAAI,CAAC;iBACzB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;gBACZ,IACE,CAAC;oBACD,CAAC,CAAC,IAAI,KAAK,qCAAoB,CAAC,UAAU;oBAC1C,CAAC,CAAC,IAAI,CAAC,QAAQ,EACf,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;YACrC,CAAC,CAAuB,CAAC;QAC7B,CAAC;KAAA;CACF;AAzFD,0CAyFC"}
|
@@ -47,6 +47,20 @@ export type PortfolioAssetGenericParams = {
|
|
47
47
|
ref?: string | PublicKey;
|
48
48
|
link?: string;
|
49
49
|
};
|
50
|
+
export type PortfolioAssetCollectibleParams = {
|
51
|
+
address: string | PublicKey;
|
52
|
+
amount?: number | BigNumber | string;
|
53
|
+
collection: {
|
54
|
+
name: string;
|
55
|
+
floorPrice: number | BigNumber | string;
|
56
|
+
imageUri?: string;
|
57
|
+
};
|
58
|
+
attributes?: PortfolioAssetAttributes;
|
59
|
+
name?: string;
|
60
|
+
sourceRefs?: SourceRef[];
|
61
|
+
ref?: string | PublicKey;
|
62
|
+
link?: string;
|
63
|
+
};
|
50
64
|
export type PortfolioAssetTokenParams = {
|
51
65
|
address: string | PublicKey;
|
52
66
|
amount: number | BigNumber | string;
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.heliusAssetToAssetCollectible = void 0;
|
4
4
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
5
5
|
function heliusAssetToAssetCollectible(asset, props) {
|
6
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
7
7
|
// Tags
|
8
8
|
const tags = [];
|
9
9
|
if (asset.compression.compressed)
|
@@ -71,7 +71,8 @@ function heliusAssetToAssetCollectible(asset, props) {
|
|
71
71
|
collection,
|
72
72
|
},
|
73
73
|
networkId: portfolio_core_1.NetworkId.solana,
|
74
|
-
|
74
|
+
imageUri: (_o = asset.content.links) === null || _o === void 0 ? void 0 : _o.image,
|
75
|
+
value: (_q = (_p = props === null || props === void 0 ? void 0 : props.collection) === null || _p === void 0 ? void 0 : _p.floorPrice) !== null && _q !== void 0 ? _q : null,
|
75
76
|
};
|
76
77
|
}
|
77
78
|
exports.heliusAssetToAssetCollectible = heliusAssetToAssetCollectible;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;AAGpC,SAAgB,6BAA6B,CAC3C,KAAkB,EAClB,KAGC;;IAED,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEhD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,UAA6C,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,QAAQ,CAAC;IAC5C,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,OAAO,CAAC;IAC1C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE1D,SAAS;IACT,IAAI,OAAO,IAAI,OAA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L,IAAI,EAAE,mCAAkB,CAAC,WAAW;QACpC,UAAU,EAAE;YACV,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;SAClC;QACD,IAAI,EACF,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;aAC3B,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAA;aAChB,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,CAAA;QACzB,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,MAAM;YACN,KAAK,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,UAAU,mCAAI,IAAI;YAC5C,IAAI,EACF,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;iBAC3B,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAA;iBAChB,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,CAAA;YACzB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YAC/B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;YACpC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU;YAC7C,UAAU;SACX;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,UAAU,mCAAI,IAAI;KAC7C,CAAC;AACJ,CAAC;
|
1
|
+
{"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;AAGpC,SAAgB,6BAA6B,CAC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AK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;iBAC3B,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAA;iBAChB,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,CAAA;YACzB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YAC/B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;YACpC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU;YAC7C,UAAU;SACX;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;QACpC,KAAK,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,UAAU,mCAAI,IAAI;KAC7C,CAAC;AACJ,CAAC;AAlFD,sEAkFC"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
2
|
-
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
3
|
-
import { GetProgramAccountsFilter } from '@solana/web3.js';
|
4
|
-
export declare const poolFilter: (owner: string) => GetProgramAccountsFilter[];
|
5
|
-
export declare const loanBorrowerFilter: (owner: string) => GetProgramAccountsFilter[];
|
6
|
-
export declare const loanLenderFilter: (owner: string) => GetProgramAccountsFilter[];
|
7
|
-
export declare const assetFilters: (owner: string) => GetProgramAccountsFilter[];
|
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.assetFilters = exports.loanLenderFilter = exports.loanBorrowerFilter = exports.poolFilter = void 0;
|
4
|
-
const loan_1 = require("./structs/loan");
|
5
|
-
const poolFilter = (owner) => [
|
6
|
-
{
|
7
|
-
memcmp: {
|
8
|
-
offset: 9,
|
9
|
-
bytes: owner,
|
10
|
-
},
|
11
|
-
},
|
12
|
-
{
|
13
|
-
dataSize: 1331,
|
14
|
-
},
|
15
|
-
];
|
16
|
-
exports.poolFilter = poolFilter;
|
17
|
-
const loanBorrowerFilter = (owner) => [
|
18
|
-
{
|
19
|
-
memcmp: {
|
20
|
-
offset: 10,
|
21
|
-
bytes: owner,
|
22
|
-
},
|
23
|
-
},
|
24
|
-
{
|
25
|
-
dataSize: 1080,
|
26
|
-
},
|
27
|
-
];
|
28
|
-
exports.loanBorrowerFilter = loanBorrowerFilter;
|
29
|
-
const loanLenderFilter = (owner) => [
|
30
|
-
{
|
31
|
-
memcmp: {
|
32
|
-
offset: 42,
|
33
|
-
bytes: owner,
|
34
|
-
},
|
35
|
-
},
|
36
|
-
{
|
37
|
-
dataSize: 1080,
|
38
|
-
},
|
39
|
-
];
|
40
|
-
exports.loanLenderFilter = loanLenderFilter;
|
41
|
-
const assetFilters = (owner) => [
|
42
|
-
{
|
43
|
-
memcmp: {
|
44
|
-
offset: 16,
|
45
|
-
bytes: owner,
|
46
|
-
},
|
47
|
-
},
|
48
|
-
{
|
49
|
-
dataSize: loan_1.assetStruct.byteSize,
|
50
|
-
},
|
51
|
-
];
|
52
|
-
exports.assetFilters = assetFilters;
|
53
|
-
//# sourceMappingURL=filters.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/filters.ts"],"names":[],"mappings":";;;AACA,yCAA6C;AAEtC,MAAM,UAAU,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACvE;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAVW,QAAA,UAAU,cAUrB;AAEK,MAAM,kBAAkB,GAAG,CAChC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAZW,QAAA,kBAAkB,sBAY7B;AAEK,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC7E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAVW,QAAA,gBAAgB,oBAU3B;AAEK,MAAM,YAAY,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACzE;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,kBAAW,CAAC,QAAQ;KAC/B;CACF,CAAC;AAVW,QAAA,YAAY,gBAUvB"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
2
|
-
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
3
|
-
import { PublicKey } from '@solana/web3.js';
|
4
|
-
import { Collection, Pool } from './types';
|
5
|
-
export declare function getPool(pool: string): Promise<Pool | undefined>;
|
6
|
-
export declare function getCollections(): Promise<Collection[]>;
|
7
|
-
export declare function getPoolPda(owner: string): PublicKey;
|
8
|
-
export declare function getLoans(owner: string): Promise<import("./types").Loan[]>;
|
9
|
-
export declare function daysBetweenDates(start: Date, end: Date): number;
|