tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
388 stars 259 forks source link

multiSign for Contracts return invalid transaction #506

Closed khairul-hotakdev closed 2 months ago

khairul-hotakdev commented 2 months ago

         const transaction = await tronWeb.transactionBuilder.triggerSmartContract(
            process.env.USDT_CONTRACT_ADDRESS,
            'transfer(address,uint256)',
            options,
            parameters,
            mainWallet,
        );
        console.log(transaction)
        const signedTxn = await tronWeb.trx.multiSign(transaction, mainWallet, usdtPermission.id);
        console.log('signedTxn: ', signedTxn);

i guess because tronWeb.trx is primarily for TRX transaction, is there any way for doing multisign for Contracts like USDT? seems there is no t in documentation for this case?

laurenceja commented 2 months ago

@khairul-hotakdev For multisign, it is the same for all transactions, the process is the same. There is a guide for multi-sign: https://developers.tron.network/docs/multi-signature-example-process-flow . Please select the permission id when creating the transaction. And you can try to use tronweb to transfer USDT without mulit-sign,, if it is successful, then try to use muti-sign way.

start940315 commented 2 months ago

It seems like you have passed the wrong address to triggerSmartContract. The fifth parameter is the issuer address, not the private key.

khairul-hotakdev commented 2 months ago

okay case closed.

it;s because transaction is not a valid transaction object

instead of await tronWeb.trx.multiSign(transaction, mainWallet, usdtPermission.id);

doing this: await tronWeb.trx.multiSign(transaction?.transaction, mainWallet, usdtPermission.id);