toncenter / tonweb

JavaScript SDK for TON (The Open Network)
MIT License
559 stars 171 forks source link

Cannot run message on account: inbound external message rejected by transaction #72

Open xxdondi opened 2 years ago

xxdondi commented 2 years ago

I'm participating in the TON-a-thon and I've basically been using https://github.com/toncenter/payment-channels-example this code as a starting point. Here is the output I get:

walletAddressA =  kQBzViV5z6Mx7v3oDLpBR9zT7qUG3adVmcp53P-58FtEK-Zd
walletAddressB =  kQDGhh97euGtukrmVHcC0CWD6K7TGYTuFrSozt7WsiTSgTaV
channelAAddress= EQCwsYHRdetnMklNKBEeSMQnZnZ_kcYRTx4Qt9iMynYwEJ6u
channelBAddress =  EQCwsYHRdetnMklNKBEeSMQnZnZ_kcYRTx4Qt9iMynYwEJ6u
helpers fromWalletA and fromWalletB created successfully
Trying to commit this to blockchain
error - unhandledRejection: LITE_SERVER_UNKNOWN: cannot apply external message to current state : External message was not accepted
Cannot run message on account: inbound external message rejected by transaction 73562579CFA331EEFDE80CBA4147DCD3EEA506DDA75599CA79DCFFB9F05B442B:
exitcode=0, steps=0, gas_used=0

The line that throws this error is:

  await fromWalletA.deploy().send(toNano('0.05'));

More code:

      const walletA = tonweb.wallet.create({
            address: A_ADDRESS
      });
      const channelConfig = {
      channelId: new BN(124), // Channel ID, for each new channel there must be a new ID
      addressA: walletAddressA, // A's funds will be withdrawn to this wallet address after the channel is closed
      addressB: walletAddressB, // B's funds will be deposited to this wallet address after the channel is closed
      initBalanceA: channelInitState.balanceA,
      initBalanceB: channelInitState.balanceB
  }

  // Each on their side creates a payment channel object with this configuration

  const channelA = tonweb.payments.createChannel({
      ...channelConfig,
      isA: true,
      myKeyPair: keyPairA,
      hisPublicKey: keyPairB.publicKey,
  });
  const channelAAddress = await channelA.getAddress(); // address of this payment channel smart-contract in blockchain
  console.log('channelAAddress=', channelAAddress.toString(true, true, true));

  const fromWalletA = channelA.fromWallet({
      wallet: walletA,
      secretKey: keyPairA.secretKey
  });

Could you please help me out here?

xxdondi commented 2 years ago
Screenshot 2022-07-02 at 19 05 32

HTTP500? Internal server error?

xxdondi commented 2 years ago
Screenshot 2022-07-02 at 19 09 50

Request payload.

k3vg3n commented 5 months ago

Hi! Have you solved the problem?

kohiry commented 1 month ago

Hi guys. I think I solve for me. Look to seqno. This is number of transactions IN WALLET WHO SEND TRANSACTION to another wallet. This mean: logic: wallet1 -> tx -> wallet2

wallet1 -> tx (seqn_wallet1:int, amount:int, wallet2:str) -> walelt2

Milimeter commented 1 month ago

i have the same issue around this line: await wallet.deploy(secretKey).send();