@avalabs/avalanchejs
Version:
Avalanche Platform JS Library
51 lines • 2.32 kB
TypeScript
import type { OutputOwners, TransferableOutput } from '../../../serializable';
import { TransferableInput } from '../../../serializable';
import type { Utxo } from '../../../serializable/avax/utxo';
import type { Dimensions } from '../../common/fees/dimensions';
import type { FeeState } from '../models';
export interface SpendHelperProps {
changeOutputs: readonly TransferableOutput[];
feeState: FeeState;
initialComplexity: Dimensions;
inputs: readonly TransferableInput[];
shouldConsolidateOutputs: boolean;
stakeOutputs: readonly TransferableOutput[];
toBurn: Map<string, bigint>;
toStake: Map<string, bigint>;
weights: Dimensions;
}
export declare class SpendHelper {
private readonly feeState;
private readonly initialComplexity;
private readonly shouldConsolidateOutputs;
private readonly toBurn;
private readonly toStake;
private readonly weights;
private changeOutputs;
private inputs;
private stakeOutputs;
private inputUTXOs;
constructor({ changeOutputs, feeState, initialComplexity, inputs, shouldConsolidateOutputs, stakeOutputs, toBurn, toStake, weights, }: SpendHelperProps);
addInput(utxo: Utxo, transferableInput: TransferableInput): SpendHelper;
addChangeOutput(transferableOutput: TransferableOutput): SpendHelper;
addStakedOutput(transferableOutput: TransferableOutput): SpendHelper;
private getComplexity;
private consolidateOutputs;
shouldConsumeLockedStakeableAsset(assetId: string): boolean;
shouldConsumeAsset(assetId: string): boolean;
consumeLockedStakableAsset(assetId: string, amount: bigint): [remainingAmount: bigint, amountToStake: bigint];
consumeAsset(assetId: string, amount: bigint): [remainingAmount: bigint, amountToStake: bigint];
private calculateGas;
calculateFee(additionalOutput?: TransferableOutput): bigint;
hasChangeOutput(assetId: string, outputOwners: OutputOwners): boolean;
verifyAssetsConsumed(): Error | null;
verifyGasUsage(): Error | null;
getInputsOutputs(): {
changeOutputs: readonly TransferableOutput[];
fee: bigint;
inputs: readonly TransferableInput[];
inputUTXOs: readonly Utxo[];
stakeOutputs: readonly TransferableOutput[];
};
}
//# sourceMappingURL=spendHelper.d.ts.map