@sonarwatch/portfolio-plugins 0.8.52 → 0.8.53

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 CHANGED
@@ -2,14 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.8.52](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.51...plugins-0.8.52) (2023-11-01)
6
-
7
-
8
-
9
- ## [0.8.51](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.50...plugins-0.8.51) (2023-11-01)
5
+ ## [0.8.53](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.52...plugins-0.8.53) (2023-11-02)
10
6
 
11
7
 
12
8
 
9
+ ## [0.8.52](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.51...plugins-0.8.52) (2023-11-01)
10
+
11
+
12
+
13
+ ## [0.8.51](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.50...plugins-0.8.51) (2023-11-01)
14
+
15
+
16
+
13
17
  ## [0.8.50](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.49...plugins-0.8.50) (2023-10-27)
14
18
 
15
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.8.52",
3
+ "version": "0.8.53",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -39,7 +39,7 @@
39
39
  "web3-v1": "npm:web3@^1.5.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@sonarwatch/portfolio-core": "0.8.52"
42
+ "@sonarwatch/portfolio-core": "0.8.54"
43
43
  },
44
44
  "main": "./src/index.js",
45
45
  "types": "./src/index.d.ts"
package/src/index.js CHANGED
@@ -59,6 +59,7 @@ const uniswap_1 = require("./plugins/uniswap");
59
59
  const uniswap_v2_1 = require("./plugins/uniswap-v2");
60
60
  const balancer_1 = require("./plugins/balancer");
61
61
  const paraswap_1 = require("./plugins/paraswap");
62
+ const realms_1 = require("./plugins/realms");
62
63
  var constants_1 = require("./plugins/tokens/constants");
63
64
  Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
64
65
  Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
@@ -108,6 +109,7 @@ exports.platforms = [
108
109
  ...uniswap_1.platforms,
109
110
  ...balancer_1.platforms,
110
111
  ...paraswap_1.platforms,
112
+ ...realms_1.platforms,
111
113
  ];
112
114
  // JOBS //
113
115
  exports.jobs = [
@@ -178,6 +180,7 @@ exports.fetchers = [
178
180
  ...uniswap_1.fetchers,
179
181
  ...balancer_1.fetchers,
180
182
  ...paraswap_1.fetchers,
183
+ ...realms_1.fetchers,
181
184
  ];
182
185
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
183
186
  //# 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":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAG2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAG+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAG0B;AAC1B,yCAIw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,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAG2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAG+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAI0B;AAC1B,+CAI2B;AAC3B,qDAG8B;AAC9B,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAG0B;AAE1B,wDAGoC;AAFlC,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAGpB,0CAAwB;AACxB,4CAA0B;AAC1B,wCAAsB;AACtB,uDAAqC;AACrC,gDAA8B;AAC9B,4DAA0C;AAE1C,eAAe;AACF,QAAA,SAAS,GAAe;IACnC,GAAG,wBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,uBAAoB;IACvB,GAAG,8BAA0B;IAC7B,GAAG,sBAAmB;IACtB,GAAG,qBAAkB;IACrB,GAAG,uBAAoB;IACvB,GAAG,kBAAe;IAClB,GAAG,wBAAoB;IACvB,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG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GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,wBAAoB;IACvB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,6BAAyB;IAC5B,GAAG,iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,sBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,qBAAiB;IACpB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,iBAAc;CAClB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,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;
@@ -0,0 +1,7 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { Platform } from '@sonarwatch/portfolio-core';
3
+ export declare const platformId = "realms";
4
+ export declare const realmsPlatform: Platform;
5
+ export declare const voteProgramId: PublicKey;
6
+ export declare const voterProgramId: PublicKey;
7
+ export declare const goveProgramId: PublicKey;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.goveProgramId = exports.voterProgramId = exports.voteProgramId = exports.realmsPlatform = exports.platformId = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ exports.platformId = 'realms';
6
+ exports.realmsPlatform = {
7
+ id: exports.platformId,
8
+ name: 'Realms',
9
+ image: 'https://sonar.watch/img/platforms/realms.png',
10
+ defiLlamaId: 'realms',
11
+ };
12
+ exports.voteProgramId = new web3_js_1.PublicKey('A7kmu2kUcnQwAVn8B4znQmGJeUrsJ1WEhYVMtmiBLkEr');
13
+ exports.voterProgramId = new web3_js_1.PublicKey('VoteMBhDCqGLRgYpp9o7DGyq81KNmwjXQRAHStjtJsS');
14
+ exports.goveProgramId = new web3_js_1.PublicKey('GovMaiHfpVPw8BAM1mbdzgmSZYDw2tdP32J2fapoQoYs');
15
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AAEtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,QAAQ;CACtB,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,66 @@
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 constants_1 = require("./constants");
17
+ const clients_1 = require("../../utils/clients");
18
+ const solana_1 = require("../../utils/solana");
19
+ const structs_1 = require("./structs");
20
+ const filters_1 = require("./filters");
21
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const client = (0, clients_1.getClientSolana)();
24
+ const oldVoteAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.voteAccountStruct, constants_1.voteProgramId, (0, filters_1.voteAccountFilters)(owner));
25
+ // Job : fetch all existing registrer of GovMAI
26
+ // Fetcher : fetch all voter for an address on each registrar
27
+ if (oldVoteAccounts.length === 0)
28
+ return [];
29
+ const mints = oldVoteAccounts.map((acc) => acc.mint.toString());
30
+ const tokenPrices = yield cache.getTokenPrices(mints, portfolio_core_1.NetworkId.solana);
31
+ if (!tokenPrices)
32
+ return [];
33
+ const tokenPriceByMint = new Map();
34
+ tokenPrices.forEach((tP) => (tP ? tokenPriceByMint.set(tP.address, tP) : []));
35
+ const assets = [];
36
+ for (const voteAccount of oldVoteAccounts) {
37
+ const tokenMint = voteAccount.mint.toString();
38
+ const tokenPrice = tokenPriceByMint.get(tokenMint);
39
+ if (!tokenPrice)
40
+ continue;
41
+ const amount = voteAccount.amount.div(Math.pow(10, tokenPrice.decimals)).toNumber();
42
+ const asset = (0, tokenPriceToAssetToken_1.default)(tokenMint, amount, portfolio_core_1.NetworkId.solana, tokenPrice);
43
+ assets.push(asset);
44
+ }
45
+ if (assets.length === 0)
46
+ return [];
47
+ return [
48
+ {
49
+ networkId: portfolio_core_1.NetworkId.solana,
50
+ platformId: constants_1.platformId,
51
+ type: 'multiple',
52
+ label: 'Deposit',
53
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
54
+ data: {
55
+ assets,
56
+ },
57
+ },
58
+ ];
59
+ });
60
+ const fetcher = {
61
+ id: `${constants_1.platformId}-deposits`,
62
+ networkId: portfolio_core_1.NetworkId.solana,
63
+ executor,
64
+ };
65
+ exports.default = fetcher;
66
+ //# sourceMappingURL=depositsFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAGpC,2CAAwD;AACxD,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA8C;AAC9C,uCAA+C;AAC/C,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,eAAe,GAAG,MAAM,IAAA,i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C,IAAI,CAAC,KAAK,CAAC,CAAC;KACpB;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,OAAO;QACL;YACE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,EAAE;gBACJ,MAAM;aACP;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,20 @@
1
+ export declare const voteAccountFilters: (address: string) => ({
2
+ dataSize: number;
3
+ memcmp?: undefined;
4
+ } | {
5
+ memcmp: {
6
+ offset: number;
7
+ bytes: string;
8
+ };
9
+ dataSize?: undefined;
10
+ })[];
11
+ export declare const voterAccountFilters: (address: string) => ({
12
+ dataSize: number;
13
+ memcmp?: undefined;
14
+ } | {
15
+ memcmp: {
16
+ offset: number;
17
+ bytes: string;
18
+ };
19
+ dataSize?: undefined;
20
+ })[];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.voterAccountFilters = exports.voteAccountFilters = void 0;
4
+ const structs_1 = require("./structs");
5
+ const voteAccountFilters = (address) => [
6
+ { dataSize: structs_1.voteAccountStruct.byteSize },
7
+ {
8
+ memcmp: {
9
+ offset: 65,
10
+ bytes: address,
11
+ },
12
+ },
13
+ ];
14
+ exports.voteAccountFilters = voteAccountFilters;
15
+ const voterAccountFilters = (address) => [
16
+ { dataSize: structs_1.voterStruct.byteSize },
17
+ {
18
+ memcmp: {
19
+ offset: 8,
20
+ bytes: address,
21
+ },
22
+ },
23
+ ];
24
+ exports.voterAccountFilters = voterAccountFilters;
25
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/filters.ts"],"names":[],"mappings":";;;AAAA,uCAA2D;AAEpD,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC;IACrD,EAAE,QAAQ,EAAE,2BAAiB,CAAC,QAAQ,EAAE;IACxC;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,OAAO;SACf;KACF;CACF,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEK,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC;IACtD,EAAE,QAAQ,EAAE,qBAAW,CAAC,QAAQ,EAAE;IAClC;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,OAAO;SACf;KACF;CACF,CAAC;AARW,QAAA,mBAAmB,uBAQ9B"}
@@ -0,0 +1,6 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { Fetcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ export declare const jobs: Job[];
5
+ export declare const fetchers: Fetcher[];
6
+ export declare const platforms: Platform[];
@@ -0,0 +1,12 @@
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.platforms = exports.fetchers = exports.jobs = void 0;
7
+ const depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
8
+ const constants_1 = require("./constants");
9
+ exports.jobs = [];
10
+ exports.fetchers = [depositsFetcher_1.default];
11
+ exports.platforms = [constants_1.realmsPlatform];
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/index.ts"],"names":[],"mappings":";;;;;;AAGA,wEAAgD;AAChD,2CAA6C;AAEhC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,yBAAe,CAAC,CAAC;AACxC,QAAA,SAAS,GAAe,CAAC,0BAAc,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ /// <reference types="node" />
2
+ import { BeetStruct } from '@metaplex-foundation/beet';
3
+ import { PublicKey } from '@solana/web3.js';
4
+ import BigNumber from 'bignumber.js';
5
+ export declare enum LockupKind {
6
+ 'None' = 0,
7
+ 'Daily' = 1,
8
+ 'Monthly' = 2,
9
+ 'Cliff' = 3,
10
+ 'Constant' = 4
11
+ }
12
+ export type Lockup = {
13
+ startTs: BigNumber;
14
+ endTs: BigNumber;
15
+ kind: LockupKind;
16
+ reserved: number[];
17
+ };
18
+ export declare const lockupStruct: BeetStruct<Lockup, Partial<Lockup>>;
19
+ export type VoteAccount = {
20
+ version: number;
21
+ realm: PublicKey;
22
+ mint: PublicKey;
23
+ owner: PublicKey;
24
+ amount: BigNumber;
25
+ padding: Buffer;
26
+ };
27
+ export declare const voteAccountStruct: BeetStruct<VoteAccount, Partial<VoteAccount>>;
28
+ export type DepositEntry = {
29
+ lockup: Lockup;
30
+ amountDepositedNative: BigNumber;
31
+ amountInitiallyLockedNative: BigNumber;
32
+ isUsed: boolean;
33
+ allowClawback: boolean;
34
+ votingMintConfigIdx: number;
35
+ reserved: number[];
36
+ };
37
+ export declare const depositEntryStruct: BeetStruct<DepositEntry, Partial<DepositEntry>>;
38
+ export type Voter = {
39
+ buffer: Buffer;
40
+ voterAuthority: PublicKey;
41
+ registrar: PublicKey;
42
+ deposits: DepositEntry[];
43
+ voterBump: number;
44
+ voterWeightRecordBump: number;
45
+ reserved: number[];
46
+ };
47
+ export declare const voterStruct: BeetStruct<Voter, Partial<Voter>>;
48
+ export type VotingMintConfig = {
49
+ mint: PublicKey;
50
+ grantAuthority: PublicKey;
51
+ baselineVoteWeightScaledFactor: BigNumber;
52
+ maxExtraLockupVoteWeightScaledFactor: BigNumber;
53
+ lockupSaturationSecs: BigNumber;
54
+ digitShift: number;
55
+ reserved1: number[];
56
+ reserved2: BigNumber[];
57
+ };
58
+ export declare const votingMintConfigStruct: BeetStruct<VotingMintConfig, Partial<VotingMintConfig>>;
59
+ export type Registrar = {
60
+ buffer: Buffer;
61
+ governanceProgramId: PublicKey;
62
+ realm: PublicKey;
63
+ realmGoverningTokenMint: PublicKey;
64
+ realmAuthority: PublicKey;
65
+ reserved1: number[];
66
+ votingMints: VotingMintConfig[];
67
+ timeOffset: BigNumber;
68
+ bump: number;
69
+ reserved2: number[];
70
+ reserved3: BigNumber[];
71
+ };
72
+ export declare const registrarStruct: BeetStruct<Registrar, Partial<Registrar>>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registrarStruct = exports.votingMintConfigStruct = exports.voterStruct = exports.depositEntryStruct = exports.voteAccountStruct = exports.lockupStruct = exports.LockupKind = void 0;
4
+ const beet_1 = require("@metaplex-foundation/beet");
5
+ const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
+ const solana_1 = require("../../utils/solana");
7
+ var LockupKind;
8
+ (function (LockupKind) {
9
+ LockupKind[LockupKind["None"] = 0] = "None";
10
+ LockupKind[LockupKind["Daily"] = 1] = "Daily";
11
+ LockupKind[LockupKind["Monthly"] = 2] = "Monthly";
12
+ LockupKind[LockupKind["Cliff"] = 3] = "Cliff";
13
+ LockupKind[LockupKind["Constant"] = 4] = "Constant";
14
+ })(LockupKind || (exports.LockupKind = LockupKind = {}));
15
+ exports.lockupStruct = new beet_1.BeetStruct([
16
+ ['startTs', solana_1.i64],
17
+ ['endTs', solana_1.i64],
18
+ ['kind', beet_1.u8],
19
+ ['reserved', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 15)],
20
+ ], (args) => args);
21
+ exports.voteAccountStruct = new beet_1.BeetStruct([
22
+ ['version', beet_1.u8],
23
+ ['realm', beet_solana_1.publicKey],
24
+ ['mint', beet_solana_1.publicKey],
25
+ ['owner', beet_solana_1.publicKey],
26
+ ['amount', solana_1.u64],
27
+ ['padding', (0, solana_1.blob)(177)],
28
+ ], (args) => args);
29
+ exports.depositEntryStruct = new beet_1.BeetStruct([
30
+ ['lockup', exports.lockupStruct],
31
+ ['amountDepositedNative', solana_1.u64],
32
+ ['amountInitiallyLockedNative', solana_1.u64],
33
+ ['isUsed', beet_1.bool],
34
+ ['allowClawback', beet_1.bool],
35
+ ['votingMintConfigIdx', beet_1.u8],
36
+ ['reserved', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 29)],
37
+ ], (args) => args);
38
+ exports.voterStruct = new beet_1.BeetStruct([
39
+ ['buffer', (0, solana_1.blob)(8)],
40
+ ['voterAuthority', beet_solana_1.publicKey],
41
+ ['registrar', beet_solana_1.publicKey],
42
+ ['deposits', (0, beet_1.uniformFixedSizeArray)(exports.depositEntryStruct, 32)],
43
+ ['voterBump', beet_1.u8],
44
+ ['voterWeightRecordBump', beet_1.u8],
45
+ ['reserved', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 94)],
46
+ ], (args) => args);
47
+ exports.votingMintConfigStruct = new beet_1.BeetStruct([
48
+ ['mint', beet_solana_1.publicKey],
49
+ ['grantAuthority', beet_solana_1.publicKey],
50
+ ['baselineVoteWeightScaledFactor', solana_1.u64],
51
+ ['maxExtraLockupVoteWeightScaledFactor', solana_1.u64],
52
+ ['lockupSaturationSecs', solana_1.u64],
53
+ ['digitShift', beet_1.i8],
54
+ ['reserved1', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
55
+ ['reserved2', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 7)],
56
+ ], (args) => args);
57
+ exports.registrarStruct = new beet_1.BeetStruct([
58
+ ['buffer', (0, solana_1.blob)(8)],
59
+ ['governanceProgramId', beet_solana_1.publicKey],
60
+ ['realm', beet_solana_1.publicKey],
61
+ ['realmGoverningTokenMint', beet_solana_1.publicKey],
62
+ ['realmAuthority', beet_solana_1.publicKey],
63
+ ['reserved1', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 32)],
64
+ ['votingMints', (0, beet_1.uniformFixedSizeArray)(exports.votingMintConfigStruct, 4)],
65
+ ['timeOffset', solana_1.i64],
66
+ ['bump', beet_1.u8],
67
+ ['reserved2', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
68
+ ['reserved3', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 11)],
69
+ ], (args) => args);
70
+ //# sourceMappingURL=structs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/realms/structs.ts"],"names":[],"mappings":";;;AAAA,oDAMmC;AACnC,kEAA6D;AAG7D,+CAAoD;AAEpD,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,2CAAM,CAAA;IACN,6CAAO,CAAA;IACP,iDAAS,CAAA;IACT,6CAAO,CAAA;IACP,mDAAU,CAAA;AACZ,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AASY,QAAA,YAAY,GAAG,IAAI,iBAAU,CACxC;IACE,CAAC,SAAS,EAAE,YAAG,CAAC;IAChB,CAAC,OAAO,EAAE,YAAG,CAAC;IACd,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,UAAU,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,EAAE,CAAC,CAAC;CAC5C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAc,CACzB,CAAC;AAWW,QAAA,iBAAiB,GAAG,IAAI,iBAAU,CAC7C;IACE,CAAC,SAAS,EAAE,SAAE,CAAC;IACf,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,OAAO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