@keplr-wallet/stores-etc 0.12.275 → 0.12.276-rc.1
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/queries.d.ts +4 -1
- package/build/queries.js +4 -2
- package/build/queries.js.map +1 -1
- package/build/tx-msg-decoder/get-tx-interpreter-url-prefix.d.ts +1 -0
- package/build/tx-msg-decoder/get-tx-interpreter-url-prefix.js +56 -0
- package/build/tx-msg-decoder/get-tx-interpreter-url-prefix.js.map +1 -0
- package/build/tx-msg-decoder/index.d.ts +1 -0
- package/build/tx-msg-decoder/index.js +18 -0
- package/build/tx-msg-decoder/index.js.map +1 -0
- package/build/tx-msg-decoder/query.d.ts +23 -0
- package/build/tx-msg-decoder/query.js +30 -0
- package/build/tx-msg-decoder/query.js.map +1 -0
- package/package.json +7 -7
- package/src/queries.ts +13 -2
- package/src/tx-msg-decoder/get-tx-interpreter-url-prefix.ts +51 -0
- package/src/tx-msg-decoder/index.ts +1 -0
- package/src/tx-msg-decoder/query.ts +67 -0
package/build/queries.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ObservableQueryEVMTokenInfo } from "./axelar";
|
|
|
5
5
|
import { ObservableQueryTaxCaps, ObservableQueryTaxRate } from "./terra-classic/treasury";
|
|
6
6
|
import { ObservableQuerySkipTokenInfo } from "./token-info";
|
|
7
7
|
import { ObservableQueryInitiaDynamicFee } from "./initia/dynamicfee";
|
|
8
|
+
import { ObservablePostTxMsgDecoder } from "./tx-msg-decoder";
|
|
8
9
|
export interface KeplrETCQueries {
|
|
9
10
|
keplrETC: KeplrETCQueriesImpl;
|
|
10
11
|
}
|
|
@@ -13,6 +14,7 @@ export declare const KeplrETCQueries: {
|
|
|
13
14
|
ethereumURL: string;
|
|
14
15
|
skipTokenInfoBaseURL: string;
|
|
15
16
|
skipTokenInfoAPIURI: string;
|
|
17
|
+
txCodecBaseURL: string;
|
|
16
18
|
}): (queriesSetBase: QueriesSetBase, sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter) => KeplrETCQueries;
|
|
17
19
|
};
|
|
18
20
|
export declare class KeplrETCQueriesImpl {
|
|
@@ -22,5 +24,6 @@ export declare class KeplrETCQueriesImpl {
|
|
|
22
24
|
readonly queryTerraClassicTaxRate: DeepReadonly<ObservableQueryTaxRate>;
|
|
23
25
|
readonly queryTerraClassicTaxCaps: DeepReadonly<ObservableQueryTaxCaps>;
|
|
24
26
|
readonly queryInitiaDynamicFee: DeepReadonly<ObservableQueryInitiaDynamicFee>;
|
|
25
|
-
|
|
27
|
+
readonly queryTxMsgDecoder: DeepReadonly<ObservablePostTxMsgDecoder>;
|
|
28
|
+
constructor(_base: QueriesSetBase, sharedContext: QuerySharedContext, chainId: string, chainGetter: ChainGetter, ethereumURL: string, skipTokenInfoBaseURL: string, skipTokenInfoAPIURI: string, txCodecBaseURL: string);
|
|
26
29
|
}
|
package/build/queries.js
CHANGED
|
@@ -6,23 +6,25 @@ const axelar_1 = require("./axelar");
|
|
|
6
6
|
const treasury_1 = require("./terra-classic/treasury");
|
|
7
7
|
const token_info_1 = require("./token-info");
|
|
8
8
|
const dynamicfee_1 = require("./initia/dynamicfee");
|
|
9
|
+
const tx_msg_decoder_1 = require("./tx-msg-decoder");
|
|
9
10
|
exports.KeplrETCQueries = {
|
|
10
11
|
use(options) {
|
|
11
12
|
return (queriesSetBase, sharedContext, chainId, chainGetter) => {
|
|
12
13
|
return {
|
|
13
|
-
keplrETC: new KeplrETCQueriesImpl(queriesSetBase, sharedContext, chainId, chainGetter, options.ethereumURL, options.skipTokenInfoBaseURL, options.skipTokenInfoAPIURI),
|
|
14
|
+
keplrETC: new KeplrETCQueriesImpl(queriesSetBase, sharedContext, chainId, chainGetter, options.ethereumURL, options.skipTokenInfoBaseURL, options.skipTokenInfoAPIURI, options.txCodecBaseURL),
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
},
|
|
17
18
|
};
|
|
18
19
|
class KeplrETCQueriesImpl {
|
|
19
|
-
constructor(_base, sharedContext, chainId, chainGetter, ethereumURL, skipTokenInfoBaseURL, skipTokenInfoAPIURI) {
|
|
20
|
+
constructor(_base, sharedContext, chainId, chainGetter, ethereumURL, skipTokenInfoBaseURL, skipTokenInfoAPIURI, txCodecBaseURL) {
|
|
20
21
|
this.queryERC20Metadata = new erc20_1.ObservableQueryERC20Metadata(sharedContext, ethereumURL);
|
|
21
22
|
this.queryEVMTokenInfo = new axelar_1.ObservableQueryEVMTokenInfo(sharedContext, chainId, chainGetter);
|
|
22
23
|
this.querySkipTokenInfo = new token_info_1.ObservableQuerySkipTokenInfo(sharedContext, chainId, chainGetter, skipTokenInfoBaseURL, skipTokenInfoAPIURI);
|
|
23
24
|
this.queryTerraClassicTaxRate = new treasury_1.ObservableQueryTaxRate(sharedContext, chainId, chainGetter);
|
|
24
25
|
this.queryTerraClassicTaxCaps = new treasury_1.ObservableQueryTaxCaps(sharedContext, chainId, chainGetter);
|
|
25
26
|
this.queryInitiaDynamicFee = new dynamicfee_1.ObservableQueryInitiaDynamicFee(sharedContext, chainId, chainGetter);
|
|
27
|
+
this.queryTxMsgDecoder = new tx_msg_decoder_1.ObservablePostTxMsgDecoder(sharedContext, txCodecBaseURL);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
exports.KeplrETCQueriesImpl = KeplrETCQueriesImpl;
|
package/build/queries.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":";;;AAMA,mCAAuD;AACvD,qCAAuD;AACvD,uDAGkC;AAClC,6CAA4D;AAC5D,oDAAsE;
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":";;;AAMA,mCAAuD;AACvD,qCAAuD;AACvD,uDAGkC;AAClC,6CAA4D;AAC5D,oDAAsE;AACtE,qDAA8D;AAMjD,QAAA,eAAe,GAAG;IAC7B,GAAG,CAAC,OAKH;QAMC,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,EACX,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,oBAAoB,EAC5B,OAAO,CAAC,mBAAmB,EAC3B,OAAO,CAAC,cAAc,CACvB;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAa,mBAAmB;IAY9B,YACE,KAAqB,EACrB,aAAiC,EACjC,OAAe,EACf,WAAwB,EACxB,WAAmB,EACnB,oBAA4B,EAC5B,mBAA2B,EAC3B,cAAsB;QAEtB,IAAI,CAAC,kBAAkB,GAAG,IAAI,oCAA4B,CACxD,aAAa,EACb,WAAW,CACZ,CAAC;QACF,IAAI,CAAC,iBAAiB,GAAG,IAAI,oCAA2B,CACtD,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QACF,IAAI,CAAC,kBAAkB,GAAG,IAAI,yCAA4B,CACxD,aAAa,EACb,OAAO,EACP,WAAW,EACX,oBAAoB,EACpB,mBAAmB,CACpB,CAAC;QAEF,IAAI,CAAC,wBAAwB,GAAG,IAAI,iCAAsB,CACxD,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QACF,IAAI,CAAC,wBAAwB,GAAG,IAAI,iCAAsB,CACxD,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QAEF,IAAI,CAAC,qBAAqB,GAAG,IAAI,4CAA+B,CAC9D,aAAa,EACb,OAAO,EACP,WAAW,CACZ,CAAC;QAEF,IAAI,CAAC,iBAAiB,GAAG,IAAI,2CAA0B,CACrD,aAAa,EACb,cAAc,CACf,CAAC;IACJ,CAAC;CACF;AA7DD,kDA6DC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTxInterpreterURLPrefix(bech32Prefix: string): string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTxInterpreterURLPrefix = void 0;
|
|
4
|
+
const TX_INTERPRETER_URL_PREFIX_BY_BECH32_PREFIX = {
|
|
5
|
+
agoric: "agoric",
|
|
6
|
+
atomone: "atomone",
|
|
7
|
+
akash: "akash",
|
|
8
|
+
axelar: "axelar",
|
|
9
|
+
babylon: "babylon",
|
|
10
|
+
bostrom: "bostrom",
|
|
11
|
+
celestia: "celestia",
|
|
12
|
+
chihuahua: "chihuahua",
|
|
13
|
+
cosmos: "cosmoshub",
|
|
14
|
+
cro: "cryptoorgchain",
|
|
15
|
+
dydx: "dydx",
|
|
16
|
+
elys: "elys",
|
|
17
|
+
iaa: "irisnet",
|
|
18
|
+
jkl: "jackal",
|
|
19
|
+
juno: "juno",
|
|
20
|
+
kava: "kava",
|
|
21
|
+
kyve: "kyve",
|
|
22
|
+
lava: "lava",
|
|
23
|
+
like: "likecoin",
|
|
24
|
+
milk: "milkyway",
|
|
25
|
+
mantra: "mantra",
|
|
26
|
+
neutron: "neutron",
|
|
27
|
+
nillion: "nillion",
|
|
28
|
+
noble: "noble",
|
|
29
|
+
nolus: "nolus",
|
|
30
|
+
omniflix: "omniflix",
|
|
31
|
+
osmo: "osmosis",
|
|
32
|
+
pasg: "passage",
|
|
33
|
+
persistence: "persistence",
|
|
34
|
+
pokt: "pocket",
|
|
35
|
+
pryzm: "pryzm",
|
|
36
|
+
quick: "quicksilver",
|
|
37
|
+
regen: "regen",
|
|
38
|
+
saga: "saga",
|
|
39
|
+
secret: "secretnetwork",
|
|
40
|
+
seda: "seda",
|
|
41
|
+
sent: "sentinel",
|
|
42
|
+
somm: "sommelier",
|
|
43
|
+
stars: "stargaze",
|
|
44
|
+
stride: "stride",
|
|
45
|
+
terra: "terra2",
|
|
46
|
+
thor: "thorchain",
|
|
47
|
+
umee: "umee",
|
|
48
|
+
union: "union",
|
|
49
|
+
xion: "xion",
|
|
50
|
+
};
|
|
51
|
+
function getTxInterpreterURLPrefix(bech32Prefix) {
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = TX_INTERPRETER_URL_PREFIX_BY_BECH32_PREFIX[bech32Prefix]) !== null && _a !== void 0 ? _a : "";
|
|
54
|
+
}
|
|
55
|
+
exports.getTxInterpreterURLPrefix = getTxInterpreterURLPrefix;
|
|
56
|
+
//# sourceMappingURL=get-tx-interpreter-url-prefix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tx-interpreter-url-prefix.js","sourceRoot":"","sources":["../../src/tx-msg-decoder/get-tx-interpreter-url-prefix.ts"],"names":[],"mappings":";;;AAAA,MAAM,0CAA0C,GAA2B;IACzE,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,WAAW;IACnB,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,aAAa;IACpB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,SAAgB,yBAAyB,CAAC,YAAoB;;IAC5D,OAAO,MAAA,0CAA0C,CAAC,YAAY,CAAC,mCAAI,EAAE,CAAC;AACxE,CAAC;AAFD,8DAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./query";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./query"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tx-msg-decoder/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QuerySharedContext, ObservablePostQuery } from "@keplr-wallet/stores";
|
|
2
|
+
export interface TxMsgDecoderResponse {
|
|
3
|
+
result: {
|
|
4
|
+
messages: Record<string, unknown>[];
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface TxMsgDecoderRequestBody {
|
|
8
|
+
messages: ProtoToAminoRequestMsg[];
|
|
9
|
+
}
|
|
10
|
+
interface ProtoToAminoRequestMsg {
|
|
11
|
+
typeUrl: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class ObservablePostTxMsgDecoderInner extends ObservablePostQuery<TxMsgDecoderResponse, unknown, TxMsgDecoderRequestBody> {
|
|
15
|
+
constructor(sharedContext: QuerySharedContext, baseURL: string, url: string, body: TxMsgDecoderRequestBody);
|
|
16
|
+
}
|
|
17
|
+
export declare class ObservablePostTxMsgDecoder {
|
|
18
|
+
private readonly sharedContext;
|
|
19
|
+
private readonly baseURL;
|
|
20
|
+
constructor(sharedContext: QuerySharedContext, baseURL: string);
|
|
21
|
+
protoToAmino(bech32Prefix: string, msgs: ProtoToAminoRequestMsg[]): ObservablePostTxMsgDecoderInner;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservablePostTxMsgDecoder = exports.ObservablePostTxMsgDecoderInner = void 0;
|
|
4
|
+
const stores_1 = require("@keplr-wallet/stores");
|
|
5
|
+
const get_tx_interpreter_url_prefix_1 = require("./get-tx-interpreter-url-prefix");
|
|
6
|
+
class ObservablePostTxMsgDecoderInner extends stores_1.ObservablePostQuery {
|
|
7
|
+
constructor(sharedContext, baseURL, url, body) {
|
|
8
|
+
super(sharedContext, baseURL, url, body, {}, {
|
|
9
|
+
disableCache: true,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ObservablePostTxMsgDecoderInner = ObservablePostTxMsgDecoderInner;
|
|
14
|
+
class ObservablePostTxMsgDecoder {
|
|
15
|
+
constructor(sharedContext, baseURL) {
|
|
16
|
+
this.sharedContext = sharedContext;
|
|
17
|
+
this.baseURL = baseURL;
|
|
18
|
+
}
|
|
19
|
+
protoToAmino(bech32Prefix, msgs) {
|
|
20
|
+
const urlPrefix = (0, get_tx_interpreter_url_prefix_1.getTxInterpreterURLPrefix)(bech32Prefix);
|
|
21
|
+
if (!urlPrefix.length) {
|
|
22
|
+
throw new Error(`Url prefix not supported. Unable to send the request to the tx-codec, bech32Prefix: ${bech32Prefix}`);
|
|
23
|
+
}
|
|
24
|
+
return new ObservablePostTxMsgDecoderInner(this.sharedContext, this.baseURL, `${urlPrefix}/tx/proto-to-amino`, {
|
|
25
|
+
messages: msgs,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ObservablePostTxMsgDecoder = ObservablePostTxMsgDecoder;
|
|
30
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/tx-msg-decoder/query.ts"],"names":[],"mappings":";;;AAAA,iDAA+E;AAC/E,mFAA4E;AAiB5E,MAAa,+BAAgC,SAAQ,4BAIpD;IACC,YACE,aAAiC,EACjC,OAAe,EACf,GAAW,EACX,IAA6B;QAE7B,KAAK,CACH,aAAa,EACb,OAAO,EACP,GAAG,EACH,IAAI,EACJ,EAAE,EACF;YACE,YAAY,EAAE,IAAI;SACnB,CACF,CAAC;IACJ,CAAC;CACF;AAtBD,0EAsBC;AAED,MAAa,0BAA0B;IACrC,YACmB,aAAiC,EACjC,OAAe;QADf,kBAAa,GAAb,aAAa,CAAoB;QACjC,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,YAAY,CAAC,YAAoB,EAAE,IAA8B;QAC/D,MAAM,SAAS,GAAG,IAAA,yDAAyB,EAAC,YAAY,CAAC,CAAC;QAE1D,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACrB,MAAM,IAAI,KAAK,CACb,uFAAuF,YAAY,EAAE,CACtG,CAAC;SACH;QAED,OAAO,IAAI,+BAA+B,CACxC,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,GAAG,SAAS,oBAAoB,EAChC;YACE,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF;AAxBD,gEAwBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keplr-wallet/stores-etc",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.276-rc.1",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"author": "chainapsis",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@ethersproject/abi": "^5.6.0",
|
|
20
|
-
"@keplr-wallet/common": "0.12.
|
|
21
|
-
"@keplr-wallet/simple-fetch": "0.12.
|
|
22
|
-
"@keplr-wallet/stores": "0.12.
|
|
23
|
-
"@keplr-wallet/types": "0.12.
|
|
24
|
-
"@keplr-wallet/unit": "0.12.
|
|
20
|
+
"@keplr-wallet/common": "0.12.276-rc.1",
|
|
21
|
+
"@keplr-wallet/simple-fetch": "0.12.276-rc.1",
|
|
22
|
+
"@keplr-wallet/stores": "0.12.276-rc.1",
|
|
23
|
+
"@keplr-wallet/types": "0.12.276-rc.1",
|
|
24
|
+
"@keplr-wallet/unit": "0.12.276-rc.1",
|
|
25
25
|
"utility-types": "^3.10.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"mobx": "^6",
|
|
29
29
|
"mobx-utils": "^6"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "0af30574ce6a603fd5318428594749276cf809a8"
|
|
32
32
|
}
|
package/src/queries.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "./terra-classic/treasury";
|
|
13
13
|
import { ObservableQuerySkipTokenInfo } from "./token-info";
|
|
14
14
|
import { ObservableQueryInitiaDynamicFee } from "./initia/dynamicfee";
|
|
15
|
+
import { ObservablePostTxMsgDecoder } from "./tx-msg-decoder";
|
|
15
16
|
|
|
16
17
|
export interface KeplrETCQueries {
|
|
17
18
|
keplrETC: KeplrETCQueriesImpl;
|
|
@@ -22,6 +23,7 @@ export const KeplrETCQueries = {
|
|
|
22
23
|
ethereumURL: string;
|
|
23
24
|
skipTokenInfoBaseURL: string;
|
|
24
25
|
skipTokenInfoAPIURI: string;
|
|
26
|
+
txCodecBaseURL: string;
|
|
25
27
|
}): (
|
|
26
28
|
queriesSetBase: QueriesSetBase,
|
|
27
29
|
sharedContext: QuerySharedContext,
|
|
@@ -42,7 +44,8 @@ export const KeplrETCQueries = {
|
|
|
42
44
|
chainGetter,
|
|
43
45
|
options.ethereumURL,
|
|
44
46
|
options.skipTokenInfoBaseURL,
|
|
45
|
-
options.skipTokenInfoAPIURI
|
|
47
|
+
options.skipTokenInfoAPIURI,
|
|
48
|
+
options.txCodecBaseURL
|
|
46
49
|
),
|
|
47
50
|
};
|
|
48
51
|
};
|
|
@@ -59,6 +62,8 @@ export class KeplrETCQueriesImpl {
|
|
|
59
62
|
|
|
60
63
|
public readonly queryInitiaDynamicFee: DeepReadonly<ObservableQueryInitiaDynamicFee>;
|
|
61
64
|
|
|
65
|
+
public readonly queryTxMsgDecoder: DeepReadonly<ObservablePostTxMsgDecoder>;
|
|
66
|
+
|
|
62
67
|
constructor(
|
|
63
68
|
_base: QueriesSetBase,
|
|
64
69
|
sharedContext: QuerySharedContext,
|
|
@@ -66,7 +71,8 @@ export class KeplrETCQueriesImpl {
|
|
|
66
71
|
chainGetter: ChainGetter,
|
|
67
72
|
ethereumURL: string,
|
|
68
73
|
skipTokenInfoBaseURL: string,
|
|
69
|
-
skipTokenInfoAPIURI: string
|
|
74
|
+
skipTokenInfoAPIURI: string,
|
|
75
|
+
txCodecBaseURL: string
|
|
70
76
|
) {
|
|
71
77
|
this.queryERC20Metadata = new ObservableQueryERC20Metadata(
|
|
72
78
|
sharedContext,
|
|
@@ -101,5 +107,10 @@ export class KeplrETCQueriesImpl {
|
|
|
101
107
|
chainId,
|
|
102
108
|
chainGetter
|
|
103
109
|
);
|
|
110
|
+
|
|
111
|
+
this.queryTxMsgDecoder = new ObservablePostTxMsgDecoder(
|
|
112
|
+
sharedContext,
|
|
113
|
+
txCodecBaseURL
|
|
114
|
+
);
|
|
104
115
|
}
|
|
105
116
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const TX_INTERPRETER_URL_PREFIX_BY_BECH32_PREFIX: Record<string, string> = {
|
|
2
|
+
agoric: "agoric",
|
|
3
|
+
atomone: "atomone",
|
|
4
|
+
akash: "akash",
|
|
5
|
+
axelar: "axelar",
|
|
6
|
+
babylon: "babylon",
|
|
7
|
+
bostrom: "bostrom",
|
|
8
|
+
celestia: "celestia",
|
|
9
|
+
chihuahua: "chihuahua",
|
|
10
|
+
cosmos: "cosmoshub",
|
|
11
|
+
cro: "cryptoorgchain",
|
|
12
|
+
dydx: "dydx",
|
|
13
|
+
elys: "elys",
|
|
14
|
+
iaa: "irisnet",
|
|
15
|
+
jkl: "jackal",
|
|
16
|
+
juno: "juno",
|
|
17
|
+
kava: "kava",
|
|
18
|
+
kyve: "kyve",
|
|
19
|
+
lava: "lava",
|
|
20
|
+
like: "likecoin",
|
|
21
|
+
milk: "milkyway",
|
|
22
|
+
mantra: "mantra",
|
|
23
|
+
neutron: "neutron",
|
|
24
|
+
nillion: "nillion",
|
|
25
|
+
noble: "noble",
|
|
26
|
+
nolus: "nolus",
|
|
27
|
+
omniflix: "omniflix",
|
|
28
|
+
osmo: "osmosis",
|
|
29
|
+
pasg: "passage",
|
|
30
|
+
persistence: "persistence",
|
|
31
|
+
pokt: "pocket",
|
|
32
|
+
pryzm: "pryzm",
|
|
33
|
+
quick: "quicksilver",
|
|
34
|
+
regen: "regen",
|
|
35
|
+
saga: "saga",
|
|
36
|
+
secret: "secretnetwork",
|
|
37
|
+
seda: "seda",
|
|
38
|
+
sent: "sentinel",
|
|
39
|
+
somm: "sommelier",
|
|
40
|
+
stars: "stargaze",
|
|
41
|
+
stride: "stride",
|
|
42
|
+
terra: "terra2",
|
|
43
|
+
thor: "thorchain",
|
|
44
|
+
umee: "umee",
|
|
45
|
+
union: "union",
|
|
46
|
+
xion: "xion",
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export function getTxInterpreterURLPrefix(bech32Prefix: string) {
|
|
50
|
+
return TX_INTERPRETER_URL_PREFIX_BY_BECH32_PREFIX[bech32Prefix] ?? "";
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./query";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { QuerySharedContext, ObservablePostQuery } from "@keplr-wallet/stores";
|
|
2
|
+
import { getTxInterpreterURLPrefix } from "./get-tx-interpreter-url-prefix";
|
|
3
|
+
|
|
4
|
+
export interface TxMsgDecoderResponse {
|
|
5
|
+
result: {
|
|
6
|
+
messages: Record<string, unknown>[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TxMsgDecoderRequestBody {
|
|
11
|
+
messages: ProtoToAminoRequestMsg[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ProtoToAminoRequestMsg {
|
|
15
|
+
typeUrl: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ObservablePostTxMsgDecoderInner extends ObservablePostQuery<
|
|
20
|
+
TxMsgDecoderResponse,
|
|
21
|
+
unknown,
|
|
22
|
+
TxMsgDecoderRequestBody
|
|
23
|
+
> {
|
|
24
|
+
constructor(
|
|
25
|
+
sharedContext: QuerySharedContext,
|
|
26
|
+
baseURL: string,
|
|
27
|
+
url: string,
|
|
28
|
+
body: TxMsgDecoderRequestBody
|
|
29
|
+
) {
|
|
30
|
+
super(
|
|
31
|
+
sharedContext,
|
|
32
|
+
baseURL,
|
|
33
|
+
url,
|
|
34
|
+
body,
|
|
35
|
+
{},
|
|
36
|
+
{
|
|
37
|
+
disableCache: true,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class ObservablePostTxMsgDecoder {
|
|
44
|
+
constructor(
|
|
45
|
+
private readonly sharedContext: QuerySharedContext,
|
|
46
|
+
private readonly baseURL: string
|
|
47
|
+
) {}
|
|
48
|
+
|
|
49
|
+
protoToAmino(bech32Prefix: string, msgs: ProtoToAminoRequestMsg[]) {
|
|
50
|
+
const urlPrefix = getTxInterpreterURLPrefix(bech32Prefix);
|
|
51
|
+
|
|
52
|
+
if (!urlPrefix.length) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
`Url prefix not supported. Unable to send the request to the tx-codec, bech32Prefix: ${bech32Prefix}`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return new ObservablePostTxMsgDecoderInner(
|
|
59
|
+
this.sharedContext,
|
|
60
|
+
this.baseURL,
|
|
61
|
+
`${urlPrefix}/tx/proto-to-amino`,
|
|
62
|
+
{
|
|
63
|
+
messages: msgs,
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|