-1

I'm trying to send file to the ton storage provider

First I generated file, using storage-daemon-cli. Command like this:

new-contract-message <BagID> <file> --query-id 0 --provider <address>

Then trying to send file, using ton-core JS SDK

const tempFilePath = './storage/tempFile' // tempFile - file generated by daemon-cli

const payload = await fsPromise.readFile(tempFilePath, {encoding: 'base64'});

const payloadBase64 = Cell.fromBase64(payload)

const messageBody = beginCell()
        .storeUint(0x107c49ef, 32)
        .storeUint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1)
        .storeSlice(payloadBase64.beginParse())
        .endCell();

await provider.internal(via, {
        value: "0.5",
        body: messageBody
});

But then execution smart contract crashes with 1009 error

const error::provider_params_changed = 1009;

Smart contract code on GitHub

Can anybody explain how to make right message body?

Thank you all in advance!

Anon
  • 1
  • 2

1 Answers1

0

I found solution. Maybe it will be helpful for somebody:

const tempFilePath = './storage/saved2' // tempFile - file generated by daemon-cli

const payload = await fsPromise.readFile(tempFilePath, {encoding: 'base64'});
        
const payloadBase64 = Cell.fromBase64(payload)

await provider.internal(via, {
    value: "0.5",
    body: payloadBase64
});
Anon
  • 1
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 17 '23 at 18:11