@radixdlt/application
Version:
A JavaScript client library for interacting with the Radix Distributed Ledger.
251 lines • 8.95 kB
TypeScript
/// <reference types="node" />
import { AccountAddressT, ResourceIdentifierT, ValidatorAddressT } from '@radixdlt/account';
import { ActionInput, ActionType, ExecutedAction, IntendedAction, StakeTokensInput, TransferTokensInput, UnstakeTokensInput } from '../actions';
import { AmountT, BuiltTransactionReadyToSign, Network } from '@radixdlt/primitives';
import { PublicKeyT, SignatureT } from '@radixdlt/crypto';
import { Observable } from 'rxjs';
import { Result } from 'neverthrow';
import { AccountT, MessageInTransaction } from '../_types';
export declare type StakePosition = Readonly<{
validator: ValidatorAddressT;
amount: AmountT;
}>;
export declare type UnstakePosition = Readonly<{
validator: ValidatorAddressT;
amount: AmountT;
withdrawTxID: TransactionIdentifierT;
epochsUntil: number;
}>;
/**
* A transaction identifier, 32 bytes hash of signature + hashOfTxBlob.
* Used to lookup transactions by ID.
*/
export declare type TransactionIdentifierT = Readonly<{
__witness: 'isTXId';
__hex: string;
toString: () => string;
equals: (other: TransactionIdentifierT) => boolean;
}>;
export declare type TransactionIntentBuilderState = Readonly<{
actionInputs: ActionInput[];
message?: MessageInTransaction;
}>;
export declare type TransactionIntentBuilderEncryptOption = Readonly<{
encryptMessageIfAnyWithAccount: Observable<AccountT>;
spendingSender?: Observable<AccountAddressT>;
}>;
export declare type TransactionIntentBuilderDoNotEncryptInput = Readonly<{
spendingSender: Observable<AccountAddressT>;
}>;
export declare type TransactionIntentBuilderDoNotEncryptOption = Readonly<{
skipEncryptionOfMessageIfAny: TransactionIntentBuilderDoNotEncryptInput;
}>;
export declare type TransactionIntentBuilderOptions = TransactionIntentBuilderDoNotEncryptOption | TransactionIntentBuilderEncryptOption;
export declare type TransactionIntentBuilderT = Readonly<{
__state: TransactionIntentBuilderState;
transferTokens: (input: TransferTokensInput) => TransactionIntentBuilderT;
stakeTokens: (input: StakeTokensInput) => TransactionIntentBuilderT;
unstakeTokens: (input: UnstakeTokensInput) => TransactionIntentBuilderT;
message: (msg: MessageInTransaction) => TransactionIntentBuilderT;
__syncBuildDoNotEncryptMessageIfAny: (from: AccountAddressT) => Result<TransactionIntent, Error>;
build: (options: TransactionIntentBuilderOptions) => Observable<TransactionIntent>;
}>;
export declare type TransactionIntent = Readonly<{
actions: IntendedAction[];
message?: Buffer;
}>;
export declare type ValidatorsRequestInput = Readonly<{
size: number;
cursor?: string;
}>;
export declare enum TransactionTrackingEventType {
INITIATED = "INITIATED",
BUILT_FROM_INTENT = "BUILT_FROM_INTENT",
SIGNED = "SIGNED",
SUBMITTED = "SUBMITTED",
ASKED_FOR_CONFIRMATION = "ASKED_FOR_CONFIRMATION",
CONFIRMED = "CONFIRMED",
FINALIZED = "FINALIZED",
UPDATE_OF_STATUS_OF_PENDING_TX = "UPDATE_OF_STATUS_OF_PENDING_TX",
COMPLETED = "COMPLETED"
}
export declare type TransactionStateSuccess<T extends TransactionState = TransactionState> = Readonly<{
eventUpdateType: TransactionTrackingEventType;
transactionState: T;
}>;
export declare type TransactionStateError = Readonly<{
eventUpdateType: TransactionTrackingEventType;
error: Error;
}>;
export declare type TransactionStateUpdate<T extends TransactionState = TransactionState> = TransactionStateSuccess<T> | TransactionStateError;
export declare type TransactionState = TransactionIntent | BuiltTransaction | SignedTransaction | FinalizedTransaction | PendingTransaction;
export declare type TransactionTracking = Readonly<{
events: Observable<TransactionStateUpdate>;
completion: Observable<TransactionIdentifierT>;
}>;
export declare type TransactionHistoryOfKnownAddressRequestInput = Readonly<{
size: number;
cursor?: string;
}>;
export declare type TransactionHistoryActiveAccountRequestInput = TransactionHistoryOfKnownAddressRequestInput;
export declare type TransactionHistoryRequestInput = TransactionHistoryOfKnownAddressRequestInput & Readonly<{
address: AccountAddressT;
}>;
export declare type RecentTransactionsRequestInput = Readonly<{
network: Network;
cursor?: string;
}>;
export declare type SimpleExecutedTransaction = Readonly<{
txID: TransactionIdentifierT;
sentAt: Date;
status: TransactionStatus;
fee: AmountT;
message?: string;
actions: ExecutedAction[];
}>;
export declare enum TransactionType {
FROM_ME_TO_ME = "FROM_ME_TO_ME",
INCOMING = "INCOMING",
OUTGOING = "OUTGOING",
UNRELATED = "UNRELATED"
}
export declare type ExecutedTransaction = SimpleExecutedTransaction & Readonly<{
transactionType: TransactionType;
}>;
export declare type TokenAmount = Readonly<{
tokenIdentifier: ResourceIdentifierT;
amount: AmountT;
}>;
export declare type SimpleTokenBalance = TokenAmount;
export declare type TokenBalance = Readonly<{
token: Token;
amount: AmountT;
}>;
export declare type Token = Readonly<{
name: string;
rri: ResourceIdentifierT;
symbol: string;
description?: string;
granularity: AmountT;
isSupplyMutable: boolean;
currentSupply: AmountT;
tokenInfoURL?: URL;
iconURL?: URL;
}>;
export declare type StatusOfTransaction = Readonly<{
txID: TransactionIdentifierT;
status: TransactionStatus;
}>;
export declare type BuiltTransaction = Readonly<{
transaction: BuiltTransactionReadyToSign;
fee: AmountT;
}>;
export declare type SignedTransaction = Readonly<{
transaction: BuiltTransactionReadyToSign;
publicKeyOfSigner: PublicKeyT;
signature: SignatureT;
}>;
export declare type FinalizedTransaction = Readonly<{
blob: string;
txID: TransactionIdentifierT;
}>;
export declare type PendingTransaction = Readonly<{
txID: TransactionIdentifierT;
}>;
export declare type RawToken = Readonly<{
name: string;
rri: string;
symbol: string;
description?: string;
granularity: string;
isSupplyMutable: boolean;
currentSupply: string;
tokenInfoURL: string;
iconURL: string;
}>;
export declare type RawExecutedActionBase<T extends ActionType> = Readonly<{
type: T;
}>;
export declare type RawOtherExecutedAction = RawExecutedActionBase<ActionType.OTHER>;
export declare type RawTransferAction = RawExecutedActionBase<ActionType.TOKEN_TRANSFER> & Readonly<{
from: string;
to: string;
amount: string;
rri: string;
}>;
export declare type RawStakesAction = RawExecutedActionBase<ActionType.STAKE_TOKENS> & Readonly<{
from: string;
validator: string;
amount: string;
}>;
export declare type RawUnstakesAction = RawExecutedActionBase<ActionType.UNSTAKE_TOKENS> & Readonly<{
from: string;
validator: string;
amount: string;
}>;
export declare type NetworkTransactionThroughput = Readonly<{
tps: number;
}>;
export declare type NetworkTransactionDemand = NetworkTransactionThroughput;
export declare enum TransactionStatus {
PENDING = "PENDING",
CONFIRMED = "CONFIRMED",
FAILED = "FAILED"
}
export declare type RawExecutedAction = RawTransferAction | RawStakesAction | RawUnstakesAction | RawOtherExecutedAction;
export declare type SimpleTokenBalances = Readonly<{
owner: AccountAddressT;
tokenBalances: SimpleTokenBalance[];
}>;
export declare type TokenBalances = Readonly<{
owner: AccountAddressT;
tokenBalances: TokenBalance[];
}>;
export declare type SimpleTransactionHistory = Readonly<{
cursor: string;
transactions: SimpleExecutedTransaction[];
}>;
export declare type TransactionHistory = SimpleTransactionHistory & Readonly<{
transactions: ExecutedTransaction[];
}>;
export declare type Validator = Readonly<{
address: ValidatorAddressT;
ownerAddress: AccountAddressT;
name: string;
infoURL: URL;
totalDelegatedStake: AmountT;
ownerDelegation: AmountT;
validatorFee: number;
registered: boolean;
isExternalStakeAccepted: boolean;
uptimePercentage: number;
proposalsMissed: number;
proposalsCompleted: number;
}>;
export declare type Validators = Readonly<{
validators: Validator[];
}>;
export declare type RawExecutedTransaction = Readonly<{
txID: string;
sentAt: string;
fee: string;
message?: string;
actions: RawExecutedAction[];
}>;
export declare type RawValidatorResponse = Readonly<{
address: string;
ownerAddress: string;
name: string;
infoURL: string;
totalDelegatedStake: string;
ownerDelegation: string;
validatorFee: string;
registered: boolean;
isExternalStakeAccepted: boolean;
uptimePercentage: string;
proposalsMissed: number;
proposalsCompleted: number;
}>;
export declare type StakePositions = StakePosition[];
export declare type UnstakePositions = UnstakePosition[];
//# sourceMappingURL=_types.d.ts.map