UNPKG

near-ca-test

Version:

An SDK for controlling Ethereum Accounts from a Near Account.

43 lines (42 loc) 1.91 kB
import { NearEthAdapter } from "./chains/ethereum"; import { NearConfig } from "near-api-js/lib/near"; export * from "./chains/ethereum"; export * from "./chains/near"; export * from "./mpcContract"; export * from "./network"; export * from "./types"; export * from "./utils"; export * from "./beta"; /** * Configuration for setting up the adapter. * * @property {string} accountId - The NEAR account ID. * @property {string} mpcContractId - The MPC contract ID. * @property {NearConfig} [network] - (Optional) The NEAR network configuration. * @property {string} [privateKey] - (Optional) The private key for the account. * @property {string} [derivationPath] - (Optional) The derivation path for the Ethereum account. Defaults to "ethereum,1". * @property {string} [rootPublicKey] - (Optional) The root public key for the account. If not available it will be fetched from the MPC contract. */ export interface SetupConfig { accountId: string; mpcContractId: string; network?: NearConfig; privateKey?: string; derivationPath?: string; rootPublicKey?: string; } /** * Sets up the NEAR-Ethereum adapter using the provided configuration. * * This function establishes a connection to the NEAR network using the given * account details, configures the Multi-Party Computation (MPC) contract, and * returns an instance of the NearEthAdapter. * * @param {SetupConfig} args - The configuration parameters for setting up the adapter. * * @returns {Promise<NearEthAdapter>} - A promise that resolves to an instance of NearEthAdapter configured with the provided settings. * * @throws {Error} - Throws an error if the `accountId` does not match the networkId of the provided or inferred `network`. * @throws {Error} - Throws an error if there is a failure in creating a NEAR account. */ export declare function setupAdapter(args: SetupConfig): Promise<NearEthAdapter>;