@instadapp/avocado-base 0.0.0-dev.d66833c → 0.0.0-dev.d723a21

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 (37) hide show
  1. package/.vscode/settings.json +67 -0
  2. package/abi/avoFactoryProxy.json +1 -1
  3. package/abi/forwarder.json +1 -1
  4. package/abi/multisigAgnosticForwarder.json +937 -0
  5. package/abi/multisigForwarder.json +680 -680
  6. package/app.vue +5 -5
  7. package/assets/images/icons/check.svg +3 -0
  8. package/assets/images/icons/copy.svg +9 -2
  9. package/components/ActionLogo.vue +15 -15
  10. package/components/ActionMetadata.vue +26 -20
  11. package/components/Address.vue +74 -0
  12. package/components/AuthorityAvatar.vue +8 -6
  13. package/components/ChainLogo.vue +19 -15
  14. package/components/CopyClipboard.vue +15 -31
  15. package/components/metadata/Bridge.vue +22 -23
  16. package/components/metadata/CrossTransfer.vue +29 -32
  17. package/components/metadata/GasTopup.vue +14 -15
  18. package/components/metadata/Permit2.vue +12 -13
  19. package/components/metadata/Signers.vue +11 -58
  20. package/components/metadata/Swap.vue +29 -30
  21. package/components/metadata/Transfer.vue +26 -27
  22. package/contracts/MultisigAgnosticForwarder.ts +1423 -0
  23. package/contracts/factories/MultisigAgnosticForwarder__factory.ts +2135 -0
  24. package/contracts/factories/index.ts +1 -0
  25. package/contracts/index.ts +2 -0
  26. package/nuxt.config.ts +8 -13
  27. package/package.json +13 -18
  28. package/server/utils/index.ts +4 -4
  29. package/utils/avocado.ts +17 -17
  30. package/utils/bignumber.ts +47 -36
  31. package/utils/formatter.ts +54 -60
  32. package/utils/helper.ts +33 -30
  33. package/utils/metadata.ts +398 -354
  34. package/utils/network.ts +434 -300
  35. package/utils/services.ts +11 -13
  36. package/utils/utils.d.ts +114 -104
  37. package/components.d.ts +0 -13
@@ -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,66 +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"
19
- class="flex gap-2 rounded-full bg-slate-100 dark:bg-slate-800 justify-start items-center px-2 py-1.5">
20
- <AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
21
- <Tippy max-width="none" interactive>
22
- <template #default>
23
- <p class="text-xs leading-5 text-slate-500 dark:text-slate-400">
24
- {{ shortenHash(address, compact ? 2 : 4) }}
25
- </p>
26
- </template>
27
- <template #content>
28
- {{ address }}
29
- </template>
30
- </Tippy>
31
- </div>
32
- </div>
33
- <div v-else class="flex gap-2 flex-wrap items-center">
34
- <div v-for="address of [metadata.addresses[0], metadata.addresses[1]].filter(Boolean)" :key="address"
35
- class="flex gap-2 rounded-full bg-slate-100 dark:bg-slate-800 justify-start items-center px-2 py-1.5">
36
- <AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
37
-
38
- <Tippy max-width="none" interactive>
39
- <template #default>
40
- <p class="text-xs leading-5 text-slate-400">
41
- {{ shortenHash(address, 2) }}
42
- </p>
43
- </template>
44
- <template #content>
45
- {{ address }}
46
- </template>
47
- </Tippy>
48
- </div>
49
-
50
- <Tippy max-width="none" interactive tag="button" content-tag="div" content-class="content-wrapper">
51
- <template #default>
52
- <Info2 class="w-[16px] h-[16px] text-slate-500 rounded-full" />
53
- </template>
54
- <template #content>
55
- <ul class="flex flex-col gap-2.5">
56
- <li v-for="address in metadata.addresses" :key="address"
57
- class="flex text-xs text-slate-400 items-center gap-2.5">
58
- <AuthorityAvatar class="shrink-0 w-5 h-5" :address="address" />
59
- {{ address }}
60
- </li>
61
- </ul>
62
- </template>
63
- </Tippy>
64
- </div>
65
- </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>
66
19
  </template>
@@ -1,63 +1,62 @@
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 buyToken = asyncComputed(() => {
12
- if (Array.isArray(tokens) && !tokens.length) return null;
11
+ if (Array.isArray(tokens) && !tokens.length)
12
+ return null
13
13
  return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
14
- }
15
- );
14
+ },
15
+ )
16
16
  const sellToken = asyncComputed(() => {
17
- if (Array.isArray(tokens) && !tokens.length) return null;
17
+ if (Array.isArray(tokens) && !tokens.length)
18
+ return null
18
19
  return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
19
- }
20
- );
20
+ },
21
+ )
21
22
 
22
23
  const sellAmountFormatted = computed(() =>
23
24
  formatDecimal(
24
- fromWei(props.metadata?.sellAmount, sellToken?.value?.decimals).toFixed()
25
- )
26
- );
25
+ fromWei(props.metadata?.sellAmount, sellToken?.value?.decimals).toFixed(),
26
+ ),
27
+ )
27
28
 
28
29
  const buyAmountFormatted = computed(() =>
29
30
  formatDecimal(
30
- fromWei(props.metadata?.buyAmount, buyToken?.value?.decimals).toFixed()
31
- )
32
- );
31
+ fromWei(props.metadata?.buyAmount, buyToken?.value?.decimals).toFixed(),
32
+ ),
33
+ )
33
34
 
34
- const formatProtocol = (protocol: string) => {
35
+ function formatProtocol(protocol: string) {
35
36
  return (
36
37
  new Map([
37
- ["1inch-v5", "1inch"],
38
- ["0x-v1", "0x"],
39
- ["paraswap-v5", "Paraswap"],
40
- ["kyber-v1", "Kyber Network"],
38
+ ['1inch-v5', '1inch'],
39
+ ['0x-v1', '0x'],
40
+ ['paraswap-v5', 'Paraswap'],
41
+ ['kyber-v1', 'Kyber Network'],
41
42
  ]).get(protocol) || protocol
42
- );
43
- };
44
-
45
-
43
+ )
44
+ }
46
45
  </script>
47
46
 
48
47
  <template>
49
48
  <div v-if="!sellToken || !buyToken" class="rounded-5 w-24 h-4 loading-box" />
50
- <div class="flex items-center gap-5" v-else>
49
+ <div v-else class="flex items-center gap-5">
51
50
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
52
51
  <span class="inline-flex gap-2.5 items-center">
53
- <img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url" />
52
+ <img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url">
54
53
  {{ sellAmountFormatted }}
55
54
  <span class="uppercase">{{ sellToken?.symbol }}</span>
56
55
  <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" />
56
+ <img width="20" height="20" class="w-5 h-5" :src="buyToken?.logo_url">
58
57
  ~ {{ buyAmountFormatted }}
59
58
  <span class="uppercase">{{ buyToken?.symbol }}</span>
60
- <span class="capitalize hidden sm:flex items-center gap-2.5" v-if="metadata.protocol && !compact">
59
+ <span v-if="metadata.protocol && !compact" class="capitalize hidden sm:flex items-center gap-2.5">
61
60
  On
62
61
  <ProtocolLogo class="w-5 h-5" :name="metadata.protocol" />
63
62
  {{ formatProtocol(metadata.protocol) }}
@@ -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
+ 5,
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>