@sonarwatch/portfolio-plugins 0.11.193 → 0.11.195
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -1
- package/package.json +2 -2
- package/src/AirdropFetcher.d.ts +11 -0
- package/src/AirdropFetcher.js +92 -0
- package/src/AirdropFetcher.js.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +10 -1
- package/src/index.js.map +1 -1
- package/src/plugins/drift/airdropFetcher.js +7 -21
- package/src/plugins/drift/airdropFetcher.js.map +1 -1
- package/src/plugins/drift/constants.d.ts +4 -0
- package/src/plugins/drift/constants.js +8 -4
- package/src/plugins/drift/constants.js.map +1 -1
- package/src/plugins/drift/helpersAirdrop.d.ts +3 -0
- package/src/plugins/drift/helpersAirdrop.js +59 -0
- package/src/plugins/drift/helpersAirdrop.js.map +1 -0
- package/src/plugins/drift/index.d.ts +1 -0
- package/src/plugins/drift/index.js +3 -1
- package/src/plugins/drift/index.js.map +1 -1
- package/src/plugins/kriya/constants.d.ts +13 -0
- package/src/plugins/kriya/constants.js +30 -0
- package/src/plugins/kriya/constants.js.map +1 -0
- package/src/plugins/kriya/farmsFetcher.d.ts +3 -0
- package/src/plugins/kriya/farmsFetcher.js +104 -0
- package/src/plugins/kriya/farmsFetcher.js.map +1 -0
- package/src/plugins/kriya/farmsJob.d.ts +3 -0
- package/src/plugins/kriya/farmsJob.js +47 -0
- package/src/plugins/kriya/farmsJob.js.map +1 -0
- package/src/plugins/kriya/index.d.ts +6 -0
- package/src/plugins/kriya/index.js +15 -0
- package/src/plugins/kriya/index.js.map +1 -0
- package/src/plugins/kriya/types.d.ts +155 -0
- package/src/plugins/kriya/types.js +16 -0
- package/src/plugins/kriya/types.js.map +1 -0
- package/src/plugins/kriya/vaultsFetcher.d.ts +3 -0
- package/src/plugins/kriya/vaultsFetcher.js +94 -0
- package/src/plugins/kriya/vaultsFetcher.js.map +1 -0
- package/src/plugins/kriya/vaultsJob.d.ts +3 -0
- package/src/plugins/kriya/vaultsJob.js +57 -0
- package/src/plugins/kriya/vaultsJob.js.map +1 -0
- package/src/plugins/parcl/airdropFetcher.js +7 -45
- package/src/plugins/parcl/airdropFetcher.js.map +1 -1
- package/src/plugins/parcl/constants.d.ts +3 -0
- package/src/plugins/parcl/constants.js +7 -4
- package/src/plugins/parcl/constants.js.map +1 -1
- package/src/plugins/parcl/helpersAirdrop.d.ts +19 -0
- package/src/plugins/parcl/helpersAirdrop.js +99 -0
- package/src/plugins/parcl/helpersAirdrop.js.map +1 -0
- package/src/plugins/parcl/index.d.ts +1 -0
- package/src/plugins/parcl/index.js +3 -1
- package/src/plugins/parcl/index.js.map +1 -1
- package/src/plugins/parcl/types.d.ts +6 -1
- package/src/plugins/sandglass/marketsJob.js +3 -2
- package/src/plugins/sandglass/marketsJob.js.map +1 -1
- package/src/utils/sui/mulitpleGetBalances.d.ts +3 -0
- package/src/utils/sui/mulitpleGetBalances.js +19 -0
- package/src/utils/sui/mulitpleGetBalances.js.map +1 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.d.ts +4 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.js +25 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.js.map +1 -0
package/CHANGELOG.md
CHANGED
@@ -2,10 +2,18 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.11.
|
5
|
+
## [0.11.195](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.194...plugins-0.11.195) (2024-05-04)
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
## [0.11.194](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.193...plugins-0.11.194) (2024-05-04)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [0.11.193](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.192...plugins-0.11.193) (2024-05-02)
|
14
|
+
|
15
|
+
|
16
|
+
|
9
17
|
## [0.11.192](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.191...plugins-0.11.192) (2024-05-02)
|
10
18
|
|
11
19
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.195",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"web3-v1": "npm:web3@^1.5.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.195"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { AddressSystemType, Airdrop, AirdropFetcherResult, AirdropFetchersResult, NetworkIdType } from '@sonarwatch/portfolio-core';
|
2
|
+
import { Cache } from './Cache';
|
3
|
+
export type AirdropFetcherExecutor = (owner: string, cache: Cache) => Promise<Airdrop>;
|
4
|
+
export type AirdropFetcher = {
|
5
|
+
id: string;
|
6
|
+
networkId: NetworkIdType;
|
7
|
+
executor: AirdropFetcherExecutor;
|
8
|
+
};
|
9
|
+
export declare function runAirdropFetchersByNetworkId(owner: string, networkId: NetworkIdType, fetchers: AirdropFetcher[], cache: Cache): Promise<AirdropFetchersResult>;
|
10
|
+
export declare function runAirdropFetchers(owner: string, addressSystem: AddressSystemType, fetchers: AirdropFetcher[], cache: Cache): Promise<AirdropFetchersResult>;
|
11
|
+
export declare function runAirdropFetcher(owner: string, fetcher: AirdropFetcher, cache: Cache): Promise<AirdropFetcherResult>;
|
@@ -0,0 +1,92 @@
|
|
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
|
+
exports.runAirdropFetcher = exports.runAirdropFetchers = exports.runAirdropFetchersByNetworkId = void 0;
|
16
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
+
const promiseTimeout_1 = __importDefault(require("./utils/misc/promiseTimeout"));
|
18
|
+
const runAirdropFetcherTimeout = 10000;
|
19
|
+
function runAirdropFetchersByNetworkId(owner, networkId, fetchers, cache) {
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
21
|
+
const isFetchersValids = fetchers.every((f) => f.networkId === networkId);
|
22
|
+
if (!isFetchersValids)
|
23
|
+
throw new Error(`Not all airdrop fetchers have the right network id: ${networkId}`);
|
24
|
+
const { addressSystem } = portfolio_core_1.networks[networkId];
|
25
|
+
return runAirdropFetchers(owner, addressSystem, fetchers, cache);
|
26
|
+
});
|
27
|
+
}
|
28
|
+
exports.runAirdropFetchersByNetworkId = runAirdropFetchersByNetworkId;
|
29
|
+
function runAirdropFetchers(owner, addressSystem, fetchers, cache) {
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
31
|
+
const fOwner = (0, portfolio_core_1.formatAddress)(owner, addressSystem);
|
32
|
+
const isFetchersValids = fetchers.every((f) => portfolio_core_1.networks[f.networkId].addressSystem === addressSystem);
|
33
|
+
if (!isFetchersValids)
|
34
|
+
throw new Error(`Not all fetchers have the right address system: ${addressSystem}`);
|
35
|
+
const promises = fetchers.map((f) => runAirdropFetcher(fOwner, f, cache));
|
36
|
+
const result = yield Promise.allSettled(promises);
|
37
|
+
const fReports = [];
|
38
|
+
const airdrops = result.flatMap((r, index) => {
|
39
|
+
let fReport;
|
40
|
+
if (r.status === 'fulfilled') {
|
41
|
+
fReport = {
|
42
|
+
id: fetchers[index].id,
|
43
|
+
status: 'succeeded',
|
44
|
+
duration: r.value.duration,
|
45
|
+
error: undefined,
|
46
|
+
};
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
fReport = {
|
50
|
+
id: fetchers[index].id,
|
51
|
+
status: 'failed',
|
52
|
+
duration: undefined,
|
53
|
+
error: r.reason.message || 'Unknown error',
|
54
|
+
};
|
55
|
+
}
|
56
|
+
fReports.push(fReport);
|
57
|
+
if (r.status === 'rejected')
|
58
|
+
return [];
|
59
|
+
return r.value.airdrop;
|
60
|
+
});
|
61
|
+
return {
|
62
|
+
date: Date.now(),
|
63
|
+
owner: fOwner,
|
64
|
+
addressSystem,
|
65
|
+
fetcherReports: fReports,
|
66
|
+
airdrops,
|
67
|
+
};
|
68
|
+
});
|
69
|
+
}
|
70
|
+
exports.runAirdropFetchers = runAirdropFetchers;
|
71
|
+
function runAirdropFetcher(owner, fetcher, cache) {
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
73
|
+
const startDate = Date.now();
|
74
|
+
const fOwner = (0, portfolio_core_1.formatAddressByNetworkId)(owner, fetcher.networkId);
|
75
|
+
const fetcherPromise = fetcher
|
76
|
+
.executor(fOwner, cache)
|
77
|
+
.then((airdrop) => {
|
78
|
+
const now = Date.now();
|
79
|
+
return {
|
80
|
+
owner: fOwner,
|
81
|
+
fetcherId: fetcher.id,
|
82
|
+
networdkId: fetcher.networkId,
|
83
|
+
duration: now - startDate,
|
84
|
+
airdrop,
|
85
|
+
date: now,
|
86
|
+
};
|
87
|
+
});
|
88
|
+
return (0, promiseTimeout_1.default)(fetcherPromise, runAirdropFetcherTimeout, `Fetcher timed out: ${fetcher.id}`);
|
89
|
+
});
|
90
|
+
}
|
91
|
+
exports.runAirdropFetcher = runAirdropFetcher;
|
92
|
+
//# sourceMappingURL=AirdropFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AirdropFetcher.js","sourceRoot":"","sources":["../../../../packages/plugins/src/AirdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAUoC;AAEpC,iFAAyD;AAazD,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAEvC,SAAsB,6BAA6B,CACjD,KAAa,EACb,SAAwB,EACxB,QAA0B,EAC1B,KAAY;;QAEZ,MAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAC1E,IAAI,CAAC,gBAAgB;YACnB,MAAM,IAAI,KAAK,CACb,uDAAuD,SAAS,EAAE,CACnE,CAAC;QAEJ,MAAM,EAAE,aAAa,EAAE,GAAG,yBAAQ,CAAC,SAAS,CAAC,CAAC;QAC9C,OAAO,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;CAAA;AAdD,sEAcC;AAED,SAAsB,kBAAkB,CACtC,KAAa,EACb,aAAgC,EAChC,QAA0B,EAC1B,KAAY;;QAEZ,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QACnD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,yBAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,aAAa,KAAK,aAAa,CAC7D,CAAC;QACF,IAAI,CAAC,gBAAgB;YACnB,MAAM,IAAI,KAAK,CACb,mDAAmD,aAAa,EAAE,CACnE,CAAC;QAEJ,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,C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GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAA,yCAAwB,EAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAClE,MAAM,cAAc,GAAG,OAAO;aAC3B,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;aACvB,IAAI,CAAC,CAAC,OAAO,EAAwB,EAAE;YACtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACvB,OAAO;gBACL,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,OAAO,CAAC,EAAE;gBACrB,UAAU,EAAE,OAAO,CAAC,SAAS;gBAC7B,QAAQ,EAAE,GAAG,GAAG,SAAS;gBACzB,OAAO;gBACP,IAAI,EAAE,GAAG;aACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACL,OAAO,IAAA,wBAAc,EACnB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,OAAO,CAAC,EAAE,EAAE,CACnC,CAAC;IACJ,CAAC;CAAA;AAzBD,8CAyBC"}
|
package/src/index.d.ts
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
import { Platform } from '@sonarwatch/portfolio-core';
|
2
2
|
import { Fetcher } from './Fetcher';
|
3
|
+
import { AirdropFetcher } from './AirdropFetcher';
|
3
4
|
import { Job } from './Job';
|
4
5
|
export { walletTokensPlatform, walletNftsPlatform, } from './plugins/tokens/constants';
|
5
6
|
export { getFetchersByAddressSystem } from './utils/misc/getFetchersByAddressSystem';
|
6
7
|
export * from './Cache';
|
7
8
|
export * from './Fetcher';
|
9
|
+
export * from './AirdropFetcher';
|
8
10
|
export * from './Job';
|
9
11
|
export * from './utils/name-service';
|
10
12
|
export * from './utils/blank';
|
@@ -13,3 +15,4 @@ export declare const platforms: Platform[];
|
|
13
15
|
export declare const jobs: Job[];
|
14
16
|
export declare const fetchers: Fetcher[];
|
15
17
|
export declare const fetchersByAddressSystem: Record<import("@sonarwatch/portfolio-core").AddressSystemType, Fetcher[]>;
|
18
|
+
export declare const airdropFetchers: AirdropFetcher[];
|
package/src/index.js
CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
18
|
};
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
-
exports.fetchersByAddressSystem = exports.fetchers = exports.jobs = exports.platforms = exports.getLlamaProtocolsJob = exports.getFetchersByAddressSystem = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
|
20
|
+
exports.airdropFetchers = exports.fetchersByAddressSystem = exports.fetchers = exports.jobs = exports.platforms = exports.getLlamaProtocolsJob = exports.getFetchersByAddressSystem = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
|
21
21
|
const getFetchersByAddressSystem_1 = require("./utils/misc/getFetchersByAddressSystem");
|
22
22
|
const orphanPlatorms_1 = __importDefault(require("./orphanPlatorms"));
|
23
23
|
const tokens_1 = require("./plugins/tokens");
|
@@ -108,6 +108,7 @@ const jito_1 = require("./plugins/jito");
|
|
108
108
|
const magiceden_1 = require("./plugins/magiceden");
|
109
109
|
const clone_1 = require("./plugins/clone");
|
110
110
|
const sandglass_1 = require("./plugins/sandglass");
|
111
|
+
const kriya_1 = require("./plugins/kriya");
|
111
112
|
var constants_1 = require("./plugins/tokens/constants");
|
112
113
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
113
114
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -115,6 +116,7 @@ var getFetchersByAddressSystem_2 = require("./utils/misc/getFetchersByAddressSys
|
|
115
116
|
Object.defineProperty(exports, "getFetchersByAddressSystem", { enumerable: true, get: function () { return getFetchersByAddressSystem_2.getFetchersByAddressSystem; } });
|
116
117
|
__exportStar(require("./Cache"), exports);
|
117
118
|
__exportStar(require("./Fetcher"), exports);
|
119
|
+
__exportStar(require("./AirdropFetcher"), exports);
|
118
120
|
__exportStar(require("./Job"), exports);
|
119
121
|
__exportStar(require("./utils/name-service"), exports);
|
120
122
|
__exportStar(require("./utils/blank"), exports);
|
@@ -208,6 +210,7 @@ exports.platforms = [
|
|
208
210
|
...magiceden_1.platforms,
|
209
211
|
...clone_1.platforms,
|
210
212
|
...sandglass_1.platforms,
|
213
|
+
...kriya_1.platforms,
|
211
214
|
];
|
212
215
|
// JOBS //
|
213
216
|
exports.jobs = [
|
@@ -292,6 +295,7 @@ exports.jobs = [
|
|
292
295
|
...clone_1.jobs,
|
293
296
|
...switchboard_1.jobs,
|
294
297
|
...sandglass_1.jobs,
|
298
|
+
...kriya_1.jobs,
|
295
299
|
];
|
296
300
|
// FETCHERS //
|
297
301
|
exports.fetchers = [
|
@@ -378,6 +382,11 @@ exports.fetchers = [
|
|
378
382
|
...magiceden_1.fetchers,
|
379
383
|
...clone_1.fetchers,
|
380
384
|
...sandglass_1.fetchers,
|
385
|
+
...kriya_1.fetchers,
|
381
386
|
];
|
382
387
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
388
|
+
exports.airdropFetchers = [
|
389
|
+
drift_1.airdropFetcher,
|
390
|
+
parcl_1.airdropFetcher,
|
391
|
+
];
|
383
392
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,uDAAgE;AAChE,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+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,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,cAAW;IACd,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;CACjB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC"}
|
@@ -13,34 +13,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
17
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
16
|
const constants_1 = require("./constants");
|
19
17
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
20
|
-
const
|
18
|
+
const helpersAirdrop_1 = require("./helpersAirdrop");
|
21
19
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
-
const res = yield axios_1.default
|
23
|
-
.get(constants_1.airdropUrl + owner, {
|
24
|
-
headers: {
|
25
|
-
Origin: 'https://drift.foundation',
|
26
|
-
Referer: 'https://drift.foundation/',
|
27
|
-
},
|
28
|
-
timeout: 1000,
|
29
|
-
})
|
30
|
-
.catch(() => null);
|
31
|
-
if (!res || res.data.error || res.data.start_amount === 0)
|
32
|
-
return [];
|
33
20
|
// const client = getClientSolana();
|
34
21
|
// const claimStatus = deriveClaimStatus(owner, res.data.merkle_tree, '');
|
35
22
|
// const account = await client.getAccountInfo(claimStatus);
|
36
23
|
// if (account) return [];
|
37
|
-
const
|
38
|
-
|
39
|
-
|
24
|
+
const amount = yield (0, helpersAirdrop_1.fetchAirdropAmount)(owner);
|
25
|
+
if (amount === 0)
|
26
|
+
return [];
|
27
|
+
const tokenPrice = constants_1.driftMint
|
28
|
+
? yield cache.getTokenPrice(constants_1.driftMint, portfolio_core_1.NetworkId.solana)
|
40
29
|
: undefined;
|
41
|
-
const amount = new bignumber_js_1.default(res.data.start_amount)
|
42
|
-
.dividedBy(driftFactor)
|
43
|
-
.toNumber();
|
44
30
|
const asset = tokenPrice
|
45
31
|
? (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.solana, tokenPrice)
|
46
32
|
: {
|
@@ -52,7 +38,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
52
38
|
imageUri: constants_1.platform.image,
|
53
39
|
},
|
54
40
|
attributes: {
|
55
|
-
lockedUntil:
|
41
|
+
lockedUntil: -1,
|
56
42
|
},
|
57
43
|
networkId: portfolio_core_1.NetworkId.solana,
|
58
44
|
value: null,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAA8D;AAC9D,qGAA6E;AAC7E,qDAAsD;AAEtD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,oCAAoC;IACpC,0EAA0E;IAC1E,4DAA4D;IAC5D,0BAA0B;IAE1B,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAkB,EAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE5B,MAAM,UAAU,GAAG,qBAAS;QAC1B,CAAC,CAAC,MAAM,KAAK,CAAC,aAAa,CAAC,qBAAS,EAAE,0BAAS,CAAC,MAAM,CAAC;QACxD,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,KAAK,GAAmB,UAAU;QACtC,CAAC,CAAC,IAAA,gCAAsB,EACpB,UAAU,CAAC,OAAO,EAClB,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX;QACH,CAAC,CAAC;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,MAAM;gBACN,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,oBAAQ,CAAC,KAAK;aACzB;YACD,UAAU,EAAE;gBACV,WAAW,EAAE,CAAC,CAAC;aAChB;YACD,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,IAAI;SACZ,CAAC;IAEN,OAAO;QACL;YACE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,IAAI,EAAE;gBACJ,MAAM,EAAE,CAAC,KAAK,CAAC;aAChB;YACD,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,SAAS;SACjB;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1,9 +1,13 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
2
|
import { Platform } from '@sonarwatch/portfolio-core';
|
3
3
|
export declare const platformId = "drift";
|
4
|
+
export declare const platformName = "Drift";
|
5
|
+
export declare const platformImage = "https://sonar.watch/img/platforms/drift.png";
|
6
|
+
export declare const platformWebsite = "https://www.drift.trade/";
|
4
7
|
export declare const platform: Platform;
|
5
8
|
export declare const prefixSpotMarkets = "drift-spotMarkets";
|
6
9
|
export declare const driftProgram: PublicKey;
|
7
10
|
export declare const preMarketPriceKey = "premarketPrice";
|
8
11
|
export declare const airdropUrl = "https://airdrop.drift.trade/eligibility/";
|
9
12
|
export declare const driftDecimals = 6;
|
13
|
+
export declare const driftMint: undefined;
|
@@ -1,18 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.driftDecimals = exports.airdropUrl = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.driftMint = exports.driftDecimals = exports.airdropUrl = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformWebsite = exports.platformImage = exports.platformName = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'drift';
|
6
|
+
exports.platformName = 'Drift';
|
7
|
+
exports.platformImage = 'https://sonar.watch/img/platforms/drift.png';
|
8
|
+
exports.platformWebsite = 'https://www.drift.trade/';
|
6
9
|
exports.platform = {
|
7
10
|
id: exports.platformId,
|
8
|
-
name:
|
9
|
-
image:
|
11
|
+
name: exports.platformName,
|
12
|
+
image: exports.platformImage,
|
10
13
|
defiLlamaId: 'drift',
|
11
|
-
website:
|
14
|
+
website: exports.platformWebsite,
|
12
15
|
};
|
13
16
|
exports.prefixSpotMarkets = `${exports.platformId}-spotMarkets`;
|
14
17
|
exports.driftProgram = new web3_js_1.PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH');
|
15
18
|
exports.preMarketPriceKey = 'premarketPrice';
|
16
19
|
exports.airdropUrl = 'https://airdrop.drift.trade/eligibility/';
|
17
20
|
exports.driftDecimals = 6;
|
21
|
+
exports.driftMint = undefined;
|
18
22
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AAErC,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,SAAS,CAAC"}
|
@@ -0,0 +1,59 @@
|
|
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
|
+
exports.airdropFetcher = exports.fetchAirdropAmount = void 0;
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
18
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
19
|
+
const constants_1 = require("./constants");
|
20
|
+
const driftFactor = new bignumber_js_1.default(Math.pow(10, constants_1.driftDecimals));
|
21
|
+
function fetchAirdropAmount(owner) {
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
23
|
+
const res = yield axios_1.default.get(constants_1.airdropUrl + owner, {
|
24
|
+
headers: {
|
25
|
+
Origin: 'https://drift.foundation',
|
26
|
+
Referer: 'https://drift.foundation/',
|
27
|
+
},
|
28
|
+
timeout: 1000,
|
29
|
+
validateStatus(status) {
|
30
|
+
return status === 404 || status === 200;
|
31
|
+
},
|
32
|
+
});
|
33
|
+
return new bignumber_js_1.default(res.data.start_amount || 0)
|
34
|
+
.dividedBy(driftFactor)
|
35
|
+
.toNumber();
|
36
|
+
});
|
37
|
+
}
|
38
|
+
exports.fetchAirdropAmount = fetchAirdropAmount;
|
39
|
+
const airdropStatics = {
|
40
|
+
claimLink: 'https://drift.foundation/eligibility',
|
41
|
+
id: 'drift-airdrop-1',
|
42
|
+
image: constants_1.platformImage,
|
43
|
+
label: 'DRIFT',
|
44
|
+
name: undefined,
|
45
|
+
organizerName: constants_1.platformName,
|
46
|
+
organizerLink: constants_1.platformWebsite,
|
47
|
+
claimStart: undefined,
|
48
|
+
claimEnd: undefined,
|
49
|
+
};
|
50
|
+
const fetchAirdropExecutor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
51
|
+
const amount = yield fetchAirdropAmount(owner);
|
52
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, airdropStatics), { amount }), (0, portfolio_core_1.getAirdropStatus)(airdropStatics.claimStart, airdropStatics.claimEnd, amount)), { price: null });
|
53
|
+
});
|
54
|
+
exports.airdropFetcher = {
|
55
|
+
id: airdropStatics.id,
|
56
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
57
|
+
executor: fetchAirdropExecutor,
|
58
|
+
};
|
59
|
+
//# sourceMappingURL=helpersAirdrop.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpersAirdrop.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/helpersAirdrop.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,kDAA6C;AAC7C,+DAAyE;AACzE,2CAMqB;AAIrB,MAAM,WAAW,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,yBAAa,CAAA,CAAC,CAAC;AACvD,SAAsB,kBAAkB,CAAC,KAAa;;QACpD,MAAM,GAAG,GAAmC,MAAM,eAAK,CAAC,GAAG,CACzD,sBAAU,GAAG,KAAK,EAClB;YACE,OAAO,EAAE;gBACP,MAAM,EAAE,0BAA0B;gBAClC,OAAO,EAAE,2BAA2B;aACrC;YACD,OAAO,EAAE,IAAI;YACb,cAAc,CAAC,MAAM;gBACnB,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;YAC1C,CAAC;SACF,CACF,CAAC;QACF,OAAO,IAAI,sBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;aAC7C,SAAS,CAAC,WAAW,CAAC;aACtB,QAAQ,EAAE,CAAC;IAChB,CAAC;CAAA;AAjBD,gDAiBC;AAED,MAAM,cAAc,GAAG;IACrB,SAAS,EAAE,sCAAsC;IACjD,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,yBAAa;IACpB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,wBAAY;IAC3B,aAAa,EAAE,2BAAe;IAC9B,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;CACpB,CAAC;AACF,MAAM,oBAAoB,GAA2B,CAAO,KAAa,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,mEACK,cAAc,KACjB,MAAM,KACH,IAAA,iCAAgB,EACjB,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,QAAQ,EACvB,MAAM,CACP,KACD,KAAK,EAAE,IAAI,IACX;AACJ,CAAC,CAAA,CAAC;AAEW,QAAA,cAAc,GAAmB;IAC5C,EAAE,EAAE,cAAc,CAAC,EAAE;IACrB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,oBAAoB;CAC/B,CAAC"}
|
@@ -3,7 +3,7 @@ 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.platforms = void 0;
|
6
|
+
exports.airdropFetcher = exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
const constants_1 = require("./constants");
|
8
8
|
const spotMarketsJob_1 = __importDefault(require("./spotMarketsJob"));
|
9
9
|
const deposits_1 = __importDefault(require("./deposits"));
|
@@ -12,4 +12,6 @@ const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
|
12
12
|
exports.platforms = [constants_1.platform];
|
13
13
|
exports.jobs = [spotMarketsJob_1.default, premarketJob_1.default];
|
14
14
|
exports.fetchers = [deposits_1.default, airdropFetcher_1.default];
|
15
|
+
var helpersAirdrop_1 = require("./helpersAirdrop");
|
16
|
+
Object.defineProperty(exports, "airdropFetcher", { enumerable: true, get: function () { return helpersAirdrop_1.airdropFetcher; } });
|
15
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,0DAA8C;AAC9C,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,wBAAc,EAAE,sBAAY,CAAC,CAAC;AAC7C,QAAA,QAAQ,GAAc,CAAC,kBAAoB,EAAE,wBAAc,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,0DAA8C;AAC9C,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,wBAAc,EAAE,sBAAY,CAAC,CAAC;AAC7C,QAAA,QAAQ,GAAc,CAAC,kBAAoB,EAAE,wBAAc,CAAC,CAAC;AAC1E,mDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
import { VaultInfo } from './types';
|
3
|
+
export declare const platformId = "kriya";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const vaultsPackageId = "0xc4ee7b00ea981402a6285b14ffa5dcd1ee7f97eb2a91df3bcc04fa88c56ac7d7";
|
6
|
+
export declare const farmsPackageId = "0x88701243d0445aa38c0a13f02a9af49a58092dfadb93af9754edb41c52f40085";
|
7
|
+
export declare const vaultsInfoKey = "vaultsInfos";
|
8
|
+
export declare const farmsInfoKey = "farmsInfos";
|
9
|
+
export declare const vaultsUrl = "https://88ob93rfva.execute-api.ap-southeast-1.amazonaws.com/release/vaults";
|
10
|
+
export declare const poolsUrl = "https://xd0ljetd33.execute-api.ap-southeast-1.amazonaws.com/release/pools";
|
11
|
+
export declare const vaultsCointsTypes: string[];
|
12
|
+
export declare const vaultsInfo: VaultInfo[];
|
13
|
+
export declare const dynamicFieldPositionType = "0x2::dynamic_field::Field<vector<u8>, 0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb::position::Position>";
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.dynamicFieldPositionType = exports.vaultsInfo = exports.vaultsCointsTypes = exports.poolsUrl = exports.vaultsUrl = exports.farmsInfoKey = exports.vaultsInfoKey = exports.farmsPackageId = exports.vaultsPackageId = exports.platform = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'kriya';
|
5
|
+
exports.platform = {
|
6
|
+
id: exports.platformId,
|
7
|
+
name: 'Kriya',
|
8
|
+
image: 'https://sonar.watch/img/platforms/kriya.webp',
|
9
|
+
// defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
|
10
|
+
// website: 'https://myplatform.com',
|
11
|
+
// twitter: 'https://twitter.com/myplatform',
|
12
|
+
};
|
13
|
+
exports.vaultsPackageId = '0xc4ee7b00ea981402a6285b14ffa5dcd1ee7f97eb2a91df3bcc04fa88c56ac7d7';
|
14
|
+
exports.farmsPackageId = '0x88701243d0445aa38c0a13f02a9af49a58092dfadb93af9754edb41c52f40085';
|
15
|
+
exports.vaultsInfoKey = 'vaultsInfos';
|
16
|
+
exports.farmsInfoKey = 'farmsInfos';
|
17
|
+
exports.vaultsUrl = 'https://88ob93rfva.execute-api.ap-southeast-1.amazonaws.com/release/vaults';
|
18
|
+
exports.poolsUrl = 'https://xd0ljetd33.execute-api.ap-southeast-1.amazonaws.com/release/pools';
|
19
|
+
exports.vaultsCointsTypes = [
|
20
|
+
'0xc4ee7b00ea981402a6285b14ffa5dcd1ee7f97eb2a91df3bcc04fa88c56ac7d7::kc_allweather_vt::KC_ALLWEATHER_VT',
|
21
|
+
];
|
22
|
+
exports.vaultsInfo = [
|
23
|
+
{
|
24
|
+
tokenType: '0xc4ee7b00ea981402a6285b14ffa5dcd1ee7f97eb2a91df3bcc04fa88c56ac7d7::kc_allweather_vt::KC_ALLWEATHER_VT',
|
25
|
+
id: '0x5eb2f7e07e4fbe6ce47dd10dc040efd5c79228ed767d242c320571dcd7c5a976',
|
26
|
+
underlyingPool: '0xcf994611fd4c48e277ce3ffd4d4364c914af2c3cbb05f7bf6facd371de688630',
|
27
|
+
},
|
28
|
+
];
|
29
|
+
exports.dynamicFieldPositionType = '0x2::dynamic_field::Field<vector<u8>, 0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb::position::Position>';
|
30
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,8CAA8C;IACrD,qEAAqE;IACrE,qCAAqC;IACrC,6CAA6C;CAC9C,CAAC;AAEW,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAC1D,QAAA,cAAc,GACzB,oEAAoE,CAAC;AAE1D,QAAA,aAAa,GAAG,aAAa,CAAC;AAC9B,QAAA,YAAY,GAAG,YAAY,CAAC;AAE5B,QAAA,SAAS,GACpB,4EAA4E,CAAC;AAClE,QAAA,QAAQ,GACnB,2EAA2E,CAAC;AAEjE,QAAA,iBAAiB,GAAG;IAC/B,wGAAwG;CACzG,CAAC;AAEW,QAAA,UAAU,GAAgB;IACrC;QACE,SAAS,EACP,wGAAwG;QAC1G,EAAE,EAAE,oEAAoE;QACxE,cAAc,EACZ,oEAAoE;KACvE;CACF,CAAC;AAEW,QAAA,wBAAwB,GACnC,+HAA+H,CAAC"}
|
@@ -0,0 +1,104 @@
|
|
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 getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
20
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
var _a, _b;
|
23
|
+
const client = (0, clients_1.getClientSui)();
|
24
|
+
const farmsObjects = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
25
|
+
filter: { Package: constants_1.farmsPackageId },
|
26
|
+
});
|
27
|
+
if (farmsObjects.length === 0)
|
28
|
+
return [];
|
29
|
+
const farmsInfos = yield cache.getItem(constants_1.farmsInfoKey, {
|
30
|
+
prefix: constants_1.platformId,
|
31
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
32
|
+
});
|
33
|
+
if (!farmsInfos)
|
34
|
+
return [];
|
35
|
+
const farmById = new Map();
|
36
|
+
const mints = new Set();
|
37
|
+
farmsInfos.forEach((farm) => {
|
38
|
+
farmById.set(farm.farmId, farm);
|
39
|
+
mints.add(farm.tokenXType);
|
40
|
+
mints.add(farm.tokenYType);
|
41
|
+
});
|
42
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.sui);
|
43
|
+
const liquidities = [];
|
44
|
+
let totalValue = 0;
|
45
|
+
for (const object of farmsObjects) {
|
46
|
+
if (!((_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields))
|
47
|
+
continue;
|
48
|
+
const position = object.data.content.fields;
|
49
|
+
const farmInfo = farmById.get(position.farm_id);
|
50
|
+
if (!farmInfo)
|
51
|
+
continue;
|
52
|
+
const [tokenPriceX, tokenPriceY] = [
|
53
|
+
tokenPriceById.get((0, portfolio_core_1.formatMoveTokenAddress)(farmInfo.tokenXType)),
|
54
|
+
tokenPriceById.get((0, portfolio_core_1.formatMoveTokenAddress)(farmInfo.tokenYType)),
|
55
|
+
];
|
56
|
+
const shares = new bignumber_js_1.default(position.stake_amount).dividedBy(new bignumber_js_1.default(farmInfo.lspSupply));
|
57
|
+
const tokenAmountX = new bignumber_js_1.default(farmInfo.tokenXReserve)
|
58
|
+
.times(shares)
|
59
|
+
.dividedBy(Math.pow(10, farmInfo.tokenX.decimals))
|
60
|
+
.toNumber();
|
61
|
+
const tokenAmountY = new bignumber_js_1.default(farmInfo.tokenYReserve)
|
62
|
+
.times(shares)
|
63
|
+
.dividedBy(Math.pow(10, farmInfo.tokenY.decimals))
|
64
|
+
.toNumber();
|
65
|
+
const assetX = (0, tokenPriceToAssetToken_1.default)(farmInfo.tokenXType, tokenAmountX, portfolio_core_1.NetworkId.sui, tokenPriceX);
|
66
|
+
const assetY = (0, tokenPriceToAssetToken_1.default)(farmInfo.tokenYType, tokenAmountY, portfolio_core_1.NetworkId.sui, tokenPriceY);
|
67
|
+
const value = (0, portfolio_core_1.getUsdValueSum)([assetX.value, assetY.value]);
|
68
|
+
totalValue = (0, portfolio_core_1.getUsdValueSum)([totalValue, value]);
|
69
|
+
liquidities.push({
|
70
|
+
assets: [assetX, assetY],
|
71
|
+
assetsValue: value,
|
72
|
+
rewardAssets: [],
|
73
|
+
rewardAssetsValue: null,
|
74
|
+
value,
|
75
|
+
yields: [
|
76
|
+
{
|
77
|
+
apy: farmInfo.apy / 100,
|
78
|
+
apr: (0, portfolio_core_1.apyToApr)(farmInfo.apy / 100),
|
79
|
+
},
|
80
|
+
],
|
81
|
+
});
|
82
|
+
}
|
83
|
+
if (liquidities.length === 0)
|
84
|
+
return [];
|
85
|
+
return [
|
86
|
+
{
|
87
|
+
type: 'liquidity',
|
88
|
+
data: {
|
89
|
+
liquidities,
|
90
|
+
},
|
91
|
+
label: 'Farming',
|
92
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
93
|
+
platformId: constants_1.platformId,
|
94
|
+
value: totalValue,
|
95
|
+
},
|
96
|
+
];
|
97
|
+
});
|
98
|
+
const fetcher = {
|
99
|
+
id: `${constants_1.platformId}-farms`,
|
100
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
101
|
+
executor,
|
102
|
+
};
|
103
|
+
exports.default = fetcher;
|
104
|
+
//# sourceMappingURL=farmsFetcher.js.map
|