UNPKG

ton-assembly

Version:
444 lines 12.3 kB
export type arg = uint | int | delta | stack | control | plduzArg | tinyInt | largeInt | minusOne | s1 | setcpArg | slice | codeSlice | refCodeSlice | inlineCodeSlice | dict | 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 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 setcpArg = { $: "setcpArg"; range: range; }; export declare const setcpArg: setcpArg; export type args = arg[]; export declare const seq: (...args: arg[]) => args; 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 dict = { $: "dict"; }; export declare const dict: dict; export type exoticCell = { $: "exoticCell"; }; export declare const exoticCell: exoticCell; export type debugstr = { $: "debugstr"; }; export declare const debugstr: debugstr; export type Effect = CellLoad | CellCreate | CanThrow | AlwaysThrow | Tuple | ImplicitJumpRef | Ecrecover | Secp256k1XonlyPubkeyTweakAdd | Chksign | P256Chksign | Rist255Fromhash | Rist255Validate | Rist255Add | Rist255Mul | Rist255Mulbase | BlsVerify | BlsG1AddSub | BlsG1Neg | BlsG1Mul | BlsMapToG1 | BlsG1InGroup | BlsG2AddSub | BlsG2Neg | BlsG2Mul | BlsMapToG2 | BlsG2InGroup | DynamicGas; 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 Ecrecover = { $: "Ecrecover"; costs: [{ value: 1500; description: "For ECRECOVER operation"; }]; }; export declare const Ecrecover: () => Ecrecover; export type Secp256k1XonlyPubkeyTweakAdd = { $: "Secp256k1XonlyPubkeyTweakAdd"; costs: [{ value: 1250; description: "For SECP256K1_XONLY_PUBKEY_TWEAK_ADD operation"; }]; }; export declare const Secp256k1XonlyPubkeyTweakAdd: () => Secp256k1XonlyPubkeyTweakAdd; export type Chksign = { $: "Chksign"; costs: [{ value: 4000; description: "For CHKSIGN operation"; }]; }; export declare const Chksign: () => Chksign; export type P256Chksign = { $: "P256Chksign"; costs: [{ value: 3500; description: "For P256_CHKSIGN operation"; }]; }; export declare const P256Chksign: () => P256Chksign; export type Rist255Fromhash = { $: "Rist255Fromhash"; costs: [{ value: 600; description: "For RIST255_FROMHASH operation"; }]; }; export declare const Rist255Fromhash: () => Rist255Fromhash; export type Rist255Validate = { $: "Rist255Validate"; costs: [{ value: 200; description: "For RIST255_VALIDATE operation"; }]; }; export declare const Rist255Validate: () => Rist255Validate; export type Rist255Add = { $: "Rist255Add"; costs: [{ value: 600; description: "For RIST255_ADD operation"; }]; }; export declare const Rist255Add: () => Rist255Add; export type Rist255Mul = { $: "Rist255Mul"; costs: [{ value: 2000; description: "For RIST255_MUL operation"; }]; }; export declare const Rist255Mul: () => Rist255Mul; export type Rist255Mulbase = { $: "Rist255Mulbase"; costs: [{ value: 750; description: "For RIST255_MULBASE operation"; }]; }; export declare const Rist255Mulbase: () => Rist255Mulbase; export type BlsG1AddSub = { $: "BlsG1AddSub"; costs: [{ value: 3900; description: "For BLS_G1_ADD/BLS_G1_SUB operation"; }]; }; export declare const BlsG1AddSub: () => BlsG1AddSub; export type BlsG1Neg = { $: "BlsG1Neg"; costs: [{ value: 750; description: "For BLS_G1_NEG operation"; }]; }; export declare const BlsG1Neg: () => BlsG1Neg; export type BlsG1Mul = { $: "BlsG1Mul"; costs: [{ value: 5200; description: "For BLS_G1_MUL operation"; }]; }; export declare const BlsG1Mul: () => BlsG1Mul; export type BlsMapToG1 = { $: "BlsMapToG1"; costs: [{ value: 2350; description: "For BLS_MAP_TO_G1 operation"; }]; }; export declare const BlsMapToG1: () => BlsMapToG1; export type BlsG1InGroup = { $: "BlsG1InGroup"; costs: [{ value: 2950; description: "For BLS_G1_INGROUP operation"; }]; }; export declare const BlsG1InGroup: () => BlsG1InGroup; export type BlsVerify = { $: "BlsVerify"; costs: [{ value: 61000; description: "For BLS_VERIFY operation"; }]; }; export declare const BlsVerify: () => BlsVerify; export type BlsG2AddSub = { $: "BlsG2AddSub"; costs: [{ value: 6100; description: "For BLS_G2_ADD/BLS_G2_SUB operation"; }]; }; export declare const BlsG2AddSub: () => BlsG2AddSub; export type BlsG2Neg = { $: "BlsG2Neg"; costs: [{ value: 1550; description: "For BLS_G2_NEG operation"; }]; }; export declare const BlsG2Neg: () => BlsG2Neg; export type BlsG2Mul = { $: "BlsG2Mul"; costs: [{ value: 10550; description: "For BLS_G2_MUL operation"; }]; }; export declare const BlsG2Mul: () => BlsG2Mul; export type BlsMapToG2 = { $: "BlsMapToG2"; costs: [{ value: 7950; description: "For BLS_MAP_TO_G2 operation"; }]; }; export declare const BlsMapToG2: () => BlsMapToG2; export type BlsG2InGroup = { $: "BlsG2InGroup"; costs: [{ value: 4250; description: "For BLS_G2_INGROUP operation"; }]; }; export declare const BlsG2InGroup: () => BlsG2InGroup; export type DynamicGas = { $: "DynamicGas"; formula: string; description: string; }; export declare const DynamicGas: (formula: string, description: string) => DynamicGas; export declare const BLS_AGGREGATE_BASE_GAS_PRICE = -2650; export declare const BLS_AGGREGATE_ELEMENT_GAS_PRICE = 4350; export declare const BLS_FAST_AGGREGATE_VERIFY_BASE_GAS_PRICE = 58000; export declare const BLS_FAST_AGGREGATE_VERIFY_ELEMENT_GAS_PRICE = 3000; export declare const BLS_AGGREGATE_VERIFY_BASE_GAS_PRICE = 38500; export declare const BLS_AGGREGATE_VERIFY_ELEMENT_GAS_PRICE = 22500; export declare const BLS_G1_MULTIEXP_BASE_GAS_PRICE = 11375; export declare const BLS_G1_MULTIEXP_COEF1_GAS_PRICE = 630; export declare const BLS_G1_MULTIEXP_COEF2_GAS_PRICE = 8820; export declare const BLS_G2_MULTIEXP_BASE_GAS_PRICE = 30388; export declare const BLS_G2_MULTIEXP_COEF1_GAS_PRICE = 1280; export declare const BLS_G2_MULTIEXP_COEF2_GAS_PRICE = 22840; export declare const BLS_PAIRING_BASE_GAS_PRICE = 20000; export declare const BLS_PAIRING_ELEMENT_GAS_PRICE = 11800; 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; readonly formula?: string; }; export declare const calculateGasConsumptionWithDescription: (instr: Opcode) => GasConsumptionEntry[]; //# sourceMappingURL=instructions.d.ts.map