Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: regenerate hooks for its 2.1.0 #499

Merged
merged 11 commits into from
Feb 6, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export function useDeployAndRegisterRemoteInterchainTokenMutation(
const registerTxData = destinationChainNames.map((destinationChain, i) =>
INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteInterchainToken.data({
...commonArgs,
originalChainName: "",
destinationChain,
gasValue: input.remoteDeploymentGasFees?.gasFees?.[i].fee ?? 0n,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ export default function useRegisterRemoteCanonicalTokens(

return INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteCanonicalInterchainToken.data(
{
originalChain: sourceChain?.chain_name ?? "0x",
originalTokenAddress: tokenDetails.tokenAddress as `0x${string}`,
destinationChain: axelarChainId,
gasValue,
}
);
});
}, [destinationChainIds, gasFeesData, sourceChain?.chain_name, tokenDetails]);
}, [destinationChainIds, gasFeesData, tokenDetails]);

const totalGasFee = gasFeesData?.totalGasFee ?? 0n;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { INTERCHAIN_TOKEN_FACTORY_ENCODERS } from "@axelarjs/evm";
import { useMemo } from "react";

import { zeroAddress } from "viem";

import {
NEXT_PUBLIC_INTERCHAIN_DEPLOYMENT_EXECUTE_DATA,
NEXT_PUBLIC_INTERCHAIN_DEPLOYMENT_GAS_LIMIT,
Expand Down Expand Up @@ -67,13 +65,9 @@ export default function useRegisterRemoteInterchainTokens(
)
return [];

const minter = tokenDeployment.originalMinterAddress ?? zeroAddress;

return destinationChainIds.map((chainId, i) =>
INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteInterchainToken.data({
salt: tokenDeployment.salt,
originalChainName: sourceChain?.chain_name ?? "",
minter: minter as `0x${string}`,
destinationChain: chainId,
gasValue: gasFeesData.gasFees[i].fee,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ export function useInterchainTransferMutation(
chain: "sui:testnet", //TODO: make this dynamic
});
} else {
const recipient = (destinationAddress ?? address) as `0x${string}`;
txHash = await transferAsync({
address: config.tokenAddress,
value: config.gas ?? 0n,
args: INTERCHAIN_TOKEN_ENCODERS.interchainTransfer.args({
destinationChain: config.destinationChainName,
recipient: destinationAddress ?? address,
recipient,
amount: bnAmount,
metadata: "0x",
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import {
createUseSimulateContract,
createUseWriteContract,
createUseSimulateContract,
} from "wagmi/codegen";

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
12 changes: 6 additions & 6 deletions apps/maestro/src/lib/contracts/InterchainToken.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import {
createUseReadContract,
createUseWriteContract,
createUseSimulateContract,
createUseWatchContractEvent,
createUseWriteContract,
} from "wagmi/codegen";

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -518,14 +518,14 @@ export const useReadInterchainTokenNameHash =
* Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"nonces"`
*/
export const useReadInterchainTokenNonces = /*#__PURE__*/ createUseReadContract(
{ abi: interchainTokenAbi, functionName: "nonces" }
{ abi: interchainTokenAbi, functionName: "nonces" },
);

/**
* Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"symbol"`
*/
export const useReadInterchainTokenSymbol = /*#__PURE__*/ createUseReadContract(
{ abi: interchainTokenAbi, functionName: "symbol" }
{ abi: interchainTokenAbi, functionName: "symbol" },
);

/**
Expand Down Expand Up @@ -566,7 +566,7 @@ export const useWriteInterchainTokenApprove =
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"burn"`
*/
export const useWriteInterchainTokenBurn = /*#__PURE__*/ createUseWriteContract(
{ abi: interchainTokenAbi, functionName: "burn" }
{ abi: interchainTokenAbi, functionName: "burn" },
);

/**
Expand All @@ -591,7 +591,7 @@ export const useWriteInterchainTokenIncreaseAllowance =
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"init"`
*/
export const useWriteInterchainTokenInit = /*#__PURE__*/ createUseWriteContract(
{ abi: interchainTokenAbi, functionName: "init" }
{ abi: interchainTokenAbi, functionName: "init" },
);

/**
Expand All @@ -616,7 +616,7 @@ export const useWriteInterchainTokenInterchainTransferFrom =
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"mint"`
*/
export const useWriteInterchainTokenMint = /*#__PURE__*/ createUseWriteContract(
{ abi: interchainTokenAbi, functionName: "mint" }
{ abi: interchainTokenAbi, functionName: "mint" },
);

/**
Expand Down
167 changes: 141 additions & 26 deletions apps/maestro/src/lib/contracts/InterchainTokenFactory.abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,55 +91,49 @@ export default {
type: "error",
},
{
inputs: [
{
internalType: "address",
name: "operator",
type: "address",
},
],
name: "NotOperator",
inputs: [],
name: "NotOwner",
type: "error",
},
{
inputs: [],
name: "NotOwner",
name: "NotProxy",
type: "error",
},
{
inputs: [],
name: "NotProxy",
name: "NotSupported",
type: "error",
},
{
inputs: [
{
internalType: "address",
name: "sender",
name: "tokenAddress",
type: "address",
},
],
name: "NotServiceOwner",
name: "NotToken",
type: "error",
},
{
inputs: [],
name: "NotSupported",
name: "RemoteDeploymentNotApproved",
type: "error",
},
{
inputs: [],
name: "RemoteDeploymentNotApproved",
name: "SetupFailed",
type: "error",
},
{
inputs: [],
name: "SetupFailed",
name: "ZeroAddress",
type: "error",
},
{
inputs: [],
name: "ZeroAddress",
name: "ZeroSupplyToken",
type: "error",
},
{
Expand Down Expand Up @@ -457,21 +451,11 @@ export default {
},
{
inputs: [
{
internalType: "string",
name: "originalChainName",
type: "string",
},
{
internalType: "bytes32",
name: "salt",
type: "bytes32",
},
{
internalType: "address",
name: "minter",
type: "address",
},
{
internalType: "string",
name: "destinationChain",
Expand All @@ -496,6 +480,11 @@ export default {
},
{
inputs: [
{
internalType: "string",
name: "originalChainName",
type: "string",
},
{
internalType: "bytes32",
name: "salt",
Expand Down Expand Up @@ -641,6 +630,98 @@ export default {
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "salt",
type: "bytes32",
},
{
internalType: "string",
name: "destinationChain",
type: "string",
},
{
internalType: "bytes",
name: "destinationTokenAddress",
type: "bytes",
},
{
internalType: "enum ITokenManagerType.TokenManagerType",
name: "tokenManagerType",
type: "uint8",
},
{
internalType: "bytes",
name: "linkParams",
type: "bytes",
},
{
internalType: "uint256",
name: "gasValue",
type: "uint256",
},
],
name: "linkToken",
outputs: [
{
internalType: "bytes32",
name: "tokenId",
type: "bytes32",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "deployer",
type: "address",
},
{
internalType: "bytes32",
name: "salt",
type: "bytes32",
},
],
name: "linkedTokenDeploySalt",
outputs: [
{
internalType: "bytes32",
name: "deploySalt",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "deployer",
type: "address",
},
{
internalType: "bytes32",
name: "salt",
type: "bytes32",
},
],
name: "linkedTokenId",
outputs: [
{
internalType: "bytes32",
name: "tokenId",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
Expand Down Expand Up @@ -718,6 +799,40 @@ export default {
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "salt",
type: "bytes32",
},
{
internalType: "address",
name: "tokenAddress",
type: "address",
},
{
internalType: "enum ITokenManagerType.TokenManagerType",
name: "tokenManagerType",
type: "uint8",
},
{
internalType: "address",
name: "operator",
type: "address",
},
],
name: "registerCustomToken",
outputs: [
{
internalType: "bytes32",
name: "tokenId",
type: "bytes32",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
Expand Down
Loading