出售代币并获得 BNB 而不是 wBNB?

Selling tokens and get BNB instead of wBNB?

我制作了一个在 BSC 智能链中出售代币的功能。但是,我想直接在 BNB 中接收它,而不是 wBNB。如何解开收到的 wBNB?

def sell_drdc(wallet_address, token_address, wallet_no):
    if not is_approved(token_address):
        approve(wallet_address, private_key)
    erc20 = web3.eth.contract(token_address, abi=erc20Abi)
    token_value = erc20.functions.balanceOf(wallet_address).call()
    if token_value != 0:
    pancakeswap2_txn = router.functions.swapExactTokensForTokensSupportingFeeOnTransferTokens (token_value, 0, [DRDC_Address, wbnb_contract], wallet_address, (int(time()) + 900)).buildTransaction({
                'from': wallet_address,
                'nonce': web3.eth.get_transaction_count(wallet_address),
            })
    signed_txn = web3.eth.account.sign_transaction(pancakeswap2_txn, private_key=private_key)
    try:
        tx_token = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
        web3.eth.waitForTransactionReceipt(tx_token, timeout=900)
        display_success() # Just function that sends success message
        update_text()
    except ValueError:
        display_error() # Just a function that sends the error
    except UnboundLocalError:
        sell_drdc(wallet_address, token_address, wallet_no) # Attempts to repeat if something goes wrong

我看到是哪里出了问题,应该是

swapExactTokensForETHSupportingFeeOnTransferTokens