ndatg / ton-highload-wallet-contract

TON Highload Wallet Contract
https://ndatg.github.io/ton-highload-wallet-contract/
MIT License
7 stars 1 forks source link

Issue while sending money to highloadWallet V2 #1

Closed cbrgpl closed 2 months ago

cbrgpl commented 2 months ago

Hello. I catch some weird behaviout when try to send ton to highload wallet v2 address. Transaction is implemented but declined(money transfered back to source wallet). But I pay fee.

I tried to create 3 types of wallets programatically - wallet V4, highload V2, highload V1; While working with highload V1 everything is ok(I successfully send money to it, I used the same mnemonic I used for wallet V4); then I decided to try highload V2, because the V1 is legacy. But I cannot transfer money to it.. I dont know why

There is my code:

export const test = async () => {
  const mnemonicArray = mnemonic.split(' ');
  const keyPair = await mnemonicToWalletKey(mnemonicArray);
  const hlV2Mnemonic = await mnemonicNew(24);
  console.log(hlV2Mnemonic.join(' '));

  const hlV2KeyPair = await mnemonicToWalletKey(hlV2Mnemonic);

  const v4Contract = client.open(WalletContractV4.create({ publicKey: keyPair.publicKey, workchain: 0 }));
  console.log('v4Contract', v4Contract.address.toString());

  const hlV2Contract = client.open(HighloadWalletContractV2.create({ publicKey: hlV2KeyPair.publicKey, workchain: 0 }));

  console.log(`hlV2Contract`, hlV2Contract.address.toString());

  const hlV1Contract = client.open(HighloadWalletContract.create({ publicKey: keyPair.publicKey, workchain: 0 }));
  console.log('hlV1Contract', hlV1Contract.address.toString());
  const seqno = await v4Contract.getSeqno();
  console.log('seqno', seqno);
  const a = await v4Contract.sendTransfer({
    seqno,
    secretKey: keyPair.secretKey,
    messages: [
      internal({
        to: 'EQCfdEncGRXVVtuuuAp-Aw4A_jj-bSlELV9gkK6wwGjMJ51y',
        value: '0.1',
      }),
    ],
  });

  console.log(a);
};

Tonscan links: wallet v4 highload v2 highload v1

cbrgpl commented 2 months ago

I solved the problem. I had to specify bounce when tried to do transaction; Highload Wallet v2 works.

Like there:

const a = await v4Contract.sendTransfer({
    seqno,
    secretKey: keyPair.secretKey,
    messages: [
      internal({
        to: 'EQCfdEncGRXVVtuuuAp-Aw4A_jj-bSlELV9gkK6wwGjMJ51y',
        value: '0.1',
        bounce: false,
      }),
    ],
  });