@keplr-wallet/stores 0.12.298 → 0.12.300-rc.0
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/build/account/babylon.js +19 -7
- package/build/account/babylon.js.map +1 -1
- package/build/account/base.js +7 -5
- package/build/account/base.js.map +1 -1
- package/build/account/cosmos.js +97 -54
- package/build/account/cosmos.js.map +1 -1
- package/build/account/cosmwasm.js +10 -2
- package/build/account/cosmwasm.js.map +1 -1
- package/build/account/secret.js +10 -2
- package/build/account/secret.js.map +1 -1
- package/build/account/store.js +4 -4
- package/build/account/store.js.map +1 -1
- package/build/chain/base.d.ts +122 -1
- package/build/chain/base.js +601 -40
- package/build/chain/base.js.map +1 -1
- package/build/chain/types.d.ts +27 -1
- package/build/common/utils/index.d.ts +2 -2
- package/build/common/utils/index.js.map +1 -1
- package/build/lsm/currency-registrar.js +7 -7
- package/build/lsm/currency-registrar.js.map +1 -1
- package/build/query/balances.js +24 -11
- package/build/query/balances.js.map +1 -1
- package/build/query/chain-query.js +2 -2
- package/build/query/chain-query.js.map +1 -1
- package/build/query/chain-rpc-query.js +2 -2
- package/build/query/chain-rpc-query.js.map +1 -1
- package/build/query/cosmos/balance/balances.js +8 -4
- package/build/query/cosmos/balance/balances.js.map +1 -1
- package/build/query/cosmos/balance/spendable.js +3 -2
- package/build/query/cosmos/balance/spendable.js.map +1 -1
- package/build/query/cosmos/ibc/channel.js +3 -2
- package/build/query/cosmos/ibc/channel.js.map +1 -1
- package/build/query/cosmos/ibc/client-state.js +2 -2
- package/build/query/cosmos/ibc/client-state.js.map +1 -1
- package/build/query/cosmos/ibc/denom-trace.js +6 -8
- package/build/query/cosmos/ibc/denom-trace.js.map +1 -1
- package/build/query/cosmos/staking/babylon-btc-delegation-reward.js +3 -2
- package/build/query/cosmos/staking/babylon-btc-delegation-reward.js.map +1 -1
- package/build/query/cosmos/staking/delegations.js +5 -4
- package/build/query/cosmos/staking/delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-delegations.js +8 -6
- package/build/query/cosmos/staking/initia-delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-unbonding-delegations.js +6 -5
- package/build/query/cosmos/staking/initia-unbonding-delegations.js.map +1 -1
- package/build/query/cosmos/staking/initia-validators.js +3 -3
- package/build/query/cosmos/staking/initia-validators.js.map +1 -1
- package/build/query/cosmos/staking/pool.js +3 -3
- package/build/query/cosmos/staking/pool.js.map +1 -1
- package/build/query/cosmos/staking/rewards.js +13 -10
- package/build/query/cosmos/staking/rewards.js.map +1 -1
- package/build/query/cosmos/staking/unbonding-delegations.js +3 -3
- package/build/query/cosmos/staking/unbonding-delegations.js.map +1 -1
- package/build/query/cosmos/staking/validators.js +2 -3
- package/build/query/cosmos/staking/validators.js.map +1 -1
- package/build/query/cosmwasm/contract-query.js +2 -2
- package/build/query/cosmwasm/contract-query.js.map +1 -1
- package/build/query/cosmwasm/cw20-balance.js +7 -4
- package/build/query/cosmwasm/cw20-balance.js.map +1 -1
- package/build/query/cosmwasm/neutron/staking-rewards.js +10 -8
- package/build/query/cosmwasm/neutron/staking-rewards.js.map +1 -1
- package/build/query/noble/swap/simulate-swap.js +1 -1
- package/build/query/noble/swap/simulate-swap.js.map +1 -1
- package/build/query/osmosis/txfees/fee-tokens/index.js +8 -4
- package/build/query/osmosis/txfees/fee-tokens/index.js.map +1 -1
- package/build/query/secret-wasm/secret20-balance.js +7 -5
- package/build/query/secret-wasm/secret20-balance.js.map +1 -1
- package/build/token-factory/currency-registrar.js +1 -1
- package/build/token-factory/currency-registrar.js.map +1 -1
- package/package.json +11 -11
- package/src/account/babylon.ts +21 -7
- package/src/account/base.ts +7 -5
- package/src/account/cosmos.ts +125 -66
- package/src/account/cosmwasm.ts +12 -3
- package/src/account/secret.ts +12 -3
- package/src/account/store.ts +4 -4
- package/src/chain/base.ts +816 -34
- package/src/chain/types.ts +27 -1
- package/src/common/utils/index.ts +2 -2
- package/src/lsm/currency-registrar.ts +9 -7
- package/src/query/balances.ts +30 -13
- package/src/query/chain-query.ts +6 -2
- package/src/query/chain-rpc-query.ts +6 -2
- package/src/query/cosmos/balance/balances.ts +8 -4
- package/src/query/cosmos/balance/spendable.ts +3 -3
- package/src/query/cosmos/ibc/channel.ts +5 -2
- package/src/query/cosmos/ibc/client-state.ts +2 -2
- package/src/query/cosmos/ibc/denom-trace.ts +7 -7
- package/src/query/cosmos/staking/babylon-btc-delegation-reward.ts +5 -2
- package/src/query/cosmos/staking/delegations.ts +9 -4
- package/src/query/cosmos/staking/initia-delegations.ts +14 -7
- package/src/query/cosmos/staking/initia-unbonding-delegations.ts +12 -6
- package/src/query/cosmos/staking/initia-validators.ts +5 -3
- package/src/query/cosmos/staking/pool.ts +3 -3
- package/src/query/cosmos/staking/rewards.ts +13 -10
- package/src/query/cosmos/staking/unbonding-delegations.ts +7 -3
- package/src/query/cosmos/staking/validators.ts +4 -3
- package/src/query/cosmwasm/contract-query.ts +4 -2
- package/src/query/cosmwasm/cw20-balance.ts +8 -5
- package/src/query/cosmwasm/neutron/staking-rewards.ts +10 -8
- package/src/query/noble/swap/simulate-swap.ts +1 -1
- package/src/query/osmosis/txfees/fee-tokens/index.ts +8 -4
- package/src/query/secret-wasm/secret20-balance.ts +7 -5
- package/src/token-factory/currency-registrar.ts +1 -1
package/src/chain/types.ts
CHANGED
|
@@ -86,11 +86,37 @@ export interface IModularChainInfoImpl<
|
|
|
86
86
|
> {
|
|
87
87
|
readonly embedded: M;
|
|
88
88
|
readonly chainId: string;
|
|
89
|
+
readonly stakeCurrency: Currency | undefined;
|
|
90
|
+
readonly feeCurrencies: FeeCurrency[] | undefined;
|
|
89
91
|
|
|
90
|
-
getCurrencies(
|
|
92
|
+
getCurrencies(): AppCurrency[];
|
|
93
|
+
getCurrenciesByModule(module: ChainInfoModule): AppCurrency[];
|
|
91
94
|
addCurrencies(module: ChainInfoModule, ...currencies: AppCurrency[]): void;
|
|
92
95
|
removeCurrencies(
|
|
93
96
|
module: ChainInfoModule,
|
|
94
97
|
...coinMinimalDenoms: string[]
|
|
95
98
|
): void;
|
|
99
|
+
findCurrency(coinMinimalDenom: string): AppCurrency | undefined;
|
|
100
|
+
forceFindCurrency(coinMinimalDenom: string): AppCurrency;
|
|
101
|
+
findCurrencyWithoutReaction(
|
|
102
|
+
coinMinimalDenom: string
|
|
103
|
+
): AppCurrency | undefined;
|
|
104
|
+
forceFindCurrencyWithoutReaction(coinMinimalDenom: string): AppCurrency;
|
|
105
|
+
findCurrencyAsync(coinMinimalDenom: string): Promise<AppCurrency | undefined>;
|
|
106
|
+
hasFeature(feature: string): boolean;
|
|
107
|
+
addUnknownDenoms(args: {
|
|
108
|
+
module: ChainInfoModule;
|
|
109
|
+
coinMinimalDenoms: string[];
|
|
110
|
+
}): void;
|
|
111
|
+
addUnknownDenomsWithoutReaction(args: {
|
|
112
|
+
module: ChainInfoModule;
|
|
113
|
+
coinMinimalDenoms: string[];
|
|
114
|
+
}): void;
|
|
115
|
+
isCurrencyRegistrationInProgress(coinMinimalDenom: string): boolean;
|
|
116
|
+
matchModules(
|
|
117
|
+
conditions:
|
|
118
|
+
| { or: ChainInfoModule[]; and?: undefined }
|
|
119
|
+
| { and: ChainInfoModule[]; or?: undefined }
|
|
120
|
+
): boolean;
|
|
121
|
+
matchModule(module: ChainInfoModule): boolean;
|
|
96
122
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Currency } from "@keplr-wallet/types";
|
|
2
2
|
import { CoinPrimitive } from "../types";
|
|
3
3
|
import { CoinPretty, Dec, Int } from "@keplr-wallet/unit";
|
|
4
|
-
import {
|
|
4
|
+
import { IModularChainInfoImpl } from "../../chain/types";
|
|
5
5
|
|
|
6
6
|
export class StoreUtils {
|
|
7
7
|
public static toCoinPretties(
|
|
8
|
-
chainInfo:
|
|
8
|
+
chainInfo: IModularChainInfoImpl,
|
|
9
9
|
balances: CoinPrimitive[]
|
|
10
10
|
): CoinPretty[] {
|
|
11
11
|
const result: CoinPretty[] = [];
|
|
@@ -69,7 +69,7 @@ export class LSMCurrencyRegistrar {
|
|
|
69
69
|
done: boolean;
|
|
70
70
|
}
|
|
71
71
|
| undefined {
|
|
72
|
-
if (!this.chainStore.
|
|
72
|
+
if (!this.chainStore.hasModularChain(chainId)) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -78,14 +78,16 @@ export class LSMCurrencyRegistrar {
|
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
const chainInfo = this.chainStore.
|
|
82
|
-
if (!chainInfo.stakeCurrency) {
|
|
81
|
+
const chainInfo = this.chainStore.getModularChain(chainId);
|
|
82
|
+
if (!("cosmos" in chainInfo) || !chainInfo.cosmos.stakeCurrency) {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (
|
|
87
|
-
!chainInfo.bech32Config ||
|
|
88
|
-
!coinMinimalDenom.startsWith(
|
|
87
|
+
!chainInfo.cosmos.bech32Config ||
|
|
88
|
+
!coinMinimalDenom.startsWith(
|
|
89
|
+
chainInfo.cosmos.bech32Config.bech32PrefixValAddr
|
|
90
|
+
)
|
|
89
91
|
) {
|
|
90
92
|
return;
|
|
91
93
|
}
|
|
@@ -99,7 +101,7 @@ export class LSMCurrencyRegistrar {
|
|
|
99
101
|
try {
|
|
100
102
|
Bech32Address.validate(
|
|
101
103
|
valAddress,
|
|
102
|
-
chainInfo.bech32Config?.bech32PrefixValAddr
|
|
104
|
+
chainInfo.cosmos.bech32Config?.bech32PrefixValAddr
|
|
103
105
|
);
|
|
104
106
|
} catch {
|
|
105
107
|
// noop
|
|
@@ -196,7 +198,7 @@ export class LSMCurrencyRegistrar {
|
|
|
196
198
|
|
|
197
199
|
return "Unknown";
|
|
198
200
|
})()}/${id}`,
|
|
199
|
-
coinDecimals: chainInfo.stakeCurrency.coinDecimals,
|
|
201
|
+
coinDecimals: chainInfo.cosmos.stakeCurrency.coinDecimals,
|
|
200
202
|
coinImageUrl: validator.thumbnail || undefined,
|
|
201
203
|
},
|
|
202
204
|
done: !validator.isFetching,
|
package/src/query/balances.ts
CHANGED
|
@@ -74,12 +74,16 @@ export class ObservableQueryBalancesImplMap {
|
|
|
74
74
|
|
|
75
75
|
@computed
|
|
76
76
|
get stakable(): IObservableQueryBalanceImpl | undefined {
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const modularChainInfoImpl = this.chainGetter.getModularChainInfoImpl(
|
|
78
|
+
this.chainId
|
|
79
|
+
);
|
|
80
|
+
const chainInfo = modularChainInfoImpl.embedded;
|
|
81
|
+
|
|
82
|
+
if (!("cosmos" in chainInfo) || !chainInfo.cosmos.stakeCurrency) {
|
|
79
83
|
return undefined;
|
|
80
84
|
}
|
|
81
85
|
|
|
82
|
-
return this.getBalanceInner(chainInfo.stakeCurrency);
|
|
86
|
+
return this.getBalanceInner(chainInfo.cosmos.stakeCurrency);
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
/**
|
|
@@ -87,12 +91,16 @@ export class ObservableQueryBalancesImplMap {
|
|
|
87
91
|
*/
|
|
88
92
|
@computed
|
|
89
93
|
get balances(): IObservableQueryBalanceImpl[] {
|
|
90
|
-
const chainInfo = this.chainGetter.getChain(this.chainId);
|
|
91
|
-
|
|
92
94
|
const result = [];
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
const modularChainInfoImpl = this.chainGetter.getModularChainInfoImpl(
|
|
97
|
+
this.chainId
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const currencies = modularChainInfoImpl.getCurrencies();
|
|
101
|
+
|
|
102
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
103
|
+
const currency = currencies[i];
|
|
96
104
|
const balanceInner = this.getBalanceInner(currency);
|
|
97
105
|
if (balanceInner) {
|
|
98
106
|
result.push(balanceInner);
|
|
@@ -129,7 +137,10 @@ export class ObservableQueryBalancesImplMap {
|
|
|
129
137
|
*/
|
|
130
138
|
@computed
|
|
131
139
|
get positiveNativeUnstakables(): IObservableQueryBalanceImpl[] {
|
|
132
|
-
const chainInfo = this.chainGetter.
|
|
140
|
+
const chainInfo = this.chainGetter.getModularChain(this.chainId);
|
|
141
|
+
if (!("cosmos" in chainInfo)) {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
133
144
|
|
|
134
145
|
const balances = this.balances;
|
|
135
146
|
return balances.filter(
|
|
@@ -137,17 +148,21 @@ export class ObservableQueryBalancesImplMap {
|
|
|
137
148
|
new DenomHelper(bal.currency.coinMinimalDenom).type === "native" &&
|
|
138
149
|
bal.balance.toDec().gt(new Dec(0)) &&
|
|
139
150
|
bal.currency.coinMinimalDenom !==
|
|
140
|
-
chainInfo.stakeCurrency?.coinMinimalDenom
|
|
151
|
+
chainInfo.cosmos.stakeCurrency?.coinMinimalDenom
|
|
141
152
|
);
|
|
142
153
|
}
|
|
143
154
|
|
|
144
155
|
@computed
|
|
145
156
|
get unstakables(): IObservableQueryBalanceImpl[] {
|
|
146
|
-
const chainInfo = this.chainGetter.
|
|
157
|
+
const chainInfo = this.chainGetter.getModularChain(this.chainId);
|
|
158
|
+
if (!("cosmos" in chainInfo)) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
147
161
|
|
|
148
|
-
const currencies = chainInfo.currencies.filter(
|
|
162
|
+
const currencies = chainInfo.cosmos.currencies.filter(
|
|
149
163
|
(cur) =>
|
|
150
|
-
cur.coinMinimalDenom !==
|
|
164
|
+
cur.coinMinimalDenom !==
|
|
165
|
+
chainInfo.cosmos.stakeCurrency?.coinMinimalDenom
|
|
151
166
|
);
|
|
152
167
|
|
|
153
168
|
const result = [];
|
|
@@ -182,7 +197,9 @@ export class ObservableQueryBalancesImplMap {
|
|
|
182
197
|
readonly getBalance = computedFn(
|
|
183
198
|
(currency: AppCurrency): IObservableQueryBalanceImpl | undefined => {
|
|
184
199
|
const bal = this.balances.find(
|
|
185
|
-
(bal) =>
|
|
200
|
+
(bal) =>
|
|
201
|
+
DenomHelper.normalizeDenom(bal.currency.coinMinimalDenom) ===
|
|
202
|
+
DenomHelper.normalizeDenom(currency.coinMinimalDenom)
|
|
186
203
|
);
|
|
187
204
|
if (bal) {
|
|
188
205
|
return bal;
|
package/src/query/chain-query.ts
CHANGED
|
@@ -16,9 +16,13 @@ export class ObservableChainQuery<
|
|
|
16
16
|
chainGetter: ChainGetter,
|
|
17
17
|
url: string
|
|
18
18
|
) {
|
|
19
|
-
const
|
|
19
|
+
const modularChainInfo = chainGetter.getModularChain(chainId);
|
|
20
20
|
|
|
21
|
-
super(
|
|
21
|
+
super(
|
|
22
|
+
sharedContext,
|
|
23
|
+
"cosmos" in modularChainInfo ? modularChainInfo.cosmos.rest : "",
|
|
24
|
+
url
|
|
25
|
+
);
|
|
22
26
|
|
|
23
27
|
this._chainId = chainId;
|
|
24
28
|
this.chainGetter = chainGetter;
|
|
@@ -16,9 +16,13 @@ export class ObservableChainQueryRPC<
|
|
|
16
16
|
chainGetter: ChainGetter,
|
|
17
17
|
url: string
|
|
18
18
|
) {
|
|
19
|
-
const
|
|
19
|
+
const modularChainInfo = chainGetter.getModularChain(chainId);
|
|
20
20
|
|
|
21
|
-
super(
|
|
21
|
+
super(
|
|
22
|
+
sharedContext,
|
|
23
|
+
"cosmos" in modularChainInfo ? modularChainInfo.cosmos.rpc : "",
|
|
24
|
+
url
|
|
25
|
+
);
|
|
22
26
|
|
|
23
27
|
this._chainId = chainId;
|
|
24
28
|
this.chainGetter = chainGetter;
|
|
@@ -47,9 +47,12 @@ export class ObservableQueryCosmosBalancesImplParent extends ObservableChainQuer
|
|
|
47
47
|
) {
|
|
48
48
|
super.onReceiveResponse(response);
|
|
49
49
|
|
|
50
|
-
const chainInfo = this.chainGetter.
|
|
50
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
51
51
|
const denoms = response.data.balances.map((coin) => coin.denom);
|
|
52
|
-
chainInfo.addUnknownDenoms(
|
|
52
|
+
chainInfo.addUnknownDenoms({
|
|
53
|
+
module: "cosmos",
|
|
54
|
+
coinMinimalDenoms: denoms,
|
|
55
|
+
});
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -83,8 +86,9 @@ export class ObservableQueryCosmosBalancesImpl
|
|
|
83
86
|
get currency(): AppCurrency {
|
|
84
87
|
const denom = this.denomHelper.denom;
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
return this.chainGetter
|
|
90
|
+
.getModularChainInfoImpl(this.chainId)
|
|
91
|
+
.forceFindCurrency(denom);
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
get error(): Readonly<QueryError<unknown>> | undefined {
|
|
@@ -31,10 +31,10 @@ export class ObservableChainQuerySpendableBalances extends ObservableChainQuery<
|
|
|
31
31
|
|
|
32
32
|
const res: CoinPretty[] = [];
|
|
33
33
|
|
|
34
|
-
const chainInfo = this.chainGetter.getChain(this.chainId);
|
|
35
|
-
|
|
36
34
|
for (const bal of this.response.data.balances) {
|
|
37
|
-
const currency =
|
|
35
|
+
const currency = this.chainGetter
|
|
36
|
+
.getModularChainInfoImpl(this.chainId)
|
|
37
|
+
.findCurrency(bal.denom);
|
|
38
38
|
if (currency) {
|
|
39
39
|
res.push(new CoinPretty(currency, bal.amount));
|
|
40
40
|
}
|
|
@@ -29,8 +29,11 @@ export class ObservableChainQueryIBCChannel extends ObservableChainQuery<Channel
|
|
|
29
29
|
super.onStart();
|
|
30
30
|
|
|
31
31
|
this.disposer = autorun(() => {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
if (
|
|
33
|
+
this.chainGetter
|
|
34
|
+
.getModularChainInfoImpl(this.chainId)
|
|
35
|
+
.hasFeature("ibc-go")
|
|
36
|
+
) {
|
|
34
37
|
this.setUrl(
|
|
35
38
|
`/ibc/core/channel/v1/channels/${this.channelId}/ports/${this.portId}`
|
|
36
39
|
);
|
|
@@ -29,8 +29,8 @@ export class ObservableChainQueryClientState extends ObservableChainQuery<Client
|
|
|
29
29
|
super.onStart();
|
|
30
30
|
|
|
31
31
|
this.disposer = autorun(() => {
|
|
32
|
-
const chainInfo = this.chainGetter.
|
|
33
|
-
if (chainInfo.
|
|
32
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
33
|
+
if (chainInfo.hasFeature("ibc-go")) {
|
|
34
34
|
this.setUrl(
|
|
35
35
|
`/ibc/core/channel/v1/channels/${this.channelId}/ports/${this.portId}/client_state`
|
|
36
36
|
);
|
|
@@ -30,13 +30,13 @@ export class ObservableChainQueryDenomTrace extends ObservableChainQuery<
|
|
|
30
30
|
super.onStart();
|
|
31
31
|
|
|
32
32
|
this.disposer = autorun(() => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
33
|
+
const modularChainInfoImpl = this.chainGetter.getModularChainInfoImpl(
|
|
34
|
+
this.chainId
|
|
35
|
+
);
|
|
36
|
+
if (modularChainInfoImpl.hasFeature("ibc-v2")) {
|
|
37
|
+
this.setUrl(`/ibc/apps/transfer/v1/denoms/${this.hash}`);
|
|
38
|
+
} else if (modularChainInfoImpl.hasFeature("ibc-go")) {
|
|
39
|
+
this.setUrl(`/ibc/apps/transfer/v1/denom_traces/${this.hash}`);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -32,13 +32,16 @@ export class ObservableQueryBabylonBtcDelegationRewardInner extends ObservableCh
|
|
|
32
32
|
// If bech32 address is empty, it will always fail, so don't need to fetch it.
|
|
33
33
|
return (
|
|
34
34
|
this.bech32Address.length > 0 ||
|
|
35
|
-
this.chainGetter.
|
|
35
|
+
this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency !=
|
|
36
|
+
null
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
@computed
|
|
40
41
|
get claimable(): CoinPretty | undefined {
|
|
41
|
-
const stakeCurrency = this.chainGetter.
|
|
42
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
43
|
+
this.chainId
|
|
44
|
+
).stakeCurrency;
|
|
42
45
|
|
|
43
46
|
if (!stakeCurrency) {
|
|
44
47
|
return;
|
|
@@ -33,13 +33,16 @@ export class ObservableQueryDelegationsInner extends ObservableChainQuery<Delega
|
|
|
33
33
|
// If bech32 address is empty, it will always fail, so don't need to fetch it.
|
|
34
34
|
return (
|
|
35
35
|
this.bech32Address.length > 0 ||
|
|
36
|
-
this.chainGetter.
|
|
36
|
+
this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency !=
|
|
37
|
+
null
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
@computed
|
|
41
42
|
get total(): CoinPretty | undefined {
|
|
42
|
-
const stakeCurrency = this.chainGetter.
|
|
43
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
44
|
+
this.chainId
|
|
45
|
+
).stakeCurrency;
|
|
43
46
|
|
|
44
47
|
if (!stakeCurrency) {
|
|
45
48
|
return;
|
|
@@ -69,7 +72,9 @@ export class ObservableQueryDelegationsInner extends ObservableChainQuery<Delega
|
|
|
69
72
|
return [];
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
const stakeCurrency = this.chainGetter.
|
|
75
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
76
|
+
this.chainId
|
|
77
|
+
).stakeCurrency;
|
|
73
78
|
|
|
74
79
|
if (!stakeCurrency) {
|
|
75
80
|
return [];
|
|
@@ -108,7 +113,7 @@ export class ObservableQueryDelegationsInner extends ObservableChainQuery<Delega
|
|
|
108
113
|
(validatorAddress: string): CoinPretty | undefined => {
|
|
109
114
|
const delegations = this.delegations;
|
|
110
115
|
|
|
111
|
-
const stakeCurrency = this.chainGetter.
|
|
116
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
112
117
|
this.chainId
|
|
113
118
|
).stakeCurrency;
|
|
114
119
|
|
|
@@ -34,15 +34,16 @@ export class ObservableQueryInitiaDelegationsInner extends ObservableChainQuery<
|
|
|
34
34
|
// If bech32 address is empty, it will always fail, so don't need to fetch it.
|
|
35
35
|
return (
|
|
36
36
|
this.bech32Address.length > 0 ||
|
|
37
|
-
this.chainGetter.
|
|
37
|
+
this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency !=
|
|
38
|
+
null
|
|
38
39
|
);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
// a function to extract amount from delegation balance
|
|
42
43
|
// For Initia chain, the balance is an array of Coin
|
|
43
44
|
protected getAmountFromBalanceArray(balance: Coin[]): string {
|
|
44
|
-
const stakeDenom = this.chainGetter.
|
|
45
|
-
?.coinMinimalDenom;
|
|
45
|
+
const stakeDenom = this.chainGetter.getModularChainInfoImpl(this.chainId)
|
|
46
|
+
.stakeCurrency?.coinMinimalDenom;
|
|
46
47
|
|
|
47
48
|
if (!stakeDenom) {
|
|
48
49
|
return "0";
|
|
@@ -54,7 +55,9 @@ export class ObservableQueryInitiaDelegationsInner extends ObservableChainQuery<
|
|
|
54
55
|
|
|
55
56
|
@computed
|
|
56
57
|
get total(): CoinPretty | undefined {
|
|
57
|
-
const stakeCurrency = this.chainGetter.
|
|
58
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
59
|
+
this.chainId
|
|
60
|
+
).stakeCurrency;
|
|
58
61
|
|
|
59
62
|
if (!stakeCurrency) {
|
|
60
63
|
return;
|
|
@@ -86,7 +89,9 @@ export class ObservableQueryInitiaDelegationsInner extends ObservableChainQuery<
|
|
|
86
89
|
return [];
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
const stakeCurrency = this.chainGetter.
|
|
92
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
93
|
+
this.chainId
|
|
94
|
+
).stakeCurrency;
|
|
90
95
|
|
|
91
96
|
if (!stakeCurrency) {
|
|
92
97
|
return [];
|
|
@@ -116,7 +121,9 @@ export class ObservableQueryInitiaDelegationsInner extends ObservableChainQuery<
|
|
|
116
121
|
return [];
|
|
117
122
|
}
|
|
118
123
|
|
|
119
|
-
const stakeCurrency = this.chainGetter.
|
|
124
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
125
|
+
this.chainId
|
|
126
|
+
).stakeCurrency;
|
|
120
127
|
|
|
121
128
|
return this.response.data.delegation_responses
|
|
122
129
|
.filter((del) => {
|
|
@@ -138,7 +145,7 @@ export class ObservableQueryInitiaDelegationsInner extends ObservableChainQuery<
|
|
|
138
145
|
(validatorAddress: string): CoinPretty | undefined => {
|
|
139
146
|
const delegations = this.delegations;
|
|
140
147
|
|
|
141
|
-
const stakeCurrency = this.chainGetter.
|
|
148
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
142
149
|
this.chainId
|
|
143
150
|
).stakeCurrency;
|
|
144
151
|
|
|
@@ -30,7 +30,7 @@ export class ObservableQueryInitiaUnbondingDelegationsInner extends ObservableCh
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
protected override canFetch(): boolean {
|
|
33
|
-
if (!this.chainGetter.
|
|
33
|
+
if (!this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
36
|
// If bech32 address is empty, it will always fail, so don't need to fetch it.
|
|
@@ -40,8 +40,8 @@ export class ObservableQueryInitiaUnbondingDelegationsInner extends ObservableCh
|
|
|
40
40
|
// a function to extract amount from unbonding balance
|
|
41
41
|
// For Initia chain, the balance is an array of Coin
|
|
42
42
|
protected getAmountFromBalanceArray(balance: Coin[]): string {
|
|
43
|
-
const stakeDenom = this.chainGetter.
|
|
44
|
-
?.coinMinimalDenom;
|
|
43
|
+
const stakeDenom = this.chainGetter.getModularChainInfoImpl(this.chainId)
|
|
44
|
+
.stakeCurrency?.coinMinimalDenom;
|
|
45
45
|
|
|
46
46
|
if (!stakeDenom) {
|
|
47
47
|
return "0";
|
|
@@ -53,7 +53,9 @@ export class ObservableQueryInitiaUnbondingDelegationsInner extends ObservableCh
|
|
|
53
53
|
|
|
54
54
|
@computed
|
|
55
55
|
get total(): CoinPretty | undefined {
|
|
56
|
-
const stakeCurrency = this.chainGetter.
|
|
56
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
57
|
+
this.chainId
|
|
58
|
+
).stakeCurrency;
|
|
57
59
|
|
|
58
60
|
if (!stakeCurrency) {
|
|
59
61
|
return;
|
|
@@ -88,7 +90,9 @@ export class ObservableQueryInitiaUnbondingDelegationsInner extends ObservableCh
|
|
|
88
90
|
}[] {
|
|
89
91
|
const unbondings = this.unbondings;
|
|
90
92
|
|
|
91
|
-
const stakeCurrency = this.chainGetter.
|
|
93
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
94
|
+
this.chainId
|
|
95
|
+
).stakeCurrency;
|
|
92
96
|
|
|
93
97
|
if (!stakeCurrency) {
|
|
94
98
|
return [];
|
|
@@ -126,7 +130,9 @@ export class ObservableQueryInitiaUnbondingDelegationsInner extends ObservableCh
|
|
|
126
130
|
return [];
|
|
127
131
|
}
|
|
128
132
|
|
|
129
|
-
const stakeCurrency = this.chainGetter.
|
|
133
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
134
|
+
this.chainId
|
|
135
|
+
).stakeCurrency;
|
|
130
136
|
|
|
131
137
|
return this.response.data.unbonding_responses.map((unbonding) => {
|
|
132
138
|
const filtered = unbonding.entries.filter((entry) =>
|
|
@@ -42,7 +42,7 @@ export class ObservableQueryInitiaValidatorsInner extends ObservableChainQuery<I
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
protected override canFetch(): boolean {
|
|
45
|
-
if (!this.chainGetter.
|
|
45
|
+
if (!this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency) {
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
48
|
return super.canFetch();
|
|
@@ -54,7 +54,9 @@ export class ObservableQueryInitiaValidatorsInner extends ObservableChainQuery<I
|
|
|
54
54
|
return [];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const stakeCurrency = this.chainGetter.
|
|
57
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
58
|
+
this.chainId
|
|
59
|
+
).stakeCurrency;
|
|
58
60
|
|
|
59
61
|
if (!stakeCurrency) {
|
|
60
62
|
return [];
|
|
@@ -148,7 +150,7 @@ export class ObservableQueryInitiaValidatorsInner extends ObservableChainQuery<I
|
|
|
148
150
|
return;
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
const chainInfo = this.chainGetter.
|
|
153
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
152
154
|
const stakeCurrency = chainInfo.stakeCurrency;
|
|
153
155
|
|
|
154
156
|
if (!stakeCurrency) {
|
|
@@ -23,7 +23,7 @@ export class ObservableQueryStakingPool extends ObservableChainQuery<StakingPool
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
protected override canFetch(): boolean {
|
|
26
|
-
if (!this.chainGetter.
|
|
26
|
+
if (!this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency) {
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
return super.canFetch();
|
|
@@ -31,7 +31,7 @@ export class ObservableQueryStakingPool extends ObservableChainQuery<StakingPool
|
|
|
31
31
|
|
|
32
32
|
@computed
|
|
33
33
|
get notBondedTokens(): CoinPretty | undefined {
|
|
34
|
-
const chainInfo = this.chainGetter.
|
|
34
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
35
35
|
|
|
36
36
|
if (!chainInfo.stakeCurrency) {
|
|
37
37
|
return;
|
|
@@ -52,7 +52,7 @@ export class ObservableQueryStakingPool extends ObservableChainQuery<StakingPool
|
|
|
52
52
|
|
|
53
53
|
@computed
|
|
54
54
|
get bondedTokens(): CoinPretty | undefined {
|
|
55
|
-
const chainInfo = this.chainGetter.
|
|
55
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
56
56
|
|
|
57
57
|
if (!chainInfo.stakeCurrency) {
|
|
58
58
|
return;
|
|
@@ -35,7 +35,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
protected override canFetch(): boolean {
|
|
38
|
-
if (!this.chainGetter.
|
|
38
|
+
if (!this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
// If bech32 address is empty, it will always fail, so don't need to fetch it.
|
|
@@ -44,7 +44,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
44
44
|
|
|
45
45
|
@computed
|
|
46
46
|
get rewards(): CoinPretty[] {
|
|
47
|
-
const chainInfo = this.chainGetter.
|
|
47
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
48
48
|
|
|
49
49
|
if (!this.response || !this.response.data.rewards) {
|
|
50
50
|
return [];
|
|
@@ -75,7 +75,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
75
75
|
|
|
76
76
|
readonly getRewardsOf = computedFn(
|
|
77
77
|
(validatorAddress: string): CoinPretty[] => {
|
|
78
|
-
const chainInfo = this.chainGetter.
|
|
78
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
79
79
|
|
|
80
80
|
const rewards = this.response?.data.rewards?.find((r) => {
|
|
81
81
|
return r.validator_address === validatorAddress;
|
|
@@ -109,7 +109,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
109
109
|
|
|
110
110
|
@computed
|
|
111
111
|
get stakableReward(): CoinPretty | undefined {
|
|
112
|
-
const chainInfo = this.chainGetter.
|
|
112
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
113
113
|
|
|
114
114
|
if (!chainInfo.stakeCurrency) {
|
|
115
115
|
return;
|
|
@@ -127,7 +127,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
127
127
|
|
|
128
128
|
readonly getStakableRewardOf = computedFn(
|
|
129
129
|
(validatorAddress: string): CoinPretty | undefined => {
|
|
130
|
-
const chainInfo = this.chainGetter.
|
|
130
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
131
131
|
|
|
132
132
|
if (!chainInfo.stakeCurrency) {
|
|
133
133
|
return;
|
|
@@ -147,7 +147,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
147
147
|
|
|
148
148
|
@computed
|
|
149
149
|
get unstakableRewards(): CoinPretty[] {
|
|
150
|
-
const chainInfo = this.chainGetter.
|
|
150
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
151
151
|
|
|
152
152
|
return this.rewards.filter((r) => {
|
|
153
153
|
return (
|
|
@@ -162,7 +162,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
162
162
|
return this.getRewardsOf(validatorAddress).filter((r) => {
|
|
163
163
|
return (
|
|
164
164
|
r.currency.coinMinimalDenom !==
|
|
165
|
-
this.chainGetter.
|
|
165
|
+
this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency
|
|
166
166
|
?.coinMinimalDenom
|
|
167
167
|
);
|
|
168
168
|
});
|
|
@@ -202,7 +202,7 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
202
202
|
return [];
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
const chainInfo = this.chainGetter.
|
|
205
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
206
206
|
|
|
207
207
|
if (!chainInfo.stakeCurrency) {
|
|
208
208
|
return [];
|
|
@@ -250,9 +250,12 @@ export class ObservableQueryRewardsInner extends ObservableChainQuery<Rewards> {
|
|
|
250
250
|
) {
|
|
251
251
|
super.onReceiveResponse(response);
|
|
252
252
|
|
|
253
|
-
const chainInfo = this.chainGetter.
|
|
253
|
+
const chainInfo = this.chainGetter.getModularChainInfoImpl(this.chainId);
|
|
254
254
|
const denoms = response.data.total.map((coin) => coin.denom);
|
|
255
|
-
chainInfo.addUnknownDenoms(
|
|
255
|
+
chainInfo.addUnknownDenoms({
|
|
256
|
+
module: "cosmos",
|
|
257
|
+
coinMinimalDenoms: denoms,
|
|
258
|
+
});
|
|
256
259
|
}
|
|
257
260
|
}
|
|
258
261
|
|
|
@@ -29,7 +29,7 @@ export class ObservableQueryUnbondingDelegationsInner extends ObservableChainQue
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
protected override canFetch(): boolean {
|
|
32
|
-
if (!this.chainGetter.
|
|
32
|
+
if (!this.chainGetter.getModularChainInfoImpl(this.chainId).stakeCurrency) {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
35
|
// If bech32 address is empty, it will always fail, so don't need to fetch it.
|
|
@@ -38,7 +38,9 @@ export class ObservableQueryUnbondingDelegationsInner extends ObservableChainQue
|
|
|
38
38
|
|
|
39
39
|
@computed
|
|
40
40
|
get total(): CoinPretty | undefined {
|
|
41
|
-
const stakeCurrency = this.chainGetter.
|
|
41
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
42
|
+
this.chainId
|
|
43
|
+
).stakeCurrency;
|
|
42
44
|
|
|
43
45
|
if (!stakeCurrency) {
|
|
44
46
|
return;
|
|
@@ -72,7 +74,9 @@ export class ObservableQueryUnbondingDelegationsInner extends ObservableChainQue
|
|
|
72
74
|
}[] {
|
|
73
75
|
const unbondings = this.unbondings;
|
|
74
76
|
|
|
75
|
-
const stakeCurrency = this.chainGetter.
|
|
77
|
+
const stakeCurrency = this.chainGetter.getModularChainInfoImpl(
|
|
78
|
+
this.chainId
|
|
79
|
+
).stakeCurrency;
|
|
76
80
|
|
|
77
81
|
if (!stakeCurrency) {
|
|
78
82
|
return [];
|