@rango-dev/provider-walletconnect-2 0.1.1-next.4 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/provider-walletconnect-2",
3
- "version": "0.1.1-next.4",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -20,13 +20,16 @@
20
20
  "lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore"
21
21
  },
22
22
  "dependencies": {
23
+ "@cosmjs/launchpad": "^0.27.1",
24
+ "@keplr-wallet/cosmos": "^0.9.12",
23
25
  "@keplr-wallet/simple-fetch": "^0.12.14",
24
- "@rango-dev/signer-cosmos": "^0.8.1-next.3",
25
- "@rango-dev/signer-evm": "^0.8.1-next.4",
26
- "@rango-dev/signer-solana": "^0.8.1-next.1",
27
- "@rango-dev/wallets-shared": "^0.8.1-next.7",
26
+ "@rango-dev/signer-cosmos": "^0.9.0",
27
+ "@rango-dev/signer-evm": "^0.9.0",
28
+ "@rango-dev/signer-solana": "^0.9.0",
29
+ "@rango-dev/wallets-shared": "^0.9.0",
30
+ "@solana/web3.js": "^1.67.2",
28
31
  "@walletconnect/encoding": "^1.0.2",
29
- "@walletconnect/sign-client": "^2.8.1",
32
+ "@walletconnect/sign-client": "^2.9.1",
30
33
  "@walletconnect/utils": "^2.9.1",
31
34
  "@web3modal/standalone": "^2.4.3",
32
35
  "bs58": "^5.0.0",
@@ -35,7 +38,7 @@
35
38
  "rango-types": "^0.1.47"
36
39
  },
37
40
  "devDependencies": {
38
- "@walletconnect/types": "^2.8.1"
41
+ "@walletconnect/types": "^2.9.1"
39
42
  },
40
43
  "publishConfig": {
41
44
  "access": "public"
package/src/helpers.ts CHANGED
@@ -89,29 +89,26 @@ export function generateOptionalNamespace(
89
89
  ): FinalNamespaces | undefined {
90
90
  const evm = evmBlockchains(meta);
91
91
  const cosmos = cosmosBlockchains(meta);
92
+ const evmChains = evm.map((chain) => {
93
+ return new ChainId({
94
+ namespace: NAMESPACES.ETHEREUM,
95
+ reference: String(parseInt(chain.chainId)),
96
+ }).toString();
97
+ });
98
+ const cosmosChains = cosmos
99
+ .filter((chain): chain is CosmosMeta => !!chain.chainId)
100
+ .map((chain) => {
101
+ return new ChainId({
102
+ namespace: NAMESPACES.COSMOS,
103
+ reference: chain.chainId,
104
+ }).toString();
105
+ });
92
106
 
93
- return {
107
+ const namespaces: FinalNamespaces = {
94
108
  [NAMESPACES.ETHEREUM]: {
95
109
  methods: DEFAULT_ETHEREUM_METHODS,
96
110
  events: DEFAULT_ETHEREUM_EVENTS,
97
- chains: evm.map((chain) => {
98
- return new ChainId({
99
- namespace: NAMESPACES.ETHEREUM,
100
- reference: String(parseInt(chain.chainId)),
101
- }).toString();
102
- }),
103
- },
104
- [NAMESPACES.COSMOS]: {
105
- methods: DEFAULT_COSMOS_METHODS,
106
- events: [],
107
- chains: cosmos
108
- .filter((chain): chain is CosmosMeta => !!chain.chainId)
109
- .map((chain) => {
110
- return new ChainId({
111
- namespace: NAMESPACES.COSMOS,
112
- reference: chain.chainId,
113
- }).toString();
114
- }),
111
+ chains: evmChains,
115
112
  },
116
113
  [NAMESPACES.SOLANA]: {
117
114
  methods: DEFAULT_SOLANA_METHODS,
@@ -119,6 +116,16 @@ export function generateOptionalNamespace(
119
116
  chains: [`solana:${DEFAULT_SOLANA_CHAIN_ID}`],
120
117
  },
121
118
  };
119
+
120
+ if (cosmosChains.length) {
121
+ namespaces[NAMESPACES.COSMOS] = {
122
+ methods: DEFAULT_COSMOS_METHODS,
123
+ events: [],
124
+ chains: cosmosChains,
125
+ };
126
+ }
127
+
128
+ return namespaces;
122
129
  }
123
130
 
124
131
  export function solanaChainIdToNetworkName(chainId: string): string {