@instadapp/avocado-base 0.0.0-dev.991c44c → 0.0.0-dev.9df8ea5

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>
@@ -53,6 +53,11 @@ provide('tokens', props.tokens);
53
53
  {{ chainIdToName(metadata.chainId) }}
54
54
  </div>
55
55
  </div>
56
+ <div v-if="metadata.type === 'tx-builder'" class="self-start capitalize flex gap-3">
57
+ <span v-if="!compact">
58
+ Transaction Builder
59
+ </span> ({{ metadata?.actionCount }} {{ toBN(metadata?.actionCount).lt(2) ? 'action' : 'actions' }})
60
+ </div>
56
61
  <div v-if="metadata.type === 'instadapp-pro'" class="self-start capitalize flex gap-3">
57
62
  Instadapp Pro |
58
63
  {{ metadata?.castDetails }}
@@ -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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.0-dev.991c44c",
3
+ "version": "0.0.0-dev.9df8ea5",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
package/utils/metadata.ts CHANGED
@@ -19,7 +19,7 @@ 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
23
  } as const;
24
24
 
25
25
  const multiMetadataTypes = ["bytes[]"];
@@ -58,7 +58,7 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
58
58
  import: ["bytes32 protocol", "uint256 valueInUsd"],
59
59
  auth: ["address address", "uint256 chainId", "bool remove"],
60
60
  deploy: [],
61
- "transaction-builder": [],
61
+ "tx-builder": ["bytes32 actionCount"],
62
62
  permit2: [
63
63
  "address token",
64
64
  "address spender",
@@ -177,10 +177,18 @@ export const encodeDeployMetadata = (single = true) => {
177
177
  return single ? encodeMultipleActions(data) : data;
178
178
  };
179
179
 
180
- export const encodeTransactionBuilderMetadata = (single = true) => {
180
+ export const encodeTransactionBuilderMetadata = (
181
+ actionCount: string,
182
+ single = true
183
+ ) => {
184
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
185
+ actionMetadataTypes["tx-builder"],
186
+ [actionCount]
187
+ );
188
+
181
189
  const data = encodeMetadata({
182
- type: MetadataEnums["transaction-builder"],
183
- encodedData: "0x",
190
+ type: MetadataEnums["tx-builder"],
191
+ encodedData,
184
192
  });
185
193
 
186
194
  return single ? encodeMultipleActions(data) : data;
@@ -468,8 +476,9 @@ const typesPayload: IPayload = {
468
476
  deploy: (data, type) => ({
469
477
  type,
470
478
  }),
471
- "transaction-builder": (data, type) => ({
479
+ "tx-builder": (data, type) => ({
472
480
  type,
481
+ actionCount: utils.parseBytes32String(data.actionCount || ""),
473
482
  }),
474
483
  permit2: (data, type) => ({
475
484
  type,
package/utils/network.ts CHANGED
@@ -269,27 +269,27 @@ export const networks: Network[] = [
269
269
  },
270
270
  },
271
271
  },
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
- // },
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
+ },
293
293
  {
294
294
  name: AVO_PROD_CHAIN_NAME,
295
295
  chainId: AVO_PROD_CHAIN_ID,