@keplr-wallet/stores 0.13.36 → 0.13.38

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.
@@ -1,7 +1,3 @@
1
1
  export * from "./cw20-balance";
2
2
  export * as CosmWasm from "./types";
3
3
  export * from "./queries";
4
- export * from "./neutron/staking-rewards";
5
- export * from "./neutron/staking-rewards-config";
6
- export * from "./neutron/governance-proposals";
7
- export * from "./neutron/governance-vote";
@@ -30,8 +30,4 @@ exports.CosmWasm = void 0;
30
30
  __exportStar(require("./cw20-balance"), exports);
31
31
  exports.CosmWasm = __importStar(require("./types"));
32
32
  __exportStar(require("./queries"), exports);
33
- __exportStar(require("./neutron/staking-rewards"), exports);
34
- __exportStar(require("./neutron/staking-rewards-config"), exports);
35
- __exportStar(require("./neutron/governance-proposals"), exports);
36
- __exportStar(require("./neutron/governance-vote"), exports);
37
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/query/cosmwasm/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,oDAAoC;AACpC,4CAA0B;AAC1B,4DAA0C;AAC1C,mEAAiD;AACjD,iEAA+C;AAC/C,4DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/query/cosmwasm/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,oDAAoC;AACpC,4CAA0B"}
@@ -3,10 +3,6 @@ import { ChainGetter } from "../../chain";
3
3
  import { ObservableQueryCw20ContractInfo } from "./cw20-contract-info";
4
4
  import { DeepReadonly } from "utility-types";
5
5
  import { QuerySharedContext } from "../../common";
6
- import { ObservableQueryNeutronStakingRewards } from "./neutron/staking-rewards";
7
- import { ObservableQueryNeutronStakingRewardsConfig } from "./neutron/staking-rewards-config";
8
- import { ObservableQueryNeutronGovernance } from "./neutron/governance-proposals";
9
- import { ObservableQueryNeutronProposalVote } from "./neutron/governance-vote";
10
6
  export interface CosmwasmQueries {
11
7
  cosmwasm: CosmwasmQueriesImpl;
12
8
  }
@@ -15,9 +11,5 @@ export declare const CosmwasmQueries: {
15
11
  };
16
12
  export declare class CosmwasmQueriesImpl {
17
13
  readonly querycw20ContractInfo: DeepReadonly<ObservableQueryCw20ContractInfo>;
18
- readonly queryNeutronStakingRewards: DeepReadonly<ObservableQueryNeutronStakingRewards>;
19
- readonly queryNeutronStakingRewardsConfig: DeepReadonly<ObservableQueryNeutronStakingRewardsConfig>;
20
- readonly queryNeutronGovernance: DeepReadonly<ObservableQueryNeutronGovernance>;
21
- readonly queryNeutronVote: DeepReadonly<ObservableQueryNeutronProposalVote>;
22
14
  constructor(base: QueriesSetBase, sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter);
23
15
  }
@@ -3,10 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CosmwasmQueriesImpl = exports.CosmwasmQueries = void 0;
4
4
  const cw20_contract_info_1 = require("./cw20-contract-info");
5
5
  const cw20_balance_1 = require("./cw20-balance");
6
- const staking_rewards_1 = require("./neutron/staking-rewards");
7
- const staking_rewards_config_1 = require("./neutron/staking-rewards-config");
8
- const governance_proposals_1 = require("./neutron/governance-proposals");
9
- const governance_vote_1 = require("./neutron/governance-vote");
10
6
  exports.CosmwasmQueries = {
11
7
  use() {
12
8
  return (queriesSetBase, sharedContext, chainId, chainGetter) => {
@@ -20,11 +16,6 @@ class CosmwasmQueriesImpl {
20
16
  constructor(base, sharedContext, chainId, chainGetter) {
21
17
  base.queryBalances.addBalanceRegistry(new cw20_balance_1.ObservableQueryCw20BalanceRegistry(sharedContext));
22
18
  this.querycw20ContractInfo = new cw20_contract_info_1.ObservableQueryCw20ContractInfo(sharedContext, chainId, chainGetter);
23
- this.queryNeutronStakingRewards = new staking_rewards_1.ObservableQueryNeutronStakingRewards(sharedContext, chainId, chainGetter);
24
- this.queryNeutronStakingRewardsConfig =
25
- new staking_rewards_config_1.ObservableQueryNeutronStakingRewardsConfig(sharedContext, chainId, chainGetter);
26
- this.queryNeutronGovernance = new governance_proposals_1.ObservableQueryNeutronGovernance(sharedContext, chainId, chainGetter);
27
- this.queryNeutronVote = new governance_vote_1.ObservableQueryNeutronProposalVote(sharedContext, chainId, chainGetter);
28
19
  }
29
20
  }
30
21
  exports.CosmwasmQueriesImpl = CosmwasmQueriesImpl;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/query/cosmwasm/queries.ts"],"names":[],"mappings":";;;AAEA,6DAAuE;AAEvE,iDAAoE;AAEpE,+DAAiF;AACjF,6EAA8F;AAC9F,yEAAkF;AAClF,+DAA+E;AAMlE,QAAA,eAAe,GAAG;IAC7B,GAAG;QAMD,OAAO,CACL,cAA8B,EAC9B,aAAiC,EACjC,OAAe,EACf,WAAwB,EACxB,EAAE;YACF,OAAO;gBACL,QAAQ,EAAE,IAAI,mBAAmB,CAC/B,cAAc,EACd,aAAa,EACb,OAAO,EACP,WAAW,CACZ;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAa,mBAAmB;IAO9B,YACE,IAAoB,EACpB,aAAiC,EACjC,OAAe,EACf,WAAwB;QAExB,IAAI,CAAC,aAAa,CAAC,kBAAkB,CACnC,IAAI,iDAAkC,CAAC,aAAa,CAAC,CACtD,CAAC;QAEF,IAAI,CAAC,qBAAqB,GAAG,IAAI,oDAA+B,CAC9D,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QAEF,IAAI,CAAC,0BAA0B,GAAG,IAAI,sDAAoC,CACxE,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QAEF,IAAI,CAAC,gCAAgC;YACnC,IAAI,mEAA0C,CAC5C,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QAEJ,IAAI,CAAC,sBAAsB,GAAG,IAAI,uDAAgC,CAChE,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QAEF,IAAI,CAAC,gBAAgB,GAAG,IAAI,oDAAkC,CAC5D,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;IACJ,CAAC;CACF;AAhDD,kDAgDC"}
1
+ {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/query/cosmwasm/queries.ts"],"names":[],"mappings":";;;AAEA,6DAAuE;AAEvE,iDAAoE;AAOvD,QAAA,eAAe,GAAG;IAC7B,GAAG;QAMD,OAAO,CACL,cAA8B,EAC9B,aAAiC,EACjC,OAAe,EACf,WAAwB,EACxB,EAAE;YACF,OAAO;gBACL,QAAQ,EAAE,IAAI,mBAAmB,CAC/B,cAAc,EACd,aAAa,EACb,OAAO,EACP,WAAW,CACZ;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAa,mBAAmB;IAG9B,YACE,IAAoB,EACpB,aAAiC,EACjC,OAAe,EACf,WAAwB;QAExB,IAAI,CAAC,aAAa,CAAC,kBAAkB,CACnC,IAAI,iDAAkC,CAAC,aAAa,CAAC,CACtD,CAAC;QAEF,IAAI,CAAC,qBAAqB,GAAG,IAAI,oDAA+B,CAC9D,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;IACJ,CAAC;CACF;AAnBD,kDAmBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keplr-wallet/stores",
3
- "version": "0.13.36",
3
+ "version": "0.13.38",
4
4
  "main": "build/index.js",
5
5
  "author": "chainapsis",
6
6
  "license": "Apache-2.0",
@@ -21,18 +21,18 @@
21
21
  "typecheck": "npx tsc -p tsconfig.check.json"
22
22
  },
23
23
  "devDependencies": {
24
- "@keplr-wallet/provider-mock": "0.13.36"
24
+ "@keplr-wallet/provider-mock": "0.13.38"
25
25
  },
26
26
  "dependencies": {
27
27
  "@ethersproject/address": "^5.7.0",
28
- "@keplr-wallet/common": "0.13.36",
29
- "@keplr-wallet/cosmos": "0.13.36",
30
- "@keplr-wallet/crypto": "0.13.36",
31
- "@keplr-wallet/mobx-utils": "0.13.36",
32
- "@keplr-wallet/proto-types": "0.13.36",
33
- "@keplr-wallet/simple-fetch": "0.13.36",
34
- "@keplr-wallet/types": "0.13.36",
35
- "@keplr-wallet/unit": "0.13.36",
28
+ "@keplr-wallet/common": "0.13.38",
29
+ "@keplr-wallet/cosmos": "0.13.38",
30
+ "@keplr-wallet/crypto": "0.13.38",
31
+ "@keplr-wallet/mobx-utils": "0.13.38",
32
+ "@keplr-wallet/proto-types": "0.13.38",
33
+ "@keplr-wallet/simple-fetch": "0.13.38",
34
+ "@keplr-wallet/types": "0.13.38",
35
+ "@keplr-wallet/unit": "0.13.38",
36
36
  "buffer": "^6.0.3",
37
37
  "deepmerge": "^4.2.2",
38
38
  "eventemitter3": "^4.0.7",
@@ -44,5 +44,5 @@
44
44
  "mobx": "^6",
45
45
  "mobx-utils": "^6"
46
46
  },
47
- "gitHead": "43bf315aca3d27f9e5965a8caf9eaa0ae4ad2529"
47
+ "gitHead": "33b91d45cfde21cc8bba19a84afd842c7a195a8b"
48
48
  }
@@ -1,7 +1,3 @@
1
1
  export * from "./cw20-balance";
2
2
  export * as CosmWasm from "./types";
3
3
  export * from "./queries";
4
- export * from "./neutron/staking-rewards";
5
- export * from "./neutron/staking-rewards-config";
6
- export * from "./neutron/governance-proposals";
7
- export * from "./neutron/governance-vote";
@@ -4,10 +4,6 @@ import { ObservableQueryCw20ContractInfo } from "./cw20-contract-info";
4
4
  import { DeepReadonly } from "utility-types";
5
5
  import { ObservableQueryCw20BalanceRegistry } from "./cw20-balance";
6
6
  import { QuerySharedContext } from "../../common";
7
- import { ObservableQueryNeutronStakingRewards } from "./neutron/staking-rewards";
8
- import { ObservableQueryNeutronStakingRewardsConfig } from "./neutron/staking-rewards-config";
9
- import { ObservableQueryNeutronGovernance } from "./neutron/governance-proposals";
10
- import { ObservableQueryNeutronProposalVote } from "./neutron/governance-vote";
11
7
 
12
8
  export interface CosmwasmQueries {
13
9
  cosmwasm: CosmwasmQueriesImpl;
@@ -40,10 +36,6 @@ export const CosmwasmQueries = {
40
36
 
41
37
  export class CosmwasmQueriesImpl {
42
38
  public readonly querycw20ContractInfo: DeepReadonly<ObservableQueryCw20ContractInfo>;
43
- public readonly queryNeutronStakingRewards: DeepReadonly<ObservableQueryNeutronStakingRewards>;
44
- public readonly queryNeutronStakingRewardsConfig: DeepReadonly<ObservableQueryNeutronStakingRewardsConfig>;
45
- public readonly queryNeutronGovernance: DeepReadonly<ObservableQueryNeutronGovernance>;
46
- public readonly queryNeutronVote: DeepReadonly<ObservableQueryNeutronProposalVote>;
47
39
 
48
40
  constructor(
49
41
  base: QueriesSetBase,
@@ -60,30 +52,5 @@ export class CosmwasmQueriesImpl {
60
52
  chainId,
61
53
  chainGetter
62
54
  );
63
-
64
- this.queryNeutronStakingRewards = new ObservableQueryNeutronStakingRewards(
65
- sharedContext,
66
- chainId,
67
- chainGetter
68
- );
69
-
70
- this.queryNeutronStakingRewardsConfig =
71
- new ObservableQueryNeutronStakingRewardsConfig(
72
- sharedContext,
73
- chainId,
74
- chainGetter
75
- );
76
-
77
- this.queryNeutronGovernance = new ObservableQueryNeutronGovernance(
78
- sharedContext,
79
- chainId,
80
- chainGetter
81
- );
82
-
83
- this.queryNeutronVote = new ObservableQueryNeutronProposalVote(
84
- sharedContext,
85
- chainId,
86
- chainGetter
87
- );
88
55
  }
89
56
  }
@@ -1,64 +0,0 @@
1
- import { ChainGetter } from "../../../chain";
2
- import { QuerySharedContext } from "../../../common";
3
- import { ObservableChainQueryMap } from "../../chain-query";
4
- export declare enum NeutronGovProposalStatus {
5
- OPEN = "open",
6
- PASSED = "passed",
7
- REJECTED = "rejected",
8
- EXECUTED = "executed",
9
- CLOSED = "closed",
10
- EXECUTION_FAILED = "execution_failed"
11
- }
12
- interface NeutronGovThreshold {
13
- threshold_quorum?: {
14
- threshold: string;
15
- quorum: string;
16
- };
17
- absolute_percentage?: {
18
- percentage: string;
19
- };
20
- }
21
- interface NeutronGovProposal {
22
- id: number;
23
- title: string;
24
- description: string;
25
- proposer: string;
26
- start_height: number;
27
- min_voting_period: null;
28
- expiration: {
29
- at_time?: string;
30
- at_height?: string;
31
- };
32
- threshold: NeutronGovThreshold;
33
- total_power: string;
34
- msgs: unknown[];
35
- status: NeutronGovProposalStatus;
36
- votes: {
37
- yes: string;
38
- no: string;
39
- abstain: string;
40
- };
41
- allow_revoting: boolean;
42
- }
43
- interface NeutronGovProposalsResponse {
44
- proposals: {
45
- id: number;
46
- proposal: NeutronGovProposal;
47
- }[];
48
- }
49
- export declare class ObservableQueryNeutronGovernance extends ObservableChainQueryMap<NeutronGovProposalsResponse> {
50
- constructor(sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter);
51
- getQueryGovernanceWithPage(params: {
52
- page: number;
53
- perPageNumber: number;
54
- }): {
55
- proposals: {
56
- id: number;
57
- proposal: NeutronGovProposal;
58
- }[];
59
- firstFetching: boolean;
60
- nextKey: number | null;
61
- isFetching: boolean;
62
- };
63
- }
64
- export {};
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ObservableQueryNeutronGovernance = exports.NeutronGovProposalStatus = void 0;
10
- const contract_query_1 = require("../contract-query");
11
- const chain_query_1 = require("../../chain-query");
12
- const mobx_1 = require("mobx");
13
- var NeutronGovProposalStatus;
14
- (function (NeutronGovProposalStatus) {
15
- NeutronGovProposalStatus["OPEN"] = "open";
16
- NeutronGovProposalStatus["PASSED"] = "passed";
17
- NeutronGovProposalStatus["REJECTED"] = "rejected";
18
- NeutronGovProposalStatus["EXECUTED"] = "executed";
19
- NeutronGovProposalStatus["CLOSED"] = "closed";
20
- NeutronGovProposalStatus["EXECUTION_FAILED"] = "execution_failed";
21
- })(NeutronGovProposalStatus = exports.NeutronGovProposalStatus || (exports.NeutronGovProposalStatus = {}));
22
- class ObservableQueryNeutronGovernanceInner extends contract_query_1.ObservableCosmwasmContractChainQuery {
23
- constructor(sharedContext, chainId, chainGetter, params) {
24
- const contractAddress = chainId === "neutron-1"
25
- ? ObservableQueryNeutronGovernanceInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET
26
- : chainId === "pion-1"
27
- ? ObservableQueryNeutronGovernanceInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET
28
- : "";
29
- super(sharedContext, chainId, chainGetter, contractAddress, {
30
- reverse_proposals: params || { limit: 20 },
31
- });
32
- this.params = params;
33
- }
34
- canFetch() {
35
- return (super.canFetch() &&
36
- (this.chainId === "neutron-1" || this.chainId === "pion-1"));
37
- }
38
- get proposals() {
39
- var _a;
40
- if (!((_a = this.response) === null || _a === void 0 ? void 0 : _a.data)) {
41
- return [];
42
- }
43
- return this.response.data.proposals || [];
44
- }
45
- }
46
- ObservableQueryNeutronGovernanceInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET = "neutron1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshlt6zh";
47
- ObservableQueryNeutronGovernanceInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET = "neutron19sf2y4dvgt02kczemvhktrwvt4aunrahw8qkjq6u3pehdujwssgqrs5e4h";
48
- __decorate([
49
- mobx_1.computed
50
- ], ObservableQueryNeutronGovernanceInner.prototype, "proposals", null);
51
- class ObservableQueryNeutronGovernance extends chain_query_1.ObservableChainQueryMap {
52
- constructor(sharedContext, chainId, chainGetter) {
53
- super(sharedContext, chainId, chainGetter, (param) => {
54
- const parsedParams = JSON.parse(param);
55
- return new ObservableQueryNeutronGovernanceInner(this.sharedContext, this.chainId, this.chainGetter, parsedParams);
56
- });
57
- }
58
- getQueryGovernanceWithPage(params) {
59
- var _a;
60
- const list = Array.from({ length: params.page + 1 }, (_, i) => {
61
- return JSON.stringify({
62
- start_before: i === 0 ? undefined : i * params.perPageNumber,
63
- limit: params.perPageNumber,
64
- });
65
- });
66
- const proposals = list.flatMap((param) => {
67
- const query = this.get(param);
68
- return query.proposals;
69
- });
70
- const lastQuery = this.get(list[list.length - 1]);
71
- const nextKey = lastQuery.proposals.length === params.perPageNumber
72
- ? (_a = proposals[proposals.length - 1]) === null || _a === void 0 ? void 0 : _a.id
73
- : null;
74
- return {
75
- proposals,
76
- firstFetching: lastQuery.isFetching && proposals.length === 0,
77
- nextKey,
78
- isFetching: lastQuery.isFetching,
79
- };
80
- }
81
- }
82
- exports.ObservableQueryNeutronGovernance = ObservableQueryNeutronGovernance;
83
- //# sourceMappingURL=governance-proposals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"governance-proposals.js","sourceRoot":"","sources":["../../../../src/query/cosmwasm/neutron/governance-proposals.ts"],"names":[],"mappings":";;;;;;;;;AACA,sDAAyE;AAEzE,mDAA4D;AAC5D,+BAAgC;AAEhC,IAAY,wBAOX;AAPD,WAAY,wBAAwB;IAClC,yCAAa,CAAA;IACb,6CAAiB,CAAA;IACjB,iDAAqB,CAAA;IACrB,iDAAqB,CAAA;IACrB,6CAAiB,CAAA;IACjB,iEAAqC,CAAA;AACvC,CAAC,EAPW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAOnC;AA0CD,MAAM,qCAAsC,SAAQ,qDAAiE;IAMnH,YACE,aAAiC,EACjC,OAAe,EACf,WAAwB,EACL,MAAiD;QAEpE,MAAM,eAAe,GACnB,OAAO,KAAK,WAAW;YACrB,CAAC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AAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAC5D,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,aAAa;gBAC5D,KAAK,EAAE,MAAM,CAAC,aAAa;aAC5B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAA0C,CAAC;YACvE,OAAO,KAAK,CAAC,SAAS,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CACxB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CACmB,CAAC;QAE3C,MAAM,OAAO,GACX,SAAS,CAAC,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,aAAa;YACjD,CAAC,CAAC,MAAA,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,EAAE;YACrC,CAAC,CAAC,IAAI,CAAC;QAEX,OAAO;YACL,SAAS;YACT,aAAa,EAAE,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAC7D,OAAO;YACP,UAAU,EAAE,SAAS,CAAC,UAAU;SACjC,CAAC;IACJ,CAAC;CACF;AAnDD,4EAmDC"}
@@ -1,27 +0,0 @@
1
- import { ChainGetter } from "../../../chain";
2
- import { ObservableCosmwasmContractChainQuery } from "../contract-query";
3
- import { QuerySharedContext } from "../../../common";
4
- import { ObservableChainQueryMap } from "../../chain-query";
5
- interface NeutronGovVote {
6
- voter: string;
7
- vote: "yes" | "no" | "abstain";
8
- power: string;
9
- }
10
- interface NeutronGovVoteResponse {
11
- vote: NeutronGovVote | null;
12
- }
13
- declare class ObservableQueryNeutronProposalVoteInner extends ObservableCosmwasmContractChainQuery<NeutronGovVoteResponse> {
14
- static readonly NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET = "neutron1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshlt6zh";
15
- static readonly NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET = "neutron19sf2y4dvgt02kczemvhktrwvt4aunrahw8qkjq6u3pehdujwssgqrs5e4h";
16
- protected proposalId: string;
17
- protected bech32Address: string;
18
- constructor(sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter, proposalId: string, bech32Address: string);
19
- get vote(): "Yes" | "Abstain" | "No" | "NoWithVeto" | "Unspecified";
20
- refetch(): void;
21
- protected canFetch(): boolean;
22
- }
23
- export declare class ObservableQueryNeutronProposalVote extends ObservableChainQueryMap<NeutronGovVoteResponse> {
24
- constructor(sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter);
25
- getVote(proposalId: string, voter: string): ObservableQueryNeutronProposalVoteInner;
26
- }
27
- export {};
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ObservableQueryNeutronProposalVote = void 0;
10
- const contract_query_1 = require("../contract-query");
11
- const chain_query_1 = require("../../chain-query");
12
- const mobx_1 = require("mobx");
13
- class ObservableQueryNeutronProposalVoteInner extends contract_query_1.ObservableCosmwasmContractChainQuery {
14
- constructor(sharedContext, chainId, chainGetter, proposalId, bech32Address) {
15
- const contractAddress = chainId === "neutron-1"
16
- ? ObservableQueryNeutronProposalVoteInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET
17
- : chainId === "pion-1"
18
- ? ObservableQueryNeutronProposalVoteInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET
19
- : "";
20
- super(sharedContext, chainId, chainGetter, contractAddress, {
21
- get_vote: { proposal_id: parseInt(proposalId), voter: bech32Address },
22
- });
23
- this.proposalId = proposalId;
24
- this.bech32Address = bech32Address;
25
- }
26
- get vote() {
27
- var _a, _b;
28
- if (!((_b = (_a = this.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.vote)) {
29
- return "Unspecified";
30
- }
31
- const voteOption = this.response.data.vote.vote;
32
- switch (voteOption) {
33
- case "yes":
34
- return "Yes";
35
- case "abstain":
36
- return "Abstain";
37
- case "no":
38
- return "No";
39
- default:
40
- return "Unspecified";
41
- }
42
- }
43
- refetch() {
44
- this.fetch();
45
- }
46
- canFetch() {
47
- return (super.canFetch() &&
48
- this.bech32Address.length > 0 &&
49
- (this.chainId === "neutron-1" || this.chainId === "pion-1"));
50
- }
51
- }
52
- ObservableQueryNeutronProposalVoteInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET = "neutron1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshlt6zh";
53
- ObservableQueryNeutronProposalVoteInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET = "neutron19sf2y4dvgt02kczemvhktrwvt4aunrahw8qkjq6u3pehdujwssgqrs5e4h";
54
- __decorate([
55
- mobx_1.computed
56
- ], ObservableQueryNeutronProposalVoteInner.prototype, "vote", null);
57
- class ObservableQueryNeutronProposalVote extends chain_query_1.ObservableChainQueryMap {
58
- constructor(sharedContext, chainId, chainGetter) {
59
- super(sharedContext, chainId, chainGetter, (param) => {
60
- const { proposalId, voter } = JSON.parse(param);
61
- return new ObservableQueryNeutronProposalVoteInner(this.sharedContext, this.chainId, this.chainGetter, proposalId, voter);
62
- });
63
- }
64
- getVote(proposalId, voter) {
65
- const param = JSON.stringify({
66
- proposalId,
67
- voter,
68
- });
69
- return this.get(param);
70
- }
71
- }
72
- exports.ObservableQueryNeutronProposalVote = ObservableQueryNeutronProposalVote;
73
- //# sourceMappingURL=governance-vote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"governance-vote.js","sourceRoot":"","sources":["../../../../src/query/cosmwasm/neutron/governance-vote.ts"],"names":[],"mappings":";;;;;;;;;AACA,sDAAyE;AAEzE,mDAA4D;AAC5D,+BAAgC;AAYhC,MAAM,uCAAwC,SAAQ,qDAA4D;IAShH,YACE,aAAiC,EACjC,OAAe,EACf,WAAwB,EACxB,UAAkB,EAClB,aAAqB;QAErB,MAAM,eAAe,GACnB,OAAO,KAAK,WAAW;YACrB,CAAC,CAAC,uCAAuC,CAAC,uCAAuC;YACjF,CAAC,CAAC,OAAO,KAAK,QAAQ;gBACtB,CAAC,CAAC,uCAAuC,CAAC,uCAAuC;gBACjF,CAAC,CAAC,EAAE,CAAC;QAET,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE;YAC1D,QAAQ,EAAE,EAAE,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE;SACtE,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAGD,IAAI,IAAI;;QACN,IAAI,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,0CAAE,IAAI,CAAA,EAAE;YAC9B,OAAO,aAAa,CAAC;SACtB;QAED,MAAM,UAAU,GAAG,IA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pE,CAAC;CACF;AA9BD,gFA8BC"}
@@ -1,18 +0,0 @@
1
- import { ChainGetter } from "../../../chain";
2
- import { ObservableCosmwasmContractChainQuery } from "../contract-query";
3
- import { QuerySharedContext } from "../../../common";
4
- interface NeutronStakingRewardsConfigResponse {
5
- owner?: string;
6
- dao_address?: string;
7
- staking_info_proxy?: string;
8
- annual_reward_rate_bps?: number;
9
- blocks_per_year?: number;
10
- staking_denom?: string;
11
- }
12
- export declare class ObservableQueryNeutronStakingRewardsConfig extends ObservableCosmwasmContractChainQuery<NeutronStakingRewardsConfigResponse> {
13
- static readonly NEUTRON_REWARDS_CONTRACT_ADDRESS = "neutron1gqq3c735pj6ese3yru5xr6ud0fvxgltxesygvyyzpsrt74v6yg4sgkrgwq";
14
- constructor(sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter);
15
- protected canFetch(): boolean;
16
- get config(): NeutronStakingRewardsConfigResponse;
17
- }
18
- export {};
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ObservableQueryNeutronStakingRewardsConfig = void 0;
10
- const mobx_1 = require("mobx");
11
- const contract_query_1 = require("../contract-query");
12
- class ObservableQueryNeutronStakingRewardsConfig extends contract_query_1.ObservableCosmwasmContractChainQuery {
13
- constructor(sharedContext, chainId, chainGetter) {
14
- super(sharedContext, chainId, chainGetter, ObservableQueryNeutronStakingRewardsConfig.NEUTRON_REWARDS_CONTRACT_ADDRESS, {
15
- config: {},
16
- });
17
- (0, mobx_1.makeObservable)(this);
18
- }
19
- canFetch() {
20
- return super.canFetch();
21
- }
22
- get config() {
23
- var _a, _b;
24
- if (!((_a = this.response) === null || _a === void 0 ? void 0 : _a.data)) {
25
- return {
26
- owner: "",
27
- dao_address: "",
28
- staking_info_proxy: "",
29
- annual_reward_rate_bps: 0,
30
- blocks_per_year: 0,
31
- staking_denom: "",
32
- };
33
- }
34
- return (_b = this.response) === null || _b === void 0 ? void 0 : _b.data;
35
- }
36
- }
37
- ObservableQueryNeutronStakingRewardsConfig.NEUTRON_REWARDS_CONTRACT_ADDRESS = "neutron1gqq3c735pj6ese3yru5xr6ud0fvxgltxesygvyyzpsrt74v6yg4sgkrgwq";
38
- __decorate([
39
- mobx_1.computed
40
- ], ObservableQueryNeutronStakingRewardsConfig.prototype, "config", null);
41
- exports.ObservableQueryNeutronStakingRewardsConfig = ObservableQueryNeutronStakingRewardsConfig;
42
- //# sourceMappingURL=staking-rewards-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"staking-rewards-config.js","sourceRoot":"","sources":["../../../../src/query/cosmwasm/neutron/staking-rewards-config.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+BAAgD;AAEhD,sDAAyE;AAYzE,MAAa,0CAA2C,SAAQ,qDAAyE;IAIvI,YACE,aAAiC,EACjC,OAAe,EACf,WAAwB;QAExB,KAAK,CACH,aAAa,EACb,OAAO,EACP,WAAW,EACX,0CAA0C,CAAC,gCAAgC,EAC3E;YACE,MAAM,EAAE,EAAE;SACX,CACF,CAAC;QACF,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAEkB,QAAQ;QACzB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAGD,IAAI,MAAM;;QACR,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAA,EAAE;YACxB,OAAO;gBACL,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,EAAE;gBACf,kBAAkB,EAAE,EAAE;gBACtB,sBAAsB,EAAE,CAAC;gBACzB,eAAe,EAAE,CAAC;gBAClB,aAAa,EAAE,EAAE;aAClB,CAAC;SACH;QACD,OAAO,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC;IAC7B,CAAC;;AArCsB,2EAAgC,GACrD,oEAAoE,CAAC;AAwBvE;IADC,eAAQ;wEAaR;AAtCU,gGAA0C"}
@@ -1,25 +0,0 @@
1
- import { ChainGetter } from "../../../chain";
2
- import { CoinPretty } from "@keplr-wallet/unit";
3
- import { ObservableCosmwasmContractChainQuery } from "../contract-query";
4
- import { QuerySharedContext } from "../../../common";
5
- import { AppCurrency } from "@keplr-wallet/types";
6
- import { ObservableChainQueryMap } from "../../chain-query";
7
- interface NeutronStakingRewardsResponse {
8
- pending_rewards?: {
9
- denom?: string;
10
- amount?: string;
11
- };
12
- }
13
- declare class ObservableQueryNeutronStakingRewardsInner extends ObservableCosmwasmContractChainQuery<NeutronStakingRewardsResponse> {
14
- protected readonly bech32Address: string;
15
- static readonly NEUTRON_REWARDS_CONTRACT_ADDRESS = "neutron1gqq3c735pj6ese3yru5xr6ud0fvxgltxesygvyyzpsrt74v6yg4sgkrgwq";
16
- constructor(sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter, bech32Address: string);
17
- protected canFetch(): boolean;
18
- get pendingReward(): CoinPretty;
19
- get rewardCurrency(): AppCurrency | undefined;
20
- }
21
- export declare class ObservableQueryNeutronStakingRewards extends ObservableChainQueryMap<NeutronStakingRewardsResponse> {
22
- constructor(sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter);
23
- getRewardFor(bech32Address: string): ObservableQueryNeutronStakingRewardsInner;
24
- }
25
- export {};
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ObservableQueryNeutronStakingRewards = void 0;
10
- const chain_1 = require("../../../chain");
11
- const unit_1 = require("@keplr-wallet/unit");
12
- const contract_query_1 = require("../contract-query");
13
- const chain_query_1 = require("../../chain-query");
14
- const mobx_1 = require("mobx");
15
- class ObservableQueryNeutronStakingRewardsInner extends contract_query_1.ObservableCosmwasmContractChainQuery {
16
- constructor(sharedContext, chainId, chainGetter, bech32Address) {
17
- super(sharedContext, chainId, chainGetter, ObservableQueryNeutronStakingRewardsInner.NEUTRON_REWARDS_CONTRACT_ADDRESS, {
18
- rewards: { user: bech32Address },
19
- });
20
- this.bech32Address = bech32Address;
21
- }
22
- canFetch() {
23
- return super.canFetch() && this.bech32Address !== "";
24
- }
25
- get pendingReward() {
26
- var _a, _b;
27
- if (!((_b = (_a = this.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.pending_rewards)) {
28
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
29
- const cosmosInfo = (0, chain_1.requireCosmosInfo)(mcInfo2);
30
- const defaultCurrency = cosmosInfo.stakeCurrency || cosmosInfo.currencies[0];
31
- return new unit_1.CoinPretty(defaultCurrency, new unit_1.Int(0)).ready(false);
32
- }
33
- const reward = this.response.data.pending_rewards;
34
- if (!reward.denom || !reward.amount) {
35
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
36
- const cosmosInfo = (0, chain_1.requireCosmosInfo)(mcInfo2);
37
- const defaultCurrency = cosmosInfo.stakeCurrency || cosmosInfo.currencies[0];
38
- return new unit_1.CoinPretty(defaultCurrency, new unit_1.Int(0)).ready(false);
39
- }
40
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
41
- const currency = mcInfo2.forceFindCurrency(reward.denom);
42
- return new unit_1.CoinPretty(currency, new unit_1.Int(reward.amount)).ready(!this.isFetching);
43
- }
44
- get rewardCurrency() {
45
- var _a, _b;
46
- if (!((_b = (_a = this.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.pending_rewards)) {
47
- return undefined;
48
- }
49
- const reward = this.response.data.pending_rewards;
50
- if (!reward.denom || !reward.amount) {
51
- return undefined;
52
- }
53
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
54
- return mcInfo2.findCurrency(reward.denom);
55
- }
56
- }
57
- ObservableQueryNeutronStakingRewardsInner.NEUTRON_REWARDS_CONTRACT_ADDRESS = "neutron1gqq3c735pj6ese3yru5xr6ud0fvxgltxesygvyyzpsrt74v6yg4sgkrgwq";
58
- __decorate([
59
- mobx_1.computed
60
- ], ObservableQueryNeutronStakingRewardsInner.prototype, "pendingReward", null);
61
- __decorate([
62
- mobx_1.computed
63
- ], ObservableQueryNeutronStakingRewardsInner.prototype, "rewardCurrency", null);
64
- class ObservableQueryNeutronStakingRewards extends chain_query_1.ObservableChainQueryMap {
65
- constructor(sharedContext, chainId, chainGetter) {
66
- super(sharedContext, chainId, chainGetter, (contractAddress) => {
67
- return new ObservableQueryNeutronStakingRewardsInner(this.sharedContext, this.chainId, this.chainGetter, contractAddress);
68
- });
69
- }
70
- getRewardFor(bech32Address) {
71
- return this.get(bech32Address);
72
- }
73
- }
74
- exports.ObservableQueryNeutronStakingRewards = ObservableQueryNeutronStakingRewards;
75
- //# sourceMappingURL=staking-rewards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"staking-rewards.js","sourceRoot":"","sources":["../../../../src/query/cosmwasm/neutron/staking-rewards.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0CAAgE;AAChE,6CAAqD;AACrD,sDAAyE;AAGzE,mDAA4D;AAC5D,+BAA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O,IAAI,yCAAyC,CAClD,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,WAAW,EAChB,eAAe,CAChB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CACV,aAAqB;QAErB,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,CAA8C,CAAC;IAC9E,CAAC;CACF;AArBD,oFAqBC"}
@@ -1,150 +0,0 @@
1
- import { ChainGetter } from "../../../chain";
2
- import { ObservableCosmwasmContractChainQuery } from "../contract-query";
3
- import { QuerySharedContext } from "../../../common";
4
- import { ObservableChainQueryMap } from "../../chain-query";
5
- import { computed } from "mobx";
6
-
7
- export enum NeutronGovProposalStatus {
8
- OPEN = "open",
9
- PASSED = "passed",
10
- REJECTED = "rejected",
11
- EXECUTED = "executed",
12
- CLOSED = "closed",
13
- EXECUTION_FAILED = "execution_failed",
14
- }
15
-
16
- interface NeutronGovThreshold {
17
- threshold_quorum?: {
18
- threshold: string;
19
- quorum: string;
20
- };
21
- absolute_percentage?: {
22
- percentage: string;
23
- };
24
- }
25
-
26
- interface NeutronGovProposal {
27
- id: number;
28
- title: string;
29
- description: string;
30
- proposer: string;
31
- start_height: number;
32
- min_voting_period: null;
33
- expiration: {
34
- at_time?: string;
35
- at_height?: string;
36
- };
37
- threshold: NeutronGovThreshold;
38
- total_power: string;
39
- msgs: unknown[];
40
- status: NeutronGovProposalStatus;
41
- votes: {
42
- yes: string;
43
- no: string;
44
- abstain: string;
45
- };
46
- allow_revoting: boolean;
47
- }
48
-
49
- interface NeutronGovProposalsResponse {
50
- proposals: {
51
- id: number;
52
- proposal: NeutronGovProposal;
53
- }[];
54
- }
55
-
56
- class ObservableQueryNeutronGovernanceInner extends ObservableCosmwasmContractChainQuery<NeutronGovProposalsResponse> {
57
- public static readonly NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET =
58
- "neutron1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshlt6zh";
59
- public static readonly NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET =
60
- "neutron19sf2y4dvgt02kczemvhktrwvt4aunrahw8qkjq6u3pehdujwssgqrs5e4h";
61
-
62
- constructor(
63
- sharedContext: QuerySharedContext,
64
- chainId: string,
65
- chainGetter: ChainGetter,
66
- protected readonly params: { start_before?: number; limit?: number }
67
- ) {
68
- const contractAddress =
69
- chainId === "neutron-1"
70
- ? ObservableQueryNeutronGovernanceInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET
71
- : chainId === "pion-1"
72
- ? ObservableQueryNeutronGovernanceInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET
73
- : "";
74
-
75
- super(sharedContext, chainId, chainGetter, contractAddress, {
76
- reverse_proposals: params || { limit: 20 },
77
- });
78
- }
79
-
80
- protected override canFetch(): boolean {
81
- return (
82
- super.canFetch() &&
83
- (this.chainId === "neutron-1" || this.chainId === "pion-1")
84
- );
85
- }
86
-
87
- @computed
88
- get proposals(): {
89
- id: number;
90
- proposal: NeutronGovProposal;
91
- }[] {
92
- if (!this.response?.data) {
93
- return [];
94
- }
95
- return this.response.data.proposals || [];
96
- }
97
- }
98
-
99
- export class ObservableQueryNeutronGovernance extends ObservableChainQueryMap<NeutronGovProposalsResponse> {
100
- constructor(
101
- sharedContext: QuerySharedContext,
102
- chainId: string,
103
- chainGetter: ChainGetter
104
- ) {
105
- super(sharedContext, chainId, chainGetter, (param: string) => {
106
- const parsedParams = JSON.parse(param);
107
- return new ObservableQueryNeutronGovernanceInner(
108
- this.sharedContext,
109
- this.chainId,
110
- this.chainGetter,
111
- parsedParams
112
- );
113
- });
114
- }
115
-
116
- getQueryGovernanceWithPage(params: { page: number; perPageNumber: number }): {
117
- proposals: { id: number; proposal: NeutronGovProposal }[];
118
- firstFetching: boolean;
119
- nextKey: number | null;
120
- isFetching: boolean;
121
- } {
122
- const list = Array.from({ length: params.page + 1 }, (_, i) => {
123
- return JSON.stringify({
124
- start_before: i === 0 ? undefined : i * params.perPageNumber,
125
- limit: params.perPageNumber,
126
- });
127
- });
128
-
129
- const proposals = list.flatMap((param) => {
130
- const query = this.get(param) as ObservableQueryNeutronGovernanceInner;
131
- return query.proposals;
132
- });
133
-
134
- const lastQuery = this.get(
135
- list[list.length - 1]
136
- ) as ObservableQueryNeutronGovernanceInner;
137
-
138
- const nextKey =
139
- lastQuery.proposals.length === params.perPageNumber
140
- ? proposals[proposals.length - 1]?.id
141
- : null;
142
-
143
- return {
144
- proposals,
145
- firstFetching: lastQuery.isFetching && proposals.length === 0,
146
- nextKey,
147
- isFetching: lastQuery.isFetching,
148
- };
149
- }
150
- }
@@ -1,109 +0,0 @@
1
- import { ChainGetter } from "../../../chain";
2
- import { ObservableCosmwasmContractChainQuery } from "../contract-query";
3
- import { QuerySharedContext } from "../../../common";
4
- import { ObservableChainQueryMap } from "../../chain-query";
5
- import { computed } from "mobx";
6
-
7
- interface NeutronGovVote {
8
- voter: string;
9
- vote: "yes" | "no" | "abstain";
10
- power: string;
11
- }
12
-
13
- interface NeutronGovVoteResponse {
14
- vote: NeutronGovVote | null;
15
- }
16
-
17
- class ObservableQueryNeutronProposalVoteInner extends ObservableCosmwasmContractChainQuery<NeutronGovVoteResponse> {
18
- public static readonly NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET =
19
- "neutron1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshlt6zh";
20
- public static readonly NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET =
21
- "neutron19sf2y4dvgt02kczemvhktrwvt4aunrahw8qkjq6u3pehdujwssgqrs5e4h";
22
-
23
- protected proposalId: string;
24
- protected bech32Address: string;
25
-
26
- constructor(
27
- sharedContext: QuerySharedContext,
28
- chainId: string,
29
- chainGetter: ChainGetter,
30
- proposalId: string,
31
- bech32Address: string
32
- ) {
33
- const contractAddress =
34
- chainId === "neutron-1"
35
- ? ObservableQueryNeutronProposalVoteInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_MAINNET
36
- : chainId === "pion-1"
37
- ? ObservableQueryNeutronProposalVoteInner.NEUTRON_PROPOSAL_MODULE_ADDRESS_TESTNET
38
- : "";
39
-
40
- super(sharedContext, chainId, chainGetter, contractAddress, {
41
- get_vote: { proposal_id: parseInt(proposalId), voter: bech32Address },
42
- });
43
- this.proposalId = proposalId;
44
- this.bech32Address = bech32Address;
45
- }
46
-
47
- @computed
48
- get vote(): "Yes" | "Abstain" | "No" | "NoWithVeto" | "Unspecified" {
49
- if (!this.response?.data?.vote) {
50
- return "Unspecified";
51
- }
52
-
53
- const voteOption = this.response.data.vote.vote;
54
- switch (voteOption) {
55
- case "yes":
56
- return "Yes";
57
- case "abstain":
58
- return "Abstain";
59
- case "no":
60
- return "No";
61
- default:
62
- return "Unspecified";
63
- }
64
- }
65
-
66
- refetch() {
67
- this.fetch();
68
- }
69
-
70
- protected override canFetch(): boolean {
71
- return (
72
- super.canFetch() &&
73
- this.bech32Address.length > 0 &&
74
- (this.chainId === "neutron-1" || this.chainId === "pion-1")
75
- );
76
- }
77
- }
78
-
79
- export class ObservableQueryNeutronProposalVote extends ObservableChainQueryMap<NeutronGovVoteResponse> {
80
- constructor(
81
- sharedContext: QuerySharedContext,
82
- chainId: string,
83
- chainGetter: ChainGetter
84
- ) {
85
- super(sharedContext, chainId, chainGetter, (param: string) => {
86
- const { proposalId, voter } = JSON.parse(param);
87
-
88
- return new ObservableQueryNeutronProposalVoteInner(
89
- this.sharedContext,
90
- this.chainId,
91
- this.chainGetter,
92
- proposalId,
93
- voter
94
- );
95
- });
96
- }
97
-
98
- getVote(
99
- proposalId: string,
100
- voter: string
101
- ): ObservableQueryNeutronProposalVoteInner {
102
- const param = JSON.stringify({
103
- proposalId,
104
- voter,
105
- });
106
-
107
- return this.get(param) as ObservableQueryNeutronProposalVoteInner;
108
- }
109
- }
@@ -1,54 +0,0 @@
1
- import { computed, makeObservable } from "mobx";
2
- import { ChainGetter } from "../../../chain";
3
- import { ObservableCosmwasmContractChainQuery } from "../contract-query";
4
- import { QuerySharedContext } from "../../../common";
5
-
6
- interface NeutronStakingRewardsConfigResponse {
7
- owner?: string;
8
- dao_address?: string;
9
- staking_info_proxy?: string;
10
- annual_reward_rate_bps?: number; // APR in basis points (e.g., 500 = 5%)
11
- blocks_per_year?: number;
12
- staking_denom?: string;
13
- }
14
-
15
- export class ObservableQueryNeutronStakingRewardsConfig extends ObservableCosmwasmContractChainQuery<NeutronStakingRewardsConfigResponse> {
16
- public static readonly NEUTRON_REWARDS_CONTRACT_ADDRESS =
17
- "neutron1gqq3c735pj6ese3yru5xr6ud0fvxgltxesygvyyzpsrt74v6yg4sgkrgwq";
18
-
19
- constructor(
20
- sharedContext: QuerySharedContext,
21
- chainId: string,
22
- chainGetter: ChainGetter
23
- ) {
24
- super(
25
- sharedContext,
26
- chainId,
27
- chainGetter,
28
- ObservableQueryNeutronStakingRewardsConfig.NEUTRON_REWARDS_CONTRACT_ADDRESS,
29
- {
30
- config: {},
31
- }
32
- );
33
- makeObservable(this);
34
- }
35
-
36
- protected override canFetch(): boolean {
37
- return super.canFetch();
38
- }
39
-
40
- @computed
41
- get config(): NeutronStakingRewardsConfigResponse {
42
- if (!this.response?.data) {
43
- return {
44
- owner: "",
45
- dao_address: "",
46
- staking_info_proxy: "",
47
- annual_reward_rate_bps: 0,
48
- blocks_per_year: 0,
49
- staking_denom: "",
50
- };
51
- }
52
- return this.response?.data;
53
- }
54
- }
@@ -1,104 +0,0 @@
1
- import { ChainGetter, requireCosmosInfo } from "../../../chain";
2
- import { CoinPretty, Int } from "@keplr-wallet/unit";
3
- import { ObservableCosmwasmContractChainQuery } from "../contract-query";
4
- import { QuerySharedContext } from "../../../common";
5
- import { AppCurrency } from "@keplr-wallet/types";
6
- import { ObservableChainQueryMap } from "../../chain-query";
7
- import { computed } from "mobx";
8
-
9
- interface NeutronStakingRewardsResponse {
10
- pending_rewards?: {
11
- denom?: string;
12
- amount?: string;
13
- };
14
- }
15
-
16
- class ObservableQueryNeutronStakingRewardsInner extends ObservableCosmwasmContractChainQuery<NeutronStakingRewardsResponse> {
17
- public static readonly NEUTRON_REWARDS_CONTRACT_ADDRESS =
18
- "neutron1gqq3c735pj6ese3yru5xr6ud0fvxgltxesygvyyzpsrt74v6yg4sgkrgwq";
19
-
20
- constructor(
21
- sharedContext: QuerySharedContext,
22
- chainId: string,
23
- chainGetter: ChainGetter,
24
- protected readonly bech32Address: string
25
- ) {
26
- super(
27
- sharedContext,
28
- chainId,
29
- chainGetter,
30
- ObservableQueryNeutronStakingRewardsInner.NEUTRON_REWARDS_CONTRACT_ADDRESS,
31
- {
32
- rewards: { user: bech32Address },
33
- }
34
- );
35
- }
36
-
37
- protected override canFetch(): boolean {
38
- return super.canFetch() && this.bech32Address !== "";
39
- }
40
-
41
- @computed
42
- get pendingReward(): CoinPretty {
43
- if (!this.response?.data?.pending_rewards) {
44
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
45
- const cosmosInfo = requireCosmosInfo(mcInfo2);
46
- const defaultCurrency =
47
- cosmosInfo.stakeCurrency || cosmosInfo.currencies[0];
48
-
49
- return new CoinPretty(defaultCurrency, new Int(0)).ready(false);
50
- }
51
-
52
- const reward = this.response.data.pending_rewards;
53
- if (!reward.denom || !reward.amount) {
54
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
55
- const cosmosInfo = requireCosmosInfo(mcInfo2);
56
- const defaultCurrency =
57
- cosmosInfo.stakeCurrency || cosmosInfo.currencies[0];
58
-
59
- return new CoinPretty(defaultCurrency, new Int(0)).ready(false);
60
- }
61
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
62
- const currency = mcInfo2.forceFindCurrency(reward.denom);
63
-
64
- return new CoinPretty(currency, new Int(reward.amount)).ready(
65
- !this.isFetching
66
- );
67
- }
68
-
69
- @computed
70
- get rewardCurrency(): AppCurrency | undefined {
71
- if (!this.response?.data?.pending_rewards) {
72
- return undefined;
73
- }
74
- const reward = this.response.data.pending_rewards;
75
- if (!reward.denom || !reward.amount) {
76
- return undefined;
77
- }
78
- const mcInfo2 = this.chainGetter.getModularChain(this.chainId);
79
- return mcInfo2.findCurrency(reward.denom);
80
- }
81
- }
82
-
83
- export class ObservableQueryNeutronStakingRewards extends ObservableChainQueryMap<NeutronStakingRewardsResponse> {
84
- constructor(
85
- sharedContext: QuerySharedContext,
86
- chainId: string,
87
- chainGetter: ChainGetter
88
- ) {
89
- super(sharedContext, chainId, chainGetter, (contractAddress: string) => {
90
- return new ObservableQueryNeutronStakingRewardsInner(
91
- this.sharedContext,
92
- this.chainId,
93
- this.chainGetter,
94
- contractAddress
95
- );
96
- });
97
- }
98
-
99
- getRewardFor(
100
- bech32Address: string
101
- ): ObservableQueryNeutronStakingRewardsInner {
102
- return this.get(bech32Address) as ObservableQueryNeutronStakingRewardsInner;
103
- }
104
- }