@instadapp/avocado-base 0.0.0-dev.a0ec235 → 0.0.0-dev.a28ed52

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.
@@ -1,6 +1,6 @@
1
1
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
2
  xmlns="http://www.w3.org/2000/svg">
3
- <path d="M11.8555 8.14404L8.14316 11.8564" stroke="#EB5757" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
- <path d="M8.14453 8.14404L11.8568 11.8564" stroke="#EB5757" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
- <rect x="3.75" y="3.75" width="12.5" height="12.5" rx="6.25" stroke="#EB5757" stroke-width="1.5"/>
3
+ <path d="M11.8555 8.14404L8.14316 11.8564" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M8.14453 8.14404L11.8568 11.8564" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <rect x="3.75" y="3.75" width="12.5" height="12.5" rx="6.25" stroke="currentColor" stroke-width="1.5"/>
6
6
  </svg>
@@ -1,8 +1,8 @@
1
1
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
2
  xmlns="http://www.w3.org/2000/svg">
3
- <path d="M4.64453 7.21045H15.3588" stroke="#EB5757" stroke-width="1.5" stroke-linecap="round"/>
4
- <path d="M13.8495 7.21045H6.14754L6.09242 8.20701C5.98681 10.1164 6.07654 12.0315 6.36021 13.9227C6.48391 14.7473 7.19233 15.3574 8.02623 15.3574H11.9708C12.8047 15.3574 13.5131 14.7473 13.6368 13.9227C13.9205 12.0315 14.0102 10.1164 13.9046 8.207L13.8495 7.21045Z" stroke="#EB5757" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
- <path d="M7.85938 7.21039V6.7825C7.85938 6.21509 8.08478 5.67091 8.486 5.26969C8.88722 4.86847 9.4314 4.64307 9.99881 4.64307C10.5662 4.64307 11.1104 4.86847 11.5116 5.26969C11.9128 5.67091 12.1382 6.21509 12.1382 6.7825V7.21039" stroke="#EB5757" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
- <path d="M8.71484 9.50195V13.0487" stroke="#EB5757" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
7
- <path d="M11.2852 9.50195V13.0487" stroke="#EB5757" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M4.64453 7.21045H15.3588" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
4
+ <path d="M13.8495 7.21045H6.14754L6.09242 8.20701C5.98681 10.1164 6.07654 12.0315 6.36021 13.9227C6.48391 14.7473 7.19233 15.3574 8.02623 15.3574H11.9708C12.8047 15.3574 13.5131 14.7473 13.6368 13.9227C13.9205 12.0315 14.0102 10.1164 13.9046 8.207L13.8495 7.21045Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M7.85938 7.21039V6.7825C7.85938 6.21509 8.08478 5.67091 8.486 5.26969C8.88722 4.86847 9.4314 4.64307 9.99881 4.64307C10.5662 4.64307 11.1104 4.86847 11.5116 5.26969C11.9128 5.67091 12.1382 6.21509 12.1382 6.7825V7.21039" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M8.71484 9.50195V13.0487" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
7
+ <path d="M11.2852 9.50195V13.0487" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
8
8
  </svg>
@@ -26,13 +26,13 @@ defineProps<{
26
26
  <CrossTransferSVG class="text-primary" v-else-if="action === 'cross-transfer'"/>
27
27
  <TransferSVG class="text-primary" v-else-if="action === 'transfer'"/>
28
28
  <PlusCircleSVG class="text-primary" v-else-if="action === 'add-signers' || (action === 'auth' && !remove)"/>
29
- <Trash2SVG v-else-if="action === 'remove-signers' || (action === 'auth' && remove)"/>
29
+ <Trash2SVG class="text-[#EB5757]" v-else-if="action === 'remove-signers' || (action === 'auth' && remove)"/>
30
+ <RejectProposalSVG class="text-[#EB5757]" v-else-if="action === 'rejection'"/>
30
31
  <ChangeThresholdSVG v-else-if="action === 'change-threshold'"/>
31
32
  <DappSVG v-else-if="action === 'dapp'"/>
32
33
  <DeploySVG v-else-if="action === 'deploy'"/>
33
34
  <GasSVG v-else-if="action === 'gas-topup'"/>
34
35
  <InstadappProSVG v-else-if="action === 'instadapp-pro'"/>
35
36
  <PermitSignSVG v-else-if="action === 'permit2'"/>
36
- <RejectProposalSVG v-else-if="action === 'rejection'"/>
37
37
  <UpgradeSVG v-else-if="action === 'upgrade'"/>
38
38
  </template>
@@ -7,9 +7,11 @@ const props = defineProps<{
7
7
  };
8
8
  chain_id: number | string;
9
9
  compact?: boolean;
10
+ tokens?: ITokenPrice[];
10
11
  }>();
11
12
 
12
13
  provide('compact', props.compact);
14
+ provide('tokens', props.tokens);
13
15
 
14
16
  </script>
15
17
 
@@ -70,4 +72,4 @@ provide('compact', props.compact);
70
72
  {{ shortenHash(metadata.id) }}
71
73
  </div>
72
74
  </div>
73
- </template>
75
+ </template>
@@ -0,0 +1,64 @@
1
+ <script setup lang="ts">
2
+ import CopySVG from '~/assets/images/icons/copy.svg'
3
+ import CheckCircle from '~/assets/images/icons/check-circle.svg'
4
+
5
+ defineProps<{
6
+ text: string
7
+ iconOnly?: boolean
8
+ successText?: string
9
+ }>()
10
+ const { copy, copied } = useClipboard()
11
+ const slots = useSlots()
12
+ </script>
13
+
14
+ <template>
15
+ <button
16
+ class="text-slate-400 font-semibold inline-flex items-center gap-2.5"
17
+ @click.stop="copy(text)"
18
+ >
19
+ <Transition mode="out-in" name="slide-left">
20
+ <span v-if="copied && !iconOnly"> {{ successText || 'Copied' }} </span>
21
+ <span v-else-if="slots.content">
22
+ <slot name="content" />
23
+ </span>
24
+ </Transition>
25
+
26
+ <Transition mode="out-in" name="slide">
27
+ <CheckCircle
28
+ v-if="copied"
29
+ class="w-4 h-4 shrink-0 dark:text-slate-900 text-white svg-circle"
30
+ />
31
+ <slot v-else-if="slots.copy" name="copy" />
32
+ <slot v-else name="copy-icon">
33
+ <CopySVG />
34
+ </slot>
35
+ </Transition>
36
+ </button>
37
+ </template>
38
+
39
+ <style scoped>
40
+ .slide-left-enter-active,
41
+ .slide-left-leave-active {
42
+ transition: all 0.1s ease-out;
43
+ }
44
+
45
+ .slide-left-enter-from {
46
+ opacity: 0;
47
+ transform: translateX(30px);
48
+ }
49
+
50
+ .slide-left-leave-to {
51
+ opacity: 0;
52
+ transform: translateX(-30px);
53
+ }
54
+
55
+ .slide-enter-active,
56
+ .slide-leave-active {
57
+ transition: opacity 0.1s ease;
58
+ }
59
+
60
+ .slide-enter-from,
61
+ .slide-leave-to {
62
+ opacity: 0;
63
+ }
64
+ </style>
@@ -6,9 +6,13 @@ const props = defineProps<{
6
6
  }>();
7
7
 
8
8
  const compact = inject('compact');
9
+ const tokens = inject<ITokenPrice[]>('tokens');
9
10
 
10
11
  const toToken = asyncComputed(() =>
11
- fetchTokenByAddress(props.metadata?.toToken, props.metadata?.toChainId)
12
+ {
13
+ if (Array.isArray(tokens) && !tokens.length) return null;
14
+ return fetchTokenByAddress(props.metadata?.toToken, props.metadata?.toChainId, tokens)
15
+ }
12
16
  );
13
17
 
14
18
  const bridgeAmountFormatted = computed(() =>
@@ -6,13 +6,17 @@ const props = defineProps<{
6
6
  }>();
7
7
 
8
8
  const compact = inject('compact');
9
+ const tokens = inject<ITokenPrice[]>('tokens');
9
10
 
10
11
  const fromToken = asyncComputed(() => {
11
12
  if (!props?.chain_id) return null;
12
13
 
14
+ if (Array.isArray(tokens) && !tokens.length) return null;
15
+
13
16
  return fetchTokenByAddress(
14
17
  props.metadata?.fromToken,
15
- props?.chain_id
18
+ props?.chain_id,
19
+ tokens
16
20
  );
17
21
  });
18
22
 
@@ -5,8 +5,14 @@ const props = defineProps<{
5
5
  chain_id: number | string
6
6
  }>();
7
7
 
8
+ const tokens = inject<ITokenPrice[]>('tokens');
9
+
8
10
  const token = asyncComputed(() =>
9
- fetchTokenByAddress(props.metadata?.token, props?.chain_id)
11
+ {
12
+ if (Array.isArray(tokens) && !tokens.length) return null;
13
+
14
+ return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
15
+ }
10
16
  );
11
17
 
12
18
  const compact = inject('compact');
@@ -5,8 +5,13 @@ const props = defineProps<{
5
5
  chain_id: number | string
6
6
  }>();
7
7
 
8
+ const tokens = inject<ITokenPrice[]>('tokens');
9
+
8
10
  const token = asyncComputed(() =>
9
- fetchTokenByAddress(props.metadata?.token, props?.chain_id)
11
+ {
12
+ if (Array.isArray(tokens) && !tokens.length) return null;
13
+ return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
14
+ }
10
15
  );
11
16
 
12
17
  const calculateDate = (timestamp: number) => {
@@ -6,12 +6,19 @@ const props = defineProps<{
6
6
  }>();
7
7
 
8
8
  const compact = inject('compact');
9
+ const tokens = inject<ITokenPrice[]>('tokens');
9
10
 
10
11
  const buyToken = asyncComputed(() =>
11
- fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id)
12
+ {
13
+ if (Array.isArray(tokens) && !tokens.length) return null;
14
+ return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
15
+ }
12
16
  );
13
17
  const sellToken = asyncComputed(() =>
14
- fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id)
18
+ {
19
+ if (Array.isArray(tokens) && !tokens.length) return null;
20
+ return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
21
+ }
15
22
  );
16
23
 
17
24
  const sellAmountFormatted = computed(() =>
@@ -6,13 +6,17 @@ const props = defineProps<{
6
6
  }>();
7
7
 
8
8
  const compact = inject('compact');
9
+ const tokens = inject<ITokenPrice[]>('tokens');
9
10
 
10
11
  const token = asyncComputed(() => {
11
12
  if (!props?.chain_id) return null;
12
13
 
14
+ if (Array.isArray(tokens) && !tokens.length) return null;
15
+
13
16
  return fetchTokenByAddress(
14
17
  props.metadata?.token,
15
- props?.chain_id
18
+ props?.chain_id,
19
+ tokens
16
20
  );
17
21
  });
18
22
 
@@ -28,9 +32,9 @@ const formattedAmount = computed(() =>
28
32
  <div class="flex items-center gap-5" v-else>
29
33
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
30
34
  <span class="inline-flex gap-2.5 items-center">
31
- <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
32
35
  {{ formattedAmount }}
33
36
  <span class="uppercase">{{ token?.symbol }}</span>
37
+ <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
34
38
  <SvgoArrowRight class="w-4 h-4 text-slate-400 mx-2" />
35
39
  <NuxtLink
36
40
  class="text-primary"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.0-dev.a0ec235",
3
+ "version": "0.0.0-dev.a28ed52",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
@@ -72,7 +72,7 @@ export function formatDecimal(value: string | number, fractionDigits?: number) {
72
72
  let decimals;
73
73
 
74
74
  if (num.lt(1)) {
75
- decimals = 8;
75
+ decimals = 4;
76
76
  } else if (num.lt(10)) {
77
77
  decimals = 6;
78
78
  } else if (num.lt(100)) {
package/utils/network.ts CHANGED
@@ -175,7 +175,6 @@ export const networks: Network[] = [
175
175
  params: {
176
176
  chainName: "polygon zkEVM",
177
177
  rpcUrls: ["https://zkevm-rpc.com"],
178
-
179
178
  nativeCurrency: {
180
179
  name: "Ethereum",
181
180
  symbol: "ETH",
@@ -225,6 +224,26 @@ export const networks: Network[] = [
225
224
  decimals: 18,
226
225
  },
227
226
  },
227
+ },
228
+ {
229
+ name: 'Base',
230
+ chainId: 8453,
231
+ color: '#1E2024',
232
+ explorerUrl: 'https://basescan.org',
233
+ get serverRpcUrl() {
234
+ return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
235
+ },
236
+ usdcAddress: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
237
+ balanceResolverAddress: '0x23c8EAb8a4373dD16b0947Ebe8bf76Ff7A49d13C',
238
+ params: {
239
+ rpcUrls: ['https://rpc.ankr.com/base'],
240
+ chainName: "Base",
241
+ nativeCurrency: {
242
+ name: "Ethereum",
243
+ symbol: "ETH",
244
+ decimals: 18,
245
+ },
246
+ }
228
247
  },
229
248
  {
230
249
  name: AVO_PROD_CHAIN_NAME,
@@ -268,6 +287,22 @@ export const networks: Network[] = [
268
287
  },
269
288
  ];
270
289
 
290
+ export const chainUsdcAddresses = [
291
+ { chainId: 1, address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' },
292
+ { chainId: 10, address: '0x7f5c764cbc14f9669b88837ca1490cca17c31607' },
293
+ { chainId: 56, address: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d' },
294
+ { chainId: 100, address: '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' },
295
+ { chainId: 137, address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' },
296
+ { chainId: 250, address: '0x04068da6c83afcfa0e13ba15a6696662335d5b75' },
297
+ { chainId: 42161, address: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' },
298
+ { chainId: 42161, address: '0xaf88d065e77c8cc2239327c5edb3a432268e5831' },
299
+ { chainId: 43114, address: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e' },
300
+ { chainId: 43114, address: '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' },
301
+ { chainId: 1101, address: '0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035' },
302
+ { chainId: 1313161554, address: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802' },
303
+ { chainId: 8453, address: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA'}
304
+ ];
305
+
271
306
  export const getNetworkByChainId = (
272
307
  chainId: ChainId | number | string
273
308
  ): Network => {
package/utils/services.ts CHANGED
@@ -1,8 +1,15 @@
1
1
  export const fetchTokenByAddress = async (
2
2
  address: string,
3
- chainId: string | number
3
+ chainId: string | number,
4
+ tokens?: ITokenPrice[]
4
5
  ) => {
5
6
  if (!address || !chainId) return null;
7
+
8
+ if (tokens?.length) {
9
+ const token = tokens.find((token) => token.address?.toLocaleLowerCase() === address?.toLocaleLowerCase() && token.chain_id == chainId);
10
+ if (token) return token;
11
+ }
12
+
6
13
  const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
7
14
  params: {
8
15
  sparkline: false,
package/utils/utils.d.ts CHANGED
@@ -11,6 +11,7 @@ declare global {
11
11
  | 250
12
12
  | 634
13
13
  | 1313161554
14
+ | 8453
14
15
  | 63400;
15
16
 
16
17
  type ISlackMessageType = "danger" | "error" | "success" | "banner";