import { AddressOrUnsafeInput, AccountAddressT, ValidatorAddressT, ValidatorAddressOrUnsafeInput, ResourceIdentifierOrUnsafeInput, ResourceIdentifierT, } from '@account' import { AmountOrUnsafeInput, AmountT } from '@primitives' export enum ActionType { TRANSFER = 'TransferTokens', STAKE = 'StakeTokens', UNSTAKE = 'UnstakeTokens', OTHER = 'Other', } export type Action = { type: T } // ################################## // #### ##### // #### INPUTTED ACTIONS ##### // #### ##### // ################################## export type TransferTokensInput = Readonly<{ to_account: AddressOrUnsafeInput amount: AmountOrUnsafeInput tokenIdentifier: ResourceIdentifierOrUnsafeInput }> export type StakeTokensInput = Readonly<{ to_validator: ValidatorAddressOrUnsafeInput amount: AmountOrUnsafeInput tokenIdentifier: ResourceIdentifierOrUnsafeInput }> export type UnstakeTokensInput = Readonly<{ from_validator: ValidatorAddressOrUnsafeInput amount: AmountOrUnsafeInput tokenIdentifier: ResourceIdentifierOrUnsafeInput }> export type ActionInput = | TransferTokensInput | StakeTokensInput | UnstakeTokensInput // ################################## // #### ##### // #### INTENDED ACTIONS ##### // #### ##### // ################################## export type TransferTokensProps = { to_account: AccountAddressT from_account: AccountAddressT amount: AmountT rri: ResourceIdentifierT } export type TransferTokensAction = TransferTokensProps & Action export type StakeTokensProps = Readonly<{ from_account: AccountAddressT to_validator: ValidatorAddressT amount: AmountT rri: ResourceIdentifierT }> export type UnstakeTokensProps = Readonly<{ to_account: AccountAddressT from_validator: ValidatorAddressT amount?: AmountT rri?: ResourceIdentifierT unstake_percentage?: number }> export type StakeTokensAction = StakeTokensProps & Action export type UnstakeTokensAction = UnstakeTokensProps & Action // An intended action specified by the user. Not yet accepted by // Radix Core API. export type IntendedActionBase = Action export type IntendedTransferTokensAction = IntendedActionBase & TransferTokensAction export type IntendedStakeTokensAction = IntendedActionBase & StakeTokensProps export type IntendedUnstakeTokensAction = IntendedActionBase & UnstakeTokensProps export type IntendedAction = | IntendedTransferTokensAction | IntendedStakeTokensAction | IntendedUnstakeTokensAction // ################################## // #### ##### // #### EXECUTED ACTIONS ##### // #### ##### // ################################## // An executed action stored in the Radix Ledger, part // of transaction history. Marker type. export type ExecutedActionBase = Action export type ExecutedTransferTokensAction = ExecutedActionBase & TransferTokensAction export type ExecutedStakeTokensAction = ExecutedActionBase & StakeTokensAction export type ExecutedUnstakeTokensAction = ExecutedActionBase & UnstakeTokensAction // OTHER (Only "Executed") export type ExecutedOtherAction = ExecutedActionBase export type ExecutedAction = | ExecutedTransferTokensAction | ExecutedStakeTokensAction | ExecutedUnstakeTokensAction | ExecutedOtherAction