Skip to content

Commit

Permalink
v16.2.2: fix estimate tx for tuple params
Browse files Browse the repository at this point in the history
  • Loading branch information
10xSebastian committed Sep 15, 2023
1 parent aa614bf commit d86d81e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 29 deletions.
29 changes: 23 additions & 6 deletions dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<script crossorigin src="https://cdn.jsdelivr.net/npm/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/solana-web3.js@1"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-blockchains@9"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-client@10"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-client@10.18.4"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/walletconnect-v1@1"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/[email protected]"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/[email protected]"></script>
Expand Down Expand Up @@ -781,11 +781,28 @@ <h5 class="px-4">Send DePayRouter route on bsc</h5>
await wallet.sendTransaction({
blockchain: "bsc",
from: account,
to: "0x0Dfb7137bC64b63F7a0de7Cb9CDa178702666220",
method: "route",
params: { path: ['0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56'], amounts: ['100000', '100000'], addresses: [account, account], plugins: ['0x8B127D169D232D5F3ebE1C3D06CE343FD7C1AA11'], data: [] },
api: [{"inputs":[{"internalType":"address","name":"_configuration","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"configuration","outputs":[{"internalType":"contract DePayRouterV1Configuration","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pluginAddress","type":"address"}],"name":"isApproved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"address[]","name":"plugins","type":"address[]"},{"internalType":"string[]","name":"data","type":"string[]"}],"name":"route","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}],
value: 0,
to: "0x7ea09401db4692a8AEF4111b75bD32AE758f552A",
method: "pay",
params: {
payment: {
amountIn: 1000000000000000,
permit2: false,
paymentAmount: 1000000000000000,
feeAmount: 0,
tokenInAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
exchangeAddress: Web3Blockchains['bsc'].zero,
tokenOutAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
paymentReceiverAddress: '0x08B277154218CCF3380CAE48d630DA13462E3950',
feeReceiverAddress: Web3Blockchains['bsc'].zero,
exchangeType: 0,
receiverType: 0,
exchangeCallData: Web3Blockchains['bsc'].zero,
receiverCallData: Web3Blockchains['bsc'].zero,
deadline: 1794587231
}
},
api: [{"inputs":[{"internalType":"address","name":"_PERMIT2","type":"address"},{"internalType":"address","name":"_FORWARDER","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ExchangeCallFailed","type":"error"},{"inputs":[],"name":"ExchangeCallMissing","type":"error"},{"inputs":[],"name":"ExchangeNotApproved","type":"error"},{"inputs":[],"name":"ForwardingPaymentFailed","type":"error"},{"inputs":[],"name":"InsufficientBalanceInAfterPayment","type":"error"},{"inputs":[],"name":"InsufficientBalanceOutAfterPayment","type":"error"},{"inputs":[],"name":"NativeFeePaymentFailed","type":"error"},{"inputs":[],"name":"NativePaymentFailed","type":"error"},{"inputs":[],"name":"PaymentDeadlineReached","type":"error"},{"inputs":[],"name":"PaymentToZeroAddressNotAllowed","type":"error"},{"inputs":[],"name":"WrongAmountPaidIn","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"exchange","type":"address"}],"name":"Disabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"exchange","type":"address"}],"name":"Enabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"InternalTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"FORWARDER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"enable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"exchanges","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"bool","name":"permit2","type":"bool"},{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"address","name":"tokenInAddress","type":"address"},{"internalType":"address","name":"exchangeAddress","type":"address"},{"internalType":"address","name":"tokenOutAddress","type":"address"},{"internalType":"address","name":"paymentReceiverAddress","type":"address"},{"internalType":"address","name":"feeReceiverAddress","type":"address"},{"internalType":"uint8","name":"exchangeType","type":"uint8"},{"internalType":"uint8","name":"receiverType","type":"uint8"},{"internalType":"bytes","name":"exchangeCallData","type":"bytes"},{"internalType":"bytes","name":"receiverCallData","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IDePayRouterV2.Payment","name":"payment","type":"tuple"}],"name":"pay","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"bool","name":"permit2","type":"bool"},{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"address","name":"tokenInAddress","type":"address"},{"internalType":"address","name":"exchangeAddress","type":"address"},{"internalType":"address","name":"tokenOutAddress","type":"address"},{"internalType":"address","name":"paymentReceiverAddress","type":"address"},{"internalType":"address","name":"feeReceiverAddress","type":"address"},{"internalType":"uint8","name":"exchangeType","type":"uint8"},{"internalType":"uint8","name":"receiverType","type":"uint8"},{"internalType":"bytes","name":"exchangeCallData","type":"bytes"},{"internalType":"bytes","name":"receiverCallData","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IDePayRouterV2.Payment","name":"payment","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint160","name":"amount","type":"uint160"},{"internalType":"uint48","name":"expiration","type":"uint48"},{"internalType":"uint48","name":"nonce","type":"uint48"}],"internalType":"struct IPermit2.PermitDetails","name":"details","type":"tuple"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"sigDeadline","type":"uint256"}],"internalType":"struct IPermit2.PermitSingle","name":"permitSingle","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"pay","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}],
value: '1000000000000000',
sent: function(transaction){ console.log("sent callback", transaction) },
succeeded: function(transaction){ console.log("succeeded callback", transaction) },
failed: function(transaction){ console.log("failed callback", transaction) }
Expand Down
4 changes: 2 additions & 2 deletions package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-wallets-evm",
"moduleName": "Web3Wallets",
"version": "16.2.1",
"version": "16.2.2",
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
"main": "dist/umd/index.evm.js",
"module": "dist/esm/index.evm.js",
Expand All @@ -28,7 +28,7 @@
"@depay/walletconnect-v1": "^1.8.0",
"@depay/walletconnect-v2": "^2.9.2",
"@depay/web3-blockchains": "^9.1.4",
"@depay/web3-client-evm": "^10.18.3",
"@depay/web3-client-evm": "^10.18.4",
"ethers": "^5.7.1"
},
"engines": {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-wallets",
"moduleName": "Web3Wallets",
"version": "16.2.1",
"version": "16.2.2",
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
"main": "dist/umd/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -37,7 +37,7 @@
"@depay/walletconnect-v1": "^1.8.0",
"@depay/walletconnect-v2": "^2.9.2",
"@depay/web3-blockchains": "^9.2.5",
"@depay/web3-client": "^10.18.3",
"@depay/web3-client": "^10.18.4",
"ethers": "^5.7.1"
},
"engines": {
Expand All @@ -51,9 +51,9 @@
"@depay/walletconnect-v1": "^1.8.0",
"@depay/walletconnect-v2": "^2.9.2",
"@depay/web3-blockchains": "^9.2.5",
"@depay/web3-client": "^10.18.3",
"@depay/web3-client-evm": "^10.18.3",
"@depay/web3-client-solana": "^10.18.3",
"@depay/web3-client": "^10.18.4",
"@depay/web3-client-evm": "^10.18.4",
"@depay/web3-client-solana": "^10.18.4",
"@depay/web3-mock": "^14.17.0",
"@depay/web3-mock-evm": "^14.17.0",
"@depay/web3-mock-solana": "^14.17.0",
Expand Down
4 changes: 2 additions & 2 deletions package.solana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-wallets-solana",
"moduleName": "Web3Wallets",
"version": "16.2.1",
"version": "16.2.2",
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
"main": "dist/umd/index.solana.js",
"module": "dist/esm/index.solana.js",
Expand Down Expand Up @@ -29,7 +29,7 @@
"@depay/walletconnect-v1": "^1.8.0",
"@depay/walletconnect-v2": "^2.9.2",
"@depay/web3-blockchains": "^9.1.4",
"@depay/web3-client-solana": "^10.18.3",
"@depay/web3-client-solana": "^10.18.4",
"ethers": "^5.7.1"
},
"engines": {
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -966,20 +966,20 @@
resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.2.5.tgz#a428f898dfa04aa7b6b4ccfe20c68807c7326077"
integrity sha512-4AxGC1vyEydvk4WF1cxInY51JrTg8qND8mdZCJAZzKSNZI/d1+aRczzCn/yYXSwEHdPQCKUmXKzybQp1k/m7pw==

"@depay/web3-client-evm@^10.18.3":
version "10.18.3"
resolved "https://registry.yarnpkg.com/@depay/web3-client-evm/-/web3-client-evm-10.18.3.tgz#c4790bedc2615809f0b912c5a5029c64fcb50a88"
integrity sha512-UDnqTU7FJfKnssP7wvh++G6WbFzDfB5xc2x+HNHymV0UDW8IYCDT4A9U0/U2N3pwuMN+RoMUd9j4JZXxPjUfqA==

"@depay/web3-client-solana@^10.18.3":
version "10.18.3"
resolved "https://registry.yarnpkg.com/@depay/web3-client-solana/-/web3-client-solana-10.18.3.tgz#102d575c7ccc185b55ae1b78603108c0a15a1ce4"
integrity sha512-MtRLfEgNeAz60uUMaZ7CqUJoM+TCBIjDpNTQ8Nm341fiAQk37IiOJVDwdn1ADMozAQzD+ejJPA4Oea6oGk+0Mw==

"@depay/web3-client@^10.18.3":
version "10.18.3"
resolved "https://registry.yarnpkg.com/@depay/web3-client/-/web3-client-10.18.3.tgz#793e56c8e2d549ed4d8b1d10e347f86ac7e7b8d1"
integrity sha512-kBL70FhGBjtjF3iIZbMpJWevy+EkvS9iRwnmqTcMT4lkmCqnzr45I3rq0uxMfiUe9WTFRqIKHe4LWvvi7CwHYQ==
"@depay/web3-client-evm@^10.18.4":
version "10.18.4"
resolved "https://registry.yarnpkg.com/@depay/web3-client-evm/-/web3-client-evm-10.18.4.tgz#568dd937a49a09e03eb335ad3eadc2154542db57"
integrity sha512-ZPl8TPFvvtmkUh45A2MDba7DlQoaqOrX7VDsgSWla8uwyzEbMfXJMCafDogAYeaZZaYCU8hTrgA4Tj7wZGKmMg==

"@depay/web3-client-solana@^10.18.4":
version "10.18.4"
resolved "https://registry.yarnpkg.com/@depay/web3-client-solana/-/web3-client-solana-10.18.4.tgz#c4f862656e90895136586e48b79ba58c10f70da8"
integrity sha512-Mw4RZM/e6pMniE/adz/bcdsyv9FTNZhSbMARJizX5gFEshlJ0P5Bq2U8IxZ/IB+JFk9JRXCBs8dms7plHxo7YQ==

"@depay/web3-client@^10.18.4":
version "10.18.4"
resolved "https://registry.yarnpkg.com/@depay/web3-client/-/web3-client-10.18.4.tgz#94a3b07c6fa837ca414e6ac7f0adb30ceba43e91"
integrity sha512-MkxXkHZpfnMXeXvON+Biz+ZwoQYFd/ZA+wvLK2f2YejNLrjWk8dBryBBULkSeNpJKiLi7awkAD2nBp5sK4WQjQ==

"@depay/web3-mock-evm@^14.17.0":
version "14.17.0"
Expand Down

0 comments on commit d86d81e

Please sign in to comment.