trustwallet / wallet-core

Cross-platform, cross-blockchain wallet library.
https://developer.trustwallet.com/wallet-core
Apache License 2.0
2.86k stars 1.6k forks source link

Cannot find 'BitcoinFee' in scope #4094

Closed benben2019 closed 1 week ago

benben2019 commented 1 week ago

when i update this repo from v4.0.34 to v4.1.15, i got this error:Cannot find 'BitcoinFee' in scope

my code:

BitcoinFee.calculateFee(data: output.encoded, satVb: "\(byteFee)")

How can I modify the code to adapt to the latest version? Thank you!

satoshiotomakan commented 1 week ago

Hi @benben2019, BitcoinFee module was deprecated and removed. Please consider using AnySigner.plan() instead. It selects UTXOs required to send the requested amounts, pay the fee, and returns the exact transaction size. Please also use BitcoinV2 API, here's an example: Swift (BRC20 example): https://github.com/trustwallet/wallet-core/blob/master/swift/Tests/Blockchains/BitcoinTests.swift#L13-L82 JS (P2TR example): https://github.com/trustwallet/wallet-core/blob/master/wasm/tests/Blockchain/Bitcoin.test.ts#L16-L93

satoshiotomakan commented 1 week ago

@benben2019 you can ask any question at the discussions https://github.com/trustwallet/wallet-core/discussions

benben2019 commented 1 week ago

Hi @benben2019, BitcoinFee module was deprecated and removed. Please consider using AnySigner.plan() instead. It selects UTXOs required to send the requested amounts, pay the fee, and returns the exact transaction size. Please also use BitcoinV2 API, here's an example: Swift (BRC20 example): https://github.com/trustwallet/wallet-core/blob/master/swift/Tests/Blockchains/BitcoinTests.swift#L13-L82 JS (P2TR example): https://github.com/trustwallet/wallet-core/blob/master/wasm/tests/Blockchain/Bitcoin.test.ts#L16-L93

thank you !