@sonarwatch/portfolio-plugins 0.14.141 → 0.14.143
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 +2188 -2169
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/AirdropFetcher.js +1 -2
- package/src/AirdropFetcher.js.map +1 -1
- package/src/Fetcher.d.ts +0 -1
- package/src/Fetcher.js +2 -40
- package/src/Fetcher.js.map +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/01/constants.d.ts +1 -4
- package/src/plugins/01/constants.js +1 -18
- package/src/plugins/01/constants.js.map +1 -1
- package/src/plugins/aave/index.d.ts +1 -2
- package/src/plugins/aave/index.js +1 -3
- package/src/plugins/aave/index.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/jupiter/exchange/dcaFetcher.js +69 -20
- package/src/plugins/jupiter/exchange/dcaFetcher.js.map +1 -1
- package/src/plugins/jupiter/exchange/limitFetcher.js +73 -23
- package/src/plugins/jupiter/exchange/limitFetcher.js.map +1 -1
- package/src/plugins/orca/constants.d.ts +1 -1
- package/src/plugins/orca/constants.js +2 -2
- package/src/plugins/orca/constants.js.map +1 -1
- package/src/plugins/raydium/index.js +0 -1
- package/src/plugins/raydium/index.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/switchboard/onDemandPricingJob.js +2 -2
- package/src/plugins/switchboard/onDemandPricingJob.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/zeus/constants.d.ts +2 -2
- package/src/plugins/zeus/constants.js +2 -7
- package/src/plugins/zeus/constants.js.map +1 -1
- package/src/plugins/zeus/delegationsFetcher.js +1 -1
- package/src/plugins/zeus/delegationsFetcher.js.map +1 -1
- package/src/plugins/zeus/index.js +1 -1
- package/src/plugins/zeus/index.js.map +1 -1
- package/src/utils/misc/getCachedDecimalsForToken.d.ts +0 -1
- package/src/utils/misc/getCachedDecimalsForToken.js +3 -51
- package/src/utils/misc/getCachedDecimalsForToken.js.map +1 -1
- package/src/utils/misc/getDecimalsForToken.d.ts +4 -0
- package/src/utils/misc/getDecimalsForToken.js +63 -0
- package/src/utils/misc/getDecimalsForToken.js.map +1 -0
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/solana/isActive.d.ts +2 -0
- package/src/utils/solana/isActive.js +39 -0
- package/src/utils/solana/isActive.js.map +1 -0
- package/src/plugins/aave/services.d.ts +0 -30
- package/src/plugins/aave/services.js +0 -181
- package/src/plugins/aave/services.js.map +0 -1
- package/src/utils/misc/promiseTimeout.d.ts +0 -1
- package/src/utils/misc/promiseTimeout.js +0 -13
- package/src/utils/misc/promiseTimeout.js.map +0 -1
package/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
# @sonarwatch/portfolio-plugins
|
2
|
-
|
3
|
-
This library is @sonarwatch/portfolio-plugins
|
1
|
+
# @sonarwatch/portfolio-plugins
|
2
|
+
|
3
|
+
This library is @sonarwatch/portfolio-plugins
|
package/package.json
CHANGED
package/src/AirdropFetcher.js
CHANGED
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.airdropFetcherToFetcher = exports.runAirdropFetcher = exports.runAirdropFetchers = exports.getAirdropRaw = exports.runAirdropFetchersByNetworkId = exports.setAirdropItemPrices = exports.airdropItemPriceCachePrefix = void 0;
|
16
16
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
-
const promiseTimeout_1 = __importDefault(require("./utils/misc/promiseTimeout"));
|
18
17
|
const tokenPriceToAssetToken_1 = __importDefault(require("./utils/misc/tokenPriceToAssetToken"));
|
19
18
|
const runInParallel_1 = __importDefault(require("./utils/misc/runInParallel"));
|
20
19
|
exports.airdropItemPriceCachePrefix = 'airdropitemprice';
|
@@ -207,7 +206,7 @@ function runAirdropFetcher(owner, fetcher, cache, useCache = false) {
|
|
207
206
|
date: now,
|
208
207
|
};
|
209
208
|
});
|
210
|
-
return (0,
|
209
|
+
return (0, portfolio_core_1.promiseTimeout)(fetcherPromise, runAirdropFetcherTimeout, `Fetcher timed out: ${fetcher.id}`);
|
211
210
|
});
|
212
211
|
}
|
213
212
|
exports.runAirdropFetcher = runAirdropFetcher;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AirdropFetcher.js","sourceRoot":"","sources":["../../../../packages/plugins/src/AirdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"AirdropFetcher.js","sourceRoot":"","sources":["../../../../packages/plugins/src/AirdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DA6BoC;AAGpC,iGAAyE;AACzE,+EAAuD;AAa1C,QAAA,2BAA2B,GAAG,kBAAkB,CAAC;AAC9D,SAAsB,oBAAoB,CACxC,MAGG,EACH,SAAwB,EACxB,KAAY;;QAEZ,MAAM,KAAK,CAAC,QAAQ,CAClB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YAChC,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,KAAK;SACb,CAAC,CAAC,EACH;YACE,SAAS;YACT,MAAM,EAAE,mCAA2B;SACpC,CACF,CAAC;IACJ,CAAC;CAAA;AAlBD,oDAkBC;AAED,SAAe,oBAAoB,CACjC,MAAgB,EAChB,UAAyB,EACzB,KAAY;;QAEZ,MAAM,SAAS,GAA0B,IAAI,GAAG,EAAE,CAAC;QACnD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAE1C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAS,MAAM,EAAE;YAClD,SAAS,EAAE,UAAU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,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,UAAU,EAAE,EACtD,OAAO,CAAC,SAAS,CAClB;oBACH,CAAC,CAAC;wBACE,IAAI,EAAE,mCAAkB,CAAC,OAAO;wBAChC,IAAI,EAAE;4BACJ,MAAM,EAAE,IAAI,CAAC,MAAM;4BACnB,KAAK,EAAE,IAAI,CAAC,KAAK;yBAClB;wBACD,IAAI,EAAE,IAAI,CAAC,KAAK;wBAChB,SAAS,EAAE,cAAc,CAAC,SAAS;wBACnC,UAAU,EAAE;4BACV,WAAW,EAAE,IAAI;4BACjB,WAAW,EAAE,OAAO,CAAC,UAAU;yBAChC;wBACD,KAAK,EAAE,IAAI,CAAC,KAAK;wBACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;wBACvB,IAAI,EAAE,OAAO,CAAC,SAAS;qBACxB,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;YAEH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;YACnC,OAAO;gBACL;oBACE,SAAS,EAAE,cAAc,CAAC,SAAS;oBACnC,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE;wBACJ,MAAM;qBACP;oBACD,UAAU;oBACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;oBACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;oBACjD,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,SAAS;iBAChC;aACF,CAAC;QACJ,CAAC,CAAA;KACF,CAAC;AACJ,CAAC;AA5ED,0DA4EC"}
|
package/src/Fetcher.d.ts
CHANGED
@@ -9,4 +9,3 @@ export type Fetcher = {
|
|
9
9
|
export declare function runFetchers(owner: string, addressSystem: AddressSystemType, fetchers: Fetcher[], cache: Cache): Promise<FetchersResult>;
|
10
10
|
export declare function runFetchersByNetworkId(owner: string, networkId: NetworkIdType, fetchers: Fetcher[], cache: Cache): Promise<FetchersResult>;
|
11
11
|
export declare function runFetcher(owner: string, fetcher: Fetcher, cache: Cache): Promise<FetcherResult>;
|
12
|
-
export declare function isAddressActive(owner: string, addressSystem: AddressSystemType): Promise<boolean>;
|
package/src/Fetcher.js
CHANGED
@@ -8,15 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.
|
12
|
+
exports.runFetcher = exports.runFetchersByNetworkId = exports.runFetchers = void 0;
|
16
13
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
-
const web3_js_1 = require("@solana/web3.js");
|
18
|
-
const promiseTimeout_1 = __importDefault(require("./utils/misc/promiseTimeout"));
|
19
|
-
const clients_1 = require("./utils/clients");
|
20
14
|
const runFetcherTimeout = 60000;
|
21
15
|
function runFetchers(owner, addressSystem, fetchers, cache) {
|
22
16
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -25,24 +19,6 @@ function runFetchers(owner, addressSystem, fetchers, cache) {
|
|
25
19
|
if (!isFetchersValids)
|
26
20
|
throw new Error(`Not all fetchers have the right address system: ${addressSystem}`);
|
27
21
|
const startDate = Date.now();
|
28
|
-
if (!(yield isAddressActive(fOwner, addressSystem))) {
|
29
|
-
return {
|
30
|
-
owner: fOwner,
|
31
|
-
addressSystem,
|
32
|
-
fetcherReports: [
|
33
|
-
{
|
34
|
-
id: 'is-active',
|
35
|
-
status: 'failed',
|
36
|
-
duration: Date.now() - startDate,
|
37
|
-
error: 'Address is not active',
|
38
|
-
},
|
39
|
-
],
|
40
|
-
value: 0,
|
41
|
-
elements: [],
|
42
|
-
duration: Date.now() - startDate,
|
43
|
-
date: Date.now(),
|
44
|
-
};
|
45
|
-
}
|
46
22
|
const promises = fetchers.map((f) => runFetcher(fOwner, f, cache));
|
47
23
|
const result = yield Promise.allSettled(promises);
|
48
24
|
const fReports = [];
|
@@ -102,22 +78,8 @@ function runFetcher(owner, fetcher, cache) {
|
|
102
78
|
duration: Date.now() - startDate,
|
103
79
|
elements: elements.map((e) => (0, portfolio_core_1.sortPortfolioElement)(e)),
|
104
80
|
}));
|
105
|
-
return (0,
|
81
|
+
return (0, portfolio_core_1.promiseTimeout)(fetcherPromise, runFetcherTimeout, `Fetcher timed out: ${fetcher.id}`);
|
106
82
|
});
|
107
83
|
}
|
108
84
|
exports.runFetcher = runFetcher;
|
109
|
-
function isAddressActive(owner, addressSystem) {
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
111
|
-
if (addressSystem === 'solana') {
|
112
|
-
const client = (0, clients_1.getClientSolana)();
|
113
|
-
const tx = yield client.getSignaturesForAddress(new web3_js_1.PublicKey(owner), {
|
114
|
-
limit: 1,
|
115
|
-
});
|
116
|
-
if (tx.length === 0)
|
117
|
-
return false;
|
118
|
-
}
|
119
|
-
return true;
|
120
|
-
});
|
121
|
-
}
|
122
|
-
exports.isAddressActive = isAddressActive;
|
123
85
|
//# sourceMappingURL=Fetcher.js.map
|
package/src/Fetcher.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Fetcher.js","sourceRoot":"","sources":["../../../../packages/plugins/src/Fetcher.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Fetcher.js","sourceRoot":"","sources":["../../../../packages/plugins/src/Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAaoC;AAGpC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAahC,SAAsB,WAAW,CAC/B,KAAa,EACb,aAAgC,EAChC,QAAmB,EACnB,KAAY;;QAEZ,MAAM,MAA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AC,MAAM,EAAE,KAAK,CAAC,CAAC,IAAI,CACzD,CAAC,QAAQ,EAAiB,EAAE,CAAC,CAAC;YAC5B,KAAK,EAAE,MAAM;YACb,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,UAAU,EAAE,OAAO,CAAC,SAAS;YAC7B,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;YAChC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qCAAoB,EAAC,CAAC,CAAC,CAAC;SACvD,CAAC,CACH,CAAC;QACF,OAAO,IAAA,+BAAc,EACnB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,OAAO,CAAC,EAAE,EAAE,CACnC,CAAC;IACJ,CAAC;CAAA;AArBD,gCAqBC"}
|
package/src/index.d.ts
CHANGED
@@ -4,6 +4,7 @@ import { AirdropFetcher } from './AirdropFetcher';
|
|
4
4
|
import { Job } from './Job';
|
5
5
|
export { walletTokensPlatform, walletNftsPlatform, } from './plugins/tokens/constants';
|
6
6
|
export { getFetchersByAddressSystem } from './utils/misc/getFetchersByAddressSystem';
|
7
|
+
export { isSolanaAddressActive } from './utils/solana/isActive';
|
7
8
|
export * from './Cache';
|
8
9
|
export * from './Fetcher';
|
9
10
|
export * from './AirdropFetcher';
|
package/src/index.js
CHANGED
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.airdropFetchersByAddressSystem = exports.airdropFetchers = exports.fetchersByAddressSystem = exports.fetchers = exports.jobs = exports.platforms = exports.solanaSimpleFetcher = exports.jupFetcherIds = exports.getLlamaProtocolsJob = exports.getFetchersByAddressSystem = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
|
29
|
+
exports.airdropFetchersByAddressSystem = exports.airdropFetchers = exports.fetchersByAddressSystem = exports.fetchers = exports.jobs = exports.platforms = exports.solanaSimpleFetcher = exports.jupFetcherIds = exports.getLlamaProtocolsJob = exports.isSolanaAddressActive = exports.getFetchersByAddressSystem = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
|
30
30
|
const getFetchersByAddressSystem_1 = require("./utils/misc/getFetchersByAddressSystem");
|
31
31
|
const orphanPlatforms = __importStar(require("./orphanPlatforms"));
|
32
32
|
// PLUGINS
|
@@ -190,6 +190,8 @@ Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get:
|
|
190
190
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
191
191
|
var getFetchersByAddressSystem_2 = require("./utils/misc/getFetchersByAddressSystem");
|
192
192
|
Object.defineProperty(exports, "getFetchersByAddressSystem", { enumerable: true, get: function () { return getFetchersByAddressSystem_2.getFetchersByAddressSystem; } });
|
193
|
+
var isActive_1 = require("./utils/solana/isActive");
|
194
|
+
Object.defineProperty(exports, "isSolanaAddressActive", { enumerable: true, get: function () { return isActive_1.isSolanaAddressActive; } });
|
193
195
|
__exportStar(require("./Cache"), exports);
|
194
196
|
__exportStar(require("./Fetcher"), exports);
|
195
197
|
__exportStar(require("./AirdropFetcher"), exports);
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,mEAAqD;AAErD,UAAU;AACV,yDAA2C;AAC3C,oEAAsD;AACtD,mEAAqD;AACrD,6DAA+C;AAC/C,6DAA+C;AAC/C,uDAAyC;AACzC,qDAAuC;AACvC,2DAA6C;AAC7C,qDAAuC;AACvC,2DAA6C;AAC7C,uDAAyC;AACzC,yDAA2C;AAC3C,uDAAyC;AACzC,yDAA2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A+C;AAC/C,yDAA2C;AAC3C,6DAA+C;AAC/C,2DAA6C;AAC7C,yDAA2C;AAC3C,yDAA2C;AAC3C,2DAA6C;AAC7C,+DAAiD;AACjD,mFAAqE;AACrE,+DAAiD;AACjD,2DAA6C;AAC7C,2DAA6C;AAC7C,yDAA2C;AAC3C,6DAA+C;AAC/C,6DAA+C;AAC/C,uDAAyC;AACzC,6DAA+C;AAC/C,2DAA6C;AAC7C,uDAAyC;AACzC,+DAAiD;AACjD,6DAA+C;AAC/C,2DAA6C;AAC7C,6DAA+C;AAC/C,6DAA+C;AAC/C,+DAAiD;AACjD,yDAA2C;AAC3C,uDAAyC;AACzC,qDAAuC;AACvC,+DAAiD;AACjD,2DAA6C;AAC7C,qDAAuC;AACvC,qDAAuC;AACvC,qDAAuC;AACvC,uDAAyC;AACzC,iEAAmD;AACnD,6DAA+C;AAC/C,yDAA2C;AAC3C,uEAAyD;AACzD,6DAA+C;AAC/C,mEAAqD;AACrD,uEAAyD;AACzD,uDAAyC;AACzC,6DAA+C;AAC/C,yDAA2C;AAC3C,iEAAmD;AACnD,uDAAyC;AACzC,6DAA+C;AAC/C,uDAAyC;AACzC,6DAA+C;AAC/C,uDAAyC;AACzC,uDAAyC;AACzC,uDAAyC;AACzC,yDAA2C;AAC3C,6DAA+C;AAC/C,uDAAyC;AACzC,uDAAyC;AACzC,uDAAyC;AACzC,+DAAiD;AACjD,qDAAuC;AAEvC,wDAGoC;AAFlC,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAGpB,sFAAqF;AAA5E,wIAAA,0BAA0B,OAAA;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,mEAAqD;AAErD,UAAU;AACV,yDAA2C;AAC3C,oEAAsD;AACtD,mEAAqD;AACrD,6DAA+C;AAC/C,6DAA+C;AAC/C,uDA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AqB,CAAC;IACtC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;KACD,IAAI,EAAE,CAAC;AACG,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB,OAAO;KACrD,GAAG,CAAC,CAAC,MAAM,EAAoB,EAAE;IAChC,IAAI,iBAAiB,IAAI,MAAM,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,eAAmC,CAAC;IACpD,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;KACD,IAAI,EAAE,CAAC;AACG,QAAA,8BAA8B,GACzC,IAAA,uDAA0B,EAAC,uBAAe,CAAC,CAAC"}
|
@@ -1,11 +1,8 @@
|
|
1
1
|
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
2
2
|
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
4
|
-
import {
|
4
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
5
5
|
export declare const platformId = "01";
|
6
6
|
export declare const platform: Platform;
|
7
7
|
export declare const programId: PublicKey;
|
8
|
-
export declare const contract: Contract;
|
9
|
-
export declare const config: ServiceConfig;
|
10
|
-
export declare const service: Service;
|
11
8
|
export declare const mints: string[];
|
@@ -1,8 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.mints = exports.
|
3
|
+
exports.mints = exports.programId = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
|
-
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
6
5
|
const solana_1 = require("../../utils/solana");
|
7
6
|
const constants_1 = require("../marinade/constants");
|
8
7
|
exports.platformId = '01';
|
@@ -19,22 +18,6 @@ exports.platform = {
|
|
19
18
|
description: '01 Exchange is a next-gen trading experience with the speed of centralized exchanges and the integrity of decentralized finance, powered by Nord Engine.',
|
20
19
|
};
|
21
20
|
exports.programId = new web3_js_1.PublicKey('Zo1ggzTUKMY5bYnDvT5mtVeZxzf2FaLTbKkmvGUhUQk');
|
22
|
-
exports.contract = {
|
23
|
-
address: exports.programId.toString(),
|
24
|
-
name: 'Lending',
|
25
|
-
network: portfolio_core_1.NetworkId.solana,
|
26
|
-
};
|
27
|
-
exports.config = {
|
28
|
-
integratedOn: 1700784000000,
|
29
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
30
|
-
contracts: [exports.contract],
|
31
|
-
};
|
32
|
-
exports.service = {
|
33
|
-
id: `${exports.platformId}_lending`,
|
34
|
-
platformId: exports.platformId,
|
35
|
-
name: 'Lending',
|
36
|
-
configs: [exports.config],
|
37
|
-
};
|
38
21
|
exports.mints = [
|
39
22
|
solana_1.usdcSolanaMint,
|
40
23
|
'So11111111111111111111111111111111111111112',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/01/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/01/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAE5C,+CAAoD;AACpD,qDAAiD;AAEpC,QAAA,UAAU,GAAG,IAAI,CAAC;AAClB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,IAAI;IACV,KAAK,EACH,wEAAwE;IAC1E,WAAW,EAAE,IAAI,EAAE,sCAAsC;IACzD,OAAO,EAAE,oDAAoD;IAC7D,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,+BAA+B;IACxC,aAAa,EAAE,qBAAqB;IACpC,YAAY,EAAE,IAAI;IAClB,WAAW,EACT,0JAA0J;CAC7J,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,uBAAc;IACd,6CAA6C;IAC7C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,oBAAQ;IACR,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;CAC9C,CAAC"}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { Platform
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
2
|
import { Job } from '../../Job';
|
3
3
|
import { Fetcher } from '../../Fetcher';
|
4
4
|
export declare const platforms: Platform[];
|
5
|
-
export declare const services: Service[];
|
6
5
|
export declare const jobs: Job[];
|
7
6
|
export declare const fetchers: Fetcher[];
|
@@ -3,13 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.fetchers = exports.jobs = exports.
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
// import lendingPoolsJob from './lendingPoolsJob';
|
8
8
|
const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
|
9
9
|
const constants_1 = require("./constants");
|
10
|
-
const services_1 = require("./services");
|
11
10
|
exports.platforms = [constants_1.platform];
|
12
|
-
exports.services = [services_1.lendingV2, services_1.lendingV3];
|
13
11
|
exports.jobs = [
|
14
12
|
// lendingPoolsJob,
|
15
13
|
];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/aave/index.ts"],"names":[],"mappings":";;;;;;AAGA,mDAAmD;AACnD,sEAA8C;AAC9C,2CAAuC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/aave/index.ts"],"names":[],"mappings":";;;;;;AAGA,mDAAmD;AACnD,sEAA8C;AAC9C,2CAAuC;AAE1B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU;AACzB,mBAAmB;CACpB,CAAC;AACW,QAAA,QAAQ,GAAc;IACjC,eAAe;IACf,uEAAuE;IACvE,eAAe;IACf,IAAI;IACJ,uDAAuD;IACvD,mCAAmC;IACnC,6DAA6D;IAC7D,KAAK;IACL,IAAI;IACJ,sDAAsD;IACtD,kCAAkC;IAClC,4DAA4D;IAC5D,KAAK;IACL,IAAI;IACJ,wDAAwD;IACxD,oCAAoC;IACpC,8DAA8D;IAC9D,KAAK;IACL,eAAe;IACf,uEAAuE;IACvE,eAAe;IACf,wBAAc;CACf,CAAC"}
|
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
|
|
36
36
|
const graphql_request_1 = __importStar(require("graphql-request"));
|
37
37
|
function getBalancerPoolsV2(url) {
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
39
|
-
const query = (0, graphql_request_1.gql) `
|
40
|
-
query pools {
|
41
|
-
pools(
|
42
|
-
first: 1000
|
43
|
-
orderBy: totalLiquidity
|
44
|
-
orderDirection: desc
|
45
|
-
where: { totalLiquidity_gt: "500" }
|
46
|
-
) {
|
47
|
-
id
|
48
|
-
address
|
49
|
-
symbol
|
50
|
-
totalLiquidity
|
51
|
-
totalShares
|
52
|
-
tokens {
|
53
|
-
balance
|
54
|
-
decimals
|
55
|
-
symbol
|
56
|
-
address
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
39
|
+
const query = (0, graphql_request_1.gql) `
|
40
|
+
query pools {
|
41
|
+
pools(
|
42
|
+
first: 1000
|
43
|
+
orderBy: totalLiquidity
|
44
|
+
orderDirection: desc
|
45
|
+
where: { totalLiquidity_gt: "500" }
|
46
|
+
) {
|
47
|
+
id
|
48
|
+
address
|
49
|
+
symbol
|
50
|
+
totalLiquidity
|
51
|
+
totalShares
|
52
|
+
tokens {
|
53
|
+
balance
|
54
|
+
decimals
|
55
|
+
symbol
|
56
|
+
address
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
60
|
`;
|
61
61
|
const res = yield (0, graphql_request_1.default)(url, query);
|
62
62
|
const pools = res.pools;
|
@@ -8,6 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
16
|
const clients_1 = require("../../../utils/clients");
|
@@ -15,36 +18,82 @@ const solana_1 = require("../../../utils/solana");
|
|
15
18
|
const constants_1 = require("./constants");
|
16
19
|
const structs_1 = require("./structs");
|
17
20
|
const filters_1 = require("./filters");
|
18
|
-
const
|
21
|
+
const getCachedDecimalsForToken_1 = require("../../../utils/misc/getCachedDecimalsForToken");
|
22
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../../utils/misc/tokenPriceToAssetToken"));
|
19
23
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
24
|
const client = (0, clients_1.getClientSolana)({ commitment: 'processed' });
|
21
25
|
const accounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.dcaStruct, constants_1.dcaProgramId, (0, filters_1.DCAFilters)(owner));
|
22
26
|
if (accounts.length === 0)
|
23
27
|
return [];
|
24
|
-
const
|
28
|
+
const mints = accounts
|
29
|
+
.map((account) => [
|
30
|
+
account.inputMint.toString(),
|
31
|
+
account.outputMint.toString(),
|
32
|
+
])
|
33
|
+
.flat();
|
34
|
+
const pricesMap = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.solana);
|
35
|
+
const elements = [];
|
25
36
|
for (let i = 0; i < accounts.length; i++) {
|
26
37
|
const account = accounts[i];
|
27
|
-
const
|
38
|
+
const inputMint = account.inputMint.toString();
|
39
|
+
const inputTokenPrice = pricesMap.get(inputMint);
|
40
|
+
const outputMint = account.outputMint.toString();
|
41
|
+
const outputTokenPrice = pricesMap.get(outputMint);
|
42
|
+
// Decimals
|
43
|
+
const inputDecimals = (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.decimals) ||
|
44
|
+
(yield (0, getCachedDecimalsForToken_1.getCachedDecimalsForToken)(cache, inputMint, portfolio_core_1.NetworkId.solana));
|
45
|
+
if (!inputDecimals)
|
46
|
+
continue;
|
47
|
+
const outputDecimals = (outputTokenPrice === null || outputTokenPrice === void 0 ? void 0 : outputTokenPrice.decimals) ||
|
48
|
+
(yield (0, getCachedDecimalsForToken_1.getCachedDecimalsForToken)(cache, outputMint, portfolio_core_1.NetworkId.solana));
|
49
|
+
if (!outputDecimals)
|
50
|
+
continue;
|
51
|
+
const inputAmount = account.inDeposited
|
52
|
+
.minus(account.inUsed)
|
53
|
+
.div(Math.pow(10, inputDecimals))
|
54
|
+
.toNumber();
|
55
|
+
let inputAsset = null;
|
56
|
+
if (inputAmount !== 0)
|
57
|
+
inputAsset = (0, tokenPriceToAssetToken_1.default)(inputMint, inputAmount, portfolio_core_1.NetworkId.solana, inputTokenPrice);
|
58
|
+
const outputAmount = account.outReceived
|
59
|
+
.minus(account.outWithdrawn)
|
60
|
+
.div(Math.pow(10, outputDecimals))
|
61
|
+
.toNumber();
|
62
|
+
let outputAsset = null;
|
63
|
+
if (outputAmount !== 0)
|
64
|
+
outputAsset = (0, tokenPriceToAssetToken_1.default)(outputMint, outputAmount, portfolio_core_1.NetworkId.solana, outputTokenPrice);
|
65
|
+
const initialInputAmount = account.inDeposited
|
66
|
+
.div(Math.pow(10, inputDecimals))
|
67
|
+
.toNumber();
|
68
|
+
const element = {
|
69
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
70
|
+
type: portfolio_core_1.PortfolioElementType.trade,
|
71
|
+
platformId: constants_1.platformId,
|
28
72
|
label: 'DCA',
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
73
|
+
data: {
|
74
|
+
ref: account.pubkey.toString(),
|
75
|
+
assets: {
|
76
|
+
input: inputAsset,
|
77
|
+
output: outputAsset,
|
78
|
+
},
|
79
|
+
inputAddress: inputMint,
|
80
|
+
outputAddress: outputMint,
|
81
|
+
filledPercentage: 1 - inputAmount / initialInputAmount,
|
82
|
+
inputPrice: (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) || null,
|
83
|
+
outputPrice: (outputTokenPrice === null || outputTokenPrice === void 0 ? void 0 : outputTokenPrice.price) || null,
|
84
|
+
link: 'https://jup.ag/recurring/',
|
85
|
+
contract: constants_1.dcaProgramId.toString(),
|
86
|
+
initialInputAmount,
|
87
|
+
withdrawnOutputAmount: account.outWithdrawn
|
88
|
+
.div(Math.pow(10, outputDecimals))
|
89
|
+
.toNumber(),
|
90
|
+
createdAt: account.createdAt.toNumber() * 1000,
|
41
91
|
},
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
});
|
92
|
+
value: (0, portfolio_core_1.getUsdValueSum)([(inputAsset === null || inputAsset === void 0 ? void 0 : inputAsset.value) || 0, (outputAsset === null || outputAsset === void 0 ? void 0 : outputAsset.value) || 0]),
|
93
|
+
};
|
94
|
+
elements.push(element);
|
46
95
|
}
|
47
|
-
return
|
96
|
+
return elements;
|
48
97
|
});
|
49
98
|
const fetcher = {
|
50
99
|
id: `${constants_1.platformId}-dca`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dcaFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/exchange/dcaFetcher.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"dcaFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/exchange/dcaFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,oDAAyD;AACzD,kDAAiE;AACjE,2CAAuD;AACvD,uCAAsC;AACtC,uCAAuC;AACvC,6FAA0F;AAC1F,wGAAgF;AAEhF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;IAE5D,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,MAAM,EACN,mBAAS,EACT,wBAAY,EACZ,IAAA,oBAAU,EAAC,KAAK,CAAC,CAClB,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,KAAK,GAAG,QAAQ;SACnB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAChB,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE;QAC5B,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE;KAC9B,CAAC;SACD,IAAI,EAAE,CAAC;IACV,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,mBAAmB,CAC/C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EACjB,0BAAS,CAAC,MAAM,CACjB,CAAC;IAEF,MAAM,QAAQ,GAA4B,EAAE,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM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CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KAAI,CAAC,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,KAAI,CAAC,CAAC,CAAC;SACzE,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,MAAM;IACvB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -8,14 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
16
|
const clients_1 = require("../../../utils/clients");
|
14
17
|
const solana_1 = require("../../../utils/solana");
|
15
18
|
const constants_1 = require("./constants");
|
16
19
|
const filters_1 = require("./filters");
|
17
|
-
const ElementRegistry_1 = require("../../../utils/elementbuilder/ElementRegistry");
|
18
20
|
const structs_1 = require("./structs");
|
21
|
+
const getCachedDecimalsForToken_1 = require("../../../utils/misc/getCachedDecimalsForToken");
|
22
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../../utils/misc/tokenPriceToAssetToken"));
|
19
23
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
24
|
const client = (0, clients_1.getClientSolana)({ commitment: 'processed' });
|
21
25
|
const accountsRes = yield Promise.all([
|
@@ -28,34 +32,80 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
28
32
|
const accounts = accountsRes.flat();
|
29
33
|
if (accounts.length === 0)
|
30
34
|
return [];
|
31
|
-
const
|
35
|
+
const mints = accounts
|
36
|
+
.map((account) => [
|
37
|
+
account.inputMint.toString(),
|
38
|
+
account.outputMint.toString(),
|
39
|
+
])
|
40
|
+
.flat();
|
41
|
+
const pricesMap = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.solana);
|
42
|
+
const elements = [];
|
32
43
|
for (let i = 0; i < accounts.length; i++) {
|
33
44
|
const account = accounts[i];
|
45
|
+
const inputMint = account.inputMint.toString();
|
46
|
+
const inputTokenPrice = pricesMap.get(inputMint);
|
47
|
+
const outputMint = account.outputMint.toString();
|
48
|
+
const outputTokenPrice = pricesMap.get(outputMint);
|
49
|
+
// Decimals
|
50
|
+
const inputDecimals = (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.decimals) ||
|
51
|
+
(yield (0, getCachedDecimalsForToken_1.getCachedDecimalsForToken)(cache, inputMint, portfolio_core_1.NetworkId.solana));
|
52
|
+
if (!inputDecimals)
|
53
|
+
continue;
|
54
|
+
const outputDecimals = (outputTokenPrice === null || outputTokenPrice === void 0 ? void 0 : outputTokenPrice.decimals) ||
|
55
|
+
(yield (0, getCachedDecimalsForToken_1.getCachedDecimalsForToken)(cache, outputMint, portfolio_core_1.NetworkId.solana));
|
56
|
+
if (!outputDecimals)
|
57
|
+
continue;
|
58
|
+
const intputAmount = account.makingAmount
|
59
|
+
.div(Math.pow(10, inputDecimals))
|
60
|
+
.toNumber();
|
61
|
+
const inputAsset = intputAmount === 0
|
62
|
+
? null
|
63
|
+
: (0, tokenPriceToAssetToken_1.default)(inputMint, intputAmount, portfolio_core_1.NetworkId.solana, inputTokenPrice);
|
64
|
+
const outputAmount = account.oriTakingAmount
|
65
|
+
.minus(account.takingAmount)
|
66
|
+
.div(Math.pow(10, outputDecimals))
|
67
|
+
.toNumber();
|
68
|
+
const outputAsset = outputAmount === 0
|
69
|
+
? null
|
70
|
+
: (0, tokenPriceToAssetToken_1.default)(outputMint, outputAmount, portfolio_core_1.NetworkId.solana, outputTokenPrice);
|
71
|
+
const initialInputAmount = account.oriMakingAmount
|
72
|
+
.div(Math.pow(10, inputDecimals))
|
73
|
+
.toNumber();
|
74
|
+
const expectedOutputAmount = account.oriTakingAmount
|
75
|
+
.div(Math.pow(10, outputDecimals))
|
76
|
+
.toNumber();
|
34
77
|
const isV1 = i <= v1Length - 1;
|
35
|
-
const
|
36
|
-
|
37
|
-
|
38
|
-
link: 'https://jup.ag/trigger/',
|
78
|
+
const tags = isV1 ? ['deprecated'] : undefined;
|
79
|
+
const element = {
|
80
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
39
81
|
label: 'LimitOrder',
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
82
|
+
platformId: constants_1.platformId,
|
83
|
+
type: portfolio_core_1.PortfolioElementType.trade,
|
84
|
+
tags,
|
85
|
+
data: {
|
86
|
+
assets: {
|
87
|
+
input: inputAsset,
|
88
|
+
output: outputAsset,
|
89
|
+
},
|
90
|
+
inputAddress: inputMint,
|
91
|
+
outputAddress: outputMint,
|
92
|
+
initialInputAmount,
|
93
|
+
expectedOutputAmount,
|
94
|
+
filledPercentage: 1 - intputAmount / initialInputAmount,
|
95
|
+
inputPrice: (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) || null,
|
96
|
+
outputPrice: (outputTokenPrice === null || outputTokenPrice === void 0 ? void 0 : outputTokenPrice.price) || null,
|
97
|
+
ref: account.pubkey.toString(),
|
98
|
+
link: 'https://jup.ag/trigger/',
|
99
|
+
contract: isV1
|
100
|
+
? constants_1.limitV1ProgramId.toString()
|
101
|
+
: constants_1.limitV2ProgramId.toString(),
|
102
|
+
withdrawnOutputAmount: 0,
|
52
103
|
},
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
});
|
104
|
+
value: (0, portfolio_core_1.getUsdValueSum)([(inputAsset === null || inputAsset === void 0 ? void 0 : inputAsset.value) || 0, (outputAsset === null || outputAsset === void 0 ? void 0 : outputAsset.value) || 0]),
|
105
|
+
};
|
106
|
+
elements.push(element);
|
57
107
|
}
|
58
|
-
return
|
108
|
+
return elements;
|
59
109
|
});
|
60
110
|
const fetcher = {
|
61
111
|
id: `${constants_1.platformId}-limit`,
|