Esc

View as Markdownllms.txt

Get from Contract

Fetch data from your deployed smart contract.

import { mega } from '@megaeth-labs/wallet-sdk';

const value = await mega.getFromContract<bigint>({
    address: '0x3e942744C21Eec1D88FBD463Fd0CcE42891Aec5C',
    abi: storageAbi,
    functionName: 'retrieve',
    args: [],
});
Runs on testnet with your wallet
ts
interface GetFromContractRequest {
    address: `0x${string}`;
    abi: any;
    functionName: string;
    args: any[];
}

// Resolves to the function's return value