UNPKG

@goequitize/rwa-token-sdk

Version:

SDK for creating and managing RWA token transactions with compliance features

185 lines (184 loc) 4.03 kB
/** * SDK configuration options */ export interface SDKConfig { /** * The JSON-RPC URL for connecting to the blockchain */ rpcUrl: string; /** * The chain ID of the network to connect to */ chainId: number; /** * Optional API key for blockchain services */ apiKey?: string; } /** * Represents an unsigned transaction */ export interface UnsignedTransaction { /** * The address of the contract to interact with */ to: string; /** * The data field of the transaction containing the encoded function call */ data: string; /** * The amount of native currency to send with the transaction */ value?: string; /** * The gas limit for the transaction (optional, can be estimated by wallet) */ gasLimit?: string; /** * The maximum fee per gas the user is willing to pay (EIP-1559) */ maxFeePerGas?: string; /** * The maximum priority fee per gas the user is willing to pay (EIP-1559) */ maxPriorityFeePerGas?: string; } /** * Common parameters for token operations */ export interface TokenOperationParams { /** * The address of the token contract */ contractAddress: string; } /** * Parameters for minting tokens */ export interface MintParams extends TokenOperationParams { /** * The address to receive the minted tokens */ recipient: string; /** * The amount of tokens to mint, in the smallest unit (e.g., wei for ETH) */ amount: string; } /** * Parameters for burning tokens */ export interface BurnParams extends TokenOperationParams { /** * The amount of tokens to burn, in the smallest unit (e.g., wei for ETH) */ amount: string; } /** * Represents gas price information */ export interface GasInfo { /** * Current market gas prices */ market: { /** * Base gas price in gwei */ gasPrice: string; /** * Maximum fee per gas for EIP-1559 transactions in gwei */ maxFeePerGas: string; /** * Maximum priority fee per gas for EIP-1559 transactions in gwei */ maxPriorityFeePerGas: string; }; /** * Recommended gas prices (market prices with a markup) */ recommended: { /** * Recommended base gas price in gwei */ gasPrice: string; /** * Recommended maximum fee per gas for EIP-1559 transactions in gwei */ maxFeePerGas: string; /** * Recommended maximum priority fee per gas for EIP-1559 transactions in gwei */ maxPriorityFeePerGas: string; }; } /** * Response from a broadcast transaction */ export interface TransactionResponse { /** * The transaction hash */ hash: string; /** * A URL to view the transaction on a block explorer */ explorerURL?: string; } /** * Token information */ export interface TokenInfo { /** * The token symbol (e.g., "ETH", "USDC") */ symbol: string; /** * The number of decimals the token uses */ decimals: number; /** * The token name */ name: string; /** * The token contract address */ address: string; } /** * Transaction build result */ export interface TxBuildResult { /** * Whether there was an error building the transaction */ isError: boolean; /** * Error message if isError is true */ errorMsg?: string; /** * Transaction data if isError is false */ data?: { /** * The raw transaction object */ rawTx: UnsignedTransaction; /** * Estimated gas cost in native currency */ gasCost: string; /** * Gas price in gwei */ gasPrice: string; /** * Gas limit for the transaction */ gasLimit: string; }; }