@radixdlt/tx-parser
Version:
Parsing of Radix Engine transactions and instructions
142 lines • 5.25 kB
TypeScript
/// <reference types="node" />
import { AmountT } from '@radixdlt/primitives';
import { PublicKeyT } from '@radixdlt/crypto';
import { UInt256 } from '@radixdlt/uint256';
import { Byte } from '@radixdlt/util';
declare type REPrimitive = Readonly<{
toBuffer: () => Buffer;
toString: () => string;
}>;
export declare enum InstructionType {
END = 0,
SYSCALL = 1,
UP = 2,
READ = 3,
LREAD = 4,
VREAD = 5,
LVREAD = 6,
DOWN = 7,
LDOWN = 8,
VDOWN = 9,
LVDOWN = 10,
SIG = 11,
MSG = 12,
HEADER = 13,
READINDEX = 14,
DOWNINDEX = 15
}
export declare type BaseInstruction<IT extends InstructionType> = REPrimitive & Readonly<{
toHumanReadableString?: () => string;
instructionType: IT;
}>;
export declare enum REAddressType {
SYSTEM = 0,
RADIX_NATIVE_TOKEN = 1,
HASHED_KEY_NONCE = 3,
PUBLIC_KEY = 4
}
export declare type REAddressBase<AT extends REAddressType> = REPrimitive & Readonly<{
reAddressType: AT;
}>;
export declare type REAddressSystem = REAddressBase<REAddressType.SYSTEM>;
export declare type REAddressNativeToken = REAddressBase<REAddressType.RADIX_NATIVE_TOKEN>;
export declare type REAddressHashedKeyNonce = REAddressBase<REAddressType.HASHED_KEY_NONCE> & Readonly<{
lower26Bytes: Buffer;
}>;
export declare type REAddressPublicKey = REAddressBase<REAddressType.PUBLIC_KEY> & Readonly<{
publicKey: PublicKeyT;
}>;
export declare type REAddressT = REAddressSystem | REAddressNativeToken | REAddressHashedKeyNonce | REAddressPublicKey;
export declare enum SubStateType {
TOKENS = 6,
PREPARED_STAKE = 7,
STAKE_OWNERSHIP = 8,
PREPARED_UNSTAKE = 9,
VALIDATOR_ALLOW_DELEGATION_FLAG = 14,
VALIDATOR_OWNER_COPY = 17
}
export declare type BaseSubstate<SST extends SubStateType> = REPrimitive & Readonly<{
substateType: SST;
toHumanReadableString?: () => string;
}>;
export declare type TokensT = BaseSubstate<SubStateType.TOKENS> & {
reserved: Byte;
owner: REAddressT;
resource: REAddressT;
amount: AmountT;
};
export declare type BaseValidatorSubstate<SST extends SubStateType> = BaseSubstate<SST> & Readonly<{
reserved: Byte;
validator: PublicKeyT;
}>;
export declare type BaseStakingSubstate<SST extends SubStateType> = BaseValidatorSubstate<SST> & Readonly<{
owner: REAddressT;
amount: AmountT;
}>;
export declare type PreparedStakeT = BaseStakingSubstate<SubStateType.PREPARED_STAKE>;
export declare type PreparedUnstakeT = BaseStakingSubstate<SubStateType.PREPARED_UNSTAKE>;
export declare type StakeOwnershipT = BaseStakingSubstate<SubStateType.STAKE_OWNERSHIP>;
export declare type ValidatorAllowDelegationFlagT = BaseValidatorSubstate<SubStateType.VALIDATOR_ALLOW_DELEGATION_FLAG> & Readonly<{
isDelegationAllowed: boolean;
}>;
export declare type ValidatorOwnerCopyT = BaseValidatorSubstate<SubStateType.VALIDATOR_OWNER_COPY> & Readonly<{
owner: REAddressT;
}>;
export declare type SubstateT = TokensT | PreparedStakeT | PreparedUnstakeT | StakeOwnershipT | ValidatorAllowDelegationFlagT | ValidatorOwnerCopyT;
export declare const stringifySubstateType: (substateType: SubStateType) => string;
export declare type BaseInstructionWithSubState<IT extends InstructionType> = BaseInstruction<IT> & Readonly<{
substate: SubstateT;
}>;
export declare type BytesT = REPrimitive & Readonly<{
length: number;
data: Buffer;
}>;
export declare type Ins_END = BaseInstruction<InstructionType.END>;
export declare type Ins_UP = BaseInstructionWithSubState<InstructionType.UP>;
export declare type Ins_MSG = BaseInstruction<InstructionType.MSG> & Readonly<{
bytes: BytesT;
}>;
export declare type UInt32 = number;
export declare type SubstateIdT = REPrimitive & Readonly<{
hash: Buffer;
index: UInt32;
}>;
export declare type Ins_DOWN = BaseInstruction<InstructionType.DOWN> & Readonly<{
substateId: SubstateIdT;
}>;
export declare type Ins_LDOWN = BaseInstruction<InstructionType.LDOWN> & Readonly<{
substateIndex: UInt32;
}>;
export declare type TXSig = REPrimitive & Readonly<{
v: Byte;
r: UInt256;
s: UInt256;
}>;
export declare type Ins_SIG = BaseInstruction<InstructionType.SIG> & Readonly<{
signature: TXSig;
}>;
export declare const SYSCALL_TX_FEE_RESERVE_PUT = 0;
export declare const SYSCALL_TX_FEE_RESERVE_TAKE = 1;
export declare type Ins_SYSCALL = BaseInstruction<InstructionType.SYSCALL> & Readonly<{
callData: BytesT;
}>;
export declare type Ins_HEADER = BaseInstruction<InstructionType.HEADER> & Readonly<{
version: Byte;
flag: Byte;
}>;
export declare type Ins_VREAD = BaseInstruction<InstructionType.VREAD> & Readonly<{
callData: BytesT;
}>;
export declare type Ins_VDOWN = BaseInstruction<InstructionType.VDOWN> & Readonly<{
callData: BytesT;
}>;
export declare type Ins_READ = BaseInstruction<InstructionType.READ> & Readonly<{
substateId: SubstateIdT;
}>;
export declare type InstructionT = Ins_END | Ins_UP | Ins_DOWN | Ins_LDOWN | Ins_MSG | Ins_SIG | Ins_SYSCALL | Ins_HEADER | Ins_VREAD | Ins_VDOWN | Ins_READ;
export declare type TransactionT = REPrimitive & Readonly<{
instructions: InstructionT[];
txID: () => string;
}>;
export {};
//# sourceMappingURL=_types.d.ts.map