import { ConnectedWalletAccount, WalletConnection, providers as najProviders } from 'near-api-js'; import { Decimal } from 'decimal.js'; import { providers as ethersProviders } from 'ethers'; declare type AuroraEvmAccount = string; interface AuroraCloudProviders { [key: AuroraEvmAccount]: ethersProviders.JsonRpcProvider; } interface NearWalletBehaviour { type: string; getAccounts: () => Promise>; signAndSendTransaction: ({ receiverId, actions }: { receiverId: string; actions: any[]; }) => Promise; } /** * Set ethProvider * * This must be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/nep141-erc20. * * Example: * * import { ethers } from 'ethers' * import { setEthProvider } from '@near-eth/client' * setEthProvider(new ethers.providers.JsonRpcProvider(url)) * * @param provider Ethereum Provider * * @returns `provider` */ export declare function setEthProvider(provider: ethersProviders.JsonRpcProvider): ethersProviders.JsonRpcProvider; /** * Set auroraProvider * * This must be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/nep141-erc20. * * Example: * * import { ethers } from 'ethers' * import { setAuroraProvider } from '@near-eth/client' * setAuroraProvider(new ethers.providers.JsonRpcProvider(url)) * * @param provider Aurora Provider * * @returns `provider` */ export declare function setAuroraProvider(provider: ethersProviders.JsonRpcProvider): ethersProviders.JsonRpcProvider; /** * Set cloudProviders * * This must be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/aurora-erc20. * * Example: * * import { ethers } from 'ethers' * import { setAuroraCloudProviders } from '@near-eth/client' * setAuroraCloudProviders({ "example-silo.near": new ethers.providers.JsonRpcProvider(url) }) * * @param cloudProviders Object of Aurora evm engine accounts to their respective provider. * * @returns `auroraCloudProviders` */ export declare function setAuroraCloudProviders(cloudProviders: AuroraCloudProviders): AuroraCloudProviders; /** * Set signerProvider * * This must be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/nep141-erc20. * * Example: * * import { ethers } from 'ethers' * import { setSignerProvider } from '@near-eth/client' * setSignerProvider(new ethers.providers.Web3Provider(window.ethereum, 'any')) * // use 'any' to allow switching networks * * @param provider Signer Provider * * @returns `provider` */ export declare function setSignerProvider(provider: ethersProviders.JsonRpcProvider | ethersProviders.Web3Provider): ethersProviders.JsonRpcProvider | ethersProviders.Web3Provider; /** * Set nearProvider * * This must be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/nep141-erc20. * * Example: * * import { providers } from 'near-api-js' * import { setNearProvider } from '@near-eth/client' * setNearProvider(new providers.JsonRpcProvider({ url })) * * @param provider Near Provider * * @returns `provider` */ export declare function setNearProvider(provider: najProviders.Provider): najProviders.Provider; /** * Set wallet-selector NEAR wallet * * This must be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/nep141-erc20. * * Example: * * import { setNearWallet } from '@near-eth/client' * import { setupWalletSelector } from "@near-wallet-selector/core" * import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet" * import { setupSender } from "@near-wallet-selector/sender" * * const selector = await setupWalletSelector({ * network: "testnet", * debug: true, * modules: [setupMyNearWallet(), setupSender()] * }) * setNearWallet(await selector.wallet()) * * @param wallet Near Wallet signer * * @returns `wallet` */ export declare function setNearWallet(wallet: NearWalletBehaviour): NearWalletBehaviour; /** * Set nearConnection * * This must be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/nep141-erc20. * * Example: * * import { Near, WalletConnection } from 'near-api-js' * import { config, setNearConnection } from '@near-eth/client' * * setNearConnection(new WalletConnection( * new Near(config.ropsten.near) * )) * * @param connection WalletConnection instance from near-api-js * * @returns `connection` */ export declare function setNearConnection(connection: WalletConnection): WalletConnection; /** * Get ethProvider * * Internal function, only expected to be used by @near-eth/nep141-erc20 and * other connector libraries that interoperate with @near-eth/client. If you * are an app developer, you can ignore this function. * * @returns an Ethereum Provider for use with ethers.js */ export declare function getEthProvider(): ethersProviders.JsonRpcProvider; export declare function getAuroraProvider(): ethersProviders.JsonRpcProvider; export declare function getAuroraCloudProvider({ auroraEvmAccount }: { auroraEvmAccount?: AuroraEvmAccount; }): ethersProviders.JsonRpcProvider; export declare function getSignerProvider(): ethersProviders.JsonRpcProvider; export declare function getNearProvider(): najProviders.Provider; export declare function getNearWallet(): NearWalletBehaviour | ConnectedWalletAccount; export declare function getNearAccountId(): Promise; /** * Get NEAR Account for the nearConnection set by `setNearConnection` * * Internal function, only expected to be used by @near-eth/nep141-erc20 and * other connector libraries that interoperate with @near-eth/client. If you * are an app developer, you can ignore this function. * Ensures that app called `setNearConnection` * * @returns WalletAccount a NEAR account object, when it doesn't trigger a page redirect. */ export declare function getNearAccount(): ConnectedWalletAccount; export declare function formatLargeNum(n: string, decimals?: number): Decimal; /** * Get bridgeParams * * Internal function, only expected to be used by @near-eth/nep141-erc20 and * other connector libraries that interoperate with @near-eth/client. If you * are an app developer, you can ignore this function. * * @returns Bridge parameters */ export declare function getBridgeParams(): any; /** * Set bridge parameters (contract addresses, abi...) * * This should be called by apps that use @near-eth/client before performing any * transfer operations with @near-eth/client itself or with connector libraries * such as @near-eth/nep141-erc20. * Otherwise connector libraries can also be used without bridgeParams by specifying the required * arguments in `options`. * * Example: bridge parameters for @near-eth/nep141-erc20 * * setBridgeParams({ * nearEventRelayerMargin: 10, // 10 blocks margin for the Event relayer to finalize the transfer * sendToNearSyncInterval: 20000, // check light client sync every 20sec * sendToEthereumSyncInterval: 60000, // check light client sync every 60sec * ethChainId: 1, // mainnet * erc20Abi: process.env.ethErc20AbiText, // Standard ERC-20 ABI * erc20LockerAddress: '0x23ddd3e3692d1861ed57ede224608875809e127f', * erc20LockerAbi: process.env.ethLockerAbiText, * nep141Factory: 'factory.bridge.near', * ethClientAddress: '0x0151568af92125fb289f1dd81d9d8f7484efc362', * ethClientAbi: process.env.ethNearOnEthClientAbiText, * nearClientAccount: 'client.bridge.near' * }) * * @param params Object containing bridge parameters * @returns `params` */ export declare function setBridgeParams(params: any): any; export {}; //# sourceMappingURL=utils.d.ts.map