I am running a script and I see the following error that the address type is unknown. I am new to typescript so if there is any information needed about Address type let me know:
yarn ts-node manage/deploy-sandbox.ts
yarn run v1.22.19
$ /Users/apple/proj/tonstart/node_modules/.bin/ts-node manage/deploy-sandbox.ts
/Users/apple/proj/tonstart/node_modules/ton/dist/address/Address.js:17
throw new Error('Unknown address type: byte length is not equal to 36');
^
Error: Unknown address type: byte length is not equal to 36
at parseFriendlyAddress (/Users/apple/proj/tonstart/node_modules/ton/dist/address/Address.js:17:15)
deploy-sandbox.ts:
import { Cell, contractAddress, StateInit, toNano, beginCell, Address } from 'ton';
import { readFileSync } from 'fs';
import qs from 'qs';
import qrcode from 'qrcode-terminal';
// Create a data cell similar to the initial contract state
const dataCell = beginCell()
.storeUint(0, 32) // counter
.storeAddress(Address.parse('/* YOUR ADDRESS */'))
.endCell();
// Load code from build
const codeCell = Cell.fromBoc(readFileSync('./build/hello-world.boc'))[0];
// Calculate address from code & data
const address = contractAddress({
workchain: 0,
initialCode: codeCell,
initialData: dataCell
});
// Prepare init message
const initCell = new Cell();
new StateInit({
code: codeCell,
data: dataCell,
}).writeTo(initCell);
// Encode link to deploy contract
let link = 'https://test.tonhub.com/transfer/' + address.toFriendly({ testOnly: true }) + '?' + qs.stringify({
text: 'Deploy contract',
amount: toNano(1).toString(10),
init: initCell.toBoc({ idx: false }).toString('base64')
});
console.log('Address: ' + address.toFriendly({ testOnly: true }));
qrcode.generate(link, { small: true }, (code) => {
console.log(code)
});
I was expecting the script to execute. I just tried running it that’s all.