@rhinestone/deposit-modal 0.1.28 → 0.1.30

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.
@@ -7,7 +7,6 @@
7
7
 
8
8
 
9
9
  var _chains = require('viem/chains');
10
- var _sharedconfigs = require('@rhinestone/shared-configs');
11
10
  var DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
12
11
  var DEFAULT_SIGNER_ADDRESS = "0x177bfcdd15bc01e99013dcc5d2b09cd87a18ce9c";
13
12
  var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
@@ -61,6 +60,128 @@ var SYMBOL_ALIASES = {
61
60
  var CANONICAL_SYMBOL_BY_REGISTRY_SYMBOL = {
62
61
  USDT0: "USDT"
63
62
  };
63
+ var chainRegistry = {
64
+ [_chains.mainnet.id]: {
65
+ name: _chains.mainnet.name,
66
+ tokens: [
67
+ { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
68
+ {
69
+ symbol: "USDC",
70
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
71
+ decimals: 6
72
+ },
73
+ {
74
+ symbol: "WETH",
75
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
76
+ decimals: 18
77
+ },
78
+ {
79
+ symbol: "USDT0",
80
+ address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
81
+ decimals: 6
82
+ }
83
+ ]
84
+ },
85
+ [_chains.base.id]: {
86
+ name: _chains.base.name,
87
+ tokens: [
88
+ { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
89
+ {
90
+ symbol: "USDC",
91
+ address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
92
+ decimals: 6
93
+ },
94
+ {
95
+ symbol: "WETH",
96
+ address: "0x4200000000000000000000000000000000000006",
97
+ decimals: 18
98
+ }
99
+ ]
100
+ },
101
+ [_chains.arbitrum.id]: {
102
+ name: _chains.arbitrum.name,
103
+ tokens: [
104
+ { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
105
+ {
106
+ symbol: "USDC",
107
+ address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
108
+ decimals: 6
109
+ },
110
+ {
111
+ symbol: "WETH",
112
+ address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
113
+ decimals: 18
114
+ },
115
+ {
116
+ symbol: "USDT0",
117
+ address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
118
+ decimals: 6
119
+ }
120
+ ]
121
+ },
122
+ [_chains.optimism.id]: {
123
+ name: _chains.optimism.name,
124
+ tokens: [
125
+ { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
126
+ {
127
+ symbol: "USDC",
128
+ address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
129
+ decimals: 6
130
+ },
131
+ {
132
+ symbol: "WETH",
133
+ address: "0x4200000000000000000000000000000000000006",
134
+ decimals: 18
135
+ },
136
+ {
137
+ symbol: "USDT0",
138
+ address: "0x01bFF41798a0BcF287b996046Ca68b395DbC1071",
139
+ decimals: 6
140
+ }
141
+ ]
142
+ },
143
+ [_chains.polygon.id]: {
144
+ name: _chains.polygon.name,
145
+ tokens: [
146
+ { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
147
+ {
148
+ symbol: "USDC",
149
+ address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
150
+ decimals: 6
151
+ },
152
+ {
153
+ symbol: "WETH",
154
+ address: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
155
+ decimals: 18
156
+ },
157
+ {
158
+ symbol: "USDT0",
159
+ address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
160
+ decimals: 6
161
+ }
162
+ ]
163
+ },
164
+ [_chains.bsc.id]: {
165
+ name: _chains.bsc.name,
166
+ tokens: [
167
+ {
168
+ symbol: "USDC",
169
+ address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
170
+ decimals: 18
171
+ },
172
+ {
173
+ symbol: "WETH",
174
+ address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
175
+ decimals: 18
176
+ },
177
+ {
178
+ symbol: "USDT",
179
+ address: "0x55d398326f99059fF775485246999027B3197955",
180
+ decimals: 18
181
+ }
182
+ ]
183
+ }
184
+ };
64
185
  function getChainId(chain) {
65
186
  return typeof chain === "number" ? chain : chain.id;
66
187
  }
@@ -85,7 +206,7 @@ function isSymbolSupportedOnChain(symbol, chainId) {
85
206
  return symbols.includes(normalizeTokenSymbol(symbol));
86
207
  }
87
208
  function getTokenFromRegistry(chainId, symbol) {
88
- const chainEntry = _sharedconfigs.chainRegistry[String(chainId)];
209
+ const chainEntry = chainRegistry[String(chainId)];
89
210
  if (!chainEntry) return void 0;
90
211
  const normalized = normalizeTokenSymbol(symbol);
91
212
  const candidates = _nullishCoalesce(SYMBOL_ALIASES[normalized], () => ( [normalized]));
@@ -127,10 +248,13 @@ function getTokenDecimals(symbol, chainId) {
127
248
  const token = getTokenFromRegistry(chainId, symbol);
128
249
  return _nullishCoalesce(_optionalChain([token, 'optionalAccess', _5 => _5.decimals]), () => ( 18));
129
250
  }
130
- function getSupportedTokenSymbolsForChain(chainId) {
251
+ function getTargetTokenSymbolsForChain(chainId) {
131
252
  const symbols = _nullishCoalesce(SUPPORTED_TOKENS_BY_CHAIN[chainId], () => ( []));
132
253
  return [...symbols];
133
254
  }
255
+ function getSupportedTokenSymbolsForChain(chainId) {
256
+ return getTargetTokenSymbolsForChain(chainId);
257
+ }
134
258
  function getSupportedChainIds() {
135
259
  return [...SUPPORTED_CHAIN_IDS];
136
260
  }
@@ -166,7 +290,7 @@ function getTokenDecimalsByAddress(token, chainId) {
166
290
  return 18;
167
291
  }
168
292
  if (chainId) {
169
- const chainEntry = _sharedconfigs.chainRegistry[String(chainId)];
293
+ const chainEntry = chainRegistry[String(chainId)];
170
294
  if (chainEntry) {
171
295
  const found = chainEntry.tokens.find(
172
296
  (t) => t.address.toLowerCase() === normalized
@@ -174,7 +298,7 @@ function getTokenDecimalsByAddress(token, chainId) {
174
298
  if (found) return found.decimals;
175
299
  }
176
300
  }
177
- for (const chainEntry of Object.values(_sharedconfigs.chainRegistry)) {
301
+ for (const chainEntry of Object.values(chainRegistry)) {
178
302
  const found = chainEntry.tokens.find(
179
303
  (t) => t.address.toLowerCase() === normalized
180
304
  );
@@ -184,7 +308,7 @@ function getTokenDecimalsByAddress(token, chainId) {
184
308
  }
185
309
  function findChainIdForToken(address) {
186
310
  const normalized = address.toLowerCase();
187
- for (const [chainIdStr, chainEntry] of Object.entries(_sharedconfigs.chainRegistry)) {
311
+ for (const [chainIdStr, chainEntry] of Object.entries(chainRegistry)) {
188
312
  for (const token of chainEntry.tokens) {
189
313
  if (token.address.toLowerCase() === normalized) {
190
314
  return Number(chainIdStr);
@@ -199,7 +323,7 @@ function getTokenSymbol(token, chainId) {
199
323
  return "ETH";
200
324
  }
201
325
  if (chainId) {
202
- const chainEntry = _sharedconfigs.chainRegistry[String(chainId)];
326
+ const chainEntry = chainRegistry[String(chainId)];
203
327
  if (chainEntry) {
204
328
  const found = chainEntry.tokens.find(
205
329
  (t) => t.address.toLowerCase() === normalized
@@ -208,7 +332,7 @@ function getTokenSymbol(token, chainId) {
208
332
  return _nullishCoalesce(CANONICAL_SYMBOL_BY_REGISTRY_SYMBOL[found.symbol.toUpperCase()], () => ( found.symbol));
209
333
  }
210
334
  }
211
- for (const chainEntry of Object.values(_sharedconfigs.chainRegistry)) {
335
+ for (const chainEntry of Object.values(chainRegistry)) {
212
336
  const found = chainEntry.tokens.find(
213
337
  (t) => t.address.toLowerCase() === normalized
214
338
  );
@@ -228,7 +352,7 @@ var CHAIN_BADGES = {
228
352
  function getChainName(chainId) {
229
353
  const chain = CHAIN_BY_ID[chainId];
230
354
  if (chain) return chain.name;
231
- const chainEntry = _sharedconfigs.chainRegistry[String(chainId)];
355
+ const chainEntry = chainRegistry[String(chainId)];
232
356
  if (chainEntry) return chainEntry.name;
233
357
  return `Chain ${chainId}`;
234
358
  }
@@ -301,4 +425,5 @@ function getTokenIcon(symbol) {
301
425
 
302
426
 
303
427
 
304
- exports.chainRegistry = _sharedconfigs.chainRegistry; exports.DEFAULT_BACKEND_URL = DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = DEFAULT_SIGNER_ADDRESS; exports.NATIVE_TOKEN_ADDRESS = NATIVE_TOKEN_ADDRESS; exports.CHAIN_BY_ID = CHAIN_BY_ID; exports.SOURCE_CHAINS = SOURCE_CHAINS; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.getChainId = getChainId; exports.getChainObject = getChainObject; exports.getUsdcAddress = getUsdcAddress; exports.getUsdcDecimals = getUsdcDecimals; exports.getTokenAddress = getTokenAddress; exports.getTokenDecimals = getTokenDecimals; exports.getSupportedTokenSymbolsForChain = getSupportedTokenSymbolsForChain; exports.getSupportedChainIds = getSupportedChainIds; exports.isSupportedTokenAddressForChain = isSupportedTokenAddressForChain; exports.getSupportedTargetTokens = getSupportedTargetTokens; exports.getTokenDecimalsByAddress = getTokenDecimalsByAddress; exports.findChainIdForToken = findChainIdForToken; exports.getTokenSymbol = getTokenSymbol; exports.getChainName = getChainName; exports.getChainBadge = getChainBadge; exports.getExplorerUrl = getExplorerUrl; exports.getExplorerTxUrl = getExplorerTxUrl; exports.getExplorerName = getExplorerName; exports.getChainIcon = getChainIcon; exports.getTokenIcon = getTokenIcon;
428
+
429
+ exports.DEFAULT_BACKEND_URL = DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = DEFAULT_SIGNER_ADDRESS; exports.NATIVE_TOKEN_ADDRESS = NATIVE_TOKEN_ADDRESS; exports.CHAIN_BY_ID = CHAIN_BY_ID; exports.SOURCE_CHAINS = SOURCE_CHAINS; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.chainRegistry = chainRegistry; exports.getChainId = getChainId; exports.getChainObject = getChainObject; exports.getUsdcAddress = getUsdcAddress; exports.getUsdcDecimals = getUsdcDecimals; exports.getTokenAddress = getTokenAddress; exports.getTokenDecimals = getTokenDecimals; exports.getTargetTokenSymbolsForChain = getTargetTokenSymbolsForChain; exports.getSupportedTokenSymbolsForChain = getSupportedTokenSymbolsForChain; exports.getSupportedChainIds = getSupportedChainIds; exports.isSupportedTokenAddressForChain = isSupportedTokenAddressForChain; exports.getSupportedTargetTokens = getSupportedTargetTokens; exports.getTokenDecimalsByAddress = getTokenDecimalsByAddress; exports.findChainIdForToken = findChainIdForToken; exports.getTokenSymbol = getTokenSymbol; exports.getChainName = getChainName; exports.getChainBadge = getChainBadge; exports.getExplorerUrl = getExplorerUrl; exports.getExplorerTxUrl = getExplorerTxUrl; exports.getExplorerName = getExplorerName; exports.getChainIcon = getChainIcon; exports.getTokenIcon = getTokenIcon;