@ledgerhq/context-module 1.3.1 → 1.6.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/README.md +17 -5
- package/lib/cjs/package.json +12 -12
- 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/di/configTypes.js +1 -1
- package/lib/cjs/src/config/di/configTypes.js.map +2 -2
- package/lib/cjs/src/config/model/ContextModuleBuildArgs.js +2 -0
- package/lib/cjs/src/config/model/ContextModuleBuildArgs.js.map +7 -0
- package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
- package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +3 -3
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
- 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/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/data/HttpPkiCertificateDataSource.js +1 -1
- package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
- 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 +1 -1
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +3 -3
- 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 +2 -0
- package/lib/cjs/src/shared/constant/HttpHeaders.js.map +7 -0
- 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/data/HttpTokenDataSource.js +1 -1
- package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +3 -3
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +3 -3
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +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/typed-data/data/HttpTypedDataDataSource.js +1 -1
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
- 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 +3 -3
- package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
- package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
- 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 +12 -12
- 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/config/di/configTypes.js +1 -1
- package/lib/esm/src/config/di/configTypes.js.map +2 -2
- package/lib/esm/src/config/model/ContextModuleBuildArgs.js +1 -0
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- 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/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/data/HttpPkiCertificateDataSource.js +1 -1
- package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
- 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 +1 -1
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +3 -3
- 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 +2 -0
- package/lib/esm/src/shared/constant/HttpHeaders.js.map +7 -0
- 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/data/HttpTokenDataSource.js +1 -1
- package/lib/esm/src/token/data/HttpTokenDataSource.js.map +3 -3
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +3 -3
- 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 +2 -2
- 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/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 +22 -4
- 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/di/configTypes.d.ts +1 -0
- package/lib/types/src/config/di/configTypes.d.ts.map +1 -1
- package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts +4 -0
- package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts.map +1 -0
- package/lib/types/src/config/model/ContextModuleConfig.d.ts +7 -0
- package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/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/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/data/HttpPkiCertificateDataSource.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 +3 -0
- package/lib/types/src/shared/constant/HttpHeaders.d.ts.map +1 -0
- 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/data/HttpTokenDataSource.d.ts.map +1 -1
- 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 +32 -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 +1 -1
- 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 +13 -13
- 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 → config/model/ContextModuleBuildArgs.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/uniswap/domain/UniswapContextLoader.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { Interface, type TransactionDescription } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport {\n UNISWAP_EXECUTE_SELECTOR,\n UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport { type CommandDecoderDataSource } from \"@/uniswap/data/CommandDecoderDataSource\";\nimport { DefaultCommandDecoderDataSource } from \"@/uniswap/data/DefaultCommandDecoderDataSource\";\nimport { EthersAbiDecoderDataSource } from \"@/uniswap/data/EthersAbiDecoderDataSource\";\n\nimport { UniswapContextLoader } from \"./UniswapContextLoader\";\n\ndescribe(\"UniswapContextLoader\", () => {\n const commandDecoderMock: CommandDecoderDataSource = {\n decode: vi.fn(),\n };\n const tokenDataSourceMock = {\n getTokenInfosPayload: vi.fn(),\n };\n let loader: UniswapContextLoader;\n\n describe(\"load\", () => {\n describe(\"with tokenDataSourceMock\", () => {\n beforeEach(() => {\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n loader = new UniswapContextLoader(\n new DefaultCommandDecoderDataSource(new EthersAbiDecoderDataSource()),\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return the external plugin context and the decoded contexts\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc9821c32c1782d9ab6baf6f9ca4b2565bce11aaf5146a2d303215bda026f5e48\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e\",\n }, // ERC20\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n ]);\n });\n\n it(\"should return the external plugin context and the decoded contexts with a permit\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc4df7ccc0527541d0e80856a8f38deedc48c84825e9355469ba02d873502ce2f\n // PERMIT2_PERMIT, V3_SWAP_EXACT_OUT, UNWRAP_ETH\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n {\n type: \"token\",\n payload: \"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e\",\n }, // ERC20\n ]);\n });\n\n it(\"should return an empty array if the transaction is not supported\", async () => {\n // GIVEN\n const transactionContext = {} as TransactionContext;\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if a command is not supported\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xa628c8b3da2ad984aed0354d8ca4b4c3c42941491dc4e0d6a5f423fd65e6c90a\n // The command 0x05 (TRANSFER) is not supported\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe(\"with mocked ethers parseTransaction\", () => {\n beforeEach(() => {\n vi.resetAllMocks();\n loader = new UniswapContextLoader(\n commandDecoderMock,\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an array with contexts if 2 chain swaps are supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x04\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x02\",\n \"0x03\",\n ]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x04\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if 1 chain swap with a non swap command\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0b0004`; // WRAP_ETH, V3_SWAP_EXACT_IN, SWEEP\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\", \"0x0003\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\"0x01\"]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x02\",\n \"0x03\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\"0x04\"]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.WRAP_ETH,\n \"0x0001\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x04\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if one token is not found\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x02\",\n \"0x03\",\n ]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockResolvedValueOnce(Left(\"error\"));\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"error\",\n error: \"error\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an empty array if the if 2 chain swaps are not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x03\", // should be 0x02\n \"0x04\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no command are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"\"],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no inputs are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"0x08\", []],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if parseTransaction throws an error\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockImplementation(\n () => {\n throw new Error();\n },\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the swap is with multiple pool versions\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x080900`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT, V3_SWAP_EXACT_IN\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x00\", \"0x01\", \"0x02\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([\n \"0x01\",\n \"0x02\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x00\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x01\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 3,\n UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n \"0x02\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the selector is not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: \"0x00000000\",\n chainId: 0x42,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the length of the commands and inputs are different\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\"]],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,aAAAA,MAA8C,SACvD,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,kCAGrC,OACE,4BAAAC,EACA,oCAAAC,EACA,2BAAAC,MACK,8BAEP,OAAS,mCAAAC,MAAuC,iDAChD,OAAS,8BAAAC,MAAkC,4CAE3C,OAAS,wBAAAC,MAA4B,yBAErC,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA+C,CACnD,OAAQ,GAAG,GAAG,CAChB,EACMC,EAAsB,CAC1B,qBAAsB,GAAG,GAAG,CAC9B,EACA,IAAIC,EAEJ,SAAS,OAAQ,IAAM,CACrB,SAAS,2BAA4B,IAAM,CACzC,WAAW,IAAM,CACf,GAAG,MACDD,EACA,sBACF,EAAE,mBAAmB,CAAC,CAAE,QAAAE,CAAQ,IAC9B,QAAQ,QAAQX,EAAM,WAAWW,CAAO,EAAE,CAAC,CAC7C,EACAD,EAAS,IAAIH,EACX,IAAIF,EAAgC,IAAIC,CAA4B,EACpEG,CACF,CACF,CAAC,EAED,GAAG,qEAAsE,SAAY,CAGnF,
|
|
4
|
+
"sourcesContent": ["import { Interface, type TransactionDescription } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport {\n UNISWAP_EXECUTE_SELECTOR,\n UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport { type CommandDecoderDataSource } from \"@/uniswap/data/CommandDecoderDataSource\";\nimport { DefaultCommandDecoderDataSource } from \"@/uniswap/data/DefaultCommandDecoderDataSource\";\nimport { EthersAbiDecoderDataSource } from \"@/uniswap/data/EthersAbiDecoderDataSource\";\n\nimport { UniswapContextLoader } from \"./UniswapContextLoader\";\n\ndescribe(\"UniswapContextLoader\", () => {\n const commandDecoderMock: CommandDecoderDataSource = {\n decode: vi.fn(),\n };\n const tokenDataSourceMock = {\n getTokenInfosPayload: vi.fn(),\n };\n let loader: UniswapContextLoader;\n\n describe(\"load\", () => {\n describe(\"with tokenDataSourceMock\", () => {\n beforeEach(() => {\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n loader = new UniswapContextLoader(\n new DefaultCommandDecoderDataSource(new EthersAbiDecoderDataSource()),\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an empty array if the selector is not UNISWAP_EXECUTE_SELECTOR\", async () => {\n // GIVEN\n const transactionContext = {\n selector: \"0x00000000\",\n data: \"0x00000000\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return the external plugin context and the decoded contexts\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc9821c32c1782d9ab6baf6f9ca4b2565bce11aaf5146a2d303215bda026f5e48\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e\",\n }, // ERC20\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n ]);\n });\n\n it(\"should return the external plugin context and the decoded contexts with a permit\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc4df7ccc0527541d0e80856a8f38deedc48c84825e9355469ba02d873502ce2f\n // PERMIT2_PERMIT, V3_SWAP_EXACT_OUT, UNWRAP_ETH\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n {\n type: \"token\",\n payload: \"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e\",\n }, // ERC20\n ]);\n });\n\n it(\"should return an empty array if the transaction is not supported\", async () => {\n // GIVEN\n const transactionContext = {} as TransactionContext;\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if a command is not supported\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xa628c8b3da2ad984aed0354d8ca4b4c3c42941491dc4e0d6a5f423fd65e6c90a\n // The command 0x05 (TRANSFER) is not supported\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8\",\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe(\"with mocked ethers parseTransaction\", () => {\n beforeEach(() => {\n vi.resetAllMocks();\n loader = new UniswapContextLoader(\n commandDecoderMock,\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an array with contexts if 2 chain swaps are supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\", \"0x04\", \"0x02\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"]);\n\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x04\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if 1 chain swap with a non swap command\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0b0004`; // WRAP_ETH, V3_SWAP_EXACT_IN, SWEEP\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\", \"0x0003\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"])\n .mockReturnValueOnce([\"0x04\"]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.WRAP_ETH,\n \"0x0001\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x04\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if one token is not found\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\")\n .mockReturnValueOnce([\"0x01\", \"0x02\"])\n .mockReturnValueOnce([\"0x02\", \"0x03\"]);\n vi.spyOn(tokenDataSourceMock, \"getTokenInfosPayload\")\n .mockResolvedValueOnce(Left(\"error\"))\n .mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"error\",\n error: \"error\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an empty array if the if 2 chain swaps are not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x03\", // should be 0x02\n \"0x04\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no command are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"\"],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no inputs are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"0x08\", []],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if parseTransaction throws an error\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockImplementation(\n () => {\n throw new Error();\n },\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the swap is with multiple pool versions\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x080900`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT, V3_SWAP_EXACT_IN\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x00\", \"0x01\", \"0x02\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([\n \"0x01\",\n \"0x02\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x00\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x01\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 3,\n UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n \"0x02\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the selector is not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: \"0x00000000\",\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the length of the commands and inputs are different\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n selector: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\"]],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,aAAAA,MAA8C,SACvD,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,kCAGrC,OACE,4BAAAC,EACA,oCAAAC,EACA,2BAAAC,MACK,8BAEP,OAAS,mCAAAC,MAAuC,iDAChD,OAAS,8BAAAC,MAAkC,4CAE3C,OAAS,wBAAAC,MAA4B,yB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,EAGnD,OAAOJ,EAAmB,MAAM,EAAE,wBAChC,EACAJ,EAAwB,iBACxB,OACA,EACF,EACA,OAAOI,EAAmB,MAAM,EAAE,wBAChC,EACAJ,EAAwB,kBACxB,OACA,EACF,EACA,OAAOI,EAAmB,MAAM,EAAE,wBAChC,EACAJ,EAAwB,iBACxB,OACA,EACF,EACA,OAAOK,EAAoB,oBAAoB,EAAE,IAAI,iBAAiB,EACtE,OAAOI,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,gEAAiE,SAAY,CAE9E,MAAMD,EAAqB,CACzB,GAAIT,EACJ,KAAM,aACN,QAAS,GACT,SAAUD,CACZ,EAGMW,EAAS,MAAMH,EAAO,KAAKE,CAAkB,EAGnD,OAAOJ,EAAmB,MAAM,EAAE,IAAI,iBAAiB,EACvD,OAAOC,EAAoB,oBAAoB,EAAE,IAAI,iBAAiB,EACtE,OAAOI,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,sFAAuF,SAAY,CAEpG,MAAMD,EAAqB,CACzB,GAAIT,EACJ,KAAMD,EACN,QAAS,GACT,SAAUA,CACZ,EAEA,GAAG,MAAMJ,EAAU,UAAW,kBAAkB,EAAE,gBAAgB,CAChE,KAAM,CAFS,SAEE,CAAC,QAAQ,CAAC,CAC7B,CAA2B,EAG3B,MAAMe,EAAS,MAAMH,EAAO,KAAKE,CAAkB,EAGnD,OAAOJ,EAAmB,MAAM,EAAE,IAAI,iBAAiB,EACvD,OAAOC,EAAoB,oBAAoB,EAAE,IAAI,iBAAiB,EACtE,OAAOI,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
6
|
"names": ["Interface", "Left", "Right", "ClearSignContextType", "UNISWAP_EXECUTE_SELECTOR", "UNISWAP_UNIVERSAL_ROUTER_ADDRESS", "UniswapSupportedCommand", "DefaultCommandDecoderDataSource", "EthersAbiDecoderDataSource", "UniswapContextLoader", "commandDecoderMock", "tokenDataSourceMock", "loader", "address", "transactionContext", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var m=Object.defineProperty;var
|
|
1
|
+
var m=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=(n,e,i,r)=>{for(var t=r>1?void 0:r?l(e,i):e,o=n.length-1,c;o>=0;o--)(c=n[o])&&(t=(r?c(e,i,t):c(t))||t);return r&&t&&m(e,i,t),t},s=(n,e)=>(i,r)=>e(i,r,n);import u from"axios";import{inject as h,injectable as b}from"inversify";import{Left as C,Right as y}from"purify-ts";import{configTypes as g}from"../../config/di/configTypes";import{pkiTypes as D}from"../../pki/di/pkiTypes";import{KeyUsage as W}from"../../pki/model/KeyUsage";import{LEDGER_CLIENT_VERSION_HEADER as _,LEDGER_ORIGIN_TOKEN_HEADER as E}from"../../shared/constant/HttpHeaders";import x from"../../../package.json";let a=class{constructor(e,i){this.config=e;this._certificateLoader=i;if(!this.config.originToken)throw new Error("Origin token is required")}async getWeb3Checks(e){const{from:i,deviceModelId:r}=e;let t,o,c;this.isTypedDataContext(e)?(o={msg:{from:i,data:e.data}},c=`${this.config.web3checks.url}/ethereum/scan/eip-712`):(o={tx:{from:i,raw:e.rawTx},chain:e.chainId},c=`${this.config.web3checks.url}/ethereum/scan/tx`);try{t=(await u.request({method:"POST",url:c,data:o,headers:{[_]:`context-module/${x.version}`,[E]:this.config.originToken}})).data}catch{return C(new Error("[ContextModule] HttpWeb3CheckDataSource: Failed to fetch web3 checks informations"))}if(!this.isWeb3CheckDto(t))return C(new Error("[ContextModule] HttpWeb3CheckDataSource: Cannot exploit Web3 checks data received"));const f=await this._certificateLoader.loadCertificate({keyId:t.public_key_id,keyUsage:W.TxSimulationSigner,targetDevice:r}),d={publicKeyId:t.public_key_id,descriptor:t.descriptor,certificate:f};return y(d)}isTypedDataContext(e){return"data"in e}isWeb3CheckDto(e){return e!=null&&typeof e=="object"&&"public_key_id"in e&&e.public_key_id!=null&&typeof e.public_key_id=="string"&&"descriptor"in e&&e.descriptor!=null&&typeof e.descriptor=="string"}};a=p([b(),s(0,h(g.Config)),s(1,h(D.PkiCertificateLoader))],a);export{a as HttpWeb3CheckDataSource};
|
|
2
2
|
//# sourceMappingURL=HttpWeb3CheckDataSource.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/web3-check/data/HttpWeb3CheckDataSource.ts"],
|
|
4
|
-
"sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport {\n type Web3CheckContext,\n type Web3Checks,\n type Web3CheckTypedDataContext,\n} from \"@/web3-check/domain/web3CheckTypes\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { Web3CheckDataSource } from \"./Web3CheckDataSource\";\nimport { GetWeb3ChecksRequestDto, Web3CheckDto } from \"./Web3CheckDto\";\n\n@injectable()\nexport class HttpWeb3CheckDataSource implements Web3CheckDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n async getWeb3Checks(\n context: Web3CheckContext,\n ): Promise<Either<Error, Web3Checks>> {\n const { from, deviceModelId } = context;\n let web3CheckDto: Web3CheckDto;\n let requestDto: GetWeb3ChecksRequestDto;\n let url: string;\n if (this.isTypedDataContext(context)) {\n requestDto = {\n msg: {\n from,\n data: context.data,\n },\n };\n url = `${this.config.web3checks.url}/ethereum/scan/eip-712`;\n } else {\n requestDto = {\n tx: {\n from,\n raw: context.rawTx,\n },\n chain: context.chainId,\n };\n url = `${this.config.web3checks.url}/ethereum/scan/tx`;\n }\n\n try {\n const response = await axios.request<Web3CheckDto>({\n method: \"POST\",\n url,\n data: requestDto,\n headers: {\n
|
|
5
|
-
"mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAE5B,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,YAAAC,MAAgB,
|
|
6
|
-
"names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "pkiTypes", "KeyUsage", "PACKAGE", "HttpWeb3CheckDataSource", "config", "_certificateLoader", "context", "from", "deviceModelId", "web3CheckDto", "requestDto", "url", "axios", "PACKAGE", "Left", "certificate", "KeyUsage", "result", "Right", "dto", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes", "pkiTypes"]
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n type Web3CheckContext,\n type Web3Checks,\n type Web3CheckTypedDataContext,\n} from \"@/web3-check/domain/web3CheckTypes\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { Web3CheckDataSource } from \"./Web3CheckDataSource\";\nimport { GetWeb3ChecksRequestDto, Web3CheckDto } from \"./Web3CheckDto\";\n\n@injectable()\nexport class HttpWeb3CheckDataSource implements Web3CheckDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {\n if (!this.config.originToken) {\n throw new Error(\"Origin token is required\");\n }\n }\n\n async getWeb3Checks(\n context: Web3CheckContext,\n ): Promise<Either<Error, Web3Checks>> {\n const { from, deviceModelId } = context;\n let web3CheckDto: Web3CheckDto;\n let requestDto: GetWeb3ChecksRequestDto;\n let url: string;\n if (this.isTypedDataContext(context)) {\n requestDto = {\n msg: {\n from,\n data: context.data,\n },\n };\n url = `${this.config.web3checks.url}/ethereum/scan/eip-712`;\n } else {\n requestDto = {\n tx: {\n from,\n raw: context.rawTx,\n },\n chain: context.chainId,\n };\n url = `${this.config.web3checks.url}/ethereum/scan/tx`;\n }\n\n try {\n const response = await axios.request<Web3CheckDto>({\n method: \"POST\",\n url,\n data: requestDto,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n web3CheckDto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpWeb3CheckDataSource: Failed to fetch web3 checks informations\",\n ),\n );\n }\n\n if (!this.isWeb3CheckDto(web3CheckDto)) {\n return Left(\n new Error(\n \"[ContextModule] HttpWeb3CheckDataSource: Cannot exploit Web3 checks data received\",\n ),\n );\n }\n\n const certificate = await this._certificateLoader.loadCertificate({\n keyId: web3CheckDto.public_key_id,\n keyUsage: KeyUsage.TxSimulationSigner,\n targetDevice: deviceModelId,\n });\n\n const result: Web3Checks = {\n publicKeyId: web3CheckDto.public_key_id,\n descriptor: web3CheckDto.descriptor,\n certificate,\n };\n\n return Right(result);\n }\n\n private isTypedDataContext(\n context: Web3CheckContext,\n ): context is Web3CheckTypedDataContext {\n return \"data\" in context;\n }\n\n private isWeb3CheckDto(dto: unknown): dto is Web3CheckDto {\n return (\n dto != null &&\n typeof dto == \"object\" &&\n \"public_key_id\" in dto &&\n dto.public_key_id != null &&\n typeof dto.public_key_id == \"string\" &&\n \"descriptor\" in dto &&\n dto.descriptor != null &&\n typeof dto.descriptor == \"string\"\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAE5B,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,YAAAC,MAAgB,uBACzB,OACE,gCAAAC,EACA,8BAAAC,MACK,gCAMP,OAAOC,MAAa,qBAMb,IAAMC,EAAN,KAA6D,CAClE,YAC+CC,EAE5BC,EACjB,CAH6C,YAAAD,EAE5B,wBAAAC,EAEjB,GAAI,CAAC,KAAK,OAAO,YACf,MAAM,IAAI,MAAM,0BAA0B,CAE9C,CAEA,MAAM,cACJC,EACoC,CACpC,KAAM,CAAE,KAAAC,EAAM,cAAAC,CAAc,EAAIF,EAChC,IAAIG,EACAC,EACAC,EACA,KAAK,mBAAmBL,CAAO,GACjCI,EAAa,CACX,IAAK,CACH,KAAAH,EACA,KAAMD,EAAQ,IAChB,CACF,EACAK,EAAM,GAAG,KAAK,OAAO,WAAW,GAAG,2BAEnCD,EAAa,CACX,GAAI,CACF,KAAAH,EACA,IAAKD,EAAQ,KACf,EACA,MAAOA,EAAQ,OACjB,EACAK,EAAM,GAAG,KAAK,OAAO,WAAW,GAAG,qBAGrC,GAAI,CAUFF,GATiB,MAAMG,EAAM,QAAsB,CACjD,OAAQ,OACR,IAAAD,EACA,KAAMD,EACN,QAAS,CACP,CAACG,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,GACuB,IAC1B,MAAiB,CACf,OAAOC,EACL,IAAI,MACF,mFACF,CACF,CACF,CAEA,GAAI,CAAC,KAAK,eAAeP,CAAY,EACnC,OAAOO,EACL,IAAI,MACF,mFACF,CACF,EAGF,MAAMC,EAAc,MAAM,KAAK,mBAAmB,gBAAgB,CAChE,MAAOR,EAAa,cACpB,SAAUS,EAAS,mBACnB,aAAcV,CAChB,CAAC,EAEKW,EAAqB,CACzB,YAAaV,EAAa,cAC1B,WAAYA,EAAa,WACzB,YAAAQ,CACF,EAEA,OAAOG,EAAMD,CAAM,CACrB,CAEQ,mBACNb,EACsC,CACtC,MAAO,SAAUA,CACnB,CAEQ,eAAee,EAAmC,CACxD,OACEA,GAAO,MACP,OAAOA,GAAO,UACd,kBAAmBA,GACnBA,EAAI,eAAiB,MACrB,OAAOA,EAAI,eAAiB,UAC5B,eAAgBA,GAChBA,EAAI,YAAc,MAClB,OAAOA,EAAI,YAAc,QAE7B,CACF,EAjGalB,EAANmB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,GACzBF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAH5BxB",
|
|
6
|
+
"names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "pkiTypes", "KeyUsage", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpWeb3CheckDataSource", "config", "_certificateLoader", "context", "from", "deviceModelId", "web3CheckDto", "requestDto", "url", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "Left", "certificate", "KeyUsage", "result", "Right", "dto", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes", "pkiTypes"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DeviceModelId as
|
|
1
|
+
import{DeviceModelId as n}from"@ledgerhq/device-management-kit";import c from"axios";import{Left as u,Right as d}from"purify-ts";import{LEDGER_CLIENT_VERSION_HEADER as p,LEDGER_ORIGIN_TOKEN_HEADER as l}from"../../shared/constant/HttpHeaders";import{HttpWeb3CheckDataSource as i}from"../../web3-check/data/HttpWeb3CheckDataSource";import k from"../../../package.json";vi.mock("axios");describe("HttpWeb3CheckDataSource",()=>{const r={web3checks:{url:"web3checksUrl"},originToken:"originToken"},e={loadCertificate:vi.fn()};beforeEach(()=>{vi.resetAllMocks()}),describe("getWeb3Checks",()=>{it("should return an object if the request is successful",async()=>{const t={deviceModelId:n.FLEX,from:"from",rawTx:"rawTx",chainId:1},o={public_key_id:"partner",descriptor:"descriptor"};vi.spyOn(c,"request").mockResolvedValueOnce({data:o}),vi.spyOn(e,"loadCertificate").mockResolvedValueOnce(void 0);const a=await new i(r,e).getWeb3Checks(t);expect(a).toEqual(d({publicKeyId:"partner",descriptor:"descriptor"}))}),it("should return an object if the typed data request is successful",async()=>{const t={deviceModelId:n.FLEX,from:"from",data:"typed data"},o={public_key_id:"partner",descriptor:"descriptor"};vi.spyOn(c,"request").mockResolvedValueOnce({data:o}),vi.spyOn(e,"loadCertificate").mockResolvedValueOnce(void 0);const a=await new i(r,e).getWeb3Checks(t);expect(a).toEqual(d({publicKeyId:"partner",descriptor:"descriptor"}))}),it("should return an object with a certificate if the request is successful",async()=>{const t={deviceModelId:n.FLEX,from:"from",rawTx:"rawTx",chainId:1},o={public_key_id:"partner",descriptor:"descriptor"};vi.spyOn(c,"request").mockResolvedValueOnce({data:o}),vi.spyOn(e,"loadCertificate").mockResolvedValueOnce({keyUsageNumber:11,payload:new Uint8Array([1])});const a=await new i(r,e).getWeb3Checks(t);expect(a).toEqual(d({publicKeyId:"partner",descriptor:"descriptor",certificate:{keyUsageNumber:11,payload:new Uint8Array([1])}}))}),it("should return an error if the request fails",async()=>{const t={deviceModelId:n.FLEX,from:"from",rawTx:"rawTx",chainId:1};vi.spyOn(c,"request").mockRejectedValue(new Error("error"));const s=await new i(r,e).getWeb3Checks(t);expect(s).toEqual(u(new Error("[ContextModule] HttpWeb3CheckDataSource: Failed to fetch web3 checks informations")))}),it("should return an error if the response is invalid",async()=>{const t={deviceModelId:n.FLEX,from:"from",rawTx:"rawTx",chainId:1},o={};vi.spyOn(c,"request").mockResolvedValue({data:o}),vi.spyOn(e,"loadCertificate").mockResolvedValue(void 0);const a=await new i(r,e).getWeb3Checks(t);expect(a).toEqual(u(new Error("[ContextModule] HttpWeb3CheckDataSource: Cannot exploit Web3 checks data received")))}),it("should throw an error if origin token is not provided",()=>{expect(()=>new i({...r,originToken:void 0},e)).toThrow("Origin token is required")}),it("should call axios with the correct headers",async()=>{const t={deviceModelId:n.FLEX,from:"from",rawTx:"rawTx",chainId:1};vi.spyOn(c,"request").mockResolvedValueOnce({data:{}}),await new i(r,e).getWeb3Checks(t),expect(c.request).toHaveBeenCalledWith(expect.objectContaining({headers:{[p]:`context-module/${k.version}`,[l]:r.originToken}}))})})});
|
|
2
2
|
//# sourceMappingURL=HttpWeb3CheckDataSource.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/web3-check/data/HttpWeb3CheckDataSource.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { HttpWeb3CheckDataSource } from \"@/web3-check/data/HttpWeb3CheckDataSource\";\nimport { type Web3CheckDto } from \"@/web3-check/data/Web3CheckDto\";\nimport type { Web3CheckTypedData } from \"@/web3-check/domain/web3CheckTypes\";\nimport { type Web3CheckContext } from \"@/web3-check/domain/web3CheckTypes\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpWeb3CheckDataSource\", () => {\n const config = {\n web3checks: {\n url: \"web3checksUrl\",\n },\n } as ContextModuleConfig;\n const certificateLoaderMock = {\n loadCertificate: vi.fn(),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"getWeb3Checks\", () => {\n it(\"should return an object if the request is successful\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n const dto: Web3CheckDto = {\n public_key_id: \"partner\",\n descriptor: \"descriptor\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValueOnce(\n undefined,\n );\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Right({\n publicKeyId: \"partner\",\n descriptor: \"descriptor\",\n }),\n );\n });\n\n it(\"should return an object if the typed data request is successful\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n data: \"typed data\" as unknown as Web3CheckTypedData,\n };\n const dto: Web3CheckDto = {\n public_key_id: \"partner\",\n descriptor: \"descriptor\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValueOnce(\n undefined,\n );\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Right({\n publicKeyId: \"partner\",\n descriptor: \"descriptor\",\n }),\n );\n });\n\n it(\"should return an object with a certificate if the request is successful\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n const dto: Web3CheckDto = {\n public_key_id: \"partner\",\n descriptor: \"descriptor\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValueOnce({\n keyUsageNumber: 11,\n payload: new Uint8Array([0x01]),\n });\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Right({\n publicKeyId: \"partner\",\n descriptor: \"descriptor\",\n certificate: { keyUsageNumber: 11, payload: new Uint8Array([0x01]) },\n }),\n );\n });\n\n it(\"should return an error if the request fails\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpWeb3CheckDataSource: Failed to fetch web3 checks informations\",\n ),\n ),\n );\n });\n\n it(\"should return an error if the response is invalid\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n const dto = {};\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValue(\n undefined,\n );\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpWeb3CheckDataSource: Cannot exploit Web3 checks data received\",\n ),\n ),\n );\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAOC,MAAW,QAClB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAI5B,OAAS,2BAAAC,MAA+B,
|
|
6
|
-
"names": ["DeviceModelId", "axios", "Left", "Right", "HttpWeb3CheckDataSource", "config", "certificateLoaderMock", "params", "dto", "result"]
|
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport { HttpWeb3CheckDataSource } from \"@/web3-check/data/HttpWeb3CheckDataSource\";\nimport { type Web3CheckDto } from \"@/web3-check/data/Web3CheckDto\";\nimport type { Web3CheckTypedData } from \"@/web3-check/domain/web3CheckTypes\";\nimport { type Web3CheckContext } from \"@/web3-check/domain/web3CheckTypes\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpWeb3CheckDataSource\", () => {\n const config = {\n web3checks: {\n url: \"web3checksUrl\",\n },\n originToken: \"originToken\",\n } as ContextModuleConfig;\n const certificateLoaderMock = {\n loadCertificate: vi.fn(),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"getWeb3Checks\", () => {\n it(\"should return an object if the request is successful\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n const dto: Web3CheckDto = {\n public_key_id: \"partner\",\n descriptor: \"descriptor\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValueOnce(\n undefined,\n );\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Right({\n publicKeyId: \"partner\",\n descriptor: \"descriptor\",\n }),\n );\n });\n\n it(\"should return an object if the typed data request is successful\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n data: \"typed data\" as unknown as Web3CheckTypedData,\n };\n const dto: Web3CheckDto = {\n public_key_id: \"partner\",\n descriptor: \"descriptor\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValueOnce(\n undefined,\n );\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Right({\n publicKeyId: \"partner\",\n descriptor: \"descriptor\",\n }),\n );\n });\n\n it(\"should return an object with a certificate if the request is successful\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n const dto: Web3CheckDto = {\n public_key_id: \"partner\",\n descriptor: \"descriptor\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValueOnce({\n keyUsageNumber: 11,\n payload: new Uint8Array([0x01]),\n });\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Right({\n publicKeyId: \"partner\",\n descriptor: \"descriptor\",\n certificate: { keyUsageNumber: 11, payload: new Uint8Array([0x01]) },\n }),\n );\n });\n\n it(\"should return an error if the request fails\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpWeb3CheckDataSource: Failed to fetch web3 checks informations\",\n ),\n ),\n );\n });\n\n it(\"should return an error if the response is invalid\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n const dto = {};\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: dto });\n vi.spyOn(certificateLoaderMock, \"loadCertificate\").mockResolvedValue(\n undefined,\n );\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n const result = await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpWeb3CheckDataSource: Cannot exploit Web3 checks data received\",\n ),\n ),\n );\n });\n\n it(\"should throw an error if origin token is not provided\", () => {\n expect(\n () =>\n new HttpWeb3CheckDataSource(\n { ...config, originToken: undefined },\n certificateLoaderMock as unknown as PkiCertificateLoader,\n ),\n ).toThrow(\"Origin token is required\");\n });\n\n it(\"should call axios with the correct headers\", async () => {\n // GIVEN\n const params: Web3CheckContext = {\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: {} });\n\n // WHEN\n const dataSource = new HttpWeb3CheckDataSource(\n config,\n certificateLoaderMock as unknown as PkiCertificateLoader,\n );\n await dataSource.getWeb3Checks(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAOC,MAAW,QAClB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAI5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAS,2BAAAC,MAA+B,4CAIxC,OAAOC,MAAa,qBAEpB,GAAG,KAAK,OAAO,EAEf,SAAS,0BAA2B,IAAM,CACxC,MAAMC,EAAS,CACb,WAAY,CACV,IAAK,eACP,EACA,YAAa,aACf,EACMC,EAAwB,CAC5B,gBAAiB,GAAG,GAAG,CACzB,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,uDAAwD,SAAY,CAErE,MAAMC,EAA2B,CAC/B,cAAeV,EAAc,KAC7B,KAAM,OACN,MAAO,QACP,QAAS,CACX,EACMW,EAAoB,CACxB,cAAe,UACf,WAAY,YACd,EACA,GAAG,MAAMV,EAAO,SAAS,EAAE,sBAAsB,CAAE,KAAMU,CAAI,CAAC,EAC9D,GAAG,MAAMF,EAAuB,iBAAiB,EAAE,sBACjD,MACF,EAOA,MAAMG,EAAS,MAJI,IAAIN,EACrBE,EACAC,CACF,EACgC,cAAcC,CAAM,EAGpD,OAAOE,CAAM,EAAE,QACbT,EAAM,CACJ,YAAa,UACb,WAAY,YACd,CAAC,CACH,CACF,CAAC,EAED,GAAG,kEAAmE,SAAY,CAEhF,MAAMO,EAA2B,CAC/B,cAAeV,EAAc,KAC7B,KAAM,OACN,KAAM,YACR,EACMW,EAAoB,CACxB,cAAe,UACf,WAAY,YACd,EACA,GAAG,MAAMV,EAAO,SAAS,EAAE,sBAAsB,CAAE,KAAMU,CAAI,CAAC,EAC9D,GAAG,MAAMF,EAAuB,iBAAiB,EAAE,sBACjD,MACF,EAOA,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C,EAC1D,GAAG,MAAMF,EAAuB,iBAAiB,EAAE,kBACjD,MACF,EAOA,MAAMG,EAAS,MAJI,IAAIN,EACrBE,EACAC,CACF,EACgC,cAAcC,CAAM,EAGpD,OAAOE,CAAM,EAAE,QACbV,EACE,IAAI,MACF,mFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,OACE,IACE,IAAII,EACF,CAAE,GAAGE,EAAQ,YAAa,MAAU,EACpCC,CACF,CACJ,EAAE,QAAQ,0BAA0B,CACtC,CAAC,EAED,GAAG,6CAA8C,SAAY,CAE3D,MAAMC,EAA2B,CAC/B,cAAeV,EAAc,KAC7B,KAAM,OACN,MAAO,QACP,QAAS,CACX,EACA,GAAG,MAAMC,EAAO,SAAS,EAAE,sBAAsB,CAAE,KAAM,CAAC,CAAE,CAAC,EAO7D,MAJmB,IAAIK,EACrBE,EACAC,CACF,EACiB,cAAcC,CAAM,EAGrC,OAAOT,EAAM,OAAO,EAAE,qBACpB,OAAO,iBAAiB,CACtB,QAAS,CACP,CAACG,CAA4B,EAAG,kBAAkBG,EAAQ,OAAO,GACjE,CAACF,CAA0B,EAAGG,EAAO,WACvC,CACF,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["DeviceModelId", "axios", "Left", "Right", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "HttpWeb3CheckDataSource", "PACKAGE", "config", "certificateLoaderMock", "params", "dto", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ContainerModule as t}from"inversify";import{HttpWeb3CheckDataSource as r}from"../../web3-check/data/HttpWeb3CheckDataSource";import{DefaultWeb3CheckContextLoader as c}from"../../web3-check/domain/DefaultWeb3CheckLoader";import{web3CheckTypes as o}from"./web3CheckTypes";const
|
|
1
|
+
import{ContainerModule as t}from"inversify";import{HttpWeb3CheckDataSource as r}from"../../web3-check/data/HttpWeb3CheckDataSource";import{DefaultWeb3CheckContextLoader as c}from"../../web3-check/domain/DefaultWeb3CheckLoader";import{web3CheckTypes as o}from"./web3CheckTypes";const h=()=>new t(({bind:e})=>{e(o.Web3CheckDataSource).to(r),e(o.Web3CheckContextLoader).to(c)});export{h as web3CheckModuleFactory};
|
|
2
2
|
//# sourceMappingURL=web3CheckModuleFactory.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/web3-check/di/web3CheckModuleFactory.ts"],
|
|
4
|
-
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpWeb3CheckDataSource } from \"@/web3-check/data/HttpWeb3CheckDataSource\";\nimport { DefaultWeb3CheckContextLoader } from \"@/web3-check/domain/DefaultWeb3CheckLoader\";\n\nimport { web3CheckTypes } from \"./web3CheckTypes\";\n\nexport const web3CheckModuleFactory = () =>\n new ContainerModule((bind
|
|
5
|
-
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,2BAAAC,MAA+B,4CACxC,OAAS,iCAAAC,MAAqC,6CAE9C,OAAS,kBAAAC,MAAsB,mBAExB,MAAMC,EAAyB,IACpC,IAAIJ,EAAgB,
|
|
6
|
-
"names": ["ContainerModule", "HttpWeb3CheckDataSource", "DefaultWeb3CheckContextLoader", "web3CheckTypes", "web3CheckModuleFactory", "bind"
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpWeb3CheckDataSource } from \"@/web3-check/data/HttpWeb3CheckDataSource\";\nimport { DefaultWeb3CheckContextLoader } from \"@/web3-check/domain/DefaultWeb3CheckLoader\";\n\nimport { web3CheckTypes } from \"./web3CheckTypes\";\n\nexport const web3CheckModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(web3CheckTypes.Web3CheckDataSource).to(HttpWeb3CheckDataSource);\n bind(web3CheckTypes.Web3CheckContextLoader).to(\n DefaultWeb3CheckContextLoader,\n );\n });\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,2BAAAC,MAA+B,4CACxC,OAAS,iCAAAC,MAAqC,6CAE9C,OAAS,kBAAAC,MAAsB,mBAExB,MAAMC,EAAyB,IACpC,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKF,EAAe,mBAAmB,EAAE,GAAGF,CAAuB,EACnEI,EAAKF,EAAe,sBAAsB,EAAE,GAC1CD,CACF,CACF,CAAC",
|
|
6
|
+
"names": ["ContainerModule", "HttpWeb3CheckDataSource", "DefaultWeb3CheckContextLoader", "web3CheckTypes", "web3CheckModuleFactory", "bind"]
|
|
7
7
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { type ClearSignContext } from "./shared/model/ClearSignContext";
|
|
2
|
+
import { type SolanaTransactionContext } from "./shared/model/SolanaTransactionContext";
|
|
2
3
|
import { type TransactionContext, type TransactionFieldContext } from "./shared/model/TransactionContext";
|
|
3
4
|
import { type TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
|
|
4
5
|
import { type TypedDataContext } from "./shared/model/TypedDataContext";
|
|
6
|
+
import { type SolanaTransactionContextResult } from "./solana/domain/solanaContextTypes";
|
|
5
7
|
import { type Web3CheckContext } from "./web3-check/domain/web3CheckTypes";
|
|
6
8
|
export interface ContextModule {
|
|
7
9
|
getContext(field: TransactionFieldContext): Promise<ClearSignContext>;
|
|
8
10
|
getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;
|
|
9
11
|
getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
|
|
10
12
|
getWeb3Checks(transactionContext: Web3CheckContext): Promise<ClearSignContext | null>;
|
|
13
|
+
getSolanaContext(transactionContext: SolanaTransactionContext): Promise<SolanaTransactionContextResult>;
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=ContextModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextModule.d.ts","sourceRoot":"","sources":["../../../src/ContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtE,WAAW,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1E,mBAAmB,CACjB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,aAAa,CACX,kBAAkB,EAAE,gBAAgB,GACnC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextModule.d.ts","sourceRoot":"","sources":["../../../src/ContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtE,WAAW,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1E,mBAAmB,CACjB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,aAAa,CACX,kBAAkB,EAAE,gBAAgB,GACnC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACpC,gBAAgB,CACd,kBAAkB,EAAE,wBAAwB,GAC3C,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAC5C"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ContextModuleConstructorArgs } from "./config/model/ContextModuleBuildArgs";
|
|
2
|
+
import { type ContextModuleCalConfig, type ContextModuleConfig, type ContextModuleMetadataServiceConfig, type ContextModuleWeb3ChecksConfig } from "./config/model/ContextModuleConfig";
|
|
2
3
|
import { type ContextLoader } from "./shared/domain/ContextLoader";
|
|
4
|
+
import { type SolanaContextLoader } from "./solana/domain/SolanaContextLoader";
|
|
3
5
|
import { type TypedDataContextLoader } from "./typed-data/domain/TypedDataContextLoader";
|
|
4
6
|
import { type Web3CheckContextLoader } from "./web3-check/domain/Web3CheckContextLoader";
|
|
5
7
|
import { type ContextModule } from "./ContextModule";
|
|
6
8
|
export declare const DEFAULT_CONFIG: ContextModuleConfig;
|
|
7
9
|
export declare class ContextModuleBuilder {
|
|
8
10
|
private config;
|
|
9
|
-
|
|
11
|
+
private needOriginToken;
|
|
12
|
+
private originToken?;
|
|
13
|
+
constructor({ originToken }?: ContextModuleConstructorArgs);
|
|
10
14
|
/**
|
|
11
15
|
* Remove default loaders from the list of loaders
|
|
12
16
|
*
|
|
@@ -34,20 +38,34 @@ export declare class ContextModuleBuilder {
|
|
|
34
38
|
* @returns this
|
|
35
39
|
*/
|
|
36
40
|
addWeb3CheckLoader(loader: Web3CheckContextLoader): this;
|
|
41
|
+
/**
|
|
42
|
+
* Replace the default loader for Solana context
|
|
43
|
+
*
|
|
44
|
+
* @param loader loader to use for Solana context
|
|
45
|
+
* @returns this
|
|
46
|
+
*/
|
|
47
|
+
addSolanaLoader(loader: SolanaContextLoader): this;
|
|
37
48
|
/**
|
|
38
49
|
* Add a custom CAL configuration
|
|
39
50
|
*
|
|
40
51
|
* @param calConfig
|
|
41
52
|
* @returns this
|
|
42
53
|
*/
|
|
43
|
-
|
|
54
|
+
setCalConfig(calConfig: ContextModuleCalConfig): this;
|
|
55
|
+
/**
|
|
56
|
+
* Add a custom metadata service configuration
|
|
57
|
+
*
|
|
58
|
+
* @param metadataServiceConfig
|
|
59
|
+
* @returns this
|
|
60
|
+
*/
|
|
61
|
+
setMetadataServiceConfig(metadataServiceConfig: ContextModuleMetadataServiceConfig): this;
|
|
44
62
|
/**
|
|
45
63
|
* Add a custom web3 checks configuration
|
|
46
64
|
*
|
|
47
65
|
* @param web3ChecksConfig
|
|
48
66
|
* @returns this
|
|
49
67
|
*/
|
|
50
|
-
|
|
68
|
+
setWeb3ChecksConfig(web3ChecksConfig: ContextModuleWeb3ChecksConfig): this;
|
|
51
69
|
/**
|
|
52
70
|
* Build the context module
|
|
53
71
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextModuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/ContextModuleBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,KAAK,sBA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AkC;IAM3D;;;;;OAKG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,6BAA6B;IAKnE;;;;OAIG;IACH,KAAK,IAAI,aAAa;CAQvB"}
|
|
@@ -2,7 +2,9 @@ import type { TypedDataClearSignContext } from "./shared/model/TypedDataClearSig
|
|
|
2
2
|
import type { TypedDataContext } from "./shared/model/TypedDataContext";
|
|
3
3
|
import { type ContextModuleConfig } from "./config/model/ContextModuleConfig";
|
|
4
4
|
import { type ClearSignContext, type ClearSignContextSuccess, ClearSignContextType } from "./shared/model/ClearSignContext";
|
|
5
|
+
import { type SolanaTransactionContext } from "./shared/model/SolanaTransactionContext";
|
|
5
6
|
import { type TransactionContext, type TransactionFieldContext } from "./shared/model/TransactionContext";
|
|
7
|
+
import { type SolanaTransactionContextResult } from "./solana/domain/solanaContextTypes";
|
|
6
8
|
import { type Web3CheckContext } from "./web3-check/domain/web3CheckTypes";
|
|
7
9
|
import { type ContextModule } from "./ContextModule";
|
|
8
10
|
export declare class DefaultContextModule implements ContextModule {
|
|
@@ -10,13 +12,16 @@ export declare class DefaultContextModule implements ContextModule {
|
|
|
10
12
|
private _loaders;
|
|
11
13
|
private _typedDataLoader;
|
|
12
14
|
private _web3CheckLoader;
|
|
15
|
+
private _solanaLoader;
|
|
13
16
|
constructor(args: ContextModuleConfig);
|
|
14
17
|
private _getDefaultLoaders;
|
|
15
18
|
private _getDefaultTypedDataLoader;
|
|
16
19
|
private _getWeb3CheckLoader;
|
|
20
|
+
private _getSolanaLoader;
|
|
17
21
|
getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;
|
|
18
22
|
getContext(field: TransactionFieldContext): Promise<ClearSignContext>;
|
|
19
23
|
getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
|
|
20
24
|
getWeb3Checks(transactionContext: Web3CheckContext): Promise<ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null>;
|
|
25
|
+
getSolanaContext(transactionContext: SolanaTransactionContext): Promise<SolanaTransactionContextResult>;
|
|
21
26
|
}
|
|
22
27
|
//# sourceMappingURL=DefaultContextModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAIxE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAM9E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AAWzF,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,aAAa,CAAsB;gBAE/B,IAAI,EAAE,mBAAmB;IAWrC,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,0BAA0B;IAMlC,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,gBAAgB;IAiBX,WAAW,CACtB,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAMjB,UAAU,CACrB,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IAaf,mBAAmB,CAC9B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC;IAIxB,aAAa,CACxB,kBAAkB,EAAE,gBAAgB,GACnC,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAa9D,gBAAgB,CAC3B,kBAAkB,EAAE,wBAAwB,GAC3C,OAAO,CAAC,8BAA8B,CAAC;CAG3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configModuleFactory.d.ts","sourceRoot":"","sources":["../../../../../src/config/di/configModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAI9E,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"configModuleFactory.d.ts","sourceRoot":"","sources":["../../../../../src/config/di/configModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAI9E,eAAO,MAAM,mBAAmB,GAAI,QAAQ,mBAAmB,oBAG3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configTypes.d.ts","sourceRoot":"","sources":["../../../../../src/config/di/configTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"configTypes.d.ts","sourceRoot":"","sources":["../../../../../src/config/di/configTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;CAGvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextModuleBuildArgs.d.ts","sourceRoot":"","sources":["../../../../../src/config/model/ContextModuleBuildArgs.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ContextLoader } from "../../shared/domain/ContextLoader";
|
|
2
|
+
import { type SolanaContextLoader } from "../../solana/domain/SolanaContextLoader";
|
|
2
3
|
import { type TypedDataContextLoader } from "../../typed-data/domain/TypedDataContextLoader";
|
|
3
4
|
import { type Web3CheckContextLoader } from "../../web3-check/domain/Web3CheckContextLoader";
|
|
4
5
|
export type ContextModuleCalMode = "prod" | "test";
|
|
@@ -11,12 +12,18 @@ export type ContextModuleCalConfig = {
|
|
|
11
12
|
export type ContextModuleWeb3ChecksConfig = {
|
|
12
13
|
url: string;
|
|
13
14
|
};
|
|
15
|
+
export type ContextModuleMetadataServiceConfig = {
|
|
16
|
+
url: string;
|
|
17
|
+
};
|
|
14
18
|
export type ContextModuleConfig = {
|
|
15
19
|
cal: ContextModuleCalConfig;
|
|
16
20
|
web3checks: ContextModuleWeb3ChecksConfig;
|
|
21
|
+
metadataService: ContextModuleMetadataServiceConfig;
|
|
17
22
|
defaultLoaders: boolean;
|
|
18
23
|
customLoaders: ContextLoader[];
|
|
19
24
|
customTypedDataLoader?: TypedDataContextLoader;
|
|
20
25
|
customWeb3CheckLoader?: Web3CheckContextLoader;
|
|
26
|
+
customSolanaLoader?: SolanaContextLoader;
|
|
27
|
+
originToken?: string;
|
|
21
28
|
};
|
|
22
29
|
//# sourceMappingURL=ContextModuleConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextModuleConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/model/ContextModuleConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAA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M,CAAC;IACZ,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,EAAE,sBAAsB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,sBAAsB,CAAC;IAC5B,UAAU,EAAE,6BAA6B,CAAC;IAC1C,eAAe,EAAE,kCAAkC,CAAC;IACpD,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IAC/C,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IAC/C,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.d.ts","sourceRoot":"","sources":["../../../src/di.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"di.d.ts","sourceRoot":"","sources":["../../../src/di.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAY9E,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,iBAAiB,cAkB1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpExternalPluginDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/HttpExternalPluginDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAGhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EACL,wBAAwB,EACxB,YAAY,EACb,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"HttpExternalPluginDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/HttpExternalPluginDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAGhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EACL,wBAAwB,EACxB,YAAY,EACb,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAQ9D,qBACa,4BAA6B,YAAW,wBAAwB;IAE7C,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAGpE,YAAY,CAAC,EACjB,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;CA+DhE"}
|
|
@@ -7,7 +7,7 @@ export declare class ExternalPluginContextLoader implements ContextLoader {
|
|
|
7
7
|
private _externalPluginDataSource;
|
|
8
8
|
private _tokenDataSource;
|
|
9
9
|
constructor(externalPluginDataSource: ExternalPluginDataSource, tokenDataSource: TokenDataSource);
|
|
10
|
-
load(
|
|
10
|
+
load(ctx: TransactionContext): Promise<ClearSignContext[]>;
|
|
11
11
|
private getTokenPayload;
|
|
12
12
|
private getDecodedCallData;
|
|
13
13
|
private getAddressFromPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalPluginContextLoader.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,qBACa,2BAA4B,YAAW,aAAa;IAC/D,OAAO,CAAC,yBAAyB,CAA2B;IAC5D,OAAO,CAAC,gBAAgB,CAAkB;gBAIxC,wBAAwB,EAAE,wBAAwB,EACd,eAAe,EAAE,eAAe;IAMhE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ExternalPluginContextLoader.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,qBACa,2BAA4B,YAAW,aAAa;IAC/D,OAAO,CAAC,yBAAyB,CAA2B;IAC5D,OAAO,CAAC,gBAAgB,CAAkB;gBAIxC,wBAAwB,EAAE,wBAAwB,EACd,eAAe,EAAE,eAAe;IAMhE,IAAI,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAoFhE,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,kBAAkB;CA6B3B"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Either } from "purify-ts";
|
|
2
|
+
import { type ContextModuleConfig } from "../../config/model/ContextModuleConfig";
|
|
2
3
|
import { GetNftInformationsParams, GetSetPluginPayloadParams, NftDataSource } from "../../nft/data/NftDataSource";
|
|
3
4
|
export declare class HttpNftDataSource implements NftDataSource {
|
|
5
|
+
private readonly config;
|
|
6
|
+
constructor(config: ContextModuleConfig);
|
|
4
7
|
getSetPluginPayload({ chainId, address, selector, }: GetSetPluginPayloadParams): Promise<Either<Error, string>>;
|
|
5
8
|
getNftInfosPayload({ chainId, address, }: GetNftInformationsParams): Promise<Either<Error, string>>;
|
|
6
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpNftDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/nft/data/HttpNftDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"HttpNftDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/nft/data/HttpNftDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAOlC,qBACa,iBAAkB,YAAW,aAAa;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAG7D,mBAAmB,CAAC,EAC/B,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IA2BhD,kBAAkB,CAAC,EAC9B,OAAO,EACP,OAAO,GACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAsB7D"}
|
|
@@ -5,7 +5,7 @@ import { TransactionContext, TransactionFieldContext } from "../../shared/model/
|
|
|
5
5
|
export declare class NftContextLoader implements ContextLoader {
|
|
6
6
|
private _dataSource;
|
|
7
7
|
constructor(dataSource: NftDataSource);
|
|
8
|
-
load(
|
|
8
|
+
load(ctx: TransactionContext): Promise<ClearSignContext[]>;
|
|
9
9
|
loadField(field: TransactionFieldContext): Promise<ClearSignContext | null>;
|
|
10
10
|
private isSelectorSupported;
|
|
11
11
|
}
|