210 lines
9.1 KiB
TypeScript
210 lines
9.1 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* Generate a new random seed phrase (18 words, 192 bits entropy)
|
|
* This is completely offline - uses browser's crypto.getRandomValues()
|
|
*/
|
|
export function generate_seed(): string;
|
|
/**
|
|
* Get view key and address from seed phrase (offline) - COMPATIBLE WITH NEPTUNE-CORE
|
|
*
|
|
* This derives the view key from a BIP39 seed phrase using neptune-crypto-core.
|
|
* The view key can be used with wallet_getUtxosFromViewKey RPC method.
|
|
*
|
|
* Input: JSON string with seed_phrase array and network ("mainnet" or "testnet")
|
|
* Output: JSON string with receiver_identifier, view_key (hex), and address (bech32m)
|
|
*
|
|
* Example:
|
|
* ```javascript
|
|
* const result = get_viewkey('["word1", "word2", ...]', "testnet");
|
|
* const { receiver_identifier, view_key, address } = JSON.parse(result);
|
|
* console.log('View key:', view_key); // Compatible with neptune-core!
|
|
* ```
|
|
*/
|
|
export function get_viewkey(seed_phrase_json: string, network: string): string;
|
|
/**
|
|
* Get receiving address from seed phrase (offline)
|
|
* Input: JSON string with seed_phrase array and network
|
|
* Output: bech32m encoded address string
|
|
*/
|
|
export function address_from_seed(seed_phrase_json: string, network: string): string;
|
|
/**
|
|
* Validate a seed phrase (offline)
|
|
*/
|
|
export function validate_seed_phrase(seed_phrase_json: string): boolean;
|
|
/**
|
|
* Decode view key from hex string (offline)
|
|
*/
|
|
export function decode_viewkey(view_key_hex: string): string;
|
|
/**
|
|
* Prepare transaction data for server-side signing
|
|
*
|
|
* This prepares transaction details but does NOT sign locally.
|
|
* Instead, it exports the spending key seed so the server can sign.
|
|
*
|
|
* Input: JSON string with BuildTxRequest
|
|
* Output: JSON string with SignedTxData (contains seed for server signing)
|
|
*
|
|
* Example:
|
|
* ```javascript
|
|
* const request = {
|
|
* seed_phrase: ["word1", "word2", ...],
|
|
* inputs: [{addition_record: "0xabc..."}],
|
|
* outputs: [{address: "nep1...", amount: "50.0"}],
|
|
* fee: "0.01",
|
|
* network: "testnet"
|
|
* };
|
|
* const txData = build_and_sign_tx(JSON.stringify(request));
|
|
* // Now broadcast via JSON-RPC: wallet_broadcastSignedTransaction(txData)
|
|
* ```
|
|
*/
|
|
export function build_and_sign_tx(request_json: string): string;
|
|
/**
|
|
* Get wallet balance via JSON-RPC (Neptune core ext format)
|
|
* Uses wallet_balance method from Wallet namespace
|
|
*/
|
|
export function get_balance(rpc_url: string): Promise<string>;
|
|
/**
|
|
* Send transaction via JSON-RPC
|
|
* Note: Neptune core ext may not have direct "send" method in public RPC
|
|
* This is a placeholder - check actual available methods
|
|
*/
|
|
export function send_tx_jsonrpc(rpc_url: string, to_address: string, amount: string, fee: string): Promise<string>;
|
|
/**
|
|
* Get block height via JSON-RPC (Neptune core ext format)
|
|
* Uses chain_height method from Chain namespace
|
|
*/
|
|
export function get_block_height(rpc_url: string): Promise<bigint>;
|
|
/**
|
|
* Get network info via JSON-RPC (Neptune core ext format)
|
|
* Uses node_network method from Node namespace
|
|
*/
|
|
export function get_network_info(rpc_url: string): Promise<string>;
|
|
/**
|
|
* Get wallet addresses from Neptune core (PRODUCTION - EXACT Neptune addresses!)
|
|
* Returns both generation_address and symmetric_address
|
|
*/
|
|
export function get_wallet_address(rpc_url: string): Promise<string>;
|
|
/**
|
|
* Get view key from Neptune core (RECOMMENDED)
|
|
* This exports the proper view key format from Neptune core's wallet
|
|
* Returns a hex-encoded view key that can be used with wallet_getUtxosFromViewKey
|
|
*/
|
|
export function get_viewkey_from_neptune(rpc_url: string): Promise<string>;
|
|
/**
|
|
* Get UTXOs from view key (scan blockchain)
|
|
* This calls Neptune core's wallet_getUtxosFromViewKey JSON-RPC method
|
|
*
|
|
* Input: view_key (hex string from neptune-core format), start_block, end_block (optional)
|
|
* Output: JSON string with list of UTXOs
|
|
*/
|
|
export function get_utxos_from_viewkey(rpc_url: string, view_key_hex: string, start_block: bigint, end_block?: bigint | null): Promise<string>;
|
|
/**
|
|
* Generate viewkey from BIP39 seed phrase
|
|
*
|
|
* # Arguments
|
|
* * `phrase` - Space-separated BIP39 seed phrase (12-24 words)
|
|
* * `key_index` - Key derivation index (default: 0)
|
|
*
|
|
* # Returns
|
|
* Hex-encoded viewkey compatible with neptune-core
|
|
*/
|
|
export function generate_viewkey_from_phrase(phrase: string, key_index: bigint): string;
|
|
/**
|
|
* Generate receiving address from BIP39 seed phrase
|
|
*
|
|
* # Arguments
|
|
* * `phrase` - Space-separated BIP39 seed phrase (12-24 words)
|
|
* * `key_index` - Key derivation index (default: 0)
|
|
* * `testnet` - Use testnet network (true) or mainnet (false)
|
|
*
|
|
* # Returns
|
|
* Bech32m-encoded receiving address
|
|
*/
|
|
export function generate_address_from_phrase(phrase: string, key_index: bigint, testnet: boolean): string;
|
|
/**
|
|
* Get receiver identifier from viewkey hex
|
|
*/
|
|
export function get_receiver_id_from_viewkey(viewkey_hex: string): string;
|
|
/**
|
|
* Debug: Get detailed key derivation info
|
|
*/
|
|
export function debug_key_derivation(phrase: string, key_index: bigint): string;
|
|
/**
|
|
* Sign transaction offline (WASM client-side signing)
|
|
* This creates lock_script_and_witness WITHOUT exposing spending key to server
|
|
*
|
|
* # Arguments
|
|
* * `phrase` - BIP39 seed phrase (18 words)
|
|
* * `utxos_json` - JSON array of UTXOs from get_utxos (with addition_record)
|
|
* * `outputs_json` - JSON array of outputs [{address, amount}, ...]
|
|
* * `fee` - Transaction fee as string
|
|
* * `key_index` - Key derivation index (usually 0)
|
|
* * `testnet` - Network selection
|
|
*
|
|
* # Returns
|
|
* JSON containing:
|
|
* - lock_script_and_witness: hex-encoded signature
|
|
* - view_key: hex-encoded view key
|
|
* - inputs: array of addition_records
|
|
* - outputs: array of {address, amount}
|
|
* - fee: fee string
|
|
*/
|
|
export function sign_transaction_offline(phrase: string, utxos_json: string, outputs_json: string, fee: string, key_index: bigint, testnet: boolean): string;
|
|
|
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
|
|
export interface InitOutput {
|
|
readonly memory: WebAssembly.Memory;
|
|
readonly generate_seed: () => [number, number, number, number];
|
|
readonly get_viewkey: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
readonly address_from_seed: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
readonly validate_seed_phrase: (a: number, b: number) => [number, number, number];
|
|
readonly decode_viewkey: (a: number, b: number) => [number, number, number, number];
|
|
readonly build_and_sign_tx: (a: number, b: number) => [number, number, number, number];
|
|
readonly get_balance: (a: number, b: number) => any;
|
|
readonly send_tx_jsonrpc: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
readonly get_block_height: (a: number, b: number) => any;
|
|
readonly get_network_info: (a: number, b: number) => any;
|
|
readonly get_wallet_address: (a: number, b: number) => any;
|
|
readonly get_viewkey_from_neptune: (a: number, b: number) => any;
|
|
readonly get_utxos_from_viewkey: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: bigint) => any;
|
|
readonly generate_viewkey_from_phrase: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
readonly generate_address_from_phrase: (a: number, b: number, c: bigint, d: number) => [number, number, number, number];
|
|
readonly get_receiver_id_from_viewkey: (a: number, b: number) => [number, number, number, number];
|
|
readonly debug_key_derivation: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
readonly sign_transaction_offline: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: bigint, j: number) => [number, number, number, number];
|
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
readonly __externref_table_alloc: () => number;
|
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
readonly __wbindgen_export_3: WebAssembly.Table;
|
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
readonly closure49_externref_shim: (a: number, b: number, c: any) => void;
|
|
readonly closure268_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
readonly __wbindgen_start: () => void;
|
|
}
|
|
|
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
/**
|
|
* Instantiates the given `module`, which can either be bytes or
|
|
* a precompiled `WebAssembly.Module`.
|
|
*
|
|
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
*
|
|
* @returns {InitOutput}
|
|
*/
|
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
|
|
/**
|
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
*
|
|
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
*
|
|
* @returns {Promise<InitOutput>}
|
|
*/
|
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|