Skip to content

Commit

Permalink
feat: upgrading swap sdk to 0.19.0 (#5694)
Browse files Browse the repository at this point in the history
* feat: upgrading swap sdk to 0.19.0

* fix: yarn lock
  • Loading branch information
fringlesinthestreet authored May 6, 2024
1 parent 3ea6c5c commit af27740
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"@notifee/react-native": "5.6.0",
"@rainbow-me/provider": "0.0.11",
"@rainbow-me/react-native-animated-number": "0.0.2",
"@rainbow-me/swaps": "0.17.0",
"@rainbow-me/swaps": "0.19.0",
"@react-native-async-storage/async-storage": "1.18.2",
"@react-native-camera-roll/camera-roll": "5.7.1",
"@react-native-clipboard/clipboard": "1.13.2",
Expand Down
6 changes: 4 additions & 2 deletions src/raps/unlockAndCrosschainSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const estimateUnlockAndCrosschainSwap = async (swapParameters: Crosschain
ETH_ADDRESS_AGGREGATOR.toLowerCase() === inputCurrency.address?.toLowerCase() ||
isNativeAsset(inputCurrency.address, ethereumUtils.getNetworkFromChainId(Number(chainId)));

if (!nativeAsset && routeAllowanceTargetAddress) {
const shouldNotHaveApproval = tradeDetails.no_approval !== undefined && tradeDetails.no_approval;
if (!nativeAsset && routeAllowanceTargetAddress && !shouldNotHaveApproval) {
swapAssetNeedsUnlocking = await assetNeedsUnlocking(accountAddress, inputAmount, inputCurrency, routeAllowanceTargetAddress, chainId);
if (swapAssetNeedsUnlocking) {
const unlockGasLimit = await estimateApprove(accountAddress, inputCurrency.address, routeAllowanceTargetAddress, chainId, false);
Expand Down Expand Up @@ -60,7 +61,8 @@ export const createUnlockAndCrosschainSwapRap = async (swapParameters: Crosschai
isNativeAsset(inputCurrency?.address, ethereumUtils.getNetworkFromChainId(Number(chainId)));

let swapAssetNeedsUnlocking = false;
if (!nativeAsset && routeAllowanceTargetAddress) {
const shouldNotHaveApproval = tradeDetails.no_approval !== undefined && tradeDetails.no_approval;
if (!nativeAsset && routeAllowanceTargetAddress && !shouldNotHaveApproval) {
swapAssetNeedsUnlocking = await assetNeedsUnlocking(accountAddress, inputAmount, inputCurrency, routeAllowanceTargetAddress, chainId);
if (swapAssetNeedsUnlocking) {
const unlock = createNewAction(RapActionTypes.unlock, {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3320,10 +3320,10 @@
dependencies:
react-merge-refs "^1.0.0"

"@rainbow-me/swaps@0.17.0":
version "0.17.0"
resolved "https://registry.yarnpkg.com/@rainbow-me/swaps/-/swaps-0.17.0.tgz#4db1c3807b1dd040c863dbd34de5f73c0489891b"
integrity sha512-iXGSfbs7fopZyFI5nUe4e6LO6z1ZnSY3SPH8tJXYxRpHOUgl9b27r46rLvDTKBFgrng9MQMeXzJkm0EMgisvzA==
"@rainbow-me/swaps@0.19.0":
version "0.19.0"
resolved "https://registry.yarnpkg.com/@rainbow-me/swaps/-/swaps-0.19.0.tgz#c4b86a69d814f5d7c5b39b9eb190c949be9e4568"
integrity sha512-cBlks1Yx7emNfbdgvhK5d+cchL2e6kCMtzvjGbqrUGnhWv+IQmT0AAdKCZu6KlK+S+3lPbGcEjZ+mUUum42//w==
dependencies:
"@ethereumjs/util" "9.0.0"
"@ethersproject/abi" "5.7.0"
Expand Down

0 comments on commit af27740

Please sign in to comment.