/** * MultiversX (formerly Elrond) Chain Adapter * * Builds MultiversX transactions using the REST API, attaches Ed25519 * signatures from the FROST threshold signing network, and broadcasts * via the MultiversX gateway/API. * * MultiversX uses Ed25519 for signing. The signing payload is the raw * bytes of the deterministic JSON serialization of the transaction — * no hashing is needed because Ed25519 signs the raw message bytes. * * No external dependencies — uses raw HTTP API calls. * * Address format: erd1... (bech32 with "erd" HRP) * * @example * ```typescript * import { MultiversXAdapter } from '@sequence0/sdk'; * * const mvx = new MultiversXAdapter('mainnet'); * * // Build a transfer transaction * const unsignedTx = await mvx.buildTransaction( * { to: 'erd1...recipient', amount: '1000000000000000000' }, // 1 EGLD * 'erd1...sender' * ); * * // ... sign via FROST ed25519 ... * const signedTx = await mvx.attachSignature(unsignedTx, signatureHex); * const txHash = await mvx.broadcast(signedTx); * ``` */ import { ChainAdapter, MultiversXTransaction } from '../core/types'; export declare class MultiversXAdapter implements ChainAdapter { private network; private apiUrl; private chainId; /** * Create a MultiversX adapter. * * @param network - Network to connect to: 'mainnet', 'devnet', or 'testnet' * @param apiUrl - Custom API URL (overrides the default for the network) */ constructor(network?: 'mainnet' | 'devnet' | 'testnet', apiUrl?: string); getRpcUrl(): string; /** * Build an unsigned MultiversX transaction. * * The signing payload is the raw UTF-8 bytes of the deterministic * JSON serialization of the transaction fields. Ed25519 signs these * bytes directly (no hashing step needed — ed25519 internally hashes). * * Returns hex-encoded JSON containing the serialized TX and signing payload. * * @param tx - Transaction parameters (to, amount, data, gasLimit) * @param fromAddress - Sender erd1... address * @returns Hex-encoded payload containing serialized TX and signing bytes */ buildTransaction(tx: MultiversXTransaction, fromAddress: string): Promise; /** * Extract the signing payload from the buildTransaction output. * * Returns the hex-encoded raw bytes of the serialized TX JSON string. * This is signed directly by ed25519 (no additional hashing). */ getSigningPayload(unsignedTx: string): string; /** * Attach an Ed25519 signature to the MultiversX transaction. * * The signature is a 64-byte Ed25519 signature, attached as a hex * string in the "signature" field of the transaction JSON. * * @param unsignedTx - Hex-encoded unsigned transaction from buildTransaction * @param signature - 64-byte Ed25519 signature (hex-encoded, with optional 0x prefix) * @returns Hex-encoded signed transaction payload */ attachSignature(unsignedTx: string, signature: string): Promise; /** * Broadcast a signed MultiversX transaction. * * Sends the signed TX JSON to the MultiversX API gateway. * The API expects a JSON body with all TX fields plus the "signature" field. * * @param signedTx - Hex-encoded signed transaction from attachSignature * @returns Transaction hash */ broadcast(signedTx: string): Promise; /** * Get the EGLD balance for an address. * * Returns balance in atomic EGLD units (1 EGLD = 1e18 atomic units). * * @param address - MultiversX erd1... bech32 address * @returns Balance in atomic EGLD as a string */ getBalance(address: string): Promise; /** * Fetch the current nonce for an account from the network. * * @param address - erd1... bech32 address * @returns Current nonce (next expected TX sequence number) */ private fetchAccountNonce; /** * Derive an erd1... address from a 32-byte Ed25519 public key. * * Useful for converting the FROST group verifying key to a * MultiversX address. * * @param pubkeyHex - 32-byte Ed25519 public key (hex-encoded) * @returns erd1... bech32 address */ static deriveAddress(pubkeyHex: string): string; /** * Extract the 32-byte public key from an erd1... address. * * @param address - erd1... bech32 address * @returns 32-byte public key (hex-encoded) */ static addressToPublicKey(address: string): string; } /** * Create a MultiversX mainnet adapter * * @param apiUrl - Optional custom API URL * @returns MultiversXAdapter configured for mainnet */ export declare function createMultiversXAdapter(apiUrl?: string): MultiversXAdapter; /** * Create a MultiversX devnet adapter * * @param apiUrl - Optional custom API URL * @returns MultiversXAdapter configured for devnet */ export declare function createMultiversXDevnetAdapter(apiUrl?: string): MultiversXAdapter; /** * Create a MultiversX testnet adapter * * @param apiUrl - Optional custom API URL * @returns MultiversXAdapter configured for testnet */ export declare function createMultiversXTestnetAdapter(apiUrl?: string): MultiversXAdapter; //# sourceMappingURL=multiversx.d.ts.map