@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
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Container as u}from"inversify";import{configTypes as f}from"../../config/di/configTypes";import{pkiTypes as x}from"../../pki/di/pkiTypes";import{HttpProxyDataSource as i}from"../../proxy/data/HttpProxyDataSource";import{HttpSafeProxyDataSource as l}from"../../proxy/data/HttpSafeProxyDataSource";import{ProxyContextFieldLoader as c}from"../../proxy/domain/ProxyContextFieldLoader";import{proxyModuleFactory as n}from"./proxyModuleFactory";import{proxyTypes as r}from"./proxyTypes";describe("proxyModuleFactory",()=>{let o;const d={metadataServiceDomain:{url:"https://metadata.api.live.ledger.com"},originToken:"test-origin-token"},s={loadCertificate:vi.fn()};beforeEach(()=>{o=new u,o.bind(f.Config).toConstantValue(d),o.bind(x.PkiCertificateLoader).toConstantValue(s)}),describe("when config is undefined",()=>{it("should bind HttpProxyDataSource as the default ProxyDataSource",()=>{const a=n();o.load(a);const e=o.get(r.ProxyDataSource);expect(e).toBeInstanceOf(i)}),it("should bind ProxyContextFieldLoader",()=>{const a=n();o.load(a);const e=o.get(r.ProxyContextFieldLoader);expect(e).toBeInstanceOf(c)})}),describe("when config.datasource.proxy is 'safe'",()=>{it("should bind HttpSafeProxyDataSource as the ProxyDataSource",()=>{const e=n({datasource:{proxy:"safe"}});o.load(e);const t=o.get(r.ProxyDataSource);expect(t).toBeInstanceOf(l)}),it("should bind ProxyContextFieldLoader",()=>{const e=n({datasource:{proxy:"safe"}});o.load(e);const t=o.get(r.ProxyContextFieldLoader);expect(t).toBeInstanceOf(c)})}),describe("when config.datasource.proxy is 'default'",()=>{it("should bind HttpProxyDataSource as the ProxyDataSource",()=>{const e=n({datasource:{proxy:"default"}});o.load(e);const t=o.get(r.ProxyDataSource);expect(t).toBeInstanceOf(i)})}),describe("when config.datasource is undefined",()=>{it("should bind HttpProxyDataSource as the default ProxyDataSource",()=>{const e=n({});o.load(e);const t=o.get(r.ProxyDataSource);expect(t).toBeInstanceOf(i)})}),describe("when config.datasource.proxy is an unexpected value",()=>{it("should bind HttpProxyDataSource as the default ProxyDataSource",()=>{const e=n({datasource:{proxy:"unknown"}});o.load(e);const t=o.get(r.ProxyDataSource);expect(t).toBeInstanceOf(i)})})});
|
|
2
|
+
//# sourceMappingURL=proxyModuleFactory.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/proxy/di/proxyModuleFactory.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { HttpProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { HttpSafeProxyDataSource } from \"@/proxy/data/HttpSafeProxyDataSource\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\n\nimport { proxyModuleFactory } from \"./proxyModuleFactory\";\nimport { proxyTypes } from \"./proxyTypes\";\n\ndescribe(\"proxyModuleFactory\", () => {\n let container: Container;\n const mockConfig: ContextModuleConfig = {\n metadataServiceDomain: {\n url: \"https://metadata.api.live.ledger.com\",\n },\n originToken: \"test-origin-token\",\n } as ContextModuleConfig;\n\n const mockPkiCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n\n beforeEach(() => {\n container = new Container();\n // Bind the config that the datasources depend on\n container.bind(configTypes.Config).toConstantValue(mockConfig);\n // Bind the PKI certificate loader that ProxyContextFieldLoader depends on\n container\n .bind(pkiTypes.PkiCertificateLoader)\n .toConstantValue(mockPkiCertificateLoader);\n });\n\n describe(\"when config is undefined\", () => {\n it(\"should bind HttpProxyDataSource as the default ProxyDataSource\", () => {\n const module = proxyModuleFactory();\n container.load(module);\n\n const proxyDataSource = container.get(proxyTypes.ProxyDataSource);\n expect(proxyDataSource).toBeInstanceOf(HttpProxyDataSource);\n });\n\n it(\"should bind ProxyContextFieldLoader\", () => {\n const module = proxyModuleFactory();\n container.load(module);\n\n const proxyContextFieldLoader = container.get(\n proxyTypes.ProxyContextFieldLoader,\n );\n expect(proxyContextFieldLoader).toBeInstanceOf(ProxyContextFieldLoader);\n });\n });\n\n describe(\"when config.datasource.proxy is 'safe'\", () => {\n it(\"should bind HttpSafeProxyDataSource as the ProxyDataSource\", () => {\n const config: ContextModuleConfig = {\n datasource: {\n proxy: \"safe\",\n },\n } as ContextModuleConfig;\n\n const module = proxyModuleFactory(config);\n container.load(module);\n\n const proxyDataSource = container.get(proxyTypes.ProxyDataSource);\n expect(proxyDataSource).toBeInstanceOf(HttpSafeProxyDataSource);\n });\n\n it(\"should bind ProxyContextFieldLoader\", () => {\n const config: ContextModuleConfig = {\n datasource: {\n proxy: \"safe\",\n },\n } as ContextModuleConfig;\n\n const module = proxyModuleFactory(config);\n container.load(module);\n\n const proxyContextFieldLoader = container.get(\n proxyTypes.ProxyContextFieldLoader,\n );\n expect(proxyContextFieldLoader).toBeInstanceOf(ProxyContextFieldLoader);\n });\n });\n\n describe(\"when config.datasource.proxy is 'default'\", () => {\n it(\"should bind HttpProxyDataSource as the ProxyDataSource\", () => {\n const config: ContextModuleConfig = {\n datasource: {\n proxy: \"default\",\n },\n } as ContextModuleConfig;\n\n const module = proxyModuleFactory(config);\n container.load(module);\n\n const proxyDataSource = container.get(proxyTypes.ProxyDataSource);\n expect(proxyDataSource).toBeInstanceOf(HttpProxyDataSource);\n });\n });\n\n describe(\"when config.datasource is undefined\", () => {\n it(\"should bind HttpProxyDataSource as the default ProxyDataSource\", () => {\n const config: ContextModuleConfig = {} as ContextModuleConfig;\n\n const module = proxyModuleFactory(config);\n container.load(module);\n\n const proxyDataSource = container.get(proxyTypes.ProxyDataSource);\n expect(proxyDataSource).toBeInstanceOf(HttpProxyDataSource);\n });\n });\n\n describe(\"when config.datasource.proxy is an unexpected value\", () => {\n it(\"should bind HttpProxyDataSource as the default ProxyDataSource\", () => {\n const config: ContextModuleConfig = {\n datasource: {\n proxy: \"unknown\" as unknown as \"safe\" | \"default\",\n },\n } as ContextModuleConfig;\n\n const module = proxyModuleFactory(config);\n container.load(module);\n\n const proxyDataSource = container.get(proxyTypes.ProxyDataSource);\n expect(proxyDataSource).toBeInstanceOf(HttpProxyDataSource);\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,eAAAC,MAAmB,0BAE5B,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,uBAAAC,MAA2B,mCACpC,OAAS,2BAAAC,MAA+B,uCACxC,OAAS,2BAAAC,MAA+B,yCAExC,OAAS,sBAAAC,MAA0B,uBACnC,OAAS,cAAAC,MAAkB,eAE3B,SAAS,qBAAsB,IAAM,CACnC,IAAIC,EACJ,MAAMC,EAAkC,CACtC,sBAAuB,CACrB,IAAK,sCACP,EACA,YAAa,mBACf,EAEMC,EAAiD,CACrD,gBAAiB,GAAG,GAAG,CACzB,EAEA,WAAW,IAAM,CACfF,EAAY,IAAIR,EAEhBQ,EAAU,KAAKP,EAAY,MAAM,EAAE,gBAAgBQ,CAAU,EAE7DD,EACG,KAAKN,EAAS,oBAAoB,EAClC,gBAAgBQ,CAAwB,CAC7C,CAAC,EAED,SAAS,2BAA4B,IAAM,CACzC,GAAG,iEAAkE,IAAM,CACzE,MAAMC,EAASL,EAAmB,EAClCE,EAAU,KAAKG,CAAM,EAErB,MAAMC,EAAkBJ,EAAU,IAAID,EAAW,eAAe,EAChE,OAAOK,CAAe,EAAE,eAAeT,CAAmB,CAC5D,CAAC,EAED,GAAG,sCAAuC,IAAM,CAC9C,MAAMQ,EAASL,EAAmB,EAClCE,EAAU,KAAKG,CAAM,EAErB,MAAME,EAA0BL,EAAU,IACxCD,EAAW,uBACb,EACA,OAAOM,CAAuB,EAAE,eAAeR,CAAuB,CACxE,CAAC,CACH,CAAC,EAED,SAAS,yCAA0C,IAAM,CACvD,GAAG,6DAA8D,IAAM,CAOrE,MAAMM,EAASL,EANqB,CAClC,WAAY,CACV,MAAO,MACT,CACF,CAEwC,EACxCE,EAAU,KAAKG,CAAM,EAErB,MAAMC,EAAkBJ,EAAU,IAAID,EAAW,eAAe,EAChE,OAAOK,CAAe,EAAE,eAAeR,CAAuB,CAChE,CAAC,EAED,GAAG,sCAAuC,IAAM,CAO9C,MAAMO,EAASL,EANqB,CAClC,WAAY,CACV,MAAO,MACT,CACF,CAEwC,EACxCE,EAAU,KAAKG,CAAM,EAErB,MAAME,EAA0BL,EAAU,IACxCD,EAAW,uBACb,EACA,OAAOM,CAAuB,EAAE,eAAeR,CAAuB,CACxE,CAAC,CACH,CAAC,EAED,SAAS,4CAA6C,IAAM,CAC1D,GAAG,yDAA0D,IAAM,CAOjE,MAAMM,EAASL,EANqB,CAClC,WAAY,CACV,MAAO,SACT,CACF,CAEwC,EACxCE,EAAU,KAAKG,CAAM,EAErB,MAAMC,EAAkBJ,EAAU,IAAID,EAAW,eAAe,EAChE,OAAOK,CAAe,EAAE,eAAeT,CAAmB,CAC5D,CAAC,CACH,CAAC,EAED,SAAS,sCAAuC,IAAM,CACpD,GAAG,iEAAkE,IAAM,CAGzE,MAAMQ,EAASL,EAFqB,CAAC,CAEG,EACxCE,EAAU,KAAKG,CAAM,EAErB,MAAMC,EAAkBJ,EAAU,IAAID,EAAW,eAAe,EAChE,OAAOK,CAAe,EAAE,eAAeT,CAAmB,CAC5D,CAAC,CACH,CAAC,EAED,SAAS,sDAAuD,IAAM,CACpE,GAAG,iEAAkE,IAAM,CAOzE,MAAMQ,EAASL,EANqB,CAClC,WAAY,CACV,MAAO,SACT,CACF,CAEwC,EACxCE,EAAU,KAAKG,CAAM,EAErB,MAAMC,EAAkBJ,EAAU,IAAID,EAAW,eAAe,EAChE,OAAOK,CAAe,EAAE,eAAeT,CAAmB,CAC5D,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["Container", "configTypes", "pkiTypes", "HttpProxyDataSource", "HttpSafeProxyDataSource", "ProxyContextFieldLoader", "proxyModuleFactory", "proxyTypes", "container", "mockConfig", "mockPkiCertificateLoader", "module", "proxyDataSource", "proxyContextFieldLoader"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=(o,e,t,r)=>{for(var a=r>1?void 0:r?m(e,t):e,i=o.length-1,l;i>=0;i--)(l=o[i])&&(a=(r?l(e,t,a):l(a))||a);return r&&a&&s(e,t,a),a},d=(o,e)=>(t,r)=>e(t,r,o);import{inject as y,injectable as x}from"inversify";import{pkiTypes as f}from"../../pki/di/pkiTypes";import{proxyTypes as g}from"../../proxy/di/proxyTypes";import{ClearSignContextType as n}from"../../shared/model/ClearSignContext";let c=class{constructor(e,t){this._proxyDataSource=e;this._certificateLoader=t}canHandle(e,t){return t===n.PROXY_INFO&&typeof e=="object"&&e!==null&&"chainId"in e&&"proxyAddress"in e&&"calldata"in e&&"challenge"in e&&"deviceModelId"in e}async loadField(e){return(await this._proxyDataSource.getProxyImplementationAddress({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge})).caseOf({Left:r=>Promise.resolve({type:n.ERROR,error:r}),Right:async({signedDescriptor:r,keyId:a,keyUsage:i})=>{const l=await this._certificateLoader.loadCertificate({keyId:a,keyUsage:i,targetDevice:e.deviceModelId});return{type:n.PROXY_INFO,payload:r,certificate:l}}})}};c=p([x(),d(0,y(g.ProxyDataSource)),d(1,y(f.PkiCertificateLoader))],c);export{c as ProxyContextFieldLoader};
|
|
2
2
|
//# sourceMappingURL=ProxyContextFieldLoader.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/proxy/domain/ProxyContextFieldLoader.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["inject", "injectable", "pkiTypes", "
|
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { type ProxyDataSource } from \"@/proxy/data/ProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport { type ContextFieldLoader } from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\ntype ProxyFieldInput = {\n chainId: number;\n proxyAddress: string;\n calldata: string;\n challenge: string;\n deviceModelId: DeviceModelId;\n};\n\n@injectable()\nexport class ProxyContextFieldLoader\n implements ContextFieldLoader<ProxyFieldInput>\n{\n constructor(\n @inject(proxyTypes.ProxyDataSource)\n private _proxyDataSource: ProxyDataSource,\n @inject(pkiTypes.PkiCertificateLoader)\n private _certificateLoader: PkiCertificateLoader,\n ) {}\n\n canHandle(\n input: unknown,\n expectedType: ClearSignContextType,\n ): input is ProxyFieldInput {\n return (\n expectedType === ClearSignContextType.PROXY_INFO &&\n typeof input === \"object\" &&\n input !== null &&\n \"chainId\" in input &&\n \"proxyAddress\" in input &&\n \"calldata\" in input &&\n \"challenge\" in input &&\n \"deviceModelId\" in input\n );\n }\n\n async loadField(input: ProxyFieldInput): Promise<ClearSignContext> {\n const proxyDelegateCall =\n await this._proxyDataSource.getProxyImplementationAddress({\n calldata: input.calldata,\n proxyAddress: input.proxyAddress,\n chainId: input.chainId,\n challenge: input.challenge,\n });\n\n return proxyDelegateCall.caseOf<Promise<ClearSignContext>>({\n Left: (error) =>\n Promise.resolve({\n type: ClearSignContextType.ERROR,\n error: error,\n }),\n Right: async ({\n signedDescriptor,\n keyId,\n keyUsage,\n }: ProxyDelegateCall) => {\n const certificate = await this._certificateLoader.loadCertificate({\n keyId,\n keyUsage,\n targetDevice: input.deviceModelId,\n });\n\n return {\n type: ClearSignContextType.PROXY_INFO,\n payload: signedDescriptor,\n certificate,\n };\n },\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "iOACA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,YAAAC,MAAgB,oBAGzB,OAAS,cAAAC,MAAkB,wBAG3B,OAEE,wBAAAC,MACK,kCAWA,IAAMC,EAAN,KAEP,CACE,YAEUC,EAEAC,EACR,CAHQ,sBAAAD,EAEA,wBAAAC,CACP,CAEH,UACEC,EACAC,EAC0B,CAC1B,OACEA,IAAiBC,EAAqB,YACtC,OAAOF,GAAU,UACjBA,IAAU,MACV,YAAaA,GACb,iBAAkBA,GAClB,aAAcA,GACd,cAAeA,GACf,kBAAmBA,CAEvB,CAEA,MAAM,UAAUA,EAAmD,CASjE,OAPE,MAAM,KAAK,iBAAiB,8BAA8B,CACxD,SAAUA,EAAM,SAChB,aAAcA,EAAM,aACpB,QAASA,EAAM,QACf,UAAWA,EAAM,SACnB,CAAC,GAEsB,OAAkC,CACzD,KAAOG,GACL,QAAQ,QAAQ,CACd,KAAMD,EAAqB,MAC3B,MAAOC,CACT,CAAC,EACH,MAAO,MAAO,CACZ,iBAAAC,EACA,MAAAC,EACA,SAAAC,CACF,IAAyB,CACvB,MAAMC,EAAc,MAAM,KAAK,mBAAmB,gBAAgB,CAChE,MAAAF,EACA,SAAAC,EACA,aAAcN,EAAM,aACtB,CAAC,EAED,MAAO,CACL,KAAME,EAAqB,WAC3B,QAASE,EACT,YAAAG,CACF,CACF,CACF,CAAC,CACH,CACF,EA5DaV,EAANW,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAW,eAAe,GAEjCF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAN5BhB",
|
|
6
|
+
"names": ["inject", "injectable", "pkiTypes", "proxyTypes", "ClearSignContextType", "ProxyContextFieldLoader", "_proxyDataSource", "_certificateLoader", "input", "expectedType", "ClearSignContextType", "error", "signedDescriptor", "keyId", "keyUsage", "certificate", "__decorateClass", "injectable", "__decorateParam", "inject", "proxyTypes", "pkiTypes"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DeviceModelId as
|
|
1
|
+
import{DeviceModelId as n}from"@ledgerhq/device-management-kit";import{Left as m,Right as s}from"purify-ts";import{KeyId as p}from"../../pki/model/KeyId";import{KeyUsage as y}from"../../pki/model/KeyUsage";import{ProxyContextFieldLoader as x}from"../../proxy/domain/ProxyContextFieldLoader";import{ClearSignContextType as i}from"../../shared/model/ClearSignContext";describe("ProxyContextFieldLoader",()=>{const t={getProxyImplementationAddress:vi.fn()},l={loadCertificate:vi.fn()},d=new x(t,l),e={chainId:1,proxyAddress:"0x1234567890abcdef",calldata:"0xabcdef1234567890",challenge:"test-challenge",deviceModelId:n.STAX},r={implementationAddress:"0x987654321fedcba0",signedDescriptor:"0x123456789abcdef0",keyId:p.CalCalldataKey,keyUsage:y.Calldata},c={keyUsageNumber:1,payload:new Uint8Array([1,2,3,4])};beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid proxy field",()=>{const a={chainId:1,proxyAddress:"0x1234567890abcdef",calldata:"0xabcdef1234567890",challenge:"test-challenge",deviceModelId:n.STAX};expect(d.canHandle(a,i.PROXY_INFO)).toBe(!0)}),describe("should return false for invalid fields",()=>{const a=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing chainId",value:{proxyAddress:"0x123",calldata:"0xabc",challenge:"test",deviceModelId:n.STAX}},{name:"object missing proxyAddress",value:{chainId:1,calldata:"0xabc",challenge:"test",deviceModelId:n.STAX}},{name:"object missing calldata",value:{chainId:1,proxyAddress:"0x123",challenge:"test",deviceModelId:n.STAX}},{name:"object missing challenge",value:{chainId:1,proxyAddress:"0x123",calldata:"0xabc",deviceModelId:n.STAX}},{name:"object missing deviceModelId",value:{chainId:1,proxyAddress:"0x123",calldata:"0xabc",challenge:"test"}}];test.each(a)("$name",({value:o})=>{expect(d.canHandle(o,i.PROXY_INFO)).toBe(!1)})}),it("should return false for invalid expected type",()=>{expect(d.canHandle(e,i.TOKEN)).toBe(!1)})}),describe("loadField",()=>{it("should return error context when proxy data source fails",async()=>{const a=new Error("Proxy data source error");vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(m(a));const o=await d.loadField(e);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(o).toEqual({type:i.ERROR,error:a}),expect(l.loadCertificate).not.toHaveBeenCalled()}),it("should return proxy delegate call context when successful",async()=>{vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(s(r)),vi.spyOn(l,"loadCertificate").mockResolvedValue(c);const a=await d.loadField(e);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(l.loadCertificate).toHaveBeenCalledWith({keyId:p.CalCalldataKey,keyUsage:y.Calldata,targetDevice:e.deviceModelId}),expect(a).toEqual({type:i.PROXY_INFO,payload:r.signedDescriptor,certificate:c})}),it("should return proxy delegate call context with undefined certificate when certificate loading returns undefined",async()=>{vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(s(r)),vi.spyOn(l,"loadCertificate").mockResolvedValue(void 0);const a=await d.loadField(e);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(l.loadCertificate).toHaveBeenCalledWith({keyId:p.CalCalldataKey,keyUsage:y.Calldata,targetDevice:e.deviceModelId}),expect(a).toEqual({type:i.PROXY_INFO,payload:r.signedDescriptor,certificate:void 0})}),it("should handle different device model IDs correctly",async()=>{const a={...e,deviceModelId:n.NANO_X};vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(s(r)),vi.spyOn(l,"loadCertificate").mockResolvedValue(c);const o=await d.loadField(a);expect(l.loadCertificate).toHaveBeenCalledWith({keyId:p.CalCalldataKey,keyUsage:y.Calldata,targetDevice:n.NANO_X}),expect(o).toEqual({type:i.PROXY_INFO,payload:r.signedDescriptor,certificate:c})}),it("should handle different chain IDs and addresses correctly",async()=>{const a={...e,chainId:137,proxyAddress:"0xdeadbeef",calldata:"0xcafebabe",challenge:"custom-challenge"};vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(s(r)),vi.spyOn(l,"loadCertificate").mockResolvedValue(c);const o=await d.loadField(a);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:"0xcafebabe",proxyAddress:"0xdeadbeef",chainId:137,challenge:"custom-challenge"}),expect(o).toEqual({type:i.PROXY_INFO,payload:r.signedDescriptor,certificate:c})}),it("should handle certificate loading failure gracefully",async()=>{vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(s(r)),vi.spyOn(l,"loadCertificate").mockRejectedValue(new Error("Certificate loading failed")),await expect(d.loadField(e)).rejects.toThrow("Certificate loading failed"),expect(t.getProxyImplementationAddress).toHaveBeenCalled(),expect(l.loadCertificate).toHaveBeenCalled()}),it("should preserve error message from proxy data source",async()=>{const a=new Error("Network timeout error");vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(m(a));const o=await d.loadField(e);expect(o).toEqual({type:i.ERROR,error:a})}),it("should handle empty signed descriptor",async()=>{const a={...r,signedDescriptor:""};vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue(s(a)),vi.spyOn(l,"loadCertificate").mockResolvedValue(c);const o=await d.loadField(e);expect(o).toEqual({type:i.PROXY_INFO,payload:"",certificate:c})})})});
|
|
2
2
|
//# sourceMappingURL=ProxyContextFieldLoader.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/proxy/domain/ProxyContextFieldLoader.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type ProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\ndescribe(\"ProxyContextFieldLoader\", () => {\n const mockProxyDataSource: ProxyDataSource = {\n getProxyDelegateCall: vi.fn(),\n getProxyImplementationAddress: vi.fn(),\n };\n const mockCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n const proxyContextFieldLoader = new ProxyContextFieldLoader(\n mockProxyDataSource,\n mockCertificateLoader,\n );\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.PROXY_DELEGATE_CALL> =\n {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n proxyAddress: \"0x1234567890abcdef\",\n calldata: \"0xabcdef1234567890\",\n challenge: \"test-challenge\",\n deviceModelId: DeviceModelId.STAX,\n };\n\n const mockProxyDelegateCall: ProxyDelegateCall = {\n delegateAddresses: [\"0x987654321fedcba0\"],\n signedDescriptor: \"0x123456789abcdef0\",\n };\n\n const mockCertificate: PkiCertificate = {\n keyUsageNumber: 1,\n payload: new Uint8Array([1, 2, 3, 4]),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"constructor\", () => {\n it(\"should initialize with correct kind\", () => {\n // THEN\n expect(proxyContextFieldLoader.kind).toBe(\n ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n );\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when proxy data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Proxy data source error\");\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n expect(mockCertificateLoader.loadCertificate).not.toHaveBeenCalled();\n });\n\n it(\"should return proxy delegate call context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should return proxy delegate call context with undefined certificate when certificate loading returns undefined\", async () => {\n // GIVEN\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n undefined,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: undefined,\n });\n });\n\n it(\"should handle different device model IDs correctly\", async () => {\n // GIVEN\n const nanoXField = {\n ...mockTransactionField,\n deviceModelId: DeviceModelId.NANO_X,\n };\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(nanoXField);\n\n // THEN\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: DeviceModelId.NANO_X,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n proxyAddress: \"0xdeadbeef\",\n calldata: \"0xcafebabe\",\n challenge: \"custom-challenge\",\n };\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: \"0xcafebabe\",\n proxyAddress: \"0xdeadbeef\",\n chainId: 137,\n challenge: \"custom-challenge\",\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle certificate loading failure gracefully\", async () => {\n // GIVEN\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockRejectedValue(\n new Error(\"Certificate loading failed\"),\n );\n\n // WHEN & THEN\n await expect(\n proxyContextFieldLoader.loadField(mockTransactionField),\n ).rejects.toThrow(\"Certificate loading failed\");\n\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalled();\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalled();\n });\n\n it(\"should preserve error message from proxy data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty signed descriptor\", async () => {\n // GIVEN\n const proxyCallWithEmptyDescriptor = {\n ...mockProxyDelegateCall,\n signedDescriptor: \"\",\n };\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(proxyCallWithEmptyDescriptor),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"\",\n certificate: mockCertificate,\n });\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAG5B,OAAS,SAAAC,MAAa,oBACtB,OAAS,YAAAC,MAAgB,uBAGzB,OAAS,2BAAAC,MAA+B,yCAExC,OAAS,
|
|
6
|
-
"names": ["DeviceModelId", "Left", "Right", "KeyId", "KeyUsage", "ProxyContextFieldLoader", "
|
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type ProxyDataSource } from \"@/proxy/data/ProxyDataSource\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\n\ndescribe(\"ProxyContextFieldLoader\", () => {\n const mockProxyDataSource: ProxyDataSource = {\n getProxyImplementationAddress: vi.fn(),\n };\n const mockCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n const proxyContextFieldLoader = new ProxyContextFieldLoader(\n mockProxyDataSource,\n mockCertificateLoader,\n );\n\n const mockTransactionField = {\n chainId: 1,\n proxyAddress: \"0x1234567890abcdef\",\n calldata: \"0xabcdef1234567890\",\n challenge: \"test-challenge\",\n deviceModelId: DeviceModelId.STAX,\n };\n\n const mockProxyDelegateCall: ProxyDelegateCall = {\n implementationAddress: \"0x987654321fedcba0\",\n signedDescriptor: \"0x123456789abcdef0\",\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n };\n\n const mockCertificate: PkiCertificate = {\n keyUsageNumber: 1,\n payload: new Uint8Array([1, 2, 3, 4]),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid proxy field\", () => {\n // GIVEN\n const validField = {\n chainId: 1,\n proxyAddress: \"0x1234567890abcdef\",\n calldata: \"0xabcdef1234567890\",\n challenge: \"test-challenge\",\n deviceModelId: DeviceModelId.STAX,\n };\n\n // THEN\n expect(\n proxyContextFieldLoader.canHandle(\n validField,\n ClearSignContextType.PROXY_INFO,\n ),\n ).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing chainId\",\n value: {\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing proxyAddress\",\n value: {\n chainId: 1,\n calldata: \"0xabc\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing calldata\",\n value: {\n chainId: 1,\n proxyAddress: \"0x123\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing challenge\",\n value: {\n chainId: 1,\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing deviceModelId\",\n value: {\n chainId: 1,\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n challenge: \"test\",\n },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(\n proxyContextFieldLoader.canHandle(\n value,\n ClearSignContextType.PROXY_INFO,\n ),\n ).toBe(false);\n });\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(\n proxyContextFieldLoader.canHandle(\n mockTransactionField,\n ClearSignContextType.TOKEN,\n ),\n ).toBe(false);\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when proxy data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Proxy data source error\");\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Left(error));\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n expect(mockCertificateLoader.loadCertificate).not.toHaveBeenCalled();\n });\n\n it(\"should return proxy delegate call context when successful\", async () => {\n // GIVEN\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_INFO,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should return proxy delegate call context with undefined certificate when certificate loading returns undefined\", async () => {\n // GIVEN\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n undefined,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_INFO,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: undefined,\n });\n });\n\n it(\"should handle different device model IDs correctly\", async () => {\n // GIVEN\n const nanoXField = {\n ...mockTransactionField,\n deviceModelId: DeviceModelId.NANO_X,\n };\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(nanoXField);\n\n // THEN\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: DeviceModelId.NANO_X,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_INFO,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n proxyAddress: \"0xdeadbeef\",\n calldata: \"0xcafebabe\",\n challenge: \"custom-challenge\",\n };\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(customField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: \"0xcafebabe\",\n proxyAddress: \"0xdeadbeef\",\n chainId: 137,\n challenge: \"custom-challenge\",\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_INFO,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle certificate loading failure gracefully\", async () => {\n // GIVEN\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockRejectedValue(\n new Error(\"Certificate loading failed\"),\n );\n\n // WHEN & THEN\n await expect(\n proxyContextFieldLoader.loadField(mockTransactionField),\n ).rejects.toThrow(\"Certificate loading failed\");\n\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalled();\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalled();\n });\n\n it(\"should preserve error message from proxy data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Left(specificError));\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty signed descriptor\", async () => {\n // GIVEN\n const proxyCallWithEmptyDescriptor = {\n ...mockProxyDelegateCall,\n signedDescriptor: \"\",\n };\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(proxyCallWithEmptyDescriptor));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_INFO,\n payload: \"\",\n certificate: mockCertificate,\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["DeviceModelId", "Left", "Right", "KeyId", "KeyUsage", "ProxyContextFieldLoader", "ClearSignContextType", "mockProxyDataSource", "mockCertificateLoader", "proxyContextFieldLoader", "mockTransactionField", "mockProxyDelegateCall", "mockCertificate", "validField", "invalidFields", "value", "error", "result", "nanoXField", "customField", "specificError", "proxyCallWithEmptyDescriptor"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r=(e=>(e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trustedName",e.PLUGIN="plugin",e.EXTERNAL_PLUGIN="externalPlugin",e.TRANSACTION_INFO="transactionInfo",e.
|
|
1
|
+
var r=(e=>(e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trustedName",e.PLUGIN="plugin",e.EXTERNAL_PLUGIN="externalPlugin",e.TRANSACTION_INFO="transactionInfo",e.PROXY_INFO="proxyInfo",e.ENUM="enum",e.TRANSACTION_FIELD_DESCRIPTION="transactionFieldDescription",e.WEB3_CHECK="web3Check",e.DYNAMIC_NETWORK="dynamicNetwork",e.DYNAMIC_NETWORK_ICON="dynamicNetworkIcon",e.ERROR="error",e))(r||{}),n=(t=>(t.TOKEN="token",t.NFT="nft",t.TRUSTED_NAME="trustedName",t.ENUM="enum",t.CALLDATA="calldata",t))(n||{});export{n as ClearSignContextReferenceType,r as ClearSignContextType};
|
|
2
2
|
//# sourceMappingURL=ClearSignContext.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/shared/model/ClearSignContext.ts"],
|
|
4
|
-
"sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nimport { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n
|
|
5
|
-
"mappings": "AAIO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,iBAAmB,kBACnBA,EAAA,
|
|
4
|
+
"sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nimport { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n PROXY_INFO = \"proxyInfo\",\n ENUM = \"enum\",\n TRANSACTION_FIELD_DESCRIPTION = \"transactionFieldDescription\",\n WEB3_CHECK = \"web3Check\",\n DYNAMIC_NETWORK = \"dynamicNetwork\",\n DYNAMIC_NETWORK_ICON = \"dynamicNetworkIcon\",\n ERROR = \"error\",\n}\n\nexport enum ClearSignContextReferenceType {\n TOKEN = ClearSignContextType.TOKEN,\n NFT = ClearSignContextType.NFT,\n TRUSTED_NAME = ClearSignContextType.TRUSTED_NAME,\n ENUM = ClearSignContextType.ENUM,\n CALLDATA = \"calldata\",\n}\n\nexport type ClearSignContextReference<\n Type extends ClearSignContextReferenceType = ClearSignContextReferenceType,\n> = Type extends ClearSignContextReferenceType.ENUM\n ? {\n type: ClearSignContextReferenceType.ENUM;\n valuePath: GenericPath;\n id: number; // enum id to reference\n }\n : Type extends ClearSignContextReferenceType.TRUSTED_NAME\n ? {\n type: ClearSignContextReferenceType.TRUSTED_NAME;\n valuePath: GenericPath;\n types: string[];\n sources: string[];\n }\n : Type extends ClearSignContextReferenceType.CALLDATA\n ? {\n type: ClearSignContextReferenceType.CALLDATA;\n callee: GenericPath;\n valuePath: GenericPath;\n selector?: GenericPath;\n amount?: GenericPath;\n spender?: GenericPath;\n chainId?: GenericPath;\n }\n :\n | {\n type: Type;\n valuePath: GenericPath;\n value?: never;\n }\n | {\n type: Type;\n valuePath?: never;\n value: string;\n };\n\nexport type ClearSignContextSuccessType = Exclude<\n ClearSignContextType,\n ClearSignContextType.ERROR\n>;\n\nexport type ClearSignContextSuccess<\n T extends Exclude<\n ClearSignContextType,\n ClearSignContextType.ERROR\n > = ClearSignContextSuccessType,\n> = T extends ClearSignContextType.ENUM\n ? {\n type: ClearSignContextType.ENUM;\n id: number;\n payload: string;\n value: number;\n certificate?: PkiCertificate;\n }\n : T extends ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION\n ? {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION;\n payload: string;\n reference?: ClearSignContextReference;\n certificate?: PkiCertificate;\n }\n : {\n type: T;\n payload: string;\n certificate?: PkiCertificate;\n };\n\nexport type ClearSignContextError = {\n type: ClearSignContextType.ERROR;\n error: Error;\n};\n\nexport type ClearSignContext = ClearSignContextSuccess | ClearSignContextError;\n"],
|
|
5
|
+
"mappings": "AAIO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,iBAAmB,kBACnBA,EAAA,WAAa,YACbA,EAAA,KAAO,OACPA,EAAA,8BAAgC,8BAChCA,EAAA,WAAa,YACbA,EAAA,gBAAkB,iBAClBA,EAAA,qBAAuB,qBACvBA,EAAA,MAAQ,QAbEA,OAAA,IAgBAC,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,KAAO,OACPA,EAAA,SAAW,WALDA,OAAA",
|
|
6
6
|
"names": ["ClearSignContextType", "ClearSignContextReferenceType"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/shared/model/TypedDataClearSignContext.ts"],
|
|
4
|
-
"sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\n\nimport {\n type ClearSignContextSuccess,\n type ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionSubset } from \"@/shared/model/TransactionSubset\";\n\n// The general informations for a typed message\nexport type TypedDataMessageInfo = {\n displayName: string;\n filtersCount: number;\n signature: string;\n};\n\n// Token index and descriptor. Needed for tokens that are referenced by a typed message\nexport type TypedDataTokenIndex = number;\nexport type TypedDataToken = string;\n// Calldata index. Needed for calldatas that are referenced by a typed message\nexport type TypedDataCalldataIndex = number;\n// Special token index value when the referenced token is the verifying contract\nexport const VERIFYING_CONTRACT_TOKEN_INDEX = 255;\n\n// Typed message filters, to select fields to display, and provide formatting informations\nexport type TypedDataFilterPath = string;\nexport type TypedDataFilterWithToken = {\n type: \"amount\" | \"token\";\n displayName: string;\n tokenIndex: TypedDataTokenIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterWithTrustedName = {\n type: \"trusted-name\";\n displayName: string;\n types: string[];\n sources: string[];\n typesAndSourcesPayload: string;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterCalldata = {\n type:\n | \"calldata-value\"\n | \"calldata-callee\"\n | \"calldata-chain-id\"\n | \"calldata-selector\"\n | \"calldata-amount\"\n | \"calldata-spender\";\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilter =\n | {\n type: \"datetime\" | \"raw\";\n displayName: string;\n path: TypedDataFilterPath;\n signature: string;\n }\n | TypedDataFilterWithToken\n | TypedDataFilterWithTrustedName\n | TypedDataFilterCalldata;\n\n// Calldata info when referenced by a typed message\nexport enum TypedDataCalldataParamPresence {\n None = \"none\",\n Present = \"present\",\n VerifyingContract = \"verifying_contract\",\n}\nexport type TypedDataFilterCalldataInfo = {\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n valueFlag: boolean;\n calleeFlag: TypedDataCalldataParamPresence;\n chainIdFlag: boolean;\n selectorFlag: boolean;\n amountFlag: boolean;\n spenderFlag: TypedDataCalldataParamPresence;\n signature: string;\n};\nexport type TypedDataCalldataInfo = {\n filter: TypedDataFilterCalldataInfo;\n subset: TransactionSubset;\n};\n\n// Clear signing context for a typed message\nexport type TypedDataClearSignContextSuccess = {\n type: \"success\";\n messageInfo: TypedDataMessageInfo;\n filters: Record<TypedDataFilterPath, TypedDataFilter>;\n trustedNamesAddresses: Record<TypedDataFilterPath, HexaString>;\n tokens: Record<TypedDataTokenIndex, TypedDataToken>;\n calldatas: Record<TypedDataCalldataIndex, TypedDataCalldataInfo>;\n proxy?: ClearSignContextSuccess<ClearSignContextType.
|
|
4
|
+
"sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\n\nimport {\n type ClearSignContextSuccess,\n type ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionSubset } from \"@/shared/model/TransactionSubset\";\n\n// The general informations for a typed message\nexport type TypedDataMessageInfo = {\n displayName: string;\n filtersCount: number;\n signature: string;\n};\n\n// Token index and descriptor. Needed for tokens that are referenced by a typed message\nexport type TypedDataTokenIndex = number;\nexport type TypedDataToken = string;\n// Calldata index. Needed for calldatas that are referenced by a typed message\nexport type TypedDataCalldataIndex = number;\n// Special token index value when the referenced token is the verifying contract\nexport const VERIFYING_CONTRACT_TOKEN_INDEX = 255;\n\n// Typed message filters, to select fields to display, and provide formatting informations\nexport type TypedDataFilterPath = string;\nexport type TypedDataFilterWithToken = {\n type: \"amount\" | \"token\";\n displayName: string;\n tokenIndex: TypedDataTokenIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterWithTrustedName = {\n type: \"trusted-name\";\n displayName: string;\n types: string[];\n sources: string[];\n typesAndSourcesPayload: string;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterCalldata = {\n type:\n | \"calldata-value\"\n | \"calldata-callee\"\n | \"calldata-chain-id\"\n | \"calldata-selector\"\n | \"calldata-amount\"\n | \"calldata-spender\";\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilter =\n | {\n type: \"datetime\" | \"raw\";\n displayName: string;\n path: TypedDataFilterPath;\n signature: string;\n }\n | TypedDataFilterWithToken\n | TypedDataFilterWithTrustedName\n | TypedDataFilterCalldata;\n\n// Calldata info when referenced by a typed message\nexport enum TypedDataCalldataParamPresence {\n None = \"none\",\n Present = \"present\",\n VerifyingContract = \"verifying_contract\",\n}\nexport type TypedDataFilterCalldataInfo = {\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n valueFlag: boolean;\n calleeFlag: TypedDataCalldataParamPresence;\n chainIdFlag: boolean;\n selectorFlag: boolean;\n amountFlag: boolean;\n spenderFlag: TypedDataCalldataParamPresence;\n signature: string;\n};\nexport type TypedDataCalldataInfo = {\n filter: TypedDataFilterCalldataInfo;\n subset: TransactionSubset;\n};\n\n// Clear signing context for a typed message\nexport type TypedDataClearSignContextSuccess = {\n type: \"success\";\n messageInfo: TypedDataMessageInfo;\n filters: Record<TypedDataFilterPath, TypedDataFilter>;\n trustedNamesAddresses: Record<TypedDataFilterPath, HexaString>;\n tokens: Record<TypedDataTokenIndex, TypedDataToken>;\n calldatas: Record<TypedDataCalldataIndex, TypedDataCalldataInfo>;\n proxy?: ClearSignContextSuccess<ClearSignContextType.PROXY_INFO>;\n};\nexport type TypedDataClearSignContextError = {\n type: \"error\";\n error: Error;\n};\nexport type TypedDataClearSignContext =\n | TypedDataClearSignContextSuccess\n | TypedDataClearSignContextError;\n"],
|
|
5
5
|
"mappings": "AAqBO,MAAMA,EAAiC,IA6CvC,IAAKC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,kBAAoB,qBAHVA,OAAA",
|
|
6
6
|
"names": ["VERIFYING_CONTRACT_TOKEN_INDEX", "TypedDataCalldataParamPresence"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{KeyUsage as e}from"../../pki/model/KeyUsage";class s{static keyUsageMap=new Map([[e.GenuineCheck,1],[e.ExchangePayload,2],[e.NftMeta,3],[e.TrustedName,4],[e.BackupProvider,5],[e.ProtectOrchestrator,6],[e.PluginMeta,7],[e.CoinMeta,8],[e.SeedIdAuth,9],[e.TxSimulationSigner,10],[e.Calldata,11],[e.Network,12]]);static mapKeyUsageForFirmware(a){return this.keyUsageMap.get(a)??-1}}export{s as KeyUsageMapper};
|
|
1
|
+
import{KeyUsage as e}from"../../pki/model/KeyUsage";class s{static keyUsageMap=new Map([[e.GenuineCheck,1],[e.ExchangePayload,2],[e.NftMeta,3],[e.TrustedName,4],[e.BackupProvider,5],[e.ProtectOrchestrator,6],[e.PluginMeta,7],[e.CoinMeta,8],[e.SeedIdAuth,9],[e.TxSimulationSigner,10],[e.Calldata,11],[e.Network,12]]);static mapKeyUsageForFirmware(a){return Object.values(e).includes(a)?this.keyUsageMap.get(a)??-1:-1}}export{s as KeyUsageMapper};
|
|
2
2
|
//# sourceMappingURL=KeyUsageMapper.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/shared/utils/KeyUsageMapper.ts"],
|
|
4
|
-
"sourcesContent": ["import { KeyUsage } from \"@/pki/model/KeyUsage\";\n\nexport class KeyUsageMapper {\n private static keyUsageMap = new Map<KeyUsage, number>([\n [KeyUsage.GenuineCheck, 1],\n [KeyUsage.ExchangePayload, 2],\n [KeyUsage.NftMeta, 3],\n [KeyUsage.TrustedName, 4],\n [KeyUsage.BackupProvider, 5],\n [KeyUsage.ProtectOrchestrator, 6],\n [KeyUsage.PluginMeta, 7],\n [KeyUsage.CoinMeta, 8],\n [KeyUsage.SeedIdAuth, 9],\n [KeyUsage.TxSimulationSigner, 10],\n [KeyUsage.Calldata, 11],\n [KeyUsage.Network, 12],\n ]);\n\n static mapKeyUsageForFirmware(keyUsage:
|
|
5
|
-
"mappings": "AAAA,OAAS,YAAAA,MAAgB,uBAElB,MAAMC,CAAe,CAC1B,OAAe,YAAc,IAAI,IAAsB,CACrD,CAACD,EAAS,aAAc,CAAC,EACzB,CAACA,EAAS,gBAAiB,CAAC,EAC5B,CAACA,EAAS,QAAS,CAAC,EACpB,CAACA,EAAS,YAAa,CAAC,EACxB,CAACA,EAAS,eAAgB,CAAC,EAC3B,CAACA,EAAS,oBAAqB,CAAC,EAChC,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,SAAU,CAAC,EACrB,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,mBAAoB,EAAE,EAChC,CAACA,EAAS,SAAU,EAAE,EACtB,CAACA,EAAS,QAAS,EAAE,CACvB,CAAC,EAED,OAAO,uBAAuBE,
|
|
4
|
+
"sourcesContent": ["import { KeyUsage } from \"@/pki/model/KeyUsage\";\n\nexport class KeyUsageMapper {\n private static keyUsageMap = new Map<KeyUsage, number>([\n [KeyUsage.GenuineCheck, 1],\n [KeyUsage.ExchangePayload, 2],\n [KeyUsage.NftMeta, 3],\n [KeyUsage.TrustedName, 4],\n [KeyUsage.BackupProvider, 5],\n [KeyUsage.ProtectOrchestrator, 6],\n [KeyUsage.PluginMeta, 7],\n [KeyUsage.CoinMeta, 8],\n [KeyUsage.SeedIdAuth, 9],\n [KeyUsage.TxSimulationSigner, 10],\n [KeyUsage.Calldata, 11],\n [KeyUsage.Network, 12],\n ]);\n\n static mapKeyUsageForFirmware(keyUsage: string): number {\n if (Object.values(KeyUsage).includes(keyUsage as KeyUsage)) {\n return this.keyUsageMap.get(keyUsage as KeyUsage) ?? -1;\n }\n return -1;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,MAAgB,uBAElB,MAAMC,CAAe,CAC1B,OAAe,YAAc,IAAI,IAAsB,CACrD,CAACD,EAAS,aAAc,CAAC,EACzB,CAACA,EAAS,gBAAiB,CAAC,EAC5B,CAACA,EAAS,QAAS,CAAC,EACpB,CAACA,EAAS,YAAa,CAAC,EACxB,CAACA,EAAS,eAAgB,CAAC,EAC3B,CAACA,EAAS,oBAAqB,CAAC,EAChC,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,SAAU,CAAC,EACrB,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,mBAAoB,EAAE,EAChC,CAACA,EAAS,SAAU,EAAE,EACtB,CAACA,EAAS,QAAS,EAAE,CACvB,CAAC,EAED,OAAO,uBAAuBE,EAA0B,CACtD,OAAI,OAAO,OAAOF,CAAQ,EAAE,SAASE,CAAoB,EAChD,KAAK,YAAY,IAAIA,CAAoB,GAAK,GAEhD,EACT,CACF",
|
|
6
6
|
"names": ["KeyUsage", "KeyUsageMapper", "keyUsage"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=(n,t,r,e)=>{for(var o=e>1?void 0:e?p(t,r):t,i=n.length-1,a;i>=0;i--)(a=n[i])&&(o=(e?a(t,r,o):a(o))||o);return e&&o&&d(t,r,o),o},f=(n,t)=>(r,e)=>t(r,e,n);import g from"axios";import{inject as l,injectable as u}from"inversify";import{Left as m,Right as h}from"purify-ts";import{configTypes as
|
|
1
|
+
var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=(n,t,r,e)=>{for(var o=e>1?void 0:e?p(t,r):t,i=n.length-1,a;i>=0;i--)(a=n[i])&&(o=(e?a(t,r,o):a(o))||o);return e&&o&&d(t,r,o),o},f=(n,t)=>(r,e)=>t(r,e,n);import g from"axios";import{inject as l,injectable as u}from"inversify";import{Left as m,Right as h}from"purify-ts";import{configTypes as E}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as k}from"../../shared/constant/HttpHeaders";import C from"../../../package.json";let s=class{constructor(t){this.config=t}async getTokenInfosPayload({chainId:t,address:r}){try{const o=(await g.request({method:"GET",url:`${this.config.cal.url}/tokens`,params:{contract_address:r,chain_id:t,output:"descriptor",ref:`branch:${this.config.cal.branch}`},headers:{[k]:`context-module/${C.version}`}})).data?.[0];if(!o||!o.descriptor||!o.descriptor.data||!o.descriptor.signatures||typeof o.descriptor.signatures[this.config.cal.mode]!="string")return m(new Error(`[ContextModule] HttpTokenDataSource: no token metadata for address ${r} on chain ${t}`));const i=(o.descriptor.data.length/2-20-4-4).toString(16).padStart(2,"0");return h([i,o.descriptor.data,o.descriptor.signatures[this.config.cal.mode]].join(""))}catch{return m(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations"))}}};s=c([u(),f(0,l(E.Config))],s);export{s as HttpTokenDataSource};
|
|
2
2
|
//# sourceMappingURL=HttpTokenDataSource.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/token/data/HttpTokenDataSource.ts"],
|
|
4
|
-
"sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { GetTokenInfosParams, TokenDataSource } from \"./TokenDataSource\";\nimport { TokenDto } from \"./TokenDto\";\n\n@injectable()\nexport class HttpTokenDataSource implements TokenDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n public async getTokenInfosPayload({\n chainId,\n address,\n }: GetTokenInfosParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<TokenDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/tokens`,\n params: {\n contract_address: address,\n chain_id: chainId,\n output: \"descriptor
|
|
5
|
-
"mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAE5B,OAAS,gCAAAC,MAAoC,gCAC7C,OAAOC,MAAa,qBAMb,IAAMC,EAAN,KAAqD,CAC1D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CACH,MAAa,qBAAqB,CAChC,QAAAC,EACA,QAAAC,CACF,EAAwD,CACtD,GAAI,CAcF,MAAMC,GAbW,MAAMC,EAAM,QAAoB,CAC/C,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,UAC3B,OAAQ,CACN,iBAAkBF,EAClB,SAAUD,EACV,OAAQ,
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { GetTokenInfosParams, TokenDataSource } from \"./TokenDataSource\";\nimport { TokenDto } from \"./TokenDto\";\n\n@injectable()\nexport class HttpTokenDataSource implements TokenDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n public async getTokenInfosPayload({\n chainId,\n address,\n }: GetTokenInfosParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<TokenDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/tokens`,\n params: {\n contract_address: address,\n chain_id: chainId,\n output: \"descriptor\",\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n },\n });\n const tokenInfos = response.data?.[0];\n\n if (\n !tokenInfos ||\n !tokenInfos.descriptor ||\n !tokenInfos.descriptor.data ||\n !tokenInfos.descriptor.signatures ||\n typeof tokenInfos.descriptor.signatures[this.config.cal.mode] !==\n \"string\"\n ) {\n return Left(\n new Error(\n `[ContextModule] HttpTokenDataSource: no token metadata for address ${address} on chain ${chainId}`,\n ),\n );\n }\n\n // According to documentation: https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-erc-20-token-information\n // Signed descriptor is composed of:\n // ticker || address (20 bytes) || number of decimals (4 bytes) || chainId (4 bytes)\n const tickerLengthBuff = (\n tokenInfos.descriptor.data.length / 2 -\n 20 -\n 4 -\n 4\n )\n .toString(16)\n .padStart(2, \"0\");\n\n return Right(\n [\n tickerLengthBuff,\n tokenInfos.descriptor.data,\n tokenInfos.descriptor.signatures[this.config.cal.mode],\n ].join(\"\"),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: Failed to fetch token informations\",\n ),\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAE5B,OAAS,gCAAAC,MAAoC,gCAC7C,OAAOC,MAAa,qBAMb,IAAMC,EAAN,KAAqD,CAC1D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CACH,MAAa,qBAAqB,CAChC,QAAAC,EACA,QAAAC,CACF,EAAwD,CACtD,GAAI,CAcF,MAAMC,GAbW,MAAMC,EAAM,QAAoB,CAC/C,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,UAC3B,OAAQ,CACN,iBAAkBF,EAClB,SAAUD,EACV,OAAQ,aACR,IAAK,UAAU,KAAK,OAAO,IAAI,MAAM,EACvC,EACA,QAAS,CACP,CAACI,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,EACnE,CACF,CAAC,GAC2B,OAAO,CAAC,EAEpC,GACE,CAACH,GACD,CAACA,EAAW,YACZ,CAACA,EAAW,WAAW,MACvB,CAACA,EAAW,WAAW,YACvB,OAAOA,EAAW,WAAW,WAAW,KAAK,OAAO,IAAI,IAAI,GAC1D,SAEF,OAAOI,EACL,IAAI,MACF,sEAAsEL,CAAO,aAAaD,CAAO,EACnG,CACF,EAMF,MAAMO,GACJL,EAAW,WAAW,KAAK,OAAS,EACpC,GACA,EACA,GAEC,SAAS,EAAE,EACX,SAAS,EAAG,GAAG,EAElB,OAAOM,EACL,CACED,EACAL,EAAW,WAAW,KACtBA,EAAW,WAAW,WAAW,KAAK,OAAO,IAAI,IAAI,CACvD,EAAE,KAAK,EAAE,CACX,CACF,MAAiB,CACf,OAAOI,EACL,IAAI,MACF,yEACF,CACF,CACF,CACF,CACF,EAlEaR,EAANW,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBf",
|
|
6
6
|
"names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "HttpTokenDataSource", "config", "chainId", "address", "tokenInfos", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "Left", "tickerLengthBuff", "Right", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"axios";import{Left as n}from"purify-ts";import{LEDGER_CLIENT_VERSION_HEADER as r}from"../../shared/constant/HttpHeaders";import{HttpTokenDataSource as s}from"../../token/data/HttpTokenDataSource";import
|
|
1
|
+
import o from"axios";import{Left as n}from"purify-ts";import{LEDGER_CLIENT_VERSION_HEADER as r}from"../../shared/constant/HttpHeaders";import{HttpTokenDataSource as s}from"../../token/data/HttpTokenDataSource";import c from"../../../package.json";vi.mock("axios");describe("HttpTokenDataSource",()=>{let t;beforeAll(()=>{const e={cal:{url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"}};t=new s(e),vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${c.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o,"request").mockImplementation(a),await t.getTokenInfosPayload({address:"0x00",chainId:1}),expect(a).toHaveBeenCalledWith(expect.objectContaining({headers:{[r]:e}}))}),it("should return a string when axios response is correct",async()=>{const e={ticker:"USDC",descriptor:{data:"555344433c499c542cef5e3811e1192ce70d8cc03d5c33590000000600000089",signatures:{prod:"0123"}}};vi.spyOn(o,"request").mockResolvedValue({data:[e]});const a=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(a.extract()).toEqual("04555344433c499c542cef5e3811e1192ce70d8cc03d5c335900000006000000890123")}),it("should return a string when axios response is correct with a prefixed ticker",async()=>{const e={ticker:"tUSDC",descriptor:{data:"7474555344431c7d4b196cb0c7b01d743fbc6116a902379c72380000000600aa36a7",signatures:{prod:"0123"}}};vi.spyOn(o,"request").mockResolvedValue({data:[e]});const a=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(a.extract()).toEqual("067474555344431c7d4b196cb0c7b01d743fbc6116a902379c72380000000600aa36a70123")}),it("should return an error when data is empty",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:void 0});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no signature",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:[{}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no decimals",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:[{live_signature:"0x0",ticker:"USDC"}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error);const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations")))})});
|
|
2
2
|
//# sourceMappingURL=HttpTokenDataSource.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/token/data/HttpTokenDataSource.test.ts"],
|
|
4
|
-
"sourcesContent": ["import axios from \"axios\";\nimport { Left } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type TokenDto } from \"@/token/data/TokenDto\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpTokenDataSource\", () => {\n let datasource: TokenDataSource;\n\n beforeAll(() => {\n const config = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n datasource = new HttpTokenDataSource(config);\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getTokenInfosPayload({ address: \"0x00\", chainId: 1 });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: { [LEDGER_CLIENT_VERSION_HEADER]: version },\n }),\n );\n });\n\n it(\"should return a string when axios response is correct\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAW,QAClB,OAAS,QAAAC,MAAY,YAGrB,OAAS,gCAAAC,MAAoC,gCAC7C,OAAS,uBAAAC,MAA2B,mCAGpC,OAAOC,MAAa,qBAEpB,GAAG,KAAK,OAAO,EAEf,SAAS,sBAAuB,IAAM,CACpC,IAAIC,EAEJ,UAAU,IAAM,CACd,MAAMC,EAAS,CACb,IAAK,CACH,IAAK,kDACL,KAAM,OACN,OAAQ,MACV,CACF,EACAD,EAAa,IAAIF,EAAoBG,CAAM,EAC3C,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMC,EAAU,kBAAkBH,EAAQ,OAAO,GAC3CI,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAMR,EAAO,SAAS,EAAE,mBAAmBQ,CAAU,EAGxD,MAAMH,EAAW,qBAAqB,CAAE,QAAS,OAAQ,QAAS,CAAE,CAAC,EAGrE,OAAOG,CAAU,EAAE,qBACjB,OAAO,iBAAiB,CACtB,QAAS,CAAE,CAACN,CAA4B,EAAGK,CAAQ,CACrD,CAAC,CACH,CACF,CAAC,EAED,GAAG,wDAAyD,SAAY,CAEtE,MAAME,EAAqB,CACzB,OAAQ,OACR,WAAY,CACV,KAAM,
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { Left } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type TokenDto } from \"@/token/data/TokenDto\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpTokenDataSource\", () => {\n let datasource: TokenDataSource;\n\n beforeAll(() => {\n const config = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n datasource = new HttpTokenDataSource(config);\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getTokenInfosPayload({ address: \"0x00\", chainId: 1 });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: { [LEDGER_CLIENT_VERSION_HEADER]: version },\n }),\n );\n });\n\n it(\"should return a string when axios response is correct\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"555344433c499c542cef5e3811e1192ce70d8cc03d5c33590000000600000089\",\n signatures: {\n prod: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n \"04555344433c499c542cef5e3811e1192ce70d8cc03d5c335900000006000000890123\",\n );\n });\n\n it(\"should return a string when axios response is correct with a prefixed ticker\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"tUSDC\",\n descriptor: {\n data: \"7474555344431c7d4b196cb0c7b01d743fbc6116a902379c72380000000600aa36a7\",\n signatures: {\n prod: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n \"067474555344431c7d4b196cb0c7b01d743fbc6116a902379c72380000000600aa36a70123\",\n );\n });\n\n it(\"should return an error when data is empty\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: undefined });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no signature\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [{}] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no decimals\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: [{ live_signature: \"0x0\", ticker: \"USDC\" }],\n });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error());\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: Failed to fetch token informations\",\n ),\n ),\n );\n });\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["axios", "Left", "LEDGER_CLIENT_VERSION_HEADER", "HttpTokenDataSource", "PACKAGE", "datasource", "config", "version", "requestSpy", "tokenDTO", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var l=(o,e,a,t)=>{for(var n=t>1?void 0:t?y(e,a):e,i=o.length-1,d;i>=0;i--)(d=o[i])&&(n=(t?d(e,a,n):d(n))||n);return t&&n&&c(e,a,n),n},s=(o,e)=>(a,t)=>e(a,t,o);import{inject as m,injectable as u}from"inversify";import{ClearSignContextType as p}from"../../shared/model/ClearSignContext";import{tokenTypes as C}from"../../token/di/tokenTypes";let r=class{constructor(e){this._dataSource=e}canHandle(e,a){return a===p.TOKEN&&typeof e=="object"&&e!==null&&"chainId"in e&&"address"in e}async loadField(e){return(await this._dataSource.getTokenInfosPayload({address:e.address,chainId:e.chainId})).caseOf({Left:t=>({type:p.ERROR,error:t}),Right:t=>({type:p.TOKEN,payload:t})})}};r=l([u(),s(0,m(C.TokenDataSource))],r);export{r as TokenContextFieldLoader};
|
|
2
2
|
//# sourceMappingURL=TokenContextFieldLoader.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/token/domain/TokenContextFieldLoader.ts"],
|
|
4
|
-
"sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {
|
|
5
|
-
"mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,
|
|
6
|
-
"names": ["inject", "injectable", "
|
|
4
|
+
"sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { type ContextFieldLoader } from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\nexport type TokenFieldInput = {\n chainId: number;\n address: string;\n};\n\n@injectable()\nexport class TokenContextFieldLoader\n implements ContextFieldLoader<TokenFieldInput>\n{\n constructor(\n @inject(tokenTypes.TokenDataSource) private _dataSource: TokenDataSource,\n ) {}\n\n canHandle(\n input: unknown,\n expectedType: ClearSignContextType,\n ): input is TokenFieldInput {\n return (\n expectedType === ClearSignContextType.TOKEN &&\n typeof input === \"object\" &&\n input !== null &&\n \"chainId\" in input &&\n \"address\" in input\n );\n }\n\n async loadField(input: TokenFieldInput): Promise<ClearSignContext> {\n const payload = await this._dataSource.getTokenInfosPayload({\n address: input.address,\n chainId: input.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAEE,wBAAAC,MACK,kCAEP,OAAS,cAAAC,MAAkB,wBAQpB,IAAMC,EAAN,KAEP,CACE,YAC8CC,EAC5C,CAD4C,iBAAAA,CAC3C,CAEH,UACEC,EACAC,EAC0B,CAC1B,OACEA,IAAiBC,EAAqB,OACtC,OAAOF,GAAU,UACjBA,IAAU,MACV,YAAaA,GACb,YAAaA,CAEjB,CAEA,MAAM,UAAUA,EAAmD,CAKjE,OAJgB,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOG,IAA6B,CAClC,KAAMD,EAAqB,MAC3B,MAAAC,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMF,EAAqB,MAC3B,QAASE,CACX,EACF,CAAC,CACH,CACF,EApCaN,EAANO,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAW,eAAe,IAJzBX",
|
|
6
|
+
"names": ["inject", "injectable", "ClearSignContextType", "tokenTypes", "TokenContextFieldLoader", "_dataSource", "input", "expectedType", "ClearSignContextType", "error", "value", "__decorateClass", "injectable", "__decorateParam", "inject", "tokenTypes"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Left as
|
|
1
|
+
import{Left as r,Right as l}from"purify-ts";import{ClearSignContextType as d}from"../../shared/model/ClearSignContext";import{TokenContextFieldLoader as i}from"../../token/domain/TokenContextFieldLoader";describe("TokenContextFieldLoader",()=>{const o={getTokenInfosPayload:vi.fn()},t=new i(o),a={kind:"TOKEN",chainId:1,address:"0x1234567890abcdef"},s="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid token field",()=>{const e={kind:"TOKEN",chainId:1,address:"0x1234567890abcdef"};expect(t.canHandle(e,d.TOKEN)).toBe(!0)}),describe("should return false for invalid fields",()=>{const e=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing chainId",value:{kind:"TOKEN",address:"0x123"}},{name:"object missing address",value:{kind:"TOKEN",chainId:1}}];test.each(e)("$name",({value:n})=>{expect(t.canHandle(n,d.TOKEN)).toBe(!1)})}),it("should return false for invalid expected type",()=>{expect(t.canHandle(a,d.NFT)).toBe(!1)})}),describe("loadField",()=>{it("should return error context when token data source fails",async()=>{const e=new Error("Token data source error");vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(r(e));const n=await t.loadField(a);expect(o.getTokenInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(n).toEqual({type:d.ERROR,error:e})}),it("should return token context when successful",async()=>{vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(l(s));const e=await t.loadField(a);expect(o.getTokenInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(e).toEqual({type:d.TOKEN,payload:s})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...a,chainId:137,address:"0xdeadbeef"};vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(l(s));const n=await t.loadField(e);expect(o.getTokenInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(n).toEqual({type:d.TOKEN,payload:s})}),it("should preserve error message from token data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(r(e));const n=await t.loadField(a);expect(n).toEqual({type:d.ERROR,error:e})}),it("should handle empty token payload",async()=>{const e="";vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(l(e));const n=await t.loadField(a);expect(n).toEqual({type:d.TOKEN,payload:e})})})});
|
|
2
2
|
//# sourceMappingURL=TokenContextFieldLoader.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/token/domain/TokenContextFieldLoader.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport {
|
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,
|
|
6
|
-
"names": ["Left", "Right", "
|
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextFieldLoader } from \"@/token/domain/TokenContextFieldLoader\";\n\ndescribe(\"TokenContextFieldLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const tokenContextFieldLoader = new TokenContextFieldLoader(\n mockTokenDataSource,\n );\n\n const mockTransactionField = {\n kind: \"TOKEN\",\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockTokenPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid token field\", () => {\n // GIVEN\n const validField = {\n kind: \"TOKEN\",\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n // THEN\n expect(\n tokenContextFieldLoader.canHandle(\n validField,\n ClearSignContextType.TOKEN,\n ),\n ).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing chainId\",\n value: { kind: \"TOKEN\", address: \"0x123\" },\n },\n {\n name: \"object missing address\",\n value: { kind: \"TOKEN\", chainId: 1 },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(\n tokenContextFieldLoader.canHandle(value, ClearSignContextType.TOKEN),\n ).toBe(false);\n });\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(\n tokenContextFieldLoader.canHandle(\n mockTransactionField,\n ClearSignContextType.NFT,\n ),\n ).toBe(false);\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when token data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Token data source error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return token context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result = await tokenContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should preserve error message from token data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty token payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: emptyPayload,\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["Left", "Right", "ClearSignContextType", "TokenContextFieldLoader", "mockTokenDataSource", "tokenContextFieldLoader", "mockTransactionField", "mockTokenPayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=(a,e,t,o)=>{for(var r=o>1?void 0:o?u(e,t):e,n=a.length-1,i;n>=0;n--)(i=a[n])&&(r=(o?i(e,t,r):i(r))||r);return o&&r&&d(e,t,r),r},p=(a,e)=>(t,o)=>e(t,o,a);import{isHexaString as S}from"@ledgerhq/device-management-kit";import{inject as m,injectable as y}from"inversify";import{ClearSignContextType as s}from"../../shared/model/ClearSignContext";import{tokenTypes as g}from"../../token/di/tokenTypes";var x=(t=>(t.Approve="0x095ea7b3",t.Transfer="0xa9059cbb",t))(x||{});const C=Object.values(x),T=[s.TOKEN];let c=class{_dataSource;constructor(e){this._dataSource=e}canHandle(e,t){return typeof e=="object"&&e!==null&&"to"in e&&"selector"in e&&"chainId"in e&&typeof e.chainId=="number"&&S(e.to)&&e.to!=="0x"&&S(e.selector)&&this.isSelectorSupported(e.selector)&&T.every(o=>t.includes(o))}async load(e){const{to:t,chainId:o}=e;return[(await this._dataSource.getTokenInfosPayload({address:t,chainId:o})).caseOf({Left:n=>({type:s.ERROR,error:n}),Right:n=>({type:s.TOKEN,payload:n})})]}isSelectorSupported(e){return Object.values(C).includes(e)}};c=l([y(),p(0,m(g.TokenDataSource))],c);export{x as ERC20_SUPPORTED_SELECTORS,c as TokenContextLoader};
|
|
2
2
|
//# sourceMappingURL=TokenContextLoader.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/token/domain/TokenContextLoader.ts"],
|
|
4
|
-
"sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport
|
|
5
|
-
"mappings": "iOAAA,OAAqB,gBAAAA,MAAoB,kCACzC,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAEE,wBAAAC,MACK,
|
|
6
|
-
"names": ["isHexaString", "inject", "injectable", "ClearSignContextType", "tokenTypes", "ERC20_SUPPORTED_SELECTORS", "SUPPORTED_SELECTORS", "TokenContextLoader", "dataSource", "
|
|
4
|
+
"sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\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\";\n\nexport enum ERC20_SUPPORTED_SELECTORS {\n Approve = \"0x095ea7b3\",\n Transfer = \"0xa9059cbb\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = Object.values(\n ERC20_SUPPORTED_SELECTORS,\n);\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [ClearSignContextType.TOKEN];\n\nexport type TokenContextInput = {\n to: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\n@injectable()\nexport class TokenContextLoader implements ContextLoader<TokenContextInput> {\n private _dataSource: TokenDataSource;\n\n constructor(@inject(tokenTypes.TokenDataSource) dataSource: TokenDataSource) {\n this._dataSource = dataSource;\n }\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is TokenContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"to\" in input &&\n \"selector\" in input &&\n \"chainId\" in input &&\n typeof input.chainId === \"number\" &&\n isHexaString(input.to) &&\n input.to !== \"0x\" &&\n isHexaString(input.selector) &&\n this.isSelectorSupported(input.selector) &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: TokenContextInput): Promise<ClearSignContext[]> {\n const { to, chainId } = input;\n\n const payload = await this._dataSource.getTokenInfosPayload({\n address: to,\n chainId,\n });\n\n return [\n payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n }),\n ];\n }\n\n private isSelectorSupported(selector: HexaString) {\n return Object.values(SUPPORTED_SELECTORS).includes(selector);\n }\n}\n"],
|
|
5
|
+
"mappings": "iOAAA,OAAqB,gBAAAA,MAAoB,kCACzC,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAEE,wBAAAC,MACK,kCAEP,OAAS,cAAAC,MAAkB,wBAEpB,IAAKC,OACVA,EAAA,QAAU,aACVA,EAAA,SAAW,aAFDA,OAAA,IAKZ,MAAMC,EAAoC,OAAO,OAC/CD,CACF,EAEME,EAA0C,CAACC,EAAqB,KAAK,EASpE,IAAMC,EAAN,KAAqE,CAClE,YAER,YAAgDC,EAA6B,CAC3E,KAAK,YAAcA,CACrB,CAEA,UACEC,EACAC,EAC4B,CAC5B,OACE,OAAOD,GAAU,UACjBA,IAAU,MACV,OAAQA,GACR,aAAcA,GACd,YAAaA,GACb,OAAOA,EAAM,SAAY,UACzBE,EAAaF,EAAM,EAAE,GACrBA,EAAM,KAAO,MACbE,EAAaF,EAAM,QAAQ,GAC3B,KAAK,oBAAoBA,EAAM,QAAQ,GACvCJ,EAAgB,MAAOO,GAASF,EAAc,SAASE,CAAI,CAAC,CAEhE,CAEA,MAAM,KAAKH,EAAuD,CAChE,KAAM,CAAE,GAAAI,EAAI,QAAAC,CAAQ,EAAIL,EAOxB,MAAO,EALS,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASI,EACT,QAAAC,CACF,CAAC,GAGS,OAAO,CACb,KAAOC,IAA6B,CAClC,KAAMT,EAAqB,MAC3B,MAAAS,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMV,EAAqB,MAC3B,QAASU,CACX,EACF,CAAC,CACH,CACF,CAEQ,oBAAoBC,EAAsB,CAChD,OAAO,OAAO,OAAOb,CAAmB,EAAE,SAASa,CAAQ,CAC7D,CACF,EAnDaV,EAANW,EAAA,CADNC,EAAW,EAIGC,EAAA,EAAAC,EAAOC,EAAW,eAAe,IAHnCf",
|
|
6
|
+
"names": ["isHexaString", "inject", "injectable", "ClearSignContextType", "tokenTypes", "ERC20_SUPPORTED_SELECTORS", "SUPPORTED_SELECTORS", "SUPPORTED_TYPES", "ClearSignContextType", "TokenContextLoader", "dataSource", "input", "expectedTypes", "isHexaString", "type", "to", "chainId", "error", "value", "selector", "__decorateClass", "injectable", "__decorateParam", "inject", "tokenTypes"]
|
|
7
7
|
}
|