diff --git a/dist/esm/index.evm.js b/dist/esm/index.evm.js index bd2ae3d..89eed1c 100644 --- a/dist/esm/index.evm.js +++ b/dist/esm/index.evm.js @@ -50690,7 +50690,7 @@ const transactionParams = async ({ paymentRoute, options })=> { if(options && _optionalChain$1([options, 'optionalAccess', _9 => _9.wallet, 'optionalAccess', _10 => _10.name]) === 'World App' && paymentRoute.blockchain === 'worldchain'){ const permitDeadline = Math.floor(Date.now() / 1000) + 30 * 60; - const nonce = getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); + const nonce = await getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); const permitTransfer = { permitted: { @@ -50798,9 +50798,9 @@ supported.solana = []; let solanaGetTransaction = ()=>{}; -const getTransaction$1 = ({ paymentRoute, fee })=>{ +const getTransaction$1 = ({ paymentRoute, fee, options })=>{ if(supported.evm.includes(paymentRoute.blockchain)) { - return getTransaction$2({ paymentRoute, fee }) + return getTransaction$2({ paymentRoute, fee, options }) } else if(supported.solana.includes(paymentRoute.blockchain)) { return solanaGetTransaction() } else { @@ -50847,7 +50847,9 @@ class PaymentRoute { this.approvalRequired = approvalRequired; this.approvalTransaction = approvalTransaction; this.directTransfer = directTransfer; - this.getTransaction = async (options)=> await getTransaction$1({ paymentRoute: this, options }); + this.getTransaction = async (options)=> { + return await getTransaction$1({ paymentRoute: this, options }) + }; } } diff --git a/dist/esm/index.js b/dist/esm/index.js index 9492107..d1b97bc 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -2254,7 +2254,7 @@ const transactionParams = async ({ paymentRoute, options })=> { if(options && _optionalChain$1([options, 'optionalAccess', _9 => _9.wallet, 'optionalAccess', _10 => _10.name]) === 'World App' && paymentRoute.blockchain === 'worldchain'){ const permitDeadline = Math.floor(Date.now() / 1000) + 30 * 60; - const nonce = getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); + const nonce = await getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); const permitTransfer = { permitted: { @@ -2360,11 +2360,11 @@ let supported = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum', ' supported.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain']; supported.solana = ['solana']; -const getTransaction$1 = ({ paymentRoute, fee })=>{ +const getTransaction$1 = ({ paymentRoute, fee, options })=>{ if(supported.evm.includes(paymentRoute.blockchain)) { - return getTransaction$2({ paymentRoute, fee }) + return getTransaction$2({ paymentRoute, fee, options }) } else if(supported.solana.includes(paymentRoute.blockchain)) { - return getTransaction$3({ paymentRoute, fee }) + return getTransaction$3({ paymentRoute, fee, options }) } else { throw('Blockchain not supported!') } @@ -2409,7 +2409,9 @@ class PaymentRoute { this.approvalRequired = approvalRequired; this.approvalTransaction = approvalTransaction; this.directTransfer = directTransfer; - this.getTransaction = async (options)=> await getTransaction$1({ paymentRoute: this, options }); + this.getTransaction = async (options)=> { + return await getTransaction$1({ paymentRoute: this, options }) + }; } } diff --git a/dist/esm/index.solana.js b/dist/esm/index.solana.js index b552e43..ce0f794 100644 --- a/dist/esm/index.solana.js +++ b/dist/esm/index.solana.js @@ -3360,11 +3360,11 @@ supported.solana = ['solana']; let evmGetTransaction = ()=>{}; -const getTransaction$1 = ({ paymentRoute, fee })=>{ +const getTransaction$1 = ({ paymentRoute, fee, options })=>{ if(supported.evm.includes(paymentRoute.blockchain)) { return evmGetTransaction() } else if(supported.solana.includes(paymentRoute.blockchain)) { - return getTransaction$2({ paymentRoute, fee }) + return getTransaction$2({ paymentRoute, fee, options }) } else { throw('Blockchain not supported!') } @@ -3409,7 +3409,9 @@ class PaymentRoute { this.approvalRequired = approvalRequired; this.approvalTransaction = approvalTransaction; this.directTransfer = directTransfer; - this.getTransaction = async (options)=> await getTransaction$1({ paymentRoute: this, options }); + this.getTransaction = async (options)=> { + return await getTransaction$1({ paymentRoute: this, options }) + }; } } diff --git a/dist/umd/index.evm.js b/dist/umd/index.evm.js index 9f2dcf7..67f062c 100644 --- a/dist/umd/index.evm.js +++ b/dist/umd/index.evm.js @@ -50696,7 +50696,7 @@ if(options && _optionalChain$1([options, 'optionalAccess', _9 => _9.wallet, 'optionalAccess', _10 => _10.name]) === 'World App' && paymentRoute.blockchain === 'worldchain'){ const permitDeadline = Math.floor(Date.now() / 1000) + 30 * 60; - const nonce = getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); + const nonce = await getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); const permitTransfer = { permitted: { @@ -50804,9 +50804,9 @@ let solanaGetTransaction = ()=>{}; - const getTransaction$1 = ({ paymentRoute, fee })=>{ + const getTransaction$1 = ({ paymentRoute, fee, options })=>{ if(supported.evm.includes(paymentRoute.blockchain)) { - return getTransaction$2({ paymentRoute, fee }) + return getTransaction$2({ paymentRoute, fee, options }) } else if(supported.solana.includes(paymentRoute.blockchain)) { return solanaGetTransaction() } else { @@ -50853,7 +50853,9 @@ this.approvalRequired = approvalRequired; this.approvalTransaction = approvalTransaction; this.directTransfer = directTransfer; - this.getTransaction = async (options)=> await getTransaction$1({ paymentRoute: this, options }); + this.getTransaction = async (options)=> { + return await getTransaction$1({ paymentRoute: this, options }) + }; } } diff --git a/dist/umd/index.js b/dist/umd/index.js index 9e4ed66..569b3e3 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -2259,7 +2259,7 @@ if(options && _optionalChain$1([options, 'optionalAccess', _9 => _9.wallet, 'optionalAccess', _10 => _10.name]) === 'World App' && paymentRoute.blockchain === 'worldchain'){ const permitDeadline = Math.floor(Date.now() / 1000) + 30 * 60; - const nonce = getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); + const nonce = await getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }); const permitTransfer = { permitted: { @@ -2365,11 +2365,11 @@ supported.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain']; supported.solana = ['solana']; - const getTransaction$1 = ({ paymentRoute, fee })=>{ + const getTransaction$1 = ({ paymentRoute, fee, options })=>{ if(supported.evm.includes(paymentRoute.blockchain)) { - return getTransaction$2({ paymentRoute, fee }) + return getTransaction$2({ paymentRoute, fee, options }) } else if(supported.solana.includes(paymentRoute.blockchain)) { - return getTransaction$3({ paymentRoute, fee }) + return getTransaction$3({ paymentRoute, fee, options }) } else { throw('Blockchain not supported!') } @@ -2414,7 +2414,9 @@ this.approvalRequired = approvalRequired; this.approvalTransaction = approvalTransaction; this.directTransfer = directTransfer; - this.getTransaction = async (options)=> await getTransaction$1({ paymentRoute: this, options }); + this.getTransaction = async (options)=> { + return await getTransaction$1({ paymentRoute: this, options }) + }; } } diff --git a/dist/umd/index.solana.js b/dist/umd/index.solana.js index 8b15983..8a7124a 100644 --- a/dist/umd/index.solana.js +++ b/dist/umd/index.solana.js @@ -3365,11 +3365,11 @@ let evmGetTransaction = ()=>{}; - const getTransaction$1 = ({ paymentRoute, fee })=>{ + const getTransaction$1 = ({ paymentRoute, fee, options })=>{ if(supported.evm.includes(paymentRoute.blockchain)) { return evmGetTransaction() } else if(supported.solana.includes(paymentRoute.blockchain)) { - return getTransaction$2({ paymentRoute, fee }) + return getTransaction$2({ paymentRoute, fee, options }) } else { throw('Blockchain not supported!') } @@ -3414,7 +3414,9 @@ this.approvalRequired = approvalRequired; this.approvalTransaction = approvalTransaction; this.directTransfer = directTransfer; - this.getTransaction = async (options)=> await getTransaction$1({ paymentRoute: this, options }); + this.getTransaction = async (options)=> { + return await getTransaction$1({ paymentRoute: this, options }) + }; } } diff --git a/examples/worldchain.md b/examples/worldchain.md index 8347b43..912e490 100644 --- a/examples/worldchain.md +++ b/examples/worldchain.md @@ -15,8 +15,8 @@ let routes = await Web3Payments.route({ } }) -let route = routes[1] -let transaction = await route.getTransaction() +let route = routes[0] +let transaction = await route.getTransaction({wallet: {name: 'World App'}}) const wallet = (await Web3Wallets.getWallets())[0] wallet.sendTransaction(transaction) diff --git a/package.evm.json b/package.evm.json index 648059d..ea78082 100644 --- a/package.evm.json +++ b/package.evm.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments-evm", "moduleName": "Web3Payments", - "version": "13.12.2", + "version": "13.12.3", "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 c9f111a..713e033 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments", "moduleName": "Web3Payments", - "version": "13.12.2", + "version": "13.12.3", "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 ebfd719..e4d6998 100644 --- a/package.solana.json +++ b/package.solana.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments-solana", "moduleName": "Web3Payments", - "version": "13.12.2", + "version": "13.12.3", "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 acee227..ac5eaa4 100644 --- a/src/platforms/evm/transaction.js +++ b/src/platforms/evm/transaction.js @@ -219,7 +219,7 @@ const transactionParams = async ({ paymentRoute, options })=> { if(options && options?.wallet?.name === 'World App' && paymentRoute.blockchain === 'worldchain'){ const permitDeadline = Math.floor(Date.now() / 1000) + 30 * 60 - const nonce = getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }) + const nonce = await getPermit2SignatureTransferNonce({ blockchain: paymentRoute.blockchain, address: paymentRoute.fromAddress }) const permitTransfer = { permitted: { diff --git a/src/route.js b/src/route.js index 275304e..7157d5d 100644 --- a/src/route.js +++ b/src/route.js @@ -63,7 +63,9 @@ class PaymentRoute { this.approvalRequired = approvalRequired this.approvalTransaction = approvalTransaction this.directTransfer = directTransfer - this.getTransaction = async (options)=> await getTransaction({ paymentRoute: this, options }) + this.getTransaction = async (options)=> { + return await getTransaction({ paymentRoute: this, options }) + } } } diff --git a/src/transaction.js b/src/transaction.js index 21095e7..5a16775 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -18,11 +18,11 @@ import { getTransaction as solanaGetTransaction} from './platforms/solana/transa import { supported } from './blockchains' -const getTransaction = ({ paymentRoute, fee })=>{ +const getTransaction = ({ paymentRoute, fee, options })=>{ if(supported.evm.includes(paymentRoute.blockchain)) { - return evmGetTransaction({ paymentRoute, fee }) + return evmGetTransaction({ paymentRoute, fee, options }) } else if(supported.solana.includes(paymentRoute.blockchain)) { - return solanaGetTransaction({ paymentRoute, fee }) + return solanaGetTransaction({ paymentRoute, fee, options }) } else { throw('Blockchain not supported!') }