@chain-registry/keplr 0.8.3 → 0.11.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/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/package.json +27 -31
- package/module/index.js +0 -96
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.11.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@0.10.0...@chain-registry/keplr@0.11.0) (2022-09-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @chain-registry/keplr
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.10.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@0.9.0...@chain-registry/keplr@0.10.0) (2022-09-16)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @chain-registry/keplr
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [0.9.0](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@0.8.3...@chain-registry/keplr@0.9.0) (2022-09-14)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @chain-registry/keplr
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [0.8.3](https://github.com/cosmology-tech/chain-registry/compare/@chain-registry/keplr@0.8.2...@chain-registry/keplr@0.8.3) (2022-09-08)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @chain-registry/keplr
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @chain-registry/keplr
|
|
2
2
|
|
|
3
3
|
<p align="center" width="100%">
|
|
4
|
-
<img height="90" src="https://user-images.githubusercontent.com/545047/
|
|
4
|
+
<img height="90" src="https://user-images.githubusercontent.com/545047/190171475-b416f99e-2831-4786-9ba3-a7ff4d95b0d3.svg" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center" width="100%">
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chain-registry/keplr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Chain Registry to Keplr",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/cosmology-tech/chain-registry",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"main": "main/index.js",
|
|
9
|
-
"module": "module/index.js",
|
|
10
9
|
"typings": "types/index.d.ts",
|
|
11
10
|
"directories": {
|
|
12
11
|
"lib": "src",
|
|
@@ -14,13 +13,10 @@
|
|
|
14
13
|
},
|
|
15
14
|
"files": [
|
|
16
15
|
"types",
|
|
17
|
-
"main"
|
|
18
|
-
"module"
|
|
16
|
+
"main"
|
|
19
17
|
],
|
|
20
18
|
"scripts": {
|
|
21
|
-
"build
|
|
22
|
-
"build:module": "cross-env MODULE=true babel src --out-dir module --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
|
|
23
|
-
"build": "npm run build:module && npm run build:main",
|
|
19
|
+
"build": "cross-env BABEL_ENV=production babel src --out-dir main --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
|
|
24
20
|
"build:ts": "tsc --project ./tsconfig.json",
|
|
25
21
|
"buidl": "npm run build && npm run build:ts",
|
|
26
22
|
"prepare": "npm run build",
|
|
@@ -45,42 +41,42 @@
|
|
|
45
41
|
"url": "https://github.com/cosmology-tech/chain-registry/issues"
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
|
-
"@babel/cli": "7.
|
|
49
|
-
"@babel/core": "7.
|
|
50
|
-
"@babel/eslint-parser": "^7.
|
|
51
|
-
"@babel/node": "^7.
|
|
52
|
-
"@babel/plugin-proposal-class-properties": "7.
|
|
53
|
-
"@babel/plugin-proposal-export-default-from": "7.
|
|
54
|
-
"@babel/plugin-proposal-object-rest-spread": "7.18.
|
|
55
|
-
"@babel/plugin-transform-runtime": "7.
|
|
56
|
-
"@babel/preset-env": "7.
|
|
44
|
+
"@babel/cli": "7.18.10",
|
|
45
|
+
"@babel/core": "7.19.1",
|
|
46
|
+
"@babel/eslint-parser": "^7.19.1",
|
|
47
|
+
"@babel/node": "^7.19.1",
|
|
48
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
49
|
+
"@babel/plugin-proposal-export-default-from": "7.18.10",
|
|
50
|
+
"@babel/plugin-proposal-object-rest-spread": "7.18.9",
|
|
51
|
+
"@babel/plugin-transform-runtime": "7.19.1",
|
|
52
|
+
"@babel/preset-env": "7.19.1",
|
|
57
53
|
"@babel/preset-typescript": "^7.17.12",
|
|
58
|
-
"@types/jest": "^
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
60
|
-
"@typescript-eslint/parser": "5.
|
|
54
|
+
"@types/jest": "^29.0.2",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "5.37.0",
|
|
56
|
+
"@typescript-eslint/parser": "5.37.0",
|
|
61
57
|
"babel-core": "7.0.0-bridge.0",
|
|
62
|
-
"babel-jest": "
|
|
58
|
+
"babel-jest": "29.0.3",
|
|
63
59
|
"babel-watch": "^7.0.0",
|
|
64
|
-
"chain-registry": "^0.
|
|
60
|
+
"chain-registry": "^0.13.0",
|
|
65
61
|
"cross-env": "^7.0.2",
|
|
66
|
-
"eslint": "8.
|
|
62
|
+
"eslint": "8.23.1",
|
|
67
63
|
"eslint-config-prettier": "^8.5.0",
|
|
68
64
|
"eslint-plugin-prettier": "^4.0.0",
|
|
69
|
-
"eslint-plugin-simple-import-sort": "
|
|
65
|
+
"eslint-plugin-simple-import-sort": "8.0.0",
|
|
70
66
|
"eslint-plugin-unused-imports": "2.0.0",
|
|
71
|
-
"jest": "^
|
|
67
|
+
"jest": "^29.0.3",
|
|
72
68
|
"long": "^5.2.0",
|
|
73
69
|
"prettier": "^2.7.0",
|
|
74
70
|
"regenerator-runtime": "^0.13.7",
|
|
75
|
-
"ts-jest": "^
|
|
76
|
-
"typescript": "^4.
|
|
71
|
+
"ts-jest": "^29.0.1",
|
|
72
|
+
"typescript": "^4.8.3"
|
|
77
73
|
},
|
|
78
74
|
"dependencies": {
|
|
79
|
-
"@babel/runtime": "^7.
|
|
80
|
-
"@chain-registry/types": "^0.
|
|
81
|
-
"@keplr-wallet/cosmos": "^0.10.
|
|
82
|
-
"@keplr-wallet/crypto": "^0.10.
|
|
75
|
+
"@babel/runtime": "^7.19.0",
|
|
76
|
+
"@chain-registry/types": "^0.10.0",
|
|
77
|
+
"@keplr-wallet/cosmos": "^0.10.24",
|
|
78
|
+
"@keplr-wallet/crypto": "^0.10.24",
|
|
83
79
|
"semver": "^7.3.7"
|
|
84
80
|
},
|
|
85
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "85c4d099a79b176a95e488af82b4b6b365c03732"
|
|
86
82
|
}
|
package/module/index.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Bech32Address } from '@keplr-wallet/cosmos';
|
|
2
|
-
import semver from 'semver';
|
|
3
|
-
|
|
4
|
-
const getRpc = chain => chain.apis?.rpc[0]?.address;
|
|
5
|
-
|
|
6
|
-
const getRest = chain => chain.apis?.rest[0]?.address;
|
|
7
|
-
|
|
8
|
-
const getExplr = chain => chain.explorers?.[0]?.url;
|
|
9
|
-
|
|
10
|
-
const cleanVer = ver => {
|
|
11
|
-
if (!semver.valid(ver)) {
|
|
12
|
-
const spaces = ver.split('.').length;
|
|
13
|
-
|
|
14
|
-
switch (spaces) {
|
|
15
|
-
case 1:
|
|
16
|
-
return ver + '.0.0';
|
|
17
|
-
|
|
18
|
-
case 2:
|
|
19
|
-
return ver + '.0';
|
|
20
|
-
|
|
21
|
-
case 3:
|
|
22
|
-
default:
|
|
23
|
-
throw new Error('contact maintainers: bad version');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const chainRegistryChainToKeplr = (chain, assets, options = {
|
|
29
|
-
getRpcEndpoint: getRpc,
|
|
30
|
-
getRestEndpoint: getRest,
|
|
31
|
-
getExplorer: getExplr
|
|
32
|
-
}) => {
|
|
33
|
-
if (!options.getRestEndpoint) options.getRestEndpoint = getRest;
|
|
34
|
-
if (!options.getRpcEndpoint) options.getRpcEndpoint = getRpc;
|
|
35
|
-
if (!options.getExplorer) options.getExplorer = getExplr;
|
|
36
|
-
const features = []; // if NOT specified, we assume stargate, sorry not sorry
|
|
37
|
-
|
|
38
|
-
const sdkVer = cleanVer(chain.codebase?.cosmos_sdk_version ?? '0.4'); // stargate
|
|
39
|
-
|
|
40
|
-
if (semver.satisfies(sdkVer, '>=0.4')) features.push('stargate'); // no-legacy-stdTx
|
|
41
|
-
|
|
42
|
-
if (semver.satisfies(sdkVer, '>=0.43')) features.push('no-legacy-stdTx'); // until further notice, assume 'ibc-transfer'
|
|
43
|
-
|
|
44
|
-
features.push('ibc-transfer'); // ibc-go
|
|
45
|
-
|
|
46
|
-
if (semver.satisfies(sdkVer, '>=0.45')) features.push('ibc-go');
|
|
47
|
-
|
|
48
|
-
if (chain.codebase?.cosmwasm_enabled) {
|
|
49
|
-
features.push('cosmwasm');
|
|
50
|
-
const wasmVer = cleanVer(chain.codebase.cosmwasm_version ?? '0.24');
|
|
51
|
-
if (semver.satisfies(wasmVer, '>=0.24')) features.push('wasmd_0.24+');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const chainAssets = assets.find(asset => asset.chain_name === chain.chain_name)?.assets || [];
|
|
55
|
-
const feeDenoms = chain.fees?.fee_tokens.map(feeToken => feeToken.denom) || [];
|
|
56
|
-
/**
|
|
57
|
-
* FROM KEPLR chain-info.d.ts:
|
|
58
|
-
* This is used to set the fee of the transaction.
|
|
59
|
-
* If this field is empty, it just use the default gas price step (low: 0.01, average: 0.025, high: 0.04).
|
|
60
|
-
* And, set field's type as primitive number because it is hard to restore the prototype after deserialzing if field's type is `Dec`.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
const gasPriceStep = {
|
|
64
|
-
low: chain.fees?.fee_tokens?.[0]?.low_gas_price ?? 0.01,
|
|
65
|
-
average: chain.fees?.fee_tokens?.[0]?.average_gas_price ?? 0.025,
|
|
66
|
-
high: chain.fees?.fee_tokens?.[0]?.high_gas_price ?? 0.04
|
|
67
|
-
};
|
|
68
|
-
const stakingDenoms = chain.staking?.staking_tokens.map(stakingToken => stakingToken.denom) || [];
|
|
69
|
-
const currencies = chainAssets.map(currency => {
|
|
70
|
-
return {
|
|
71
|
-
coinDenom: currency.symbol,
|
|
72
|
-
coinMinimalDenom: currency.base,
|
|
73
|
-
coinDecimals: currency.denom_units.filter(denomUnit => denomUnit.denom === currency.display)[0]?.exponent,
|
|
74
|
-
coinGeckoId: currency.coingecko_id,
|
|
75
|
-
coinImageUrl: currency.logo_URIs?.svg ?? currency.logo_URIs?.png
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
const stakeCurrency = currencies.find(currency => stakingDenoms.includes(currency.coinDenom)) ?? currencies[0];
|
|
79
|
-
const feeCurrencies = currencies.filter(currency => feeDenoms.includes(currency.coinDenom));
|
|
80
|
-
const chainInfo = {
|
|
81
|
-
rpc: options.getRpcEndpoint(chain),
|
|
82
|
-
rest: options.getRestEndpoint(chain),
|
|
83
|
-
chainId: chain.chain_id,
|
|
84
|
-
chainName: chain.pretty_name,
|
|
85
|
-
bip44: {
|
|
86
|
-
coinType: chain.slip44
|
|
87
|
-
},
|
|
88
|
-
gasPriceStep,
|
|
89
|
-
bech32Config: Bech32Address.defaultBech32Config(chain.bech32_prefix),
|
|
90
|
-
currencies: currencies,
|
|
91
|
-
stakeCurrency: stakeCurrency || currencies[0],
|
|
92
|
-
feeCurrencies: feeCurrencies.length !== 0 ? feeCurrencies : currencies,
|
|
93
|
-
features
|
|
94
|
-
};
|
|
95
|
-
return chainInfo;
|
|
96
|
-
};
|