@rango-dev/wallets-react 0.0.0-experimental-3e0c1f86-20251213 → 0.0.0-experimental-82bcc5d9-20260608
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 +43 -0
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/index.js.map +3 -3
- package/dist/hub/autoConnect.d.ts +2 -2
- package/dist/hub/autoConnect.d.ts.map +1 -1
- package/dist/hub/helpers.d.ts +4 -5
- package/dist/hub/helpers.d.ts.map +1 -1
- package/dist/hub/lastConnectedWallets.d.ts +1 -1
- package/dist/hub/lastConnectedWallets.d.ts.map +1 -1
- package/dist/hub/types.d.ts +3 -2
- package/dist/hub/types.d.ts.map +1 -1
- package/dist/hub/useHubAdapter.d.ts +2 -2
- package/dist/hub/useHubAdapter.d.ts.map +1 -1
- package/dist/hub/useHubRefs.d.ts +2 -2
- package/dist/hub/useHubRefs.d.ts.map +1 -1
- package/dist/hub/utils.d.ts +7 -13
- package/dist/hub/utils.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/legacy/types.d.ts +12 -3
- package/dist/legacy/types.d.ts.map +1 -1
- package/dist/test-utils/fixtures.d.ts +1 -1
- package/dist/test-utils/fixtures.d.ts.map +1 -1
- package/dist/wallets-react.build.json +1 -1
- package/package.json +11 -5
- package/src/hub/autoConnect.ts +5 -24
- package/src/hub/helpers.ts +15 -23
- package/src/hub/lastConnectedWallets.ts +1 -1
- package/src/hub/types.ts +4 -7
- package/src/hub/useHubAdapter.ts +6 -46
- package/src/hub/useHubRefs.ts +2 -2
- package/src/hub/utils.ts +8 -26
- package/src/legacy/types.ts +12 -7
- package/src/test-utils/fixtures.ts +4 -78
- package/dist/hub/chainRegisteryConvertors.d.ts +0 -11
- package/dist/hub/chainRegisteryConvertors.d.ts.map +0 -1
- package/src/hub/chainRegisteryConvertors.ts +0 -186
|
@@ -18,7 +18,7 @@ export class MockEvmSigner implements GenericSigner<EvmTransaction> {
|
|
|
18
18
|
_tx: EvmTransaction,
|
|
19
19
|
_address: string,
|
|
20
20
|
_chainId: string | null
|
|
21
|
-
): Promise<{ hash: string; response?:
|
|
21
|
+
): Promise<{ hash: string; response?: unknown }> {
|
|
22
22
|
return {
|
|
23
23
|
hash: '0x',
|
|
24
24
|
};
|
|
@@ -96,6 +96,7 @@ export const blockchainsMeta: BlockchainMeta[] = [
|
|
|
96
96
|
blockExplorerUrls: ['https://www.blockchain.com/btc/'],
|
|
97
97
|
addressUrl: 'https://www.blockchain.com/btc/address/{wallet}',
|
|
98
98
|
transactionUrl: 'https://www.blockchain.com/btc/tx/{txHash}',
|
|
99
|
+
tokenUrl: null,
|
|
99
100
|
},
|
|
100
101
|
},
|
|
101
102
|
{
|
|
@@ -130,6 +131,7 @@ export const blockchainsMeta: BlockchainMeta[] = [
|
|
|
130
131
|
addressUrl: 'https://etherscan.io/address/{wallet}',
|
|
131
132
|
transactionUrl: 'https://etherscan.io/tx/{txHash}',
|
|
132
133
|
enableGasV2: true,
|
|
134
|
+
tokenUrl: 'https://etherscan.io/token/{address}',
|
|
133
135
|
},
|
|
134
136
|
},
|
|
135
137
|
{
|
|
@@ -156,83 +158,7 @@ export const blockchainsMeta: BlockchainMeta[] = [
|
|
|
156
158
|
blockExplorerUrls: ['https://solscan.io/'],
|
|
157
159
|
addressUrl: 'https://solscan.io/account/{wallet}',
|
|
158
160
|
transactionUrl: 'https://solscan.io/tx/{txHash}',
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'COSMOS',
|
|
163
|
-
defaultDecimals: 6,
|
|
164
|
-
addressPatterns: ['^(cosmos1)[0-9a-z]{38}$'],
|
|
165
|
-
feeAssets: [
|
|
166
|
-
{
|
|
167
|
-
blockchain: 'COSMOS',
|
|
168
|
-
symbol: 'ATOM',
|
|
169
|
-
address: null,
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
logo: 'https://raw.githubusercontent.com/rango-exchange/assets/main/blockchains/COSMOS/icon.svg',
|
|
173
|
-
displayName: 'Cosmos',
|
|
174
|
-
shortName: 'Cosmos',
|
|
175
|
-
sort: 15,
|
|
176
|
-
color: '#2E3148',
|
|
177
|
-
enabled: true,
|
|
178
|
-
type: TransactionType.COSMOS,
|
|
179
|
-
chainId: 'cosmoshub-4',
|
|
180
|
-
info: {
|
|
181
|
-
infoType: 'CosmosMetaInfo',
|
|
182
|
-
experimental: false,
|
|
183
|
-
rpc: 'https://cosmos-rpc.polkachu.com',
|
|
184
|
-
rest: 'https://lcd-cosmoshub.blockapsis.com',
|
|
185
|
-
cosmostationLcdUrl: 'https://lcd-cosmoshub.blockapsis.com',
|
|
186
|
-
cosmostationApiUrl: 'https://cosmos-rpc.polkachu.com',
|
|
187
|
-
cosmostationDenomTracePath: '/ibc/apps/transfer/v1/denom_traces/',
|
|
188
|
-
mintScanName: 'cosmos',
|
|
189
|
-
chainName: 'Cosmos',
|
|
190
|
-
stakeCurrency: {
|
|
191
|
-
coinDenom: 'ATOM',
|
|
192
|
-
coinMinimalDenom: 'uatom',
|
|
193
|
-
coinDecimals: 6,
|
|
194
|
-
coinGeckoId: 'cosmos',
|
|
195
|
-
coinImageUrl: '/tokens/blockchain/cosmos.svg',
|
|
196
|
-
},
|
|
197
|
-
bip44: {
|
|
198
|
-
coinType: 118,
|
|
199
|
-
},
|
|
200
|
-
bech32Config: {
|
|
201
|
-
bech32PrefixAccAddr: 'cosmos',
|
|
202
|
-
bech32PrefixAccPub: 'cosmospub',
|
|
203
|
-
bech32PrefixValAddr: 'cosmosvaloper',
|
|
204
|
-
bech32PrefixValPub: 'cosmosvaloperpub',
|
|
205
|
-
bech32PrefixConsAddr: 'cosmosvalcons',
|
|
206
|
-
bech32PrefixConsPub: 'cosmosvalconspub',
|
|
207
|
-
},
|
|
208
|
-
currencies: [
|
|
209
|
-
{
|
|
210
|
-
coinDenom: 'ATOM',
|
|
211
|
-
coinMinimalDenom: 'uatom',
|
|
212
|
-
coinDecimals: 6,
|
|
213
|
-
coinGeckoId: 'cosmos',
|
|
214
|
-
coinImageUrl: '/tokens/blockchain/cosmos.svg',
|
|
215
|
-
},
|
|
216
|
-
],
|
|
217
|
-
feeCurrencies: [
|
|
218
|
-
{
|
|
219
|
-
coinDenom: 'ATOM',
|
|
220
|
-
coinMinimalDenom: 'uatom',
|
|
221
|
-
coinDecimals: 6,
|
|
222
|
-
coinGeckoId: 'cosmos',
|
|
223
|
-
coinImageUrl: '/tokens/blockchain/cosmos.svg',
|
|
224
|
-
},
|
|
225
|
-
],
|
|
226
|
-
features: ['stargate', 'ibc-transfer'],
|
|
227
|
-
explorerUrlToTx: 'https://www.mintscan.io/cosmos/txs/{txHash}',
|
|
228
|
-
gasPriceStep: {
|
|
229
|
-
low: 0.01,
|
|
230
|
-
average: 0.025,
|
|
231
|
-
high: 0.04,
|
|
232
|
-
},
|
|
233
|
-
blockExplorerUrls: ['https://www.mintscan.io/cosmos/'],
|
|
234
|
-
addressUrl: 'https://www.mintscan.io/cosmos/account/{wallet}',
|
|
235
|
-
transactionUrl: 'https://www.mintscan.io/cosmos/txs/{txHash}',
|
|
161
|
+
tokenUrl: 'https://solscan.io/token/{address}',
|
|
236
162
|
},
|
|
237
163
|
},
|
|
238
164
|
];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CosmosAssetList, CosmosChain } from '@rango-dev/wallets-core/namespaces/cosmos';
|
|
2
|
-
import type { CosmosBlockchainMeta } from 'rango-types';
|
|
3
|
-
export interface ConversionResult {
|
|
4
|
-
chain: CosmosChain;
|
|
5
|
-
assetList: CosmosAssetList;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Converts CosmosBlockchainMeta to Chain and AssetList formats
|
|
9
|
-
*/
|
|
10
|
-
export declare function convertCosmosMetaToChainRegistry(meta: CosmosBlockchainMeta): ConversionResult;
|
|
11
|
-
//# sourceMappingURL=chainRegisteryConvertors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chainRegisteryConvertors.d.ts","sourceRoot":"","sources":["../../src/hub/chainRegisteryConvertors.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACZ,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,aAAa,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,oBAAoB,GACzB,gBAAgB,CAWlB"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Asset,
|
|
3
|
-
Explorer,
|
|
4
|
-
FeeToken,
|
|
5
|
-
StakingToken,
|
|
6
|
-
} from '@chain-registry/types';
|
|
7
|
-
import type {
|
|
8
|
-
CosmosAssetList,
|
|
9
|
-
CosmosChain,
|
|
10
|
-
} from '@rango-dev/wallets-core/namespaces/cosmos';
|
|
11
|
-
import type { CosmosBlockchainMeta, CosmosChainInfo } from 'rango-types';
|
|
12
|
-
|
|
13
|
-
export interface ConversionResult {
|
|
14
|
-
chain: CosmosChain;
|
|
15
|
-
assetList: CosmosAssetList;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Converts CosmosBlockchainMeta to Chain and AssetList formats
|
|
20
|
-
*/
|
|
21
|
-
export function convertCosmosMetaToChainRegistry(
|
|
22
|
-
meta: CosmosBlockchainMeta
|
|
23
|
-
): ConversionResult {
|
|
24
|
-
const info = meta.info;
|
|
25
|
-
|
|
26
|
-
if (!info) {
|
|
27
|
-
throw new Error('CosmosChainInfo is required for conversion');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const chain = convertToChain(meta, info);
|
|
31
|
-
const assetList = convertToAssetList(info);
|
|
32
|
-
|
|
33
|
-
return { chain, assetList };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function convertToChain(
|
|
37
|
-
meta: CosmosBlockchainMeta,
|
|
38
|
-
info: CosmosChainInfo
|
|
39
|
-
): CosmosChain {
|
|
40
|
-
const chain: CosmosChain = {
|
|
41
|
-
chainName: info.chainName,
|
|
42
|
-
chainType: 'cosmos',
|
|
43
|
-
chainId: meta.chainId || undefined,
|
|
44
|
-
prettyName: meta.displayName,
|
|
45
|
-
status: meta.enabled ? 'live' : 'killed',
|
|
46
|
-
networkType: 'mainnet',
|
|
47
|
-
bech32Prefix: info.bech32Config.bech32PrefixAccAddr,
|
|
48
|
-
bech32Config: {
|
|
49
|
-
bech32PrefixAccAddr: info.bech32Config.bech32PrefixAccAddr,
|
|
50
|
-
bech32PrefixAccPub: info.bech32Config.bech32PrefixAccPub,
|
|
51
|
-
bech32PrefixValAddr: info.bech32Config.bech32PrefixValAddr,
|
|
52
|
-
bech32PrefixValPub: info.bech32Config.bech32PrefixValPub,
|
|
53
|
-
bech32PrefixConsAddr: info.bech32Config.bech32PrefixConsAddr,
|
|
54
|
-
bech32PrefixConsPub: info.bech32Config.bech32PrefixConsPub,
|
|
55
|
-
},
|
|
56
|
-
slip44: info.bip44.coinType,
|
|
57
|
-
fees: {
|
|
58
|
-
feeTokens: convertFeeTokens(info),
|
|
59
|
-
},
|
|
60
|
-
staking: {
|
|
61
|
-
stakingTokens: convertStakingTokens(info),
|
|
62
|
-
},
|
|
63
|
-
apis: {
|
|
64
|
-
rpc: info.rpc ? [{ address: info.rpc }] : undefined,
|
|
65
|
-
rest: info.rest ? [{ address: info.rest }] : undefined,
|
|
66
|
-
},
|
|
67
|
-
explorers: convertExplorers(info),
|
|
68
|
-
logoURIs: meta.logo
|
|
69
|
-
? { png: window.location.origin + meta.logo }
|
|
70
|
-
: undefined,
|
|
71
|
-
keywords: info.experimental ? ['experimental'] : undefined,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return chain;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function convertFeeTokens(info: CosmosChainInfo): FeeToken[] {
|
|
78
|
-
return info.feeCurrencies.map((currency) => {
|
|
79
|
-
const feeToken: FeeToken = {
|
|
80
|
-
denom: currency.coinMinimalDenom,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
if (info.gasPriceStep) {
|
|
84
|
-
feeToken.lowGasPrice = info.gasPriceStep.low;
|
|
85
|
-
feeToken.averageGasPrice = info.gasPriceStep.average;
|
|
86
|
-
feeToken.highGasPrice = info.gasPriceStep.high;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return feeToken;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function convertStakingTokens(info: CosmosChainInfo): StakingToken[] {
|
|
94
|
-
return [
|
|
95
|
-
{
|
|
96
|
-
denom: info.stakeCurrency.coinMinimalDenom,
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function convertExplorers(info: CosmosChainInfo): Explorer[] | undefined {
|
|
102
|
-
const explorers: Explorer[] = [];
|
|
103
|
-
|
|
104
|
-
if (info.explorerUrlToTx) {
|
|
105
|
-
const baseUrl = info.explorerUrlToTx.split('/tx/')[0];
|
|
106
|
-
explorers.push({
|
|
107
|
-
url: baseUrl,
|
|
108
|
-
txPage: info.explorerUrlToTx.replace(
|
|
109
|
-
/\{txHash\}|\$\{txHash\}/g,
|
|
110
|
-
'${txHash}'
|
|
111
|
-
),
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (info.blockExplorerUrls && info.blockExplorerUrls.length > 0) {
|
|
116
|
-
info.blockExplorerUrls.forEach((url) => {
|
|
117
|
-
if (!explorers.some((e) => e.url === url)) {
|
|
118
|
-
explorers.push({ url });
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return explorers.length > 0 ? explorers : undefined;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function convertToAssetList(info: CosmosChainInfo): CosmosAssetList {
|
|
127
|
-
const assets: Asset[] = [];
|
|
128
|
-
|
|
129
|
-
// Add staking currency
|
|
130
|
-
assets.push({
|
|
131
|
-
denomUnits: [
|
|
132
|
-
{
|
|
133
|
-
denom: info.stakeCurrency.coinMinimalDenom,
|
|
134
|
-
exponent: 0,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
denom: info.stakeCurrency.coinDenom.toLowerCase(),
|
|
138
|
-
exponent: info.stakeCurrency.coinDecimals,
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
base: info.stakeCurrency.coinMinimalDenom,
|
|
142
|
-
name: info.stakeCurrency.coinDenom,
|
|
143
|
-
display: info.stakeCurrency.coinDenom.toLowerCase(),
|
|
144
|
-
symbol: info.stakeCurrency.coinDenom,
|
|
145
|
-
typeAsset: 'sdk.coin',
|
|
146
|
-
logoURIs: info.stakeCurrency.coinImageUrl
|
|
147
|
-
? { png: window.location.origin + info.stakeCurrency.coinImageUrl }
|
|
148
|
-
: undefined,
|
|
149
|
-
coingeckoId: info.stakeCurrency.coinGeckoId || undefined,
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// Add other currencies
|
|
153
|
-
info.currencies.forEach((currency) => {
|
|
154
|
-
// Skip if already added as staking currency
|
|
155
|
-
if (currency.coinMinimalDenom === info.stakeCurrency.coinMinimalDenom) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
assets.push({
|
|
160
|
-
denomUnits: [
|
|
161
|
-
{
|
|
162
|
-
denom: currency.coinMinimalDenom,
|
|
163
|
-
exponent: 0,
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
denom: currency.coinDenom.toLowerCase(),
|
|
167
|
-
exponent: currency.coinDecimals,
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
base: currency.coinMinimalDenom,
|
|
171
|
-
name: currency.coinDenom,
|
|
172
|
-
display: currency.coinDenom.toLowerCase(),
|
|
173
|
-
symbol: currency.coinDenom,
|
|
174
|
-
typeAsset: 'sdk.coin',
|
|
175
|
-
logoURIs: currency.coinImageUrl
|
|
176
|
-
? { png: window.location.origin + currency.coinImageUrl }
|
|
177
|
-
: undefined,
|
|
178
|
-
coingeckoId: currency.coinGeckoId || undefined,
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
return {
|
|
183
|
-
chainName: info.chainName,
|
|
184
|
-
assets,
|
|
185
|
-
};
|
|
186
|
-
}
|