diff --git a/dist/esm/index.evm.js b/dist/esm/index.evm.js index 1bb8320..fbdba15 100644 --- a/dist/esm/index.evm.js +++ b/dist/esm/index.evm.js @@ -51036,15 +51036,24 @@ const EXCHANGE_PROXIES = { const getTransaction$2 = async({ paymentRoute, options })=> { + let deadline; + if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline + deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms + } else { + deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s + } + const transaction = { blockchain: paymentRoute.blockchain, to: transactionAddress({ paymentRoute, options }), api: transactionApi({ paymentRoute, options }), method: transactionMethod({ paymentRoute, options }), - params: await transactionParams({ paymentRoute, options }), + params: await transactionParams({ paymentRoute, options, deadline }), value: transactionValue({ paymentRoute }) }; + transaction.deadline = deadline; + return transaction }; @@ -51167,7 +51176,7 @@ const getPermit2SignatureTransferNonce = async({ address, blockchain })=>{ } }; -const transactionParams = async ({ paymentRoute, options })=> { +const transactionParams = async ({ paymentRoute, options, deadline })=> { if(paymentRoute.directTransfer && !paymentRoute.fee && _optionalChain$1([options, 'optionalAccess', _7 => _7.wallet, 'optionalAccess', _8 => _8.name]) !== 'World App') { if(paymentRoute.toToken.address == Blockchains[paymentRoute.blockchain].currency.address) { return undefined @@ -51175,12 +51184,6 @@ const transactionParams = async ({ paymentRoute, options })=> { return [paymentRoute.toAddress, paymentRoute.toAmount] } } else { - let deadline; - if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline - deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms - } else { - deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s - } const exchangeRoute = paymentRoute.exchangeRoutes[0]; const exchangeType = getExchangeType({ exchangeRoute, blockchain: paymentRoute.blockchain }); const exchangeTransaction = !exchangeRoute ? undefined : await exchangeRoute.getTransaction({ diff --git a/dist/esm/index.js b/dist/esm/index.js index 9a15e72..8f86586 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -2085,15 +2085,24 @@ const EXCHANGE_PROXIES = { const getTransaction$2 = async({ paymentRoute, options })=> { + let deadline; + if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline + deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms + } else { + deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s + } + const transaction = { blockchain: paymentRoute.blockchain, to: transactionAddress({ paymentRoute, options }), api: transactionApi({ paymentRoute, options }), method: transactionMethod({ paymentRoute, options }), - params: await transactionParams({ paymentRoute, options }), + params: await transactionParams({ paymentRoute, options, deadline }), value: transactionValue({ paymentRoute }) }; + transaction.deadline = deadline; + return transaction }; @@ -2216,7 +2225,7 @@ const getPermit2SignatureTransferNonce = async({ address, blockchain })=>{ } }; -const transactionParams = async ({ paymentRoute, options })=> { +const transactionParams = async ({ paymentRoute, options, deadline })=> { if(paymentRoute.directTransfer && !paymentRoute.fee && _optionalChain$1([options, 'optionalAccess', _7 => _7.wallet, 'optionalAccess', _8 => _8.name]) !== 'World App') { if(paymentRoute.toToken.address == Blockchains[paymentRoute.blockchain].currency.address) { return undefined @@ -2224,12 +2233,6 @@ const transactionParams = async ({ paymentRoute, options })=> { return [paymentRoute.toAddress, paymentRoute.toAmount] } } else { - let deadline; - if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline - deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms - } else { - deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s - } const exchangeRoute = paymentRoute.exchangeRoutes[0]; const exchangeType = getExchangeType({ exchangeRoute, blockchain: paymentRoute.blockchain }); const exchangeTransaction = !exchangeRoute ? undefined : await exchangeRoute.getTransaction({ diff --git a/dist/umd/index.evm.js b/dist/umd/index.evm.js index a550ec3..e0bae5e 100644 --- a/dist/umd/index.evm.js +++ b/dist/umd/index.evm.js @@ -51042,15 +51042,24 @@ const getTransaction$2 = async({ paymentRoute, options })=> { + let deadline; + if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline + deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms + } else { + deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s + } + const transaction = { blockchain: paymentRoute.blockchain, to: transactionAddress({ paymentRoute, options }), api: transactionApi({ paymentRoute, options }), method: transactionMethod({ paymentRoute, options }), - params: await transactionParams({ paymentRoute, options }), + params: await transactionParams({ paymentRoute, options, deadline }), value: transactionValue({ paymentRoute }) }; + transaction.deadline = deadline; + return transaction }; @@ -51173,7 +51182,7 @@ } }; - const transactionParams = async ({ paymentRoute, options })=> { + const transactionParams = async ({ paymentRoute, options, deadline })=> { if(paymentRoute.directTransfer && !paymentRoute.fee && _optionalChain$1([options, 'optionalAccess', _7 => _7.wallet, 'optionalAccess', _8 => _8.name]) !== 'World App') { if(paymentRoute.toToken.address == Blockchains__default["default"][paymentRoute.blockchain].currency.address) { return undefined @@ -51181,12 +51190,6 @@ return [paymentRoute.toAddress, paymentRoute.toAmount] } } else { - let deadline; - if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline - deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms - } else { - deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s - } const exchangeRoute = paymentRoute.exchangeRoutes[0]; const exchangeType = getExchangeType({ exchangeRoute, blockchain: paymentRoute.blockchain }); const exchangeTransaction = !exchangeRoute ? undefined : await exchangeRoute.getTransaction({ diff --git a/dist/umd/index.js b/dist/umd/index.js index ed2ea0d..3320eab 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -2090,15 +2090,24 @@ const getTransaction$2 = async({ paymentRoute, options })=> { + let deadline; + if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline + deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms + } else { + deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s + } + const transaction = { blockchain: paymentRoute.blockchain, to: transactionAddress({ paymentRoute, options }), api: transactionApi({ paymentRoute, options }), method: transactionMethod({ paymentRoute, options }), - params: await transactionParams({ paymentRoute, options }), + params: await transactionParams({ paymentRoute, options, deadline }), value: transactionValue({ paymentRoute }) }; + transaction.deadline = deadline; + return transaction }; @@ -2221,7 +2230,7 @@ } }; - const transactionParams = async ({ paymentRoute, options })=> { + const transactionParams = async ({ paymentRoute, options, deadline })=> { if(paymentRoute.directTransfer && !paymentRoute.fee && _optionalChain$1([options, 'optionalAccess', _7 => _7.wallet, 'optionalAccess', _8 => _8.name]) !== 'World App') { if(paymentRoute.toToken.address == Blockchains__default["default"][paymentRoute.blockchain].currency.address) { return undefined @@ -2229,12 +2238,6 @@ return [paymentRoute.toAddress, paymentRoute.toAmount] } } else { - let deadline; - if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline - deadline = Math.ceil(new Date())+3600*1000; // 1 hour in ms - } else { - deadline = Math.ceil(new Date()/1000)+3600; // 1 hour in s - } const exchangeRoute = paymentRoute.exchangeRoutes[0]; const exchangeType = getExchangeType({ exchangeRoute, blockchain: paymentRoute.blockchain }); const exchangeTransaction = !exchangeRoute ? undefined : await exchangeRoute.getTransaction({ diff --git a/package.evm.json b/package.evm.json index 23100ad..90fed98 100644 --- a/package.evm.json +++ b/package.evm.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments-evm", "moduleName": "Web3Payments", - "version": "13.12.6", + "version": "13.12.7", "description": "JavaScript library to scan crypto wallets for liquefiable assets and perform cost-effective, auto-converted payments on-chain.", "main": "dist/umd/index.evm.js", "module": "dist/esm/index.evm.js", diff --git a/package.json b/package.json index 0219ca1..b608645 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments", "moduleName": "Web3Payments", - "version": "13.12.6", + "version": "13.12.7", "description": "JavaScript library to scan crypto wallets for liquefiable assets and perform cost-effective, auto-converted payments on-chain.", "main": "dist/umd/index.js", "module": "dist/esm/index.js", diff --git a/package.solana.json b/package.solana.json index c70f0d3..0c33bb5 100644 --- a/package.solana.json +++ b/package.solana.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments-solana", "moduleName": "Web3Payments", - "version": "13.12.6", + "version": "13.12.7", "description": "JavaScript library to scan crypto wallets for liquefiable assets and perform cost-effective, auto-converted payments on-chain.", "main": "dist/umd/index.solana.js", "module": "dist/esm/index.solana.js", diff --git a/src/platforms/evm/transaction.js b/src/platforms/evm/transaction.js index 2d50b0e..7bd0b33 100644 --- a/src/platforms/evm/transaction.js +++ b/src/platforms/evm/transaction.js @@ -52,15 +52,24 @@ const EXCHANGE_PROXIES = { const getTransaction = async({ paymentRoute, options })=> { + let deadline + if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline + deadline = Math.ceil(new Date())+3600*1000 // 1 hour in ms + } else { + deadline = Math.ceil(new Date()/1000)+3600 // 1 hour in s + } + const transaction = { blockchain: paymentRoute.blockchain, to: transactionAddress({ paymentRoute, options }), api: transactionApi({ paymentRoute, options }), method: transactionMethod({ paymentRoute, options }), - params: await transactionParams({ paymentRoute, options }), + params: await transactionParams({ paymentRoute, options, deadline }), value: transactionValue({ paymentRoute }) } + transaction.deadline = deadline + return transaction } @@ -183,7 +192,7 @@ const getPermit2SignatureTransferNonce = async({ address, blockchain })=>{ } } -const transactionParams = async ({ paymentRoute, options })=> { +const transactionParams = async ({ paymentRoute, options, deadline })=> { if(paymentRoute.directTransfer && !paymentRoute.fee && options?.wallet?.name !== 'World App') { if(paymentRoute.toToken.address == Blockchains[paymentRoute.blockchain].currency.address) { return undefined @@ -191,12 +200,6 @@ const transactionParams = async ({ paymentRoute, options })=> { return [paymentRoute.toAddress, paymentRoute.toAmount] } } else { - let deadline - if(paymentRoute.blockchain === 'worldchain'){ // protocol V3 deadline - deadline = Math.ceil(new Date())+3600*1000 // 1 hour in ms - } else { - deadline = Math.ceil(new Date()/1000)+3600 // 1 hour in s - } const exchangeRoute = paymentRoute.exchangeRoutes[0] const exchangeType = getExchangeType({ exchangeRoute, blockchain: paymentRoute.blockchain }) const exchangeTransaction = !exchangeRoute ? undefined : await exchangeRoute.getTransaction({