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

fix: build devnet amplifier #477

Merged
merged 29 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cd06c21
chore: init fix decimals
npty Dec 4, 2024
c6aa428
chore: prevent token decimals issue for sui
npty Dec 5, 2024
c1917db
chore: update sui imports
npty Dec 12, 2024
aa597f1
chore: update hooks build
npty Dec 12, 2024
4c6f379
chore: update chain types
npty Dec 12, 2024
bb7815f
chore: remove unused var
npty Dec 12, 2024
c824d61
fix: some build errors
npty Dec 12, 2024
a4dcc44
chore: fix more errors
npty Dec 12, 2024
eb63872
chore: fix more build errors
npty Dec 13, 2024
3590b0f
chore: fix all compile errors
npty Dec 17, 2024
d94b9fe
chore: update pnpm-lock
npty Dec 17, 2024
4c3aafe
chore: fix unnecessary cast
npty Dec 17, 2024
e1ef786
chore: make contract_0_path optional
npty Dec 17, 2024
c54663c
chore: fix deployment
npty Dec 17, 2024
69b2633
chore: remove log
npty Dec 17, 2024
99bedbe
chore: fix build error
npty Dec 17, 2024
024ea0a
chore: add token address
SGiaccobasso Dec 17, 2024
6ad4fd3
chore: add tx index to deployment message id
SGiaccobasso Dec 18, 2024
3517b04
chore: fix minter address type for evm
npty Dec 19, 2024
180b157
chore: fix deploymentMessageId type string | undefined
npty Dec 19, 2024
2c5ab36
chore: fix more errors
npty Dec 19, 2024
46c4444
chore: fix remainning errors
npty Dec 19, 2024
e837dd5
chore: few more build errors
npty Dec 19, 2024
81b24b0
chore: add todo
npty Dec 19, 2024
960dd23
chore: add todo to handle register type
npty Dec 19, 2024
98ce408
Merge branch 'env/devnet-amplifier' into fix/build-devnet-amplifier
npty Dec 19, 2024
66a88a8
chore: add comment
npty Dec 19, 2024
53ee75c
chore: fix some errors
npty Dec 19, 2024
1a5f67f
chore: fix build errors
npty Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: fix more build errors
npty committed Dec 13, 2024
commit eb638723d0ee6269c5516fd1186bc3ac30b9ac1b
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@ export type DeployAndRegisterTransactionState =
}
| {
type: "deploying";
txHash: `0x${string}`;
txHash: string;
}
| {
type: "deployed";
txHash: `0x${string}`;
txHash: string;
tokenAddress: `0x${string}`;
};

@@ -32,7 +32,7 @@ export const INITIAL_STATE = {
},
txState: { type: "idle" } as DeployAndRegisterTransactionState,
selectedChains: [] as string[],
onDeployTxHash: (txHash: `0x${string}`) => {
onDeployTxHash: (txHash: string) => {
logger.log("onDeployTxHash", txHash);
},
};
Original file line number Diff line number Diff line change
@@ -107,18 +107,18 @@ export const Step2: FC = () => {
if (sourceChain.chain_id === SUI_CHAIN_ID) {
const result = await txPromise;
// if tx is successful, we will get a digest
if (result?.digest) {
if (result) {
rootActions.setTxState({
status: "submitted",
suiTx: result,
txHash: result.digest,
chainId: sourceChain.chain_id,
type: "deployed",
txHash: result,
// TODO: get token address
tokenAddress: "0x",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SGiaccobasso could you pls help me set the token address correctly here?

// chainId: sourceChain.chain_id,
});
if (rootState.selectedChains.length > 0) {
addTransaction({
status: "submitted",
suiTx: result,
hash: result.digest,
hash: result,
chainId: sourceChain.chain_id,
txType: "INTERCHAIN_DEPLOYMENT",
});
Original file line number Diff line number Diff line change
@@ -79,12 +79,15 @@ export const RegisterRemoteTokens: FC<RegisterRemoteTokensProps> = (props) => {
);

const { data: receipt } = useWaitForTransactionReceipt({
hash: txState.status === "submitted" ? txState.hash : undefined,
hash:
txState.status === "submitted"
? (txState.hash as `0x${string}`)
: undefined,
});

const onSuiTxComplete = useCallback(async () => {
console.log("onSuiTxComplete", txState.suiTx);
const { digest, transactionIndex: txIndex } = txState.suiTx;
console.log("onSuiTxComplete", txState.txHash);
const { digest, transactionIndex: txIndex } = txState.txHash;

const remoteTokens = baseRemoteTokens.map((remoteToken) => ({
...remoteToken,
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ const MOCK_EVM_CHAIN_CONFIG: EVMChainConfig = {
symbol: "ETH",
decimals: 18,
},
no_tvl: true,
// no_tvl: true,
};

const mocks = {
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import { createContainer, useSessionStorageState } from "@axelarjs/utils/react";

import type { SubmittedTransactionState } from "~/lib/hooks/useTransactionState";

type TransactionsByHash = Record<`0x${string}`, SubmittedTransactionState>;
type TransactionsByHash = Record<string, SubmittedTransactionState>;

export const {
Provider: TransactionsProvider,
6 changes: 3 additions & 3 deletions apps/maestro/src/features/suiHooks/useDeployToken.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useSignAndExecuteTransaction } from "@mysten/dapp-kit";
import { getFullnodeUrl, SuiClient, SuiObjectChange } from "@mysten/sui/client";
import { Transaction } from "@mysten/sui/transactions";
import { fromHEX } from "@mysten/sui/utils";
import { fromHex } from "@mysten/sui/utils";

import { useAccount } from "~/lib/hooks";
import { trpc } from "~/lib/trpc";

const findCoinDataObject = (registerTokenResult: any) => {
return registerTokenResult.objectChanges.find(
(change) =>
(change: SuiObjectChange) =>
change.type === "created" && change.objectType.includes("coin_data")
).objectId;
};
@@ -88,7 +88,7 @@ export default function useTokenDeploy() {
walletAddress: currentAccount.address,
});
// First step, deploy the token
const deployTokenTx = Transaction.from(fromHEX(deployTokenTxBytes));
const deployTokenTx = Transaction.from(fromHex(deployTokenTxBytes));
const deployTokenResult = await signAndExecuteTransaction({
transaction: deployTokenTx,
chain: "sui:testnet",
5 changes: 2 additions & 3 deletions apps/maestro/src/lib/transactions/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { toast } from "@axelarjs/ui/toaster";

import { TransactionExecutionError } from "viem";
import type { WriteContractData } from "wagmi/query";

import { logger } from "~/lib/logger";

type TransactionResultHooks = {
onSuccess?: (tx: WriteContractData) => void;
onSuccess?: (tx: string) => void;
onTransactionError?: (error: TransactionExecutionError) => void;
onUnknownError?: (error: Error) => void;
};
@@ -36,7 +35,7 @@ const DEFAULT_HOOKS: TransactionResultHooks = {
* ```
*/
export async function handleTransactionResult(
txPromise: Promise<WriteContractData | undefined>,
txPromise: Promise<string | undefined>,
hooks: TransactionResultHooks
): Promise<void> {
const handleSuccess = hooks.onSuccess ?? DEFAULT_HOOKS.onSuccess;
Original file line number Diff line number Diff line change
@@ -14,8 +14,9 @@ const evmChainConfigSchema = z.object({
name: z.string(),
image: z.string(),
color: z.string(),
chain_type: z.literal("evm"),
chain_type: z.string(),
no_inflation: z.boolean(),
no_tvl: z.boolean().optional(),
endpoints: z.object({
rpc: z.array(z.string()),
}),
@@ -31,7 +32,7 @@ const evmChainConfigSchema = z.object({
block_path: z.string(),
address_path: z.string(),
contract_path: z.string(),
contract_0_path: z.string().optional(),
contract_0_path: z.string(),
transaction_path: z.string(),
}),
provider_params: z.array(
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ import type { GMPTxStatus } from "@axelarjs/api/gmp";
import { TRPCError } from "@trpc/server";
import { z } from "zod";

import { hex64Literal } from "~/lib/utils/validation";
import { publicProcedure } from "~/server/trpc";

export const SEARCHGMP_SOURCE = {
@@ -37,7 +36,7 @@ export const SEARCHGMP_SOURCE = {
};

const INPUT_SCHEMA = z.object({
txHash: hex64Literal(),
txHash: z.string(),
});

/**
6 changes: 6 additions & 0 deletions apps/maestro/src/services/axelarscan/hooks.ts
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@ const suiChainMockData =
color: "#6fbcf0",
chain_type: "sui",
no_inflation: false,
no_tvl: true,
deprecated: false,
endpoints: {
rpc: ["https://sui-rpc.publicnode.com"],
},
@@ -39,6 +41,7 @@ const suiChainMockData =
block_path: "/block/{block}",
address_path: "/address/{address}",
contract_path: "/object/{address}",
contract_0_path: "/object/{address}",
transaction_path: "/txblock/{tx}",
},
provider_params: [
@@ -65,6 +68,8 @@ const suiChainMockData =
color: "#6fbcf0",
chain_type: "sui",
no_inflation: false,
no_tvl: true,
deprecated: false,
endpoints: {
rpc: ["https://fullnode.testnet.sui.io:443"],
},
@@ -80,6 +85,7 @@ const suiChainMockData =
block_path: "/block/{block}",
address_path: "/address/{address}",
contract_path: "/object/{address}",
contract_0_path: "/object/{address}",
transaction_path: "/txblock/{tx}",
},
provider_params: [
4 changes: 2 additions & 2 deletions apps/maestro/src/services/gmp/hooks.ts
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ export function useInterchainTokensQuery(input: {

export function useGetTransactionStatusOnDestinationChainsQuery(
input: {
txHash?: `0x${string}`;
txHash?: string;
},
options?: {
enabled?: boolean;
@@ -93,7 +93,7 @@ export function useGetTransactionStatusOnDestinationChainsQuery(

export function useGetTransactionsStatusesOnDestinationChainsQuery(
input: {
txHashes?: `0x${string}`[];
txHashes?: string[];
},
options?: {
enabled?: boolean;
Original file line number Diff line number Diff line change
@@ -42,10 +42,10 @@ const STATUS_COLORS: Partial<
pending: "neutral",
};

export function useGMPTxProgress(txHash: `0x${string}`, chainId: number) {
export function useGMPTxProgress(txHash: string, chainId: number) {
const { computed } = useEVMChainConfigsQuery();
const { data: txInfo } = useTransaction({
hash: txHash,
hash: txHash as `0x${string}`,
chainId,
});

@@ -95,11 +95,11 @@ export function useGMPTxProgress(txHash: `0x${string}`, chainId: number) {
}

type Props = {
txHash: `0x${string}`;
txHash: string;
onAllChainsExecuted?: () => void;
};

const TxFinalityProgress: FC<{ txHash: `0x${string}`; chainId: number }> = ({
const TxFinalityProgress: FC<{ txHash: string; chainId: number }> = ({
txHash,
chainId,
}) => {
@@ -203,7 +203,7 @@ export default GMPTxStatusMonitor;

export type ChainStatusItemProps = {
status: ExtendedGMPTxStatus;
txHash: `0x${string}`;
txHash: string;
logIndex: number;
chain: EVMChainConfig;
className?: string;
@@ -308,7 +308,7 @@ export const ChainStatusItem: FC<ChainStatusItemProps> = ({
};

export type StatusIndicatorProps = {
txHash: `0x${string}` | `0x${string}:${number}`;
txHash: string;
status: ExtendedGMPTxStatus;
};

Original file line number Diff line number Diff line change
@@ -55,14 +55,14 @@ export const getInterchainTokenDetailsPageSessionStorageKey = (
`@maestro/interchain-tokens/${props.chainId}/${props.tokenAddress}/v${version}`;

export type InterchainTokenDetailsPageState = {
deployTokensTxHashes: `0x${string}`[];
deployTokensTxHashes: string[];
selectedChainIds: number[];
};

export function persistTokenDeploymentTxHash(
tokenAddress: `0x${string}`,
chainId: number,
deployTokensTxHash: `0x${string}`,
deployTokensTxHash: string,
selectedChainIds: number[]
) {
const key = getInterchainTokenDetailsPageSessionStorageKey({
30 changes: 14 additions & 16 deletions packages/api/src/axelarscan/types.ts
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ export type EVMChainConfig = {
chain_id: number;
chain_name: string;
maintainer_id: string;
deprecated: boolean;
deprecated?: boolean;
endpoints: {
rpc: string[];
};
@@ -59,22 +59,20 @@ export type EVMChainConfig = {
transaction_path: string;
};
id: string;
chain_type: "evm";
provider_params: [
{
chainId: string;
chainName: string;
rpcUrls: string[];
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
blockExplorerUrls: string[];
},
];
chain_type: string;
provider_params: {
chainId: string;
chainName: string;
rpcUrls: string[];
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
blockExplorerUrls: string[];
}[];
no_inflation: boolean;
no_tvl: boolean;
no_tvl?: boolean;
};

export type CosmosChainConfig = {
2 changes: 1 addition & 1 deletion packages/utils/src/string.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export const unSluggify = (value: string) =>
value.split("-").map(capitalize).join(" ");

export const maskAddress = (
address: `0x${string}`,
address: string,
opts?: {
segmentA: number;
segmentB: number;

Unchanged files with check annotations Beta

}
});
expect(supportedChains.length).toBe(chains.length);

Check failure on line 41 in packages/evm/src/clients/clients.spec.ts

GitHub Actions / setup-and-test

src/clients/clients.spec.ts > EVM Clients > should support all mainnet chains

AssertionError: expected 19 to be 20 // Object.is equality - Expected + Received - 20 + 19 ❯ src/clients/clients.spec.ts:41:36
});
it("should support all testnet chains", async () => {
}
});
expect(supportedChains.length).toBe(chains.length - 1); // Excluding centrifuge-2 chain because public rpc is not available

Check failure on line 64 in packages/evm/src/clients/clients.spec.ts

GitHub Actions / setup-and-test

src/clients/clients.spec.ts > EVM Clients > should support all testnet chains

AssertionError: expected 20 to be 24 // Object.is equality - Expected + Received - 24 + 20 ❯ src/clients/clients.spec.ts:64:36
});
});