Hello !
I am doing the SDK tutorial with the Node JS library.
at the stage of Deploying contracts I find the following error
{source: 'sdk', code: 2004, message: 'Invalid address [SizeError]: 0: 841288ed3b55d9cdafa806807f02a0ae0c169aa5edfe88a789a6482429756a94'}
Can you help me ?
This mi code
const { TONClient } = require('ton-client-node-js');
// Define contract package
const HelloContract = require('./helloContract');
// Define keys for our contract
const helloKeys = {
public: '55d7bab463a6a3ef5e03bb5f975836ddfb589b9ccb00329be7da8ea981c5268a',
secret: 'de93a97c7103c2d44e47972265cfdfe266fd28c8cadc4875804ee9f57cf786d6',
};
const giverAddress = '0:841288ed3b55d9cdafa806807f02a0ae0c169aa5edfe88a789a6482429756a94';
const giverAbi =
{
"ABI version": 0,
"functions": [
{
"name": "constructor",
"inputs": [],
"outputs": []
},
{
"name": "sendGrams",
"inputs": [
{"name":"dest","type":"address"},
{"name":"amount","type":"uint64"}
],
"outputs": []
}
],
"events": [],
"data": []
};
(async () => {
try {
const client = new TONClient();
client.config.setData({
servers: ['http://0.0.0.0']
});
await client.setup();
await main(client);
console.log('Hello TON Done');
process.exit(0);
} catch (error) {
console.error(error);
}
})();
async function get_grams_from_giver(client, account) {
const { contracts, queries } = client;
const result = await contracts.run({
address: giverAddress,
functionName: 'sendGrams',
abi: giverAbi,
input: {
dest: account
,
amount: 5000000000
},
keyPair: null,
});
const wait = await queries.accounts.waitFor(
{
id: { eq: account },
balance: { gt: "0" }
},
'id balance'
);
};
async function main(client) {
// <<<<< La siguiente sentencia arroja el error >>>>>
const futureHelloAddress = (await client.contracts.createDeployMessage({
package: HelloContract.package,
constructorParams: {},
keyPair: helloKeys,
})).address;
console.log(`Future address of the contract will be: ${futureHelloAddress}`);
await get_grams_from_giver(client, futureHelloAddress);
console.log(`Grams were transfered from giver to ${futureHelloAddress}`);
const helloAddress = (await client.contracts.deploy({
package: HelloContract.package,
constructorParams: {},
keyPair: helloKeys,
})).address;
console.log(`Hello contract was deployed at address: ${helloAddress});
}