diff --git a/dist/types/boc/slice.d.ts b/dist/types/boc/slice.d.ts new file mode 100644 index 00000000..9167e028 --- /dev/null +++ b/dist/types/boc/slice.d.ts @@ -0,0 +1,88 @@ +import BN from 'bn.js'; +import { Address } from "../utils/address"; + +/** + * A partial view of a TVM cell, used for parsing data from Cells. + */ +declare class Slice { + array: Uint8Array; + length: number; + readCursor: number; + refs: Slice[]; + refCursor: number; + + /** + * @param array {Uint8Array} + * @param length {number} length in bits + * @param refs {Slice[]} child cells + */ + constructor(array: Uint8Array, length: number, refs: Slice[]); + + /** + * @return {number} + */ + getFreeBits(): number; + + /** + * @private + * @param n {number} + */ + private checkRange(n: number): void; + + /** + * @private + * @param n {number} + * @return {boolean} bit value at position `n` + */ + private get(n: number): boolean; + + /** + * @return {boolean} read bit + */ + loadBit(): boolean; + + /** + * @param bitLength {number} + * @return {Uint8Array} + */ + loadBits(bitLength: number): Uint8Array; + + /** + * Reads unsigned int + * + * @param {number} bitLength Size of uint in bits + * @returns {BN} number + */ + loadUint(bitLength: number): BN; + + /** + * Reads signed int + * + * @param {number} bitLength Size of uint in bits + * @returns {BN} number + */ + loadInt(bitLength: number): BN; + + /** + * @param bitLength {number} + * @return {BN} + */ + loadVarUint(bitLength: number): BN; + + /** + * @return {BN} + */ + loadCoins(): BN; + + /** + * @return {Address | null} + */ + loadAddress(): Address | null; + + /** + * @return {Slice} + */ + loadRef(): Slice; +} + +export { Slice }; diff --git a/dist/types/index.d.ts b/dist/types/index.d.ts index b0d61b56..9746cf96 100644 --- a/dist/types/index.d.ts +++ b/dist/types/index.d.ts @@ -14,6 +14,7 @@ import { formatTransferUrl, parseTransferUrl } from './utils/transfer-url'; export { ParsedTransferUrl } from './utils/transfer-url'; import { BitString } from './boc/bit-string'; import { Cell } from './boc/cell'; +import { Slice } from './boc/slice'; import { Contract } from './contract/contract'; export { ContractMethods, ContractOptions, Method, Query, StateInit, } from './contract/contract'; import { Wallets } from './contract/wallet/wallets'; @@ -68,6 +69,7 @@ export default class TonWeb { static boc: { BitString: typeof BitString; Cell: typeof Cell; + Slice: typeof Slice; }; static HttpProvider: typeof HttpProvider; static Contract: typeof Contract;