ton-assembly
Version:
TON assembler and disassembler
285 lines • 7.4 kB
TypeScript
export type arg = uint | int | refs | delta | stack | control | plduzArg | tinyInt | largeInt | runvmArg | hash | minusOne | s1 | setcpArg | slice | codeSlice | refCodeSlice | inlineCodeSlice | exoticCell | debugstr;
export type range = {
min: bigint;
max: bigint;
};
export declare const range: (min: bigint, max: bigint) => {
min: bigint;
max: bigint;
};
export type uint = {
$: "uint";
len: number;
range: range;
};
export declare const uint: (len: number, range: range) => uint;
export type int = {
$: "int";
len: number;
range: range;
};
export declare const int: (len: number, range: range) => int;
export type refs = {
$: "refs";
count: number;
};
export declare const refs: (count: number) => refs;
export type delta = {
$: "delta";
delta: number;
arg: arg;
};
export declare const delta: (delta: number, arg: arg) => delta;
export type stack = {
$: "stack";
len: number;
range: range;
};
export declare const stack: (len: number) => stack;
export declare const stack2: (len: number, start: bigint) => stack;
export type control = {
$: "control";
range: range;
};
export declare const control: control;
export type plduzArg = {
$: "plduzArg";
range: range;
};
export declare const plduzArg: plduzArg;
export type tinyInt = {
$: "tinyInt";
range: range;
};
export declare const tinyInt: tinyInt;
export type largeInt = {
$: "largeInt";
range: range;
};
export declare const largeInt: largeInt;
export type s1 = {
$: "s1";
};
export declare const s1: s1;
export type minusOne = {
$: "minusOne";
};
export declare const minusOne: minusOne;
export type runvmArg = {
$: "runvmArg";
};
export declare const runvmArg: runvmArg;
export type hash = {
$: "hash";
};
export declare const hash: hash;
export type setcpArg = {
$: "setcpArg";
range: range;
};
export declare const setcpArg: setcpArg;
export type args = simpleArgs | xchgArgs | dictpush;
export type simpleArgs = {
$: "simpleArgs";
children: arg[];
};
export declare const seq: (...args: arg[]) => simpleArgs;
export type xchgArgs = {
$: "xchgArgs";
range: range;
};
export declare const xchgArgs: xchgArgs;
export type codeSlice = {
$: "codeSlice";
refs: arg;
bits: arg;
};
export declare const codeSlice: (refs: arg, bits: arg) => codeSlice;
export type inlineCodeSlice = {
$: "inlineCodeSlice";
bits: arg;
};
export declare const inlineCodeSlice: (bits: arg) => inlineCodeSlice;
export type refCodeSlice = {
$: "refCodeSlice";
};
export declare const refCodeSlice: refCodeSlice;
export type slice = {
$: "slice";
refs: arg;
bits: arg;
pad: number;
};
export declare const slice: (refs: arg, bits: arg, pad: number) => slice;
export type exoticCell = {
$: "exoticCell";
};
export declare const exoticCell: exoticCell;
export type dictpush = {
$: "dictpush";
};
export declare const dictpush: dictpush;
export type debugstr = {
$: "debugstr";
};
export declare const debugstr: debugstr;
export type Effect = CellLoad | CellCreate | CanThrow | AlwaysThrow | Tuple | ImplicitJumpRef;
export type CellLoad = {
$: "CellLoad";
costs: [
{
value: 100;
description: "If cell is loaded for the first time";
},
{
value: 25;
description: "If cell is already loaded";
}
];
};
export declare const CellLoad: () => CellLoad;
export type CellCreate = {
$: "CellCreate";
costs: [{
value: 500;
description: "For Cell creation";
}];
};
export declare const CellCreate: () => CellCreate;
export type CanThrow = {
$: "CanThrow";
costs: [
{
value: 0;
description: "If no exception was thrown";
},
{
value: 50;
description: "If exception is thrown";
}
];
};
export declare const CanThrow: () => CanThrow;
export type AlwaysThrow = {
$: "AlwaysThrow";
costs: [{
value: 50;
description: "For exception throw";
}];
};
export declare const AlwaysThrow: () => AlwaysThrow;
export type Tuple = {
$: "Tuple";
costs: [
{
value: 0;
description: "For 0 elements tuple";
},
{
value: 1;
description: "For 1 element tuple";
},
{
value: 2;
description: "For 2 elements tuple";
},
{
value: 3;
description: "For 3 elements tuple";
},
{
value: 4;
description: "For 4 elements tuple";
},
{
value: 5;
description: "For 5 elements tuple";
},
{
value: 6;
description: "For 6 elements tuple";
},
{
value: 7;
description: "For 7 elements tuple";
},
{
value: 8;
description: "For 8 elements tuple";
},
{
value: 9;
description: "For 9 elements tuple";
},
{
value: 10;
description: "For 10 elements tuple";
},
{
value: 11;
description: "For 11 elements tuple";
},
{
value: 12;
description: "For 12 elements tuple";
},
{
value: 13;
description: "For 13 elements tuple";
},
{
value: 14;
description: "For 14 elements tuple";
},
{
value: 15;
description: "For 15 elements tuple";
}
];
};
export declare const Tuple: () => Tuple;
export type ImplicitJumpRef = {
$: "ImplicitJumpRef";
costs: [
{
value: 0;
description: "If reference Cell is already loaded";
},
{
value: 10;
description: "If reference Cell is loaded for the first time";
}
];
};
export declare const ImplicitJumpRef: () => ImplicitJumpRef;
export type Opcode = {
readonly min: number;
readonly max: number;
readonly checkLen: number;
readonly skipLen: number;
readonly exec: string;
readonly category: string;
readonly subCategory: string;
readonly version: undefined | number;
readonly args: args;
readonly kind: "dummy" | "simple" | "fixed" | "fixed-range" | "ext" | "ext-range";
readonly prefix: number;
readonly effects?: readonly Effect[];
};
export declare const MAX_OPCODE_BITS = 24;
export declare const instructions: Record<string, Opcode>;
export declare const pseudoInstructions: Set<string>;
export declare const instructionList: () => [string, Opcode][];
export declare const fiftInstructionList: () => [string, Opcode][];
export declare const infoOf: (name: string) => Opcode | undefined;
export declare const COST_PER_BIT = 1;
export declare const COST_PER_TUPLE_ITEM = 1;
export declare const MAX_TUPLE_ITEMS = 15;
export declare const COST_PRELOAD_INSTR = 10;
export declare const calculateGasConsumption: (instr: Opcode) => number[];
export type GasConsumptionEntry = {
readonly value: number;
readonly description: string;
};
export declare const calculateGasConsumptionWithDescription: (instr: Opcode) => GasConsumptionEntry[];
//# sourceMappingURL=instructions.d.ts.map