UNPKG

@tonkite/jest-tolk

Version:

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tonkite/tonkite/main/assets/logo-dark.svg"> <img alt="tonkite logo" src="https://raw.githubusercontent.com/tonkite/tonkite/main/a

28 lines (27 loc) 921 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateAddressValues = generateAddressValues; const core_1 = require("@ton/core"); const node_crypto_1 = require("node:crypto"); function generateAddressValues(count) { const result = []; const edgeCases = [ null, new core_1.ExternalAddress(0n, 0), new core_1.ExternalAddress((1n << 511n) - 1n, 511), ]; edgeCases.forEach((value) => result.push({ type: 'slice', cell: (0, core_1.beginCell)().storeAddress(value).endCell(), })); while (result.length < count) { const workchain = Math.random() < 0.5 ? 0 : -1; result.push({ type: 'slice', cell: (0, core_1.beginCell)() .storeAddress(new core_1.Address(workchain, (0, node_crypto_1.randomBytes)(32))) .endCell(), }); } return result; }