@keplr-wallet/common 0.12.71-rc.0 → 0.12.71
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/denom/index.js +6 -9
- package/build/denom/index.js.map +1 -1
- package/package.json +4 -4
- package/src/denom/index.ts +6 -9
package/build/denom/index.js
CHANGED
|
@@ -18,16 +18,13 @@ class DenomHelper {
|
|
|
18
18
|
}
|
|
19
19
|
constructor(_denom) {
|
|
20
20
|
this._denom = _denom;
|
|
21
|
-
// Remember that the coin's actual denom should start with "type:contractAddress
|
|
22
|
-
|
|
23
|
-
if (split.length !==
|
|
24
|
-
|
|
25
|
-
if (split.length !== 1 && split.length !== 3) {
|
|
26
|
-
throw new Error(`Invalid denom: ${this.denom}`);
|
|
27
|
-
}
|
|
21
|
+
// Remember that the coin's actual denom should start with "type:contractAddress:denom" if it is for the token based on contract.
|
|
22
|
+
const split = this.denom.split(/(\w+):(\w+):(.+)/).filter(Boolean);
|
|
23
|
+
if (split.length !== 1 && split.length !== 3) {
|
|
24
|
+
throw new Error(`Invalid denom: ${this.denom}`);
|
|
28
25
|
}
|
|
29
|
-
this._type = split.length
|
|
30
|
-
this._contractAddress = split.length
|
|
26
|
+
this._type = split.length === 3 ? split[0] : "";
|
|
27
|
+
this._contractAddress = split.length === 3 ? split[1] : "";
|
|
31
28
|
}
|
|
32
29
|
get denom() {
|
|
33
30
|
return this._denom;
|
package/build/denom/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/denom/index.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AACjC,iDAA4C;AAE5C,MAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CACb,KAGG,EACH,gBAAwB;QAExB,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAA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KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5C,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC;IAChC,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAjDD,kCAiDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keplr-wallet/common",
|
|
3
|
-
"version": "0.12.71
|
|
3
|
+
"version": "0.12.71",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"author": "chainapsis",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@keplr-wallet/crypto": "0.12.71
|
|
20
|
-
"@keplr-wallet/types": "0.12.71
|
|
19
|
+
"@keplr-wallet/crypto": "0.12.71",
|
|
20
|
+
"@keplr-wallet/types": "0.12.71",
|
|
21
21
|
"buffer": "^6.0.3",
|
|
22
22
|
"delay": "^4.4.0",
|
|
23
23
|
"mobx": "^6.1.7"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "667e172901b0635ef8ce0c3790a124f48c41d60b"
|
|
26
26
|
}
|
package/src/denom/index.ts
CHANGED
|
@@ -29,17 +29,14 @@ export class DenomHelper {
|
|
|
29
29
|
protected readonly _contractAddress: string;
|
|
30
30
|
|
|
31
31
|
constructor(protected readonly _denom: string) {
|
|
32
|
-
// Remember that the coin's actual denom should start with "type:contractAddress
|
|
33
|
-
|
|
34
|
-
if (split.length !==
|
|
35
|
-
|
|
36
|
-
if (split.length !== 1 && split.length !== 3) {
|
|
37
|
-
throw new Error(`Invalid denom: ${this.denom}`);
|
|
38
|
-
}
|
|
32
|
+
// Remember that the coin's actual denom should start with "type:contractAddress:denom" if it is for the token based on contract.
|
|
33
|
+
const split = this.denom.split(/(\w+):(\w+):(.+)/).filter(Boolean);
|
|
34
|
+
if (split.length !== 1 && split.length !== 3) {
|
|
35
|
+
throw new Error(`Invalid denom: ${this.denom}`);
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
this._type = split.length
|
|
42
|
-
this._contractAddress = split.length
|
|
38
|
+
this._type = split.length === 3 ? split[0] : "";
|
|
39
|
+
this._contractAddress = split.length === 3 ? split[1] : "";
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
get denom(): string {
|