near-ca
Version:
An SDK for controlling Ethereum Accounts from a Near Account.
55 lines (54 loc) • 1.87 kB
TypeScript
import { Address, Hex, Signature } from "viem";
import { FunctionCallTransaction, SignArgs } from "../types";
import { Account } from "near-api-js";
import { IMpcContract, NearEthAdapter } from "..";
/** Mock implementation of the MPC Contract interface for testing */
export declare class MockMpcContract implements IMpcContract {
connectedAccount: Account;
private ethAccount;
/**
* Creates a new mock MPC contract instance
*
* @param account - The NEAR account to use
* @param privateKey - Optional private key (defaults to deterministic test key)
*/
constructor(account: Account, privateKey?: Hex);
/** Gets the mock contract ID */
accountId(): string;
/**
* Returns the mock Ethereum address
*
* @returns The Ethereum address associated with the private key
*/
deriveEthAddress: (_unused?: string) => Promise<Address>;
/**
* Returns a mock deposit amount
*
* @returns A constant deposit value of "1"
*/
getDeposit: () => Promise<string>;
/**
* Signs a message using the mock private key
*
* @param signArgs - The signature request arguments
* @returns The signature
*/
requestSignature: (signArgs: SignArgs) => Promise<Signature>;
/**
* Encodes a mock signature request transaction
*
* @param signArgs - The signature request arguments
* @param gas - Optional gas limit
* @returns The encoded transaction
*/
encodeSignatureRequestTx(signArgs: SignArgs, gas?: bigint): Promise<FunctionCallTransaction<{
request: SignArgs;
}>>;
}
/**
* Creates a mock adapter instance for testing
*
* @param privateKey - Optional private key for the mock contract
* @returns A configured NearEthAdapter instance
*/
export declare function mockAdapter(privateKey?: Hex): Promise<NearEthAdapter>;