ton-community / assets-sdk

MIT License
76 stars 13 forks source link

Cell underflow when smart contract receive JettonTransferNotification #20

Open JohnnnyWang opened 2 months ago

JohnnnyWang commented 2 months ago

Here is the transfer logic of the client. We hope to notify the smart contract when the transfer is completed, carrying a bigint as necessary data:

 const jetton = sdk.openJetton(Address.parse('xxxxxxxxxxxxxxxxxxxxxxxxxx')); 
 const playerWallet = await jetton.getWallet(provider.sender().address!);
 await playerWallet.send(provider.sender(), classicGameAddress, toNano(50), {
        notify: {
            amount: toNano(0.06),
            payload: beginCell().storeUint(1n, 64).endCell() // store Uint here
        },
        value: toNano(0.14)
});

here is code of smart contract (tact), we try to load

 let roomId = notify.forward_payload.loadUint(64);

Finally, the smart contract reports an error on this line: Exit code 9 · Cell underflow

ps: We find when using Jetton Transfer, forward_payload is sum_type: TextComment instead of Cell

Is there something I did wrong? Thanks for help!