import type { Wallet } from "../wallet"; import { CChain } from "./cchain"; import { NetworkBased } from "./core"; import { PChain } from "./pchain"; import type { AfterTxConfirmationCallback, AfterTxSubmissionCallback, BeforeTxSignatureCallback, BeforeTxSubmissionCallback } from "./callback"; import { Constants } from "./constants"; import type { Balance, FdcAttestation, FdcAttestationRequest, FdcSourceNetwork, FoundationProposalInfo, FoundationProposalSupport, FtsoDelegate, FtsoRewardClaimWithProof, FtsoRewardState, RNatAccountBalance, RNatProject, RNatProjectAndClaimableReward, RNatProjectInfo, SafeSmartAccount, Stake, StakeLimits } from "./iotype"; import type { FlareContract } from "./contract"; /** * The main class used for interaction with the Flare network. */ export declare class Network extends NetworkBased { /** * Network constructor. * @param constants Network constants of class {@link Constants}. */ constructor(constants: Constants); /** * The main Flare network. */ static readonly FLARE: Network; /** * The canary Flare network. */ static readonly SONGBIRD: Network; /** * The test Flare network. */ static readonly COSTON2: Network; /** * The test canary Flare network. */ static readonly COSTON: Network; protected _cchain: CChain; protected _pchain: PChain; /** * Derives the C-chain address from the given public key. * @param publicKey A public key in hexadecimal encoding. * @returns The C-chain address in checksummed hexadecimal encoding. */ getCAddress(publicKey: string): string; /** * Derives the P-chain address from the given public key. * @param publicKey A public key in hexadecimal encoding. * @returns The P-chain address in bech32 encoding. */ getPAddress(publicKey: string): string; /** * Returns balance information related the given public key. * @param publicKey A public key in hexadecimal encoding. * @returns The object of type {@link Balance}. */ getBalance(publicKey: string): Promise; /** * Returns balance on the C-chain. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The balance in wei corresponding to the public key or address. */ getBalanceOnC(publicKeyOrAddress: string): Promise; /** * Returns balance wrapped on the C-chain. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The balance in wei corresponding to the public key or address. */ getBalanceWrappedOnC(publicKeyOrAddress: string): Promise; /** * Returns rNat account address. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The C-chain address in hexadecimal encoding of the rNat account associated * with the public key or address. */ getRNatAccount(publicKeyOrAddress: string): Promise; /** * Returns balance of the rNat account. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The object of type {@link RNatAccountBalance} containing the balance * information about the rNat account associated with the public key or address. */ getRNatAccountBalance(publicKeyOrAddress: string): Promise; /** * Returns balance of unlocked wrapped tokens on an rNat account. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The balance in wei of the rNat account associated with the public key or address. */ getUnlockedBalanceWrappedOnRNatAccount(publicKeyOrAddress: string): Promise; /** * Returns balance of locked wrapped tokens on an rNat account. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The balance in wei of the rNat account associated with the public key or address. */ getLockedBalanceWrappedOnRNatAccount(publicKeyOrAddress: string): Promise; /** * Returns balance on the P-chain. * @param publicKeyOrAddress A public key in hexadecimal encoding or a P-chain address in bech32 encoding. * @returns The balance in wei corresponding to the public key or address. */ getBalanceOnP(publicKeyOrAddress: string): Promise; /** * Returns balance not imported to the C-chain. * @param publicKeyOrAddress A public key in hexadecimal encoding or a P-chain address in bech32 encoding. * @returns The balance in wei corresponding to the public key or address. */ getBalanceNotImportedToC(publicKeyOrAddress: string): Promise; /** * Returns balance not imported to the P-chain. * @param publicKeyOrAddress A public key in hexadecimal encoding or a P-chain address in bech32 encoding. * @returns The balance in wei corresponding to the public key or address. */ getBalanceNotImportedToP(publicKeyOrAddress: string): Promise; /** * Returns balance staked on the P-chain. * @param publicKeyOrAddress A public key in hexadecimal encoding or a P-chain address in bech32 encoding. * @returns The balance in wei corresponding to the public key or address. */ getBalanceStakedOnP(publicKeyOrAddress: string): Promise; /** * Returns information about stakes on the P-chain. * @param publicKeyOrAddress A public key in hexadecimal encoding or a P-chain address in bech32 encoding (optional). * @returns The array of stakes on the P-chain * (corresponding to the given public key or address if given). */ getStakesOnP(publicKeyOrAddress?: string): Promise>; /** * Returns information about validators on the P-chain. * @returns The array of stakes on the P-chain corresponding to validators. */ getValidatorsOnP(): Promise>; /** * Returns information about stakes on the P-chain corresponding to a specific validator. * @param nodeId The code of a validator's node. * @returns The array of stakes on the P-chain (corresponding to the given node if given). */ getValidatorStakesOnP(nodeId: string): Promise>; /** * Returns information about stake limits on the P-chain * @returns An object of type {@link StakeLimits} */ getStakeLimits(): Promise; /** * Returns the amount of claimable reward from staking. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The reward in wei corresponding to the public key or address. */ getClaimableStakingReward(publicKeyOrAddress: string): Promise; /** * Returns the amount of claimable reward from FTSO delegation. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The reward in wei corresponding to the public key or address. */ getClaimableFtsoReward(publicKeyOrAddress: string): Promise; /** * Returns the state of rewards from FTSO delegation. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The array of reward states for all unclaimed reward epochs with claimable rewards * corresponding to the public key or address. */ getStateOfFtsoRewards(publicKeyOrAddress: string): Promise>>; /** * Returns FTSO delegates on the C-chain. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The array of objects of type {@link FtsoDelegate} that contains information * about the FTSO delegates and shares that the address specified by `publicKeyOrAddress` * currently delegates to. */ getFtsoDelegatesOf(publicKeyOrAddress: string): Promise>; /** * Returns rNat projects. * @returns The array of objects of type {@link RNatProject} that contains basic information * about the rNat projects. */ getRNatProjects(): Promise>; /** * Returns rNat projects together with the claimable rNat reward for each project. * All values are read atomically in a single call against the same block. * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The array of objects of type {@link RNatProjectAndClaimableReward} that contains basic * information about the rNat projects and the reward in wei claimable by the address specified * by `publicKeyOrAddress`. */ getRNatProjectsAndClaimableRewards(publicKeyOrAddress: string): Promise>; /** * Returns rNat project information. * @param projectId A project id number. * @returns The object of type {@link RNatProjectInfo} that contains detailed information * about the rNat project with the given project id. */ getRNatProjectInfo(projectId: number): Promise; /** * Returns the amount of claimable rNat reward for the given project and owner. * @param projectId A project id number * @param publicKeyOrAddress A public key or a C-chain address in hexadecimal encoding. * @returns The reward in wei corresponding to the project and public key or address. */ getClaimableRNatReward(projectId: number, publicKeyOrAddress: string): Promise; /** * Transfers wallet funds to a given recipient on the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param recipient A C-chain address of the transfer recipient. * @param amount An amount in wei to be transferred on the C-chain. */ transferNative(wallet: Wallet, recipient: string, amount: bigint): Promise; /** * Attempts to transfer all wallet funds to a given recipient on the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param recipient A C-chain address of the transfer recipient. * @remark As fees on the C-chain are subjected to change, a certain amount of dust may be left on * the account after the transaction is executed. */ transferAllNative(wallet: Wallet, recipient: string): Promise; /** * Wraps wallet funds on the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param amount An amount in wei to be wrapped on the C-chain. */ wrapNative(wallet: Wallet, amount: bigint): Promise; /** * Unwraps wallet funds on the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param amount An amount in wei to be unwrapped on the C-chain. * If the amount is not given, all wrapped funds are unwrapped. */ unwrapToNative(wallet: Wallet, amount?: bigint): Promise; /** * Transfers wrapped wallet funds to a given recipient on the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param recipient A C-chain address of the transfer recipient. * @param amount An amount in wei to be transferred on the C-chain. */ transferWrapped(wallet: Wallet, recipient: string, amount: bigint): Promise; /** * Claims or wraps entire claimable reward from staking. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param rewardOwner A C-chain address of the reward owner (optional, equal to the wallet's C-chain address by default). * @param recipient A C-chain address of the reward recipient (optional, equal to the wallet's C-chain address by default). * @param wrap A boolean indicating if the claimable amount is to be wrapped (optional, false by default). * @remarks If the wallet's C-chain address is different from the `rewardOwner`, it must be approved by the reward owner. */ claimStakingReward(wallet: Wallet, rewardOwner?: string, recipient?: string, wrap?: boolean): Promise; /** * Claims or wraps entire claimable reward from FTSO delegation. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param rewardOwner A C-chain address of the reward owner (optional, equal to the wallet's C-chain address by default). * @param recipient A C-chain address of the reward recipient (optional, equal to the wallet's C-chain address by default). * @param wrap A boolean indicating if the claimable amount is to be wrapped (optional, false by default). * @param proofs An array of objects of type {@link FtsoRewardClaimWithProof} specifying the claims with Merkle proofs (optional). * @remarks If the wallet's C-chain address is different from the `rewardOwner`, it must be approved by the reward owner. */ claimFtsoReward(wallet: Wallet, rewardOwner?: string, recipient?: string, wrap?: boolean, proofs?: Array): Promise; /** * Claims entire claimable reward from rNat projects to the rNat account corresponding to the * wallet's C-chain address. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param projectIds An array of project ids to claim for. */ claimRNatReward(wallet: Wallet, projectIds: Array): Promise; /** * Withdraws unlocked wrapped funds from an rNat account to its owner. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param amount An amount in wei to be withdrawn from the rNat account associated with the wallet's C-chain address * (optional, entire unlocked wrapped rNat account balance by default). * @param wrap A boolean indicating if the withdrawn amount is to be wrapped (optional, false by default). */ withdrawFromRNatAccount(wallet: Wallet, amount?: bigint, wrap?: boolean): Promise; /** * Withdraws unlocked and locked wrapped funds from an rNat account to its owner. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param wrap A boolean indicating if the withdrawn amount is to be wrapped (optional, false by default). * @remarks If some tokens are still locked, only 50% of them will be withdrawn, the rest will be burned as a penalty. */ withdrawAllFromRNatAccount(wallet: Wallet, wrap?: boolean): Promise; /** * Returns the information about an existing Safe smart account. * @param address A C-chain address representing the smart account. * @returns An object of type {@link SafeSmartAccount}. */ getSafeSmartAccount(address: string): Promise; /** * Creates a new Safe smart account and returns its address * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param owners An array of C-chain addresses representing the owners of the smart account. * @param threshold An integer representing the threshold of the smart account. * @returns A string representing the C-chain address of the smart account. */ createSafeSmartAccount(wallet: Wallet, owners: Array, threshold: bigint): Promise; /** * Gets a list of foundation proposal ids. * @returns The array of integers representing the ids of the proposals. */ getFoundationProposalIds(): Promise>; /** * Gets information about a specific foundation proposal. * @param proposalId An id of proposal. * @returns The object of type {@link FoundationProposalInfo} containing information about * the proposal with the given id. */ getFoundationProposalInfo(proposalId: bigint): Promise; /** * Gets the governance vote power of a voter's vote for a given foundation proposal. * @param publicKeyOrAddress A public key or a C-chain address of the voter in hexadecimal encoding. * @param proposalId An integer representing the id of a foundation proposal. * @returns The integer representing the vote power. */ getVotePowerForFoundationProposal(publicKeyOrAddress: string, proposalId: bigint): Promise; /** * Gets the delegate of a voter for a given foundation proposal, i.e., the address to which the voter's * governance vote power has been delegated at the vote power block of the foundation proposal. * @param publicKeyOrAddress A public key or a C-chain address of the voter in hexadecimal encoding. * @param proposalId An integer representing the id of a foundation proposal. * @returns A string representing the C-chain address of the delegate (zero address indicates no delegate). */ getVoteDelegateForFoundationProposal(publicKeyOrAddress: string, proposalId: bigint): Promise; /** * Gets the current governance vote power of a voter's vote. * @param publicKeyOrAddress A public key or a C-chain address of the voter in hexadecimal encoding. * @returns The integer representing the vote power. */ getCurrentGovernanceVotePower(publicKeyOrAddress: string): Promise; /** * Gets the current delegate of a voter, i.e., the address to which the voter's governance vote power * is currently delegated. * @param publicKeyOrAddress A public key or a C-chain address of the voter in hexadecimal encoding. * @returns A string representing the C-chain address of the delegate (zero address indicates no delegate). */ getCurrentGovernanceVoteDelegate(publicKeyOrAddress: string): Promise; /** * Returns a boolean indicating if a voter has cast vote for a given foundation proposal. * @param publicKeyOrAddress A public key or a C-chain address of the voter in hexadecimal encoding. * @param proposalId An integer representing the id of a foundation proposal. * @returns The boolean indicating if a voter has cast a vote. */ hasCastVoteForFoundationProposal(publicKeyOrAddress: string, proposalId: bigint): Promise; /** * Casts a vote for a foundation proposal. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param proposalId An integer representing the id of the foundation proposal. * @param support A value of enum {@link FoundationProposalSupport} representing the support. */ castVoteForFoundationProposal(wallet: Wallet, proposalId: bigint, support: FoundationProposalSupport): Promise; /** * Delegates governance vote power to the provided delegate. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param delegate A C-chain address of the delegate in hexadecimal notation. */ delegateGovernanceVotePower(wallet: Wallet, delegate: string): Promise; /** * Undelegates governance vote power. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. */ undelegateGovernanceVotePower(wallet: Wallet): Promise; /** * Submits Flare Data Connector (FDC) attestation request for EVM transaction. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param source An instance of the enum {@link FdcSourceNetwork} that determines the source network (ETH, FLR, or SGB) of the EVM transaction to attest. * @param transactionId Hash of the EVM transaction to attest. * @returns The instance of type {@link FdcAttestationRequest} that specifies the attestation request data. */ submitFdcAttestationRequestForEvmTransaction(wallet: Wallet, source: FdcSourceNetwork, transactionId: string): Promise; /** * Submits Flare Data Connector (FDC) attestation request for payment transaction. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param source An instance of the enum {@link FdcSourceNetwork} that determines the source network (BTC, DOGE, or XRP) of the payment transaction to attest. * @param transactionId Id of the payment transaction to attest. * @param senderUtxo Input index or address specifying the sender of the UTXO based payment transaction (optional, equal to 0 by default, relevant for BTC and DOGE) * @param recipientUtxo Output index or address specifying the recipient of the UTXO based payment transaction (optional, equal to 0 by default, relevant for BTC and DOGE) * @returns The instance of type {@link FdcAttestationRequest} that specifies the attestation request data. */ submitFdcAttestationRequestForPayment(wallet: Wallet, source: FdcSourceNetwork, transactionId: string, senderUtxo?: number | string, recipientUtxo?: number | string): Promise; /** * Submits Flare Data Connector (FDC) attestation request for the validity of an address. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param source An instance of the enum {@link FdcSourceNetwork} that determines the source network (BTC, DOGE, or XRP) of the address to attest. * @param address Address to attest. * @returns The instance of type {@link FdcAttestationRequest} that specifies the attestation request data. */ submitFdcAttestationRequestForAddressValidity(wallet: Wallet, source: FdcSourceNetwork, address: string): Promise; /** * Submits Flare Data Connector (FDC) attestation request for Web2 Json API data. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param url URL of the data source. * @param httpMethod HTTP method to be used to fetch from URL source (GET, POST, PUT, PATCH, DELETE). * @param headers Headers to be included to fetch from URL source. Use '{}' if no headers are needed. * @param queryParams Query parameters to be included to fetch from URL source. Use '{}' if no query parameters are needed. * @param body Request body to be included to fetch from URL source. Use '{}' if no request body is required. * @param postProcessJq jq filter used to post-process the JSON response from the URL. * @param abiSignature ABI signature of the struct used to encode the data after jq post-processing. * @returns The instance of type {@link FdcAttestationRequest} that specifies the attestation request data. * @remarks The request parameters are submitted to the network as public data. They should not * contain secrets, such as API keys in `headers`. */ submitFdcAttestationRequestForWeb2Json(wallet: Wallet, url: string, httpMethod: string, headers: string, queryParams: string, body: string, postProcessJq: string, abiSignature: string): Promise; /** * Determines if the Flare Data Connector (FDC) voting round is finalized. * @param votingRoundId A number that specifies the voting round id. * @returns The boolean indicating if the voting round is finalized. * @remarks An error is thrown if `votingRoundId` is null, i.e., the attestation request was not submitted. */ isFdcVotingRoundFinalized(votingRoundId: number | null): Promise; /** * Returns the Flare Data Connector (FDC) attestation. * @param request An instance of type {@link FdcAttestationRequest} specifying the submitted attestation request. * @returns The instance of type {@link FdcAttestation} specifying the attestation. */ getFdcAttestation(request: FdcAttestationRequest): Promise; /** * Verifies the Flare Data Connector (FDC) attestation. * @param attestation An instance of type {@link FdcAttestation} specifiyng the attestation. * @returns The boolean indicating if the attestation data (response) matches the attestation proof. */ verifyFdcAttestation(attestation: FdcAttestation): Promise; /** * Gets a list of all official Flare network contracts. * @returns The array of type {@link FlareContract}. */ getFlareContracts(): Promise>; /** * Invokes a method call on a specified EVM contract. * @param contract Contract address or a Flare network name. * @param abi Application binary interface corresponding to contract or method. * @param method Name of the method. * @param params Parameters of the method. * @returns The result of the call. */ invokeContractCallOnC(contract: string, abi: string, method: string, ...params: any[]): Promise; /** * Invokes a method transaction on a specified EVM contract. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param contract Contract address or a Flare network name. * @param abi Application binary interface corresponding to contract or method. * @param method Name of the method. * @param value Native coin value in wei to send in the transaction (optional, 0 by default). * @param params Parameters of the method. */ invokeContractMethodOnC(wallet: Wallet, contract: string, abi: string, method: string, value: bigint, ...params: any[]): Promise; /** * Transfers wallet funds from the C-chain to the P-chain. * @remarks The transfer generally requires two transactions: * export from the C-chain and import to the P-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param amount An amount in wei to be transferred to the P-chain. * @param allocatedFeeOnP An amount in wei specifying the allocated fee for import to the P-chain. * If the amount is not provided, the default fee allocation value is used. */ transferToP(wallet: Wallet, amount: bigint, allocatedFeeOnP?: bigint): Promise; private _transferToP; /** * Transfers wallet funds from the P-chain to the C-chain. * @remarks The transfer generally requires two transactions: * export from the P-chain and import to the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param amount An amount in wei to be transferred to the C-chain. * Note that this amount is reduced by the C-chain transaction fee. * If the amount is not given, all available balance on the P-chain is transferred. */ transferToC(wallet: Wallet, amount?: bigint): Promise; /** * Exports wallet funds from the C-chain address. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param amount An amount in wei to be exported. * @param baseFee A base C-chain transaction fee in wei to be used for transaction (optional). */ exportFromC(wallet: Wallet, amount: bigint, baseFee?: bigint): Promise; /** * Imports all unimported wallet funds to the C-chain address. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param baseFee A base C-chain transaction fee in wei to be used for transaction (optional). */ importToC(wallet: Wallet, baseFee?: bigint): Promise; /** * Transfers wallet funds on the P-chain from one address to another. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param recipient The P-chain address of the recipient in bech32 encoding. * @param amount An amount in wei to be transferred. * If amount is not provided, the entire P-chain balance of the wallet is transferred. */ transferOnP(wallet: Wallet, recipient: string, amount?: bigint): Promise; /** * Exports wallet funds from the P-chain address. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param amount An amount in wei to be exported. */ exportFromP(wallet: Wallet, amount: bigint): Promise; /** * Imports all unimported wallet funds to the P-chain address. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. */ importToP(wallet: Wallet): Promise; /** * Delegates wallet funds on the P-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param amount The amount in wei to be delegated. * @param nodeId The code of the validator's node to delegate to. * @param startTime The seconds from the Unix epoch marking the start of the delegation. * If the value is not provided, it is set to the current time plus 5 minutes. * @param endTime The seconds from the Unix epoch marking the end of the delegation. * If the value is not provided, it is set to be equal to the validator's end time. * @param allocatedFeeOnP An amount in wei specifying the allocated fee for import to and delegate on * the P-chain. If the amount is not provided, the default fee allocation value is used. */ delegateOnP(wallet: Wallet, amount: bigint, nodeId: string, startTime?: bigint, endTime?: bigint, allocatedFeeOnP?: bigint): Promise; /** * Adds validator on the P-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getPublicKey`, and * - the function `signPTransaction`, `signDigest` or `signEthMessage`. * @param amount The amount in wei to be staked. * @param nodeId The code of the validator's node. * @param startTime The seconds from the Unix epoch marking the start of the validation. * @param endTime The seconds from the Unix epoch marking the end of the validation. * @param delegationFee The percentage in base points that corresponds to the fee the validator charges * to delegators. * @param popBLSPublicKey The public key in hexadecimal notation for the proof of possesion of the BLS key. * @param popBLSSignature The signature in hexadecimal notation for the proof of possesion of the BLS key. */ addValidatorOnP(wallet: Wallet, amount: bigint, nodeId: string, startTime: bigint, endTime: bigint, delegationFee: bigint, popBLSPublicKey: string, popBLSSignature: string): Promise; /** * Delegates vote power to FTSO providers on the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. * @param delegate1 A C-chain address representing the first FTSO delegate. * @param shareBP1 A share of vote power in base points to delegate to the first delegate. * @param delegate2 A C-chain address representing the second FTSO delegate (optional). * @param shareBP2 A share of vote power in base points to delegate to the second delegate (optional). * @remark The shares are specified in units between 1 and 10000 with a unit representing 0.01%. * The sum of `shareBP1` and `shareBP2` should not be larger than 10000. * The transaction invoked by this call undelegates all previous delegations. */ delegateToFtso(wallet: Wallet, delegate1: string, shareBP1: bigint, delegate2?: string, shareBP2?: bigint): Promise; /** * Undelegates vote power from FTSO providers on the C-chain. * @param wallet An instance of the class implementing the interface {@link Wallet} that contains: * - the function `getCAddress` or `getPublicKey`, and * - the function `signCTransaction`, `signAndSubmitCTransaction` or `signDigest`. */ undelegateFromFtso(wallet: Wallet): Promise; /** * Returns the number of the current block on the C-chain. * @returns Block number. */ getCurrentBlockOnC(): Promise; /** * Returns the current base fee rate on the C-chain. * @returns The base fee rate in wei per unit of transaction size. */ getBaseTxFeeOnC(): Promise; /** * Returns the current base fee rate on the P-chain. * @returns The base fee rate in wei per unit of transaction size. */ getBaseTxFeeOnP(): Promise; /** * Returns the fee amount reserved by default to cover a P-chain transaction. * @returns The allocated fee in wei. */ getDefaultAllocatedFeeOnP(): Promise; /** * Returns the network identifier (human-readable part). * @returns The string identifier. */ getHrp(): string; /** * Sets the node's RPC address used for connecting to the blockchains. * @param rpc RPC address. */ setRpc(rpc: string): void; /** * Sets the callback that is invoked before each transaction signature request. * @param callback The callback function of type {@link BeforeTxSignatureCallback}. * Use `null` to remove the callback. */ setBeforeTxSignatureCallback(callback: BeforeTxSignatureCallback): void; /** * Sets the callback that is invoked before each transaction submission to the network. * @param callback The callback function of type {@link BeforeTxSubmissionCallback}. * Use `null` to remove the callback. */ setBeforeTxSubmissionCallback(callback: BeforeTxSubmissionCallback): void; /** * Sets the callback that is invoked after each transaction submission to the network. * @param callback The callback function of type {@link AfterTxSubmissionCallback}. * Use `null` to remove the callback. */ setAfterTxSubmissionCallback(callback: AfterTxSubmissionCallback): void; /** * Sets the callback that is invoked after each transaction confirmation to the network. * @param callback The callback function of type {@link AfterTxConfirmationCallback}. * Use `null` to remove the callback. */ setAfterTxConfirmationCallback(callback: AfterTxConfirmationCallback): void; private _getCAddress; private _getAccount; private _isBigInt; private _shouldBeBigInt; private _isBoolean; private _shouldBeCAddress; private _shouldBeGweiInteger; private _shouldBePositiveInteger; private _shouldBeNonnegativeInteger; } //# sourceMappingURL=network.d.ts.map