@instadapp/avocado-base 0.0.0-dev.b89d937 → 0.0.0-dev.b8bae6e

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.
@@ -36,5 +36,5 @@ defineProps<{
36
36
  <InstadappProSVG v-else-if="action === 'instadapp-pro'"/>
37
37
  <PermitSignSVG v-else-if="action === 'permit2'"/>
38
38
  <UpgradeSVG v-else-if="action === 'upgrade'"/>
39
- <HammerSVG v-else-if="action === 'transaction-builder'"/>
39
+ <HammerSVG v-else-if="action === 'tx-builder'"/>
40
40
  </template>
@@ -24,7 +24,7 @@ provide('tokens', props.tokens);
24
24
  <MetadataPermit2 v-if="metadata.type === 'permit2'" :metadata="metadata" :chain_id="chain_id" />
25
25
 
26
26
  <div class="text-left w-fit capitalize" v-if="metadata.type === 'import'">
27
- Import from {{ metadata.protocol }} ({{ (formatUsd(fromWei(metadata.valueInUsd, 10)))}})
27
+ Import from {{ metadata.protocol }} ({{ (formatUsd(fromWei(metadata.valueInUsd, 10))) }})
28
28
  </div>
29
29
 
30
30
  <div v-if="metadata.type === 'upgrade'" class="self-start">
@@ -32,7 +32,7 @@ provide('tokens', props.tokens);
32
32
  </div>
33
33
  <div v-if="metadata.type === 'dapp'" class="self-start flex items-center gap-2 text-primary">
34
34
  <a :href="metadata?.url" target="_blank" rel="noopener noreferrer">{{
35
- metadata?.name
35
+ metadata?.name || metadata?.url
36
36
  }}</a>
37
37
  <SvgoExternalLink />
38
38
  </div>
@@ -41,39 +41,38 @@ provide('tokens', props.tokens);
41
41
  </div>
42
42
  <div v-if="metadata.type === 'auth'" class="self-start capitalize flex gap-3">
43
43
  Authority {{ metadata.remove ? 'Removed' : 'Added' }}:
44
- <a
45
- class="text-primary break-all"
46
- :href="getExplorerUrl(metadata.chainId, `/address/${metadata.address}`)"
47
- target="_blank"
48
- >
49
- {{ shortenHash(metadata.address) }}
50
- </a>
51
- <div class="flex gap-3">
52
- <ChainLogo class="w-5 h-5" :chain="metadata.chainId"/>
53
- {{ chainIdToName(metadata.chainId) }}
54
- </div>
44
+ <a class="text-primary break-all" :href="getExplorerUrl(metadata.chainId, `/address/${metadata.address}`)"
45
+ target="_blank">
46
+ {{ shortenHash(metadata.address) }}
47
+ </a>
48
+ <div class="flex gap-3">
49
+ <ChainLogo class="w-5 h-5" :chain="metadata.chainId" />
50
+ {{ chainIdToName(metadata.chainId) }}
51
+ </div>
55
52
  </div>
56
- <div v-if="metadata.type === 'transaction-builder'" class="self-start capitalize flex gap-3">
57
- Transaction Builder ({{ metadata?.actionCount }} actions)
53
+ <div v-if="metadata.type === 'tx-builder'" class="self-start capitalize flex gap-3">
54
+ <span v-if="!compact">
55
+ Transaction Builder
56
+ </span> ({{ metadata?.actionCount }} {{ toBN(metadata?.actionCount).lt(2) ? 'action' : 'actions' }})
58
57
  </div>
59
58
  <div v-if="metadata.type === 'instadapp-pro'" class="self-start capitalize flex gap-3">
60
59
  Instadapp Pro |
61
60
  {{ metadata?.castDetails }}
62
61
  </div>
63
62
 
64
- <MetadataSigners v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'" :metadata="metadata" :compact="compact" />
63
+ <MetadataSigners v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'" :metadata="metadata"
64
+ :compact="compact" />
65
65
 
66
- <div v-if="metadata.type === 'change-threshold'" class="text-left w-fit" >
67
- Change Threshold to {{ metadata.count }}
66
+ <div v-if="metadata.type === 'change-threshold'" class="text-left w-fit">
67
+ Change Threshold to {{ metadata.count }}
68
68
  </div>
69
69
 
70
70
  <div v-tippy="{
71
- content: metadata.id,
72
- maxWidth: 'none',
73
- interactive: true,
74
- }"
75
- v-if="metadata.type === 'rejection'" class="text-left w-fit">
76
- {{ shortenHash(metadata.id) }}
71
+ content: metadata.id,
72
+ maxWidth: 'none',
73
+ interactive: true,
74
+ }" v-if="metadata.type === 'rejection'" class="text-left w-fit">
75
+ {{ shortenHash(metadata.id) }}
77
76
  </div>
78
77
  </div>
79
78
  </template>
@@ -20,9 +20,17 @@ const fromToken = asyncComputed(() => {
20
20
  );
21
21
  });
22
22
 
23
- const formattedFromAmount = computed(() =>
23
+ const toToken = asyncComputed(() => {
24
+ if (!props?.metadata?.toChainId) return null;
25
+
26
+ if (Array.isArray(tokens) && !tokens.length) return null;
27
+
28
+ return fetchTokenByAddress(props.metadata?.toToken, props?.metadata?.toChainId, tokens);
29
+ });
30
+
31
+ const formattedToAmount = computed(() =>
24
32
  formatDecimal(
25
- fromWei(props.metadata?.amount, fromToken?.value?.decimals).toFixed()
33
+ fromWei(props.metadata?.amount, toToken?.value?.decimals).toFixed()
26
34
  )
27
35
  );
28
36
  </script>
@@ -36,7 +44,7 @@ const formattedFromAmount = computed(() =>
36
44
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">Cross-chain send</span>
37
45
  <span class="inline-flex gap-2.5 items-center">
38
46
  <img width="20" height="20" class="w-5 h-5" :src="fromToken?.logo_url" />
39
- {{ formattedFromAmount }}
47
+ {{ formattedToAmount }}
40
48
  <span class="uppercase">{{ fromToken?.symbol }}</span>
41
49
  </span>
42
50
  </div>
@@ -8,17 +8,15 @@ const props = defineProps<{
8
8
  const compact = inject('compact');
9
9
  const tokens = inject<ITokenPrice[]>('tokens');
10
10
 
11
- const buyToken = asyncComputed(() =>
12
- {
11
+ const buyToken = asyncComputed(() => {
13
12
  if (Array.isArray(tokens) && !tokens.length) return null;
14
- return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
15
- }
13
+ return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
14
+ }
16
15
  );
17
- const sellToken = asyncComputed(() =>
18
- {
16
+ const sellToken = asyncComputed(() => {
19
17
  if (Array.isArray(tokens) && !tokens.length) return null;
20
- return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
21
- }
18
+ return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
19
+ }
22
20
  );
23
21
 
24
22
  const sellAmountFormatted = computed(() =>
@@ -49,26 +47,21 @@ const formatProtocol = (protocol: string) => {
49
47
 
50
48
  <template>
51
49
  <div v-if="!sellToken || !buyToken" class="rounded-5 w-24 h-4 loading-box" />
52
- <div
53
- class="flex items-center gap-5"
54
- v-else
55
- >
56
- <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
57
- <span class="inline-flex gap-2.5 items-center">
58
- <img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url" />
59
- {{ sellAmountFormatted }}
60
- <span class="uppercase">{{ sellToken?.symbol }}</span>
61
- <SvgoRefresh class="w-4 h-4 text-slate-400 mx-2" />
62
- <img width="20" height="20" class="w-5 h-5" :src="buyToken?.logo_url" />
63
- {{ buyAmountFormatted }}
64
- <span class="uppercase">{{ buyToken?.symbol }}</span>
65
- <span
66
- class="capitalize hidden sm:flex items-center gap-2.5"
67
- v-if="metadata.protocol && !compact"
68
- >
69
- On <ProtocolLogo class="w-5 h-5" :name="metadata.protocol" />
70
- {{ formatProtocol(metadata.protocol) }}
71
- </span>
50
+ <div class="flex items-center gap-5" v-else>
51
+ <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
52
+ <span class="inline-flex gap-2.5 items-center">
53
+ <img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url" />
54
+ {{ sellAmountFormatted }}
55
+ <span class="uppercase">{{ sellToken?.symbol }}</span>
56
+ <SvgoRefresh class="w-4 h-4 text-slate-400 mx-2" />
57
+ <img width="20" height="20" class="w-5 h-5" :src="buyToken?.logo_url" />
58
+ ~ {{ buyAmountFormatted }}
59
+ <span class="uppercase">{{ buyToken?.symbol }}</span>
60
+ <span class="capitalize hidden sm:flex items-center gap-2.5" v-if="metadata.protocol && !compact">
61
+ On
62
+ <ProtocolLogo class="w-5 h-5" :name="metadata.protocol" />
63
+ {{ formatProtocol(metadata.protocol) }}
72
64
  </span>
73
- </div>
65
+ </span>
66
+ </div>
74
67
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.0-dev.b89d937",
3
+ "version": "0.0.0-dev.b8bae6e",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
package/utils/metadata.ts CHANGED
@@ -19,7 +19,8 @@ export const MetadataEnums = {
19
19
  "remove-signers": "remove-signers",
20
20
  "change-threshold": "change-threshold",
21
21
  import: "import",
22
- "transaction-builder": "transaction-builder",
22
+ "tx-builder": "tx-builder",
23
+ "avocado-bridge": "avocado-bridge",
23
24
  } as const;
24
25
 
25
26
  const multiMetadataTypes = ["bytes[]"];
@@ -58,7 +59,7 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
58
59
  import: ["bytes32 protocol", "uint256 valueInUsd"],
59
60
  auth: ["address address", "uint256 chainId", "bool remove"],
60
61
  deploy: [],
61
- "transaction-builder": ["bytes32 actionCount"],
62
+ "tx-builder": ["bytes32 actionCount"],
62
63
  permit2: [
63
64
  "address token",
64
65
  "address spender",
@@ -70,6 +71,7 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
70
71
  "remove-signers": ["address[] signers"],
71
72
  "change-threshold": ["uint8 count"],
72
73
  rejection: ["bytes32 id"],
74
+ "avocado-bridge": ["bytes32 id", "uint256 toChainId"],
73
75
  };
74
76
 
75
77
  const encodeMetadata = (props: MetadataProps) => {
@@ -97,6 +99,24 @@ export const encodeDappMetadata = (
97
99
  return single ? encodeMultipleActions(data) : data;
98
100
  };
99
101
 
102
+ export const encodeAvocadoBridgeMetadata = (
103
+ id: string,
104
+ toChainId: string | number,
105
+ single = true
106
+ ) => {
107
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
108
+ actionMetadataTypes["avocado-bridge"],
109
+ [id, toChainId]
110
+ );
111
+
112
+ const data = encodeMetadata({
113
+ type: MetadataEnums["avocado-bridge"],
114
+ encodedData,
115
+ });
116
+
117
+ return single ? encodeMultipleActions(data) : data;
118
+ };
119
+
100
120
  export const encodeTransferMetadata = (
101
121
  params: SendMetadataProps,
102
122
  single = true
@@ -182,12 +202,12 @@ export const encodeTransactionBuilderMetadata = (
182
202
  single = true
183
203
  ) => {
184
204
  const encodedData = ethers.utils.defaultAbiCoder.encode(
185
- actionMetadataTypes["transaction-builder"],
205
+ actionMetadataTypes["tx-builder"],
186
206
  [actionCount]
187
207
  );
188
208
 
189
209
  const data = encodeMetadata({
190
- type: MetadataEnums["transaction-builder"],
210
+ type: MetadataEnums["tx-builder"],
191
211
  encodedData,
192
212
  });
193
213
 
@@ -476,9 +496,9 @@ const typesPayload: IPayload = {
476
496
  deploy: (data, type) => ({
477
497
  type,
478
498
  }),
479
- "transaction-builder": (data, type) => ({
499
+ "tx-builder": (data, type) => ({
480
500
  type,
481
- actionCount: data.actionCount ? toBN(data.actionCount).toNumber() : 0,
501
+ actionCount: utils.parseBytes32String(data.actionCount || ""),
482
502
  }),
483
503
  permit2: (data, type) => ({
484
504
  type,
@@ -521,6 +541,11 @@ const typesPayload: IPayload = {
521
541
  type,
522
542
  count: data.count,
523
543
  }),
544
+ "avocado-bridge": (data, type) => ({
545
+ type,
546
+ id: data.id,
547
+ toChainId: data.toChainId ? data.toChainId.toString() : null,
548
+ }),
524
549
  };
525
550
 
526
551
  const parseMetadata = (metadata: string) => {
package/utils/network.ts CHANGED
@@ -26,6 +26,8 @@ export const networks: Network[] = [
26
26
  usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
27
27
  explorerUrl: "https://polygonscan.com",
28
28
  apiURL: "https://api.polygonscan.com",
29
+ fakeTransactionHash:
30
+ "0x906c551abd5873a428505b6530ac14d91367820706c7ee525f6d7313265d1c92",
29
31
  get serverRpcUrl() {
30
32
  return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
31
33
  },
@@ -48,6 +50,8 @@ export const networks: Network[] = [
48
50
  chainId: 42161,
49
51
  usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
50
52
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
53
+ fakeTransactionHash:
54
+ "0x9fa291c3b09d31f19b1fa5dd05f30169d1364036d5f7c14b026410bc07bd8843",
51
55
  explorerUrl: "https://arbiscan.io",
52
56
  apiURL: "https://api.arbiscan.io",
53
57
  get serverRpcUrl() {
@@ -70,6 +74,8 @@ export const networks: Network[] = [
70
74
  zerionName: "ethereum",
71
75
  chainId: 1,
72
76
  explorerUrl: "https://etherscan.io",
77
+ fakeTransactionHash:
78
+ "0x13232dd32cef2f641ead890a507710c96560c8c9c3d5fab6facb5ec563c49433",
73
79
  apiURL: "https://api.etherscan.io",
74
80
  color: "#5D5FEF",
75
81
  get serverRpcUrl() {
@@ -92,6 +98,8 @@ export const networks: Network[] = [
92
98
  color: "#1E2024",
93
99
  ankrName: "base",
94
100
  explorerUrl: "https://basescan.org",
101
+ fakeTransactionHash:
102
+ "0xf7833d80da33730c4fc5d4c64151f0eaa64c0c0535be022af0228a44cc4e9c8e",
95
103
  apiURL: "https://api.basescan.org",
96
104
  get serverRpcUrl() {
97
105
  return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
@@ -118,6 +126,8 @@ export const networks: Network[] = [
118
126
  apiURL: "https://api-optimistic.etherscan.io",
119
127
  usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
120
128
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
129
+ fakeTransactionHash:
130
+ "0xee7311d68059732b05088f2144dfec6c7a4f5fd0433eb85306afcd6bdf17cebc",
121
131
  explorerUrl: "https://optimistic.etherscan.io",
122
132
  get serverRpcUrl() {
123
133
  return process.env?.OPTIMISM_RPC_URL || this.params.rpcUrls[0];
@@ -140,6 +150,8 @@ export const networks: Network[] = [
140
150
  explorerUrl: "https://zkevm.polygonscan.com",
141
151
  apiURL: "https://api-zkevm.polygonscan.com",
142
152
  balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
153
+ fakeTransactionHash:
154
+ "0x1077130463ade91ad4e9c43c3195298e26a99970975238128912490eea12bf41",
143
155
  usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
144
156
  get serverRpcUrl() {
145
157
  return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
@@ -162,6 +174,8 @@ export const networks: Network[] = [
162
174
  color: "#F3BA2F",
163
175
  chainId: 56,
164
176
  explorerUrl: "https://bscscan.com",
177
+ fakeTransactionHash:
178
+ "0x897d54bf8e492f840bd4d8f1e743bfcab8226ab4d5a899e47ee433dcd6d6abf7",
165
179
  apiURL: "https://api.bscscan.com",
166
180
  usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
167
181
  balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
@@ -188,6 +202,8 @@ export const networks: Network[] = [
188
202
  usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
189
203
  balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
190
204
  explorerUrl: "https://snowtrace.io",
205
+ fakeTransactionHash:
206
+ "0x233aac7402558dd4e23f938a50f983e67f5c9604233981c7ac74e63737b8294e",
191
207
  apiURL: "https://api.snowtrace.io",
192
208
  get serverRpcUrl() {
193
209
  return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
@@ -214,6 +230,8 @@ export const networks: Network[] = [
214
230
  },
215
231
  usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
216
232
  balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
233
+ fakeTransactionHash:
234
+ "0x1e9a8405d660172314124e06896212c0786d7fb1550b89410d4bc87e9e8054e4",
217
235
  params: {
218
236
  rpcUrls: ["https://rpc.ankr.com/fantom"],
219
237
  chainName: "Fantom",
@@ -233,6 +251,8 @@ export const networks: Network[] = [
233
251
  chainId: 100,
234
252
  balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
235
253
  explorerUrl: "https://gnosisscan.io",
254
+ fakeTransactionHash:
255
+ "0x1513033806310a2c3b29f2276f8aa7388461b0ef9f8499c297e68c12187c179b",
236
256
  apiURL: "https://api.gnosisscan.io",
237
257
  usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
238
258
  get serverRpcUrl() {
@@ -254,6 +274,8 @@ export const networks: Network[] = [
254
274
  zerionName: "aurora",
255
275
  color: "#78d64b",
256
276
  explorerUrl: "https://explorer.mainnet.aurora.dev",
277
+ fakeTransactionHash:
278
+ "0x0923401c5a80c39a5cd57c098a6c4729edbefd0db6894def7d349493f4ff3ec6",
257
279
  get serverRpcUrl() {
258
280
  return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0];
259
281
  },
@@ -269,32 +291,75 @@ export const networks: Network[] = [
269
291
  },
270
292
  },
271
293
  },
272
- // {
273
- // name: "Fuse",
274
- // chainId: 122,
275
- // zerionName: "fuse",
276
- // color: "#78d64b",
277
- // explorerUrl: "https://explorer.fuse.io",
278
- // get serverRpcUrl() {
279
- // return process.env?.FUSE_RPC_URL || this.params.rpcUrls[0];
280
- // },
281
- // usdcAddress: "",
282
- // balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
283
- // params: {
284
- // rpcUrls: ["https://fuse-mainnet.chainstacklabs.com"],
285
- // chainName: "Fuse",
286
- // nativeCurrency: {
287
- // decimals: 18,
288
- // name: "Fuse",
289
- // symbol: "fuse",
290
- // },
291
- // },
292
- // },
294
+ {
295
+ name: "Fuse",
296
+ chainId: 122,
297
+ zerionName: "fuse",
298
+ color: "#78d64b",
299
+ explorerUrl: "https://explorer.fuse.io",
300
+ fakeTransactionHash:
301
+ "0xf22a8031de9b978a57c728e18c6b54633356c39db4d0466e53b9b7c3ee7f8def",
302
+ get serverRpcUrl() {
303
+ return process.env?.FUSE_RPC_URL || this.params.rpcUrls[0];
304
+ },
305
+ usdcAddress: "",
306
+ balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
307
+ params: {
308
+ rpcUrls: ["https://fuse-mainnet.chainstacklabs.com"],
309
+ chainName: "Fuse",
310
+ nativeCurrency: {
311
+ decimals: 18,
312
+ name: "Fuse",
313
+ symbol: "fuse",
314
+ },
315
+ },
316
+ },
317
+ {
318
+ name: "Scroll",
319
+ chainId: 534352,
320
+ color: "#78d64b",
321
+ explorerUrl: "https://scrollscan.com",
322
+ fakeTransactionHash:
323
+ "0x6bf297c414264fc8cddd47224632b4426a02138df2f50fe891eca87f6aefea01",
324
+ get serverRpcUrl() {
325
+ return process.env?.SCROLL_RPC_URL || this.params.rpcUrls[0];
326
+ },
327
+ params: {
328
+ rpcUrls: ["https://rpc.scroll.io"],
329
+ chainName: "Scroll",
330
+ nativeCurrency: {
331
+ name: "Ethereum",
332
+ symbol: "ETH",
333
+ decimals: 18,
334
+ },
335
+ },
336
+ },
337
+ {
338
+ name: "opBNB",
339
+ chainId: 204,
340
+ color: "#78d64b",
341
+ explorerUrl: "https://opbnbscan.com",
342
+ fakeTransactionHash:
343
+ "0xb9438a3eae61442bc7d419d79930370ce09ac0f46e0695025751e3bfe1a931e7",
344
+ get serverRpcUrl() {
345
+ return process.env?.OPBNB_RPC_URL || this.params.rpcUrls[0];
346
+ },
347
+ params: {
348
+ rpcUrls: ["https://opbnb-mainnet-rpc.bnbchain.org"],
349
+ chainName: "opBNB",
350
+ nativeCurrency: {
351
+ name: "BNB",
352
+ symbol: "BNB",
353
+ decimals: 18,
354
+ },
355
+ },
356
+ },
293
357
  {
294
358
  name: AVO_PROD_CHAIN_NAME,
295
359
  chainId: AVO_PROD_CHAIN_ID,
296
360
  isAvocado: true,
297
361
  balanceResolverAddress: "",
362
+ fakeTransactionHash: "",
298
363
  color: "#16A34A",
299
364
  usdcAddress: "",
300
365
  serverRpcUrl: AVO_PROD_RPC_URL,
@@ -316,6 +381,7 @@ export const networks: Network[] = [
316
381
  serverRpcUrl: AVO_STAGING_RPC_URL,
317
382
  color: "#16A34A",
318
383
  explorerUrl: AVO_STAGING_EXPLORER_URL,
384
+ fakeTransactionHash: "",
319
385
  isAvocado: true,
320
386
  balanceResolverAddress: "",
321
387
  usdcAddress: "",
@@ -338,6 +404,7 @@ export const chainUsdcAddresses = [
338
404
  { chainId: 56, address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d" },
339
405
  { chainId: 100, address: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83" },
340
406
  { chainId: 137, address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" },
407
+ { chainId: 137, address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359" },
341
408
  { chainId: 250, address: "0x04068da6c83afcfa0e13ba15a6696662335d5b75" },
342
409
  { chainId: 42161, address: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" },
343
410
  { chainId: 42161, address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831" },
@@ -363,12 +430,16 @@ export const availableNetworks = networks.filter(
363
430
 
364
431
  export const chainIdToName = (chainId: ChainId | number | string) => {
365
432
  const network = getNetworkByChainId(chainId);
366
- return network.name;
433
+ return network?.name;
367
434
  };
368
435
 
369
436
  export const getRpcURLByChainId = (chainId: ChainId | number | string) => {
370
- const network = getNetworkByChainId(chainId);
371
- return network.params.rpcUrls[0];
437
+ try {
438
+ const network = getNetworkByChainId(chainId);
439
+ return network.params.rpcUrls[0];
440
+ } catch (e) {
441
+ return "";
442
+ }
372
443
  };
373
444
 
374
445
  export const RPCMap = networks.reduce((acc, network) => {
@@ -410,5 +481,6 @@ export const getExplorerUrl = (
410
481
  suffix: `/${string}` = "/"
411
482
  ) => {
412
483
  const network = getNetworkByChainId(chainId);
484
+ if (!network) return "";
413
485
  return `${network.explorerUrl}${suffix}`;
414
486
  };
package/utils/utils.d.ts CHANGED
@@ -13,6 +13,8 @@ declare global {
13
13
  | 1313161554
14
14
  | 8453
15
15
  | 122
16
+ | 534352
17
+ | 204
16
18
  | 63400;
17
19
 
18
20
  type ISlackMessageType = "danger" | "error" | "success" | "banner";
@@ -33,8 +35,9 @@ declare global {
33
35
  isAvocado?: boolean;
34
36
  serverRpcUrl: string | undefined;
35
37
  balanceResolverAddress?: string;
36
- usdcAddress: string;
38
+ usdcAddress?: string;
37
39
  explorerUrl: string;
40
+ fakeTransactionHash: string;
38
41
  apiURL?: string;
39
42
  params: {
40
43
  chainName?: string;