@instadapp/avocado-base 0.0.0-dev.d8050bd → 0.0.0-dev.dcb4af3

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.
Files changed (39) hide show
  1. package/.github/workflows/npm-publish-dev.yml +2 -5
  2. package/.vscode/settings.json +67 -0
  3. package/abi/avoFactoryProxy.json +1 -1
  4. package/abi/forwarder.json +1 -1
  5. package/abi/multisigAgnosticForwarder.json +937 -0
  6. package/abi/multisigForwarder.json +680 -680
  7. package/app.vue +5 -5
  8. package/assets/images/icons/check.svg +3 -0
  9. package/assets/images/icons/copy.svg +9 -2
  10. package/assets/images/icons/stars.svg +4 -0
  11. package/components/ActionLogo.vue +33 -31
  12. package/components/ActionMetadata.vue +30 -20
  13. package/components/Address.vue +74 -0
  14. package/components/AuthorityAvatar.vue +4 -3
  15. package/components/ChainLogo.vue +22 -25
  16. package/components/CopyClipboard.vue +16 -38
  17. package/components/metadata/Bridge.vue +22 -23
  18. package/components/metadata/CrossTransfer.vue +29 -32
  19. package/components/metadata/GasTopup.vue +14 -15
  20. package/components/metadata/Permit2.vue +12 -13
  21. package/components/metadata/Signers.vue +11 -55
  22. package/components/metadata/Swap.vue +45 -53
  23. package/components/metadata/Transfer.vue +26 -27
  24. package/contracts/MultisigAgnosticForwarder.ts +1423 -0
  25. package/contracts/factories/MultisigAgnosticForwarder__factory.ts +2135 -0
  26. package/contracts/factories/index.ts +1 -0
  27. package/contracts/index.ts +2 -0
  28. package/eslint.config.mjs +34 -0
  29. package/nuxt.config.ts +21 -12
  30. package/package.json +14 -14
  31. package/server/utils/index.ts +4 -4
  32. package/utils/avocado.ts +17 -17
  33. package/utils/bignumber.ts +47 -36
  34. package/utils/formatter.ts +55 -61
  35. package/utils/helper.ts +33 -30
  36. package/utils/metadata.ts +408 -349
  37. package/utils/network.ts +508 -263
  38. package/utils/services.ts +11 -13
  39. package/utils/utils.d.ts +117 -103
@@ -1,35 +1,34 @@
1
1
  <script setup lang="ts">
2
-
3
2
  const props = defineProps<{
4
- metadata: any;
3
+ metadata: any
5
4
  chain_id: number | string
6
- }>();
5
+ }>()
7
6
 
8
- const tokens = inject<ITokenPrice[]>('tokens');
7
+ const tokens = inject<ITokenPrice[]>('tokens')
9
8
 
10
- const token = asyncComputed(() =>
11
- {
12
- if (Array.isArray(tokens) && !tokens.length) return null;
9
+ const token = asyncComputed(() => {
10
+ if (Array.isArray(tokens) && !tokens.length)
11
+ return null
13
12
 
14
13
  return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
15
- }
16
- );
14
+ },
15
+ )
17
16
 
18
- const compact = inject('compact');
17
+ const compact = inject('compact')
19
18
 
20
19
  const formattedAmount = computed(() =>
21
20
  formatDecimal(
22
- fromWei(props.metadata?.amount, token?.value?.decimals).toFixed()
23
- )
24
- );
21
+ fromWei(props.metadata?.amount, token?.value?.decimals).toFixed(),
22
+ ),
23
+ )
25
24
  </script>
26
25
 
27
26
  <template>
28
27
  <div v-if="!token" class="rounded-5 w-24 h-4 loading-box" />
29
- <div class="flex items-center gap-5" v-else>
28
+ <div v-else class="flex items-center gap-5">
30
29
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
31
30
  <span class="inline-flex gap-2.5 items-center">
32
- <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
31
+ <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url">
33
32
  {{ formattedAmount }}
34
33
  <span class="uppercase">{{ token?.symbol }}</span>
35
34
  <SvgoGas class="w-4 h-4 text-slate-400 mx-2" />
@@ -1,29 +1,28 @@
1
1
  <script setup lang="ts">
2
-
3
2
  const props = defineProps<{
4
- metadata: any;
3
+ metadata: any
5
4
  chain_id: number | string
6
- }>();
5
+ }>()
7
6
 
8
- const tokens = inject<ITokenPrice[]>('tokens');
7
+ const tokens = inject<ITokenPrice[]>('tokens')
9
8
 
10
- const token = asyncComputed(() =>
11
- {
12
- if (Array.isArray(tokens) && !tokens.length) return null;
9
+ const token = asyncComputed(() => {
10
+ if (Array.isArray(tokens) && !tokens.length)
11
+ return null
13
12
  return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
14
- }
15
- );
13
+ },
14
+ )
16
15
 
17
- const calculateDate = (timestamp: number) => {
18
- return new Date(timestamp * 1000).toLocaleString();
19
- };
16
+ function calculateDate(timestamp: number) {
17
+ return new Date(timestamp * 1000).toLocaleString()
18
+ }
20
19
  </script>
21
20
 
22
21
  <template>
23
22
  <div v-if="!token" class="rounded-5 w-24 h-4 loading-box" />
24
23
  <div v-else class="inline-flex items-center gap-2 flex-wrap">
25
24
  <span>Permit2 Allowance: </span>
26
- <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
25
+ <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url">
27
26
  <span class="capitalize">{{ token?.symbol }}</span>
28
27
  to
29
28
  <NuxtLink
@@ -1,63 +1,19 @@
1
1
  <script setup lang="ts">
2
- import { Tippy } from 'vue-tippy'
3
- import Info2 from '~/assets/images/icons/info-2.svg'
4
-
5
2
  defineProps<{
3
+ chain_id: number | string
6
4
  metadata: {
7
- type: MetadataTypes,
5
+ type: MetadataTypes
8
6
  [key: string]: any
9
- };
10
- compact?: boolean;
11
- }>();
7
+ }
8
+ compact?: boolean
9
+ }>()
12
10
  </script>
13
11
 
14
12
  <template>
15
- <div class="font-medium">
16
- <div v-if="!compact || metadata.addresses.length < 3" class="flex gap-[14px] flex-wrap items-end">
17
- <p v-if="!compact" class="text-xs"> {{ formatTxType(metadata.type) }} </p>
18
- <div v-for="address of metadata.addresses" :key="address" class="flex gap-2 rounded-full bg-slate-100 dark:bg-slate-800 justify-start items-center px-2 py-1.5">
19
- <AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
20
- <Tippy max-width="none" interactive>
21
- <template #default>
22
- <p class="text-xs leading-5 text-slate-500 dark:text-slate-400">
23
- {{ shortenHash(address, compact ? 2 : 4) }}
24
- </p>
25
- </template>
26
- <template #content>
27
- {{ address }}
28
- </template>
29
- </Tippy>
30
- </div>
31
- </div>
32
- <div v-else class="flex gap-2 flex-wrap items-center">
33
- <div v-for="address of [metadata.addresses[0], metadata.addresses[1]].filter(Boolean)" :key="address" class="flex gap-2 rounded-full bg-slate-100 dark:bg-slate-800 justify-start items-center px-2 py-1.5">
34
- <AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
35
-
36
- <Tippy max-width="none" interactive>
37
- <template #default>
38
- <p class="text-xs leading-5 text-slate-400">
39
- {{ shortenHash(address, 2) }}
40
- </p>
41
- </template>
42
- <template #content>
43
- {{ address }}
44
- </template>
45
- </Tippy>
46
- </div>
47
-
48
- <Tippy max-width="none" interactive tag="button" content-tag="div" content-class="content-wrapper">
49
- <template #default>
50
- <Info2 class="w-[16px] h-[16px] text-slate-500 rounded-full" />
51
- </template>
52
- <template #content>
53
- <ul class="flex flex-col gap-2.5">
54
- <li v-for="address in metadata.addresses" :key="address" class="flex text-xs text-slate-400 items-center gap-2.5">
55
- <AuthorityAvatar class="shrink-0 w-5 h-5" :address="address" />
56
- {{ address }}
57
- </li>
58
- </ul>
59
- </template>
60
- </Tippy>
61
- </div>
62
- </div>
13
+ <ul class="flex gap-2 flex-wrap">
14
+ <li v-for="address in metadata.addresses" :key="address" class="flex rounded-2xl gap-2 bg-gray-900 w-fit items-center py-1.5 px-2.5">
15
+ <AuthorityAvatar class="size-5" :address="address" />
16
+ <Address :address="address" />
17
+ </li>
18
+ </ul>
63
19
  </template>
@@ -1,74 +1,66 @@
1
1
  <script setup lang="ts">
2
-
3
2
  const props = defineProps<{
4
- metadata: any;
3
+ metadata: any
5
4
  chain_id: number | string
6
- }>();
5
+ }>()
7
6
 
8
- const compact = inject('compact');
9
- const tokens = inject<ITokenPrice[]>('tokens');
7
+ const compact = inject('compact')
8
+ const tokens = inject<ITokenPrice[]>('tokens')
10
9
 
11
- const buyToken = asyncComputed(() =>
12
- {
13
- if (Array.isArray(tokens) && !tokens.length) return null;
14
- return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
15
- }
16
- );
17
- const sellToken = asyncComputed(() =>
18
- {
19
- if (Array.isArray(tokens) && !tokens.length) return null;
20
- return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
21
- }
22
- );
10
+ const buyToken = asyncComputed(() => {
11
+ if (Array.isArray(tokens) && !tokens.length)
12
+ return null
13
+ return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
14
+ },
15
+ )
16
+ const sellToken = asyncComputed(() => {
17
+ if (Array.isArray(tokens) && !tokens.length)
18
+ return null
19
+ return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
20
+ },
21
+ )
23
22
 
24
23
  const sellAmountFormatted = computed(() =>
25
24
  formatDecimal(
26
- fromWei(props.metadata?.sellAmount, sellToken?.value?.decimals).toFixed()
27
- )
28
- );
25
+ fromWei(props.metadata?.sellAmount, sellToken?.value?.decimals).toFixed(),
26
+ ),
27
+ )
29
28
 
30
29
  const buyAmountFormatted = computed(() =>
31
30
  formatDecimal(
32
- fromWei(props.metadata?.buyAmount, buyToken?.value?.decimals).toFixed()
33
- )
34
- );
31
+ fromWei(props.metadata?.buyAmount, buyToken?.value?.decimals).toFixed(),
32
+ ),
33
+ )
35
34
 
36
- const formatProtocol = (protocol: string) => {
35
+ function formatProtocol(protocol: string) {
37
36
  return (
38
37
  new Map([
39
- ["1inch-v5", "1inch"],
40
- ["0x-v1", "0x"],
41
- ["paraswap-v5", "Paraswap"],
42
- ["kyber-v1", "Kyber Network"],
38
+ ['1inch-v5', '1inch'],
39
+ ['0x-v1', '0x'],
40
+ ['paraswap-v5', 'Paraswap'],
41
+ ['kyber-v1', 'Kyber Network'],
43
42
  ]).get(protocol) || protocol
44
- );
45
- };
46
-
47
-
43
+ )
44
+ }
48
45
  </script>
49
46
 
50
47
  <template>
51
48
  <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>
49
+ <div v-else class="flex items-center gap-5">
50
+ <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
51
+ <span class="inline-flex gap-2.5 items-center">
52
+ <img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url">
53
+ {{ sellAmountFormatted }}
54
+ <span class="uppercase">{{ sellToken?.symbol }}</span>
55
+ <SvgoRefresh class="w-4 h-4 text-slate-400 mx-2" />
56
+ <img width="20" height="20" class="w-5 h-5" :src="buyToken?.logo_url">
57
+ ~ {{ buyAmountFormatted }}
58
+ <span class="uppercase">{{ buyToken?.symbol }}</span>
59
+ <span v-if="metadata.protocol && !compact" class="capitalize hidden sm:flex items-center gap-2.5">
60
+ On
61
+ <ProtocolLogo class="w-5 h-5" :name="metadata.protocol" />
62
+ {{ formatProtocol(metadata.protocol) }}
72
63
  </span>
73
- </div>
64
+ </span>
65
+ </div>
74
66
  </template>
@@ -1,50 +1,49 @@
1
1
  <script setup lang="ts">
2
-
3
2
  const props = defineProps<{
4
- metadata: any;
3
+ metadata: any
5
4
  chain_id: number | string
6
- }>();
5
+ }>()
7
6
 
8
- const compact = inject('compact');
9
- const tokens = inject<ITokenPrice[]>('tokens');
7
+ const compact = inject('compact')
8
+ const tokens = inject<ITokenPrice[]>('tokens')
10
9
 
11
10
  const token = asyncComputed(() => {
12
- if (!props?.chain_id) return null;
11
+ if (!props?.chain_id)
12
+ return null
13
13
 
14
- if (Array.isArray(tokens) && !tokens.length) return null;
14
+ if (Array.isArray(tokens) && !tokens.length)
15
+ return null
15
16
 
16
17
  return fetchTokenByAddress(
17
18
  props.metadata?.token,
18
19
  props?.chain_id,
19
- tokens
20
- );
21
- });
20
+ tokens,
21
+ )
22
+ })
22
23
 
23
24
  const formattedAmount = computed(() =>
24
25
  formatDecimal(
25
- fromWei(props.metadata?.amount, token?.value?.decimals).toFixed()
26
- )
27
- );
26
+ fromWei(props.metadata?.amount, token?.value?.decimals).toFixed(),
27
+ 3,
28
+ ),
29
+ )
28
30
  </script>
29
31
 
30
32
  <template>
31
33
  <div v-if="!token" class="rounded-5 w-24 h-4 loading-box" />
32
- <div class="flex items-center gap-5" v-else>
34
+ <div v-else class="flex items-center gap-5">
33
35
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
34
36
  <span class="inline-flex gap-2.5 items-center">
35
- {{ formattedAmount }}
36
- <span class="uppercase">{{ token?.symbol }}</span>
37
- <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
38
- <SvgoArrowRight class="w-4 h-4 text-slate-400 mx-2" />
39
- <NuxtLink
40
- class="text-primary"
41
- target="_blank"
42
- external
43
- :to="
44
- getExplorerUrl(chain_id, `/address/${metadata.receiver}`)
45
- "
46
- >{{ shortenHash(metadata.receiver) }}
47
- </NuxtLink>
37
+ <span class="w-[8em]">
38
+ {{ formattedAmount }}
39
+ <span class="uppercase">{{ token?.symbol }}</span>
40
+ </span>
41
+ <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url">
42
+ <SvgoArrowRight class="w-4 h-4 text-slate-400" />
43
+ <Address
44
+ :to="getExplorerUrl(chain_id, `/address/${metadata.receiver}`)"
45
+ :address="metadata.receiver"
46
+ />
48
47
  </span>
49
48
  </div>
50
49
  </template>