@instadapp/avocado-base 0.0.38 → 0.0.39

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.
package/app.vue CHANGED
@@ -15,6 +15,13 @@
15
15
  </div>
16
16
  </li>
17
17
  </ul>
18
+
19
+ <ul class="grid grid-cols-5 gap-5 mt-20">
20
+ <li v-for="item in MetadataEnums">
21
+ {{ item }}
22
+ <ActionLogo class="w-10 h-10" :action="item"/>
23
+ </li>
24
+ </ul>
18
25
  </div>
19
26
  <ul></ul>
20
27
  </template>
@@ -0,0 +1,4 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M4.80469 9.3209H6.74805L8.48912 5.65137L10.9863 13.5476L13.3078 9.3209H15.2511" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M12 4H16V8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M16 12L16 16L12 16" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M16 4L6 14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M16 16L6 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
7
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M5.86776 7.56373C8.14869 5.47876 11.8513 5.47876 14.1322 7.56373L14.4068 7.81658C14.522 7.92021 14.522 8.09016 14.4068 8.19378L13.4679 9.05181C13.4103 9.1057 13.3173 9.1057 13.2597 9.05181L12.8833 8.70777C11.2888 7.25285 8.71117 7.25285 7.11674 8.70777L6.7137 9.07668C6.65612 9.13057 6.56311 9.13057 6.50554 9.07668L5.56659 8.21865C5.45144 8.11503 5.45144 7.94508 5.56659 7.84145L5.86776 7.56373ZM16.0766 9.33782L16.9136 10.1005C17.0288 10.2041 17.0288 10.3741 16.9136 10.4777L13.1446 13.9223C13.0294 14.0259 12.8434 14.0259 12.7327 13.9223L10.0576 11.4767C10.031 11.4518 9.98229 11.4518 9.95571 11.4767L7.28061 13.9223C7.16545 14.0259 6.97944 14.0259 6.86871 13.9223L3.08637 10.4777C2.97121 10.3741 2.97121 10.2041 3.08637 10.1005L3.92344 9.33782C4.0386 9.2342 4.22461 9.2342 4.33534 9.33782L7.01044 11.7834C7.03701 11.8083 7.08573 11.8083 7.11231 11.7834L9.78741 9.33782C9.90256 9.2342 10.0886 9.2342 10.1993 9.33782L12.8744 11.7834C12.901 11.8083 12.9497 11.8083 12.9763 11.7834L15.6514 9.33782C15.7754 9.2342 15.9614 9.2342 16.0766 9.33782Z" fill="currentColor"/>
4
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <g clip-path="url(#clip0_13865_495124)">
4
+ <path d="M3.58203 5.3335V8.8335H7.08203" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M5.0462 11.7499C5.42443 12.8235 6.14131 13.745 7.08883 14.3757C8.03635 15.0064 9.16318 15.3121 10.2995 15.2467C11.4359 15.1813 12.5202 14.7484 13.3891 14.0131C14.258 13.2779 14.8644 12.2802 15.117 11.1703C15.3696 10.0604 15.2546 8.89857 14.7894 7.85974C14.3242 6.8209 13.534 5.96139 12.5379 5.41071C11.5417 4.86002 10.3936 4.648 9.26643 4.80658C8.13929 4.96516 7.09423 5.48576 6.2887 6.28993L3.58203 8.83326" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
+ </g>
7
+ <defs>
8
+ <clipPath id="clip0_13865_495124">
9
+ <rect width="14" height="14" fill="white" transform="translate(3 3)"/>
10
+ </clipPath>
11
+ </defs>
12
+ </svg>
@@ -1,7 +1,14 @@
1
1
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
2
  xmlns="http://www.w3.org/2000/svg">
3
- <rect x="2" y="2" width="10" height="16" rx="2" stroke="currentColor" stroke-width="2" />
4
- <rect x="5.5" y="9.5" width="3" height="1" rx="0.5" stroke="currentColor" />
5
- <rect x="5.5" y="13.5" width="3" height="1" rx="0.5" stroke="currentColor" />
6
- <path d="M13 10H14.5C15.0523 10 15.5 10.4477 15.5 11V16C15.5 16.5523 15.9477 17 16.5 17H17.5C18.0523 17 18.5 16.5523 18.5 16V2.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
7
- </svg>
3
+ <g clip-path="url(#clip0_13865_495109)">
4
+ <rect x="4.44922" y="4.4502" width="6.9" height="11.1" rx="1.25" stroke="currentColor" stroke-width="1.5"/>
5
+ <rect x="6.85" y="9.6498" width="2.1" height="0.7" rx="0.35" fill="currentColor" stroke="currentColor" stroke-width="0.7"/>
6
+ <rect x="6.85" y="12.4501" width="2.1" height="0.7" rx="0.35" fill="currentColor" stroke="currentColor" stroke-width="0.7"/>
7
+ <path d="M12.1016 10H12.8516C13.4038 10 13.8516 10.4477 13.8516 11V13.9C13.8516 14.4523 14.2993 14.9 14.8516 14.9H14.9516C15.5038 14.9 15.9516 14.4523 15.9516 13.9V4.75" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
8
+ </g>
9
+ <defs>
10
+ <clipPath id="clip0_13865_495109">
11
+ <rect width="14" height="14" fill="white" transform="translate(3 3)"/>
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M8.00156 14.1775C8.00156 14.5712 8.32023 14.8941 8.70991 14.854C12.1642 14.4978 14.8588 11.5653 14.8588 8.00023C14.8588 4.43519 12.1642 1.50263 8.70991 1.14648C8.32023 1.10609 8.00156 1.42922 8.00156 1.8229V3.72362C8.00156 4.1173 8.3224 4.42902 8.70645 4.50672C10.3277 4.83529 11.5485 6.27438 11.5485 8.00023C11.5485 9.72609 10.3277 11.1652 8.70645 11.4938C8.3224 11.5714 8.00156 11.8834 8.00156 12.2768V14.1775ZM5.87349 2.43066C5.87349 1.94597 5.40133 1.60432 4.96901 1.81886C2.70303 2.94337 1.14453 5.28885 1.14453 8.00023C1.14453 10.7116 2.70303 13.0571 4.96901 14.1816C5.40133 14.3961 5.87349 14.0545 5.87349 13.5698V2.43089V2.43066Z" fill="#456CED"/>
4
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M12 4H16V8" stroke="#4CA054" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M16 12L16 16L12 16" stroke="#4CA054" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M16 4L6 14" stroke="#4CA054" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M16 16L6 6" stroke="#4CA054" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
7
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <g clip-path="url(#clip0_13865_495129)">
4
+ <path d="M15.2506 4.1665L14.084 5.33317M14.084 5.33317L15.834 7.08317L13.7923 9.12484L12.0423 7.37484M14.084 5.33317L12.0423 7.37484M9.64482 9.77234C9.94601 10.0695 10.1854 10.4234 10.3493 10.8135C10.5132 11.2036 10.5983 11.6222 10.5997 12.0454C10.6012 12.4685 10.5189 12.8877 10.3576 13.2789C10.1963 13.6701 9.95927 14.0256 9.66007 14.3248C9.36087 14.624 9.00544 14.861 8.61424 15.0223C8.22305 15.1836 7.80381 15.2659 7.38068 15.2644C6.95755 15.263 6.53888 15.1779 6.14878 15.014C5.75867 14.8501 5.40484 14.6107 5.10765 14.3095C4.52322 13.7044 4.19984 12.894 4.20715 12.0528C4.21446 11.2115 4.55188 10.4069 5.14673 9.812C5.74158 9.21715 6.54627 8.87973 7.38749 8.87242C8.2287 8.86511 9.03913 9.1885 9.64423 9.77292L9.64482 9.77234ZM9.64482 9.77234L12.0423 7.37484" stroke="#94A3B8" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </g>
6
+ <defs>
7
+ <clipPath id="clip0_13865_495129">
8
+ <rect width="14" height="14" fill="white" transform="translate(3 3)"/>
9
+ </clipPath>
10
+ </defs>
11
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M10 7.375V12.625" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M7.375 10H12.625" 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
+ </svg>
@@ -1,6 +1,6 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
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="M14.5204 3.25928V6.81483H10.9648" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
- <path d="M1.48047 12.7406V9.18506H5.03602" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
- <path d="M2.96788 6.22212C3.26842 5.37281 3.77922 4.61347 4.4526 4.01496C5.12598 3.41645 5.94001 2.99828 6.81871 2.79946C7.69742 2.60064 8.61218 2.62766 9.47762 2.87799C10.3431 3.12832 11.131 3.5938 11.7679 4.23101L14.5175 6.81471M1.48047 9.18509L4.2301 11.7688C4.86699 12.406 5.65491 12.8715 6.52036 13.1218C7.3858 13.3721 8.30056 13.3992 9.17926 13.2003C10.058 13.0015 10.872 12.5833 11.5454 11.9848C12.2188 11.3863 12.7296 10.627 13.0301 9.77768" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M15.7049 5.85205V8.96316H12.5938" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M4.29688 14.1482V11.0371H7.40799" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M5.59836 8.44436C5.86133 7.70121 6.30828 7.03679 6.89749 6.51309C7.4867 5.9894 8.19897 5.62349 8.96784 5.44953C9.73671 5.27556 10.5371 5.2992 11.2944 5.51824C12.0516 5.73728 12.7411 6.14458 13.2984 6.70213L15.7043 8.96288M4.29688 11.0369L6.7028 13.2977C7.26008 13.8552 7.94951 14.2625 8.70678 14.4816C9.46404 14.7006 10.2644 14.7243 11.0333 14.5503C11.8022 14.3763 12.5145 14.0104 13.1037 13.4867C13.6929 12.963 14.1398 12.2986 14.4028 11.5555" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
6
  </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
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"/>
6
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M6.66797 13.3332L13.3346 6.6665" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M6.66797 6.6665H13.3346V13.3332" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
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"/>
8
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M14.8549 10.8661C14.8235 10.8264 14.8065 10.7773 14.8067 10.7268V9.27321C14.8065 9.22267 14.8235 9.17356 14.8549 9.13393L15.5254 8.29375C15.6461 8.14274 15.7184 7.95886 15.7329 7.76612C15.7474 7.57338 15.7034 7.38075 15.6067 7.21339L15.2156 6.53661C15.1192 6.36911 14.9744 6.2346 14.8003 6.15065C14.6262 6.06671 14.4308 6.03723 14.2397 6.06607L13.1772 6.22768C13.127 6.23473 13.0758 6.225 13.0317 6.2L11.7728 5.47321C11.7284 5.44656 11.6944 5.40563 11.6763 5.35714L11.2844 4.36071C11.2142 4.18096 11.0914 4.02654 10.9322 3.9176C10.7729 3.80865 10.5845 3.75025 10.3915 3.75H9.60758C9.41461 3.75025 9.2262 3.80865 9.06692 3.9176C8.90765 4.02654 8.78491 4.18096 8.71472 4.36071L8.32097 5.35714C8.30221 5.40431 8.26829 5.44389 8.22454 5.46964L6.96294 6.2C6.91882 6.22506 6.86764 6.2348 6.8174 6.22768L5.75758 6.06607C5.56646 6.03723 5.37108 6.06671 5.19698 6.15065C5.02287 6.2346 4.87814 6.36911 4.78169 6.53661L4.39061 7.21339C4.29391 7.38075 4.24993 7.57338 4.26442 7.76612C4.27892 7.95886 4.35122 8.14274 4.47186 8.29375L5.1424 9.13393C5.17378 9.17356 5.19078 9.22267 5.19061 9.27321V10.7268C5.19078 10.7773 5.17378 10.8264 5.1424 10.8661L4.47186 11.7063C4.35122 11.8573 4.27892 12.0411 4.26442 12.2339C4.24993 12.4266 4.29391 12.6193 4.39061 12.7866L4.78169 13.4634C4.87814 13.6309 5.02287 13.7654 5.19698 13.8493C5.37108 13.9333 5.56646 13.9628 5.75758 13.9339L6.82008 13.7723C6.87032 13.7652 6.9215 13.7749 6.96561 13.8L8.22454 14.5268C8.26829 14.5525 8.30221 14.5921 8.32097 14.6393L8.71294 15.6393C8.78312 15.819 8.90586 15.9735 9.06514 16.0824C9.22441 16.1913 9.41282 16.2498 9.60579 16.25H10.3879C10.5809 16.2498 10.7693 16.1913 10.9286 16.0824C11.0879 15.9735 11.2106 15.819 11.2808 15.6393L11.6728 14.6393C11.6915 14.5921 11.7254 14.5525 11.7692 14.5268L13.0281 13.8C13.0723 13.775 13.1234 13.7653 13.1736 13.7723L14.2362 13.9339C14.4273 13.9628 14.6226 13.9333 14.7968 13.8493C14.9709 13.7654 15.1156 13.6309 15.212 13.4634L15.6031 12.7866C15.6998 12.6193 15.7438 12.4266 15.7293 12.2339C15.7148 12.0411 15.6425 11.8573 15.5219 11.7063L14.8549 10.8661ZM9.99865 12.0089C9.60132 12.0089 9.21292 11.8911 8.88255 11.6704C8.55218 11.4496 8.29469 11.1359 8.14264 10.7688C7.99059 10.4017 7.95081 9.99777 8.02832 9.60808C8.10584 9.21838 8.29717 8.86043 8.57812 8.57947C8.85908 8.29852 9.21703 8.10719 9.60673 8.02967C9.99642 7.95216 10.4003 7.99194 10.7674 8.14399C11.1345 8.29604 11.4483 8.55353 11.669 8.8839C11.8898 9.21427 12.0076 9.60267 12.0076 10C12.0076 10.5328 11.7959 11.0438 11.4192 11.4205C11.0424 11.7973 10.5315 12.0089 9.99865 12.0089Z" stroke="#94A3B8" stroke-width="1.5"/>
4
+ </svg>
@@ -0,0 +1,38 @@
1
+ <script setup lang="ts">
2
+ import RefreshSVG from '~/assets/images/icons/refresh.svg'
3
+ import BridgeSVG from '~/assets/images/icons/bridge.svg'
4
+ import CrossTransferSVG from '~/assets/images/icons/cross-transfer.svg'
5
+ import TransferSVG from '~/assets/images/icons/transfer.svg'
6
+ import PlusCircleSVG from '~/assets/images/icons/plus-circle.svg'
7
+ import Trash2SVG from '~/assets/images/icons/trash-2.svg'
8
+ import ChangeThresholdSVG from '~/assets/images/icons/change-threshold.svg'
9
+ import DappSVG from '~/assets/images/icons/dapp.svg'
10
+ import DeploySVG from '~/assets/images/icons/deploy.svg'
11
+ import GasSVG from '~/assets/images/icons/gas.svg'
12
+ import InstadappProSVG from '~/assets/images/icons/instadapp-pro.svg'
13
+ import PermitSignSVG from '~/assets/images/icons/permit-sign.svg'
14
+ import RejectProposalSVG from '~/assets/images/icons/reject-proposal.svg'
15
+ import UpgradeSVG from '~/assets/images/icons/upgrade.svg'
16
+
17
+ defineProps<{
18
+ action: MetadataTypes
19
+ remove?: boolean
20
+ }>()
21
+ </script>
22
+
23
+ <template>
24
+ <RefreshSVG class="text-primary" v-if="action === 'swap'"/>
25
+ <BridgeSVG class="text-primary" v-else-if="action === 'bridge'"/>
26
+ <CrossTransferSVG class="text-primary" v-else-if="action === 'cross-transfer'"/>
27
+ <TransferSVG class="text-primary" v-else-if="action === 'transfer'"/>
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)"/>
30
+ <ChangeThresholdSVG v-else-if="action === 'change-threshold'"/>
31
+ <DappSVG v-else-if="action === 'dapp'"/>
32
+ <DeploySVG v-else-if="action === 'deploy'"/>
33
+ <GasSVG v-else-if="action === 'gas-topup'"/>
34
+ <InstadappProSVG v-else-if="action === 'instadapp-pro'"/>
35
+ <PermitSignSVG v-else-if="action === 'permit2'"/>
36
+ <RejectProposalSVG v-else-if="action === 'rejection'"/>
37
+ <UpgradeSVG v-else-if="action === 'upgrade'"/>
38
+ </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
package/utils/metadata.ts CHANGED
@@ -1,6 +1,24 @@
1
1
  import { ethers, utils } from "ethers";
2
2
  import { Forwarder__factory } from "../contracts";
3
3
 
4
+ export const MetadataEnums = {
5
+ "transfer": "transfer",
6
+ "bridge": "bridge",
7
+ "swap": "swap",
8
+ "gas-topup": "gas-topup",
9
+ "upgrade": "upgrade",
10
+ "dapp": "dapp",
11
+ "deploy": "deploy",
12
+ "permit2": "permit2",
13
+ "cross-transfer": "cross-transfer",
14
+ "auth": "auth",
15
+ "rejection": "rejection",
16
+ "instadapp-pro": "instadapp-pro",
17
+ "add-signers": "add-signers",
18
+ "remove-signers": "remove-signers",
19
+ "change-threshold": "change-threshold",
20
+ } as const;
21
+
4
22
  const multiMetadataTypes = ["bytes[]"];
5
23
 
6
24
  const metadataTypes = ["bytes32 type", "uint8 version", "bytes data"];
@@ -67,7 +85,7 @@ export const encodeDappMetadata = (
67
85
  );
68
86
 
69
87
  const data = encodeMetadata({
70
- type: "dapp",
88
+ type: MetadataEnums.dapp,
71
89
  encodedData,
72
90
  });
73
91
 
@@ -84,7 +102,7 @@ export const encodeTransferMetadata = (
84
102
  );
85
103
 
86
104
  const data = encodeMetadata({
87
- type: "transfer",
105
+ type: MetadataEnums.transfer,
88
106
  encodedData,
89
107
  });
90
108
 
@@ -98,7 +116,7 @@ export const encodeRejectionMetadata = (id: string, single = true) => {
98
116
  );
99
117
 
100
118
  const data = encodeMetadata({
101
- type: "rejection",
119
+ type: MetadataEnums.rejection,
102
120
  encodedData,
103
121
  });
104
122
 
@@ -121,7 +139,7 @@ export const encodeCrossTransferMetadata = (
121
139
  );
122
140
 
123
141
  const data = encodeMetadata({
124
- type: "cross-transfer",
142
+ type: MetadataEnums["cross-transfer"],
125
143
  encodedData,
126
144
  });
127
145
 
@@ -138,7 +156,7 @@ export const encodeAuthMetadata = (
138
156
  );
139
157
 
140
158
  const data = encodeMetadata({
141
- type: "auth",
159
+ type: MetadataEnums.auth,
142
160
  encodedData,
143
161
  });
144
162
 
@@ -147,7 +165,7 @@ export const encodeAuthMetadata = (
147
165
 
148
166
  export const encodeDeployMetadata = (single = true) => {
149
167
  const data = encodeMetadata({
150
- type: "deploy",
168
+ type: MetadataEnums.deploy,
151
169
  encodedData: "0x",
152
170
  });
153
171
 
@@ -164,7 +182,7 @@ export const encodeWCSignMetadata = (
164
182
  );
165
183
 
166
184
  const data = encodeMetadata({
167
- type: "permit2",
185
+ type: MetadataEnums.permit2,
168
186
  encodedData,
169
187
  });
170
188
 
@@ -181,7 +199,7 @@ export const encodeUpgradeMetadata = (
181
199
  );
182
200
 
183
201
  const data = encodeMetadata({
184
- type: "upgrade",
202
+ type: MetadataEnums.upgrade,
185
203
  encodedData,
186
204
  });
187
205
 
@@ -205,7 +223,7 @@ export const encodeSwapMetadata = (
205
223
  );
206
224
 
207
225
  const data = encodeMetadata({
208
- type: "swap",
226
+ type: MetadataEnums.swap,
209
227
  encodedData,
210
228
  });
211
229
 
@@ -221,10 +239,8 @@ export const encodeTopupMetadata = (
221
239
  [params.amount, params.token, params.onBehalf]
222
240
  );
223
241
 
224
- console.log(params);
225
-
226
242
  const data = encodeMetadata({
227
- type: "gas-topup",
243
+ type: MetadataEnums["gas-topup"],
228
244
  encodedData,
229
245
  });
230
246
 
@@ -249,7 +265,7 @@ export const encodeBridgeMetadata = (
249
265
  );
250
266
 
251
267
  const data = encodeMetadata({
252
- type: "bridge",
268
+ type: MetadataEnums.bridge,
253
269
  encodedData,
254
270
  });
255
271
 
@@ -266,7 +282,7 @@ export const encodeChangeThresholdMetadata = (
266
282
  );
267
283
 
268
284
  const data = encodeMetadata({
269
- type: "change-threshold",
285
+ type: MetadataEnums["change-threshold"],
270
286
  encodedData,
271
287
  });
272
288
 
@@ -283,7 +299,7 @@ export const encodeRemoveSignersMetadata = (
283
299
  );
284
300
 
285
301
  const data = encodeMetadata({
286
- type: "remove-signers",
302
+ type: MetadataEnums["remove-signers"],
287
303
  encodedData,
288
304
  });
289
305
 
@@ -300,7 +316,7 @@ export const encodeAddSignersMetadata = (
300
316
  );
301
317
 
302
318
  const data = encodeMetadata({
303
- type: "add-signers",
319
+ type: MetadataEnums["add-signers"],
304
320
  encodedData,
305
321
  });
306
322
 
@@ -381,13 +397,13 @@ const getMetadataFromData = (data: string) => {
381
397
 
382
398
 
383
399
  const typesPayload: IPayload = {
384
- "transfer": (data, type) => ({
400
+ transfer: (data, type) => ({
385
401
  type,
386
402
  token: data.token,
387
403
  amount: toBN(data.amount).toFixed(),
388
404
  receiver: data.receiver,
389
405
  }),
390
- "bridge": (data, type) => ({
406
+ bridge: (data, type) => ({
391
407
  type,
392
408
  amount: toBN(data.amount).toFixed(),
393
409
  receiver: data.receiver,
@@ -396,7 +412,7 @@ const typesPayload: IPayload = {
396
412
  toChainId: data.toChainId ? data.toChainId.toString() : null,
397
413
  bridgeFee: toBN(data.bridgeFee).toFixed(),
398
414
  }),
399
- "swap": (data, type) => ({
415
+ swap: (data, type) => ({
400
416
  type,
401
417
  buyAmount: toBN(data.buyAmount).toFixed(),
402
418
  sellAmount: toBN(data.sellAmount).toFixed(),
@@ -405,7 +421,7 @@ const typesPayload: IPayload = {
405
421
  receiver: data.receiver,
406
422
  protocol: utils.parseBytes32String(data.protocol || ""),
407
423
  }),
408
- "upgrade": (data, type) => ({
424
+ upgrade: (data, type) => ({
409
425
  type,
410
426
  version: utils.parseBytes32String(data.version || ""),
411
427
  walletImpl: data.walletImpl,
@@ -464,7 +480,7 @@ const typesPayload: IPayload = {
464
480
  "change-threshold": (data, type) => ({
465
481
  type,
466
482
  count: data.count,
467
- })
483
+ }),
468
484
  };
469
485
 
470
486
  const parseMetadata = (metadata: string) => {
package/utils/utils.d.ts CHANGED
@@ -1,138 +1,131 @@
1
- type ChainId =
2
- | 1
3
- | 137
4
- | 42161
5
- | 10
6
- | 56
7
- | 43114
8
- | 100
9
- | 1101
10
- | 250
11
- | 634
12
- | 1313161554
13
- | 63400;
14
-
15
- type ISlackMessageType = "danger" | "error" | "success" | "banner";
16
- type MetadataTypes = "transfer"
17
- | "bridge"
18
- | "swap"
19
- | "gas-topup"
20
- | "upgrade"
21
- | "dapp"
22
- | "deploy"
23
- | "permit2"
24
- | "cross-transfer"
25
- | "auth"
26
- | "rejection"
27
- | 'instadapp-pro'
28
- | 'add-signers'
29
- | 'remove-signers'
30
- | 'change-threshold'
31
-
32
- type PayloadFunction = (data: any, type: MetadataTypes) => any;
33
-
34
- type IPayload = Record<MetadataTypes, PayloadFunction>;
35
-
36
- interface Network {
37
- name: string;
38
- debankName?: string;
39
- ankrName?: string;
40
- zerionName?: string;
41
- chainId: ChainId;
42
- color: string;
43
- isAvocado?: boolean;
44
- serverRpcUrl: string | undefined;
45
- balanceResolverAddress?: string;
46
- usdcAddress: string;
47
- explorerUrl: string;
48
- params: {
49
- chainName?: string;
50
- iconUrls?: string[];
51
- rpcUrls: string[];
52
- nativeCurrency?: {
53
- name: string;
54
- symbol: string;
55
- decimals: number;
1
+ declare global {
2
+ type ChainId =
3
+ | 1
4
+ | 137
5
+ | 42161
6
+ | 10
7
+ | 56
8
+ | 43114
9
+ | 100
10
+ | 1101
11
+ | 250
12
+ | 634
13
+ | 1313161554
14
+ | 63400;
15
+
16
+ type ISlackMessageType = "danger" | "error" | "success" | "banner";
17
+
18
+ type MetadataTypes = keyof typeof MetadataEnums;
19
+
20
+ type PayloadFunction = (data: any, type: MetadataTypes) => any;
21
+
22
+ type IPayload = Record<MetadataTypes, PayloadFunction>;
23
+
24
+ interface Network {
25
+ name: string;
26
+ debankName?: string;
27
+ ankrName?: string;
28
+ zerionName?: string;
29
+ chainId: ChainId;
30
+ color: string;
31
+ isAvocado?: boolean;
32
+ serverRpcUrl: string | undefined;
33
+ balanceResolverAddress?: string;
34
+ usdcAddress: string;
35
+ explorerUrl: string;
36
+ params: {
37
+ chainName?: string;
38
+ iconUrls?: string[];
39
+ rpcUrls: string[];
40
+ nativeCurrency?: {
41
+ name: string;
42
+ symbol: string;
43
+ decimals: number;
44
+ };
56
45
  };
46
+ }
47
+
48
+ type SignMetadataProps = {
49
+ token: string;
50
+ spender: string;
51
+ amount: string;
52
+ expiration: string;
53
+ };
54
+
55
+ type DappMetadataProps = {
56
+ name: string;
57
+ url: string;
58
+ };
59
+
60
+ type SendMetadataProps = {
61
+ token: string;
62
+ amount: string;
63
+ receiver: string;
64
+ };
65
+
66
+ type CrossSendMetadataProps = {
67
+ fromToken: string;
68
+ toToken: string;
69
+ toChainId: string;
70
+ amount: string;
71
+ receiver: string;
72
+ };
73
+
74
+ type AuthMetadataProps = {
75
+ address: string;
76
+ chainId: string;
77
+ remove: boolean;
57
78
  };
58
- }
59
79
 
60
- type SignMetadataProps = {
61
- token: string;
62
- spender: string;
63
- amount: string;
64
- expiration: string;
65
- };
66
-
67
- type DappMetadataProps = {
68
- name: string;
69
- url: string;
70
- };
71
-
72
- type SendMetadataProps = {
73
- token: string;
74
- amount: string;
75
- receiver: string;
76
- };
77
-
78
- type CrossSendMetadataProps = {
79
- fromToken: string;
80
- toToken: string;
81
- toChainId: string;
82
- amount: string;
83
- receiver: string;
84
- };
85
-
86
- type AuthMetadataProps = {
87
- address: string;
88
- chainId: string;
89
- remove: boolean;
90
- };
91
-
92
- type UpgradeMetadataProps = {
93
- version: string;
94
- walletImpl: string;
95
- };
96
-
97
- type TopupMetadataProps = {
98
- amount: string;
99
- token: string;
100
- onBehalf: string;
101
- };
102
-
103
- type BridgeMetadataProps = {
104
- amount: string;
105
- receiver: string;
106
- fromToken: string;
107
- toToken: string;
108
- toChainId: string;
109
- bridgeFee: string;
110
- nativeToken: string;
111
- };
112
-
113
- type SwapMetadataProps = {
114
- sellToken: string;
115
- buyToken: string;
116
- sellAmount: string;
117
- buyAmount: string;
118
- receiver: string;
119
- protocol?: string;
120
- };
121
-
122
- type MetadataProps = {
123
- type: MetadataTypes,
124
- encodedData: string;
125
- version?: string;
126
- };
127
-
128
- interface ITokenPrice {
129
- address: string;
130
- chain_id: string;
131
- name: string;
132
- symbol: string;
133
- decimals: number;
134
- logo_url: string;
135
- price: string;
136
- coingecko_id: string;
137
- sparkline_price_7d: number[];
80
+ type UpgradeMetadataProps = {
81
+ version: string;
82
+ walletImpl: string;
83
+ };
84
+
85
+ type TopupMetadataProps = {
86
+ amount: string;
87
+ token: string;
88
+ onBehalf: string;
89
+ };
90
+
91
+ type BridgeMetadataProps = {
92
+ amount: string;
93
+ receiver: string;
94
+ fromToken: string;
95
+ toToken: string;
96
+ toChainId: string;
97
+ bridgeFee: string;
98
+ nativeToken: string;
99
+ };
100
+
101
+ type SwapMetadataProps = {
102
+ sellToken: string;
103
+ buyToken: string;
104
+ sellAmount: string;
105
+ buyAmount: string;
106
+ receiver: string;
107
+ protocol?: string;
108
+ };
109
+
110
+ type MetadataProps = {
111
+ type: MetadataTypes,
112
+ encodedData: string;
113
+ version?: string;
114
+ };
115
+
116
+ interface ITokenPrice {
117
+ address: string;
118
+ chain_id: string;
119
+ name: string;
120
+ symbol: string;
121
+ decimals: number;
122
+ logo_url: string;
123
+ price: string;
124
+ coingecko_id: string;
125
+ sparkline_price_7d: number[];
126
+ }
127
+
138
128
  }
129
+
130
+ export { }
131
+