From 96d5a77e6eec5064223b4df536bd436c711fbdf4 Mon Sep 17 00:00:00 2001 From: Sebastian Pape <0xneo11@gmail.com> Date: Sat, 19 Oct 2024 11:20:25 +0200 Subject: [PATCH] v13.12.8: fix whitelist should not contain native if native is not on the whitelist --- dist/esm/index.evm.js | 5 ++++- dist/esm/index.js | 5 ++++- dist/esm/index.solana.js | 5 ++++- dist/umd/index.evm.js | 5 ++++- dist/umd/index.js | 5 ++++- dist/umd/index.solana.js | 5 ++++- package.evm.json | 4 ++-- package.json | 6 +++--- package.solana.json | 4 ++-- src/route.js | 5 ++++- 10 files changed, 35 insertions(+), 14 deletions(-) diff --git a/dist/esm/index.evm.js b/dist/esm/index.evm.js index fbdba15..a6274d8 100644 --- a/dist/esm/index.evm.js +++ b/dist/esm/index.evm.js @@ -51458,7 +51458,10 @@ function route({ accept, from, whitelist, blacklist, drip }) { // add native currency as priority if does not exist already [...new Set(blockchains)].forEach((blockchain)=>{ - if(!priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address)) { + if( + !priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address) && + (!whitelist || (whitelist && whitelist[blockchain] && whitelist[blockchain].includes(Blockchains[blockchain].currency.address))) + ) { priority.push({ blockchain, address: Blockchains[blockchain].currency.address }); } }); diff --git a/dist/esm/index.js b/dist/esm/index.js index 8f86586..e0702b0 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -2505,7 +2505,10 @@ function route({ accept, from, whitelist, blacklist, drip }) { // add native currency as priority if does not exist already [...new Set(blockchains)].forEach((blockchain)=>{ - if(!priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address)) { + if( + !priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address) && + (!whitelist || (whitelist && whitelist[blockchain] && whitelist[blockchain].includes(Blockchains[blockchain].currency.address))) + ) { priority.push({ blockchain, address: Blockchains[blockchain].currency.address }); } }); diff --git a/dist/esm/index.solana.js b/dist/esm/index.solana.js index 252fa3e..30712ad 100644 --- a/dist/esm/index.solana.js +++ b/dist/esm/index.solana.js @@ -3502,7 +3502,10 @@ function route({ accept, from, whitelist, blacklist, drip }) { // add native currency as priority if does not exist already [...new Set(blockchains)].forEach((blockchain)=>{ - if(!priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address)) { + if( + !priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address) && + (!whitelist || (whitelist && whitelist[blockchain] && whitelist[blockchain].includes(Blockchains[blockchain].currency.address))) + ) { priority.push({ blockchain, address: Blockchains[blockchain].currency.address }); } }); diff --git a/dist/umd/index.evm.js b/dist/umd/index.evm.js index e0bae5e..4fcf329 100644 --- a/dist/umd/index.evm.js +++ b/dist/umd/index.evm.js @@ -51464,7 +51464,10 @@ // add native currency as priority if does not exist already [...new Set(blockchains)].forEach((blockchain)=>{ - if(!priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains__default["default"][blockchain].currency.address)) { + if( + !priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains__default["default"][blockchain].currency.address) && + (!whitelist || (whitelist && whitelist[blockchain] && whitelist[blockchain].includes(Blockchains__default["default"][blockchain].currency.address))) + ) { priority.push({ blockchain, address: Blockchains__default["default"][blockchain].currency.address }); } }); diff --git a/dist/umd/index.js b/dist/umd/index.js index 3320eab..1ecd954 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -2510,7 +2510,10 @@ // add native currency as priority if does not exist already [...new Set(blockchains)].forEach((blockchain)=>{ - if(!priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains__default["default"][blockchain].currency.address)) { + if( + !priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains__default["default"][blockchain].currency.address) && + (!whitelist || (whitelist && whitelist[blockchain] && whitelist[blockchain].includes(Blockchains__default["default"][blockchain].currency.address))) + ) { priority.push({ blockchain, address: Blockchains__default["default"][blockchain].currency.address }); } }); diff --git a/dist/umd/index.solana.js b/dist/umd/index.solana.js index b34310e..1b1431d 100644 --- a/dist/umd/index.solana.js +++ b/dist/umd/index.solana.js @@ -3507,7 +3507,10 @@ // add native currency as priority if does not exist already [...new Set(blockchains)].forEach((blockchain)=>{ - if(!priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains__default["default"][blockchain].currency.address)) { + if( + !priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains__default["default"][blockchain].currency.address) && + (!whitelist || (whitelist && whitelist[blockchain] && whitelist[blockchain].includes(Blockchains__default["default"][blockchain].currency.address))) + ) { priority.push({ blockchain, address: Blockchains__default["default"][blockchain].currency.address }); } }); diff --git a/package.evm.json b/package.evm.json index 90fed98..2fc196d 100644 --- a/package.evm.json +++ b/package.evm.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments-evm", "moduleName": "Web3Payments", - "version": "13.12.7", + "version": "13.12.8", "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", @@ -27,7 +27,7 @@ "dependencies": {}, "peerDependencies": { "@depay/web3-assets-evm": "^7.4.0", - "@depay/web3-blockchains": "^9.6.5", + "@depay/web3-blockchains": "^9.6.9", "@depay/web3-exchanges-evm": "^13.11.0", "@depay/web3-tokens-evm": "^10.4.3", "ethers": "^5.7.1" diff --git a/package.json b/package.json index b608645..788abbd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments", "moduleName": "Web3Payments", - "version": "13.12.7", + "version": "13.12.8", "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", @@ -38,7 +38,7 @@ "peerDependencies": { "@depay/solana-web3.js": "^1.26.0", "@depay/web3-assets": "^7.4.0", - "@depay/web3-blockchains": "^9.6.5", + "@depay/web3-blockchains": "^9.6.9", "@depay/web3-exchanges": "^13.11.0", "@depay/web3-tokens": "^10.4.3", "decimal.js": "^10.4.3", @@ -56,7 +56,7 @@ "@depay/web3-assets": "^7.4.0", "@depay/web3-assets-evm": "^7.4.0", "@depay/web3-assets-solana": "^7.4.0", - "@depay/web3-blockchains": "^9.6.5", + "@depay/web3-blockchains": "^9.6.9", "@depay/web3-client": "^10.19.1", "@depay/web3-client-evm": "^10.19.1", "@depay/web3-client-solana": "^10.19.1", diff --git a/package.solana.json b/package.solana.json index 0c33bb5..5ae30e8 100644 --- a/package.solana.json +++ b/package.solana.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-payments-solana", "moduleName": "Web3Payments", - "version": "13.12.7", + "version": "13.12.8", "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", @@ -28,7 +28,7 @@ "peerDependencies": { "@depay/solana-web3.js": "^1.26.0", "@depay/web3-assets-solana": "^7.4.0", - "@depay/web3-blockchains": "^9.6.5", + "@depay/web3-blockchains": "^9.6.9", "@depay/web3-exchanges-solana": "^13.11.0", "@depay/web3-tokens-solana": "^10.4.3", "ethers": "^5.7.1", diff --git a/src/route.js b/src/route.js index 7157d5d..822ba44 100644 --- a/src/route.js +++ b/src/route.js @@ -156,7 +156,10 @@ function route({ accept, from, whitelist, blacklist, drip }) { // add native currency as priority if does not exist already [...new Set(blockchains)].forEach((blockchain)=>{ - if(!priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address)) { + if( + !priority.find((priority)=>priority.blockchain === blockchain && priority.address === Blockchains[blockchain].currency.address) && + (!whitelist || (whitelist && whitelist[blockchain] && whitelist[blockchain].includes(Blockchains[blockchain].currency.address))) + ) { priority.push({ blockchain, address: Blockchains[blockchain].currency.address }) } })