///
import BigNumber from '../../dependencies/src/bignumber.js-9.0.0/bignumber';
import { IAirGapSignedTransaction } from '../../interfaces/IAirGapSignedTransaction';
import { AirGapTransactionStatus, IAirGapTransaction } from '../../interfaces/IAirGapTransaction';
import { SignedTezosTransaction } from '../../serializer/schemas/definitions/signed-transaction-tezos';
import { UnsignedTezosTransaction } from '../../serializer/schemas/definitions/unsigned-transaction-tezos';
import { RawTezosTransaction } from '../../serializer/types';
import { ProtocolSymbols } from '../../utils/ProtocolSymbols';
import { DelegateeDetails, DelegationDetails, DelegatorDetails, ICoinDelegateProtocol } from '../ICoinDelegateProtocol';
import { CurrencyUnit, FeeDefaults } from '../ICoinProtocol';
import { ICoinSubProtocol } from '../ICoinSubProtocol';
import { NonExtendedProtocol } from '../NonExtendedProtocol';
import { TezosAddress } from './TezosAddress';
import { TezosCryptoClient } from './TezosCryptoClient';
import { TezosProtocolOptions } from './TezosProtocolOptions';
import { TezosRevealOperation } from './types/operations/Reveal';
import { TezosOperation } from './types/operations/TezosOperation';
import { TezosTransactionOperation } from './types/operations/Transaction';
import { TezosTransactionCursor } from './types/TezosTransactionCursor';
import { TezosTransactionResult } from './types/TezosTransactionResult';
import { TezosWrappedOperation } from './types/TezosWrappedOperation';
export interface TezosVotingInfo {
pkh: string;
rolls: number;
}
export interface BakerInfo {
balance: BigNumber;
delegatedBalance: BigNumber;
stakingBalance: BigNumber;
selfBond: BigNumber;
bakerCapacity: BigNumber;
bakerUsage: BigNumber;
}
export interface DelegationRewardInfo {
cycle: number;
reward: BigNumber;
deposit: BigNumber;
delegatedBalance: BigNumber;
stakingBalance: BigNumber;
totalRewards: BigNumber;
totalFees: BigNumber;
payout: Date;
}
export interface DelegationInfo {
isDelegated: boolean;
value?: string;
delegatedOpLevel?: number;
delegatedDate?: Date;
}
export declare enum TezosDelegatorAction {
DELEGATE = "delegate",
UNDELEGATE = "undelegate",
CHANGE_BAKER = "change_baker"
}
export interface TezosPayoutInfo {
delegator: string;
share: string;
payout: string;
balance: string;
}
export interface RunOperationBalanceUpdate {
kind: string;
contract: string;
change: string;
category: string;
delegate: string;
cycle?: number;
}
export interface RunOperationOperationBalanceUpdate {
kind: string;
contract: string;
change: string;
}
export interface RunOperationOperationResult {
status: string;
errors?: unknown;
balance_updates: RunOperationOperationBalanceUpdate[];
consumed_gas: string;
paid_storage_size_diff?: string;
originated_contracts?: string[];
allocated_destination_contract?: boolean;
}
interface RunOperationInternalOperationResult {
result?: {
errors?: unknown;
consumed_gas: string;
paid_storage_size_diff?: string;
originated_contracts?: string[];
allocated_destination_contract?: boolean;
};
parameters?: {
entrypoint: string;
value: unknown;
};
}
export interface RunOperationMetadata {
balance_updates: RunOperationBalanceUpdate[];
operation_result: RunOperationOperationResult;
internal_operation_results?: RunOperationInternalOperationResult[];
}
export declare enum TezosNetwork {
MAINNET = "mainnet",
EDONET = "edonet",
FLORENCENET = "florencenet",
GRANADANET = "granadanet",
HANGZHOUNET = "hangzhounet"
}
export declare class TezosProtocol extends NonExtendedProtocol implements ICoinDelegateProtocol {
readonly options: TezosProtocolOptions;
symbol: string;
name: string;
marketSymbol: string;
feeSymbol: string;
decimals: number;
feeDecimals: number;
identifier: ProtocolSymbols;
get subProtocols(): ICoinSubProtocol[];
feeDefaults: FeeDefaults;
units: CurrencyUnit[];
supportsHD: boolean;
standardDerivationPath: string;
addressIsCaseSensitive: boolean;
addressValidationPattern: string;
addressPlaceholder: string;
minCycleDuration: number;
protected readonly transactionFee: BigNumber;
protected readonly originationSize: BigNumber;
protected readonly storageCostPerByte: BigNumber;
protected readonly revealFee: BigNumber;
protected readonly activationBurn: BigNumber;
protected readonly originationBurn: BigNumber;
readonly cryptoClient: TezosCryptoClient;
get jsonRPCAPI(): string;
get baseApiUrl(): string;
get baseApiNetwork(): string;
readonly headers: {
'Content-Type': string;
apiKey: string;
};
constructor(options?: TezosProtocolOptions);
getBlockExplorerLinkForAddress(address: string): Promise;
getBlockExplorerLinkForTxId(txId: string): Promise;
getPublicKeyFromMnemonic(mnemonic: string, derivationPath: string, password?: string): Promise;
getPrivateKeyFromMnemonic(mnemonic: string, derivationPath: string, password?: string): Promise;
/**
* Returns the PublicKey as String, derived from a supplied hex-string
* @param secret HEX-Secret from BIP39
* @param derivationPath DerivationPath for Key
*/
getPublicKeyFromHexSecret(secret: string, derivationPath: string): Promise;
/**
* Returns the PrivateKey as Buffer, derived from a supplied hex-string
* @param secret HEX-Secret from BIP39
* @param derivationPath DerivationPath for Key
*/
getPrivateKeyFromHexSecret(secret: string, derivationPath: string): Promise;
getAddressFromPublicKey(publicKey: string): Promise;
getAddressesFromPublicKey(publicKey: string): Promise;
getNextAddressFromPublicKey(publicKey: string, current: TezosAddress): Promise;
getTransactionsFromPublicKey(publicKey: string, limit: number, cursor?: TezosTransactionCursor): Promise;
getTransactionsFromAddresses(addresses: string[], limit: number, cursor?: TezosTransactionCursor): Promise;
signWithPrivateKey(privateKey: Buffer, transaction: RawTezosTransaction): Promise;
getTransactionDetails(unsignedTx: UnsignedTezosTransaction): Promise;
getTransactionDetailsFromSigned(signedTx: SignedTezosTransaction): Promise;
getAirGapTxFromWrappedOperations(wrappedOperations: TezosWrappedOperation): Promise;
getBalanceOfAddresses(addresses: string[], _data?: any): Promise;
getBalanceOfPublicKey(publicKey: string, data?: any): Promise;
getBalanceOfPublicKeyForSubProtocols(publicKey: string, subProtocols: ICoinSubProtocol[]): Promise;
getAvailableBalanceOfAddresses(addresses: string[], data?: any): Promise;
estimateMaxTransactionValueFromPublicKey(publicKey: string, recipients: string[], fee?: string): Promise;
private estimateMaxTansactionValueWithBalance;
estimateFeeDefaultsFromPublicKey(publicKey: string, recipients: string[], values: string[], _data?: any): Promise;
estimateFeeDefaultsForOperations(publicKey: string, operations: TezosOperation[]): Promise;
prepareTransactionFromPublicKey(publicKey: string, recipients: string[], values: string[], fee: string, data?: {
addressIndex: number;
}): Promise;
prepareTransactionsFromPublicKey(publicKey: string, recipients: string[], values: string[], fee: string, data?: {
addressIndex: number;
}, operationsPerGroup?: number): Promise;
protected getTransactionOperationDetails(transactionOperation: TezosTransactionOperation): Promise[]>;
private createTransactionOperations;
forgeAndWrapOperations(tezosWrappedOperation: TezosWrappedOperation): Promise;
getDefaultDelegatee(): Promise;
getCurrentDelegateesForPublicKey(publicKey: string): Promise;
getCurrentDelegateesForAddress(address: string): Promise;
getDelegateeDetails(address: string): Promise;
isPublicKeyDelegating(publicKey: string): Promise;
isAddressDelegating(address: string): Promise;
getDelegatorDetailsFromPublicKey(publicKey: string): Promise;
getDelegatorDetailsFromAddress(address: string): Promise;
getDelegationDetailsFromPublicKey(publicKey: string, delegatees: string[]): Promise;
getDelegationDetailsFromAddress(address: string, delegatees: string[]): Promise;
private getDelegatorDetails;
prepareDelegatorActionFromPublicKey(publicKey: string, type: TezosDelegatorAction, data?: any): Promise;
prepareOperations(publicKey: string, operationRequests: TezosOperation[], overrideParameters?: boolean): Promise;
estimateAndReplaceLimitsAndFee(tezosWrappedOperation: TezosWrappedOperation, overrideParameters?: boolean, startingCounter?: BigNumber): Promise;
getDelegationInfo(delegatedAddress: string, fetchExtraInfo?: boolean): Promise;
bakerInfo(tzAddress: string | undefined): Promise;
getDelegationRewardsForAddress(address: string): Promise;
getDelegationRewards(bakerAddress: string, delegatorAddress?: string): Promise;
undelegate(publicKey: string): Promise;
delegate(publicKey: string, delegate?: string | string[]): Promise;
private getAmountUsedByPreviousOperations;
broadcastTransaction(rawTransaction: IAirGapSignedTransaction): Promise;
protected checkAndRemovePrefixToHex(base58CheckEncodedPayload: string, tezosPrefix: Uint8Array): string;
unforgeSignedTezosWrappedOperation(hexString: string): Promise;
unforgeUnsignedTezosWrappedOperation(hexString: string): Promise;
forgeTezosOperation(tezosWrappedOperation: TezosWrappedOperation): Promise;
createRevealOperation(counter: BigNumber, publicKey: string, address: string, fee?: string): Promise;
getTezosVotingInfo(blockHash: string): Promise;
fetchCurrentCycle(): Promise;
private static readonly FIRST_005_CYCLE;
private static readonly FIRST_006_CYCLE;
private static readonly FIRST_010_CYCLE;
private static readonly BLOCKS_PER_CYCLE;
private static readonly TIME_BETWEEN_BLOCKS;
timeIntervalBetweenCycles(fromCycle: number, toCycle: number): number;
cycleToBlockLevel(cycle: number): number;
blockLevelToCycle(blockLevel: number): number;
private readonly rewardCalculations;
calculateRewards(bakerAddress: string, cycle: number, currentCycle?: number, breakDownRewards?: boolean): Promise;
calculatePayouts(rewards: TezosRewards, offsetOrAddresses: number | string[], limit?: number): Promise;
calculatePayout(address: string, rewards: TezosRewards): Promise;
private calculatePayoutForAddresses;
private fetchBlockMetadata;
private fetchBalances;
signMessage(message: string, keypair: {
privateKey: Buffer;
}): Promise;
verifyMessage(message: string, signature: string, publicKey: string): Promise;
encryptAsymmetric(message: string, publicKey: string): Promise;
decryptAsymmetric(message: string, keypair: {
publicKey: string;
privateKey: Buffer;
}): Promise;
encryptAES(message: string, privateKey: Buffer): Promise;
decryptAES(message: string, privateKey: Buffer): Promise;
getTransactionStatuses(transactionHashes: string[]): Promise;
}
export interface TezosBakingRight {
level: number;
delegate: string;
priority: number;
}
export interface TezosBakingRewards {
totalBakingRewards: string;
rewardsDetails: {
level: number;
amount: string;
deposit: string;
fees?: string;
}[];
}
export interface TezosEndorsingRewards {
totalEndorsingRewards: string;
rewardsDetails: {
level: number;
amount: string;
deposit: string;
}[];
}
export interface TezosEndorsingRight {
level: number;
block_level?: number;
delegate: string;
number_of_slots: number;
}
export interface TezosRewardsCalculations {
protocol: TezosProtocol;
calculateRewards(bakerAddress: string, cycle: number, breakDownRewards: boolean, currentCycleIn?: number): Promise;
}
export interface TezosRewards {
baker: string;
stakingBalance: string;
bakingRewards: string;
bakingDeposits: string;
endorsingDeposits: string;
endorsingRewards: string;
fees: string;
deposit: string;
totalRewards: string;
cycle: number;
snapshotBlockLevel: number;
delegatedContracts: string[];
bakingRewardsDetails: {
level: number;
amount: string;
deposit: string;
fees?: string;
}[];
endorsingRewardsDetails: {
level: number;
amount: string;
deposit: string;
}[];
endorsingRightsCount: number;
}
export interface TezosBakerInfo {
balance: string;
frozen_balance: string;
frozen_balance_by_cycle: TezosFrozenBalance[];
staking_balance: string;
delegated_contracts: string[];
delegated_balance: string;
deactivated: boolean;
grace_period: number;
}
export interface TezosFrozenBalance {
cycle: number;
deposit?: string;
deposits: string;
fees: string;
rewards: string;
}
export interface TezosNodeConstants {
proof_of_work_nonce_size: number;
nonce_length: number;
max_revelations_per_block: number;
max_operation_data_length: number;
max_proposals_per_delegate: number;
preserved_cycles: number;
blocks_per_cycle: number;
blocks_per_commitment: number;
blocks_per_roll_snapshot: number;
blocks_per_voting_period: number;
time_between_blocks: number[];
endorsers_per_block: number;
hard_gas_limit_per_operation: string;
hard_gas_limit_per_block: string;
proof_of_work_threshold: number;
tokens_per_roll: string;
michelson_maximum_type_size: number;
seed_nonce_revelation_tip: string;
origination_size: number;
block_security_deposit: string;
endorsement_security_deposit: string;
cost_per_byte: string;
hard_storage_limit_per_operation: string;
test_chain_duration: string;
quorum_min: number;
quorum_max: number;
min_proposal_quorum: number;
initial_endorsers: number;
delay_per_missing_endorsement: string;
}
export interface TezosNodeConstantsV1 extends TezosNodeConstants {
block_reward: string;
endorsement_reward: string;
}
export interface TezosNodeConstantsV2 extends TezosNodeConstants {
baking_reward_per_endorsement: string[];
endorsement_reward: string[];
}
export {};