🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@kasplex/kiwi-web

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kasplex/kiwi-web - npm Package Compare versions

Comparing version
1.0.18
to
1.0.19
+23
dist/address/mnemonic.d.ts
declare class Mnemonic {
/**
* Generates a random mnemonic phrase of the specified length.
* @param {number} length - The length of the mnemonic phrase (must be 12 or 24).
* @returns {string} - The generated mnemonic phrase.
* @throws {Error} - Throws an error if the length is not 12 or 24.
*/
static random(length: number): string;
/**
* Validates whether the given mnemonic phrase is valid.
* @param {string} mnemonic - The mnemonic phrase to validate.
* @returns {boolean} - Returns true if the mnemonic is valid, otherwise false.
*/
static validate(mnemonic: string): boolean;
/**
* Converts a mnemonic phrase into a seed.
* @param {string} mnemonic - The mnemonic phrase.
* @param {string} [password=""] - An optional password used for seed generation.
* @returns {string} - The generated seed from the mnemonic.
*/
static toSeed(mnemonic: string, password?: string): string;
}
export { Mnemonic };
import { Wasm } from "../index";
declare class Wallet {
private privateKey;
private walletType?;
private xprv?;
private index?;
/**
* Private constructor to initialize a Wallet instance.
* @param {PrivateKey} privateKey - The private key for the wallet.
* @param {WalletType} [walletType] - The type of the wallet (HD or PrivateKey).
* @param {XPrv} [xprv] - The extended private key (only for HD wallets).
* @param {number} [index] - The index of the derived key (only for HD wallets).
*/
private constructor();
/**
* Creates a new wallet instance from a mnemonic phrase.
* @param {string} mnemonic - The mnemonic phrase.
* @param {string} [password=""] - An optional password for additional security.
* @returns {Wallet} - A new Wallet instance.
*/
static fromMnemonic(mnemonic: string, password?: string): Wallet;
/**
* Creates a wallet instance from an existing private key.
* @param {string} privateKey - The private key string.
* @returns {Wallet} - A new Wallet instance.
*/
static fromPrivateKey(privateKey: string): Wallet;
/**
* Returns the private key of the wallet as a string.
* @returns {string} - The private key.
*/
toPrivateKey(): string;
/**
* Returns the public key derived from the private key.
* @returns {PublicKey} - The public key.
*/
toPublicKey(): Wasm.PublicKey;
/**
* Returns the X-only public key (compressed public key format).
* @returns {XOnlyPublicKey} - The X-only public key.
*/
toXOnlyPublicKey(): Wasm.XOnlyPublicKey;
/**
* Returns the wallet's address based on the specified network type.
* @param {NetworkType} network - The network type (mainnet, testnet, etc.).
* @returns {Address} - The corresponding blockchain address.
*/
toAddress(network: Wasm.NetworkType): Wasm.Address;
/**
* Creates a new wallet derived from the current HD wallet at a specified index.
* @param {number} [index] - The index for the new wallet. If not provided, increments the last index.
* @returns {Wallet} - A new derived Wallet instance.
* @throws {Error} - Throws an error if the current wallet is not an HD wallet.
*/
newWallet(index?: number): Wallet;
/**
* Signs a given message using the private key.
* This allows the owner of the private key to prove ownership of the associated address.
*
* @param message - The message to be signed.
* @returns The signature as a hexadecimal string.
*/
signMessage(message: string): Wasm.HexString;
/**
* Verifies a signed message using the public key.
* This checks whether the signature was generated by the corresponding private key.
*
* @param message - The original message that was signed.
* @param signature - The signature to be verified.
* @returns A boolean indicating whether the signature is valid.
*/
verifyMessage(message: string, signature: string): boolean;
/**
* Validates an address.
* This checks whether the given address is valid using the AddressUtil.
*
* @param address - The address to be validated.
* @returns A boolean indicating whether the address is valid.
*/
static validate(address: string): boolean;
}
export { Wallet };
import { Params } from '../types/interface';
declare class KaspaApi {
/**
* Determines the appropriate API base URL based on the network type.
* @returns {string} - The base API URL.
*/
private static getBaseUrl;
/**
* Get balance for a specific Kaspa address.
* @param kaspaAddress The Kaspa wallet address
*/
static getBalance(kaspaAddress: string): Promise<unknown>;
/**
* Get balances for multiple addresses.
* @param params List of addresses
*/
static postBalance(params: Params): Promise<unknown>;
/**
* Get UTXOs for a specific Kaspa address.
* @param kaspaAddress The Kaspa wallet address
*/
static getUtxo(kaspaAddress: string): Promise<unknown>;
/**
* Get UTXOs for multiple addresses.
* @param params List of addresses
*/
static postUtxos(params: Params): Promise<unknown>;
/**
* Retrieves full transaction details for a specific Kaspa address.
* @param address The Kaspa wallet address to query.
* @param param Optional query parameters (e.g., limit, offset, fields, resolve_previous_outpoints).
* @returns A Promise resolving to the full transaction details.
*/
static getFullTransactions(address: string, param?: Record<string, string>): Promise<unknown>;
/**
* Retrieves paginated full transaction details for a specific Kaspa address.
* This is useful when dealing with large transaction histories that need pagination.
*
* @param address - The Kaspa wallet address to query
* @param param - Optional query parameters for pagination (e.g., limit, before,after,fields,resolve_previous_outpoints)
* @returns Promise containing the paginated transaction data
*/
static getFullTransactionPage(address: string, param?: Record<string, string>): Promise<unknown>;
/**
* Get transaction count for a specific Kaspa address.
* @param kaspaAddress The Kaspa wallet address
*/
static getTransactionsCount(kaspaAddress: string): Promise<unknown>;
/** Get BlockDAG info */
static getInfoBlockdag(): Promise<unknown>;
static getInfoCoinsupply(): Promise<unknown>;
static getInfoCoinsupplyCirculating(): Promise<unknown>;
static getInfoCoinsupplyTotal(): Promise<unknown>;
static getInfoKaspad(): Promise<unknown>;
static getInfoNetwork(): Promise<unknown>;
static getInfoFeeEstimate(): Promise<unknown>;
static getInfoPrice(): Promise<unknown>;
static getInfoBlockReward(): Promise<unknown>;
static getInfoHalving(): Promise<unknown>;
static getInfoHashRate(): Promise<unknown>;
static getInfoHashRateMax(): Promise<unknown>;
static getInfoHealth(): Promise<unknown>;
static getInfoMarketcap(): Promise<unknown>;
/**
* Get block details by block ID.
* @param blockId The block identifier
*/
static getBlocksBlockId(blockId: string): Promise<unknown>;
static getBlocks(): Promise<unknown>;
static getBlocksFromBluescore(): Promise<unknown>;
/**
* Get transaction details by transaction ID.
* @param transactionId The transaction identifier
*/
static getTransactionsId(transactionId: string): Promise<unknown>;
/**
* Search transactions based on parameters.
* @param params The search query parameters
*/
static postTransactionsSearch(params: Params): Promise<unknown>;
/**
* Submit a new transaction.
* @param params The transaction data
*/
static postTransactions(params: Params): Promise<unknown>;
/**
* Submit multiple transactions in a batch.
* @param params The batch transaction data
*/
static postTransactionsMass(params: Params): Promise<unknown>;
}
export { KaspaApi };
import { StatusInfoResponse, TokenListResponse, TokenInfoResponse, AddressTokenListResponse, BalanceResponse, MarketInfoResponse, BlackListResponse, OpListResponse, OperationInfoResponse, ArchiveOpListResponse, ArchiveVspcListResponse } from '../types/kasplexApiType';
declare class KasplexApi {
static version: string;
/**
* Determines the appropriate API base URL based on the network type.
* @returns {string} - The base API URL.
*/
private static getBaseUrl;
/**
* Fetches general blockchain information.
* @returns {Promise<StatusInfoResponse>} - A promise resolving to the blockchain info response.
*/
static getInfo(): Promise<StatusInfoResponse>;
/**
* Retrieves the list of KRC20 tokens.
* @param {Record<string, string>} param - Optional query parameters:
* - `next`: Cursor to start the next page (optional).
* - `prev`: Cursor to start the previous page (optional).
* @returns {Promise<TokenListResponse>} - A promise resolving to the token list response.
*/
static getTokenList(param?: Record<string, string>): Promise<TokenListResponse>;
/**
* Retrieves details of a specific KRC20 token by its ticker symbol.
* @param {string} tick - The token ticker symbol.
* @returns {Promise<TokenInfoResponse>} - A promise resolving to the token details response.
*/
static getToken(tick: string): Promise<TokenInfoResponse>;
/**
* Retrieves a list of tokens associated with a specific address.
* @param {string} address - The wallet address.
* @param {Record<string, string>} param - Optional query parameters:
* - `next`: Cursor to start the next page (optional).
* - `prev`: Cursor to start the previous page (optional).
* @returns {Promise<AddressTokenListResponse>} - A promise resolving to the list of tokens held by the address.
*/
static getAddressTokenList(address: string, param?: Record<string, string>): Promise<AddressTokenListResponse>;
/**
* Retrieves the balance of a specific token for a given address.
* @param {string} address - The wallet address.
* @param {string} tick - The token ticker symbol.
* @returns {Promise<BalanceResponse>} - A promise resolving to the balance response.
*/
static getBalance(address: string, tick: string): Promise<BalanceResponse>;
/**
* Retrieves a list of KRC20 operations based on query parameters.
* @param {Record<string, string>} param - Optional query parameters:
* - `next`: Cursor to start the next page (optional).
* - `prev`: Cursor to start the previous page (optional).
* - `address`: Filter by address (case-insensitive) (optional, either address or tick must be provided).
* - `tick`: Filter by token symbol (case-insensitive) (optional, either address or tick must be provided).
* @returns {Promise<OpListResponse>} - A promise resolving to the operations list response.
*/
static getOpList(param?: Record<string, string>): Promise<OpListResponse>;
/**
* Retrieves details of a specific KRC20 operation by its ID.
* @param {string} id - The operation ID.
* @returns {Promise<OperationInfoResponse>} - A promise resolving to the operation details response.
*/
static getOperationInfo(id: string): Promise<OperationInfoResponse>;
/**
* Retrieves VSPC archive details for a given DAAScore.
* @param {string} daascore - The DAAScore to look up.
* @returns {Promise<ArchiveVspcListResponse>} - A promise resolving to the VSPC details response.
*/
static getVspcDetail(daascore: string): Promise<ArchiveVspcListResponse>;
/**
* Retrieves a list of archived operations within a specific range.
* @param {string} oprange - The operation range.
* @returns {Promise<ArchiveOpListResponse>} - A promise resolving to the archived operations list response.
*/
static getOpListByRange(oprange: string): Promise<ArchiveOpListResponse>;
/**
* Retrieves market listing details for a specific KRC20 token.
* @param {string} tick - The token ticker symbol.
* @param {Record<string, string>} param - Optional query parameters:
* - `next`: Cursor to start the next page (optional).
* - `prev`: Cursor to start the previous page (optional).
* - `address`: Filter by address (case-insensitive) (optional).
* - `txid`: The UTXO hash bound to the order. Must also specify the address (optional).
* @returns {Promise<MarketInfoResponse>} - A promise resolving to the market listing details response.
*/
static getMarketInfo(tick: string, param?: Record<string, string>): Promise<MarketInfoResponse>;
/**
* Retrieves the blacklist for a specific contract address.
* @param {string} ca - The contract address.
* @param {Record<string, string>} param - Optional query parameters:
* - `next`: Cursor to start the next page (optional).
* - `prev`: Cursor to start the previous page (optional).
* @returns {Promise<BlackListResponse>} - A promise resolving to the blacklist response.
*/
static getBlackList(ca: string, param?: Record<string, string>): Promise<BlackListResponse>;
}
export { KasplexApi };
export declare const errorMsg: {
WALLET_NOT_FOUND: (walletName: string) => string;
WALLET_NOT_INITIALIZED: string;
WALLET_OBJECT_NOT_INITIALIZED: string;
FUNCTION_NAME_REQUIRED: string;
METHOD_NOT_FUNCTION: (functionName: string) => string;
WALLET_PROVIDER_NOT_INITIALIZED: string;
};
export * from './walletDetector';
export * from './walletApi';
/**
* A unified wallet API interface for interacting with various cryptocurrency wallets.
* Provides standardized methods for account management, transactions, and wallet operations.
*/
declare class WalletApi {
private walletObj;
private initialized;
walletName: string;
private constructor();
/**
* Initializes the wallet instance with the specified wallet provider
* @param walletName - Name of the wallet provider (e.g., 'kasware', 'unisat')
* @throws Error if wallet is not found or invalid
*/
private initWallet;
/**
* Factory method to create a new WalletApi instance
* @param walletName - Name of the wallet provider
* @returns Promise<WalletApi> - Initialized wallet instance
*/
static create(walletName: string): Promise<WalletApi>;
/**
* Validates that the wallet instance is properly initialized
* @throws Error if instance is not initialized
*/
private ensureInitialized;
/**
* Validates and returns a wallet method
* @param functionName - Name of the wallet method to call
* @returns Function - Bound wallet method
* @throws Error if method is invalid or unavailable
*/
checkFun(functionName: string): Promise<any>;
/**
* Performs wallet-specific authorization flow
* @returns Promise<string> - Authorization result (varies by wallet)
*/
authorize(): Promise<string | void | string[]>;
/**
* Validates wallet object is initialized
* @private
* @throws {Error} When wallet object is not available
*/
private validateWalletObject;
/**
* Registers a handler for the 'accountsChanged' event.
* @param handler - Callback function to handle the event.
*/
onAccountsChanged(handler: (accounts: string[]) => void): Promise<void>;
/**
* Removes a handler for the 'accountsChanged' event.
* @param handler - Callback function to remove.
*/
offAccountsChanged(handler: (accounts: string[]) => void): Promise<void>;
/**
* Registers a callback for network change events
* @param handler - Callback function that receives new network identifier
* @throws {Error} When wallet is not initialized
* @example
* wallet.onNetworkChanged((network) => {
* console.log('Network changed to:', network);
* });
*/
onNetworkChanged(handler: (network: string) => void): Promise<void>;
/**
* Unregisters a network change callback
* @param handler - Previously registered callback function to remove
* @throws {Error} When wallet is not initialized
*/
offNetworkChanged(handler: (network: string) => void): Promise<void>;
/**
* Requests access to wallet accounts
* @returns Promise<string[]> - Array of authorized account addresses
*/
requestAccounts(): Promise<string[]>;
/**
* Gets currently connected accounts
* @returns Promise<string> - Primary account address
*/
getAccounts(): Promise<string>;
/**
* Gets currently connected accounts
* @returns Promise<string> - Primary account address
*/
getAccount(): Promise<string>;
/**
* Gets current network version
* @returns Promise<string> - Network version identifier
*/
getVersion(): Promise<string>;
/**
* Gets current network information
* @returns Promise<string> - Network name/identifier
*/
getNetwork(): Promise<string>;
/**
* Switches wallet to specified network
* @param network - Target network identifier
* @returns Promise<string> - Operation result
*/
switchNetwork(network: string): Promise<string>;
/**
* Disconnects from wallet
* @param origin - Optional origin identifier
* @returns Promise<string> - Disconnection result
*/
disconnect(orgin?: string): Promise<string>;
/**
* Retrieves the public key from the wallet.
* @returns {Promise<string>} - Public key.
*/
getPublicKey(): Promise<string>;
/**
* Gets current account balance
* @returns Promise<Object> - Balance information
*/
getBalance(): Promise<Object>;
/**
* Retrieves the KRC20 token balance.
* @returns {Promise<Array<any> | Object>} - KRC20 token balance.
*/
getKRC20Balance(): Promise<Array<any> | Object>;
/**
* Retrieves the UTXO entries from the wallet.
* @returns {Promise<Array<any> | Object>} - UTXO entries.
*/
getUtxoEntries(): Promise<Array<any> | Object>;
/**
* Sends Kaspa transaction
* @param toAddress - Recipient address
* @param sompi - Amount in sompi
* @param options - Additional transaction options
* @returns Promise<string> - Transaction hash
*/
sendKaspa(toAddress: string, sompi: number, options?: object): Promise<string>;
/**
* Signs a PSKT transaction
* @param txJsonString - Transaction data in JSON format
* @param options - Signing options
* @returns Promise<string> - Signed transaction
*/
signPskt({ txJsonString, options }: {
txJsonString: string;
options: object;
}): Promise<string>;
/**
* Builds a script for a transaction.
* @param {Object} params - Script parameters.
* @param {string} params.type - Script type.
* @param {string} params.data - Script data.
* @returns {Promise<string>} - Built script.
*/
buildScript({ type, data }: {
type: string;
data: string;
}): Promise<string>;
/**
* Submits a commit-reveal transaction.
* @param {object} commit - Commit transaction.
* @param {object} reveal - Reveal transaction.
* @param {any} script - Script data.
* @param {string} networkId - Network ID.
* @returns {Promise<any>} - Transaction result.
*/
submitCommitReveal(commit: object, reveal: object, script: any, networkId: string): Promise<any>;
/**
* Creates a KRC20 order.
* @param {Object} params - Order parameters.
* @param {string} params.krc20Tick - KRC20 ticker.
* @param {number | string} params.krc20Amount - KRC20 amount.
* @param {number} params.kasAmount - Kaspa amount.
* @param {Array<{ address: string; amount: number }>} params.psktExtraOutput - Extra outputs.
* @param {number} params.priorityFee - Priority fee.
* @returns {Promise<any>} - Order result.
*/
createKRC20Order({ krc20Tick, krc20Amount, kasAmount, psktExtraOutput, priorityFee }: {
krc20Tick: string;
krc20Amount: number | string;
kasAmount: number;
psktExtraOutput: {
address: string;
amount: number;
}[];
priorityFee: number;
}): Promise<any>;
/**
* Buys a KRC20 token.
* @param {Object} params - Transaction parameters.
* @param {string} params.txJsonString - Transaction JSON string.
* @param {Array<{ address: string; amount: number }>} params.extraOutput - Extra outputs.
* @param {number} params.priorityFee - Priority fee.
* @returns {Promise<any>} - Transaction result.
*/
buyKRC20Token({ txJsonString, extraOutput, priorityFee }: {
txJsonString: string;
extraOutput: {
address: string;
amount: number;
}[];
priorityFee: number;
}): Promise<any>;
/**
* Cancels a KRC20 order.
* @param {Object} params - Order parameters.
* @param {string} params.krc20Tick - KRC20 ticker.
* @param {string} params.txJsonString - Transaction JSON string.
* @param {string} params.sendCommitTxId - Commit transaction ID.
* @returns {Promise<string>} - Cancellation result.
*/
cancelKRC20Order({ krc20Tick, txJsonString, sendCommitTxId }: {
krc20Tick: string;
txJsonString: string;
sendCommitTxId: string;
}): Promise<string>;
/**
* Signs a message.
* @param {string} msg - Message to sign.
* @param {string} type - Signature type.
* @returns {Promise<string>} - Signed message.
*/
signMessage(msg: string, type: string): Promise<string>;
/**
* Signs a KRC20 transaction.
* @param {string} inscribeJsonString - Inscription JSON string.
* @param {number} type - Transaction type.
* @param {string} destAddr - Destination address.
* @param {number} priorityFee - Priority fee.
* @returns {Promise<any>} - Signed transaction.
*/
signKRC20Transaction(inscribeJsonString: string, type: number, destAddr: string, priorityFee: number): Promise<any>;
/**
* Retrieves the current chain.
* @returns {Promise<Object>} - Current chain.
*/
getChain(): Promise<Object>;
/**
* Switches the wallet to the specified blockchain network
* @param chain - Chain ID/number to switch to
* @returns Promise<Object> - Result object containing network switch details
* @throws Error if chain switching fails or unsupported chain
*/
switchChain(chain: number): Promise<Object>;
/**
* Retrieves a paginated list of digital inscriptions (NFTs/BRC-20 tokens)
* @param cursor - Starting index for pagination (default: 0)
* @param size - Number of items per page (default: 10)
* @returns Promise<Object> - Paginated inscription data { list, total, cursor }
*/
getInscriptions(cursor?: number, size?: number): Promise<Object>;
/**
* Sends Bitcoin transaction to specified address
* @param toAddress - Recipient Bitcoin address
* @param satoshis - Amount to send in satoshis
* @param options - Additional transaction options { feeRate, memo, etc. }
* @returns Promise<string> - Resulting transaction hash
*/
sendBitcoin(toAddress: string, satoshis: number, options: object): Promise<string>;
/**
* Transfers Runes protocol tokens
* @param address - Recipient address
* @param runeid - Rune ID/identifier
* @param amount - Amount to transfer
* @param options - Additional transfer options
* @returns Promise<Object> - Transfer result { txId, status }
*/
sendRunes(address: string, runeid: string, amount: string, options: object): Promise<Object>;
/**
* Transfers a single inscription (NFT/BRC-20)
* @param address - Recipient address
* @param inscriptionId - ID of the inscription to transfer
* @param options - Transfer options { feeRate, etc. }
* @returns Promise<Object> - Transfer confirmation data
*/
sendInscription(address: string, inscriptionId: string, options: object): Promise<Object>;
/**
* Creates a transfer inscription for specified token
* @param ticker - Token ticker symbol (e.g., 'ordi')
* @param amount - Amount to inscribe
* @returns Promise<void> - Resolves when inscription is initiated
*/
inscribeTransfer(ticker: string, amount: string): Promise<void>;
/**
* Broadcasts a raw transaction to the network
* @param options - Transaction data { hex, network, etc. }
* @returns Promise<string> - Broadcast transaction ID
*/
pushTx(options: object): Promise<string>;
/**
* Signs a Partially Signed Bitcoin Transaction (PSBT)
* @param psbtHex - PSBT in hex format
* @param options - Signing options { autoFinalize, etc. }
* @returns Promise<string> - Signed PSBT hex
*/
signPsbt(psbtHex: string, options: object): Promise<string>;
/**
* Batch signs multiple PSBTs
* @param psbtHexs - Array of PSBT hex strings
* @param options - Array of signing options per PSBT
* @returns Promise<string[]> - Array of signed PSBT hex strings
*/
signPsbts(psbtHexs: string[], options: object[]): Promise<string[]>;
/**
* Pushes a signed PSBT to the network
* @param psbtHex - Signed PSBT in hex format
* @returns Promise<string> - Broadcast transaction ID
*/
pushPsbt(psbtHex: string): Promise<string>;
/**
* Establishes connection with wallet provider
* @returns Promise<void> - Resolves when connection is established
* @throws Error if connection fails
*/
connect(): Promise<void>;
/**
* Initializes wallet state and required parameters
* @returns Promise<any> - Wallet initialization data
*/
initialize(): Promise<any>;
/**
* Opens wallet UI for KRC-20 token deployment
* @returns Promise<any> - Deployment interface response
*/
openDeployKrc20View(): Promise<any>;
/**
* Opens wallet UI for KRC-20 token minting
* @returns Promise<any> - Minting interface response
*/
openMintKrc20View(): Promise<any>;
/**
* Verifies a signed message against current account
* @returns Promise<any> - Verification result
*/
verifyMessage(): Promise<any>;
}
export { WalletApi };
declare class BrowerWallet {
static walletList: string[];
/**
* Retrieves a list of installed browser wallets by checking their global variables.
* This method iterates through the `WALLET_ID_LIST` and checks if each wallet's global variable
* exists on the `window` object.
*
* @returns {Promise<string[]>} A promise that resolves to an array of wallet keys for installed wallets.
*/
static getBrowerWalletList(force?: boolean): Promise<string[]>;
/**
* Detects whether specified browser extensions are installed by checking their global variables.
* This method takes an array of extension names and checks if each extension's global variable
*
* @param {string[]} extensionNames - An array of extension names to check.
* @returns {Promise<Record<string, boolean>>} A promise that resolves to an object mapping extension names to their installation status.
*/
static detectBrowserExtensions(extensionNames: string[]): Promise<Record<string, boolean>>;
/**
* Checks if a specific browser extension is installed by verifying its global variable.
* This method attempts to detect the extension by checking if the corresponding global variable
* might be loaded asynchronously.
*
* @param {string} extensionName - The name of the extension to check.
* @param {number} retries - The number of retry attempts (default: 1).
* @param {number} delay - The delay (in milliseconds) between retries (default: 300).
* @returns {Promise<boolean>} A promise that resolves to `true` if the extension is installed, otherwise `false`.
*/
static isExtInstalled(extensionName: string, retries?: number, delay?: number): Promise<boolean>;
/**
* Retrieves the wallet instance for the specified wallet name.
* This method checks if the wallet extension is installed by verifying its global variable on the `window` object.
* If the wallet is installed, it returns the wallet instance; otherwise, it returns `null`.
*
* @param {string} walletName - The name of the wallet to retrieve.
* @returns {Promise<Window[keyof Window] | null>} A promise that resolves to the wallet instance if installed, otherwise `null`.
*/
static getWallet(walletName: string): Promise<Window[keyof Window] | null>;
}
export { BrowerWallet };
import { Krc20Data } from "./types/interface";
declare class ValidateKrc20Data {
#private;
/**
* Validates the deployment operation data.
* @returns The current instance for chaining.
*/
private static validateDeploy;
/**
* Validates the mint operation data.
* @returns The current instance for chaining.
*/
private static validateMint;
/**
* Validates the transfer operation data.
* @returns The current instance for chaining.
*/
private static validateTransfer;
/**
* Validates the list operation data.
* @returns The current instance for chaining.
*/
private static validateList;
/**
* Validates the send operation data.
* @returns The current instance for chaining.
*/
private static validateSend;
/**
* Validates the issue operation data.
* @returns The current instance for chaining.
*/
private static validateIssue;
/**
* Validates the burn operation data.
* @returns The current instance for chaining.
*/
private static validateBurn;
/**
* Validates the blacklist operation data.
* @returns The current instance for chaining.
*/
private static validateBlacklist;
/**
* Validates the chown operation data.
* @returns The current instance for chaining.
*/
private static validateChown;
/**
* Validates the ticker field in the data.
* @returns The current instance for chaining.
* @throws Error if the ticker is invalid.
*/
private static validateTick;
/**
* Validates the ticker field in the data.
* @param data The Krc20Data object to validate.
* @returns The current instance for chaining.
* @throws Error if the ticker is invalid.
*/
private static validateTickOrCa;
/**
* Validates the 'to' address field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'to' address is invalid.
*/
private static validateAddress;
/**
* Validates the 'to' address field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'to' address is invalid.
*/
private static validateTo;
/**
* Validates the 'max' field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'max' value is invalid.
*/
private static validateMax;
/**
* Validates the 'lim' field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'lim' value is invalid.
*/
private static validateLim;
/**
* Validates the 'amt' field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'amt' value is invalid.
*/
private static validateAmt;
/**
* Validates the 'dec' field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'dec' value is invalid.
*/
private static validateDec;
/**
* Validates the 'pre' field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'pre' value is invalid.
*/
private static validatePre;
/**
* Validates the 'ca' field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'ca' value is invalid.
*/
private static validateCa;
/**
* Validates the 'mod' field in the data.
* @returns The current instance for chaining.
* @throws Error if the 'mod' value is invalid.
*/
private static validateMod;
/**
* Validates the Krc20Data based on the operation type.
* @param data The Krc20Data object to validate.
* @throws Error if the operation type is invalid or data validation fails.
*/
static validate(data: Krc20Data): void;
}
export { ValidateKrc20Data };
export * as Wasm from './wasm';
export * from "./address/mnemonic";
export * from "./address/wallet";
export * from "./rpc/client";
export * from "./api/kasplexApi";
export * from "./api/kaspaApi";
export * from "./KaspaTransaction";
export * from "./script/script";
export * from "./krc20";
export * from './kiwi';
export * from './init';
export * from "./utils/index";
export * from "./browerExtend/index";
export * as Modules from "./types/index";
export * as Tx from "./tx";

Sorry, the diff of this file is too big to display

export declare function initialize(wasmUrl?: string | URL): Promise<void>;

Sorry, the diff of this file is not supported yet

import { Wasm } from "./index";
declare class KaspaTransaction {
static transferKas(privateKey: Wasm.PrivateKey, toAddress: string | Wasm.Address, amount: bigint, fee?: bigint | undefined, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
static transfer(privateKey: Wasm.PrivateKey, outputs: Wasm.IPaymentOutput[], fee?: bigint | undefined, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
}
export { KaspaTransaction };
import { Wasm } from "./index";
declare class Kiwi {
static network: Wasm.NetworkType;
private static isWasmLoaded;
/**
* Sets the network type for the Kiwi class.
*
* @param {NetworkType} network - The network type to set (e.g., Mainnet, Testnet).
*/
static setNetwork(network: Wasm.NetworkType): void;
static getNetworkID(): string;
}
export { Kiwi };
import { Wasm } from "./index";
import { Krc20Data } from './types/interface';
declare class KRC20 {
static executeCommit(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint): Promise<string | undefined>;
static executeReveal(privateKey: Wasm.PrivateKey, data: Krc20Data, commitTxid: string): Promise<string | undefined>;
/**
* Executes a KRC20 operation.
* .param privateKey - The private key.
* .param data - The KRC20 data.
* .param fee - The transaction fee.
* .param payload - The transaction payload.
* .returns The submitted transaction ID.
*/
static executeOperation(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
/**
* Gets the script public key from a transaction output.
* .param txOutput - The transaction output.
* .returns The script public key.
*/
private static getScriptPublicKey;
/**
* Mints new KRC20 tokens.
* .param privateKey - The private key for signing the transaction.
* .param data - The KRC20 data containing mint details.
* .param fee - The transaction fee.
* .param payload - (Optional) payload in the transaction.
* .returns The submitted reveal transaction.
*/
static mint(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
/**
* Deploys a new KRC20 token contract.
* .param privateKey - The private key for signing the transaction.
* .param data - The KRC20 data containing deployment details.
* .param fee - The transaction fee.
* .returns The submitted reveal transaction.
*/
static deploy(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
/**
* Transfers KRC20 tokens to another address.
* .param privateKey - The private key for signing the transaction.
* .param data - The KRC20 data containing transfer details.
* .param fee - The transaction fee.
* .returns The submitted reveal transaction.
*/
static transfer(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
/**
* Lists KRC20 token details.
* .param privateKey - The private key for signing the transaction.
* .param data - The KRC20 data containing listing details.
* .param fee - The transaction fee.
* .returns The submitted reveal transaction.
*/
static list(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint): Promise<string | undefined>;
/**
* Signs a transaction.
* .param privateKey - The private key.
* .param data - The KRC20 data.
* .param hash - The transaction hash.
* .param amount - The amount.
* .param fee - The fee.
* .param payload - The payload.
* .returns The serialized transaction.
*/
static sendTransaction(privateKey: Wasm.PrivateKey, data: Krc20Data, hash: string, amount: bigint, payload?: string): Promise<string>;
/**
* Sends KRC20 tokens to another address.
* .param privateKey - The private key for signing the transaction.
* .param sendTx - The KRC20 data containing send details.
* .param priorityFee - The transaction fee.
* .returns The submitted reveal transaction.
*/
static send(privateKey: Wasm.PrivateKey, sendTx: string, priorityFee?: bigint): Promise<string | undefined>;
/**
* Multi-mints new KRC20 tokens.
* .param privateKey - The private key string.
* .param data - The KRC20 data containing mint details.
* .param fee - The transaction fee.
* .param executionCount - The number of mint operations to execute.
* .param callback - callback function.
* .returns The submitted reveal transaction IDs.
*/
static multiMint(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, executionCount?: number, callback?: (current: number, txid: string) => void): Promise<undefined>;
/**
* Multi-mints new KRC20 tokens.
* .param privateKey - The private key string.
* .param data - The KRC20 data containing mint details.
* .param fee - The transaction fee.
* .param executionCount - The number of mint operations to execute.
* .param callback - callback function.
* .returns The submitted reveal transaction IDs.
*/
static multiMintWithReuseUtxo(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, executionCount?: number, callback?: (current: number, txid: string) => void): Promise<undefined>;
/**
* Get the fee information based on the operation type.
*
* .param op - The operation type (e.g., 'mint', 'deploy', 'transfer').
* .returns An object containing the P2SH fee and priority fee.
*/
private static getFeeInfo;
/**
* Creates a KRC20 script.
* .param privateKey - The private key.
* .param data - The KRC20 data.
* .returns The generated script.
*/
private static createScript;
/**
* Creates a P2SH address from a script.
* .param script - The script.
* .returns The P2SH address.
*/
private static createP2SHAddress;
static issue(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
static burn(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
static blacklist(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
static chown(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>;
}
export { KRC20 };
import { Wasm } from "../index";
declare class Rpc {
private static instance;
client: Wasm.RpcClient;
/**
* Private constructor to initialize the Wasm.RpcClient with the given network and URL.
*
* @param network - The network type (default: Mainnet).
* @param url - The optional RPC server URL.
*/
private constructor();
/**
* Sets and returns a singleton instance of the Rpc class.
*
* @param network - The network type (default: Mainnet).
* @param url - The optional RPC server URL.
* @returns The singleton instance of Rpc.
*/
static setInstance(network: Wasm.NetworkType, url?: string): Rpc;
/**
* Returns the existing singleton instance of the Rpc class.
*
* @returns The singleton instance of Rpc.
*/
static getInstance(): Rpc;
/**
* Establishes a connection to the RPC server.
*/
connect(): Promise<void>;
/**
* Disconnects from the RPC server.
*/
disconnect(): Promise<void>;
/**
* Generates the RPC client configuration based on the provided network and URL.
*
* @param network - The network type.
* @param url - The optional RPC server URL.
* @returns The configuration object for the Wasm.RpcClient.
*/
private static getConfig;
}
export { Rpc };
import { Wasm } from "../index";
import { Krc20Data } from '../types/interface';
declare class Script {
/**
* Generates a KRC-20 script.
* @param publicKey - The public key as a string.
* @param data - The KRC-20 data to be included in the script.
* @returns The generated ScriptBuilder instance.
*/
static krc20Script(publicKey: string, data: Krc20Data): Wasm.ScriptBuilder;
/**
* Generates a script with a lock time.
* @param publicKey - The public key as a string.
* @param data - The KRC-20 data to be included in the script.
* @param lockTime - The lock time in seconds.
* @returns The generated ScriptBuilder instance.
* @throws If the lock time is in the past.
*/
static lockTimeScript(publicKey: string, data: Krc20Data, lockTime: bigint): Wasm.ScriptBuilder;
/**
* Generates a multi-signature transaction script.
* @param publicKeys - An array of public keys.
* @param require - The number of required signatures.
* @param ecdsa - Whether to use ECDSA (optional).
* @returns The generated ScriptBuilder instance.
*/
static multiSignTx(publicKeys: string[], require: number, ecdsa?: boolean): Wasm.ScriptBuilder;
/**
* Generates a multi-signature transaction script with KRC-20 data.
* @param publicKeys - An array of public keys.
* @param data - The KRC-20 data to be included in the script.
* @param require - The number of required signatures.
* @param ecdsa - Whether to use ECDSA (optional).
* @returns The generated ScriptBuilder instance.
*/
static multiSignTxKrc20Script(publicKeys: string[], data: Krc20Data, require: number, ecdsa?: boolean): Wasm.ScriptBuilder;
/**
* Creates a multi-signature address.
* @param publicKeys - An array of public keys.
* @param require - The number of required signatures.
* @param networkType - The network type.
* @param ecdsa - Whether to use ECDSA (optional).
* @returns The multi-signature address.
*/
static multiSignAddress(require: number, publicKeys: string[], networkType: Wasm.NetworkType, ecdsa?: boolean): Wasm.Address;
/**
* Generates a redeem multi-signature address.
* @param publicKeys - An array of public keys.
* @param require - The number of required signatures.
* @param networkType - The networkType type.
* @param ecdsa - Whether to use ECDSA (optional).
* @returns The generated address.
*/
static redeemScript(require: number, publicKeys: string[], ecdsa?: boolean): Wasm.ScriptBuilder;
/**
* Redeems a multi-signature address by constructing the appropriate script.
*
* @param require - The number of required signatures to unlock the funds.
* @param publicKeys - An array of public keys involved in the multi-signature address.
* @param networkType - The network type (e.g., mainnet, testnet) for address generation.
* @param ecdsa - Optional flag to indicate whether to use ECDSA signatures (default is Schnorr signatures).
* @returns A `ScriptBuilder` instance containing the constructed multi-signature script.
*/
static redeemMultiSignAddress(require: number, publicKeys: string[], ecdsa?: boolean): Wasm.ScriptBuilder;
}
export { Script };
import { Wasm } from "../index";
declare class Entries {
/**
* Fetches UTXO entries for a given address from the RPC server.
*
* @param address - The address to fetch UTXOs for.
* @returns A promise that resolves to an array of UTXO entry references.
*/
static entries(address: string): Promise<Wasm.UtxoEntryReference[]>;
/**
* Creates a revealed UTXO entry for a given address and transaction hash.
*
* @param address - The address associated with the UTXO.
* @param hash - The transaction hash of the UTXO.
* @param scriptPublicKey - The script public key of the UTXO.
* @param amount - The amount of the UTXO (default is BASE_KAS_TO_P2SH_ADDRESS).
* @param blockDaaScore - The block DAA score of the UTXO (default is U64_MAX_VALUE).
* @returns An array containing the revealed UTXO entry.
*/
static revealEntries(address: Wasm.Address, hash: string, scriptPublicKey: Wasm.ScriptPublicKey, amount?: bigint, blockDaaScore?: bigint): Wasm.IUtxoEntry[];
}
export { Entries };
export * from './entries';
export * from './outpoint';
export * from './pendingTransaction';
export * from './output';
export * from './transaction';
export * from './rawTransaction';
import { Wasm } from "../index";
/**
* Represents a raw Kaspa transaction, providing methods for creation and signing.
*/
declare class MultiSignTransaction {
transaction: Wasm.Transaction;
/**
* Initializes a new instance of `RawTransaction` with a given transaction object.
*
* @param transaction - The transaction object.
*/
constructor(transaction: Wasm.Transaction);
static createTransaction(address: string, outputs: Wasm.IPaymentOutput[], priorityFee?: bigint, payload?: Wasm.HexString | Uint8Array, sigOpCount?: number): Promise<MultiSignTransaction>;
static createTransactionFromJson(json: string): MultiSignTransaction;
/**
* Signs the transaction using the provided private key.
*
* @param privateKey - The private key used for signing.
* @param script - A custom script used for signature encoding.
* @param sigHashType - The signature hash type (optional).
* @returns The updated instance of `RawTransaction`.
*/
sign(privateKey: Wasm.PrivateKey, script: Wasm.ScriptBuilder, sigHashType?: Wasm.SighashType): this;
/**
* Signs the transaction using the provided private key.
*
* @param privateKey - The private key used for signing.
* @param sigHashType - The signature hash type (optional).
* @returns The updated instance of `RawTransaction`.
*/
signMessages(privateKey: Wasm.PrivateKey, sigHashType?: Wasm.SighashType): string[];
/**
* Signs the transaction using the provided private key.
*
* @param signMessage - The signed message.
* @returns The updated instance of `RawTransaction`.
*/
combineSignMessages(signMessage: string[][]): this;
/**
* Serializes the transaction into a JSON string format.
*
* @returns A JSON representation of the transaction.
*/
toJson(): string;
/**
* Signs the transaction using the provided private key.
*
* @param privateKey - The private key used for signing.
* @param script - A custom script used for signature encoding.
* @param sigHashType - The signature hash type (optional).
* @returns The updated instance of `RawTransaction`.
*/
signScript(script: Wasm.ScriptBuilder, sigHashType?: Wasm.SighashType): this;
/**
* Serializes the transaction into a JSON string format.
*
* @returns A JSON representation of the transaction.
*/
submit(): Promise<string>;
}
export { MultiSignTransaction };
declare class Outpoint {
/**
* Creates an outpoint object for a given transaction hash and optional index.
*
* @param hash - The transaction hash of the UTXO.
* @param index - The output index of the UTXO in the transaction (defaults to 0).
* @returns An object representing the outpoint with `transactionId` and `index`.
*/
static outpoint(hash: string, index?: number): {
transactionId: string;
index: number;
};
}
export { Outpoint };
import { Wasm } from "../index";
declare class Output {
/**
* Creates an array of payment outputs for a given address and amount.
*
* @param address - The destination address for the payment.
* @param amount - The amount to be sent to the address.
* @returns An array of `IPaymentOutput` objects containing the address and amount.
*/
static createOutputs(address: string, amount: bigint): Wasm.IPaymentOutput[];
/**
* Creates a payment outputs for a given address and amount.
*
* @param address - The destination address for the payment.
* @param amount - The amount to be sent to the address.
* @returns A `IPaymentOutput` objects containing the address and amount.
*/
static new(address: string, amount: bigint): Wasm.IPaymentOutput;
}
export { Output };
import { Wasm } from "../index";
declare class PendingTransaction {
transaction: Wasm.ICreateTransactions;
constructor(transaction: Wasm.ICreateTransactions);
static createTransactions(setting: Wasm.IGeneratorSettingsObject): Promise<PendingTransaction>;
sign(privateKeys: Wasm.PrivateKey[], script?: Wasm.ScriptBuilder): this;
submit(): Promise<string | undefined>;
}
export { PendingTransaction };
import { Wasm } from "../index";
/**
* Represents a raw Kaspa transaction, providing methods for creation and signing.
*/
declare class RawTransaction {
transaction: Wasm.Transaction;
/**
* Initializes a new instance of `RawTransaction` with a given transaction object.
*
* @param transaction - The transaction object.
*/
constructor(transaction: Wasm.Transaction);
/**
* Creates a new transaction.
*
* @param entries - A list of UTXOs (Unspent Transaction Outputs) to be used as inputs.
* @param outputs - The payment outputs for the transaction.
* @param priorityFee - The transaction fee (optional).
* @param payload - Additional data to include in the transaction (optional).
* @param sigOpCount - The number of signature operations to include (optional).
* @returns A new instance of `RawTransaction`.
*/
static createTransactionWithEntries(entries: Wasm.IUtxoEntry[], outputs: Wasm.IPaymentOutput[], priorityFee: bigint, payload?: Wasm.HexString | Uint8Array, sigOpCount?: number): RawTransaction;
/**
* Creates a new transaction.
*
* @param entries - A list of UTXOs (Unspent Transaction Outputs) to be used as inputs.
* @param outputs - The payment outputs for the transaction.
* @param priorityFee - The transaction fee (optional).
* @param payload - Additional data to include in the transaction (optional).
* @param sigOpCount - The number of signature operations to include (optional).
* @returns A new instance of `RawTransaction`.
*/
static createTransaction(address: string, outputs: Wasm.IPaymentOutput[], priorityFee: bigint, payload?: Wasm.HexString | Uint8Array, sigOpCount?: number): Promise<RawTransaction>;
/**
* Signs the transaction using the provided private key.
*
* @param privateKey - The private key used for signing.
* @param script - A custom script used for signature encoding.
* @param sigHashType - The signature hash type (optional).
* @returns The updated instance of `RawTransaction`.
*/
sign(privateKey: Wasm.PrivateKey, script?: Wasm.ScriptBuilder, sigHashType?: Wasm.SighashType): this;
/**
* Serializes the transaction into a JSON string format.
*
* @returns A JSON representation of the transaction.
*/
toJson(): string;
/**
* Serializes the transaction into a JSON string format.
*
* @returns A JSON representation of the transaction.
*/
submit(): Promise<string>;
}
export { RawTransaction };
import { Wasm } from "../index";
import { PendingTransaction } from "./pendingTransaction";
import { RawTransaction } from "./rawTransaction";
import { MultiSignTransaction } from "./multiSignTransaction";
declare class Transaction {
static createTransactions(setting: Wasm.IGeneratorSettingsObject): Promise<PendingTransaction>;
/**
* creates a transaction.
*
* @param address - A list of UTXOs to be used in the transaction of the address.
* @param outputs - Payment outputs for the transaction.
* @param priorityFee - (Optional) Transaction fee.
* @param payload - (Optional) payload in the transaction.
* @param sigOpCount - (Optional) Number of signature operations to include.
* @returns A `RawTransaction` instance.
*/
static createTransaction(address: string, outputs: Wasm.IPaymentOutput[], priorityFee: bigint, payload?: Wasm.HexString | Uint8Array, sigOpCount?: number): Promise<RawTransaction>;
/**
* creates a transaction.
*
* @param entries - A list of UTXOs to be used in the transaction.
* @param outputs - Payment outputs for the transaction.
* @param priorityFee - (Optional) Transaction fee.
* @param payload - (Optional) payload in the transaction.
* @param sigOpCount - (Optional) Number of signature operations to include.
* @returns A `RawTransaction` instance.
*/
static createTransactionWithEntries(entries: Wasm.IUtxoEntry[], outputs: Wasm.IPaymentOutput[], priorityFee: bigint, payload?: Wasm.HexString | Uint8Array, sigOpCount?: number): RawTransaction;
/**
* creates a transaction.
*
* @param address - A list of UTXOs to be used in the transaction of the address.
* @param outputs - Payment outputs for the transaction.
* @param priorityFee - (Optional) Transaction fee.
* @param payload - (Optional) payload in the transaction.
* @param sigOpCount - (Optional) Number of signature operations to include.
* @returns A `RawTransaction` instance.
*/
static createMultiSignTransaction(address: string | Wasm.Address, outputs: Wasm.IPaymentOutput[], priorityFee?: bigint, payload?: Wasm.HexString | Uint8Array, sigOpCount?: number): Promise<MultiSignTransaction>;
static createMultiSignTransactionFromJson(json: string): MultiSignTransaction;
}
export { Transaction };
export * from './interface';
export * from './kasplexApiType';
import { Wasm } from "../index";
import { OP } from '../utils/enum';
export interface RpcOptions {
encoding: Wasm.Encoding;
networkId: string;
url?: string;
resolver?: Wasm.Resolver;
}
export interface Params {
[key: string]: string | number | boolean | Array<string>;
}
export interface Krc20Data {
p: 'krc-20';
op: OP;
tick?: string;
mod?: string;
name?: string;
max?: string;
lim?: string;
amt?: string;
to?: string;
dec?: string;
pre?: string;
ca?: string;
}
export interface addressList {
address: string;
amount: bigint;
}
export interface TransferList {
toAddress: string;
amount: bigint;
}
export interface PaginationParam {
next?: string;
prev?: string;
}
export interface KasplexApiResponse extends PaginationParam {
message: string;
result: [] | Record<string, any> | null;
}
export interface TokenBaseData {
ca?: string;
tick?: string;
name?: string;
max: string;
lim: string;
pre: string;
to: string;
dec: string;
mod: string;
minted: string;
burned: string;
opScoreAdd: string;
opScoreMod: string;
state: string;
hashRev: string;
mtsAdd: string;
}
export interface InfoData {
daaScore: string;
daaScoreGap: string;
feeTotal: string;
opScore: string;
opTotal: string;
tokenTotal: string;
version: string;
versionApi: string;
}
export interface TokenInfoData extends TokenBaseData {
holderTotal: string;
transferTotal: string;
mintTotal: string;
holder: {
address: string;
amount: string;
}[];
}
export interface TokenListData extends TokenBaseData {
}
export interface AddressTokenList {
tick?: string;
ca?: string;
balance: string;
locked: string;
dec: string;
opScoreMod: string;
}
export interface BalanceData {
tick: string;
balance: string;
locked: string;
dec: string;
opScoreMod: string;
}
export interface MarketInfoData {
tick?: string;
ca?: string;
from: string;
amount: string;
uTxid: string;
uAddr: string;
uAmt: string;
uScript: string;
opScoreAdd: string;
}
export interface BlackListData {
ca: string;
address: string;
opScoreAdd: string;
}
export interface OpListData {
p: "KRC-20";
op: string;
tick?: string;
ca?: string;
max?: string;
lim?: string;
pre?: string;
dec?: string;
mod?: string;
amt?: string;
name?: string;
from: string;
to: string;
opScore: string;
hashRev: string;
feeRev: string;
txAccept: string;
opAccept: string;
opError: string;
mtsAdd: string;
mtsMod: string;
checkpoint: string;
}
export interface ArchiveOpListData {
opscore: number;
addressaffc: string;
script: string;
state: string;
tickaffc: string;
txid: string;
}
export interface TxListData {
txid: string;
data: string;
}
export interface ArchiveVspcList {
chainBlock: Record<string, string | number>;
txList: TxListData[];
}
export interface OperationInfo extends OpListData {
utxo: string;
}
export interface StatusInfoResponse extends KasplexApiResponse {
result: InfoData;
}
export interface TokenListResponse extends KasplexApiResponse {
result: TokenListData[];
}
export interface TokenInfoResponse extends KasplexApiResponse {
result: TokenInfoData[];
}
export interface AddressTokenListResponse extends KasplexApiResponse {
result: AddressTokenList[];
}
export interface BalanceResponse extends KasplexApiResponse {
result: BalanceData[];
}
export interface MarketInfoResponse extends KasplexApiResponse {
result: MarketInfoData[];
}
export interface BlackListResponse extends KasplexApiResponse {
result: BlackListData[];
}
export interface OpListResponse extends KasplexApiResponse {
result: OpListData[];
}
export interface OperationInfoResponse extends KasplexApiResponse {
result: OperationInfo[];
}
export interface ArchiveOpListResponse extends KasplexApiResponse {
result: ArchiveOpListData[];
}
export interface ArchiveVspcListResponse extends KasplexApiResponse {
result: ArchiveVspcList[];
}
import { AddressVersion } from '../utils/enum';
import { Wasm } from "../index";
export declare class Address {
/**
* Convert the address to a string.
* @returns {string} The address string.
*/
static toAddress(network: Wasm.NetworkType, version: AddressVersion, payload: Uint8Array): string;
/**
* Convert the address to a string.
* @returns {string} The address string.
*/
static validate(address: string): boolean;
/**
* Encode the payload to a string.
* @returns {string} The encoded payload string.
*/
private static encodePayload;
private static decodePayload;
private static polymod;
private static checksum;
private static conv8to5;
private static conv5to8;
}
export declare const BASE_URL_TEST = "https://tn10api.kasplex.org";
export declare const BASE_URL_MAIN = "https://api.kasplex.org";
export declare const BASE_URL_KASPA: {
MAIN: string;
TEST: string;
};
export declare const U64_MAX_VALUE = 18446744073709551615n;
export declare const BASE_KAS_TO_P2SH_ADDRESS = 130000000n;
export declare const BASE_P2SH_TO_KASPA_ADDRESS = 30000000n;
export declare const DEFAULT_FEE = 100000000n;
export declare const TRANSFER_FEE = 10000n;
export declare const MIN_PUSHDATA: {
MIN_PUSHDATA1: number;
MIN_PUSHDATA2: number;
MIN_PUSHDATA4: number;
MAX_PUSHDATA1: number;
MAX_PUSHDATA2: number;
MAX_PUSHDATA4: number;
};
export declare const KASPLEX = "kasplex";
export declare const WALLET_AUTH_METHODS: {
readonly kastle: "connect";
readonly kasware: "requestAccounts";
readonly unisat: "requestAccounts";
readonly kaskeeper: "disconnect";
readonly kasperia: "requestAccounts";
};
export declare const WALLET_ID_LIST: {
Kaskeeper: string;
Kaspian: string;
kasware: string;
kastle: string;
kasperia: string;
};
export declare enum AddressPrefix {
Mainnet = "kaspa",
Testnet = "kaspatest",
Devnet = "kaspadev"
}
export declare enum OP {
Mint = "mint",
Deploy = "deploy",
Transfer = "transfer",
List = "list",
Send = "send",
Issue = "issue",
Burn = "burn",
Blacklist = "blacklist",
Chown = "chown"
}
export declare enum AddressVersion {
PubKey = 0,
PubKeyECDSA = 1,
ScriptHash = 8
}
export declare enum WalletType {
HD = 0,
PrivateKey = 1
}
/**
* A flexible HTTP request utility class supporting GET, POST, PUT, and DELETE methods.
*/
declare class HttpRequest {
private defaultHeaders;
private timeout;
/**
* Constructs an instance of HttpRequest.
* @param timeout Request timeout in milliseconds (default: 10s).
* @param headers Optional default headers for all requests.
*/
constructor(timeout?: number, headers?: HeadersInit);
/**
* Sends an HTTP request with the specified method and parameters.
* @param method HTTP method (GET, POST, PUT, DELETE).
* @param url Full API URL.
* @param params Optional query parameters.
* @param body Optional request body (for POST, PUT).
* @param headers Optional headers to override defaults.
* @returns A Promise resolving to the response data.
*/
private request;
/** Performs a GET request. */
get<T>(url: string, params?: Record<string, string>, headers?: HeadersInit): Promise<T>;
/** Performs a POST request. */
post<T>(url: string, body: any, params?: Record<string, string>, headers?: HeadersInit): Promise<T>;
}
declare let httpClient: HttpRequest;
export { httpClient, HttpRequest };
import * as Enum from './enum';
import * as Utils from './utils';
export { Enum, Utils };
import { Wasm } from "../index";
import { Krc20Data } from '../types/interface';
import { OP } from "./enum";
import { AddressPrefix } from './enum';
/**
* Converts a NetworkType to its corresponding network ID string.
* @param networkType The network type to convert.
* @returns The corresponding network ID string.
*/
declare function networkToString(networkType: Wasm.NetworkType): string;
/**
* Converts a hexadecimal string to a Uint8Array.
* @param {string} hexString - The hexadecimal string to convert.
* @returns {Uint8Array} - The resulting Uint8Array representation of the hexadecimal string.
* @throws {Error} - Throws an error if the hex string is invalid, has an odd length, or contains invalid characters.
*/
declare function hexStringToUint8Array(hexString: string): Uint8Array;
/**
* Determines the appropriate opcode for pushing data based on its size.
* @param {number} size - The size of the data to be pushed.
* @returns {string | void} - The corresponding opcode as a string, or calls `reportError` for invalid size.
* @throws {Error} - If the provided size is invalid based on the defined size limits.
*/
declare function getPushData(size: number): void | Wasm.Opcodes.OpPushData1 | Wasm.Opcodes.OpPushData2 | Wasm.Opcodes.OpPushData4;
declare function createKrc20Data(data: Krc20Data): {
p: "krc-20";
op: OP;
tick?: string;
mod?: string;
name?: string;
max?: string;
lim?: string;
amt?: string;
to?: string;
dec?: string;
pre?: string;
ca?: string;
};
declare function getScriptLockTime(oneHourInSeconds?: number): bigint;
declare function getSizeByPrivateKeys(multiplier: number, addend: number, ecdsa?: boolean): number;
declare function getFeeByOp(op: OP): bigint;
declare function addressPrefixToNetwork(network: AddressPrefix): Wasm.NetworkType;
/**
* Converts a string to an AddressPrefix enum value.
* @param {string} prefix - The string representation of the address prefix.
* @returns {AddressPrefix | undefined} The corresponding enum value, or undefined if not found.
*/
declare function stringToAddressPrefix(prefix: string): AddressPrefix | undefined;
declare function networkToAddressPrefix(network: Wasm.NetworkType): AddressPrefix;
export { networkToString, hexStringToUint8Array, getPushData, createKrc20Data, getScriptLockTime, getSizeByPrivateKeys, getFeeByOp, addressPrefixToNetwork, stringToAddressPrefix, networkToAddressPrefix, };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

{
"name": "kaspa-wasm",
"type": "module",
"collaborators": [
"Kaspa developers"
],
"description": "KASPA WASM bindings",
"version": "1.1.0-rc.2",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/kaspanet/rusty-kaspa"
},
"files": [
"kaspa_bg.wasm",
"kaspa.js",
"kaspa.d.ts"
],
"main": "kaspa.js",
"types": "kaspa.d.ts",
"sideEffects": [
"./snippets/*"
]
}
+1
-1
{
"name": "@kasplex/kiwi-web",
"version": "1.0.18",
"version": "1.0.19",
"type": "module",

@@ -5,0 +5,0 @@ "sideEffects": false,