@ledgerhq/context-module 0.0.0-no-issue-rn-ble-reconnection-20250916150911 → 0.0.0-no-issue-rn-ble-fix-scan-20251013184811
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/src/ContextModule.js +1 -1
- package/lib/cjs/src/ContextModule.js.map +1 -1
- package/lib/cjs/src/ContextModuleBuilder.js +1 -1
- package/lib/cjs/src/ContextModuleBuilder.js.map +3 -3
- package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
- package/lib/cjs/src/ContextModuleBuilder.test.js.map +3 -3
- package/lib/cjs/src/DefaultContextModule.js +1 -1
- package/lib/cjs/src/DefaultContextModule.js.map +3 -3
- package/lib/cjs/src/DefaultContextModule.test.js +1 -1
- package/lib/cjs/src/DefaultContextModule.test.js.map +3 -3
- package/lib/cjs/src/calldata/data/CalldataDescriptorDataSource.js +2 -0
- package/lib/cjs/src/calldata/data/CalldataDescriptorDataSource.js.map +7 -0
- package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.js +2 -0
- package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.js.map +7 -0
- package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.test.js +2 -0
- package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.test.js.map +7 -0
- package/lib/cjs/src/{transaction → calldata}/data/dto/CalldataDto.js.map +1 -1
- package/lib/cjs/src/calldata/di/calldataModuleFactory.js +2 -0
- package/lib/cjs/src/calldata/di/calldataModuleFactory.js.map +7 -0
- package/lib/cjs/src/calldata/di/calldataTypes.js +2 -0
- package/lib/cjs/src/calldata/di/calldataTypes.js.map +7 -0
- package/lib/cjs/src/calldata/domain/CalldataContextLoader.js +2 -0
- package/lib/cjs/src/calldata/domain/CalldataContextLoader.js.map +7 -0
- package/lib/cjs/src/calldata/domain/CalldataContextLoader.test.js +2 -0
- package/lib/cjs/src/calldata/domain/CalldataContextLoader.test.js.map +7 -0
- package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
- package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +3 -3
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +1 -1
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +3 -3
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +1 -1
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +3 -3
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
- package/lib/cjs/src/index.js +1 -1
- package/lib/cjs/src/index.js.map +2 -2
- package/lib/cjs/src/nft/domain/NftContextFieldLoader.js +1 -1
- package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +3 -3
- package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +1 -1
- package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +3 -3
- package/lib/cjs/src/nft/domain/NftContextLoader.js +1 -1
- package/lib/cjs/src/nft/domain/NftContextLoader.js.map +3 -3
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +3 -3
- package/lib/cjs/src/pki/model/PkiCertificateInfo.js +1 -1
- package/lib/cjs/src/pki/model/PkiCertificateInfo.js.map +1 -1
- package/lib/cjs/src/proxy/data/HttpProxyDataSource.js +1 -1
- package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +3 -3
- package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js +1 -1
- package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +3 -3
- package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
- package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
- package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
- package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
- package/lib/cjs/src/proxy/data/ProxyDataSource.js +2 -0
- package/lib/cjs/src/proxy/data/ProxyDataSource.js.map +7 -0
- package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +2 -0
- package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
- package/lib/cjs/src/proxy/di/proxyModuleFactory.js +1 -1
- package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +3 -3
- package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js +2 -0
- package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
- package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +1 -1
- package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +3 -3
- package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +1 -1
- package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +3 -3
- package/lib/cjs/src/proxy/model/ProxyDelegateCall.js +1 -1
- package/lib/cjs/src/proxy/model/ProxyDelegateCall.js.map +1 -1
- package/lib/cjs/src/shared/domain/ContextFieldLoader.js +1 -1
- package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +3 -3
- package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
- package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
- package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
- package/lib/cjs/src/shared/model/ClearSignContext.js.map +2 -2
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +1 -1
- package/lib/cjs/src/shared/utils/KeyUsageMapper.js +1 -1
- package/lib/cjs/src/shared/utils/KeyUsageMapper.js.map +2 -2
- package/lib/cjs/src/token/data/HttpTokenDataSource.js +1 -1
- package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +2 -2
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +2 -2
- package/lib/cjs/src/token/domain/TokenContextFieldLoader.js +1 -1
- package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +3 -3
- package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +1 -1
- package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +3 -3
- package/lib/cjs/src/token/domain/TokenContextLoader.js +1 -1
- package/lib/cjs/src/token/domain/TokenContextLoader.js.map +3 -3
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +3 -3
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +2 -2
- package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js +1 -1
- package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js.map +1 -1
- package/lib/cjs/src/trusted-name/data/TrustedNameDto.js +1 -1
- package/lib/cjs/src/trusted-name/data/TrustedNameDto.js.map +1 -1
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js +1 -1
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +3 -3
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +1 -1
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +3 -3
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
- package/lib/cjs/src/uniswap/constants/uniswap.js +1 -1
- package/lib/cjs/src/uniswap/constants/uniswap.js.map +3 -3
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +3 -3
- package/lib/esm/package.json +1 -1
- package/lib/esm/src/ContextModuleBuilder.js +1 -1
- package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
- package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
- package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
- package/lib/esm/src/DefaultContextModule.js +1 -1
- package/lib/esm/src/DefaultContextModule.js.map +3 -3
- package/lib/esm/src/DefaultContextModule.test.js +1 -1
- package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
- package/lib/esm/src/calldata/data/CalldataDescriptorDataSource.js +1 -0
- package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js +2 -0
- package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js.map +7 -0
- package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js +2 -0
- package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js.map +7 -0
- package/lib/esm/src/calldata/di/calldataModuleFactory.js +2 -0
- package/lib/esm/src/calldata/di/calldataModuleFactory.js.map +7 -0
- package/lib/esm/src/calldata/di/calldataTypes.js +2 -0
- package/lib/esm/src/calldata/di/calldataTypes.js.map +7 -0
- package/lib/esm/src/calldata/domain/CalldataContextLoader.js +2 -0
- package/lib/esm/src/calldata/domain/CalldataContextLoader.js.map +7 -0
- package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js +2 -0
- package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js.map +7 -0
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +1 -1
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +3 -3
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +1 -1
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +3 -3
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
- package/lib/esm/src/index.js +1 -1
- package/lib/esm/src/index.js.map +2 -2
- package/lib/esm/src/nft/domain/NftContextFieldLoader.js +1 -1
- package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +3 -3
- package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +1 -1
- package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +3 -3
- package/lib/esm/src/nft/domain/NftContextLoader.js +1 -1
- package/lib/esm/src/nft/domain/NftContextLoader.js.map +3 -3
- package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
- package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +3 -3
- package/lib/esm/src/proxy/data/HttpProxyDataSource.js +1 -1
- package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +3 -3
- package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js +1 -1
- package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +3 -3
- package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
- package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
- package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
- package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
- package/lib/esm/src/proxy/data/ProxyDataSource.js +1 -0
- package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +1 -0
- package/lib/esm/src/proxy/di/proxyModuleFactory.js +1 -1
- package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +3 -3
- package/lib/esm/src/proxy/di/proxyModuleFactory.test.js +2 -0
- package/lib/esm/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
- package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +1 -1
- package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +3 -3
- package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +1 -1
- package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +3 -3
- package/lib/esm/src/shared/domain/ContextFieldLoader.js +0 -1
- package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +4 -4
- package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
- package/lib/esm/src/shared/model/ClearSignContext.js.map +2 -2
- package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +1 -1
- package/lib/esm/src/shared/utils/KeyUsageMapper.js +1 -1
- package/lib/esm/src/shared/utils/KeyUsageMapper.js.map +2 -2
- package/lib/esm/src/token/data/HttpTokenDataSource.js +1 -1
- package/lib/esm/src/token/data/HttpTokenDataSource.js.map +2 -2
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +2 -2
- package/lib/esm/src/token/domain/TokenContextFieldLoader.js +1 -1
- package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +3 -3
- package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +1 -1
- package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +3 -3
- package/lib/esm/src/token/domain/TokenContextLoader.js +1 -1
- package/lib/esm/src/token/domain/TokenContextLoader.js.map +3 -3
- package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
- package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +3 -3
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +2 -2
- package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js +1 -1
- package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +3 -3
- package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +1 -1
- package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +3 -3
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
- package/lib/esm/src/uniswap/constants/uniswap.js +1 -1
- package/lib/esm/src/uniswap/constants/uniswap.js.map +3 -3
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +3 -3
- package/lib/types/src/ContextModule.d.ts +3 -6
- package/lib/types/src/ContextModule.d.ts.map +1 -1
- package/lib/types/src/ContextModuleBuilder.d.ts +8 -1
- package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
- package/lib/types/src/DefaultContextModule.d.ts +3 -5
- package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
- package/lib/types/src/{transaction/data/TransactionDataSource.d.ts → calldata/data/CalldataDescriptorDataSource.d.ts} +4 -4
- package/lib/types/src/calldata/data/CalldataDescriptorDataSource.d.ts.map +1 -0
- package/lib/types/src/{transaction/data/HttpTransactionDataSource.d.ts → calldata/data/HttpCalldataDescriptorDataSource.d.ts} +6 -5
- package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.d.ts.map +1 -0
- package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts +2 -0
- package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts.map +1 -0
- package/lib/types/src/calldata/data/dto/CalldataDto.d.ts.map +1 -0
- package/lib/types/src/calldata/di/calldataModuleFactory.d.ts +3 -0
- package/lib/types/src/calldata/di/calldataModuleFactory.d.ts.map +1 -0
- package/lib/types/src/calldata/di/calldataTypes.d.ts +6 -0
- package/lib/types/src/calldata/di/calldataTypes.d.ts.map +1 -0
- package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts +23 -0
- package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts.map +1 -0
- package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts +2 -0
- package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/config/model/ContextModuleConfig.d.ts +7 -0
- package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +9 -4
- package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -1
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +20 -5
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
- package/lib/types/src/index.d.ts +40 -2
- package/lib/types/src/index.d.ts.map +1 -1
- package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +10 -6
- package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -1
- package/lib/types/src/nft/domain/NftContextLoader.d.ts +10 -4
- package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
- package/lib/types/src/pki/model/PkiCertificateInfo.d.ts +1 -2
- package/lib/types/src/pki/model/PkiCertificateInfo.d.ts.map +1 -1
- package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts +2 -22
- package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -1
- package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts +13 -0
- package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts.map +1 -0
- package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts +2 -0
- package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts.map +1 -0
- package/lib/types/src/proxy/data/ProxyDataSource.d.ts +17 -0
- package/lib/types/src/proxy/data/ProxyDataSource.d.ts.map +1 -0
- package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts +10 -0
- package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts.map +1 -0
- package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +2 -1
- package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -1
- package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts +2 -0
- package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts.map +1 -0
- package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +15 -7
- package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -1
- package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts +3 -1
- package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -1
- package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +13 -11
- package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -1
- package/lib/types/src/shared/domain/ContextLoader.d.ts +13 -6
- package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
- package/lib/types/src/shared/model/ClearSignContext.d.ts +1 -1
- package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
- package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +1 -1
- package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
- package/lib/types/src/shared/utils/KeyUsageMapper.d.ts +1 -2
- package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -1
- package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
- package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +9 -6
- package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -1
- package/lib/types/src/token/domain/TokenContextLoader.d.ts +10 -4
- package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts +7 -3
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
- package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts +7 -2
- package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts.map +1 -1
- package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts +4 -5
- package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts.map +1 -1
- package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +18 -7
- package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -1
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +14 -5
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +1 -1
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
- package/lib/types/src/uniswap/constants/uniswap.d.ts +0 -1
- package/lib/types/src/uniswap/constants/uniswap.d.ts.map +1 -1
- package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +10 -11
- package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/lib/cjs/src/proxy/model/ProxyImplementationAddress.js +0 -2
- package/lib/cjs/src/proxy/model/ProxyImplementationAddress.js.map +0 -7
- package/lib/cjs/src/shared/model/TransactionContext.js +0 -2
- package/lib/cjs/src/shared/model/TransactionContext.js.map +0 -7
- package/lib/cjs/src/shared/model/TransactionFieldContext.js +0 -2
- package/lib/cjs/src/shared/model/TransactionFieldContext.js.map +0 -7
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +0 -2
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
- package/lib/cjs/src/transaction/data/TransactionDataSource.js +0 -2
- package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +0 -7
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js +0 -2
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +0 -7
- package/lib/cjs/src/transaction/di/transactionTypes.js +0 -2
- package/lib/cjs/src/transaction/di/transactionTypes.js.map +0 -7
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +0 -2
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +0 -7
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +0 -2
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
- package/lib/cjs/src/uniswap/constants/plugin.js +0 -2
- package/lib/cjs/src/uniswap/constants/plugin.js.map +0 -7
- package/lib/esm/src/proxy/model/ProxyImplementationAddress.js +0 -1
- package/lib/esm/src/shared/model/TransactionContext.js +0 -1
- package/lib/esm/src/shared/model/TransactionFieldContext.js +0 -1
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +0 -2
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
- package/lib/esm/src/transaction/data/TransactionDataSource.js +0 -1
- package/lib/esm/src/transaction/data/TransactionDataSource.js.map +0 -7
- package/lib/esm/src/transaction/di/transactionModuleFactory.js +0 -2
- package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +0 -7
- package/lib/esm/src/transaction/di/transactionTypes.js +0 -2
- package/lib/esm/src/transaction/di/transactionTypes.js.map +0 -7
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js +0 -2
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +0 -7
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +0 -2
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
- package/lib/esm/src/uniswap/constants/plugin.js +0 -2
- package/lib/esm/src/uniswap/constants/plugin.js.map +0 -7
- package/lib/types/src/proxy/model/ProxyImplementationAddress.d.ts +0 -4
- package/lib/types/src/proxy/model/ProxyImplementationAddress.d.ts.map +0 -1
- package/lib/types/src/shared/model/TransactionContext.d.ts +0 -8
- package/lib/types/src/shared/model/TransactionContext.d.ts.map +0 -1
- package/lib/types/src/shared/model/TransactionFieldContext.d.ts +0 -26
- package/lib/types/src/shared/model/TransactionFieldContext.d.ts.map +0 -1
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +0 -1
- package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +0 -2
- package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +0 -1
- package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +0 -1
- package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +0 -1
- package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +0 -3
- package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +0 -1
- package/lib/types/src/transaction/di/transactionTypes.d.ts +0 -5
- package/lib/types/src/transaction/di/transactionTypes.d.ts.map +0 -1
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +0 -12
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +0 -1
- package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +0 -2
- package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +0 -1
- package/lib/types/src/uniswap/constants/plugin.d.ts +0 -3
- package/lib/types/src/uniswap/constants/plugin.d.ts.map +0 -1
- /package/lib/cjs/src/{transaction → calldata}/data/dto/CalldataDto.js +0 -0
- /package/lib/esm/src/{proxy/model/ProxyImplementationAddress.js.map → calldata/data/CalldataDescriptorDataSource.js.map} +0 -0
- /package/lib/esm/src/{transaction → calldata}/data/dto/CalldataDto.js +0 -0
- /package/lib/esm/src/{transaction → calldata}/data/dto/CalldataDto.js.map +0 -0
- /package/lib/esm/src/{shared/model/TransactionContext.js.map → proxy/data/ProxyDataSource.js.map} +0 -0
- /package/lib/esm/src/{shared/model/TransactionFieldContext.js.map → proxy/data/dto/SafeProxyImplementationAddressDto.js.map} +0 -0
- /package/lib/types/src/{transaction → calldata}/data/dto/CalldataDto.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/uniswap/constants/uniswap.ts"],
|
|
4
|
-
"sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\n\nexport const UNISWAP_EXECUTE_ABI = [\n \"function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable\",\n];\n\nexport const
|
|
5
|
-
"mappings": "AAEO,MAAMA,EAAsB,CACjC,uGACF,EAEaC,
|
|
6
|
-
"names": ["UNISWAP_EXECUTE_ABI", "
|
|
4
|
+
"sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\n\nexport const UNISWAP_EXECUTE_ABI = [\n \"function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable\",\n];\n\nexport const UNISWAP_EXECUTE_SELECTOR = \"0x3593564c\";\n\nexport enum UniswapSupportedCommand {\n V2_SWAP_EXACT_IN = \"V2_SWAP_EXACT_IN\",\n V2_SWAP_EXACT_OUT = \"V2_SWAP_EXACT_OUT\",\n V3_SWAP_EXACT_IN = \"V3_SWAP_EXACT_IN\",\n V3_SWAP_EXACT_OUT = \"V3_SWAP_EXACT_OUT\",\n WRAP_ETH = \"WRAP_ETH\",\n UNWRAP_ETH = \"UNWRAP_ETH\",\n PERMIT2_PERMIT = \"PERMIT2_PERMIT\",\n PERMIT2_TRANSFER_FROM = \"PERMIT2_TRANSFER_FROM\",\n PERMIT2_PERMIT_BATCH = \"PERMIT2_PERMIT_BATCH\",\n PERMIT2_TRANSFER_FROM_BATCH = \"PERMIT2_TRANSFER_FROM_BATCH\",\n PAY_PORTION = \"PAY_PORTION\",\n SWEEP = \"SWEEP\",\n}\n\nexport const UNISWAP_COMMANDS: Record<HexaString, UniswapSupportedCommand> = {\n \"0x08\": UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x09\": UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x00\": UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n \"0x01\": UniswapSupportedCommand.V3_SWAP_EXACT_OUT,\n \"0x0b\": UniswapSupportedCommand.WRAP_ETH,\n \"0x0c\": UniswapSupportedCommand.UNWRAP_ETH,\n \"0x0a\": UniswapSupportedCommand.PERMIT2_PERMIT,\n \"0x0d\": UniswapSupportedCommand.PERMIT2_TRANSFER_FROM,\n \"0x02\": UniswapSupportedCommand.PERMIT2_PERMIT_BATCH,\n \"0x03\": UniswapSupportedCommand.PERMIT2_TRANSFER_FROM_BATCH,\n \"0x06\": UniswapSupportedCommand.PAY_PORTION,\n \"0x04\": UniswapSupportedCommand.SWEEP,\n};\n\nexport const UNISWAP_SWAP_COMMANDS: UniswapSupportedCommand[] = [\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n UniswapSupportedCommand.V3_SWAP_EXACT_OUT,\n];\n"],
|
|
5
|
+
"mappings": "AAEO,MAAMA,EAAsB,CACjC,uGACF,EAEaC,EAA2B,aAEjC,IAAKC,OACVA,EAAA,iBAAmB,mBACnBA,EAAA,kBAAoB,oBACpBA,EAAA,iBAAmB,mBACnBA,EAAA,kBAAoB,oBACpBA,EAAA,SAAW,WACXA,EAAA,WAAa,aACbA,EAAA,eAAiB,iBACjBA,EAAA,sBAAwB,wBACxBA,EAAA,qBAAuB,uBACvBA,EAAA,4BAA8B,8BAC9BA,EAAA,YAAc,cACdA,EAAA,MAAQ,QAZEA,OAAA,IAeL,MAAMC,EAAgE,CAC3E,OAAQ,mBACR,OAAQ,oBACR,OAAQ,mBACR,OAAQ,oBACR,OAAQ,WACR,OAAQ,aACR,OAAQ,iBACR,OAAQ,wBACR,OAAQ,uBACR,OAAQ,8BACR,OAAQ,cACR,OAAQ,OACV,EAEaC,EAAmD,CAC9D,mBACA,oBACA,mBACA,mBACF",
|
|
6
|
+
"names": ["UNISWAP_EXECUTE_ABI", "UNISWAP_EXECUTE_SELECTOR", "UniswapSupportedCommand", "UNISWAP_COMMANDS", "UNISWAP_SWAP_COMMANDS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var w=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var C=(c,e,t,n)=>{for(var a=n>1?void 0:n?T(e,t):e,r=c.length-1,o;r>=0;r--)(o=c[r])&&(a=(n?o(e,t,a):o(a))||a);return n&&a&&w(e,t,a),a},p=(c,e)=>(t,n)=>e(t,n,c);import{isHexaString as d}from"@ledgerhq/device-management-kit";import{Interface as _}from"ethers";import{inject as f,injectable as H}from"inversify";import{Maybe as g,Nothing as P}from"purify-ts";import{ClearSignContextType as S}from"../../shared/model/ClearSignContext";import{tokenTypes as A}from"../../token/di/tokenTypes";import{UNISWAP_COMMANDS as I,UNISWAP_EXECUTE_ABI as k,UNISWAP_EXECUTE_SELECTOR as E,UNISWAP_SWAP_COMMANDS as U}from"../../uniswap/constants/uniswap";import{uniswapTypes as N}from"../../uniswap/di/uniswapTypes";const b=[S.TOKEN];let m=class{constructor(e,t){this.commandDecoderDataSource=e;this.tokenDataSource=t}canHandle(e,t){return typeof e=="object"&&e!==null&&"data"in e&&"selector"in e&&"chainId"in e&&typeof e.chainId=="number"&&d(e.data)&&e.data!=="0x"&&d(e.selector)&&e.selector===E&&b.every(n=>t.includes(n))}async load(e){const{data:t,chainId:n}=e;return await this._extractClearSignContexts(t,n)}async _extractClearSignContexts(e,t){try{const a=new _(k).parseTransaction({data:e}),r=a?.args[0],o=a?.args[1];if(!d(r)||!this._isHexaStringArray(o))return[];const u=this._extractCommands(r).orDefault([]);if(r.length===0||o.length!==u.length)return[];const l=u.reduce((i,s,y)=>{const h=o[y],D=this.commandDecoderDataSource.decode(s,h,t);return i.push([s,D]),i},[]);if(!this._isChainingSwapSupported(l))return[];const x=[...new Set(l.flatMap(([,i])=>i))];return(await Promise.all(x.map(i=>this.tokenDataSource.getTokenInfosPayload({address:i,chainId:t})))).map(i=>i.caseOf({Left:s=>({type:S.ERROR,error:s}),Right:s=>({type:S.TOKEN,payload:s})}))}catch{return[]}}_extractCommands(e){return g.fromNullable(e.slice(2).match(/../g)).map(t=>t.map(n=>`0x${n}`)).map(t=>t.map(n=>I[n])).chain(t=>t.every(n=>n!==void 0)?g.of(t):P)}_isChainingSwapSupported(e){let t,n;for(const[a,r]of e){if(!U.includes(a))continue;const o=a.slice(0,2);if(t&&(t!==r[0]||n!==o))return!1;t=r[r.length-1],n=o}return!0}_isHexaStringArray(e){return Array.isArray(e)&&e.every(t=>typeof t=="string"&&d(t))}};m=C([H(),p(0,f(N.CommandDecoderDataSource)),p(1,f(A.TokenDataSource))],m);export{m as UniswapContextLoader};
|
|
2
2
|
//# sourceMappingURL=UniswapContextLoader.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/uniswap/domain/UniswapContextLoader.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "iOAAA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Maybe, Nothing } from \"purify-ts\";\n\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport {\n UNISWAP_COMMANDS,\n UNISWAP_EXECUTE_ABI,\n UNISWAP_EXECUTE_SELECTOR,\n UNISWAP_SWAP_COMMANDS,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport { type CommandDecoderDataSource } from \"@/uniswap/data/CommandDecoderDataSource\";\nimport { uniswapTypes } from \"@/uniswap/di/uniswapTypes\";\n\nexport type UniswapContextInput = {\n data: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [ClearSignContextType.TOKEN];\n\n@injectable()\nexport class UniswapContextLoader\n implements ContextLoader<UniswapContextInput>\n{\n constructor(\n @inject(uniswapTypes.CommandDecoderDataSource)\n private commandDecoderDataSource: CommandDecoderDataSource,\n @inject(tokenTypes.TokenDataSource)\n private tokenDataSource: TokenDataSource,\n ) {}\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is UniswapContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"data\" in input &&\n \"selector\" in input &&\n \"chainId\" in input &&\n typeof input.chainId === \"number\" &&\n isHexaString(input.data) &&\n input.data !== \"0x\" &&\n isHexaString(input.selector) &&\n input.selector === UNISWAP_EXECUTE_SELECTOR &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: UniswapContextInput): Promise<ClearSignContext[]> {\n const { data, chainId } = input;\n return await this._extractClearSignContexts(data, chainId);\n }\n\n /**\n * Extracts and decodes the clear sign contexts from a Uniswap calldata transaction.\n *\n * This function:\n * - Parses the calldata using the Uniswap `execute` function signature.\n * - Extracts and validates the `commands` and `inputs`.\n * - Decodes the commands and ensures they match the number of inputs.\n * - Extracts addresses used in the transaction and verifies if chaining swaps are supported.\n * - Fetches token information for unique addresses.\n * - Returns an array of `ClearSignContext` objects representing either token data or errors.\n *\n * @private\n * @param {HexaString} calldata - The raw calldata of the Uniswap transaction.\n * @param {number} chainId - The blockchain chain ID where the transaction is being executed.\n * @returns {Promise<ClearSignContext[]>} - A promise resolving to an array of clear sign contexts.\n */\n private async _extractClearSignContexts(\n calldata: HexaString,\n chainId: number,\n ): Promise<ClearSignContext[]> {\n try {\n const iface = new Interface(UNISWAP_EXECUTE_ABI);\n\n const tx = iface.parseTransaction({ data: calldata });\n const commands: unknown = tx?.args[0];\n const inputs: unknown = tx?.args[1];\n\n if (!isHexaString(commands) || !this._isHexaStringArray(inputs)) {\n return [];\n }\n\n const decodedCommands = this._extractCommands(commands).orDefault([]);\n if (commands.length === 0 || inputs.length !== decodedCommands.length) {\n // Invalid commands or inputs\n return [];\n }\n\n const addressesByCommand = decodedCommands.reduce(\n (acc, command, index) => {\n const input = inputs[index]!;\n const decoded: HexaString[] = this.commandDecoderDataSource.decode(\n command,\n input,\n chainId,\n );\n\n acc.push([command, decoded]);\n\n return acc;\n },\n [] as [UniswapSupportedCommand, HexaString[]][],\n );\n\n if (!this._isChainingSwapSupported(addressesByCommand)) {\n return [];\n }\n\n const uniqueAddresses = [\n ...new Set(addressesByCommand.flatMap(([, addresses]) => addresses)),\n ];\n\n const tokensPayload = await Promise.all(\n uniqueAddresses.map((address) =>\n this.tokenDataSource.getTokenInfosPayload({ address, chainId }),\n ),\n );\n\n return tokensPayload.map((either) =>\n either.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n } catch (_) {\n return [];\n }\n }\n\n /**\n * Extracts Uniswap-supported commands from a hexadecimal string.\n * Each command is represented by one byte (2 hex characters), and this function:\n * - Maps each command to a known Uniswap command.\n * - Returns `Nothing` if any extracted command is unsupported.\n *\n * @private\n * @param {HexaString} hex - A hexadecimal string representing commands.\n * @returns {Maybe<UniswapSupportedCommand[]>} - A `Maybe` containing an array of recognized commands, or `Nothing` if any command is unsupported.\n *\n * @example\n * // Valid command extraction\n * _extractCommands('0x0008');\n * // Returns: Just(['0x00', '0x08'])\n *\n * @example\n * // Contains an unsupported command (0x05 is not supported)\n * _extractCommands('0x0005');\n * // Returns: Nothing\n *\n * @example\n * // Empty or invalid input\n * _extractCommands('0x');\n * // Returns: Nothing\n */\n private _extractCommands(hex: HexaString): Maybe<UniswapSupportedCommand[]> {\n return Maybe.fromNullable(hex.slice(2).match(/../g))\n .map((bytes) => bytes.map((b) => `0x${b}` as HexaString))\n .map((hexBytes) => hexBytes.map((b) => UNISWAP_COMMANDS[b]))\n .chain((commands) =>\n commands.every((command) => command !== undefined)\n ? Maybe.of(commands as UniswapSupportedCommand[])\n : Nothing,\n );\n }\n\n /**\n * Checks if the provided swap commands can be chained together.\n * A valid chain requires that:\n * - The output asset of the previous swap matches the input asset of the next swap.\n * - The pool version remains consistent across swaps.\n *\n * @private\n * @param {Array<[UniswapSupportedCommand, HexaString[]]>} data - An array of tuples containing a swap command and associated addresses.\n * @returns {boolean} - Returns `true` if the swap commands form a valid chain, otherwise `false`.\n *\n * @example\n * // Valid chaining: same output/input asset and pool version\n * _isChainingSwapSupported([\n * ['0x08', ['0xABC', '0xDEF']],\n * ['0x08', ['0xDEF', '0x123']]\n * ]);\n * // Returns: true\n *\n * @example\n * // Invalid chaining: different pool versions\n * _isChainingSwapSupported([\n * ['0x08', ['0xABC', '0xDEF']],\n * ['0x01', ['0xDEF', '0x123']]\n * ]);\n * // Returns: false\n *\n * @example\n * // Invalid chaining: output does not match next input\n * _isChainingSwapSupported([\n * ['0x01A1', ['0xABC', '0xDEF']],\n * ['0x01B2', ['0xXYZ', '0x123']]\n * ]);\n * // Returns: false\n */\n private _isChainingSwapSupported(\n data: [UniswapSupportedCommand, HexaString[]][],\n ): boolean {\n let lastAsset: HexaString | undefined = undefined;\n let lastPoolVersion: string | undefined = undefined;\n\n for (const [command, addresses] of data) {\n if (!UNISWAP_SWAP_COMMANDS.includes(command)) continue; // Ignore non-swap commands\n\n const poolVersion = command.slice(0, 2);\n\n if (\n lastAsset &&\n (lastAsset !== addresses[0] || lastPoolVersion !== poolVersion)\n ) {\n // Invalid chaining, return empty array\n return false;\n }\n\n // update last asset and pool version\n lastAsset = addresses[addresses.length - 1];\n lastPoolVersion = poolVersion;\n }\n\n return true;\n }\n\n /**\n * Checks if a given value is an array of hexadecimal strings.\n *\n * @private\n * @param {unknown} array - The value to check.\n * @returns {array is HexaString[]} - `true` if the value is an array of hexadecimal strings, otherwise `false`.\n */\n private _isHexaStringArray(array: unknown): array is HexaString[] {\n return (\n Array.isArray(array) &&\n array.every((item) => typeof item === \"string\" && isHexaString(item))\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "iOAAA,OAAq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EAAcnB,EAAQ,MAAM,EAAG,CAAC,EAEtC,GACEgB,IACCA,IAAcZ,EAAU,CAAC,GAAKa,IAAoBE,GAGnD,MAAO,GAITH,EAAYZ,EAAUA,EAAU,OAAS,CAAC,EAC1Ca,EAAkBE,CACpB,CAEA,MAAO,EACT,CASQ,mBAAmBC,EAAuC,CAChE,OACE,MAAM,QAAQA,CAAK,GACnBA,EAAM,MAAOC,GAAS,OAAOA,GAAS,UAAYnC,EAAamC,CAAI,CAAC,CAExE,CACF,EA9NaxC,EAANyC,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAa,wBAAwB,GAE5CF,EAAA,EAAAC,EAAOE,EAAW,eAAe,IANzB9C",
|
|
6
|
+
"names": ["isHexaString", "Interface", "inject", "injectable", "Maybe", "Nothing", "ClearSignContextType", "tokenTypes", "UNISWAP_COMMANDS", "UNISWAP_EXECUTE_ABI", "UNISWAP_EXECUTE_SELECTOR", "UNISWAP_SWAP_COMMANDS", "uniswapTypes", "SUPPORTED_TYPES", "ClearSignContextType", "UniswapContextLoader", "commandDecoderDataSource", "tokenDataSource", "input", "expectedTypes", "isHexaString", "UNISWAP_EXECUTE_SELECTOR", "type", "data", "chainId", "calldata", "tx", "Interface", "UNISWAP_EXECUTE_ABI", "commands", "inputs", "decodedCommands", "addressesByCommand", "acc", "command", "index", "decoded", "uniqueAddresses", "addresses", "address", "either", "error", "payload", "hex", "Maybe", "bytes", "b", "hexBytes", "UNISWAP_COMMANDS", "Nothing", "lastAsset", "lastPoolVersion", "UNISWAP_SWAP_COMMANDS", "poolVersion", "array", "item", "__decorateClass", "injectable", "__decorateParam", "inject", "uniswapTypes", "tokenTypes"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Interface as f}from"ethers";import{Left as b,Right as p}from"purify-ts";import{ClearSignContextType as i}from"../../shared/model/ClearSignContext";import{UNISWAP_EXECUTE_SELECTOR as n,UNISWAP_UNIVERSAL_ROUTER_ADDRESS as s,UniswapSupportedCommand as r}from"../../uniswap/constants/uniswap";import{DefaultCommandDecoderDataSource as y}from"../../uniswap/data/DefaultCommandDecoderDataSource";import{EthersAbiDecoderDataSource as u}from"../../uniswap/data/EthersAbiDecoderDataSource";import{UniswapContextLoader as x}from"./UniswapContextLoader";describe("UniswapContextLoader",()=>{const o={decode:vi.fn()},a={getTokenInfosPayload:vi.fn()};let c;describe("load",()=>{describe("with tokenDataSourceMock",()=>{beforeEach(()=>{vi.spyOn(a,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve(p(`payload-${e}`))),c=new x(new y(new u),a)}),it("should return an empty array if the selector is not UNISWAP_EXECUTE_SELECTOR",async()=>{const e={selector:"0x00000000",data:"0x00000000"},t=await c.load(e);expect(t).toEqual([])}),it("should return the external plugin context and the decoded contexts",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee",selector:n},t=await c.load(e);expect(t).toEqual([{type:i.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e"},{type:"token",payload:"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}])}),it("should return the external plugin context and the decoded contexts with a permit",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771",selector:n},t=await c.load(e);expect(t).toEqual([{type:i.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"},{type:"token",payload:"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e"}])}),it("should return an empty array if the transaction is not supported",async()=>{const e={};vi.spyOn(o,"decode").mockReturnValue([]);const t=await c.load(e);expect(t).toEqual([])}),it("should return an empty array if a command is not supported",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8",selector:n},t=await c.load(e);expect(t).toEqual([])})}),describe("with mocked ethers parseTransaction",()=>{beforeEach(()=>{vi.resetAllMocks(),c=new x(o,a)}),it("should return an array with contexts if 2 chain swaps are supported",async()=>{const e={to:s,data:n,chainId:66,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(o,"decode").mockReturnValueOnce(["0x01","0x04","0x02"]).mockReturnValueOnce(["0x02","0x03"]),vi.spyOn(a,"getTokenInfosPayload").mockImplementation(({address:l})=>Promise.resolve(p(`payload-${l}`)));const d=await c.load(e);expect(o.decode).toHaveBeenNthCalledWith(1,r.V2_SWAP_EXACT_IN,"0x0001",66),expect(o.decode).toHaveBeenNthCalledWith(2,r.V2_SWAP_EXACT_OUT,"0x0002",66),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x04",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x02",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(4,{address:"0x03",chainId:66}),expect(d).toEqual([{type:i.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0x01"},{type:"token",payload:"payload-0x04"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"}])}),it("should return an array with contexts if 1 chain swap with a non swap command",async()=>{const e={to:s,data:n,chainId:66,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:["0x0b0004",["0x0001","0x0002","0x0003"]]}),vi.spyOn(o,"decode").mockReturnValueOnce(["0x01"]).mockReturnValueOnce(["0x02","0x03"]).mockReturnValueOnce(["0x04"]),vi.spyOn(a,"getTokenInfosPayload").mockImplementation(({address:l})=>Promise.resolve(p(`payload-${l}`)));const d=await c.load(e);expect(o.decode).toHaveBeenNthCalledWith(1,r.WRAP_ETH,"0x0001",66),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x02",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x03",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(4,{address:"0x04",chainId:66}),expect(d).toEqual([{type:i.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0x01"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"},{type:"token",payload:"payload-0x04"}])}),it("should return an array with contexts if one token is not found",async()=>{const e={to:s,data:n,chainId:66,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(o,"decode").mockReturnValueOnce(["0x01","0x02"]).mockReturnValueOnce(["0x02","0x03"]),vi.spyOn(a,"getTokenInfosPayload").mockResolvedValueOnce(b("error")).mockImplementation(({address:l})=>Promise.resolve(p(`payload-${l}`)));const d=await c.load(e);expect(o.decode).toHaveBeenNthCalledWith(1,r.V2_SWAP_EXACT_IN,"0x0001",66),expect(o.decode).toHaveBeenNthCalledWith(2,r.V2_SWAP_EXACT_OUT,"0x0002",66),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x02",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x03",chainId:66}),expect(d).toEqual([{type:i.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"error",error:"error"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"}])}),it("should return an empty array if the if 2 chain swaps are not supported",async()=>{const e={to:s,data:n,chainId:66,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(o,"decode").mockReturnValueOnce(["0x01","0x02"]),vi.spyOn(o,"decode").mockReturnValueOnce(["0x03","0x04"]);const d=await c.load(e);expect(o.decode).toHaveBeenNthCalledWith(1,r.V2_SWAP_EXACT_IN,"0x0001",66),expect(o.decode).toHaveBeenNthCalledWith(2,r.V2_SWAP_EXACT_OUT,"0x0002",66),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(d).toEqual([])}),it("should return an empty array if no command are returned from parseTransaction",async()=>{const e={to:s,data:n,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:[""]});const t=await c.load(e);expect(o.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if no inputs are returned from parseTransaction",async()=>{const e={to:s,data:n,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:["0x08",[]]});const t=await c.load(e);expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if parseTransaction throws an error",async()=>{const e={to:s,data:n,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockImplementation(()=>{throw new Error});const t=await c.load(e);expect(o.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if the swap is with multiple pool versions",async()=>{const e={to:s,data:n,chainId:66,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:["0x080900",["0x00","0x01","0x02"]]}),vi.spyOn(o,"decode").mockReturnValue(["0x01","0x02"]);const d=await c.load(e);expect(o.decode).toHaveBeenNthCalledWith(1,r.V2_SWAP_EXACT_IN,"0x00",66),expect(o.decode).toHaveBeenNthCalledWith(2,r.V2_SWAP_EXACT_OUT,"0x01",66),expect(o.decode).toHaveBeenNthCalledWith(3,r.V3_SWAP_EXACT_IN,"0x02",66),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(d).toEqual([])}),it("should return an empty array if the selector is not supported",async()=>{const e={to:s,data:"0x00000000",chainId:66,selector:n},t=await c.load(e);expect(o.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if the length of the commands and inputs are different",async()=>{const e={to:s,data:n,chainId:66,selector:n};vi.spyOn(f.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001"]]});const d=await c.load(e);expect(o.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(d).toEqual([])})})})});
|
|
1
|
+
import{Interface as r}from"ethers";import{Left as y,Right as p}from"purify-ts";import{ClearSignContextType as l}from"../../shared/model/ClearSignContext";import{UNISWAP_EXECUTE_SELECTOR as o,UniswapSupportedCommand as s}from"../../uniswap/constants/uniswap";import{DefaultCommandDecoderDataSource as x}from"../../uniswap/data/DefaultCommandDecoderDataSource";import{EthersAbiDecoderDataSource as u}from"../../uniswap/data/EthersAbiDecoderDataSource";import{UniswapContextLoader as f}from"./UniswapContextLoader";describe("UniswapContextLoader",()=>{const n={decode:vi.fn()},a={getTokenInfosPayload:vi.fn()};let c;describe("canHandle function",()=>{beforeEach(()=>{c=new f(new x(new u),a)});const e={data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b",selector:o,chainId:1};it("should return true for valid input",()=>{expect(c.canHandle(e,[l.TOKEN])).toBe(!0)}),it("should return false for invalid expected type",()=>{expect(c.canHandle(e,[l.NFT])).toBe(!1),expect(c.canHandle(e,[l.EXTERNAL_PLUGIN])).toBe(!1)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"],[{...e,data:void 0},"missing data"],[{...e,selector:void 0},"missing selector"],[{...e,chainId:void 0},"missing chainId"],[{...e,data:"invalid-hex"},"invalid data hex"],[{...e,data:"0x"},"empty data hex"],[{...e,selector:"invalid-hex"},"invalid selector hex"],[{...e,selector:"0x"},"empty selector hex"],[{...e,selector:"not-hex-at-all"},"non-hex selector"],[{...e,selector:0},"different selector"],[{...e,chainId:"1"},"string chainId"],[{...e,chainId:null},"null chainId"]])("should return false for %s",(t,d)=>{expect(c.canHandle(t,[l.TOKEN])).toBe(!1)})}),describe("load",()=>{describe("with tokenDataSourceMock",()=>{beforeEach(()=>{vi.spyOn(a,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve(p(`payload-${e}`))),c=new f(new x(new u),a)}),it("should return an empty array if the selector is not UNISWAP_EXECUTE_SELECTOR",async()=>{const e={selector:"0x00000000",data:"0x00000000",chainId:1},t=await c.load(e);expect(t).toEqual([])}),it("should return the decoded contexts",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee",selector:o},t=await c.load(e);expect(t).toEqual([{type:"token",payload:"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e"},{type:"token",payload:"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}])}),it("should return the decoded contexts with a permit",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771",selector:o},t=await c.load(e);expect(t).toEqual([{type:"token",payload:"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"},{type:"token",payload:"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e"}])}),it("should return an empty array if the transaction is not supported",async()=>{const e={};vi.spyOn(n,"decode").mockReturnValue([]);const t=await c.load(e);expect(t).toEqual([])}),it("should return an empty array if a command is not supported",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8",selector:o},t=await c.load(e);expect(t).toEqual([])})}),describe("with mocked ethers parseTransaction",()=>{beforeEach(()=>{vi.resetAllMocks(),c=new f(n,a)}),it("should return an array with contexts if 2 chain swaps are supported",async()=>{const e={data:o,chainId:66,selector:o};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(n,"decode").mockReturnValueOnce(["0x01","0x04","0x02"]).mockReturnValueOnce(["0x02","0x03"]),vi.spyOn(a,"getTokenInfosPayload").mockImplementation(({address:i})=>Promise.resolve(p(`payload-${i}`)));const d=await c.load(e);expect(n.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x0001",66),expect(n.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x0002",66),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x04",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x02",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(4,{address:"0x03",chainId:66}),expect(d).toEqual([{type:"token",payload:"payload-0x01"},{type:"token",payload:"payload-0x04"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"}])}),it("should return an array with contexts if 1 chain swap with a non swap command",async()=>{const e={data:o,chainId:66,selector:o};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0b0004",["0x0001","0x0002","0x0003"]]}),vi.spyOn(n,"decode").mockReturnValueOnce(["0x01"]).mockReturnValueOnce(["0x02","0x03"]).mockReturnValueOnce(["0x04"]),vi.spyOn(a,"getTokenInfosPayload").mockImplementation(({address:i})=>Promise.resolve(p(`payload-${i}`)));const d=await c.load(e);expect(n.decode).toHaveBeenNthCalledWith(1,s.WRAP_ETH,"0x0001",66),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x02",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x03",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(4,{address:"0x04",chainId:66}),expect(d).toEqual([{type:"token",payload:"payload-0x01"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"},{type:"token",payload:"payload-0x04"}])}),it("should return an array with contexts if one token is not found",async()=>{const e={data:o,chainId:66,selector:o};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(n,"decode").mockReturnValueOnce(["0x01","0x02"]).mockReturnValueOnce(["0x02","0x03"]),vi.spyOn(a,"getTokenInfosPayload").mockResolvedValueOnce(y("error")).mockImplementation(({address:i})=>Promise.resolve(p(`payload-${i}`)));const d=await c.load(e);expect(n.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x0001",66),expect(n.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x0002",66),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x02",chainId:66}),expect(a.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x03",chainId:66}),expect(d).toEqual([{type:"error",error:"error"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"}])}),it("should return an empty array if the if 2 chain swaps are not supported",async()=>{const e={data:o,chainId:66,selector:o};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(n,"decode").mockReturnValueOnce(["0x01","0x02"]),vi.spyOn(n,"decode").mockReturnValueOnce(["0x03","0x04"]);const d=await c.load(e);expect(n.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x0001",66),expect(n.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x0002",66),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(d).toEqual([])}),it("should return an empty array if no command are returned from parseTransaction",async()=>{const e={data:o,selector:o,chainId:1};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:[""]});const t=await c.load(e);expect(n.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if no inputs are returned from parseTransaction",async()=>{const e={data:o,selector:o,chainId:1};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x08",[]]}),vi.spyOn(n,"decode").mockReturnValue([]);const t=await c.load(e);expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if parseTransaction throws an error",async()=>{const e={data:o,selector:o,chainId:1};vi.spyOn(r.prototype,"parseTransaction").mockImplementation(()=>{throw new Error});const t=await c.load(e);expect(n.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if the swap is with multiple pool versions",async()=>{const e={data:o,chainId:66,selector:o};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x080900",["0x00","0x01","0x02"]]}),vi.spyOn(n,"decode").mockReturnValue(["0x01","0x02"]);const d=await c.load(e);expect(n.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x00",66),expect(n.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x01",66),expect(n.decode).toHaveBeenNthCalledWith(3,s.V3_SWAP_EXACT_IN,"0x02",66),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(d).toEqual([])}),it("should return an empty array if the selector is not supported",async()=>{const e={data:"0x00000000",chainId:66,selector:o},t=await c.load(e);expect(n.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(t).toEqual([])}),it("should return an empty array if the length of the commands and inputs are different",async()=>{const e={data:o,chainId:66,selector:o};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001"]]});const d=await c.load(e);expect(n.decode).not.toHaveBeenCalled(),expect(a.getTokenInfosPayload).not.toHaveBeenCalled(),expect(d).toEqual([])})})})});
|
|
2
2
|
//# sourceMappingURL=UniswapContextLoader.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/uniswap/domain/UniswapContextLoader.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { Interface, type TransactionDescription } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport {\n UNISWAP_EXECUTE_SELECTOR,\n UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport { type CommandDecoderDataSource } from \"@/uniswap/data/CommandDecoderDataSource\";\nimport { DefaultCommandDecoderDataSource } from \"@/uniswap/data/DefaultCommandDecoderDataSource\";\nimport { EthersAbiDecoderDataSource } from \"@/uniswap/data/EthersAbiDecoderDataSource\";\n\nimport { UniswapContextLoader } from \"./UniswapContextLoader\";\n\ndescribe(\"UniswapContextLoader\", () => {\n const commandDecoderMock: CommandDecoderDataSource = {\n decode: vi.fn(),\n };\n const tokenDataSourceMock = {\n getTokenInfosPayload: vi.fn(),\n };\n let loader: UniswapContextLoader;\n\n describe(\"load\", () => {\n describe(\"with tokenDataSourceMock\", () => {\n beforeEach(() => {\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n loader = new UniswapContextLoader(\n new DefaultCommandDecoderDataSource(new EthersAbiDecoderDataSource()),\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an empty array if the selector is not UNISWAP_EXECUTE_SELECTOR\", async () => {\n // GIVEN\n const transactionContext = {\n selector: \"0x00000000\",\n data: \"0x00000000\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return the external plugin context and the decoded contexts\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc9821c32c1782d9ab6baf6f9ca4b2565bce11aaf5146a2d303215bda026f5e48\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e\",\n }, // ERC20\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n ]);\n });\n\n it(\"should return the external plugin context and the decoded contexts with a permit\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc4df7ccc0527541d0e80856a8f38deedc48c84825e9355469ba02d873502ce2f\n // PERMIT2_PERMIT, V3_SWAP_EXACT_OUT, UNWRAP_ETH\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n {\n type: \"token\",\n payload: \"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e\",\n }, // ERC20\n ]);\n });\n\n it(\"should return an empty array if the transaction is not supported\", async () => {\n // GIVEN\n const transactionContext = {} as TransactionContext;\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if a command is not supported\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xa628c8b3da2ad984aed0354d8ca4b4c3c42941491dc4e0d6a5f423fd65e6c90a\n // The command 0x05 (TRANSFER) is not supported\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe(\"with mocked ethers parseTransaction\", () => {\n beforeEach(() => {\n vi.resetAllMocks();\n loader = new UniswapContextLoader(\n commandDecoderMock,\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an array with contexts if 2 chain swaps are supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\", \"0x04\", \"0x02\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"]);\n\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x04\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if 1 chain swap with a non swap command\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0b0004`; // WRAP_ETH, V3_SWAP_EXACT_IN, SWEEP\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\", \"0x0003\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"])\n .mockReturnValueOnce([\"0x04\"]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.WRAP_ETH,\n \"0x0001\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x04\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if one token is not found\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\", \"0x02\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"]);\n vi.spyOn(tokenDataSourceMock, \"getTokenInfosPayload\")\n .mockResolvedValueOnce(Left(\"error\"))\n .mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"error\",\n error: \"error\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an empty array if the if 2 chain swaps are not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x03\", // should be 0x02\n \"0x04\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no command are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"\"],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no inputs are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"0x08\", []],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if parseTransaction throws an error\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockImplementation(\n () => {\n throw new Error();\n },\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the swap is with multiple pool versions\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x080900`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT, V3_SWAP_EXACT_IN\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x00\", \"0x01\", \"0x02\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([\n \"0x01\",\n \"0x02\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x00\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x01\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 3,\n UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n \"0x02\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the selector is not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: \"0x00000000\",\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the length of the commands and inputs are different\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\"]],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,aAAAA,MAA8C,SACvD,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,
|
|
6
|
-
"names": ["Interface", "Left", "Right", "ClearSignContextType", "UNISWAP_EXECUTE_SELECTOR", "
|
|
4
|
+
"sourcesContent": ["import { Interface, type TransactionDescription } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport {\n UNISWAP_EXECUTE_SELECTOR,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport { type CommandDecoderDataSource } from \"@/uniswap/data/CommandDecoderDataSource\";\nimport { DefaultCommandDecoderDataSource } from \"@/uniswap/data/DefaultCommandDecoderDataSource\";\nimport { EthersAbiDecoderDataSource } from \"@/uniswap/data/EthersAbiDecoderDataSource\";\n\nimport {\n type UniswapContextInput,\n UniswapContextLoader,\n} from \"./UniswapContextLoader\";\n\ndescribe(\"UniswapContextLoader\", () => {\n const commandDecoderMock: CommandDecoderDataSource = {\n decode: vi.fn(),\n };\n const tokenDataSourceMock = {\n getTokenInfosPayload: vi.fn(),\n };\n let loader: UniswapContextLoader;\n\n describe(\"canHandle function\", () => {\n beforeEach(() => {\n loader = new UniswapContextLoader(\n new DefaultCommandDecoderDataSource(new EthersAbiDecoderDataSource()),\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n const validInput: UniswapContextInput = {\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n chainId: 1,\n };\n\n it(\"should return true for valid input\", () => {\n expect(loader.canHandle(validInput, [ClearSignContextType.TOKEN])).toBe(\n true,\n );\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(loader.canHandle(validInput, [ClearSignContextType.NFT])).toBe(\n false,\n );\n expect(\n loader.canHandle(validInput, [ClearSignContextType.EXTERNAL_PLUGIN]),\n ).toBe(false);\n });\n\n it.each([\n [null, \"null input\"],\n [undefined, \"undefined input\"],\n [{}, \"empty object\"],\n [\"string\", \"string input\"],\n [123, \"number input\"],\n [{ ...validInput, data: undefined }, \"missing data\"],\n [{ ...validInput, selector: undefined }, \"missing selector\"],\n [{ ...validInput, chainId: undefined }, \"missing chainId\"],\n [{ ...validInput, data: \"invalid-hex\" }, \"invalid data hex\"],\n [{ ...validInput, data: \"0x\" }, \"empty data hex\"],\n [{ ...validInput, selector: \"invalid-hex\" }, \"invalid selector hex\"],\n [{ ...validInput, selector: \"0x\" }, \"empty selector hex\"],\n [{ ...validInput, selector: \"not-hex-at-all\" }, \"non-hex selector\"],\n [{ ...validInput, selector: 0x00000000 }, \"different selector\"],\n [{ ...validInput, chainId: \"1\" }, \"string chainId\"],\n [{ ...validInput, chainId: null }, \"null chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(loader.canHandle(input, [ClearSignContextType.TOKEN])).toBe(false);\n });\n });\n\n describe(\"load\", () => {\n describe(\"with tokenDataSourceMock\", () => {\n beforeEach(() => {\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n loader = new UniswapContextLoader(\n new DefaultCommandDecoderDataSource(new EthersAbiDecoderDataSource()),\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an empty array if the selector is not UNISWAP_EXECUTE_SELECTOR\", async () => {\n // GIVEN\n const input: UniswapContextInput = {\n selector: \"0x00000000\" as const,\n data: \"0x00000000\" as const,\n chainId: 1,\n };\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return the decoded contexts\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc9821c32c1782d9ab6baf6f9ca4b2565bce11aaf5146a2d303215bda026f5e48\n const input: UniswapContextInput = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n };\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: \"token\",\n payload: \"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e\",\n }, // ERC20\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n ]);\n });\n\n it(\"should return the decoded contexts with a permit\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc4df7ccc0527541d0e80856a8f38deedc48c84825e9355469ba02d873502ce2f\n // PERMIT2_PERMIT, V3_SWAP_EXACT_OUT, UNWRAP_ETH\n const input = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as UniswapContextInput;\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n {\n type: \"token\",\n payload: \"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e\",\n }, // ERC20\n ]);\n });\n\n it(\"should return an empty array if the transaction is not supported\", async () => {\n // GIVEN\n const input = {} as UniswapContextInput;\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([]);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if a command is not supported\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xa628c8b3da2ad984aed0354d8ca4b4c3c42941491dc4e0d6a5f423fd65e6c90a\n // The command 0x05 (TRANSFER) is not supported\n const input: UniswapContextInput = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n };\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe(\"with mocked ethers parseTransaction\", () => {\n beforeEach(() => {\n vi.resetAllMocks();\n loader = new UniswapContextLoader(\n commandDecoderMock,\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an array with contexts if 2 chain swaps are supported\", async () => {\n // GIVEN\n const input = {\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as UniswapContextInput;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\", \"0x04\", \"0x02\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"]);\n\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x04\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if 1 chain swap with a non swap command\", async () => {\n // GIVEN\n const input = {\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as UniswapContextInput;\n const commands = `0x0b0004`; // WRAP_ETH, V3_SWAP_EXACT_IN, SWEEP\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\", \"0x0003\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"])\n .mockReturnValueOnce([\"0x04\"]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.WRAP_ETH,\n \"0x0001\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x04\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if one token is not found\", async () => {\n // GIVEN\n const input = {\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as UniswapContextInput;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\", \"0x02\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"]);\n vi.spyOn(tokenDataSourceMock, \"getTokenInfosPayload\")\n .mockResolvedValueOnce(Left(\"error\"))\n .mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: \"error\",\n error: \"error\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an empty array if the if 2 chain swaps are not supported\", async () => {\n // GIVEN\n const input = {\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as UniswapContextInput;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x03\", // should be 0x02\n \"0x04\",\n ]);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no command are returned from parseTransaction\", async () => {\n // GIVEN\n const input: UniswapContextInput = {\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n chainId: 1,\n };\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"\"],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no inputs are returned from parseTransaction\", async () => {\n // GIVEN\n const input: UniswapContextInput = {\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n chainId: 1,\n };\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"0x08\", []],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([]);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if parseTransaction throws an error\", async () => {\n // GIVEN\n const input: UniswapContextInput = {\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n chainId: 1,\n };\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockImplementation(\n () => {\n throw new Error();\n },\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the swap is with multiple pool versions\", async () => {\n // GIVEN\n const input: UniswapContextInput = {\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n };\n const commands = `0x080900`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT, V3_SWAP_EXACT_IN\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x00\", \"0x01\", \"0x02\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([\n \"0x01\",\n \"0x02\",\n ]);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x00\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x01\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 3,\n UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n \"0x02\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the selector is not supported\", async () => {\n // GIVEN\n const input = {\n data: \"0x00000000\",\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as UniswapContextInput;\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the length of the commands and inputs are different\", async () => {\n // GIVEN\n const input = {\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as UniswapContextInput;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\"]],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,aAAAA,MAA8C,SACvD,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,kCAErC,OACE,4BAAAC,EACA,2BAAAC,MACK,8BAEP,OAAS,mCAAAC,MAAuC,iDAChD,OAAS,8BAAAC,MAAkC,4CAE3C,OAEE,wBAAAC,MACK,yBAEP,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA+C,CACnD,OAAQ,GAAG,GAAG,CAChB,EACMC,EAAsB,CAC1B,qBAAsB,GAAG,GAAG,CAC9B,EACA,IAAIC,EAEJ,SAAS,qBAAsB,IAAM,CACnC,WAAW,IAAM,CACfA,EAAS,IAAIH,EACX,IAAIF,EAAgC,IAAIC,CAA4B,EACpEG,CACF,CACF,CAAC,EAED,MAAME,EAAkC,CACtC,KAAM,6MACN,SAAUR,EACV,QAAS,CACX,EAEA,GAAG,qCAAsC,IAAM,CAC7C,OAAOO,EAAO,UAAUC,EAAY,CAACT,EAAqB,KAAK,CAAC,CAAC,EAAE,KACjE,EACF,CACF,CAAC,EAED,GAAG,gDAAiD,IAAM,CACxD,OAAOQ,EAAO,UAAUC,EAAY,CAACT,EAAqB,GAAG,CAAC,CAAC,EAAE,KAC/D,EACF,EACA,OACEQ,EAAO,UAAUC,EAAY,CAACT,EAAqB,eAAe,CAAC,CACrE,EAAE,KAAK,EAAK,CACd,CAAC,EAED,GAAG,KAAK,CACN,CAAC,KAAM,YAAY,EACnB,CAAC,OAAW,iBAAiB,EAC7B,CAAC,CAAC,EAAG,cAAc,EACnB,CAAC,SAAU,cAAc,EACzB,CAAC,IAAK,cAAc,EACpB,CAAC,CAAE,GAAGS,EAAY,KAAM,MAAU,EAAG,c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iBAAiB,EACvD,OAAOC,EAAoB,oBAAoB,EAAE,IAAI,iBAAiB,EACtE,OAAOM,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["Interface", "Left", "Right", "ClearSignContextType", "UNISWAP_EXECUTE_SELECTOR", "UniswapSupportedCommand", "DefaultCommandDecoderDataSource", "EthersAbiDecoderDataSource", "UniswapContextLoader", "commandDecoderMock", "tokenDataSourceMock", "loader", "validInput", "input", "_description", "address", "result"]
|
|
7
7
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { type ClearSignContext } from "./shared/model/ClearSignContext";
|
|
2
|
-
import { type ContextFieldLoaderKind } from "./shared/domain/ContextFieldLoader";
|
|
1
|
+
import { type ClearSignContext, type ClearSignContextType } from "./shared/model/ClearSignContext";
|
|
3
2
|
import { type SolanaTransactionContext } from "./shared/model/SolanaTransactionContext";
|
|
4
|
-
import { type TransactionContext } from "./shared/model/TransactionContext";
|
|
5
|
-
import { type TransactionFieldContext } from "./shared/model/TransactionFieldContext";
|
|
6
3
|
import { type TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
|
|
7
4
|
import { type TypedDataContext } from "./shared/model/TypedDataContext";
|
|
8
5
|
import { type SolanaTransactionContextResult } from "./solana/domain/solanaContextTypes";
|
|
9
6
|
import { type Web3CheckContext } from "./web3-check/domain/web3CheckTypes";
|
|
10
7
|
export interface ContextModule {
|
|
11
|
-
getContexts(
|
|
12
|
-
getFieldContext<
|
|
8
|
+
getContexts<TInput>(input: TInput, expectedTypes?: ClearSignContextType[]): Promise<ClearSignContext[]>;
|
|
9
|
+
getFieldContext<TInput>(field: TInput, expectedType: ClearSignContextType): Promise<ClearSignContext>;
|
|
13
10
|
getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
|
|
14
11
|
getWeb3Checks(transactionContext: Web3CheckContext): Promise<ClearSignContext | null>;
|
|
15
12
|
getSolanaContext(transactionContext: SolanaTransactionContext): Promise<SolanaTransactionContextResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextModule.d.ts","sourceRoot":"","sources":["../../../src/ContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ContextModule.d.ts","sourceRoot":"","sources":["../../../src/ContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,oBAAoB,EAAE,GACrC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC/B,eAAe,CAAC,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,oBAAoB,GACjC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7B,mBAAmB,CACjB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,aAAa,CACX,kBAAkB,EAAE,gBAAgB,GACnC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACpC,gBAAgB,CACd,kBAAkB,EAAE,wBAAwB,GAC3C,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAC5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ContextModuleConstructorArgs } from "./config/model/ContextModuleBuildArgs";
|
|
2
|
-
import { type ContextModuleCalConfig, type ContextModuleConfig, type ContextModuleMetadataServiceConfig, type ContextModuleWeb3ChecksConfig } from "./config/model/ContextModuleConfig";
|
|
2
|
+
import { type ContextModuleCalConfig, type ContextModuleConfig, type ContextModuleDatasourceConfig, type ContextModuleMetadataServiceConfig, type ContextModuleWeb3ChecksConfig } from "./config/model/ContextModuleConfig";
|
|
3
3
|
import { type ContextLoader } from "./shared/domain/ContextLoader";
|
|
4
4
|
import { type SolanaContextLoader } from "./solana/domain/SolanaContextLoader";
|
|
5
5
|
import { type TypedDataContextLoader } from "./typed-data/domain/TypedDataContextLoader";
|
|
@@ -66,6 +66,13 @@ export declare class ContextModuleBuilder {
|
|
|
66
66
|
* @returns this
|
|
67
67
|
*/
|
|
68
68
|
setWeb3ChecksConfig(web3ChecksConfig: ContextModuleWeb3ChecksConfig): this;
|
|
69
|
+
/**
|
|
70
|
+
* Add datasource configuration
|
|
71
|
+
*
|
|
72
|
+
* @param datasourceConfig
|
|
73
|
+
* @returns this
|
|
74
|
+
*/
|
|
75
|
+
setDatasourceConfig(datasourceConfig: ContextModuleDatasourceConfig): this;
|
|
69
76
|
/**
|
|
70
77
|
* Build the context module
|
|
71
78
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextModuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/ContextModuleBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,kCAAkC,EACvC,KAAK,6BAA6B,EACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,KAAK,sBAAsB,EAAE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;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,sBAAsB;IAK9C;;;;;OAKG;IACH,wBAAwB,CACtB,qBAAqB,EAAE,kCAAkC;IAM3D;;;;;OAKG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,6BAA6B;IAKnE;;;;;OAKG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,6BAA6B;IAKnE;;;;OAIG;IACH,KAAK,IAAI,aAAa;CAQvB"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
|
|
2
2
|
import type { TypedDataContext } from "./shared/model/TypedDataContext";
|
|
3
3
|
import { type ContextModuleConfig } from "./config/model/ContextModuleConfig";
|
|
4
|
-
import { type ContextFieldLoaderKind } from "./shared/domain/ContextFieldLoader";
|
|
5
4
|
import { type ClearSignContext, type ClearSignContextSuccess, ClearSignContextType } from "./shared/model/ClearSignContext";
|
|
6
5
|
import { type SolanaTransactionContext } from "./shared/model/SolanaTransactionContext";
|
|
7
|
-
import { type TransactionContext } from "./shared/model/TransactionContext";
|
|
8
|
-
import { type TransactionFieldContext } from "./shared/model/TransactionFieldContext";
|
|
9
6
|
import { type SolanaTransactionContextResult } from "./solana/domain/solanaContextTypes";
|
|
10
7
|
import { type Web3CheckContext } from "./web3-check/domain/web3CheckTypes";
|
|
11
8
|
import { type ContextModule } from "./ContextModule";
|
|
@@ -17,12 +14,13 @@ export declare class DefaultContextModule implements ContextModule {
|
|
|
17
14
|
private _solanaLoader;
|
|
18
15
|
private _fieldLoaders;
|
|
19
16
|
constructor(args: ContextModuleConfig);
|
|
17
|
+
private _getDefaultFieldLoaders;
|
|
20
18
|
private _getDefaultLoaders;
|
|
21
19
|
private _getDefaultTypedDataLoader;
|
|
22
20
|
private _getWeb3CheckLoader;
|
|
23
21
|
private _getSolanaLoader;
|
|
24
|
-
getContexts(
|
|
25
|
-
getFieldContext<
|
|
22
|
+
getContexts(input: unknown, expectedTypes?: ClearSignContextType[]): Promise<ClearSignContext[]>;
|
|
23
|
+
getFieldContext<TInput>(field: TInput, expectedType: ClearSignContextType): Promise<ClearSignContext>;
|
|
26
24
|
getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
|
|
27
25
|
getWeb3Checks(transactionContext: Web3CheckContext): Promise<ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null>;
|
|
28
26
|
getSolanaContext(transactionContext: SolanaTransactionContext): Promise<SolanaTransactionContextResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAM9E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAGxF,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AAMzF,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,aAAa,CAAgC;gBAEzC,IAAI,EAAE,mBAAmB;IAkBrC,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,0BAA0B;IAMlC,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,gBAAgB;IAiBX,WAAW,CACtB,KAAK,EAAE,OAAO,EACd,aAAa,CAAC,EAAE,oBAAoB,EAAE,GACrC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAUjB,eAAe,CAAC,MAAM,EACjC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,oBAAoB,GACjC,OAAO,CAAC,gBAAgB,CAAC;IA4Bf,mBAAmB,CAC9B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC;IAIxB,aAAa,CACxB,kBAAkB,EAAE,gBAAgB,GACnC,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAa9D,gBAAgB,CAC3B,kBAAkB,EAAE,wBAAwB,GAC3C,OAAO,CAAC,8BAA8B,CAAC;CAG3C"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type DeviceModelId, type HexaString } from "@ledgerhq/device-management-kit";
|
|
2
2
|
import { type Either } from "purify-ts";
|
|
3
3
|
import { type ClearSignContextSuccess } from "../../shared/model/ClearSignContext";
|
|
4
|
-
export type
|
|
4
|
+
export type GetCalldataDescriptorsParams = {
|
|
5
5
|
address: string;
|
|
6
6
|
chainId: number;
|
|
7
7
|
selector: HexaString;
|
|
8
8
|
deviceModelId: DeviceModelId;
|
|
9
9
|
};
|
|
10
|
-
export interface
|
|
11
|
-
|
|
10
|
+
export interface CalldataDescriptorDataSource {
|
|
11
|
+
getCalldataDescriptors(params: GetCalldataDescriptorsParams): Promise<Either<Error, ClearSignContextSuccess[]>>;
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=CalldataDescriptorDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalldataDescriptorDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/calldata/data/CalldataDescriptorDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,UAAU,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,sBAAsB,CACpB,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC;CACtD"}
|
|
@@ -2,12 +2,13 @@ import { Either } from "purify-ts";
|
|
|
2
2
|
import { type ContextModuleConfig } from "../../config/model/ContextModuleConfig";
|
|
3
3
|
import { type PkiCertificateLoader } from "../../pki/domain/PkiCertificateLoader";
|
|
4
4
|
import { ClearSignContextSuccess } from "../../shared/model/ClearSignContext";
|
|
5
|
-
import {
|
|
6
|
-
export declare class
|
|
5
|
+
import { CalldataDescriptorDataSource, GetCalldataDescriptorsParams } from "./CalldataDescriptorDataSource";
|
|
6
|
+
export declare class HttpCalldataDescriptorDataSource implements CalldataDescriptorDataSource {
|
|
7
7
|
private readonly config;
|
|
8
8
|
private readonly _certificateLoader;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
private readonly endpoint;
|
|
10
|
+
constructor(config: ContextModuleConfig, _certificateLoader: PkiCertificateLoader, endpoint: string);
|
|
11
|
+
getCalldataDescriptors({ chainId, address, selector, deviceModelId, }: GetCalldataDescriptorsParams): Promise<Either<Error, ClearSignContextSuccess[]>>;
|
|
11
12
|
private getReference;
|
|
12
13
|
private toGenericPath;
|
|
13
14
|
private isCalldataDescriptorV1;
|
|
@@ -20,4 +21,4 @@ export declare class HttpTransactionDataSource implements TransactionDataSource
|
|
|
20
21
|
private isCalldataDescriptorValueBinaryPathV1;
|
|
21
22
|
private isPathElementV1;
|
|
22
23
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=HttpCalldataDescriptorDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpCalldataDescriptorDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/calldata/data/HttpCalldataDescriptorDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAGhD,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAS9E,OAAO,EAGL,uBAAuB,EAExB,MAAM,iCAAiC,CAAC;AAuBzC,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAExC,qBACa,gCACX,YAAW,4BAA4B;IAGT,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEnD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAHoB,MAAM,EAAE,mBAAmB,EAEvD,kBAAkB,EAAE,oBAAoB,EACxC,QAAQ,EAAE,MAAM;IAGtB,sBAAsB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,QAAQ,EACR,aAAa,GACd,EAAE,4BAA4B,GAAG,OAAO,CACvC,MAAM,CAAC,KAAK,EAAE,uBAAuB,EAAE,CAAC,CACzC;IAsHD,OAAO,CAAC,YAAY;IA0EpB,OAAO,CAAC,aAAa;IAwBrB,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,QAAQ;IAsBhB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,SAAS;IAqCjB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,mCAAmC;IAU3C,OAAO,CAAC,qCAAqC;IAc7C,OAAO,CAAC,eAAe;CAqBxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpCalldataDescriptorDataSource.test.d.ts","sourceRoot":"","sources":["../../../../../src/calldata/data/HttpCalldataDescriptorDataSource.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalldataDto.d.ts","sourceRoot":"","sources":["../../../../../../src/calldata/data/dto/CalldataDto.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,oBAAoB,EAAE;QACpB,CAAC,OAAO,EAAE,MAAM,GAAG;YACjB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAAC;SACxC,CAAC;KACH,CAAC;CACH;AAED,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IACd,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,E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