Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add decodedOneInchSwapArgs #164

Merged
merged 2 commits into from
Sep 28, 2023
Merged

feat: add decodedOneInchSwapArgs #164

merged 2 commits into from
Sep 28, 2023

Conversation

iherger
Copy link
Member

@iherger iherger commented Sep 28, 2023

This is a helper function which is needed to decode data received from the 1Inch API.


PR-Codex overview

This PR adds a helper function to decode 1Inch data received from their API.

Detailed summary

  • Added decodedOneInchSwapArgs function to decode 1Inch swap arguments
  • Defined oneInchSwapArgsEncoding array to specify the encoding structure
  • Extracted relevant data from the decoded arguments
  • Returned the extracted data in a structured format

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot
Copy link

changeset-bot bot commented Sep 28, 2023

🦋 Changeset detected

Latest commit: 73cc7fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@enzymefinance/sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@commit-lint
Copy link

commit-lint bot commented Sep 28, 2023

Features

  • add decodedOneInchSwapArgs (e2a16c8)

Chore

Contributors

iherger

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

@github-actions
Copy link
Contributor

Size Change: +85 B (0%)

Total Size: 195 kB

Filename Size Change
packages/sdk/dist/internal/Extensions/IntegrationAdapters/OneInchV5.js 1.12 kB +85 B (+8%) 🔍
ℹ️ View Unchanged
Filename Size
packages/abis/dist/abis/IAaveDebtPositionLib.js 562 B
packages/abis/dist/abis/IAaveDebtPositionParser.js 406 B
packages/abis/dist/abis/IAaveV2Adapter.js 619 B
packages/abis/dist/abis/IAaveV2ATokenListOwner.js 352 B
packages/abis/dist/abis/IAaveV3Adapter.js 631 B
packages/abis/dist/abis/IAaveV3ATokenListOwner.js 348 B
packages/abis/dist/abis/IAaveV3DebtPositionLib.js 589 B
packages/abis/dist/abis/IAaveV3DebtPositionParser.js 421 B
packages/abis/dist/abis/IAddressListRegistry.js 822 B
packages/abis/dist/abis/IAllowedAdapterIncomingAssetsPolicy.js 664 B
packages/abis/dist/abis/IAllowedAdaptersPerManagerPolicy.js 692 B
packages/abis/dist/abis/IAllowedAdaptersPolicy.js 652 B
packages/abis/dist/abis/IAllowedAssetsForRedemptionPolicy.js 664 B
packages/abis/dist/abis/IAllowedDepositRecipientsPolicy.js 656 B
packages/abis/dist/abis/IAllowedExternalPositionTypesPerManagerPolicy.js 712 B
packages/abis/dist/abis/IAllowedExternalPositionTypesPolicy.js 613 B
packages/abis/dist/abis/IAllowedSharesTransferRecipientsPolicy.js 662 B
packages/abis/dist/abis/IArbitraryLoanPositionLib.js 682 B
packages/abis/dist/abis/IArbitraryLoanPositionParser.js 386 B
packages/abis/dist/abis/IArbitraryLoanTotalNominalDeltaOracleModule.js 642 B
packages/abis/dist/abis/IArbitraryTokenPhasedSharesWrapperFactory.js 551 B
packages/abis/dist/abis/IArbitraryTokenPhasedSharesWrapperLib.js 1.32 kB
packages/abis/dist/abis/IArbitraryTokenPhasedSharesWrapperProxy.js 293 B
packages/abis/dist/abis/IArbitraryValueOracle.js 307 B
packages/abis/dist/abis/IAssetValueCalculator.js 379 B
packages/abis/dist/abis/IAuraBalancerV2LpStakingAdapter.js 666 B
packages/abis/dist/abis/IAuraBalancerV2LpStakingWrapperFactory.js 607 B
packages/abis/dist/abis/IAuraBalancerV2LpStakingWrapperPriceFeed.js 401 B
packages/abis/dist/abis/IBalancerV2GaugeTokenPriceFeed.js 376 B
packages/abis/dist/abis/IBalancerV2LiquidityAdapter.js 713 B
packages/abis/dist/abis/IBalancerV2StablePoolPriceFeed.js 669 B
packages/abis/dist/abis/IBalancerV2WeightedPoolPriceFeed.js 574 B
packages/abis/dist/abis/IChainlinkPriceFeedMixin.js 544 B
packages/abis/dist/abis/ICompoundAdapter.js 670 B
packages/abis/dist/abis/ICompoundDebtPositionLib.js 599 B
packages/abis/dist/abis/ICompoundDebtPositionParser.js 486 B
packages/abis/dist/abis/ICompoundPriceFeed.js 528 B
packages/abis/dist/abis/ICompoundV3Adapter.js 656 B
packages/abis/dist/abis/ICompoundV3CTokenListOwner.js 349 B
packages/abis/dist/abis/IComptrollerLib.js 1.58 kB
packages/abis/dist/abis/IConvexCurveLpStakingAdapter.js 726 B
packages/abis/dist/abis/IConvexCurveLpStakingWrapperFactory.js 603 B
packages/abis/dist/abis/IConvexCurveLpStakingWrapperLib.js 1.35 kB
packages/abis/dist/abis/IConvexCurveLpStakingWrapperPriceFeed.js 400 B
packages/abis/dist/abis/IConvexVotingPositionLib.js 451 B
packages/abis/dist/abis/IConvexVotingPositionParser.js 402 B
packages/abis/dist/abis/ICumulativeSlippageTolerancePolicy.js 979 B
packages/abis/dist/abis/ICurveExchangeAdapter.js 632 B
packages/abis/dist/abis/ICurveLiquidityAdapter.js 763 B
packages/abis/dist/abis/ICurvePriceFeed.js 893 B
packages/abis/dist/abis/IDepositWrapper.js 471 B
packages/abis/dist/abis/IDerivativePriceFeed.js 333 B
packages/abis/dist/abis/IDispatcher.js 1.04 kB
packages/abis/dist/abis/IEntranceRateBurnFee.js 681 B
packages/abis/dist/abis/IEntranceRateDirectFee.js 705 B
packages/abis/dist/abis/IERC4626Adapter.js 583 B
packages/abis/dist/abis/IERC4626PriceFeed.js 360 B
packages/abis/dist/abis/IExitRateBurnFee.js 725 B
packages/abis/dist/abis/IExitRateDirectFee.js 749 B
packages/abis/dist/abis/IExternalPosition.js 331 B
packages/abis/dist/abis/IExternalPositionFactory.js 679 B
packages/abis/dist/abis/IExternalPositionManager.js 793 B
packages/abis/dist/abis/IExternalPositionProxy.js 405 B
packages/abis/dist/abis/IExternalPositionVault.js 271 B
packages/abis/dist/abis/IFee.js 538 B
packages/abis/dist/abis/IFeeManager.js 726 B
packages/abis/dist/abis/IFundDataProviderRouter.js 421 B
packages/abis/dist/abis/IFundDeployer.js 1.49 kB
packages/abis/dist/abis/IFundValueCalculator.js 551 B
packages/abis/dist/abis/IFundValueCalculatorRouter.js 629 B
packages/abis/dist/abis/IFundValueCalculatorUsdWrapper.js 522 B
packages/abis/dist/abis/IGasRelayPaymasterFactory.js 452 B
packages/abis/dist/abis/IGasRelayPaymasterLib.js 1.12 kB
packages/abis/dist/abis/IGatedRedemptionQueueSharesWrapperFactory.js 631 B
packages/abis/dist/abis/IGatedRedemptionQueueSharesWrapperLib.js 1.85 kB
packages/abis/dist/abis/IGlobalConfigLib.js 630 B
packages/abis/dist/abis/IHelperDataReader.js 937 B
packages/abis/dist/abis/IHelperDataReaderRouter.js 634 B
packages/abis/dist/abis/IIdleAdapter.js 626 B
packages/abis/dist/abis/IIdlePriceFeed.js 538 B
packages/abis/dist/abis/IIntegrationAdapter.js 392 B
packages/abis/dist/abis/IIntegrationManager.js 667 B
packages/abis/dist/abis/IKilnStakingPositionLib.js 564 B
packages/abis/dist/abis/IKilnStakingPositionParser.js 554 B
packages/abis/dist/abis/ILidoWithdrawalsPositionLib.js 562 B
packages/abis/dist/abis/ILiquityDebtPositionLib.js 409 B
packages/abis/dist/abis/ILiquityDebtPositionParser.js 436 B
packages/abis/dist/abis/IManagementFee.js 774 B
packages/abis/dist/abis/IManualValueOracleFactory.js 374 B
packages/abis/dist/abis/IManualValueOracleLib.js 572 B
packages/abis/dist/abis/IMapleLiquidityPositionLib.js 635 B
packages/abis/dist/abis/IMapleLiquidityPositionParser.js 430 B
packages/abis/dist/abis/IMapleV1ToV2PoolMapper.js 510 B
packages/abis/dist/abis/IMigrationHookHandler.js 361 B
packages/abis/dist/abis/IMinAssetBalancesPostRedemptionPolicy.js 625 B
packages/abis/dist/abis/IMinMaxInvestmentPolicy.js 676 B
packages/abis/dist/abis/IMinSharesSupplyFee.js 635 B
packages/abis/dist/abis/INoDepegOnRedeemSharesForSpecificAssetsPolicy.js 738 B
packages/abis/dist/abis/INotionalV3PositionLib.js 393 B
packages/abis/dist/abis/IOnlyRemoveDustExternalPositionPolicy.js 835 B
packages/abis/dist/abis/IOnlyUntrackDustOrPricelessAssetsPolicy.js 831 B
packages/abis/dist/abis/IParaSwapV5Adapter.js 740 B
packages/abis/dist/abis/IPerformanceFee.js 770 B
packages/abis/dist/abis/IPolicy.js 463 B
packages/abis/dist/abis/IPolicyManager.js 761 B
packages/abis/dist/abis/IProtocolFeeReserveLib.js 594 B
packages/abis/dist/abis/IProtocolFeeTracker.js 612 B
packages/abis/dist/abis/IRevertingPriceFeed.js 337 B
packages/abis/dist/abis/ISharesSplitterFactory.js 387 B
packages/abis/dist/abis/ISharesSplitterLib.js 622 B
packages/abis/dist/abis/ISolvV2BondBuyerPositionLib.js 598 B
packages/abis/dist/abis/ISolvV2BondBuyerPositionParser.js 418 B
packages/abis/dist/abis/ISolvV2BondIssuerPositionLib.js 520 B
packages/abis/dist/abis/ISolvV2BondIssuerPositionParser.js 425 B
packages/abis/dist/abis/IStakeWiseV3StakingPositionLib.js 643 B
packages/abis/dist/abis/IStakeWiseV3StakingPositionParser.js 507 B
packages/abis/dist/abis/IStakingWrapper.js 648 B
packages/abis/dist/abis/ISynthetixAdapter.js 693 B
packages/abis/dist/abis/ITheGraphDelegationPositionLib.js 522 B
packages/abis/dist/abis/ITheGraphDelegationPositionParser.js 405 B
packages/abis/dist/abis/IUintListRegistry.js 822 B
packages/abis/dist/abis/IUniswapV2ExchangeAdapter.js 604 B
packages/abis/dist/abis/IUniswapV2LiquidityAdapter.js 635 B
packages/abis/dist/abis/IUniswapV2PoolPriceFeed.js 655 B
packages/abis/dist/abis/IUniswapV3Adapter.js 596 B
packages/abis/dist/abis/IUniswapV3LiquidityPositionLib.js 578 B
packages/abis/dist/abis/IUniswapV3LiquidityPositionParser.js 472 B
packages/abis/dist/abis/IUnpermissionedActionsWrapper.js 400 B
packages/abis/dist/abis/IValueInterpreter.js 881 B
packages/abis/dist/abis/IVaultCore.js 293 B
packages/abis/dist/abis/IVaultLib.js 1.72 kB
packages/abis/dist/abis/IWstethPriceFeed.js 383 B
packages/abis/dist/abis/IYearnVaultV2Adapter.js 614 B
packages/abis/dist/abis/IYearnVaultV2PriceFeed.js 568 B
packages/abis/dist/index.js 3.31 kB
packages/api/dist/client.js 554 B
packages/api/dist/generated/enzyme/enzyme/v1/asset_balance_pb.js 740 B
packages/api/dist/generated/enzyme/enzyme/v1/asset_item_pb.js 980 B
packages/api/dist/generated/enzyme/enzyme/v1/depositor_item_pb.js 950 B
packages/api/dist/generated/enzyme/enzyme/v1/depositor_time_series_item_pb.js 859 B
packages/api/dist/generated/enzyme/enzyme/v1/enums_pb.js 2.01 kB
packages/api/dist/generated/enzyme/enzyme/v1/enzyme_connect.js 1.07 kB
packages/api/dist/generated/enzyme/enzyme/v1/enzyme_pb.js 4.28 kB
packages/api/dist/generated/enzyme/enzyme/v1/external_position_item_pb.js 794 B
packages/api/dist/generated/enzyme/enzyme/v1/fee_configuration_pb.js 1.71 kB
packages/api/dist/generated/enzyme/enzyme/v1/manager_time_series_item_pb.js 851 B
packages/api/dist/generated/enzyme/enzyme/v1/network_time_series_item_pb.js 855 B
packages/api/dist/generated/enzyme/enzyme/v1/policy_configuration_pb.js 3.99 kB
packages/api/dist/generated/enzyme/enzyme/v1/portfolio_asset_item_pb.js 949 B
packages/api/dist/generated/enzyme/enzyme/v1/time_window_pb.js 747 B
packages/api/dist/generated/enzyme/enzyme/v1/vault_list_item_pb.js 1.31 kB
packages/api/dist/generated/enzyme/enzyme/v1/vault_time_series_item_pb.js 948 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/asset_balance_pb.js 745 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/asset_item_pb.js 984 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/depositor_item_pb.js 954 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/depositor_time_series_item_pb.js 862 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/enums_pb.js 2.02 kB
packages/api/dist/generated/enzyme/enzyme/v1alpha/enzyme_connect.js 1.08 kB
packages/api/dist/generated/enzyme/enzyme/v1alpha/enzyme_pb.js 4.29 kB
packages/api/dist/generated/enzyme/enzyme/v1alpha/external_position_item_pb.js 798 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/fee_configuration_pb.js 1.71 kB
packages/api/dist/generated/enzyme/enzyme/v1alpha/manager_time_series_item_pb.js 858 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/network_time_series_item_pb.js 862 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/policy_configuration_pb.js 4 kB
packages/api/dist/generated/enzyme/enzyme/v1alpha/portfolio_asset_item_pb.js 954 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/time_window_pb.js 752 B
packages/api/dist/generated/enzyme/enzyme/v1alpha/vault_list_item_pb.js 1.31 kB
packages/api/dist/generated/enzyme/enzyme/v1alpha/vault_time_series_item_pb.js 953 B
packages/api/dist/index.js 313 B
packages/api/dist/protobuf.js 675 B
packages/sdk/dist/Assets.js 1.42 kB
packages/sdk/dist/Deposit.js 1.21 kB
packages/sdk/dist/Fees.js 1.01 kB
packages/sdk/dist/index.js 788 B
packages/sdk/dist/internal/Extensions.js 714 B
packages/sdk/dist/internal/Extensions/ExternalPositions.js 845 B
packages/sdk/dist/internal/Extensions/ExternalPositions/AaveV2Debt.js 1.22 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/ArbitraryLoan.js 1.45 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/CompoundV2Debt.js 1.3 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/ConvexVoting.js 1.4 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/Kiln.js 1.4 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/Liquity.js 1.42 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/MapleLiquidity.js 1.34 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/StakeWise.js 1.25 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/TheGraphDelegation.js 1.43 kB
packages/sdk/dist/internal/Extensions/ExternalPositions/UniswapV3Liquidity.js 1.45 kB
packages/sdk/dist/internal/Extensions/Fees.js 678 B
packages/sdk/dist/internal/Extensions/Fees/Entrance.js 562 B
packages/sdk/dist/internal/Extensions/Fees/Exit.js 601 B
packages/sdk/dist/internal/Extensions/Fees/Management.js 1.11 kB
packages/sdk/dist/internal/Extensions/Fees/Performance.js 949 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters.js 983 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters/AaveV2.js 971 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters/AaveV3.js 971 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters/BalancerV2Liquidity.js 1.89 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/CompoundV2.js 1.01 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/CompoundV3.js 1.09 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/ConvexCurveLpStaking.js 1.58 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/CurveExchange.js 925 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters/CurveLiquidity.js 1.84 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/Erc4626.js 984 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters/IdleV4.js 1.14 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/ParaswapV5.js 1.69 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/UniswapV2Exchange.js 903 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters/UniswapV2Liquidity.js 1.06 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/UniswapV3.js 919 B
packages/sdk/dist/internal/Extensions/IntegrationAdapters/YearnVaultV2.js 1.1 kB
packages/sdk/dist/internal/Extensions/IntegrationAdapters/ZeroExV4.js 1.5 kB
packages/sdk/dist/internal/Extensions/Policies.js 737 B
packages/sdk/dist/internal/Extensions/Policies/AllowedExternalPositionTypes.js 399 B
packages/sdk/dist/internal/Extensions/Policies/CumulativeSlippageTolerance.js 378 B
packages/sdk/dist/internal/Extensions/Policies/MinAssetBalancesPostRedemption.js 565 B
packages/sdk/dist/internal/Extensions/Policies/MinMaxInvestment.js 461 B
packages/sdk/dist/internal/ExternalPositionManager.js 1.1 kB
packages/sdk/dist/internal/FeeManager.js 885 B
packages/sdk/dist/internal/IntegrationManager.js 883 B
packages/sdk/dist/internal/PolicyManager.js 580 B
packages/sdk/dist/internal/Utils/assertion.js 220 B
packages/sdk/dist/internal/Utils/bigint.js 242 B
packages/sdk/dist/internal/Utils/constants.js 349 B
packages/sdk/dist/internal/Utils/conversion.js 471 B
packages/sdk/dist/internal/Utils/rates.js 837 B
packages/sdk/dist/internal/Utils/slippage.js 274 B
packages/sdk/dist/internal/Utils/types.js 126 B
packages/sdk/dist/internal/Utils/viem.js 507 B
packages/sdk/dist/Migration.js 836 B
packages/sdk/dist/Performance.js 864 B
packages/sdk/dist/Policies.js 864 B
packages/sdk/dist/Portfolio.js 1.65 kB
packages/sdk/dist/Relayer.js 806 B
packages/sdk/dist/Utils.js 758 B
packages/sdk/dist/Vault.js 812 B

compressed-size-action

@iherger iherger merged commit 447fbb3 into main Sep 28, 2023
9 checks passed
@iherger iherger deleted the feat/one-inch-swap-args branch September 28, 2023 08:08
@@ -90,3 +90,67 @@ export function takeOrderDecode(encoded: Hex): TakeOrderArgs {
data,
};
}

const oneInchSwapArgsEncoding = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to prefix names with oneInch within a file called OneInchV5

},
] as const;

export function decodedOneInchSwapArgs(encoded: Hex): TakeOrderArgs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to prefix names with oneInch within a file called OneInchV5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants