@ledgerhq/context-module 1.4.0 → 1.7.0
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 +2 -2
- 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 +2 -2
- package/lib/cjs/src/config/di/configModuleFactory.js +1 -1
- package/lib/cjs/src/config/di/configModuleFactory.js.map +3 -3
- 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/data/DynamicNetworkDataSource.js +2 -0
- package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
- package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
- package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
- package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
- package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
- package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +2 -0
- package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
- package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
- package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
- package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
- package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
- package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
- package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js +2 -0
- package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +2 -2
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.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/data/HttpNftDataSource.js +1 -1
- package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +3 -3
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +3 -3
- package/lib/cjs/src/nft/di/nftModuleFactory.js +1 -1
- package/lib/cjs/src/nft/di/nftModuleFactory.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 +2 -2
- package/lib/cjs/src/pki/di/pkiModuleFactory.js +1 -1
- package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +3 -3
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
- package/lib/cjs/src/shared/constant/HttpHeaders.js +1 -1
- package/lib/cjs/src/shared/constant/HttpHeaders.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/SolanaTransactionContext.js +2 -0
- package/lib/cjs/src/shared/model/SolanaTransactionContext.js.map +7 -0
- package/lib/cjs/src/shared/model/TransactionSubset.js +1 -1
- package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
- package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
- package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
- package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
- package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
- package/lib/cjs/src/solana/data/SolanaDataSource.js +2 -0
- package/lib/cjs/src/solana/data/SolanaDataSource.js.map +7 -0
- package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js +2 -0
- package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
- package/lib/cjs/src/solana/di/solanaContextTypes.js +2 -0
- package/lib/cjs/src/solana/di/solanaContextTypes.js.map +7 -0
- package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
- package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
- package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
- package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
- package/lib/cjs/src/solana/domain/SolanaContextLoader.js +2 -0
- package/lib/cjs/src/solana/domain/SolanaContextLoader.js.map +7 -0
- package/lib/cjs/src/solana/domain/solanaContextTypes.js +2 -0
- package/lib/cjs/src/solana/domain/solanaContextTypes.js.map +7 -0
- package/lib/cjs/src/token/di/tokenModuleFactory.js +1 -1
- package/lib/cjs/src/token/di/tokenModuleFactory.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 +2 -2
- package/lib/cjs/src/transaction/data/HttpProxyDataSource.js +2 -0
- package/lib/cjs/src/transaction/data/HttpProxyDataSource.js.map +7 -0
- package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js +2 -0
- package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js.map +7 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +2 -2
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
- package/lib/cjs/src/transaction/data/{CalldataDto.js.map → dto/CalldataDto.js.map} +1 -1
- package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js +2 -0
- package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js.map +7 -0
- package/lib/cjs/src/transaction/data/dto/ProxyImplementationAddressDto.js +2 -0
- package/lib/cjs/src/transaction/data/dto/ProxyImplementationAddressDto.js.map +7 -0
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js +1 -1
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +3 -3
- package/lib/cjs/src/transaction/di/transactionTypes.js +1 -1
- package/lib/cjs/src/transaction/di/transactionTypes.js.map +2 -2
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +3 -3
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
- package/lib/cjs/src/transaction/model/ProxyDelegateCall.js +2 -0
- package/lib/cjs/src/transaction/model/ProxyDelegateCall.js.map +7 -0
- package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js +2 -0
- package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +2 -2
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
- package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
- package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.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 +2 -2
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +2 -2
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +1 -1
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
- package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +1 -1
- package/lib/cjs/src/uniswap/di/uniswapModuleFactory.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 +2 -2
- package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
- package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +2 -2
- package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
- package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +2 -2
- package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +1 -1
- package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
- package/lib/esm/package.json +2 -2
- 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 +2 -2
- package/lib/esm/src/config/di/configModuleFactory.js +1 -1
- package/lib/esm/src/config/di/configModuleFactory.js.map +3 -3
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js +1 -0
- package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
- package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
- package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
- package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
- package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +1 -0
- package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
- package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
- package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
- package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
- package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
- package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
- package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js +1 -0
- package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.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/data/HttpNftDataSource.js +1 -1
- package/lib/esm/src/nft/data/HttpNftDataSource.js.map +3 -3
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +3 -3
- package/lib/esm/src/nft/di/nftModuleFactory.js +1 -1
- package/lib/esm/src/nft/di/nftModuleFactory.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 +2 -2
- package/lib/esm/src/pki/di/pkiModuleFactory.js +1 -1
- package/lib/esm/src/pki/di/pkiModuleFactory.js.map +3 -3
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
- package/lib/esm/src/shared/constant/HttpHeaders.js +1 -1
- package/lib/esm/src/shared/constant/HttpHeaders.js.map +1 -1
- 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/SolanaTransactionContext.js +1 -0
- package/lib/esm/src/shared/model/SolanaTransactionContext.js.map +7 -0
- package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
- package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
- package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
- package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
- package/lib/esm/src/solana/data/SolanaDataSource.js +1 -0
- package/lib/esm/src/solana/data/SolanaDataSource.js.map +7 -0
- package/lib/esm/src/solana/di/SolanaContextModuleFactory.js +2 -0
- package/lib/esm/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
- package/lib/esm/src/solana/di/solanaContextTypes.js +2 -0
- package/lib/esm/src/solana/di/solanaContextTypes.js.map +7 -0
- package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
- package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
- package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
- package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
- package/lib/esm/src/solana/domain/SolanaContextLoader.js +1 -0
- package/lib/esm/src/solana/domain/SolanaContextLoader.js.map +7 -0
- package/lib/esm/src/solana/domain/solanaContextTypes.js +1 -0
- package/lib/esm/src/solana/domain/solanaContextTypes.js.map +7 -0
- package/lib/esm/src/token/di/tokenModuleFactory.js +1 -1
- package/lib/esm/src/token/di/tokenModuleFactory.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 +2 -2
- package/lib/esm/src/transaction/data/HttpProxyDataSource.js +2 -0
- package/lib/esm/src/transaction/data/HttpProxyDataSource.js.map +7 -0
- package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js +2 -0
- package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js.map +7 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
- package/lib/esm/src/transaction/data/dto/CalldataDto.js.map +7 -0
- package/lib/esm/src/transaction/data/dto/ProxyDelegateCallDto.js +1 -0
- package/lib/esm/src/transaction/data/dto/ProxyDelegateCallDto.js.map +7 -0
- package/lib/esm/src/transaction/data/dto/ProxyImplementationAddressDto.js +1 -0
- package/lib/esm/src/transaction/data/dto/ProxyImplementationAddressDto.js.map +7 -0
- package/lib/esm/src/transaction/di/transactionModuleFactory.js +1 -1
- package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +3 -3
- package/lib/esm/src/transaction/di/transactionTypes.js +1 -1
- package/lib/esm/src/transaction/di/transactionTypes.js.map +2 -2
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +3 -3
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
- package/lib/esm/src/transaction/model/ProxyDelegateCall.js +1 -0
- package/lib/esm/src/transaction/model/ProxyDelegateCall.js.map +7 -0
- package/lib/esm/src/transaction/model/ProxyImplementationAddress.js +1 -0
- package/lib/esm/src/transaction/model/ProxyImplementationAddress.js.map +7 -0
- 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 +3 -3
- package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
- package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.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 +2 -2
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +1 -1
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
- package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +1 -1
- package/lib/esm/src/uniswap/di/uniswapModuleFactory.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 +2 -2
- package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
- package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
- package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
- package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
- package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +1 -1
- package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
- package/lib/types/src/ContextModule.d.ts +3 -0
- package/lib/types/src/ContextModule.d.ts.map +1 -1
- package/lib/types/src/ContextModuleBuilder.d.ts +18 -3
- package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
- package/lib/types/src/DefaultContextModule.d.ts +5 -0
- package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
- package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -1
- package/lib/types/src/config/model/ContextModuleConfig.d.ts +6 -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/data/DynamicNetworkDataSource.d.ts +6 -0
- package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts +13 -0
- package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts +2 -0
- package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts +14 -0
- package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts +3 -0
- package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts +5 -0
- package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +15 -0
- package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts +2 -0
- package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts +16 -0
- package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts.map +1 -0
- package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -1
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +1 -1
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
- package/lib/types/src/index.d.ts +2 -0
- package/lib/types/src/index.d.ts.map +1 -1
- package/lib/types/src/nft/data/HttpNftDataSource.d.ts +3 -0
- package/lib/types/src/nft/data/HttpNftDataSource.d.ts.map +1 -1
- package/lib/types/src/nft/domain/NftContextLoader.d.ts +1 -1
- package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
- package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -1
- package/lib/types/src/shared/constant/HttpHeaders.d.ts +1 -1
- package/lib/types/src/shared/constant/HttpHeaders.d.ts.map +1 -1
- package/lib/types/src/shared/model/ClearSignContext.d.ts +3 -0
- package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
- package/lib/types/src/shared/model/SolanaTransactionContext.d.ts +11 -0
- package/lib/types/src/shared/model/SolanaTransactionContext.d.ts.map +1 -0
- package/lib/types/src/shared/model/TransactionSubset.d.ts +3 -3
- package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -1
- package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts +13 -0
- package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts.map +1 -0
- package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts +2 -0
- package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts.map +1 -0
- package/lib/types/src/solana/data/SolanaDataSource.d.ts +12 -0
- package/lib/types/src/solana/data/SolanaDataSource.d.ts.map +1 -0
- package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts +3 -0
- package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts.map +1 -0
- package/lib/types/src/solana/di/solanaContextTypes.d.ts +5 -0
- package/lib/types/src/solana/di/solanaContextTypes.d.ts.map +1 -0
- package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts +11 -0
- package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts.map +1 -0
- package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts +2 -0
- package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/solana/domain/SolanaContextLoader.d.ts +5 -0
- package/lib/types/src/solana/domain/SolanaContextLoader.d.ts.map +1 -0
- package/lib/types/src/solana/domain/solanaContextTypes.d.ts +27 -0
- package/lib/types/src/solana/domain/solanaContextTypes.d.ts.map +1 -0
- package/lib/types/src/token/domain/TokenContextLoader.d.ts +1 -1
- package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
- package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts +33 -0
- package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts.map +1 -0
- package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts +2 -0
- package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts.map +1 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
- package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +1 -0
- package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts +5 -0
- package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
- package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts +6 -0
- package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
- package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -1
- package/lib/types/src/transaction/di/transactionTypes.d.ts +1 -0
- package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -1
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +4 -2
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
- package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts +5 -0
- package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts.map +1 -0
- package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts +4 -0
- package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +1 -1
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
- package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +1 -1
- package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
- package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/lib/types/src/transaction/data/CalldataDto.d.ts.map +0 -1
- /package/lib/cjs/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +0 -0
- /package/lib/esm/src/{transaction/data/CalldataDto.js.map → dynamic-network/data/DynamicNetworkDataSource.js.map} +0 -0
- /package/lib/esm/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +0 -0
- /package/lib/types/src/transaction/data/{CalldataDto.d.ts → dto/CalldataDto.d.ts} +0 -0
package/lib/cjs/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/context-module",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"exports": {
|
|
@@ -53,6 +53,6 @@
|
|
|
53
53
|
"reflect-metadata": "catalog:"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@ledgerhq/device-management-kit": "
|
|
56
|
+
"@ledgerhq/device-management-kit": "workspace:*"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var p=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!x.call(e,o)&&o!==r&&a(e,o,{get:()=>t[o],enumerable:!(n=i(t,o))||n.enumerable});return e};var s=e=>p(a({},"__esModule",{value:!0}),e);var l={};module.exports=s(l);
|
|
2
2
|
//# sourceMappingURL=ContextModule.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ContextModule.ts"],
|
|
4
|
-
"sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\n\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { type TypedDataClearSignContext } from \"./shared/model/TypedDataClearSignContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport { type Web3CheckContext } from \"./web3-check/domain/web3CheckTypes\";\n\nexport interface ContextModule {\n getContext(field: TransactionFieldContext): Promise<ClearSignContext>;\n getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;\n getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext>;\n getWeb3Checks(\n transactionContext: Web3CheckContext,\n ): Promise<ClearSignContext | null>;\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\n\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { type TypedDataClearSignContext } from \"./shared/model/TypedDataClearSignContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\nimport { type Web3CheckContext } from \"./web3-check/domain/web3CheckTypes\";\n\nexport interface ContextModule {\n getContext(field: TransactionFieldContext): Promise<ClearSignContext>;\n getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;\n getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext>;\n getWeb3Checks(\n transactionContext: Web3CheckContext,\n ): Promise<ClearSignContext | null>;\n getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult>;\n}\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["ContextModule_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!C.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(i=s(e,o))||i.enumerable});return t};var f=t=>l(n({},"__esModule",{value:!0}),t);var L={};u(L,{ContextModuleBuilder:()=>m,DEFAULT_CONFIG:()=>d});module.exports=f(L);var a=require("./DefaultContextModule");const g="https://crypto-assets-service.api.ledger.com/v1",h="https://web3checks-backend.api.ledger.com/v3",p="https://nft.api.live.ledger.com",d={cal:{url:g,mode:"prod",branch:"main"},web3checks:{url:h},metadataServiceDomain:{url:p},defaultLoaders:!0,customLoaders:[],customTypedDataLoader:void 0,customSolanaLoader:void 0};class m{config=d;needOriginToken=!0;originToken;constructor({originToken:e}={}){this.originToken=e}removeDefaultLoaders(){return this.config.defaultLoaders=!1,this}addLoader(e){return this.config.customLoaders.push(e),this}addTypedDataLoader(e){return this.config.customTypedDataLoader=e,this}addWeb3CheckLoader(e){return this.needOriginToken=!1,this.config.customWeb3CheckLoader=e,this}addSolanaLoader(e){return this.config.customSolanaLoader=e,this}setCalConfig(e){return this.config.cal=e,this}setMetadataServiceConfig(e){return this.config.metadataServiceDomain=e,this}setWeb3ChecksConfig(e){return this.config.web3checks=e,this}build(){if(this.needOriginToken&&!this.originToken)throw new Error("Origin token is required");const e={...this.config,originToken:this.originToken};return new a.DefaultContextModule(e)}}0&&(module.exports={ContextModuleBuilder,DEFAULT_CONFIG});
|
|
2
2
|
//# sourceMappingURL=ContextModuleBuilder.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ContextModuleBuilder.ts"],
|
|
4
|
-
"sourcesContent": ["import { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n type ContextModuleWeb3ChecksConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport { type TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { type Web3CheckContextLoader } from \"./web3-check/domain/Web3CheckContextLoader\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst DEFAULT_CAL_URL = \"https://crypto-assets-service.api.ledger.com/v1\";\nconst DEFAULT_WEB3_CHECKS_URL = \"https://web3checks-backend.api.ledger.com/v3\";\n\nexport const DEFAULT_CONFIG: ContextModuleConfig = {\n cal: {\n url: DEFAULT_CAL_URL,\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: DEFAULT_WEB3_CHECKS_URL,\n },\n defaultLoaders: true,\n customLoaders: [],\n customTypedDataLoader: undefined,\n};\n\nexport class ContextModuleBuilder {\n private config: ContextModuleConfig = DEFAULT_CONFIG;\n private needOriginToken: boolean = true;\n private originToken?: string;\n\n constructor({ originToken }: ContextModuleConstructorArgs = {}) {\n this.originToken = originToken;\n }\n\n /**\n * Remove default loaders from the list of loaders\n *\n * @returns this\n */\n removeDefaultLoaders() {\n this.config.defaultLoaders = false;\n return this;\n }\n\n /**\n * Add a custom loader to the list of loaders\n *\n * @param loader loader to add to the list of loaders\n * @returns this\n */\n addLoader(loader: ContextLoader) {\n this.config.customLoaders.push(loader);\n return this;\n }\n\n /**\n * Replace the default loader for typed data clear signing contexts\n *\n * @param loader loader to use for typed data clear signing contexts\n * @returns this\n */\n addTypedDataLoader(loader: TypedDataContextLoader) {\n this.config.customTypedDataLoader = loader;\n return this;\n }\n\n /**\n * Replace the default loader for web3 checks\n *\n * @param loader loader to use for web3 checks\n * @returns this\n */\n addWeb3CheckLoader(loader: Web3CheckContextLoader) {\n this.needOriginToken = false;\n this.config.customWeb3CheckLoader = loader;\n return this;\n }\n\n /**\n * Add a custom CAL configuration\n *\n * @param calConfig\n * @returns this\n */\n
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,mBAAAC,IAAA,eAAAC,EAAAJ,
|
|
6
|
-
"names": ["ContextModuleBuilder_exports", "__export", "ContextModuleBuilder", "DEFAULT_CONFIG", "__toCommonJS", "import_DefaultContextModule", "DEFAULT_CAL_URL", "DEFAULT_WEB3_CHECKS_URL", "originToken", "loader", "calConfig", "web3ChecksConfig", "config"]
|
|
4
|
+
"sourcesContent": ["import { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n type ContextModuleMetadataServiceConfig,\n type ContextModuleWeb3ChecksConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { type Web3CheckContextLoader } from \"./web3-check/domain/Web3CheckContextLoader\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst DEFAULT_CAL_URL = \"https://crypto-assets-service.api.ledger.com/v1\";\nconst DEFAULT_WEB3_CHECKS_URL = \"https://web3checks-backend.api.ledger.com/v3\";\nconst DEFAULT_METADATA_SERVICE_DOMAIN = \"https://nft.api.live.ledger.com\";\n\nexport const DEFAULT_CONFIG: ContextModuleConfig = {\n cal: {\n url: DEFAULT_CAL_URL,\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: DEFAULT_WEB3_CHECKS_URL,\n },\n metadataServiceDomain: {\n url: DEFAULT_METADATA_SERVICE_DOMAIN,\n },\n defaultLoaders: true,\n customLoaders: [],\n customTypedDataLoader: undefined,\n customSolanaLoader: undefined,\n};\n\nexport class ContextModuleBuilder {\n private config: ContextModuleConfig = DEFAULT_CONFIG;\n private needOriginToken: boolean = true;\n private originToken?: string;\n\n constructor({ originToken }: ContextModuleConstructorArgs = {}) {\n this.originToken = originToken;\n }\n\n /**\n * Remove default loaders from the list of loaders\n *\n * @returns this\n */\n removeDefaultLoaders() {\n this.config.defaultLoaders = false;\n return this;\n }\n\n /**\n * Add a custom loader to the list of loaders\n *\n * @param loader loader to add to the list of loaders\n * @returns this\n */\n addLoader(loader: ContextLoader) {\n this.config.customLoaders.push(loader);\n return this;\n }\n\n /**\n * Replace the default loader for typed data clear signing contexts\n *\n * @param loader loader to use for typed data clear signing contexts\n * @returns this\n */\n addTypedDataLoader(loader: TypedDataContextLoader) {\n this.config.customTypedDataLoader = loader;\n return this;\n }\n\n /**\n * Replace the default loader for web3 checks\n *\n * @param loader loader to use for web3 checks\n * @returns this\n */\n addWeb3CheckLoader(loader: Web3CheckContextLoader) {\n this.needOriginToken = false;\n this.config.customWeb3CheckLoader = loader;\n return this;\n }\n\n /**\n * Replace the default loader for Solana context\n *\n * @param loader loader to use for Solana context\n * @returns this\n */\n addSolanaLoader(loader: SolanaContextLoader) {\n this.config.customSolanaLoader = loader;\n return this;\n }\n\n /**\n * Add a custom CAL configuration\n *\n * @param calConfig\n * @returns this\n */\n setCalConfig(calConfig: ContextModuleCalConfig) {\n this.config.cal = calConfig;\n return this;\n }\n\n /**\n * Add a custom metadata service configuration\n *\n * @param metadataServiceConfig\n * @returns this\n */\n setMetadataServiceConfig(\n metadataServiceConfig: ContextModuleMetadataServiceConfig,\n ) {\n this.config.metadataServiceDomain = metadataServiceConfig;\n return this;\n }\n\n /**\n * Add a custom web3 checks configuration\n *\n * @param web3ChecksConfig\n * @returns this\n */\n setWeb3ChecksConfig(web3ChecksConfig: ContextModuleWeb3ChecksConfig) {\n this.config.web3checks = web3ChecksConfig;\n return this;\n }\n\n /**\n * Build the context module\n *\n * @returns the context module\n */\n build(): ContextModule {\n if (this.needOriginToken && !this.originToken) {\n throw new Error(\"Origin token is required\");\n }\n\n const config = { ...this.config, originToken: this.originToken };\n return new DefaultContextModule(config);\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,mBAAAC,IAAA,eAAAC,EAAAJ,GAYA,IAAAK,EAAqC,kCAErC,MAAMC,EAAkB,kDAClBC,EAA0B,+CAC1BC,EAAkC,kCAE3BL,EAAsC,CACjD,IAAK,CACH,IAAKG,EACL,KAAM,OACN,OAAQ,MACV,EACA,WAAY,CACV,IAAKC,CACP,EACA,sBAAuB,CACrB,IAAKC,CACP,EACA,eAAgB,GAChB,cAAe,CAAC,EAChB,sBAAuB,OACvB,mBAAoB,MACtB,EAEO,MAAMN,CAAqB,CACxB,OAA8BC,EAC9B,gBAA2B,GAC3B,YAER,YAAY,CAAE,YAAAM,CAAY,EAAkC,CAAC,EAAG,CAC9D,KAAK,YAAcA,CACrB,CAOA,sBAAuB,CACrB,YAAK,OAAO,eAAiB,GACtB,IACT,CAQA,UAAUC,EAAuB,CAC/B,YAAK,OAAO,cAAc,KAAKA,CAAM,EAC9B,IACT,CAQA,mBAAmBA,EAAgC,CACjD,YAAK,OAAO,sBAAwBA,EAC7B,IACT,CAQA,mBAAmBA,EAAgC,CACjD,YAAK,gBAAkB,GACvB,KAAK,OAAO,sBAAwBA,EAC7B,IACT,CAQA,gBAAgBA,EAA6B,CAC3C,YAAK,OAAO,mBAAqBA,EAC1B,IACT,CAQA,aAAaC,EAAmC,CAC9C,YAAK,OAAO,IAAMA,EACX,IACT,CAQA,yBACEC,EACA,CACA,YAAK,OAAO,sBAAwBA,EAC7B,IACT,CAQA,oBAAoBC,EAAiD,CACnE,YAAK,OAAO,WAAaA,EAClB,IACT,CAOA,OAAuB,CACrB,GAAI,KAAK,iBAAmB,CAAC,KAAK,YAChC,MAAM,IAAI,MAAM,0BAA0B,EAG5C,MAAMC,EAAS,CAAE,GAAG,KAAK,OAAQ,YAAa,KAAK,WAAY,EAC/D,OAAO,IAAI,uBAAqBA,CAAM,CACxC,CACF",
|
|
6
|
+
"names": ["ContextModuleBuilder_exports", "__export", "ContextModuleBuilder", "DEFAULT_CONFIG", "__toCommonJS", "import_DefaultContextModule", "DEFAULT_CAL_URL", "DEFAULT_WEB3_CHECKS_URL", "DEFAULT_METADATA_SERVICE_DOMAIN", "originToken", "loader", "calConfig", "metadataServiceConfig", "web3ChecksConfig", "config"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=require("./config/di/configTypes"),c=require("./ContextModuleBuilder"),r=require("./DefaultContextModule");describe("ContextModuleBuilder",()=>{const d={url:"https://cal/v1",mode:"prod",branch:"main"},a={url:"https://web3checks/v1"},i={originToken:"test"};beforeEach(()=>{vi.resetAllMocks()}),it("should return a default context module",()=>{const e=new c.ContextModuleBuilder(i).build();expect(e).toBeInstanceOf(r.DefaultContextModule)}),it("should return a custom context module",()=>{const t=new c.ContextModuleBuilder(i),e={load:vi.fn()},o=t.removeDefaultLoaders().addLoader(e).build();expect(o).toBeInstanceOf(r.DefaultContextModule)}),it("should return a custom context module with a custom typed data loader",()=>{const t=new c.ContextModuleBuilder(i),e={load:vi.fn()},o=t.removeDefaultLoaders().addTypedDataLoader(e).build();expect(o).toBeInstanceOf(r.DefaultContextModule),expect(o._typedDataLoader).toBe(e)}),it("should return a custom context module with a custom config",()=>{const e=new c.ContextModuleBuilder(i).setCalConfig(d).setWeb3ChecksConfig(a).build(),o=e._container.get(s.configTypes.Config);expect(e).toBeInstanceOf(r.DefaultContextModule),expect(o.cal).toEqual(d),expect(o.web3checks).toEqual(a)}),it("should return a custom context module with a custom custom web3checks loader",()=>{const t=new c.ContextModuleBuilder,e={load:vi.fn()},o=t.removeDefaultLoaders().addWeb3CheckLoader(e).build();expect(o).toBeInstanceOf(r.DefaultContextModule),expect(o._web3CheckLoader).toBe(e)}),it("should throw an error if origin token is not provided",()=>{const t=new c.ContextModuleBuilder;expect(()=>t.build()).toThrow("Origin token is required")}),it("should not throw an error if origin token is provided",()=>{const t=new c.ContextModuleBuilder(i);expect(()=>t.build()).not.toThrow()}),it("should not throw an error if origin token is not provided and addWeb3CheckLoader is called",()=>{const t=new c.ContextModuleBuilder;expect(()=>t.addWeb3CheckLoader({load:vi.fn()}).build()).not.toThrow()}),describe("setMetadataServiceConfig",()=>{it("should set the metadata service configuration",()=>{const t=new c.ContextModuleBuilder(i),e={url:"https://custom-metadata-service.com/v3"},o=t.setMetadataServiceConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(r.DefaultContextModule),expect(n.metadataServiceDomain).toEqual(e)}),it("should override the default metadata service configuration",()=>{const t=new c.ContextModuleBuilder(i),e={url:"https://override-metadata-service.com/v1"},n=t.setMetadataServiceConfig(e).build()._container.get(s.configTypes.Config);expect(n.metadataServiceDomain.url).toBe(e.url),expect(n.metadataServiceDomain.url).not.toBe("https://nft.api.live.ledger.com/v2")})}),describe("setCalConfig",()=>{it("should set the CAL configuration",()=>{const t=new c.ContextModuleBuilder(i),e={url:"https://custom-cal-service.com/v2",mode:"test",branch:"next"},o=t.setCalConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(r.DefaultContextModule),expect(n.cal).toEqual(e)}),it("should override the default CAL configuration",()=>{const t=new c.ContextModuleBuilder(i),e={url:"https://override-cal-service.com/v1",mode:"prod",branch:"demo"},n=t.setCalConfig(e).build()._container.get(s.configTypes.Config);expect(n.cal.url).toBe(e.url),expect(n.cal.mode).toBe(e.mode),expect(n.cal.branch).toBe(e.branch),expect(n.cal.url).not.toBe("https://crypto-assets-service.api.ledger.com/v1")})}),describe("setWeb3ChecksConfig",()=>{it("should set the web3 checks configuration",()=>{const t=new c.ContextModuleBuilder(i),e={url:"https://custom-web3checks-service.com/v4"},o=t.setWeb3ChecksConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(r.DefaultContextModule),expect(n.web3checks).toEqual(e)}),it("should override the default web3 checks configuration",()=>{const t=new c.ContextModuleBuilder(i),e={url:"https://override-web3checks-service.com/v2"},n=t.setWeb3ChecksConfig(e).build()._container.get(s.configTypes.Config);expect(n.web3checks.url).toBe(e.url),expect(n.web3checks.url).not.toBe("https://web3checks-backend.api.ledger.com/v3")})})});
|
|
2
2
|
//# sourceMappingURL=ContextModuleBuilder.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ContextModuleBuilder.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { type Container } from \"inversify\";\n\nimport { configTypes } from \"./config/di/configTypes\";\nimport { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { ContextModuleBuilder } from \"./ContextModuleBuilder\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\ndescribe(\"ContextModuleBuilder\", () => {\n const defaultCalConfig: ContextModuleCalConfig = {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n };\n const defaultWeb3ChecksConfig = {\n url: \"https://web3checks/v1\",\n };\n const defaultBuilderArgs: ContextModuleConstructorArgs = {\n originToken: \"test\",\n };\n it(\"should return a default context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder.build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module with a custom typed data loader\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addTypedDataLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n // @ts-expect-error _typedDataLoader is private\n expect(res[\"_typedDataLoader\"]).toBe(customLoader);\n });\n\n it(\"should return a custom context module with a custom config\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder\n .
|
|
5
|
-
"mappings": "aAEA,IAAAA,EAA4B,
|
|
6
|
-
"names": ["import_configTypes", "import_ContextModuleBuilder", "import_DefaultContextModule", "defaultCalConfig", "defaultWeb3ChecksConfig", "defaultBuilderArgs", "res", "contextModuleBuilder", "customLoader", "config"]
|
|
4
|
+
"sourcesContent": ["import { type Container } from \"inversify\";\n\nimport { configTypes } from \"./config/di/configTypes\";\nimport { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n type ContextModuleMetadataServiceConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { ContextModuleBuilder } from \"./ContextModuleBuilder\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\ndescribe(\"ContextModuleBuilder\", () => {\n const defaultCalConfig: ContextModuleCalConfig = {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n };\n const defaultWeb3ChecksConfig = {\n url: \"https://web3checks/v1\",\n };\n const defaultBuilderArgs: ContextModuleConstructorArgs = {\n originToken: \"test\",\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should return a default context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder.build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module with a custom typed data loader\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addTypedDataLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n // @ts-expect-error _typedDataLoader is private\n expect(res[\"_typedDataLoader\"]).toBe(customLoader);\n });\n\n it(\"should return a custom context module with a custom config\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder\n .setCalConfig(defaultCalConfig)\n .setWeb3ChecksConfig(defaultWeb3ChecksConfig)\n .build();\n // @ts-expect-error _container is private\n const config = (res[\"_container\"] as Container).get<ContextModuleConfig>(\n configTypes.Config,\n );\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.cal).toEqual(defaultCalConfig);\n expect(config.web3checks).toEqual(defaultWeb3ChecksConfig);\n });\n\n it(\"should return a custom context module with a custom custom web3checks loader\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addWeb3CheckLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n // @ts-expect-error _web3CheckLoader is private\n expect(res[\"_web3CheckLoader\"]).toBe(customLoader);\n });\n\n it(\"should throw an error if origin token is not provided\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n\n expect(() => contextModuleBuilder.build()).toThrow(\n \"Origin token is required\",\n );\n });\n\n it(\"should not throw an error if origin token is provided\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n expect(() => contextModuleBuilder.build()).not.toThrow();\n });\n\n it(\"should not throw an error if origin token is not provided and addWeb3CheckLoader is called\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n\n expect(() =>\n contextModuleBuilder.addWeb3CheckLoader({ load: vi.fn() }).build(),\n ).not.toThrow();\n });\n\n describe(\"setMetadataServiceConfig\", () => {\n it(\"should set the metadata service configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customMetadataConfig: ContextModuleMetadataServiceConfig = {\n url: \"https://custom-metadata-service.com/v3\",\n };\n\n const res = contextModuleBuilder\n .setMetadataServiceConfig(customMetadataConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.metadataServiceDomain).toEqual(customMetadataConfig);\n });\n\n it(\"should override the default metadata service configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customMetadataConfig: ContextModuleMetadataServiceConfig = {\n url: \"https://override-metadata-service.com/v1\",\n };\n\n const res = contextModuleBuilder\n .setMetadataServiceConfig(customMetadataConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.metadataServiceDomain.url).toBe(customMetadataConfig.url);\n expect(config.metadataServiceDomain.url).not.toBe(\n \"https://nft.api.live.ledger.com/v2\",\n );\n });\n });\n\n describe(\"setCalConfig\", () => {\n it(\"should set the CAL configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customCalConfig: ContextModuleCalConfig = {\n url: \"https://custom-cal-service.com/v2\",\n mode: \"test\",\n branch: \"next\",\n };\n\n const res = contextModuleBuilder.setCalConfig(customCalConfig).build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.cal).toEqual(customCalConfig);\n });\n\n it(\"should override the default CAL configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customCalConfig: ContextModuleCalConfig = {\n url: \"https://override-cal-service.com/v1\",\n mode: \"prod\",\n branch: \"demo\",\n };\n\n const res = contextModuleBuilder.setCalConfig(customCalConfig).build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.cal.url).toBe(customCalConfig.url);\n expect(config.cal.mode).toBe(customCalConfig.mode);\n expect(config.cal.branch).toBe(customCalConfig.branch);\n expect(config.cal.url).not.toBe(\n \"https://crypto-assets-service.api.ledger.com/v1\",\n );\n });\n });\n\n describe(\"setWeb3ChecksConfig\", () => {\n it(\"should set the web3 checks configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customWeb3ChecksConfig = {\n url: \"https://custom-web3checks-service.com/v4\",\n };\n\n const res = contextModuleBuilder\n .setWeb3ChecksConfig(customWeb3ChecksConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.web3checks).toEqual(customWeb3ChecksConfig);\n });\n\n it(\"should override the default web3 checks configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customWeb3ChecksConfig = {\n url: \"https://override-web3checks-service.com/v2\",\n };\n\n const res = contextModuleBuilder\n .setWeb3ChecksConfig(customWeb3ChecksConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.web3checks.url).toBe(customWeb3ChecksConfig.url);\n expect(config.web3checks.url).not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,EAAO,UAAU,EAAE,QAAQG,CAAsB,CAC1D,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,MAAML,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEO,EAAyB,CAC7B,IAAK,4CACP,EAKMH,EAHMF,EACT,oBAAoBK,CAAsB,EAC1C,MAAM,EAEP,WACA,IAAyB,cAAY,MAAM,EAE7C,OAAOH,EAAO,WAAW,GAAG,EAAE,KAAKG,EAAuB,GAAG,EAC7D,OAAOH,EAAO,WAAW,GAAG,EAAE,IAAI,KAChC,8CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_configTypes", "import_ContextModuleBuilder", "import_DefaultContextModule", "defaultCalConfig", "defaultWeb3ChecksConfig", "defaultBuilderArgs", "res", "contextModuleBuilder", "customLoader", "config", "customMetadataConfig", "customCalConfig", "customWeb3ChecksConfig"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var g=(a,t)=>{for(var o in t)n(a,o,{get:t[o],enumerable:!0})},D=(a,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of T(t))!_.call(a,e)&&e!==o&&n(a,e,{get:()=>t[e],enumerable:!(r=h(t,e))||r.enumerable});return a};var k=a=>D(n({},"__esModule",{value:!0}),a);var b={};g(b,{DefaultContextModule:()=>S});module.exports=k(b);var p=require("purify-ts"),d=require("./dynamic-network/di/dynamicNetworkTypes"),s=require("./transaction/di/transactionTypes"),C=require("./trusted-name/di/trustedNameTypes"),m=require("./external-plugin/di/externalPluginTypes"),l=require("./nft/di/nftTypes"),i=require("./shared/model/ClearSignContext"),c=require("./solana/di/solanaContextTypes"),x=require("./token/di/tokenTypes"),y=require("./typed-data/di/typedDataTypes"),L=require("./uniswap/di/uniswapTypes"),f=require("./web3-check/di/web3CheckTypes"),u=require("./di");class S{_container;_loaders;_typedDataLoader;_web3CheckLoader;_solanaLoader;constructor(t){this._container=(0,u.makeContainer)({config:t}),this._loaders=t.defaultLoaders?this._getDefaultLoaders():[],this._loaders.push(...t.customLoaders),this._typedDataLoader=t.customTypedDataLoader??this._getDefaultTypedDataLoader(),this._web3CheckLoader=t.customWeb3CheckLoader??this._getWeb3CheckLoader(),this._solanaLoader=t.customSolanaLoader??this._getSolanaLoader()}_getDefaultLoaders(){return[this._container.get(m.externalPluginTypes.ExternalPluginContextLoader),this._container.get(C.trustedNameTypes.TrustedNameContextLoader),this._container.get(l.nftTypes.NftContextLoader),this._container.get(x.tokenTypes.TokenContextLoader),this._container.get(s.transactionTypes.TransactionContextLoader),this._container.get(L.uniswapTypes.UniswapContextLoader),this._container.get(d.dynamicNetworkTypes.DynamicNetworkContextLoader)]}_getDefaultTypedDataLoader(){return this._container.get(y.typedDataTypes.TypedDataContextLoader)}_getWeb3CheckLoader(){return this._container.get(f.web3CheckTypes.Web3CheckContextLoader)}_getSolanaLoader(){try{return this._container.get(c.solanaContextTypes.SolanaContextLoader)}catch{return{load:async t=>(0,p.Left)(new Error("[ContextModule] - DefaultContextModule: no SolanaContextLoader bound"))}}}async getContexts(t){const o=this._loaders.map(e=>e.load(t));return(await Promise.all(o)).flat()}async getContext(t){const o=this._loaders.filter(e=>e.loadField).map(e=>e.loadField(t));return(await Promise.all(o)).find(e=>e!==null)||{type:i.ClearSignContextType.ERROR,error:new Error(`Field type not supported: ${t.type}`)}}async getTypedDataFilters(t){return this._typedDataLoader.load(t)}async getWeb3Checks(t){return(await this._web3CheckLoader.load(t)).caseOf({Right:r=>({type:i.ClearSignContextType.WEB3_CHECK,payload:r.descriptor,certificate:r.certificate}),Left:()=>null})}async getSolanaContext(t){return await this._solanaLoader.load(t)}}0&&(module.exports={DefaultContextModule});
|
|
2
2
|
//# sourceMappingURL=DefaultContextModule.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/DefaultContextModule.ts"],
|
|
4
|
-
"sourcesContent": ["import { type Container } from \"inversify\";\n\nimport type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport { externalPluginTypes } from \"./external-plugin/di/externalPluginTypes\";\nimport { type ExternalPluginContextLoader } from \"./external-plugin/domain/ExternalPluginContextLoader\";\nimport { nftTypes } from \"./nft/di/nftTypes\";\nimport { type NftContextLoader } from \"./nft/domain/NftContextLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { tokenTypes } from \"./token/di/tokenTypes\";\nimport { type TokenContextLoader } from \"./token/domain/TokenContextLoader\";\nimport { type TransactionContextLoader } from \"./transaction/domain/TransactionContextLoader\";\nimport { type TrustedNameContextLoader } from \"./trusted-name/domain/TrustedNameContextLoader\";\nimport { typedDataTypes } from \"./typed-data/di/typedDataTypes\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { uniswapTypes } from \"./uniswap/di/uniswapTypes\";\nimport { type UniswapContextLoader } from \"./uniswap/domain/UniswapContextLoader\";\nimport { web3CheckTypes } from \"./web3-check/di/web3CheckTypes\";\nimport { type Web3CheckContextLoader } from \"./web3-check/domain/Web3CheckContextLoader\";\nimport {\n type Web3CheckContext,\n type Web3Checks,\n} from \"./web3-check/domain/web3CheckTypes\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { makeContainer } from \"./di\";\n\nexport class DefaultContextModule implements ContextModule {\n private _container: Container;\n private _loaders: ContextLoader[];\n private _typedDataLoader: TypedDataContextLoader;\n private _web3CheckLoader: Web3CheckContextLoader;\n\n constructor(args: ContextModuleConfig) {\n this._container = makeContainer({ config: args });\n this._loaders = args.defaultLoaders ? this._getDefaultLoaders() : [];\n this._loaders.push(...args.customLoaders);\n this._typedDataLoader =\n args.customTypedDataLoader ?? this._getDefaultTypedDataLoader();\n this._web3CheckLoader =\n args.customWeb3CheckLoader ?? this._getWeb3CheckLoader();\n }\n\n private _getDefaultLoaders(): ContextLoader[] {\n return [\n this._container.get<ExternalPluginContextLoader>(\n externalPluginTypes.ExternalPluginContextLoader,\n ),\n this._container.get<TrustedNameContextLoader>(\n trustedNameTypes.TrustedNameContextLoader,\n ),\n this._container.get<NftContextLoader>(nftTypes.NftContextLoader),\n this._container.get<TokenContextLoader>(tokenTypes.TokenContextLoader),\n this._container.get<TransactionContextLoader>(\n transactionTypes.TransactionContextLoader,\n ),\n this._container.get<UniswapContextLoader>(\n uniswapTypes.UniswapContextLoader,\n ),\n ];\n }\n\n private _getDefaultTypedDataLoader(): TypedDataContextLoader {\n return this._container.get<TypedDataContextLoader>(\n typedDataTypes.TypedDataContextLoader,\n );\n }\n\n private _getWeb3CheckLoader(): Web3CheckContextLoader {\n return this._container.get<Web3CheckContextLoader>(\n web3CheckTypes.Web3CheckContextLoader,\n );\n }\n\n public async getContexts(\n transaction: TransactionContext,\n ): Promise<ClearSignContext[]> {\n const promises = this._loaders.map((fetcher) => fetcher.load(transaction));\n const responses = await Promise.all(promises);\n return responses.flat();\n }\n\n public async getContext(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext> {\n const promises = this._loaders\n .filter((fetcher) => fetcher.loadField)\n .map((fetcher) => fetcher.loadField!(field));\n const responses = await Promise.all(promises);\n return (\n responses.find((resp) => resp !== null) || {\n type: ClearSignContextType.ERROR,\n error: new Error(`Field type not supported: ${field.type}`),\n }\n );\n }\n\n public async getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext> {\n return this._typedDataLoader.load(typedData);\n }\n\n public async getWeb3Checks(\n transactionContext: Web3CheckContext,\n ): Promise<ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null> {\n const web3Checks = await this._web3CheckLoader.load(transactionContext);\n\n return web3Checks.caseOf({\n Right: (checks: Web3Checks) => ({\n type: ClearSignContextType.WEB3_CHECK,\n payload: checks.descriptor,\n certificate: checks.certificate,\n }),\n Left: () => null,\n });\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["DefaultContextModule_exports", "__export", "DefaultContextModule", "__toCommonJS", "import_transactionTypes", "import_trustedNameTypes", "import_externalPluginTypes", "import_nftTypes", "import_ClearSignContext", "import_tokenTypes", "import_typedDataTypes", "import_uniswapTypes", "import_web3CheckTypes", "import_di", "args", "transaction", "promises", "fetcher", "field", "resp", "typedData", "transactionContext", "checks"]
|
|
4
|
+
"sourcesContent": ["import { type Container } from \"inversify\";\nimport { Left } from \"purify-ts\";\n\nimport { dynamicNetworkTypes } from \"@/dynamic-network/di/dynamicNetworkTypes\";\nimport { type DynamicNetworkContextLoader } from \"@/dynamic-network/domain/DynamicNetworkContextLoader\";\nimport type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport { externalPluginTypes } from \"./external-plugin/di/externalPluginTypes\";\nimport { type ExternalPluginContextLoader } from \"./external-plugin/domain/ExternalPluginContextLoader\";\nimport { nftTypes } from \"./nft/di/nftTypes\";\nimport { type NftContextLoader } from \"./nft/domain/NftContextLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { solanaContextTypes } from \"./solana/di/solanaContextTypes\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\nimport { tokenTypes } from \"./token/di/tokenTypes\";\nimport { type TokenContextLoader } from \"./token/domain/TokenContextLoader\";\nimport { type TransactionContextLoader } from \"./transaction/domain/TransactionContextLoader\";\nimport { type TrustedNameContextLoader } from \"./trusted-name/domain/TrustedNameContextLoader\";\nimport { typedDataTypes } from \"./typed-data/di/typedDataTypes\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { uniswapTypes } from \"./uniswap/di/uniswapTypes\";\nimport { type UniswapContextLoader } from \"./uniswap/domain/UniswapContextLoader\";\nimport { web3CheckTypes } from \"./web3-check/di/web3CheckTypes\";\nimport { type Web3CheckContextLoader } from \"./web3-check/domain/Web3CheckContextLoader\";\nimport {\n type Web3CheckContext,\n type Web3Checks,\n} from \"./web3-check/domain/web3CheckTypes\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { makeContainer } from \"./di\";\n\nexport class DefaultContextModule implements ContextModule {\n private _container: Container;\n private _loaders: ContextLoader[];\n private _typedDataLoader: TypedDataContextLoader;\n private _web3CheckLoader: Web3CheckContextLoader;\n private _solanaLoader: SolanaContextLoader;\n\n constructor(args: ContextModuleConfig) {\n this._container = makeContainer({ config: args });\n this._loaders = args.defaultLoaders ? this._getDefaultLoaders() : [];\n this._loaders.push(...args.customLoaders);\n this._typedDataLoader =\n args.customTypedDataLoader ?? this._getDefaultTypedDataLoader();\n this._web3CheckLoader =\n args.customWeb3CheckLoader ?? this._getWeb3CheckLoader();\n this._solanaLoader = args.customSolanaLoader ?? this._getSolanaLoader();\n }\n\n private _getDefaultLoaders(): ContextLoader[] {\n return [\n this._container.get<ExternalPluginContextLoader>(\n externalPluginTypes.ExternalPluginContextLoader,\n ),\n this._container.get<TrustedNameContextLoader>(\n trustedNameTypes.TrustedNameContextLoader,\n ),\n this._container.get<NftContextLoader>(nftTypes.NftContextLoader),\n this._container.get<TokenContextLoader>(tokenTypes.TokenContextLoader),\n this._container.get<TransactionContextLoader>(\n transactionTypes.TransactionContextLoader,\n ),\n this._container.get<UniswapContextLoader>(\n uniswapTypes.UniswapContextLoader,\n ),\n this._container.get<DynamicNetworkContextLoader>(\n dynamicNetworkTypes.DynamicNetworkContextLoader,\n ),\n ];\n }\n\n private _getDefaultTypedDataLoader(): TypedDataContextLoader {\n return this._container.get<TypedDataContextLoader>(\n typedDataTypes.TypedDataContextLoader,\n );\n }\n\n private _getWeb3CheckLoader(): Web3CheckContextLoader {\n return this._container.get<Web3CheckContextLoader>(\n web3CheckTypes.Web3CheckContextLoader,\n );\n }\n\n private _getSolanaLoader(): SolanaContextLoader {\n try {\n return this._container.get<SolanaContextLoader>(\n solanaContextTypes.SolanaContextLoader,\n );\n } catch {\n return {\n load: async (_ctx) =>\n Left(\n new Error(\n \"[ContextModule] - DefaultContextModule: no SolanaContextLoader bound\",\n ),\n ),\n };\n }\n }\n\n public async getContexts(\n transaction: TransactionContext,\n ): Promise<ClearSignContext[]> {\n const promises = this._loaders.map((fetcher) => fetcher.load(transaction));\n const responses = await Promise.all(promises);\n return responses.flat();\n }\n\n public async getContext(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext> {\n const promises = this._loaders\n .filter((fetcher) => fetcher.loadField)\n .map((fetcher) => fetcher.loadField!(field));\n const responses = await Promise.all(promises);\n return (\n responses.find((resp) => resp !== null) || {\n type: ClearSignContextType.ERROR,\n error: new Error(`Field type not supported: ${field.type}`),\n }\n );\n }\n\n public async getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext> {\n return this._typedDataLoader.load(typedData);\n }\n\n public async getWeb3Checks(\n transactionContext: Web3CheckContext,\n ): Promise<ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null> {\n const web3Checks = await this._web3CheckLoader.load(transactionContext);\n\n return web3Checks.caseOf({\n Right: (checks: Web3Checks) => ({\n type: ClearSignContextType.WEB3_CHECK,\n payload: checks.descriptor,\n certificate: checks.certificate,\n }),\n Left: () => null,\n });\n }\n\n public async getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult> {\n return await this._solanaLoader.load(transactionContext);\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAqB,qBAErBC,EAAoC,oDAIpCC,EAAiC,6CACjCC,EAAiC,8CAGjCC,EAAoC,oDAEpCC,EAAyB,6BAGzBC,EAIO,2CAMPC,EAAmC,0CAGnCC,EAA2B,iCAI3BC,EAA+B,0CAE/BC,EAA6B,qCAE7BC,EAA+B,0CAO/BC,EAA8B,gBAEvB,MAAMd,CAA8C,CACjD,WACA,SACA,iBACA,iBACA,cAER,YAAYe,EAA2B,CACrC,KAAK,cAAa,iBAAc,CAAE,OAAQA,CAAK,CAAC,EAChD,KAAK,SAAWA,EAAK,eAAiB,KAAK,mBAAmB,EAAI,CAAC,EACnE,KAAK,SAAS,KAAK,GAAGA,EAAK,aAAa,EACxC,KAAK,iBACHA,EAAK,uBAAyB,KAAK,2BAA2B,EAChE,KAAK,iBACHA,EAAK,uBAAyB,KAAK,oBAAoB,EACzD,KAAK,cAAgBA,EAAK,oBAAsB,KAAK,iBAAiB,CACxE,CAEQ,oBAAsC,CAC5C,MAAO,CACL,KAAK,WAAW,IACd,sBAAoB,2BACtB,EACA,KAAK,WAAW,IACd,mBAAiB,wBACnB,EACA,KAAK,WAAW,IAAsB,WAA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OAAO,MAAM,KAAK,cAAc,KAAKA,CAAkB,CACzD,CACF",
|
|
6
|
+
"names": ["DefaultContextModule_exports", "__export", "DefaultContextModule", "__toCommonJS", "import_purify_ts", "import_dynamicNetworkTypes", "import_transactionTypes", "import_trustedNameTypes", "import_externalPluginTypes", "import_nftTypes", "import_ClearSignContext", "import_solanaContextTypes", "import_tokenTypes", "import_typedDataTypes", "import_uniswapTypes", "import_web3CheckTypes", "import_di", "args", "_ctx", "transaction", "promises", "fetcher", "field", "resp", "typedData", "transactionContext", "checks"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("@ledgerhq/device-management-kit"),s=require("purify-ts"),o=require("./DefaultContextModule");const d=()=>({load:vi.fn(),loadField:vi.fn()});describe("DefaultContextModule",()=>{const c={load:vi.fn()},a={customLoaders:[],defaultLoaders:!1,customTypedDataLoader:c,cal:{url:"https://cal/v1",mode:"prod",branch:"main"},web3checks:{url:"https://web3checks/v3"},originToken:"originToken"};beforeEach(()=>{vi.restoreAllMocks()}),it("should initialize the context module with all the default loaders",async()=>{const t=await new o.DefaultContextModule(a).getContexts({});expect(t).toEqual([])}),it("should return an empty array when no loaders",async()=>{const t=await new o.DefaultContextModule(a).getContexts({});expect(t).toEqual([])}),it("should call all fetch method from metadata fetcher",async()=>{const e=d();await new o.DefaultContextModule({...a,customLoaders:[e,e]}).getContexts({}),expect(e.load).toHaveBeenCalledTimes(2)}),it("should return an array of context response",async()=>{const e=d(),t=[[{type:"provideERC20Info",payload:"payload1"}],[{type:"provideERC20Info",payload:"payload2"},{type:"plugin",payload:"payload3"}]];vi.spyOn(e,"load").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const l=await new o.DefaultContextModule({...a,customLoaders:[e,e]}).getContexts({});expect(e.load).toHaveBeenCalledTimes(2),expect(l).toEqual(t.flat())}),it("should call the typed data loader",async()=>{await new o.DefaultContextModule({...a,customTypedDataLoader:c}).getTypedDataFilters({}),expect(c.load).toHaveBeenCalledTimes(1)}),it("should return a single context",async()=>{const e=d(),t=[null,{type:"token",payload:"payload"}];vi.spyOn(e,"loadField").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const l=await new o.DefaultContextModule({...a,customLoaders:[e,{load:vi.fn()},e]}).getContext({type:"token"});expect(e.loadField).toHaveBeenCalledTimes(2),expect(l).toEqual({type:"token",payload:"payload"})}),it("should return a web3 check context",async()=>{const e=d();vi.spyOn(e,"load").mockResolvedValueOnce((0,s.Right)({descriptor:"payload"}));const n=await new o.DefaultContextModule({...a,customLoaders:[],customWeb3CheckLoader:e}).getWeb3Checks({deviceModelId:r.DeviceModelId.FLEX,from:"from",rawTx:"rawTx",chainId:1});expect(e.load).toHaveBeenCalledTimes(1),expect(n).toEqual({type:"web3Check",payload:"payload"})}),it("should return null if no web3 check context",async()=>{const e=d();vi.spyOn(e,"load").mockResolvedValue((0,s.Left)(new Error("error")));const n=await new o.DefaultContextModule({...a,customLoaders:[],customWeb3CheckLoader:e}).getWeb3Checks({deviceModelId:r.DeviceModelId.FLEX,from:"from",rawTx:"rawTx",chainId:1});expect(e.load).toHaveBeenCalledTimes(1),expect(n).toBeNull()}),it("context field not supported",async()=>{const e=d(),t=[null,null];vi.spyOn(e,"loadField").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const l=await new o.DefaultContextModule({...a,customLoaders:[e,{load:vi.fn()},e]}).getContext({type:"token"});expect(e.loadField).toHaveBeenCalledTimes(2),expect(l).toEqual({type:"error",error:new Error("Field type not supported: token")})}),it("getField not implemented",async()=>{const t=await new o.DefaultContextModule({...a,customLoaders:[{load:vi.fn()}]}).getContext({type:"token"});expect(t).toEqual({type:"error",error:new Error("Field type not supported: token")})}),it("should throw an error if origin token is not provided",()=>{expect(()=>new o.DefaultContextModule({...a,originToken:void 0})).toThrow("Origin token is required")})});
|
|
1
|
+
"use strict";var r=require("@ledgerhq/device-management-kit"),s=require("purify-ts"),o=require("./DefaultContextModule");const d=()=>({load:vi.fn(),loadField:vi.fn()});describe("DefaultContextModule",()=>{const c={load:vi.fn()},a={customLoaders:[],defaultLoaders:!1,customTypedDataLoader:c,cal:{url:"https://cal/v1",mode:"prod",branch:"main"},web3checks:{url:"https://web3checks/v3"},metadataServiceDomain:{url:"https://metadata.com"},originToken:"originToken"};beforeEach(()=>{vi.restoreAllMocks()}),it("should initialize the context module with all the default loaders",async()=>{const t=await new o.DefaultContextModule(a).getContexts({});expect(t).toEqual([])}),it("should return an empty array when no loaders",async()=>{const t=await new o.DefaultContextModule(a).getContexts({});expect(t).toEqual([])}),it("should call all fetch method from metadata fetcher",async()=>{const e=d();await new o.DefaultContextModule({...a,customLoaders:[e,e]}).getContexts({}),expect(e.load).toHaveBeenCalledTimes(2)}),it("should return an array of context response",async()=>{const e=d(),t=[[{type:"provideERC20Info",payload:"payload1"}],[{type:"provideERC20Info",payload:"payload2"},{type:"plugin",payload:"payload3"}]];vi.spyOn(e,"load").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const l=await new o.DefaultContextModule({...a,customLoaders:[e,e]}).getContexts({});expect(e.load).toHaveBeenCalledTimes(2),expect(l).toEqual(t.flat())}),it("should call the typed data loader",async()=>{await new o.DefaultContextModule({...a,customTypedDataLoader:c}).getTypedDataFilters({}),expect(c.load).toHaveBeenCalledTimes(1)}),it("should return a single context",async()=>{const e=d(),t=[null,{type:"token",payload:"payload"}];vi.spyOn(e,"loadField").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const l=await new o.DefaultContextModule({...a,customLoaders:[e,{load:vi.fn()},e]}).getContext({type:"token"});expect(e.loadField).toHaveBeenCalledTimes(2),expect(l).toEqual({type:"token",payload:"payload"})}),it("should return a web3 check context",async()=>{const e=d();vi.spyOn(e,"load").mockResolvedValueOnce((0,s.Right)({descriptor:"payload"}));const n=await new o.DefaultContextModule({...a,customLoaders:[],customWeb3CheckLoader:e}).getWeb3Checks({deviceModelId:r.DeviceModelId.FLEX,from:"from",rawTx:"rawTx",chainId:1});expect(e.load).toHaveBeenCalledTimes(1),expect(n).toEqual({type:"web3Check",payload:"payload"})}),it("should return null if no web3 check context",async()=>{const e=d();vi.spyOn(e,"load").mockResolvedValue((0,s.Left)(new Error("error")));const n=await new o.DefaultContextModule({...a,customLoaders:[],customWeb3CheckLoader:e}).getWeb3Checks({deviceModelId:r.DeviceModelId.FLEX,from:"from",rawTx:"rawTx",chainId:1});expect(e.load).toHaveBeenCalledTimes(1),expect(n).toBeNull()}),it("context field not supported",async()=>{const e=d(),t=[null,null];vi.spyOn(e,"loadField").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const l=await new o.DefaultContextModule({...a,customLoaders:[e,{load:vi.fn()},e]}).getContext({type:"token"});expect(e.loadField).toHaveBeenCalledTimes(2),expect(l).toEqual({type:"error",error:new Error("Field type not supported: token")})}),it("getField not implemented",async()=>{const t=await new o.DefaultContextModule({...a,customLoaders:[{load:vi.fn()}]}).getContext({type:"token"});expect(t).toEqual({type:"error",error:new Error("Field type not supported: token")})}),it("should throw an error if origin token is not provided",()=>{expect(()=>new o.DefaultContextModule({...a,originToken:void 0})).toThrow("Origin token is required")})});
|
|
2
2
|
//# sourceMappingURL=DefaultContextModule.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/DefaultContextModule.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst contextLoaderStubBuilder = () => {\n return { load: vi.fn(), loadField: vi.fn() };\n};\n\ndescribe(\"DefaultContextModule\", () => {\n const typedDataLoader: TypedDataContextLoader = { load: vi.fn() };\n const defaultContextModuleConfig: ContextModuleConfig = {\n customLoaders: [],\n defaultLoaders: false,\n customTypedDataLoader: typedDataLoader,\n cal: {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: \"https://web3checks/v3\",\n },\n originToken: \"originToken\",\n };\n\n beforeEach(() => {\n vi.restoreAllMocks();\n });\n\n it(\"should initialize the context module with all the default loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(res).toEqual([]);\n });\n\n it(\"should return an empty array when no loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(res).toEqual([]);\n });\n\n it(\"should call all fetch method from metadata fetcher\", async () => {\n const loader = contextLoaderStubBuilder();\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n await contextModule.getContexts({} as TransactionContext);\n\n expect(loader.load).toHaveBeenCalledTimes(2);\n });\n\n it(\"should return an array of context response\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [\n [{ type: \"provideERC20Info\", payload: \"payload1\" }],\n [\n { type: \"provideERC20Info\", payload: \"payload2\" },\n { type: \"plugin\", payload: \"payload3\" },\n ],\n ];\n vi.spyOn(loader, \"load\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(loader.load).toHaveBeenCalledTimes(2);\n expect(res).toEqual(responses.flat());\n });\n\n it(\"should call the typed data loader\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customTypedDataLoader: typedDataLoader,\n });\n\n await contextModule.getTypedDataFilters({} as TypedDataContext);\n\n expect(typedDataLoader.load).toHaveBeenCalledTimes(1);\n });\n\n it(\"should return a single context\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [null, { type: \"token\", payload: \"payload\" }];\n vi.spyOn(loader, \"loadField\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, { load: vi.fn() }, loader],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(loader.loadField).toHaveBeenCalledTimes(2);\n expect(res).toEqual({ type: \"token\", payload: \"payload\" });\n });\n\n it(\"should return a web3 check context\", async () => {\n const loader = contextLoaderStubBuilder();\n vi.spyOn(loader, \"load\").mockResolvedValueOnce(\n Right({ descriptor: \"payload\" }),\n );\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [],\n customWeb3CheckLoader: loader,\n });\n\n const res = await contextModule.getWeb3Checks({\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n });\n\n expect(loader.load).toHaveBeenCalledTimes(1);\n expect(res).toEqual({ type: \"web3Check\", payload: \"payload\" });\n });\n\n it(\"should return null if no web3 check context\", async () => {\n const loader = contextLoaderStubBuilder();\n vi.spyOn(loader, \"load\").mockResolvedValue(Left(new Error(\"error\")));\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [],\n customWeb3CheckLoader: loader,\n });\n\n const res = await contextModule.getWeb3Checks({\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n });\n\n expect(loader.load).toHaveBeenCalledTimes(1);\n expect(res).toBeNull();\n });\n\n it(\"context field not supported\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [null, null];\n vi.spyOn(loader, \"loadField\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, { load: vi.fn() }, loader],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(loader.loadField).toHaveBeenCalledTimes(2);\n expect(res).toEqual({\n type: \"error\",\n error: new Error(\"Field type not supported: token\"),\n });\n });\n\n it(\"getField not implemented\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [{ load: vi.fn() }],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(res).toEqual({\n type: \"error\",\n error: new Error(\"Field type not supported: token\"),\n });\n });\n\n it(\"should throw an error if origin token is not provided\", () => {\n expect(\n () =>\n new DefaultContextModule({\n ...defaultContextModuleConfig,\n originToken: undefined,\n }),\n ).toThrow(\"Origin token is required\");\n });\n});\n"],
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAS5BC,EAAqC,kCAErC,MAAMC,EAA2B,KACxB,CAAE,KAAM,GAAG,GAAG,EAAG,UAAW,GAAG,GAAG,CAAE,GAG7C,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA0C,CAAE,KAAM,GAAG,GAAG,CAAE,EAC1DC,EAAkD,CACtD,cAAe,CAAC,EAChB,eAAgB,GAChB,sBAAuBD,EACvB,IAAK,CACH,IAAK,iBACL,KAAM,OACN,OAAQ,MACV,EACA,WAAY,CACV,IAAK,uBACP,EACA,YAAa,aACf,EAEA,WAAW,IAAM,CACf,GAAG,gBAAgB,CACrB,CAAC,EAED,GAAG,oEAAqE,SAAY,CAGlF,MAAME,EAAM,MAFU,IAAI,uBAAqBD,CAA0B,EAEzC,YAAY,CAAC,CAAuB,EAEpE,OAAOC,CAAG,EAAE,QAAQ,CAAC,CAAC,CACxB,CAAC,EAED,GAAG,+CAAgD,SAAY,CAG7D,MAAMA,EAAM,MAFU,IAAI,uBAAqBD,CAA0B,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AAM,IAAI,EAC7B,GAAG,MAAMD,EAAQ,WAAW,EACzB,sBAAsBC,EAAU,CAAC,CAAC,EAClC,sBAAsBA,EAAU,CAAC,CAAC,EAMrC,MAAMF,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAACE,EAAQ,CAAE,KAAM,GAAG,GAAG,CAAE,EAAGA,CAAM,CACnD,CAAC,EAE+B,WAAW,CACzC,KAAM,OACR,CAA4B,EAE5B,OAAOA,EAAO,SAAS,EAAE,sBAAsB,CAAC,EAChD,OAAOD,CAAG,EAAE,QAAQ,CAClB,KAAM,QACN,MAAO,IAAI,MAAM,iCAAiC,CACpD,CAAC,CACH,CAAC,EAED,GAAG,2BAA4B,SAAY,CAMzC,MAAMA,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAAC,CAAE,KAAM,GAAG,GAAG,CAAE,CAAC,CACnC,CAAC,EAE+B,WAAW,CACzC,KAAM,OACR,CAA4B,EAE5B,OAAOC,CAAG,EAAE,QAAQ,CAClB,KAAM,QACN,MAAO,IAAI,MAAM,iCAAiC,CACpD,CAAC,CACH,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,OACE,IACE,IAAI,uBAAqB,CACvB,GAAGD,EACH,YAAa,MACf,CAAC,CACL,EAAE,QAAQ,0BAA0B,CACtC,CAAC,CACH,CAAC",
|
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst contextLoaderStubBuilder = () => {\n return { load: vi.fn(), loadField: vi.fn() };\n};\n\ndescribe(\"DefaultContextModule\", () => {\n const typedDataLoader: TypedDataContextLoader = { load: vi.fn() };\n const defaultContextModuleConfig: ContextModuleConfig = {\n customLoaders: [],\n defaultLoaders: false,\n customTypedDataLoader: typedDataLoader,\n cal: {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: \"https://web3checks/v3\",\n },\n metadataServiceDomain: {\n url: \"https://metadata.com\",\n },\n originToken: \"originToken\",\n };\n\n beforeEach(() => {\n vi.restoreAllMocks();\n });\n\n it(\"should initialize the context module with all the default loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(res).toEqual([]);\n });\n\n it(\"should return an empty array when no loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(res).toEqual([]);\n });\n\n it(\"should call all fetch method from metadata fetcher\", async () => {\n const loader = contextLoaderStubBuilder();\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n await contextModule.getContexts({} as TransactionContext);\n\n expect(loader.load).toHaveBeenCalledTimes(2);\n });\n\n it(\"should return an array of context response\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [\n [{ type: \"provideERC20Info\", payload: \"payload1\" }],\n [\n { type: \"provideERC20Info\", payload: \"payload2\" },\n { type: \"plugin\", payload: \"payload3\" },\n ],\n ];\n vi.spyOn(loader, \"load\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(loader.load).toHaveBeenCalledTimes(2);\n expect(res).toEqual(responses.flat());\n });\n\n it(\"should call the typed data loader\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customTypedDataLoader: typedDataLoader,\n });\n\n await contextModule.getTypedDataFilters({} as TypedDataContext);\n\n expect(typedDataLoader.load).toHaveBeenCalledTimes(1);\n });\n\n it(\"should return a single context\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [null, { type: \"token\", payload: \"payload\" }];\n vi.spyOn(loader, \"loadField\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, { load: vi.fn() }, loader],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(loader.loadField).toHaveBeenCalledTimes(2);\n expect(res).toEqual({ type: \"token\", payload: \"payload\" });\n });\n\n it(\"should return a web3 check context\", async () => {\n const loader = contextLoaderStubBuilder();\n vi.spyOn(loader, \"load\").mockResolvedValueOnce(\n Right({ descriptor: \"payload\" }),\n );\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [],\n customWeb3CheckLoader: loader,\n });\n\n const res = await contextModule.getWeb3Checks({\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n });\n\n expect(loader.load).toHaveBeenCalledTimes(1);\n expect(res).toEqual({ type: \"web3Check\", payload: \"payload\" });\n });\n\n it(\"should return null if no web3 check context\", async () => {\n const loader = contextLoaderStubBuilder();\n vi.spyOn(loader, \"load\").mockResolvedValue(Left(new Error(\"error\")));\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [],\n customWeb3CheckLoader: loader,\n });\n\n const res = await contextModule.getWeb3Checks({\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n });\n\n expect(loader.load).toHaveBeenCalledTimes(1);\n expect(res).toBeNull();\n });\n\n it(\"context field not supported\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [null, null];\n vi.spyOn(loader, \"loadField\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, { load: vi.fn() }, loader],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(loader.loadField).toHaveBeenCalledTimes(2);\n expect(res).toEqual({\n type: \"error\",\n error: new Error(\"Field type not supported: token\"),\n });\n });\n\n it(\"getField not implemented\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [{ load: vi.fn() }],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(res).toEqual({\n type: \"error\",\n error: new Error(\"Field type not supported: token\"),\n });\n });\n\n it(\"should throw an error if origin token is not provided\", () => {\n expect(\n () =>\n new DefaultContextModule({\n ...defaultContextModuleConfig,\n originToken: undefined,\n }),\n ).toThrow(\"Origin token is required\");\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAS5BC,EAAqC,kCAErC,MAAMC,EAA2B,KACxB,CAAE,KAAM,GAAG,GAAG,EAAG,UAAW,GAAG,GAAG,CAAE,GAG7C,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA0C,CAAE,KAAM,GAAG,GAAG,CAAE,EAC1DC,EAAkD,CACtD,cAAe,CAAC,EAChB,eAAgB,GAChB,sBAAuBD,EACvB,IAAK,CACH,IAAK,iBACL,KAAM,OACN,OAAQ,MACV,EACA,WAAY,CACV,IAAK,uBACP,EACA,sBAAuB,CACrB,IAAK,sBACP,EACA,YAAa,aACf,EAEA,WAAW,IAAM,CACf,GAAG,gBAAgB,CACrB,CAAC,EAED,GAAG,oEAAqE,SAAY,CAGlF,MAAME,EAAM,MAFU,IAAI,uBAAqBD,CAA0B,EAEzC,YAAY,CAAC,CAAuB,EAEpE,OAAOC,CAAG,EAAE,QAAQ,CAAC,CAAC,CACxB,CAAC,EAED,GAAG,+CAAgD,SAAY,CAG7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C,MAAMC,EAASJ,EAAyB,EAClCK,EAAY,CAAC,KAAM,IAAI,EAC7B,GAAG,MAAMD,EAAQ,WAAW,EACzB,sBAAsBC,EAAU,CAAC,CAAC,EAClC,sBAAsBA,EAAU,CAAC,CAAC,EAMrC,MAAMF,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAACE,EAAQ,CAAE,KAAM,GAAG,GAAG,CAAE,EAAGA,CAAM,CACnD,CAAC,EAE+B,WAAW,CACzC,KAAM,OACR,CAA4B,EAE5B,OAAOA,EAAO,SAAS,EAAE,sBAAsB,CAAC,EAChD,OAAOD,CAAG,EAAE,QAAQ,CAClB,KAAM,QACN,MAAO,IAAI,MAAM,iCAAiC,CACpD,CAAC,CACH,CAAC,EAED,GAAG,2BAA4B,SAAY,CAMzC,MAAMA,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAAC,CAAE,KAAM,GAAG,GAAG,CAAE,CAAC,CACnC,CAAC,EAE+B,WAAW,CACzC,KAAM,OACR,CAA4B,EAE5B,OAAOC,CAAG,EAAE,QAAQ,CAClB,KAAM,QACN,MAAO,IAAI,MAAM,iCAAiC,CACpD,CAAC,CACH,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,OACE,IACE,IAAI,uBAAqB,CACvB,GAAGD,EACH,YAAa,MACf,CAAC,CACL,EAAE,QAAQ,0BAA0B,CACtC,CAAC,CACH,CAAC",
|
|
6
6
|
"names": ["import_device_management_kit", "import_purify_ts", "import_DefaultContextModule", "contextLoaderStubBuilder", "typedDataLoader", "defaultContextModuleConfig", "res", "loader", "responses"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(t,o)=>{for(var e in o)i(t,e,{get:o[e],enumerable:!0})},u=(t,o,e,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of l(o))!m.call(t,n)&&n!==e&&i(t,n,{get:()=>o[n],enumerable:!(f=g(o,n))||f.enumerable});return t};var d=t=>u(i({},"__esModule",{value:!0}),t);var a={};p(a,{configModuleFactory:()=>M});module.exports=d(a);var r=require("inversify"),C=require("./configTypes");const M=t=>new r.ContainerModule(({bind:o})=>{o(C.configTypes.Config).toConstantValue(t)});0&&(module.exports={configModuleFactory});
|
|
2
2
|
//# sourceMappingURL=configModuleFactory.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/config/di/configModuleFactory.ts"],
|
|
4
|
-
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\n\nimport { configTypes } from \"./configTypes\";\n\nexport const configModuleFactory = (config: ContextModuleConfig) =>\n new ContainerModule((bind
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAIhCC,EAA4B,yBAErB,MAAMH,EAAuBI,GAClC,IAAI,kBAAgB,
|
|
6
|
-
"names": ["configModuleFactory_exports", "__export", "configModuleFactory", "__toCommonJS", "import_inversify", "import_configTypes", "config", "bind"
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\n\nimport { configTypes } from \"./configTypes\";\n\nexport const configModuleFactory = (config: ContextModuleConfig) =>\n new ContainerModule(({ bind }) => {\n bind<ContextModuleConfig>(configTypes.Config).toConstantValue(config);\n });\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAIhCC,EAA4B,yBAErB,MAAMH,EAAuBI,GAClC,IAAI,kBAAgB,CAAC,CAAE,KAAAC,CAAK,IAAM,CAChCA,EAA0B,cAAY,MAAM,EAAE,gBAAgBD,CAAM,CACtE,CAAC",
|
|
6
|
+
"names": ["configModuleFactory_exports", "__export", "configModuleFactory", "__toCommonJS", "import_inversify", "import_configTypes", "config", "bind"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var x=(o,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of d(e))!l.call(o,t)&&t!==r&&n(o,t,{get:()=>e[t],enumerable:!(a=C(e,t))||a.enumerable});return o};var p=o=>x(n({},"__esModule",{value:!0}),o);var i={};module.exports=p(i);
|
|
2
2
|
//# sourceMappingURL=ContextModuleConfig.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/config/model/ContextModuleConfig.ts"],
|
|
4
|
-
"sourcesContent": ["import { type ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport { type TypedDataContextLoader } from \"@/typed-data/domain/TypedDataContextLoader\";\nimport { type Web3CheckContextLoader } from \"@/web3-check/domain/Web3CheckContextLoader\";\n\nexport type ContextModuleCalMode = \"prod\" | \"test\";\nexport type ContextModuleCalBranch = \"next\" | \"main\" | \"demo\";\n\nexport type ContextModuleCalConfig = {\n url: string;\n mode: ContextModuleCalMode;\n branch: ContextModuleCalBranch;\n};\n\nexport type ContextModuleWeb3ChecksConfig = {\n url: string;\n};\n\nexport type ContextModuleConfig = {\n cal: ContextModuleCalConfig;\n web3checks: ContextModuleWeb3ChecksConfig;\n defaultLoaders: boolean;\n customLoaders: ContextLoader[];\n customTypedDataLoader?: TypedDataContextLoader;\n customWeb3CheckLoader?: Web3CheckContextLoader;\n originToken?: string;\n};\n"],
|
|
4
|
+
"sourcesContent": ["import { type ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport { type SolanaContextLoader } from \"@/solana/domain/SolanaContextLoader\";\nimport { type TypedDataContextLoader } from \"@/typed-data/domain/TypedDataContextLoader\";\nimport { type Web3CheckContextLoader } from \"@/web3-check/domain/Web3CheckContextLoader\";\n\nexport type ContextModuleCalMode = \"prod\" | \"test\";\nexport type ContextModuleCalBranch = \"next\" | \"main\" | \"demo\";\n\nexport type ContextModuleCalConfig = {\n url: string;\n mode: ContextModuleCalMode;\n branch: ContextModuleCalBranch;\n};\n\nexport type ContextModuleWeb3ChecksConfig = {\n url: string;\n};\n\nexport type ContextModuleMetadataServiceConfig = {\n url: string;\n};\n\nexport type ContextModuleConfig = {\n cal: ContextModuleCalConfig;\n web3checks: ContextModuleWeb3ChecksConfig;\n metadataServiceDomain: ContextModuleMetadataServiceConfig;\n defaultLoaders: boolean;\n customLoaders: ContextLoader[];\n customTypedDataLoader?: TypedDataContextLoader;\n customWeb3CheckLoader?: Web3CheckContextLoader;\n customSolanaLoader?: SolanaContextLoader;\n originToken?: string;\n};\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["ContextModuleConfig_exports", "__toCommonJS"]
|
|
7
7
|
}
|
package/lib/cjs/src/di.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var w=(r,o)=>{for(var e in o)n(r,e,{get:o[e],enumerable:!0})},A=(r,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of k(o))!x.call(r,t)&&t!==e&&n(r,t,{get:()=>o[t],enumerable:!(a=g(o,t))||a.enumerable});return r};var N=r=>A(n({},"__esModule",{value:!0}),r);var b={};w(b,{makeContainer:()=>P});module.exports=N(b);var m=require("inversify"),i=require("./config/di/configModuleFactory"),c=require("./dynamic-network/di/dynamicNetworkModuleFactory"),f=require("./external-plugin/di/externalPluginModuleFactory"),p=require("./nft/di/nftModuleFactory"),d=require("./pki/di/pkiModuleFactory"),l=require("./solana/di/SolanaContextModuleFactory"),u=require("./token/di/tokenModuleFactory"),y=require("./transaction/di/transactionModuleFactory"),M=require("./trusted-name/di/trustedNameModuleFactory"),F=require("./typed-data/di/typedDataModuleFactory"),C=require("./uniswap/di/uniswapModuleFactory"),s=require("./web3-check/di/web3CheckModuleFactory");const P=({config:r})=>{const o=new m.Container;return o.loadSync((0,i.configModuleFactory)(r),(0,f.externalPluginModuleFactory)(),(0,c.dynamicNetworkModuleFactory)(),(0,p.nftModuleFactory)(),(0,u.tokenModuleFactory)(),(0,y.transactionModuleFactory)(),(0,M.trustedNameModuleFactory)(),(0,F.typedDataModuleFactory)(),(0,d.nanoPkiModuleFactory)(),(0,C.uniswapModuleFactory)(),(0,s.web3CheckModuleFactory)(),(0,l.solanaContextModuleFactory)()),o};0&&(module.exports={makeContainer});
|
|
2
2
|
//# sourceMappingURL=di.js.map
|
package/lib/cjs/src/di.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/di.ts"],
|
|
4
|
-
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { configModuleFactory } from \"@/config/di/configModuleFactory\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { externalPluginModuleFactory } from \"@/external-plugin/di/externalPluginModuleFactory\";\nimport { nftModuleFactory } from \"@/nft/di/nftModuleFactory\";\nimport { nanoPkiModuleFactory } from \"@/pki/di/pkiModuleFactory\";\nimport { tokenModuleFactory } from \"@/token/di/tokenModuleFactory\";\nimport { transactionModuleFactory } from \"@/transaction/di/transactionModuleFactory\";\nimport { trustedNameModuleFactory } from \"@/trusted-name/di/trustedNameModuleFactory\";\nimport { typedDataModuleFactory } from \"@/typed-data/di/typedDataModuleFactory\";\nimport { uniswapModuleFactory } from \"@/uniswap/di/uniswapModuleFactory\";\nimport { web3CheckModuleFactory } from \"@/web3-check/di/web3CheckModuleFactory\";\n\ntype MakeContainerArgs = {\n config: ContextModuleConfig;\n};\n\nexport const makeContainer = ({ config }: MakeContainerArgs) => {\n const container = new Container();\n\n container.
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0B,qBAE1BC,EAAoC,2CAEpCC,EAA4C,4DAC5CC,EAAiC,qCACjCC,EAAqC,qCACrCC,EAAmC,yCACnCC,EAAyC,qDACzCC,EAAyC,sDACzCC,EAAuC,kDACvCC,EAAqC,6CACrCC,EAAuC,kDAMhC,
|
|
6
|
-
"names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_configModuleFactory", "import_externalPluginModuleFactory", "import_nftModuleFactory", "import_pkiModuleFactory", "import_tokenModuleFactory", "import_transactionModuleFactory", "import_trustedNameModuleFactory", "import_typedDataModuleFactory", "import_uniswapModuleFactory", "import_web3CheckModuleFactory", "config", "container"]
|
|
4
|
+
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { configModuleFactory } from \"@/config/di/configModuleFactory\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { dynamicNetworkModuleFactory } from \"@/dynamic-network/di/dynamicNetworkModuleFactory\";\nimport { externalPluginModuleFactory } from \"@/external-plugin/di/externalPluginModuleFactory\";\nimport { nftModuleFactory } from \"@/nft/di/nftModuleFactory\";\nimport { nanoPkiModuleFactory } from \"@/pki/di/pkiModuleFactory\";\nimport { solanaContextModuleFactory } from \"@/solana/di/SolanaContextModuleFactory\";\nimport { tokenModuleFactory } from \"@/token/di/tokenModuleFactory\";\nimport { transactionModuleFactory } from \"@/transaction/di/transactionModuleFactory\";\nimport { trustedNameModuleFactory } from \"@/trusted-name/di/trustedNameModuleFactory\";\nimport { typedDataModuleFactory } from \"@/typed-data/di/typedDataModuleFactory\";\nimport { uniswapModuleFactory } from \"@/uniswap/di/uniswapModuleFactory\";\nimport { web3CheckModuleFactory } from \"@/web3-check/di/web3CheckModuleFactory\";\n\ntype MakeContainerArgs = {\n config: ContextModuleConfig;\n};\n\nexport const makeContainer = ({ config }: MakeContainerArgs) => {\n const container = new Container();\n\n container.loadSync(\n configModuleFactory(config),\n externalPluginModuleFactory(),\n dynamicNetworkModuleFactory(),\n nftModuleFactory(),\n tokenModuleFactory(),\n transactionModuleFactory(),\n trustedNameModuleFactory(),\n typedDataModuleFactory(),\n nanoPkiModuleFactory(),\n uniswapModuleFactory(),\n web3CheckModuleFactory(),\n solanaContextModuleFactory(),\n );\n\n return container;\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0B,qBAE1BC,EAAoC,2CAEpCC,EAA4C,4DAC5CC,EAA4C,4DAC5CC,EAAiC,qCACjCC,EAAqC,qCACrCC,EAA2C,kDAC3CC,EAAmC,yCACnCC,EAAyC,qDACzCC,EAAyC,sDACzCC,EAAuC,kDACvCC,EAAqC,6CACrCC,EAAuC,kDAMhC,MAAMd,EAAgB,CAAC,CAAE,OAAAe,CAAO,IAAyB,CAC9D,MAAMC,EAAY,IAAI,YAEtB,OAAAA,EAAU,YACR,uBAAoBD,CAAM,KAC1B,+BAA4B,KAC5B,+BAA4B,KAC5B,oBAAiB,KACjB,sBAAmB,KACnB,4BAAyB,KACzB,4BAAyB,KACzB,0BAAuB,KACvB,wBAAqB,KACrB,wBAAqB,KACrB,0BAAuB,KACvB,8BAA2B,CAC7B,EAEOC,CACT",
|
|
6
|
+
"names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_configModuleFactory", "import_dynamicNetworkModuleFactory", "import_externalPluginModuleFactory", "import_nftModuleFactory", "import_pkiModuleFactory", "import_SolanaContextModuleFactory", "import_tokenModuleFactory", "import_transactionModuleFactory", "import_trustedNameModuleFactory", "import_typedDataModuleFactory", "import_uniswapModuleFactory", "import_web3CheckModuleFactory", "config", "container"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(o,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of m(r))!c.call(o,i)&&i!==n&&e(o,i,{get:()=>r[i],enumerable:!(t=a(r,i))||t.enumerable});return o};var y=o=>f(e({},"__esModule",{value:!0}),o);var p={};module.exports=y(p);
|
|
2
|
+
//# sourceMappingURL=DynamicNetworkDataSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/dynamic-network/data/DynamicNetworkDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import { type Either } from \"purify-ts\";\n\nimport { type DynamicNetworkConfiguration } from \"@/dynamic-network/model/DynamicNetworkConfiguration\";\n\nexport interface DynamicNetworkDataSource {\n getDynamicNetworkConfiguration(\n chainId: number,\n ): Promise<Either<Error, DynamicNetworkConfiguration>>;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["DynamicNetworkDataSource_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var N=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var h=(t,r)=>{for(var o in r)a(t,o,{get:r[o],enumerable:!0})},m=(t,r,o,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of R(r))!C.call(t,i)&&i!==o&&a(t,i,{get:()=>r[i],enumerable:!(e=u(r,i))||e.enumerable});return t};var d=(t,r,o)=>(o=t!=null?N(E(t)):{},m(r||!t||!t.__esModule?a(o,"default",{value:t,enumerable:!0}):o,t)),b=t=>m(a({},"__esModule",{value:!0}),t),g=(t,r,o,e)=>{for(var i=e>1?void 0:e?u(r,o):r,n=t.length-1,p;n>=0;n--)(p=t[n])&&(i=(e?p(r,o,i):p(i))||i);return e&&i&&a(r,o,i),i},y=(t,r)=>(o,e)=>r(o,e,t);var j={};h(j,{HttpDynamicNetworkDataSource:()=>c});module.exports=b(j);var l=d(require("axios")),f=require("inversify"),s=require("purify-ts"),D=require("../../config/di/configTypes"),w=require("../../shared/constant/HttpHeaders"),k=d(require("../../../package.json"));let c=class{constructor(r){this.config=r}async getDynamicNetworkConfiguration(r){let o;try{o=(await l.default.get(`${this.config.cal.url}/networks?output=id,descriptors,icons&chain_id=${r}`,{headers:{[w.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${k.default.version}`}})).data}catch(n){return(0,s.Left)(n instanceof Error?n:new Error("Failed to fetch network configuration"))}const e=o?.[0];if(!e)return(0,s.Left)(new Error(`Network configuration not found for chain ID: ${r}`));if(!this.isValidNetworkData(e))return(0,s.Left)(new Error(`Invalid network configuration response for chain ID: ${r}`));const i=this.transformToNetworkConfiguration(e);return(0,s.Right)(i)}isValidNetworkData(r){if(!r||typeof r!="object")return!1;const o=r;if(typeof o.id!="string"||!o.descriptors||typeof o.descriptors!="object")return!1;for(const e of Object.values(o.descriptors))if(!this.isValidDescriptor(e))return!1;return!(o.icons&&typeof o.icons!="object")}isValidDescriptor(r){if(!r||typeof r!="object")return!1;const o=r;if(typeof o.data!="string"||typeof o.descriptorType!="string"||typeof o.descriptorVersion!="string"||!o.signatures||typeof o.signatures!="object")return!1;const e=o.signatures;return!(typeof e.prod!="string"||typeof e.test!="string")}transformToNetworkConfiguration(r){const o=Object.entries(r.descriptors).reduce((e,[i,n])=>(e[i]={descriptorType:n.descriptorType,descriptorVersion:n.descriptorVersion,data:n.data,signatures:n.signatures,icon:r.icons?.[i]},e),{});return{id:r.id,descriptors:o}}};c=g([(0,f.injectable)(),y(0,(0,f.inject)(D.configTypes.Config))],c);0&&(module.exports={HttpDynamicNetworkDataSource});
|
|
2
|
+
//# sourceMappingURL=HttpDynamicNetworkDataSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/dynamic-network/data/HttpDynamicNetworkDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport 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 {\n type DynamicNetworkConfiguration,\n type DynamicNetworkDescriptor,\n} from \"@/dynamic-network/model/DynamicNetworkConfiguration\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type DynamicNetworkApiResponseDto } from \"./dto/DynamicNetworkApiResponseDto\";\nimport { type DynamicNetworkDataSource } from \"./DynamicNetworkDataSource\";\n\n@injectable()\nexport class HttpDynamicNetworkDataSource implements DynamicNetworkDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async getDynamicNetworkConfiguration(\n chainId: number,\n ): Promise<Either<Error, DynamicNetworkConfiguration>> {\n let response: DynamicNetworkApiResponseDto;\n\n try {\n const axiosResponse = await axios.get<DynamicNetworkApiResponseDto>(\n `${this.config.cal.url}/networks?output=id,descriptors,icons&chain_id=${chainId}`,\n {\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n },\n },\n );\n response = axiosResponse.data;\n } catch (error) {\n return Left(\n error instanceof Error\n ? error\n : new Error(\"Failed to fetch network configuration\"),\n );\n }\n\n const networkData = response?.[0];\n if (!networkData) {\n return Left(\n new Error(`Network configuration not found for chain ID: ${chainId}`),\n );\n }\n\n // Validate response structure\n if (!this.isValidNetworkData(networkData)) {\n return Left(\n new Error(\n `Invalid network configuration response for chain ID: ${chainId}`,\n ),\n );\n }\n\n const configuration = this.transformToNetworkConfiguration(networkData);\n return Right(configuration);\n }\n\n private isValidNetworkData(\n data: unknown,\n ): data is DynamicNetworkApiResponseDto[0] {\n if (!data || typeof data !== \"object\") {\n return false;\n }\n\n const obj = data as Record<string, unknown>;\n\n // Check required fields\n if (typeof obj[\"id\"] !== \"string\") {\n return false;\n }\n\n // Check descriptors structure\n if (!obj[\"descriptors\"] || typeof obj[\"descriptors\"] !== \"object\") {\n return false;\n }\n\n // Validate each descriptor\n for (const descriptor of Object.values(obj[\"descriptors\"])) {\n if (!this.isValidDescriptor(descriptor)) {\n return false;\n }\n }\n\n // Icons are optional but if present, should be an object\n if (obj[\"icons\"] && typeof obj[\"icons\"] !== \"object\") {\n return false;\n }\n\n return true;\n }\n\n private isValidDescriptor(\n descriptor: unknown,\n ): descriptor is DynamicNetworkApiResponseDto[0][\"descriptors\"][string] {\n if (!descriptor || typeof descriptor !== \"object\") {\n return false;\n }\n\n const desc = descriptor as Record<string, unknown>;\n\n // Check required descriptor fields\n if (\n typeof desc[\"data\"] !== \"string\" ||\n typeof desc[\"descriptorType\"] !== \"string\" ||\n typeof desc[\"descriptorVersion\"] !== \"string\"\n ) {\n return false;\n }\n\n // Check signatures structure\n if (!desc[\"signatures\"] || typeof desc[\"signatures\"] !== \"object\") {\n return false;\n }\n\n const signatures = desc[\"signatures\"] as Record<string, unknown>;\n if (\n typeof signatures[\"prod\"] !== \"string\" ||\n typeof signatures[\"test\"] !== \"string\"\n ) {\n return false;\n }\n\n return true;\n }\n\n private transformToNetworkConfiguration(\n networkData: DynamicNetworkApiResponseDto[0],\n ): DynamicNetworkConfiguration {\n const descriptors = Object.entries(networkData.descriptors).reduce(\n (acc, [deviceModel, descriptor]) => {\n acc[deviceModel as DeviceModelId] = {\n descriptorType: descriptor.descriptorType,\n descriptorVersion: descriptor.descriptorVersion,\n data: descriptor.data,\n signatures: descriptor.signatures,\n icon: networkData.icons?.[deviceModel],\n };\n return acc;\n },\n {} as Record<DeviceModelId, DynamicNetworkDescriptor>,\n );\n\n return {\n id: networkData.id,\n descriptors,\n };\n }\n}\n"],
|
|
5
|
+
"mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAM5BC,EAA6C,yCAC7CC,EAAoB,iCAMb,IAAMC,EAAN,KAAuE,CAC5E,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAM,+BACJC,EACqD,CACrD,IAAIC,EAEJ,GAAI,CASFA,GARsB,MAAM,EAAAC,QAAM,IAChC,GAAG,KAAK,OAAO,IAAI,GAAG,kDAAkDF,CAAO,GAC/E,CACE,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAG,QAAQ,OAAO,EACnE,CACF,CACF,GACyB,IAC3B,OAASC,EAAO,CACd,SAAO,QACLA,aAAiB,MACbA,EACA,IAAI,MAAM,uCAAuC,CACvD,CACF,CAEA,MAAMC,EAAcJ,IAAW,CAAC,EAChC,GAAI,CAACI,EACH,SAAO,QACL,IAAI,MAAM,iDAAiDL,CAAO,EAAE,CACtE,EAIF,GAAI,CAAC,KAAK,mBAAmBK,CAAW,EACtC,SAAO,QACL,IAAI,MACF,wDAAwDL,CAAO,EACjE,CACF,EAGF,MAAMM,EAAgB,KAAK,gCAAgCD,CAAW,EACtE,SAAO,SAAMC,CAAa,CAC5B,CAEQ,mBACNC,EACyC,CACzC,GAAI,CAACA,GAAQ,OAAOA,GAAS,SAC3B,MAAO,GAGT,MAAMC,EAAMD,EAQZ,GALI,OAAOC,EAAI,IAAU,UAKrB,CAACA,EAAI,aAAkB,OAAOA,EAAI,aAAmB,SACvD,MAAO,GAIT,UAAWC,KAAc,OAAO,OAAOD,EAAI,WAAc,EACvD,GAAI,CAAC,KAAK,kBAAkBC,CAAU,EACpC,MAAO,GAKX,MAAI,EAAAD,EAAI,OAAY,OAAOA,EAAI,OAAa,SAK9C,CAEQ,kBACNC,EACsE,CACtE,GAAI,CAACA,GAAc,OAAOA,GAAe,SACvC,MAAO,GAGT,MAAMC,EAAOD,EAYb,GARE,OAAOC,EAAK,MAAY,UACxB,OAAOA,EAAK,gBAAsB,UAClC,OAAOA,EAAK,mBAAyB,UAMnC,CAACA,EAAK,YAAiB,OAAOA,EAAK,YAAkB,SACvD,MAAO,GAGT,MAAMC,EAAaD,EAAK,WACxB,MACE,SAAOC,EAAW,MAAY,UAC9B,OAAOA,EAAW,MAAY,SAMlC,CAEQ,gCACNN,EAC6B,CAC7B,MAAMO,EAAc,OAAO,QAAQP,EAAY,WAAW,EAAE,OAC1D,CAACQ,EAAK,CAACC,EAAaL,CAAU,KAC5BI,EAAIC,CAA4B,EAAI,CAClC,eAAgBL,EAAW,eAC3B,kBAAmBA,EAAW,kBAC9B,KAAMA,EAAW,KACjB,WAAYA,EAAW,WACvB,KAAMJ,EAAY,QAAQS,CAAW,CACvC,EACOD,GAET,CAAC,CACH,EAEA,MAAO,CACL,GAAIR,EAAY,GAChB,YAAAO,CACF,CACF,CACF,EA1Iad,EAANiB,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBlB",
|
|
6
|
+
"names": ["HttpDynamicNetworkDataSource_exports", "__export", "HttpDynamicNetworkDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpDynamicNetworkDataSource", "config", "chainId", "response", "axios", "PACKAGE", "error", "networkData", "configuration", "data", "obj", "descriptor", "desc", "signatures", "descriptors", "acc", "deviceModel", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var f=Object.create;var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var k=(a,i,c,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of g(i))!w.call(a,t)&&t!==c&&d(a,t,{get:()=>i[t],enumerable:!(o=u(i,t))||o.enumerable});return a};var b=(a,i,c)=>(c=a!=null?f(p(a)):{},k(i||!a||!a.__esModule?d(c,"default",{value:a,enumerable:!0}):c,a));var r=b(require("axios")),n=require("purify-ts"),e=require("vitest"),l=require("./HttpDynamicNetworkDataSource");e.vi.mock("axios");(0,e.describe)("HttpNetworkDataSource",()=>{let a;const i={cal:{url:"https://crypto-assets-service.api.ledger.com",mode:"prod",branch:"main"}},c={data:[{id:"ethereum",descriptors:{flex:{data:"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"3045022100c116b5470c266c2947b92aa9eadbe3da03305efc6b8fee041e04e8484a9834af022041d5b82b359614ea8dd94a542dfd87b0ae6f3b4a075aad9a53a030064ab42cd0",test:"3045022100f78bac5c9c3f2ceeea26680aaea17be61fce84ae7ec983a8194e68275f4fe5900220231afbe39fcec63edfea2b4e787a72d79ce53d6a4c408f24b5a116905a9082d3"}},stax:{data:"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c53204aa5034d2fd4c46647d382aa64d0a03d06b185512bb7942390318bda18d0423a",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d",test:"304402207e1e1b8f99b45c95b0cf1e90f46cf07e6a90f82c49ccdb6e2e95ab0c1e2f5a370220784e1fac16bb01c5d096733e1cbf067d616e4de659fda2c388f8c3502e7f7f80"}}}}]};(0,e.beforeAll)(()=>{a=new l.HttpDynamicNetworkDataSource(i)}),(0,e.beforeEach)(()=>{e.vi.clearAllMocks()}),(0,e.describe)("getNetworkConfiguration",()=>{(0,e.it)("should return network configuration successfully",async()=>{e.vi.mocked(r.default.get).mockResolvedValue(c);const o=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(r.default.get).toHaveBeenCalledWith("https://crypto-assets-service.api.ledger.com/networks?output=id,descriptors,icons&chain_id=1",e.expect.objectContaining({headers:e.expect.any(Object)})),(0,e.expect)(o).toEqual((0,n.Right)({id:"ethereum",descriptors:{flex:{data:"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"3045022100c116b5470c266c2947b92aa9eadbe3da03305efc6b8fee041e04e8484a9834af022041d5b82b359614ea8dd94a542dfd87b0ae6f3b4a075aad9a53a030064ab42cd0",test:"3045022100f78bac5c9c3f2ceeea26680aaea17be61fce84ae7ec983a8194e68275f4fe5900220231afbe39fcec63edfea2b4e787a72d79ce53d6a4c408f24b5a116905a9082d3"},icon:void 0},stax:{data:"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c53204aa5034d2fd4c46647d382aa64d0a03d06b185512bb7942390318bda18d0423a",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d",test:"304402207e1e1b8f99b45c95b0cf1e90f46cf07e6a90f82c49ccdb6e2e95ab0c1e2f5a370220784e1fac16bb01c5d096733e1cbf067d616e4de659fda2c388f8c3502e7f7f80"},icon:void 0}}}))}),(0,e.it)("should return error when network data is not found",async()=>{e.vi.mocked(r.default.get).mockResolvedValue({data:[]});const o=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(o).toEqual((0,n.Left)(new Error("Network configuration not found for chain ID: 1")))}),(0,e.it)("should return error when network data is undefined",async()=>{e.vi.mocked(r.default.get).mockResolvedValue({data:void 0});const o=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(o).toEqual((0,n.Left)(new Error("Network configuration not found for chain ID: 1")))}),(0,e.it)("should return error when axios throws an error",async()=>{e.vi.mocked(r.default.get).mockRejectedValue(new Error("Network error"));const o=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(o).toEqual((0,n.Left)(new Error("Network error")))}),(0,e.it)("should return generic error when axios throws non-Error",async()=>{e.vi.mocked(r.default.get).mockRejectedValue("String error");const o=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(o).toEqual((0,n.Left)(new Error("Failed to fetch network configuration")))}),(0,e.it)("should handle invalid data - missing id",async()=>{const o={data:[{descriptors:{}}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid data - missing descriptors",async()=>{const o={data:[{id:"ethereum"}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid descriptor - missing data field",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:{descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"sig1",test:"sig2"}}}}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid descriptor - missing signatures",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:{data:"0x0101",descriptorType:"network",descriptorVersion:"v1"}}}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid signatures - missing prod",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:{data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{test:"sig2"}}}}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should include icons when available",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:{data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"sig1",test:"sig2"}},stax:{data:"0x0102",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"sig3",test:"sig4"}}},icons:{flex:"icon1",stax:"icon2"}}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t.isRight()).toBe(!0);const s=t.unsafeCoerce();(0,e.expect)(s.descriptors.flex.icon).toBe("icon1"),(0,e.expect)(s.descriptors.stax.icon).toBe("icon2")}),(0,e.it)("should transform data correctly for Polygon chain ID",async()=>{e.vi.mocked(r.default.get).mockResolvedValue(c);const o=await a.getDynamicNetworkConfiguration(137);(0,e.expect)(r.default.get).toHaveBeenCalledWith("https://crypto-assets-service.api.ledger.com/networks?output=id,descriptors,icons&chain_id=137",e.expect.objectContaining({headers:e.expect.any(Object)})),(0,e.expect)(o.isRight()).toBe(!0);const t=o.unsafeCoerce();(0,e.expect)(Object.keys(t.descriptors)).toEqual(["flex","stax"])}),(0,e.it)("should handle invalid data - null data",async()=>{const o={data:[null]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Network configuration not found for chain ID: 1")))}),(0,e.it)("should handle invalid data - non-object data",async()=>{const o={data:["string_instead_of_object"]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid data - icons as string instead of object",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:{data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"sig1",test:"sig2"}}},icons:"should_be_object_not_string"}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid data - icons as number instead of object (line 93)",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:{data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"sig1",test:"sig2"}}},icons:123}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid descriptor - null descriptor (line 103)",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:null}}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))}),(0,e.it)("should handle invalid descriptor - non-object descriptor (line 103)",async()=>{const o={data:[{id:"ethereum",descriptors:{flex:"should_be_object_not_string"}}]};e.vi.mocked(r.default.get).mockResolvedValue(o);const t=await a.getDynamicNetworkConfiguration(1);(0,e.expect)(t).toEqual((0,n.Left)(new Error("Invalid network configuration response for chain ID: 1")))})})});
|
|
2
|
+
//# sourceMappingURL=HttpDynamicNetworkDataSource.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/dynamic-network/data/HttpDynamicNetworkDataSource.test.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\nimport { beforeAll, beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\n\nimport { HttpDynamicNetworkDataSource } from \"./HttpDynamicNetworkDataSource\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpNetworkDataSource\", () => {\n let datasource: HttpDynamicNetworkDataSource;\n const mockConfig: ContextModuleConfig = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n\n const mockNetworkResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100c116b5470c266c2947b92aa9eadbe3da03305efc6b8fee041e04e8484a9834af022041d5b82b359614ea8dd94a542dfd87b0ae6f3b4a075aad9a53a030064ab42cd0\",\n test: \"3045022100f78bac5c9c3f2ceeea26680aaea17be61fce84ae7ec983a8194e68275f4fe5900220231afbe39fcec63edfea2b4e787a72d79ce53d6a4c408f24b5a116905a9082d3\",\n },\n },\n stax: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c53204aa5034d2fd4c46647d382aa64d0a03d06b185512bb7942390318bda18d0423a\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d\",\n test: \"304402207e1e1b8f99b45c95b0cf1e90f46cf07e6a90f82c49ccdb6e2e95ab0c1e2f5a370220784e1fac16bb01c5d096733e1cbf067d616e4de659fda2c388f8c3502e7f7f80\",\n },\n },\n },\n },\n ],\n };\n\n beforeAll(() => {\n datasource = new HttpDynamicNetworkDataSource(mockConfig);\n });\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n describe(\"getNetworkConfiguration\", () => {\n it(\"should return network configuration successfully\", async () => {\n vi.mocked(axios.get).mockResolvedValue(mockNetworkResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(axios.get).toHaveBeenCalledWith(\n \"https://crypto-assets-service.api.ledger.com/networks?output=id,descriptors,icons&chain_id=1\",\n expect.objectContaining({\n headers: expect.any(Object) as Record<string, string>,\n }),\n );\n\n expect(result).toEqual(\n Right({\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100c116b5470c266c2947b92aa9eadbe3da03305efc6b8fee041e04e8484a9834af022041d5b82b359614ea8dd94a542dfd87b0ae6f3b4a075aad9a53a030064ab42cd0\",\n test: \"3045022100f78bac5c9c3f2ceeea26680aaea17be61fce84ae7ec983a8194e68275f4fe5900220231afbe39fcec63edfea2b4e787a72d79ce53d6a4c408f24b5a116905a9082d3\",\n },\n icon: undefined,\n },\n stax: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c53204aa5034d2fd4c46647d382aa64d0a03d06b185512bb7942390318bda18d0423a\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d\",\n test: \"304402207e1e1b8f99b45c95b0cf1e90f46cf07e6a90f82c49ccdb6e2e95ab0c1e2f5a370220784e1fac16bb01c5d096733e1cbf067d616e4de659fda2c388f8c3502e7f7f80\",\n },\n icon: undefined,\n },\n },\n }),\n );\n });\n\n it(\"should return error when network data is not found\", async () => {\n vi.mocked(axios.get).mockResolvedValue({ data: [] });\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Network configuration not found for chain ID: 1\")),\n );\n });\n\n it(\"should return error when network data is undefined\", async () => {\n vi.mocked(axios.get).mockResolvedValue({ data: undefined });\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Network configuration not found for chain ID: 1\")),\n );\n });\n\n it(\"should return error when axios throws an error\", async () => {\n vi.mocked(axios.get).mockRejectedValue(new Error(\"Network error\"));\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(Left(new Error(\"Network error\")));\n });\n\n it(\"should return generic error when axios throws non-Error\", async () => {\n vi.mocked(axios.get).mockRejectedValue(\"String error\");\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Failed to fetch network configuration\")),\n );\n });\n\n it(\"should handle invalid data - missing id\", async () => {\n const invalidResponse = {\n data: [\n {\n // Missing id\n descriptors: {},\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid data - missing descriptors\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n // Missing descriptors\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - missing data field\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n // Missing data\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: { prod: \"sig1\", test: \"sig2\" },\n },\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - missing signatures\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n // Missing signatures\n },\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid signatures - missing prod\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n // Missing prod\n test: \"sig2\",\n },\n },\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should include icons when available\", async () => {\n const responseWithIcons = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig1\",\n test: \"sig2\",\n },\n },\n stax: {\n data: \"0x0102\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig3\",\n test: \"sig4\",\n },\n },\n },\n icons: {\n flex: \"icon1\",\n stax: \"icon2\",\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(responseWithIcons);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result.isRight()).toBe(true);\n const configuration = result.unsafeCoerce();\n expect(configuration.descriptors.flex.icon).toBe(\"icon1\");\n expect(configuration.descriptors.stax.icon).toBe(\"icon2\");\n });\n\n it(\"should transform data correctly for Polygon chain ID\", async () => {\n vi.mocked(axios.get).mockResolvedValue(mockNetworkResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(137);\n\n expect(axios.get).toHaveBeenCalledWith(\n \"https://crypto-assets-service.api.ledger.com/networks?output=id,descriptors,icons&chain_id=137\",\n expect.objectContaining({\n headers: expect.any(Object) as Record<string, string>,\n }),\n );\n\n expect(result.isRight()).toBe(true);\n const configuration = result.unsafeCoerce();\n expect(Object.keys(configuration.descriptors)).toEqual([\"flex\", \"stax\"]);\n });\n\n it(\"should handle invalid data - null data\", async () => {\n const invalidResponse = {\n data: [null],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Network configuration not found for chain ID: 1\")),\n );\n });\n\n it(\"should handle invalid data - non-object data\", async () => {\n const invalidResponse = {\n data: [\"string_instead_of_object\"],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid data - icons as string instead of object\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig1\",\n test: \"sig2\",\n },\n },\n },\n icons: \"should_be_object_not_string\",\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid data - icons as number instead of object (line 93)\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig1\",\n test: \"sig2\",\n },\n },\n },\n icons: 123,\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - null descriptor (line 103)\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: null,\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - non-object descriptor (line 103)\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: \"should_be_object_not_string\",\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "wdAAA,IAAAA,EAAkB,oBAClBC,EAA4B,qBAC5BC,EAAgE,kBAIhEC,EAA6C,0CAE7C,KAAG,KAAK,OAAO,KAEf,YAAS,wBAAyB,IAAM,CACtC,IAAIC,EACJ,MAAMC,EAAkC,CACtC,IAAK,CACH,IAAK,+CACL,KAAM,OACN,OAAQ,MACV,CACF,EAEMC,EAAsB,CAC1B,KAAM,CACJ,CACE,GAAI,WACJ,YAAa,CACX,KAAM,CACJ,KAAM,uEACN,eAAgB,UAChB,kBAAmB,KACnB,WAAY,CACV,KAAM,iJACN,KAAM,gJACR,CACF,EACA,KAAM,CACJ,KAAM,2IACN,eAAgB,UAChB,kBAAmB,KACnB,WAAY,CACV,KAAM,iJACN,KAAM,8IACR,CACF,CACF,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D,EAAS,MAAMJ,EAAW,+BAA+B,CAAC,KAEhE,UAAOI,CAAM,EAAE,WACb,QACE,IAAI,MAAM,wDAAwD,CACpE,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_axios", "import_purify_ts", "import_vitest", "import_HttpDynamicNetworkDataSource", "datasource", "mockConfig", "mockNetworkResponse", "axios", "result", "invalidResponse", "responseWithIcons", "configuration"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(s,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of g(r))!p.call(s,t)&&t!==n&&e(s,t,{get:()=>r[t],enumerable:!(i=o(r,t))||i.enumerable});return s};var c=s=>d(e({},"__esModule",{value:!0}),s);var a={};module.exports=c(a);
|
|
2
|
+
//# sourceMappingURL=DynamicNetworkApiResponseDto.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.ts"],
|
|
4
|
+
"sourcesContent": ["export type DynamicNetworkApiResponseDto = Array<{\n id: string;\n descriptors: Record<\n string,\n {\n data: string;\n descriptorType: string;\n descriptorVersion: string;\n signatures: {\n prod: string;\n test: string;\n };\n }\n >;\n icons: Record<string, string>;\n}>;\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["DynamicNetworkApiResponseDto_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var D=(o,t)=>{for(var e in t)a(o,e,{get:t[e],enumerable:!0})},N=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of w(t))!k.call(o,r)&&r!==e&&a(o,r,{get:()=>t[r],enumerable:!(n=p(t,r))||n.enumerable});return o};var d=o=>N(a({},"__esModule",{value:!0}),o);var u={};D(u,{dynamicNetworkModuleFactory:()=>f});module.exports=d(u);var c=require("inversify"),i=require("../../dynamic-network/data/HttpDynamicNetworkDataSource"),y=require("../../dynamic-network/domain/DynamicNetworkContextLoader"),m=require("./dynamicNetworkTypes");const f=()=>new c.ContainerModule(({bind:o})=>{o(m.dynamicNetworkTypes.DynamicNetworkDataSource).to(i.HttpDynamicNetworkDataSource),o(m.dynamicNetworkTypes.DynamicNetworkContextLoader).to(y.DynamicNetworkContextLoader)});0&&(module.exports={dynamicNetworkModuleFactory});
|
|
2
|
+
//# sourceMappingURL=dynamicNetworkModuleFactory.js.map
|