@ledgerhq/context-module 0.1.2 → 1.1.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/LICENSE.MD +202 -0
- package/README.md +125 -0
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +7 -0
- package/lib/cjs/package.json +57 -0
- package/lib/cjs/src/ContextModule.js +2 -0
- package/lib/cjs/src/ContextModule.js.map +7 -0
- package/lib/cjs/src/ContextModuleBuilder.js +2 -0
- package/lib/cjs/src/ContextModuleBuilder.js.map +7 -0
- package/lib/cjs/src/ContextModuleBuilder.test.js +2 -0
- package/lib/cjs/src/ContextModuleBuilder.test.js.map +7 -0
- package/lib/cjs/src/DefaultContextModule.js +2 -0
- package/lib/cjs/src/DefaultContextModule.js.map +7 -0
- package/lib/cjs/src/DefaultContextModule.test.js +2 -0
- package/lib/cjs/src/DefaultContextModule.test.js.map +7 -0
- package/lib/cjs/src/config/di/configModuleFactory.js +2 -0
- package/lib/cjs/src/config/di/configModuleFactory.js.map +7 -0
- package/lib/cjs/src/config/di/configTypes.js +2 -0
- package/lib/cjs/src/config/di/configTypes.js.map +7 -0
- package/lib/cjs/src/config/model/ContextModuleConfig.js +2 -0
- package/lib/cjs/src/config/model/ContextModuleConfig.js.map +7 -0
- package/lib/cjs/src/di.js +2 -0
- package/lib/cjs/src/di.js.map +7 -0
- package/lib/cjs/src/external-plugin/data/DAppDto.js +2 -0
- package/lib/cjs/src/external-plugin/data/DAppDto.js.map +7 -0
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js +2 -0
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +2 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +7 -0
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +2 -0
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -0
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.js +2 -0
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.js.map +7 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +2 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +7 -0
- package/lib/cjs/src/external-plugin/model/DappInfos.js +2 -0
- package/lib/cjs/src/external-plugin/model/DappInfos.js.map +7 -0
- package/lib/cjs/src/external-plugin/model/SelectorDetails.js +2 -0
- package/lib/cjs/src/external-plugin/model/SelectorDetails.js.map +7 -0
- package/lib/cjs/src/index.js +2 -0
- package/lib/cjs/src/index.js.map +7 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.js +2 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +7 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +2 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +7 -0
- package/lib/cjs/src/nft/data/NftDataSource.js +2 -0
- package/lib/cjs/src/nft/data/NftDataSource.js.map +7 -0
- package/lib/cjs/src/nft/di/nftModuleFactory.js +2 -0
- package/lib/cjs/src/nft/di/nftModuleFactory.js.map +7 -0
- package/lib/cjs/src/nft/di/nftTypes.js +2 -0
- package/lib/cjs/src/nft/di/nftTypes.js.map +7 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.js +2 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.js.map +7 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js +2 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +7 -0
- package/lib/cjs/src/shared/domain/ContextLoader.js +2 -0
- package/lib/cjs/src/shared/domain/ContextLoader.js.map +7 -0
- package/lib/cjs/src/shared/model/ClearSignContext.js +2 -0
- package/lib/cjs/src/shared/model/ClearSignContext.js.map +7 -0
- package/lib/cjs/src/shared/model/GenericPath.js +2 -0
- package/lib/cjs/src/shared/model/GenericPath.js.map +7 -0
- package/lib/cjs/src/shared/model/TransactionContext.js +2 -0
- package/lib/cjs/src/shared/model/TransactionContext.js.map +7 -0
- package/lib/cjs/src/shared/model/TransactionSubset.js +2 -0
- package/lib/cjs/src/shared/model/TransactionSubset.js.map +7 -0
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +2 -0
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +7 -0
- package/lib/cjs/src/shared/model/TypedDataContext.js +2 -0
- package/lib/cjs/src/shared/model/TypedDataContext.js.map +7 -0
- package/lib/cjs/src/shared/utils/HexStringUtils.js +2 -0
- package/lib/cjs/src/shared/utils/HexStringUtils.js.map +7 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.js +2 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +7 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +2 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +7 -0
- package/lib/cjs/src/token/data/TokenDataSource.js +2 -0
- package/lib/cjs/src/token/data/TokenDataSource.js.map +7 -0
- package/lib/cjs/src/token/data/TokenDto.js +2 -0
- package/lib/cjs/src/token/data/TokenDto.js.map +7 -0
- package/lib/cjs/src/token/di/tokenModuleFactory.js +2 -0
- package/lib/cjs/src/token/di/tokenModuleFactory.js.map +7 -0
- package/lib/cjs/src/token/di/tokenTypes.js +2 -0
- package/lib/cjs/src/token/di/tokenTypes.js.map +7 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.js +2 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.js.map +7 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js +2 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +7 -0
- package/lib/cjs/src/transaction/data/CalldataDto.js +2 -0
- package/lib/cjs/src/transaction/data/CalldataDto.js.map +7 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +2 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +7 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +2 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +7 -0
- package/lib/cjs/src/transaction/data/TransactionDataSource.js +2 -0
- package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +7 -0
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js +2 -0
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +7 -0
- package/lib/cjs/src/transaction/di/transactionTypes.js +2 -0
- package/lib/cjs/src/transaction/di/transactionTypes.js.map +7 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +2 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +7 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +2 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +2 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +2 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js +2 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDto.js +2 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDto.js.map +7 -0
- package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +2 -0
- package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +7 -0
- package/lib/cjs/src/trusted-name/di/trustedNameTypes.js +2 -0
- package/lib/cjs/src/trusted-name/di/trustedNameTypes.js.map +7 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +2 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +7 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +2 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +7 -0
- package/lib/cjs/src/typed-data/data/FiltersDto.js +2 -0
- package/lib/cjs/src/typed-data/data/FiltersDto.js.map +7 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +2 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +2 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +7 -0
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +2 -0
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +7 -0
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +2 -0
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +7 -0
- package/lib/cjs/src/typed-data/di/typedDataTypes.js +2 -0
- package/lib/cjs/src/typed-data/di/typedDataTypes.js.map +7 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +2 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +7 -0
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js +2 -0
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js.map +7 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/package.json +57 -0
- package/lib/esm/src/ContextModule.js +1 -0
- package/lib/esm/src/ContextModule.js.map +7 -0
- package/lib/esm/src/ContextModuleBuilder.js +2 -0
- package/lib/esm/src/ContextModuleBuilder.js.map +7 -0
- package/lib/esm/src/ContextModuleBuilder.test.js +2 -0
- package/lib/esm/src/ContextModuleBuilder.test.js.map +7 -0
- package/lib/esm/src/DefaultContextModule.js +2 -0
- package/lib/esm/src/DefaultContextModule.js.map +7 -0
- package/lib/esm/src/DefaultContextModule.test.js +2 -0
- package/lib/esm/src/DefaultContextModule.test.js.map +7 -0
- package/lib/esm/src/config/di/configModuleFactory.js +2 -0
- package/lib/esm/src/config/di/configModuleFactory.js.map +7 -0
- package/lib/esm/src/config/di/configTypes.js +2 -0
- package/lib/esm/src/config/di/configTypes.js.map +7 -0
- package/lib/esm/src/config/model/ContextModuleConfig.js +1 -0
- package/lib/esm/src/config/model/ContextModuleConfig.js.map +7 -0
- package/lib/esm/src/di.js +2 -0
- package/lib/esm/src/di.js.map +7 -0
- package/lib/esm/src/external-plugin/data/DAppDto.js +1 -0
- package/lib/esm/src/external-plugin/data/DAppDto.js.map +7 -0
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js +1 -0
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +2 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +7 -0
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +2 -0
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -0
- package/lib/esm/src/external-plugin/di/externalPluginTypes.js +2 -0
- package/lib/esm/src/external-plugin/di/externalPluginTypes.js.map +7 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +2 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +7 -0
- package/lib/esm/src/external-plugin/model/DappInfos.js +1 -0
- package/lib/esm/src/external-plugin/model/DappInfos.js.map +7 -0
- package/lib/esm/src/external-plugin/model/SelectorDetails.js +1 -0
- package/lib/esm/src/external-plugin/model/SelectorDetails.js.map +7 -0
- package/lib/esm/src/index.js +2 -0
- package/lib/esm/src/index.js.map +7 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.js +2 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.js.map +7 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js +2 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +7 -0
- package/lib/esm/src/nft/data/NftDataSource.js +1 -0
- package/lib/esm/src/nft/data/NftDataSource.js.map +7 -0
- package/lib/esm/src/nft/di/nftModuleFactory.js +2 -0
- package/lib/esm/src/nft/di/nftModuleFactory.js.map +7 -0
- package/lib/esm/src/nft/di/nftTypes.js +2 -0
- package/lib/esm/src/nft/di/nftTypes.js.map +7 -0
- package/lib/esm/src/nft/domain/NftContextLoader.js +2 -0
- package/lib/esm/src/nft/domain/NftContextLoader.js.map +7 -0
- package/lib/esm/src/nft/domain/NftContextLoader.test.js +2 -0
- package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +7 -0
- package/lib/esm/src/shared/domain/ContextLoader.js +1 -0
- package/lib/esm/src/shared/domain/ContextLoader.js.map +7 -0
- package/lib/esm/src/shared/model/ClearSignContext.js +2 -0
- package/lib/esm/src/shared/model/ClearSignContext.js.map +7 -0
- package/lib/esm/src/shared/model/GenericPath.js +2 -0
- package/lib/esm/src/shared/model/GenericPath.js.map +7 -0
- package/lib/esm/src/shared/model/TransactionContext.js +1 -0
- package/lib/esm/src/shared/model/TransactionContext.js.map +7 -0
- package/lib/esm/src/shared/model/TransactionSubset.js +1 -0
- package/lib/esm/src/shared/model/TransactionSubset.js.map +7 -0
- package/lib/esm/src/shared/model/TypedDataClearSignContext.js +2 -0
- package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +7 -0
- package/lib/esm/src/shared/model/TypedDataContext.js +1 -0
- package/lib/esm/src/shared/model/TypedDataContext.js.map +7 -0
- package/lib/esm/src/shared/utils/HexStringUtils.js +2 -0
- package/lib/esm/src/shared/utils/HexStringUtils.js.map +7 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.js +2 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.js.map +7 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js +2 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +7 -0
- package/lib/esm/src/token/data/TokenDataSource.js +1 -0
- package/lib/esm/src/token/data/TokenDataSource.js.map +7 -0
- package/lib/esm/src/token/data/TokenDto.js +1 -0
- package/lib/esm/src/token/data/TokenDto.js.map +7 -0
- package/lib/esm/src/token/di/tokenModuleFactory.js +2 -0
- package/lib/esm/src/token/di/tokenModuleFactory.js.map +7 -0
- package/lib/esm/src/token/di/tokenTypes.js +2 -0
- package/lib/esm/src/token/di/tokenTypes.js.map +7 -0
- package/lib/esm/src/token/domain/TokenContextLoader.js +2 -0
- package/lib/esm/src/token/domain/TokenContextLoader.js.map +7 -0
- package/lib/esm/src/token/domain/TokenContextLoader.test.js +2 -0
- package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +7 -0
- package/lib/esm/src/transaction/data/CalldataDto.js +1 -0
- package/lib/esm/src/transaction/data/CalldataDto.js.map +7 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +2 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +7 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +2 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +7 -0
- package/lib/esm/src/transaction/data/TransactionDataSource.js +1 -0
- package/lib/esm/src/transaction/data/TransactionDataSource.js.map +7 -0
- package/lib/esm/src/transaction/di/transactionModuleFactory.js +2 -0
- package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +7 -0
- package/lib/esm/src/transaction/di/transactionTypes.js +2 -0
- package/lib/esm/src/transaction/di/transactionTypes.js.map +7 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js +2 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +7 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +2 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +7 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +2 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +7 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +2 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +7 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDataSource.js +1 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDataSource.js.map +7 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDto.js +1 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDto.js.map +7 -0
- package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +2 -0
- package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +7 -0
- package/lib/esm/src/trusted-name/di/trustedNameTypes.js +2 -0
- package/lib/esm/src/trusted-name/di/trustedNameTypes.js.map +7 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +2 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +7 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +2 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +7 -0
- package/lib/esm/src/typed-data/data/FiltersDto.js +1 -0
- package/lib/esm/src/typed-data/data/FiltersDto.js.map +7 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +2 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +2 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +7 -0
- package/lib/esm/src/typed-data/data/TypedDataDataSource.js +1 -0
- package/lib/esm/src/typed-data/data/TypedDataDataSource.js.map +7 -0
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +2 -0
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +7 -0
- package/lib/esm/src/typed-data/di/typedDataTypes.js +2 -0
- package/lib/esm/src/typed-data/di/typedDataTypes.js.map +7 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +2 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +7 -0
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js +1 -0
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js.map +7 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/src/ContextModule.d.ts +10 -0
- package/lib/types/src/ContextModule.d.ts.map +1 -0
- package/lib/types/src/ContextModuleBuilder.d.ts +43 -0
- package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -0
- package/lib/types/src/ContextModuleBuilder.test.d.ts.map +1 -0
- package/lib/types/src/DefaultContextModule.d.ts +18 -0
- package/lib/types/src/DefaultContextModule.d.ts.map +1 -0
- package/lib/types/src/DefaultContextModule.test.d.ts.map +1 -0
- package/lib/types/src/config/di/configModuleFactory.d.ts +4 -0
- package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -0
- package/lib/types/src/config/di/configTypes.d.ts +4 -0
- package/lib/types/src/config/di/configTypes.d.ts.map +1 -0
- package/lib/types/src/config/model/ContextModuleConfig.d.ts +16 -0
- package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -0
- package/lib/types/src/di.d.ts +8 -0
- package/lib/types/src/di.d.ts.map +1 -0
- package/lib/types/src/external-plugin/data/DAppDto.d.ts.map +1 -0
- package/lib/types/src/external-plugin/data/ExternalPluginDataSource.d.ts +12 -0
- package/lib/types/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -0
- package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +10 -0
- package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -0
- package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.test.d.ts.map +1 -0
- package/lib/types/src/external-plugin/di/externalPluginModuleFactory.d.ts +3 -0
- package/lib/types/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +1 -0
- package/lib/types/src/external-plugin/di/externalPluginTypes.d.ts +5 -0
- package/lib/types/src/external-plugin/di/externalPluginTypes.d.ts.map +1 -0
- package/lib/{external-plugin → types/src/external-plugin}/domain/ExternalPluginContextLoader.d.ts +4 -3
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -0
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/external-plugin/model/DappInfos.d.ts +6 -0
- package/lib/types/src/external-plugin/model/DappInfos.d.ts.map +1 -0
- package/lib/types/src/external-plugin/model/SelectorDetails.d.ts.map +1 -0
- package/lib/{index.d.ts → types/src/index.d.ts} +8 -3
- package/lib/types/src/index.d.ts.map +1 -0
- package/lib/types/src/nft/data/HttpNftDataSource.d.ts +7 -0
- package/lib/types/src/nft/data/HttpNftDataSource.d.ts.map +1 -0
- package/lib/types/src/nft/data/HttpNftDataSource.test.d.ts.map +1 -0
- package/lib/{nft → types/src/nft}/data/NftDataSource.d.ts +3 -2
- package/lib/types/src/nft/data/NftDataSource.d.ts.map +1 -0
- package/lib/types/src/nft/di/nftModuleFactory.d.ts +3 -0
- package/lib/types/src/nft/di/nftModuleFactory.d.ts.map +1 -0
- package/lib/types/src/nft/di/nftTypes.d.ts +5 -0
- package/lib/types/src/nft/di/nftTypes.d.ts.map +1 -0
- package/lib/{nft → types/src/nft}/domain/NftContextLoader.d.ts +3 -2
- package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -0
- package/lib/types/src/nft/domain/NftContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/shared/domain/ContextLoader.d.ts +7 -0
- package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -0
- package/lib/types/src/shared/model/ClearSignContext.d.ts +40 -0
- package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -0
- package/lib/types/src/shared/model/GenericPath.d.ts +105 -0
- package/lib/types/src/shared/model/GenericPath.d.ts.map +1 -0
- package/lib/types/src/shared/model/TransactionContext.d.ts +19 -0
- package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -0
- package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -0
- package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +33 -0
- package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -0
- package/lib/types/src/shared/model/TypedDataContext.d.ts +16 -0
- package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -0
- package/lib/types/src/shared/utils/HexStringUtils.d.ts +4 -0
- package/lib/types/src/shared/utils/HexStringUtils.d.ts.map +1 -0
- package/lib/types/src/token/data/HttpTokenDataSource.d.ts +9 -0
- package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -0
- package/lib/types/src/token/data/HttpTokenDataSource.test.d.ts.map +1 -0
- package/lib/types/src/token/data/TokenDataSource.d.ts +9 -0
- package/lib/types/src/token/data/TokenDataSource.d.ts.map +1 -0
- package/lib/types/src/token/data/TokenDto.d.ts +16 -0
- package/lib/types/src/token/data/TokenDto.d.ts.map +1 -0
- package/lib/types/src/token/di/tokenModuleFactory.d.ts +3 -0
- package/lib/types/src/token/di/tokenModuleFactory.d.ts.map +1 -0
- package/lib/types/src/token/di/tokenTypes.d.ts +5 -0
- package/lib/types/src/token/di/tokenTypes.d.ts.map +1 -0
- package/lib/{token → types/src/token}/domain/TokenContextLoader.d.ts +3 -2
- package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -0
- package/lib/types/src/token/domain/TokenContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/transaction/data/CalldataDto.d.ts +117 -0
- package/lib/types/src/transaction/data/CalldataDto.d.ts.map +1 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts +19 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +2 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +1 -0
- package/lib/types/src/transaction/data/TransactionDataSource.d.ts +12 -0
- package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +1 -0
- package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +3 -0
- package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -0
- package/lib/types/src/transaction/di/transactionTypes.d.ts +5 -0
- package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +10 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +2 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts +11 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts +2 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts +16 -0
- package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts +15 -0
- package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts.map +1 -0
- package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts +3 -0
- package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -0
- package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +5 -0
- package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +12 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts +2 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/typed-data/data/FiltersDto.d.ts +58 -0
- package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -0
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts +14 -0
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -0
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +3 -0
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -0
- package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +17 -0
- package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -0
- package/lib/types/src/typed-data/di/typedDataModuleFactory.d.ts +3 -0
- package/lib/types/src/typed-data/di/typedDataModuleFactory.d.ts.map +1 -0
- package/lib/types/src/typed-data/di/typedDataTypes.d.ts +5 -0
- package/lib/types/src/typed-data/di/typedDataTypes.d.ts.map +1 -0
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +13 -0
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -0
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.test.d.ts +2 -0
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/typed-data/domain/TypedDataContextLoader.d.ts +6 -0
- package/lib/types/src/typed-data/domain/TypedDataContextLoader.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -0
- package/package.json +44 -20
- package/LICENSE.txt +0 -21
- package/lib/ContextModule.d.ts +0 -6
- package/lib/ContextModule.d.ts.map +0 -1
- package/lib/ContextModule.js +0 -3
- package/lib/ContextModule.js.map +0 -1
- package/lib/ContextModuleBuilder.d.ts +0 -27
- package/lib/ContextModuleBuilder.d.ts.map +0 -1
- package/lib/ContextModuleBuilder.js +0 -54
- package/lib/ContextModuleBuilder.js.map +0 -1
- package/lib/ContextModuleBuilder.test.d.ts.map +0 -1
- package/lib/ContextModuleBuilder.test.js +0 -18
- package/lib/ContextModuleBuilder.test.js.map +0 -1
- package/lib/DefaultContextModule.d.ts +0 -14
- package/lib/DefaultContextModule.d.ts.map +0 -1
- package/lib/DefaultContextModule.js +0 -26
- package/lib/DefaultContextModule.js.map +0 -1
- package/lib/DefaultContextModule.test.d.ts.map +0 -1
- package/lib/DefaultContextModule.test.js +0 -55
- package/lib/DefaultContextModule.test.js.map +0 -1
- package/lib/external-plugin/__tests__/abi.json +0 -92
- package/lib/external-plugin/data/DAppDto.d.ts.map +0 -1
- package/lib/external-plugin/data/DAppDto.js +0 -3
- package/lib/external-plugin/data/DAppDto.js.map +0 -1
- package/lib/external-plugin/data/ExternalPluginDataSource.d.ts +0 -10
- package/lib/external-plugin/data/ExternalPluginDataSource.d.ts.map +0 -1
- package/lib/external-plugin/data/ExternalPluginDataSource.js +0 -3
- package/lib/external-plugin/data/ExternalPluginDataSource.js.map +0 -1
- package/lib/external-plugin/data/HttpExternalPluginDataSource.d.ts +0 -7
- package/lib/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +0 -1
- package/lib/external-plugin/data/HttpExternalPluginDataSource.js +0 -55
- package/lib/external-plugin/data/HttpExternalPluginDataSource.js.map +0 -1
- package/lib/external-plugin/data/HttpExternalPluginDataSource.test.d.ts.map +0 -1
- package/lib/external-plugin/data/HttpExternalPluginDataSource.test.js +0 -268
- package/lib/external-plugin/data/HttpExternalPluginDataSource.test.js.map +0 -1
- package/lib/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +0 -1
- package/lib/external-plugin/domain/ExternalPluginContextLoader.js +0 -96
- package/lib/external-plugin/domain/ExternalPluginContextLoader.js.map +0 -1
- package/lib/external-plugin/domain/ExternalPluginContextLoader.test.d.ts.map +0 -1
- package/lib/external-plugin/domain/ExternalPluginContextLoader.test.js +0 -344
- package/lib/external-plugin/domain/ExternalPluginContextLoader.test.js.map +0 -1
- package/lib/external-plugin/model/DappInfos.d.ts +0 -6
- package/lib/external-plugin/model/DappInfos.d.ts.map +0 -1
- package/lib/external-plugin/model/DappInfos.js +0 -3
- package/lib/external-plugin/model/DappInfos.js.map +0 -1
- package/lib/external-plugin/model/SelectorDetails.d.ts.map +0 -1
- package/lib/external-plugin/model/SelectorDetails.js +0 -3
- package/lib/external-plugin/model/SelectorDetails.js.map +0 -1
- package/lib/forward-domain/data/ForwardDomainDataSource.d.ts +0 -8
- package/lib/forward-domain/data/ForwardDomainDataSource.d.ts.map +0 -1
- package/lib/forward-domain/data/ForwardDomainDataSource.js +0 -3
- package/lib/forward-domain/data/ForwardDomainDataSource.js.map +0 -1
- package/lib/forward-domain/data/HttpForwardDomainDataSource.d.ts +0 -5
- package/lib/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +0 -1
- package/lib/forward-domain/data/HttpForwardDomainDataSource.js +0 -36
- package/lib/forward-domain/data/HttpForwardDomainDataSource.js.map +0 -1
- package/lib/forward-domain/data/HttpForwardDomainDataSource.test.d.ts +0 -2
- package/lib/forward-domain/data/HttpForwardDomainDataSource.test.d.ts.map +0 -1
- package/lib/forward-domain/data/HttpForwardDomainDataSource.test.js +0 -53
- package/lib/forward-domain/data/HttpForwardDomainDataSource.test.js.map +0 -1
- package/lib/forward-domain/domain/ForwardDomainContextLoader.d.ts +0 -11
- package/lib/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +0 -1
- package/lib/forward-domain/domain/ForwardDomainContextLoader.js +0 -54
- package/lib/forward-domain/domain/ForwardDomainContextLoader.js.map +0 -1
- package/lib/forward-domain/domain/ForwardDomainContextLoader.test.d.ts +0 -2
- package/lib/forward-domain/domain/ForwardDomainContextLoader.test.d.ts.map +0 -1
- package/lib/forward-domain/domain/ForwardDomainContextLoader.test.js +0 -83
- package/lib/forward-domain/domain/ForwardDomainContextLoader.test.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -27
- package/lib/index.js.map +0 -1
- package/lib/nft/data/HttpNftDataSource.d.ts +0 -6
- package/lib/nft/data/HttpNftDataSource.d.ts.map +0 -1
- package/lib/nft/data/HttpNftDataSource.js +0 -51
- package/lib/nft/data/HttpNftDataSource.js.map +0 -1
- package/lib/nft/data/HttpNftDataSource.test.d.ts.map +0 -1
- package/lib/nft/data/HttpNftDataSource.test.js +0 -62
- package/lib/nft/data/HttpNftDataSource.test.js.map +0 -1
- package/lib/nft/data/NftDataSource.d.ts.map +0 -1
- package/lib/nft/data/NftDataSource.js +0 -3
- package/lib/nft/data/NftDataSource.js.map +0 -1
- package/lib/nft/domain/NftContextLoader.d.ts.map +0 -1
- package/lib/nft/domain/NftContextLoader.js +0 -79
- package/lib/nft/domain/NftContextLoader.js.map +0 -1
- package/lib/nft/domain/NftContextLoader.test.d.ts.map +0 -1
- package/lib/nft/domain/NftContextLoader.test.js +0 -106
- package/lib/nft/domain/NftContextLoader.test.js.map +0 -1
- package/lib/shared/domain/ContextLoader.d.ts +0 -6
- package/lib/shared/domain/ContextLoader.d.ts.map +0 -1
- package/lib/shared/domain/ContextLoader.js +0 -3
- package/lib/shared/domain/ContextLoader.js.map +0 -1
- package/lib/shared/model/ClearSignContext.d.ts +0 -11
- package/lib/shared/model/ClearSignContext.d.ts.map +0 -1
- package/lib/shared/model/ClearSignContext.js +0 -3
- package/lib/shared/model/ClearSignContext.js.map +0 -1
- package/lib/shared/model/TransactionContext.d.ts +0 -6
- package/lib/shared/model/TransactionContext.d.ts.map +0 -1
- package/lib/shared/model/TransactionContext.js +0 -3
- package/lib/shared/model/TransactionContext.js.map +0 -1
- package/lib/shared/model/TransactionSubset.d.ts.map +0 -1
- package/lib/shared/model/TransactionSubset.js +0 -3
- package/lib/shared/model/TransactionSubset.js.map +0 -1
- package/lib/token/data/HttpTokenDataSource.d.ts +0 -5
- package/lib/token/data/HttpTokenDataSource.d.ts.map +0 -1
- package/lib/token/data/HttpTokenDataSource.js +0 -68
- package/lib/token/data/HttpTokenDataSource.js.map +0 -1
- package/lib/token/data/HttpTokenDataSource.test.d.ts.map +0 -1
- package/lib/token/data/HttpTokenDataSource.test.js +0 -87
- package/lib/token/data/HttpTokenDataSource.test.js.map +0 -1
- package/lib/token/data/TokenDataSource.d.ts +0 -8
- package/lib/token/data/TokenDataSource.d.ts.map +0 -1
- package/lib/token/data/TokenDataSource.js +0 -3
- package/lib/token/data/TokenDataSource.js.map +0 -1
- package/lib/token/data/TokenDto.d.ts +0 -6
- package/lib/token/data/TokenDto.d.ts.map +0 -1
- package/lib/token/data/TokenDto.js +0 -3
- package/lib/token/data/TokenDto.js.map +0 -1
- package/lib/token/domain/TokenContextLoader.d.ts.map +0 -1
- package/lib/token/domain/TokenContextLoader.js +0 -52
- package/lib/token/domain/TokenContextLoader.js.map +0 -1
- package/lib/token/domain/TokenContextLoader.test.d.ts.map +0 -1
- package/lib/token/domain/TokenContextLoader.test.js +0 -96
- package/lib/token/domain/TokenContextLoader.test.js.map +0 -1
- /package/lib/{ContextModuleBuilder.test.d.ts → types/src/ContextModuleBuilder.test.d.ts} +0 -0
- /package/lib/{DefaultContextModule.test.d.ts → types/src/DefaultContextModule.test.d.ts} +0 -0
- /package/lib/{external-plugin → types/src/external-plugin}/data/DAppDto.d.ts +0 -0
- /package/lib/{external-plugin → types/src/external-plugin}/data/HttpExternalPluginDataSource.test.d.ts +0 -0
- /package/lib/{external-plugin → types/src/external-plugin}/domain/ExternalPluginContextLoader.test.d.ts +0 -0
- /package/lib/{external-plugin → types/src/external-plugin}/model/SelectorDetails.d.ts +0 -0
- /package/lib/{nft → types/src/nft}/data/HttpNftDataSource.test.d.ts +0 -0
- /package/lib/{nft → types/src/nft}/domain/NftContextLoader.test.d.ts +0 -0
- /package/lib/{shared → types/src/shared}/model/TransactionSubset.d.ts +0 -0
- /package/lib/{token → types/src/token}/data/HttpTokenDataSource.test.d.ts +0 -0
- /package/lib/{token → types/src/token}/domain/TokenContextLoader.test.d.ts +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/typed-data/data/HttpTypedDataDataSource.test.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpTypedDataDataSource } from \"@/typed-data/data/HttpTypedDataDataSource\";\nimport { type TypedDataDataSource } from \"@/typed-data/data/TypedDataDataSource\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type FiltersDto, type InstructionField } from \"./FiltersDto\";\n\njest.mock(\"axios\");\n\nexport const buildDescriptor = (\n instructions: InstructionField[],\n): FiltersDto[] => [\n {\n descriptors_eip712: {\n \"0x000000000022d473030f116ddee9f6b43ac78ba3\": {\n \"4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3\": {\n schema: {\n DutchOutput: [\n {\n name: \"token\",\n type: \"address\",\n },\n {\n name: \"startAmount\",\n type: \"uint256\",\n },\n {\n name: \"endAmount\",\n type: \"uint256\",\n },\n {\n name: \"recipient\",\n type: \"address\",\n },\n ],\n EIP712Domain: [\n {\n name: \"name\",\n type: \"string\",\n },\n {\n name: \"chainId\",\n type: \"uint256\",\n },\n {\n name: \"verifyingContract\",\n type: \"address\",\n },\n ],\n ExclusiveDutchOrder: [\n {\n name: \"info\",\n type: \"OrderInfo\",\n },\n {\n name: \"decayStartTime\",\n type: \"uint256\",\n },\n {\n name: \"decayEndTime\",\n type: \"uint256\",\n },\n {\n name: \"exclusiveFiller\",\n type: \"address\",\n },\n {\n name: \"exclusivityOverrideBps\",\n type: \"uint256\",\n },\n {\n name: \"inputToken\",\n type: \"address\",\n },\n {\n name: \"inputStartAmount\",\n type: \"uint256\",\n },\n {\n name: \"inputEndAmount\",\n type: \"uint256\",\n },\n {\n name: \"outputs\",\n type: \"DutchOutput[]\",\n },\n ],\n OrderInfo: [\n {\n name: \"reactor\",\n type: \"address\",\n },\n {\n name: \"swapper\",\n type: \"address\",\n },\n {\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n name: \"deadline\",\n type: \"uint256\",\n },\n {\n name: \"additionalValidationContract\",\n type: \"address\",\n },\n {\n name: \"additionalValidationData\",\n type: \"bytes\",\n },\n ],\n PermitWitnessTransferFrom: [\n {\n name: \"permitted\",\n type: \"TokenPermissions\",\n },\n {\n name: \"spender\",\n type: \"address\",\n },\n {\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n name: \"deadline\",\n type: \"uint256\",\n },\n {\n name: \"witness\",\n type: \"ExclusiveDutchOrder\",\n },\n ],\n TokenPermissions: [\n {\n name: \"token\",\n type: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n },\n instructions,\n },\n },\n },\n },\n];\n\ndescribe(\"HttpTypedDataDataSource\", () => {\n let datasource: TypedDataDataSource;\n\n const TEST_TYPES = {\n PermitSingle: [\n {\n name: \"details\",\n type: \"PermitDetails\",\n },\n {\n name: \"spender\",\n type: \"address\",\n },\n {\n name: \"sigDeadline\",\n type: \"uint256\",\n },\n ],\n PermitDetails: [\n {\n type: \"address\",\n name: \"token\",\n },\n {\n name: \"amount\",\n type: \"uint160\",\n },\n {\n name: \"expiration\",\n type: \"uint48\",\n },\n {\n name: \"nonce\",\n type: \"uint48\",\n },\n ],\n EIP712Domain: [\n {\n name: \"name\",\n type: \"string\",\n },\n {\n name: \"chainId\",\n type: \"uint256\",\n },\n {\n name: \"verifyingContract\",\n type: \"address\",\n },\n ],\n };\n\n beforeAll(() => {\n const config = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n },\n } as ContextModuleConfig;\n datasource = new HttpTypedDataDataSource(config);\n jest.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = jest.fn(() => Promise.resolve({ data: [] }));\n jest.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x00\",\n version: \"v2\",\n schema: {},\n });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: { \"X-Ledger-Client-Version\": version },\n }),\n );\n });\n\n it(\"should return V2 filters when axios response is correct\", async () => {\n // GIVEN\n const filtersDTO = buildDescriptor([\n {\n display_name: \"Permit2\",\n field_mappers_count: 4,\n descriptor:\n \"b7000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3045065726d697432\",\n signatures: {\n prod: \"304402201675b7d8507b40de5136c386815afdad8012cb8e3f0e0a126c758d6fbb3f6b0f0220595cbfeeab7591d0eebe40f0e4ea8ea53beeaf89ee50b7faf97f97bdf36abbce\",\n },\n type: \"message\",\n },\n {\n display_name: \"Amount allowance\",\n format: \"token\",\n field_path: \"details.token\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e746f6b656e416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n type: \"field\",\n },\n {\n display_name: \"Amount allowance\",\n format: \"amount\",\n field_path: \"details.amount\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e616d6f756e74416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30450221008f9e2f33b35872e63b2024a6d4938525c6e72364604da2d5e21b3d7fa44cac8a02207d4fe42c9d3994a322dae99adc2c56157435c177c51831103fdaf3cef12bb19f\",\n },\n type: \"field\",\n },\n {\n display_name: \"Approve to spender\",\n format: \"raw\",\n field_path: \"spender\",\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df37370656e646572417070726f766520746f207370656e646572\",\n signatures: {\n prod: \"3045022100dddb92141e3b3f21dafb60c8d5093e28b25a8dc4f926ed501b6d2021203f68bc02201abca405540e72b5b70120a428967b776edb8a88ebd9b1d7aa320c3df602027f\",\n },\n type: \"field\",\n },\n {\n display_name: \"Approval expire\",\n format: \"datetime\",\n field_path: \"details.expiration\",\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e65787069726174696f6e417070726f76616c20657870697265\",\n signatures: {\n prod: \"3044022060a11c1b15d07e7172e2e68a4e4aa5cbd3b5af900907634b1bce58000eab9fb502201e40963d9e2b00948ce16d3817756329e11a81e8b14b762adff68db4b3a4b8ff\",\n },\n type: \"field\",\n },\n ]);\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022D473030F116DDEE9F6B43AC78BA3\",\n version: \"v2\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result).toEqual(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 4,\n signature:\n \"304402201675b7d8507b40de5136c386815afdad8012cb8e3f0e0a126c758d6fbb3f6b0f0220595cbfeeab7591d0eebe40f0e4ea8ea53beeaf89ee50b7faf97f97bdf36abbce\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token\",\n tokenIndex: 0,\n signature:\n \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n {\n type: \"amount\",\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n tokenIndex: 0,\n signature:\n \"30450221008f9e2f33b35872e63b2024a6d4938525c6e72364604da2d5e21b3d7fa44cac8a02207d4fe42c9d3994a322dae99adc2c56157435c177c51831103fdaf3cef12bb19f\",\n },\n {\n type: \"raw\",\n displayName: \"Approve to spender\",\n path: \"spender\",\n signature:\n \"3045022100dddb92141e3b3f21dafb60c8d5093e28b25a8dc4f926ed501b6d2021203f68bc02201abca405540e72b5b70120a428967b776edb8a88ebd9b1d7aa320c3df602027f\",\n },\n {\n type: \"datetime\",\n displayName: \"Approval expire\",\n path: \"details.expiration\",\n signature:\n \"3044022060a11c1b15d07e7172e2e68a4e4aa5cbd3b5af900907634b1bce58000eab9fb502201e40963d9e2b00948ce16d3817756329e11a81e8b14b762adff68db4b3a4b8ff\",\n },\n ],\n }),\n );\n });\n\n it(\"should return V1 filters when axios response is correct\", async () => {\n // GIVEN\n const filtersDTO = buildDescriptor([\n {\n display_name: \"Permit2\",\n field_mappers_count: 4,\n descriptor:\n \"b7000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3045065726d697432\",\n signatures: {\n prod: \"304402201675b7d8507b40de5136c386815afdad8012cb8e3f0e0a126c758d6fbb3f6b0f0220595cbfeeab7591d0eebe40f0e4ea8ea53beeaf89ee50b7faf97f97bdf36abbce\",\n },\n type: \"message\",\n },\n {\n display_name: \"Amount allowance\",\n format: \"token\",\n field_path: \"details.token\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e746f6b656e416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n type: \"field\",\n },\n {\n display_name: \"Amount allowance\",\n format: \"amount\",\n field_path: \"details.amount\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e616d6f756e74416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30450221008f9e2f33b35872e63b2024a6d4938525c6e72364604da2d5e21b3d7fa44cac8a02207d4fe42c9d3994a322dae99adc2c56157435c177c51831103fdaf3cef12bb19f\",\n },\n type: \"field\",\n },\n {\n display_name: \"Approve to spender\",\n format: \"raw\",\n field_path: \"spender\",\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df37370656e646572417070726f766520746f207370656e646572\",\n signatures: {\n prod: \"3045022100dddb92141e3b3f21dafb60c8d5093e28b25a8dc4f926ed501b6d2021203f68bc02201abca405540e72b5b70120a428967b776edb8a88ebd9b1d7aa320c3df602027f\",\n },\n type: \"field\",\n },\n {\n display_name: \"Approval expire\",\n format: \"datetime\",\n field_path: \"details.expiration\",\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e65787069726174696f6e417070726f76616c20657870697265\",\n signatures: {\n prod: \"3044022060a11c1b15d07e7172e2e68a4e4aa5cbd3b5af900907634b1bce58000eab9fb502201e40963d9e2b00948ce16d3817756329e11a81e8b14b762adff68db4b3a4b8ff\",\n },\n type: \"field\",\n },\n ]);\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result).toEqual(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 4,\n signature:\n \"304402201675b7d8507b40de5136c386815afdad8012cb8e3f0e0a126c758d6fbb3f6b0f0220595cbfeeab7591d0eebe40f0e4ea8ea53beeaf89ee50b7faf97f97bdf36abbce\",\n },\n filters: [\n {\n type: \"raw\",\n displayName: \"Amount allowance\",\n path: \"details.token\",\n signature:\n \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n {\n type: \"raw\",\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n signature:\n \"30450221008f9e2f33b35872e63b2024a6d4938525c6e72364604da2d5e21b3d7fa44cac8a02207d4fe42c9d3994a322dae99adc2c56157435c177c51831103fdaf3cef12bb19f\",\n },\n {\n type: \"raw\",\n displayName: \"Approve to spender\",\n path: \"spender\",\n signature:\n \"3045022100dddb92141e3b3f21dafb60c8d5093e28b25a8dc4f926ed501b6d2021203f68bc02201abca405540e72b5b70120a428967b776edb8a88ebd9b1d7aa320c3df602027f\",\n },\n {\n type: \"raw\",\n displayName: \"Approval expire\",\n path: \"details.expiration\",\n signature:\n \"3044022060a11c1b15d07e7172e2e68a4e4aa5cbd3b5af900907634b1bce58000eab9fb502201e40963d9e2b00948ce16d3817756329e11a81e8b14b762adff68db4b3a4b8ff\",\n },\n ],\n }),\n );\n });\n\n it(\"should return an error when data is empty\", async () => {\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: undefined });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no typed data filters for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error when schema is not found\", async () => {\n const filtersDTO = buildDescriptor([]);\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error when schema is undefined\", async () => {\n const filtersDTO = buildDescriptor(\n undefined as unknown as InstructionField[],\n );\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error if no message info is found\", async () => {\n const filtersDTO = buildDescriptor([\n {\n display_name: \"Amount allowance\",\n format: \"token\",\n field_path: \"details.token\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e746f6b656e416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n type: \"field\",\n },\n ]);\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error if message info display name is missing\", async () => {\n const filtersDTO = buildDescriptor([\n {\n // display_name: \"Permit2\",\n field_mappers_count: 4,\n descriptor:\n \"b7000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3045065726d697432\",\n signatures: {\n prod: \"304402201675b7d8507b40de5136c386815afdad8012cb8e3f0e0a126c758d6fbb3f6b0f0220595cbfeeab7591d0eebe40f0e4ea8ea53beeaf89ee50b7faf97f97bdf36abbce\",\n },\n type: \"message\",\n } as InstructionField,\n ]);\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error if field path is invalid\", async () => {\n const filtersDTO = buildDescriptor([\n {\n display_name: \"Amount allowance\",\n format: \"token\",\n // field_path: \"details.token\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e746f6b656e416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n type: \"field\",\n } as InstructionField,\n ]);\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error if field display_name is invalid\", async () => {\n const filtersDTO = buildDescriptor([\n {\n // display_name: \"Amount allowance\",\n format: \"token\",\n field_path: \"details.token\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e746f6b656e416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n type: \"field\",\n } as InstructionField,\n ]);\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error if field signatures.prod is missing\", async () => {\n const filtersDTO = buildDescriptor([\n {\n display_name: \"Amount allowance\",\n format: \"token\",\n field_path: \"details.token\",\n coin_ref: 0,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e746f6b656e416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n test: \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n type: \"field\",\n } as InstructionField,\n ]);\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error on token fileds with coin ref to null\", async () => {\n const filtersDTO = buildDescriptor([\n {\n display_name: \"Amount allowance\",\n format: \"token\",\n field_path: \"details.token\",\n coin_ref: null,\n descriptor:\n \"48000000000000a4b1000000000022d473030f116ddee9f6b43ac78ba34d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df364657461696c732e746f6b656e416d6f756e7420616c6c6f77616e6365\",\n signatures: {\n prod: \"30440220238723d4ddd47baf829d547802a2017476bf68e03d0b920fd46aa543de81d5b902206123218eae82c5f898454c45262e5b0b839dc9d84b2b0926fe14e8218b5b0d53\",\n },\n type: \"field\",\n } as unknown as InstructionField,\n ]);\n // GIVEN\n jest.spyOn(axios, \"request\").mockResolvedValue({ data: filtersDTO });\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v2\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address 0x000000000022d473030f116ddee9f6b43ac78ba3 on chain 1 for schema 4d593149e876e739220f3b5ede1b38a0213d76c4705b1547c4323df3`,\n ),\n );\n });\n\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n jest.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getTypedDataFilters({\n chainId: 1,\n address: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n version: \"v1\",\n schema: TEST_TYPES,\n });\n\n // THEN\n expect(result.isLeft()).toEqual(true);\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAW,QAClB,OAAS,SAAAC,MAAa,YAGtB,OAAS,2BAAAC,MAA+B,4CAExC,OAAOC,MAAa,qBAIpB,KAAK,KAAK,OAAO,EAEV,MAAMC,EACXC,GACiB,CACjB,CACE,mBAAoB,CAClB,6CAA8C,CAC5C,2DAA4D,CAC1D,OAAQ,CACN,YAAa,CACX,CACE,KAAM,QACN,KAAM,SACR,EACA,CACE,KAAM,cACN,KAAM,SACR,EACA,CACE,KAAM,YACN,KAAM,SACR,EACA,CACE,KAAM,YACN,KAAM,SACR,CACF,EACA,aAAc,CACZ,CACE,KAAM,OACN,KAAM,QACR,EACA,CACE,KAAM,UACN,KAAM,SACR,EACA,CACE,KAAM,oBACN,KAAM,SACR,CACF,EACA,oBAAqB,CACnB,CACE,KAAM,OACN,KAAM,WACR,EACA,CACE,KAAM,iBACN,KAAM,SACR,EACA,CACE,KAAM,eACN,KAAM,SACR,EACA,CACE,KAAM,kBACN,KAAM,SACR,EACA,CACE,KAAM,yBACN,KAAM,SACR,EACA,CACE,KAAM,aACN,KAAM,SACR,EACA,CACE,KAAM,mBACN,KAAM,SACR,EACA,CACE,KAAM,iBACN,KAAM,SACR,EACA,CACE,KAAM,UACN,KAAM,eACR,CACF,EACA,UAAW,CACT,CACE,KAAM,UACN,KAAM,SACR,EACA,CACE,KAAM,UACN,KAAM,SACR,EACA,CACE,KAAM,QACN,KAAM,SACR,EACA,CACE,KAAM,WACN,KAAM,SACR,EACA,CACE,KAAM,+BACN,KAAM,SACR,EACA,CACE,KAAM,2BACN,KAAM,OACR,CACF,EACA,0BAA2B,CACzB,CACE,KAAM,YACN,KAAM,kBACR,EACA,CACE,KAAM,UACN,KAAM,SACR,EACA,CACE,KAAM,QACN,KAAM,SACR,EACA,CACE,KAAM,WACN,KAAM,SACR,EACA,CACE,KAAM,UACN,KAAM,qBACR,CACF,EACA,iBAAkB,CAChB,CACE,KAAM,QACN,KAAM,SACR,EACA,CACE,KAAM,SACN,KAAM,SACR,CACF,CACF,EACA,aAAAA,CACF,CACF,CACF,CACF,CACF,EAEA,SAAS,0BAA2B,IAAM,CACxC,IAAIC,EAEJ,MAAMC,EAAa,CACjB,aAAc,CACZ,CACE,K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,EACA,KAAM,OACR,EACA,CACE,aAAc,qBACd,OAAQ,MACR,WAAY,UACZ,WACE,uKACF,WAAY,CACV,KAAM,gJACR,EACA,KAAM,OACR,EACA,CACE,aAAc,kBACd,OAAQ,WACR,WAAY,qBACZ,WACE,uLACF,WAAY,CACV,KAAM,8IACR,EACA,KAAM,OACR,CACF,CAAC,EACD,KAAK,MAAMJ,EAAO,SAAS,EAAE,kBAAkB,CAAE,KAAMW,CAAW,CAAC,EAGnE,MAAMC,EAAS,MAAMN,EAAW,oBAAoB,CAClD,QAAS,EACT,QAAS,6CACT,QAAS,KACT,OAAQC,CACV,CAAC,EAGD,OAAOK,CAAM,EAAE,QACbX,EAAM,CACJ,YAAa,CACX,YAAa,UACb,aAAc,EACd,UACE,8IACJ,EACA,QAAS,CACP,CACE,KAAM,QACN,YAAa,mBACb,KAAM,gBACN,WAAY,EACZ,UACE,8IACJ,EACA,CACE,KAAM,SACN,YAAa,mBACb,KAAM,iBACN,WAAY,EACZ,UACE,gJACJ,EACA,CACE,KAAM,MACN,YAAa,qBACb,KAAM,UACN,UACE,gJACJ,EACA,CACE,KAAM,WACN,YAAa,kBACb,KAAM,qBACN,UACE,8IACJ,CACF,CACF,CAAC,CACH,CACF,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMU,EAAaP,EAAgB,CACjC,CACE,aAAc,UACd,oBAAqB,EACrB,WACE,qIACF,WAAY,CACV,KAAM,8IACR,EACA,KAAM,SACR,EACA,CACE,aAAc,mBACd,OAAQ,QACR,WAAY,gBACZ,SAAU,EACV,WACE,+KACF,WAAY,CACV,KAAM,8IACR,EACA,KAAM,OACR,EACA,CACE,aAAc,mBACd,OAAQ,SACR,WAAY,iBACZ,SAAU,EACV,WACE,iLACF,WAAY,CACV,KAAM,gJACR,EACA,KAAM,OACR,EACA,CACE,aAAc,qBACd,OAAQ,MACR,WAAY,UACZ,WACE,uKACF,WAAY,CACV,KAAM,gJACR,EACA,KAAM,OACR,EACA,CACE,aAAc,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E,kBAAkB,CAAE,KAAMW,CAAW,CAAC,EAGnE,MAAMC,EAAS,MAAMN,EAAW,oBAAoB,CAClD,QAAS,EACT,QAAS,6CACT,QAAS,KACT,OAAQC,CACV,CAAC,EAGD,OAAOK,EAAO,OAAO,CAAC,EAAE,QAAQ,EAAI,EACpC,OAAOA,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,yMACF,CACF,CACF,CAAC,EAED,GAAG,+DAAgE,SAAY,CAC7E,MAAMD,EAAaP,EAAgB,CACjC,CACE,aAAc,mBACd,OAAQ,QACR,WAAY,gBACZ,SAAU,KACV,WACE,+KACF,WAAY,CACV,KAAM,8IACR,EACA,KAAM,OACR,CACF,CAAC,EAED,KAAK,MAAMJ,EAAO,SAAS,EAAE,kBAAkB,CAAE,KAAMW,CAAW,CAAC,EAGnE,MAAMC,EAAS,MAAMN,EAAW,oBAAoB,CAClD,QAAS,EACT,QAAS,6CACT,QAAS,KACT,OAAQC,CACV,CAAC,EAGD,OAAOK,EAAO,OAAO,CAAC,EAAE,QAAQ,EAAI,EACpC,OAAOA,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,yMACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,KAAK,MAAMZ,EAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,OAAO,CAAC,EAGjE,MAAMY,EAAS,MAAMN,EAAW,oBAAoB,CAClD,QAAS,EACT,QAAS,6CACT,QAAS,KACT,OAAQC,CACV,CAAC,EAGD,OAAOK,EAAO,OAAO,CAAC,EAAE,QAAQ,EAAI,CACtC,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["axios", "Right", "HttpTypedDataDataSource", "PACKAGE", "buildDescriptor", "instructions", "datasource", "TEST_TYPES", "config", "version", "requestSpy", "filtersDTO", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=TypedDataDataSource.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ContainerModule as a}from"inversify";import{HttpTypedDataDataSource as e}from"../../typed-data/data/HttpTypedDataDataSource";import{typedDataTypes as o}from"../../typed-data/di/typedDataTypes";import{DefaultTypedDataContextLoader as r}from"../../typed-data/domain/DefaultTypedDataContextLoader";const u=()=>new a((t,p,d,n)=>{t(o.TypedDataDataSource).to(e),t(o.TypedDataContextLoader).to(r)});export{u as typedDataModuleFactory};
|
|
2
|
+
//# sourceMappingURL=typedDataModuleFactory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/typed-data/di/typedDataModuleFactory.ts"],
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTypedDataDataSource } from \"@/typed-data/data/HttpTypedDataDataSource\";\nimport { typedDataTypes } from \"@/typed-data/di/typedDataTypes\";\nimport { DefaultTypedDataContextLoader } from \"@/typed-data/domain/DefaultTypedDataContextLoader\";\n\nexport const typedDataModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(typedDataTypes.TypedDataDataSource).to(HttpTypedDataDataSource);\n bind(typedDataTypes.TypedDataContextLoader).to(\n DefaultTypedDataContextLoader,\n );\n });\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,2BAAAC,MAA+B,4CACxC,OAAS,kBAAAC,MAAsB,iCAC/B,OAAS,iCAAAC,MAAqC,oDAEvC,MAAMC,EAAyB,IACpC,IAAIJ,EAAgB,CAACK,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAKH,EAAe,mBAAmB,EAAE,GAAGD,CAAuB,EACnEI,EAAKH,EAAe,sBAAsB,EAAE,GAC1CC,CACF,CACF,CAAC",
|
|
6
|
+
"names": ["ContainerModule", "HttpTypedDataDataSource", "typedDataTypes", "DefaultTypedDataContextLoader", "typedDataModuleFactory", "bind", "_unbind", "_isBound", "_rebind"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/typed-data/di/typedDataTypes.ts"],
|
|
4
|
+
"sourcesContent": ["export const typedDataTypes = {\n TypedDataDataSource: Symbol.for(\"TypedDataDataSource\"),\n TypedDataContextLoader: Symbol.for(\"TypedDataContextLoader\"),\n};\n"],
|
|
5
|
+
"mappings": "AAAO,MAAMA,EAAiB,CAC5B,oBAAqB,OAAO,IAAI,qBAAqB,EACrD,uBAAwB,OAAO,IAAI,wBAAwB,CAC7D",
|
|
6
|
+
"names": ["typedDataTypes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var S=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var l=(s,e,t,o)=>{for(var a=o>1?void 0:o?k(e,t):e,d=s.length-1,r;d>=0;d--)(r=s[d])&&(a=(o?r(e,t,a):r(a))||a);return o&&a&&S(e,t,a),a},f=(s,e)=>(t,o)=>e(t,o,s);import{inject as u,injectable as D}from"inversify";import{VERIFYING_CONTRACT_TOKEN_INDEX as g}from"../../shared/model/TypedDataClearSignContext";import{tokenTypes as x}from"../../token/di/tokenTypes";import{typedDataTypes as v}from"../../typed-data/di/typedDataTypes";let y=class{constructor(e,t){this.dataSource=e;this.tokenDataSource=t}async load(e){const t=await this.dataSource.getTypedDataFilters({address:e.verifyingContract,chainId:e.chainId,version:e.version,schema:e.schema});if(t.isLeft())return{type:"error",error:t.extract()};const{messageInfo:o,filters:a}=t.unsafeCoerce(),d={},r={};for(const n of a){if(d[n.path]=n,n.type!=="token"&&n.type!=="amount")continue;const c=n.tokenIndex;if(r[c]===void 0){if(n.type==="token"){const p=e.fieldsValues.filter(i=>i.path===n.path);if(p.length===0)continue;const T=p[0],m=this.convertAddressToHexaString(T.value);if(p.every(i=>this.convertAddressToHexaString(i.value)===m)){const i=e.chainId;(await this.tokenDataSource.getTokenInfosPayload({address:m,chainId:i})).ifRight(h=>{r[c]=h})}}else if(n.type==="amount"&&c===g){const p=e.verifyingContract,T=e.chainId;(await this.tokenDataSource.getTokenInfosPayload({address:p,chainId:T})).ifRight(i=>{r[c]=i})}}}return{type:"success",messageInfo:o,filters:d,tokens:r}}convertAddressToHexaString(e){return`0x${Array.from(e,t=>t.toString(16).padStart(2,"0")).join("").padStart(40,"0")}`}};y=l([D(),f(0,u(v.TypedDataDataSource)),f(1,u(x.TokenDataSource))],y);export{y as DefaultTypedDataContextLoader};
|
|
2
|
+
//# sourceMappingURL=DefaultTypedDataContextLoader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/typed-data/domain/DefaultTypedDataContextLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type {\n TypedDataClearSignContext,\n TypedDataFilter,\n TypedDataFilterPath,\n TypedDataToken,\n TypedDataTokenIndex,\n} from \"@/shared/model/TypedDataClearSignContext\";\nimport { VERIFYING_CONTRACT_TOKEN_INDEX } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport type { TypedDataDataSource } from \"@/typed-data/data/TypedDataDataSource\";\nimport { typedDataTypes } from \"@/typed-data/di/typedDataTypes\";\nimport type { TypedDataContextLoader } from \"@/typed-data/domain/TypedDataContextLoader\";\n\n@injectable()\nexport class DefaultTypedDataContextLoader implements TypedDataContextLoader {\n constructor(\n @inject(typedDataTypes.TypedDataDataSource)\n private dataSource: TypedDataDataSource,\n @inject(tokenTypes.TokenDataSource)\n private tokenDataSource: TokenDataSource,\n ) {}\n\n async load(typedData: TypedDataContext): Promise<TypedDataClearSignContext> {\n // Get the typed data filters from the data source\n const data = await this.dataSource.getTypedDataFilters({\n address: typedData.verifyingContract,\n chainId: typedData.chainId,\n version: typedData.version,\n schema: typedData.schema,\n });\n\n // If there was an error getting the typed data filters, return an error immediately\n if (data.isLeft()) {\n return {\n type: \"error\",\n error: data.extract(),\n };\n }\n\n // Else, extract the message info and filters\n const { messageInfo, filters } = data.unsafeCoerce();\n\n // Loop through the typed data filters to extract informations\n const mappedFilters: Record<TypedDataFilterPath, TypedDataFilter> = {};\n const mappedTokens: Record<TypedDataTokenIndex, TypedDataToken> = {};\n for (const filter of filters) {\n // Add the filter to the clear signing context\n mappedFilters[filter.path] = filter;\n if (filter.type !== \"token\" && filter.type !== \"amount\") {\n continue; // no token reference\n }\n\n // If the filter references a token, retrieve its descriptor from the tokens data source\n const tokenIndex = filter.tokenIndex;\n if (mappedTokens[tokenIndex] !== undefined) {\n continue; // Already fetched for a previous filter\n }\n\n // If the filter is a token, get token address from typed message values, and fetch descriptor\n if (filter.type === \"token\") {\n const values = typedData.fieldsValues.filter(\n (entry) => entry.path === filter.path,\n );\n if (values.length === 0) {\n // No value matching the referenced token. It may be located in an empty array.\n continue;\n }\n const value = values[0]!;\n const address = this.convertAddressToHexaString(value.value);\n\n // Arrays with different tokens are not supported since there is only 1 tokenIndex per filter.\n // Only fetch tokens if all values are the same.\n if (\n values.every(\n (entry) => this.convertAddressToHexaString(entry.value) === address,\n )\n ) {\n // Fetch descriptor\n const chainId = typedData.chainId;\n const payload = await this.tokenDataSource.getTokenInfosPayload({\n address,\n chainId,\n });\n payload.ifRight((p) => {\n mappedTokens[tokenIndex] = p;\n });\n }\n }\n\n // If the filter is an amount with a reference to the verifyingContract, fetch verifyingContract descriptor.\n // This is because descriptors data-sources should be compatible with Ledger devices specifications:\n // https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#amount-join-value\n else if (\n filter.type === \"amount\" &&\n tokenIndex === VERIFYING_CONTRACT_TOKEN_INDEX\n ) {\n const address = typedData.verifyingContract;\n const chainId = typedData.chainId;\n const payload = await this.tokenDataSource.getTokenInfosPayload({\n address,\n chainId,\n });\n payload.ifRight((p) => {\n mappedTokens[tokenIndex] = p;\n });\n }\n }\n\n return {\n type: \"success\",\n messageInfo,\n filters: mappedFilters,\n tokens: mappedTokens,\n };\n }\n\n private convertAddressToHexaString(address: Uint8Array): HexaString {\n // Address size is 20 bytes so 40 characters, padded with zeros on the left\n return `0x${Array.from(address, (byte) =>\n byte.toString(16).padStart(2, \"0\"),\n )\n .join(\"\")\n .padStart(40, \"0\")}`;\n }\n}\n"],
|
|
5
|
+
"mappings": "iOACA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YASnC,OAAS,kCAAAC,MAAsC,2CAG/C,OAAS,cAAAC,MAAkB,wBAE3B,OAAS,kBAAAC,MAAsB,iCAIxB,IAAMC,EAAN,KAAsE,CAC3E,YAEUC,EAEAC,EACR,CAHQ,gBAAAD,EAEA,qBAAAC,CACP,CAEH,MAAM,KAAKC,EAAiE,CAE1E,MAAMC,EAAO,MAAM,KAAK,WAAW,oBAAoB,CACrD,QAASD,EAAU,kBACnB,QAASA,EAAU,QACnB,QAASA,EAAU,QACnB,OAAQA,EAAU,MACpB,CAAC,EAGD,GAAIC,EAAK,OAAO,EACd,MAAO,CACL,KAAM,QACN,MAAOA,EAAK,QAAQ,CACtB,EAIF,KAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAAK,aAAa,EAG7CG,EAA8D,CAAC,EAC/DC,EAA4D,CAAC,EACnE,UAAWC,KAAUH,EAAS,CAG5B,GADAC,EAAcE,EAAO,IAAI,EAAIA,EACzBA,EAAO,OAAS,SAAWA,EAAO,OAAS,SAC7C,SAIF,MAAMC,EAAaD,EAAO,WAC1B,GAAID,EAAaE,CAAU,IAAM,QAKjC,GAAID,EAAO,OAAS,QAAS,CAC3B,MAAME,EAASR,EAAU,aAAa,OACnCS,GAAUA,EAAM,OAASH,EAAO,IACnC,EACA,GAAIE,EAAO,SAAW,EAEpB,SAEF,MAAME,EAAQF,EAAO,CAAC,EAChBG,EAAU,KAAK,2BAA2BD,EAAM,KAAK,EAI3D,GACEF,EAAO,MACJC,GAAU,KAAK,2BAA2BA,EAAM,KAAK,IAAME,CAC9D,EACA,CAEA,MAAMC,EAAUZ,EAAU,SACV,MAAM,KAAK,gBAAgB,qBAAqB,CAC9D,QAAAW,EACA,QAAAC,CACF,CAAC,GACO,QAASC,GAAM,CACrBR,EAAaE,CAAU,EAAIM,CAC7B,CAAC,CACH,CACF,SAMEP,EAAO,OAAS,UAChBC,IAAeO,EACf,CACA,MAAMH,EAAUX,EAAU,kBACpBY,EAAUZ,EAAU,SACV,MAAM,KAAK,gBAAgB,qBAAqB,CAC9D,QAAAW,EACA,QAAAC,CACF,CAAC,GACO,QAASC,GAAM,CACrBR,EAAaE,CAAU,EAAIM,CAC7B,CAAC,CACH,EACF,CAEA,MAAO,CACL,KAAM,UACN,YAAAX,EACA,QAASE,EACT,OAAQC,CACV,CACF,CAEQ,2BAA2BM,EAAiC,CAElE,MAAO,KAAK,MAAM,KAAKA,EAAUI,GAC/BA,EAAK,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,CACnC,EACG,KAAK,EAAE,EACP,SAAS,GAAI,GAAG,CAAC,EACtB,CACF,EA9GalB,EAANmB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAe,mBAAmB,GAEzCF,EAAA,EAAAC,EAAOE,EAAW,eAAe,IAJzBxB",
|
|
6
|
+
"names": ["inject", "injectable", "VERIFYING_CONTRACT_TOKEN_INDEX", "tokenTypes", "typedDataTypes", "DefaultTypedDataContextLoader", "dataSource", "tokenDataSource", "typedData", "data", "messageInfo", "filters", "mappedFilters", "mappedTokens", "filter", "tokenIndex", "values", "entry", "value", "address", "chainId", "p", "VERIFYING_CONTRACT_TOKEN_INDEX", "byte", "__decorateClass", "injectable", "__decorateParam", "inject", "typedDataTypes", "tokenTypes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Left as b,Right as s}from"purify-ts";import{DefaultTypedDataContextLoader as o}from"../../typed-data/domain/DefaultTypedDataContextLoader";describe("TokenContextLoader",()=>{const f={getTokenInfosPayload:jest.fn()},t={getTypedDataFilters:jest.fn()},d=new o(t,f),c={PermitSingle:[{name:"details",type:"PermitDetails"},{name:"spender",type:"address"},{name:"sigDeadline",type:"uint256"}],PermitDetails:[{type:"address[]",name:"token"},{name:"amount",type:"uint160"},{name:"expiration",type:"uint48"},{name:"nonce",type:"uint48"}],EIP712Domain:[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}]},n=[{path:"details.token.[]",value:Uint8Array.from([124,235,35,253,107,192,173,213,158,98,172,37,87,130,112,207,241,185,246,25])},{path:"details.amount",value:Uint8Array.from([18])},{path:"spender",value:Uint8Array.from([18])},{path:"details.expiration",value:Uint8Array.from([18])}];beforeEach(()=>{jest.clearAllMocks(),jest.spyOn(f,"getTokenInfosPayload").mockImplementation(({address:a})=>Promise.resolve(s(`payload-${a}`)))}),describe("load function",()=>{it("success with referenced token",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:c,fieldsValues:n};jest.spyOn(t,"getTypedDataFilters").mockImplementation(()=>Promise.resolve(s({messageInfo:{displayName:"Permit2",filtersCount:4,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"},{type:"amount",displayName:"Amount allowance",path:"details.amount",tokenIndex:0,signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3"},{type:"raw",displayName:"Approve to spender",path:"spender",signature:"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb"},{type:"datetime",displayName:"Approval expire",path:"details.expiration",signature:"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b"}]})));const e=await d.load(a);expect(e).toEqual({type:"success",messageInfo:{displayName:"Permit2",filtersCount:4,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},tokens:{0:"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"},filters:{"details.amount":{displayName:"Amount allowance",path:"details.amount",signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3",tokenIndex:0,type:"amount"},"details.expiration":{displayName:"Approval expire",path:"details.expiration",signature:"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b",type:"datetime"},"details.token.[]":{displayName:"Amount allowance",path:"details.token.[]",signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733",tokenIndex:0,type:"token"},spender:{displayName:"Approve to spender",path:"spender",signature:"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb",type:"raw"}}})}),it("success with referenced token verifying contract",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:c,fieldsValues:n};jest.spyOn(t,"getTypedDataFilters").mockImplementation(()=>Promise.resolve(s({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"},{type:"amount",displayName:"Amount allowance",path:"details.amount",tokenIndex:255,signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3"}]})));const e=await d.load(a);expect(e).toEqual({type:"success",messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},tokens:{0:"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",255:"payload-0x000000000022d473030f116ddee9f6b43ac78ba3"},filters:{"details.amount":{displayName:"Amount allowance",path:"details.amount",signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3",tokenIndex:255,type:"amount"},"details.token.[]":{displayName:"Amount allowance",path:"details.token.[]",signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733",tokenIndex:0,type:"token"}}})}),it("should return an error if filters are unavailable",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:c,fieldsValues:n};jest.spyOn(t,"getTypedDataFilters").mockImplementation(()=>Promise.resolve(b(new Error("error"))));const e=await d.load(a);expect(e).toEqual({type:"error",error:new Error("error")})}),it("success with unavailable tokens",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:c,fieldsValues:n};jest.spyOn(t,"getTypedDataFilters").mockImplementation(()=>Promise.resolve(s({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]}))),jest.spyOn(f,"getTokenInfosPayload").mockImplementation(()=>Promise.resolve(b(new Error("token error"))));const e=await d.load(a);expect(e).toEqual({type:"success",messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},tokens:{},filters:{"details.token.[]":{displayName:"Amount allowance",path:"details.token.[]",signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733",tokenIndex:0,type:"token"}}})}),it("success with several identic tokens",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:c,fieldsValues:[{path:"details.token.[]",value:Uint8Array.from([124,235,35,253,107,192,173,213,158,98,172,37,87,130,112,207,241,185,246,25])},...n]};jest.spyOn(t,"getTypedDataFilters").mockImplementation(()=>Promise.resolve(s({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]}))),jest.spyOn(f,"getTokenInfosPayload").mockImplementation(()=>Promise.resolve(b(new Error("token error"))));const e=await d.load(a);expect(f.getTokenInfosPayload).toHaveBeenCalledWith({address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",chainId:1}),expect(e.type).toEqual("success")}),it("success with several different tokens",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:c,fieldsValues:[{path:"details.token.[]",value:Uint8Array.from([124,235,35,253,107,192,173,213,158,98,172,37,87,130,112,207,241,185,246,255])},...n]};jest.spyOn(t,"getTypedDataFilters").mockImplementation(()=>Promise.resolve(s({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]})));const e=await d.load(a);expect(f.getTokenInfosPayload).not.toHaveBeenCalledWith({address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f6ff",chainId:1}),expect(f.getTokenInfosPayload).not.toHaveBeenCalledWith({address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",chainId:1}),expect(e.type).toEqual("success")}),it("should ignore the token if value is not found",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:c,fieldsValues:n};jest.spyOn(t,"getTypedDataFilters").mockImplementation(()=>Promise.resolve(s({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.badtoken",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]})));const e=await d.load(a);expect(e.type).toEqual("success"),e.type==="success"&&(expect(e.filters["details.badtoken"]?.displayName).toEqual("Amount allowance"),expect(e.tokens).toEqual({}))})})});
|
|
2
|
+
//# sourceMappingURL=DefaultTypedDataContextLoader.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/typed-data/domain/DefaultTypedDataContextLoader.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport type { TypedDataDataSource } from \"@/typed-data/data/TypedDataDataSource\";\nimport { DefaultTypedDataContextLoader } from \"@/typed-data/domain/DefaultTypedDataContextLoader\";\n\ndescribe(\"TokenContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: jest.fn(),\n };\n const mockTypedDataDataSource: TypedDataDataSource = {\n getTypedDataFilters: jest.fn(),\n };\n const loader = new DefaultTypedDataContextLoader(\n mockTypedDataDataSource,\n mockTokenDataSource,\n );\n\n const TEST_TYPES = {\n PermitSingle: [\n {\n name: \"details\",\n type: \"PermitDetails\",\n },\n {\n name: \"spender\",\n type: \"address\",\n },\n {\n name: \"sigDeadline\",\n type: \"uint256\",\n },\n ],\n PermitDetails: [\n {\n type: \"address[]\",\n name: \"token\",\n },\n {\n name: \"amount\",\n type: \"uint160\",\n },\n {\n name: \"expiration\",\n type: \"uint48\",\n },\n {\n name: \"nonce\",\n type: \"uint48\",\n },\n ],\n EIP712Domain: [\n {\n name: \"name\",\n type: \"string\",\n },\n {\n name: \"chainId\",\n type: \"uint256\",\n },\n {\n name: \"verifyingContract\",\n type: \"address\",\n },\n ],\n };\n const TEST_VALUES = [\n {\n path: \"details.token.[]\",\n value: Uint8Array.from([\n 0x7c, 0xeb, 0x23, 0xfd, 0x6b, 0xc0, 0xad, 0xd5, 0x9e, 0x62, 0xac, 0x25,\n 0x57, 0x82, 0x70, 0xcf, 0xf1, 0xb9, 0xf6, 0x19,\n ]),\n },\n {\n path: \"details.amount\",\n value: Uint8Array.from([0x12]),\n },\n {\n path: \"spender\",\n value: Uint8Array.from([0x12]),\n },\n {\n path: \"details.expiration\",\n value: Uint8Array.from([0x12]),\n },\n ];\n\n beforeEach(() => {\n jest.clearAllMocks();\n jest\n .spyOn(mockTokenDataSource, \"getTokenInfosPayload\")\n .mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"load function\", () => {\n it(\"success with referenced token\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n jest\n .spyOn(mockTypedDataDataSource, \"getTypedDataFilters\")\n .mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 4,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n {\n type: \"amount\",\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n tokenIndex: 0,\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n },\n {\n type: \"raw\",\n displayName: \"Approve to spender\",\n path: \"spender\",\n signature:\n \"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb\",\n },\n {\n type: \"datetime\",\n displayName: \"Approval expire\",\n path: \"details.expiration\",\n signature:\n \"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b\",\n },\n ],\n }),\n ),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"success\",\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 4,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n tokens: {\n 0: \"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\",\n },\n filters: {\n \"details.amount\": {\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n tokenIndex: 0,\n type: \"amount\",\n },\n \"details.expiration\": {\n displayName: \"Approval expire\",\n path: \"details.expiration\",\n signature:\n \"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b\",\n type: \"datetime\",\n },\n \"details.token.[]\": {\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n tokenIndex: 0,\n type: \"token\",\n },\n spender: {\n displayName: \"Approve to spender\",\n path: \"spender\",\n signature:\n \"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb\",\n type: \"raw\",\n },\n },\n });\n });\n\n it(\"success with referenced token verifying contract\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n jest\n .spyOn(mockTypedDataDataSource, \"getTypedDataFilters\")\n .mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n {\n type: \"amount\",\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n tokenIndex: 255,\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n },\n ],\n }),\n ),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"success\",\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n tokens: {\n 0: \"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\",\n 255: \"payload-0x000000000022d473030f116ddee9f6b43ac78ba3\",\n },\n filters: {\n \"details.amount\": {\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n tokenIndex: 255,\n type: \"amount\",\n },\n \"details.token.[]\": {\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n tokenIndex: 0,\n type: \"token\",\n },\n },\n });\n });\n\n it(\"should return an error if filters are unavailable\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n jest\n .spyOn(mockTypedDataDataSource, \"getTypedDataFilters\")\n .mockImplementation(() => Promise.resolve(Left(new Error(\"error\"))));\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"error\",\n error: new Error(\"error\"),\n });\n });\n\n it(\"success with unavailable tokens\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n jest\n .spyOn(mockTypedDataDataSource, \"getTypedDataFilters\")\n .mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n jest\n .spyOn(mockTokenDataSource, \"getTokenInfosPayload\")\n .mockImplementation(() =>\n Promise.resolve(Left(new Error(\"token error\"))),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"success\",\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n tokens: {},\n filters: {\n \"details.token.[]\": {\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n tokenIndex: 0,\n type: \"token\",\n },\n },\n });\n });\n\n it(\"success with several identic tokens\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: [\n {\n path: \"details.token.[]\",\n value: Uint8Array.from([\n 0x7c, 0xeb, 0x23, 0xfd, 0x6b, 0xc0, 0xad, 0xd5, 0x9e, 0x62, 0xac,\n 0x25, 0x57, 0x82, 0x70, 0xcf, 0xf1, 0xb9, 0xf6, 0x19,\n ]),\n },\n ...TEST_VALUES,\n ],\n } as TypedDataContext;\n jest\n .spyOn(mockTypedDataDataSource, \"getTypedDataFilters\")\n .mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n jest\n .spyOn(mockTokenDataSource, \"getTokenInfosPayload\")\n .mockImplementation(() =>\n Promise.resolve(Left(new Error(\"token error\"))),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: \"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\",\n chainId: 1,\n });\n expect(result.type).toEqual(\"success\");\n });\n\n it(\"success with several different tokens\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: [\n {\n path: \"details.token.[]\",\n value: Uint8Array.from([\n 0x7c, 0xeb, 0x23, 0xfd, 0x6b, 0xc0, 0xad, 0xd5, 0x9e, 0x62, 0xac,\n 0x25, 0x57, 0x82, 0x70, 0xcf, 0xf1, 0xb9, 0xf6, 0xff,\n ]),\n },\n ...TEST_VALUES,\n ],\n } as TypedDataContext;\n jest\n .spyOn(mockTypedDataDataSource, \"getTypedDataFilters\")\n .mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).not.toHaveBeenCalledWith(\n { address: \"0x7ceb23fd6bc0add59e62ac25578270cff1b9f6ff\", chainId: 1 },\n );\n expect(mockTokenDataSource.getTokenInfosPayload).not.toHaveBeenCalledWith(\n { address: \"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\", chainId: 1 },\n );\n expect(result.type).toEqual(\"success\");\n });\n\n it(\"should ignore the token if value is not found\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n jest\n .spyOn(mockTypedDataDataSource, \"getTypedDataFilters\")\n .mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.badtoken\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result.type).toEqual(\"success\");\n if (result.type === \"success\") {\n expect(result.filters[\"details.badtoken\"]?.[\"displayName\"]).toEqual(\n \"Amount allowance\",\n );\n expect(result.tokens).toEqual({});\n }\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAK5B,OAAS,iCAAAC,MAAqC,oDAE9C,SAAS,qBAAsB,IAAM,CACnC,MAAMC,EAAuC,CAC3C,qBAAsB,KAAK,GAAG,CAChC,EACMC,EAA+C,CACnD,oBAAqB,KAAK,GAAG,CAC/B,EACMC,EAAS,IAAIH,EACjBE,EACAD,CACF,EAEMG,EAAa,CACjB,aAAc,CACZ,CACE,KAAM,UACN,KAAM,eACR,EACA,CACE,KAAM,UACN,KAAM,SACR,EACA,CACE,KAAM,cACN,KAAM,SACR,CACF,EACA,cAAe,CACb,CACE,KAAM,YACN,KAAM,OACR,EACA,CACE,KAAM,SACN,KAAM,SACR,EACA,CACE,KAAM,aACN,KAAM,QACR,EACA,CACE,KAAM,QACN,KAAM,QACR,CACF,EACA,aAAc,CACZ,CACE,KAAM,OACN,KAAM,QACR,EACA,CACE,KAAM,UACN,KAAM,SACR,EACA,CACE,KAAM,oBACN,KAAM,SACR,CACF,CACF,EACMC,EAAc,CAClB,CACE,KAAM,mBACN,MAAO,WAAW,KAAK,CAC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AoB,EAAE,IAAI,qBACnD,CAAE,QAAS,6CAA8C,QAAS,CAAE,CACtE,EACA,OAAOO,EAAO,IAAI,EAAE,QAAQ,SAAS,CACvC,CAAC,EAED,GAAG,gDAAiD,SAAY,CAE9D,MAAMD,EAAM,CACV,kBAAmB,6CACnB,QAAS,EACT,QAAS,KACT,OAAQH,EACR,aAAcC,CAChB,EACA,KACG,MAAMH,EAAyB,qBAAqB,EACpD,mBAAmB,IAClB,QAAQ,QACNH,EAAM,CACJ,YAAa,CACX,YAAa,UACb,aAAc,EACd,UACE,gJACJ,EACA,QAAS,CACP,CACE,KAAM,QACN,YAAa,mBACb,KAAM,mBACN,WAAY,EACZ,UACE,8IACJ,CACF,CACF,CAAC,CACH,CACF,EAGF,MAAMS,EAAS,MAAML,EAAO,KAAKI,CAAG,EAGpC,OAAOC,EAAO,IAAI,EAAE,QAAQ,SAAS,EACjCA,EAAO,OAAS,YAClB,OAAOA,EAAO,QAAQ,kBAAkB,GAAI,WAAc,EAAE,QAC1D,kBACF,EACA,OAAOA,EAAO,MAAM,EAAE,QAAQ,CAAC,CAAC,EAEpC,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["Left", "Right", "DefaultTypedDataContextLoader", "mockTokenDataSource", "mockTypedDataDataSource", "loader", "TEST_TYPES", "TEST_VALUES", "address", "ctx", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=TypedDataContextLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ClearSignContext } from "./shared/model/ClearSignContext";
|
|
2
|
+
import { type TransactionContext, type TransactionFieldContext } from "./shared/model/TransactionContext";
|
|
3
|
+
import { type TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
|
|
4
|
+
import { type TypedDataContext } from "./shared/model/TypedDataContext";
|
|
5
|
+
export interface ContextModule {
|
|
6
|
+
getContext(field: TransactionFieldContext): Promise<ClearSignContext>;
|
|
7
|
+
getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;
|
|
8
|
+
getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ContextModule.d.ts.map
|
|
@@ -0,0 +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;AAExE,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;CACvC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ContextModuleCalConfig, type ContextModuleConfig } from "./config/model/ContextModuleConfig";
|
|
2
|
+
import { type ContextLoader } from "./shared/domain/ContextLoader";
|
|
3
|
+
import { type TypedDataContextLoader } from "./typed-data/domain/TypedDataContextLoader";
|
|
4
|
+
import { type ContextModule } from "./ContextModule";
|
|
5
|
+
export declare const DEFAULT_CONFIG: ContextModuleConfig;
|
|
6
|
+
export declare class ContextModuleBuilder {
|
|
7
|
+
private config;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Remove default loaders from the list of loaders
|
|
11
|
+
*
|
|
12
|
+
* @returns this
|
|
13
|
+
*/
|
|
14
|
+
removeDefaultLoaders(): this;
|
|
15
|
+
/**
|
|
16
|
+
* Add a custom loader to the list of loaders
|
|
17
|
+
*
|
|
18
|
+
* @param loader loader to add to the list of loaders
|
|
19
|
+
* @returns this
|
|
20
|
+
*/
|
|
21
|
+
addLoader(loader: ContextLoader): this;
|
|
22
|
+
/**
|
|
23
|
+
* Replace the default loader for typed data clear signing contexts
|
|
24
|
+
*
|
|
25
|
+
* @param loader loader to use for typed data clear signing contexts
|
|
26
|
+
* @returns this
|
|
27
|
+
*/
|
|
28
|
+
addTypedDataLoader(loader: TypedDataContextLoader): this;
|
|
29
|
+
/**
|
|
30
|
+
* Add a custom CAL configuration
|
|
31
|
+
*
|
|
32
|
+
* @param calConfig
|
|
33
|
+
* @returns this
|
|
34
|
+
*/
|
|
35
|
+
addCalConfig(calConfig: ContextModuleCalConfig): this;
|
|
36
|
+
/**
|
|
37
|
+
* Build the context module
|
|
38
|
+
*
|
|
39
|
+
* @returns the context module
|
|
40
|
+
*/
|
|
41
|
+
build(): ContextModule;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ContextModuleBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextModuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/ContextModuleBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,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,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKrD,eAAO,MAAM,cAAc,EAAE,mBAS5B,CAAC;AAEF,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAuC;;IAIrD;;;;OAIG;IACH,oBAAoB;IAKpB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa;IAK/B;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,sBAAsB;IAKjD;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,sBAAsB;IAK9C;;;;OAIG;IACH,KAAK,IAAI,aAAa;CAGvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextModuleBuilder.test.d.ts","sourceRoot":"","sources":["../../../src/ContextModuleBuilder.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
|
|
2
|
+
import type { TypedDataContext } from "./shared/model/TypedDataContext";
|
|
3
|
+
import { type ContextModuleConfig } from "./config/model/ContextModuleConfig";
|
|
4
|
+
import { type ClearSignContext } from "./shared/model/ClearSignContext";
|
|
5
|
+
import { type TransactionContext, type TransactionFieldContext } from "./shared/model/TransactionContext";
|
|
6
|
+
import { type ContextModule } from "./ContextModule";
|
|
7
|
+
export declare class DefaultContextModule implements ContextModule {
|
|
8
|
+
private _container;
|
|
9
|
+
private _loaders;
|
|
10
|
+
private _typedDataLoader;
|
|
11
|
+
constructor(args: ContextModuleConfig);
|
|
12
|
+
private _getDefaultLoaders;
|
|
13
|
+
private _getDefaultTypedDataLoader;
|
|
14
|
+
getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;
|
|
15
|
+
getContext(field: TransactionFieldContext): Promise<ClearSignContext>;
|
|
16
|
+
getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=DefaultContextModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAEA,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,EAEtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAO3C,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;gBAErC,IAAI,EAAE,mBAAmB;IAQrC,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,0BAA0B;IAMrB,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;CAGtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultContextModule.test.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ContainerModule } from "inversify";
|
|
2
|
+
import { type ContextModuleConfig } from "../../config/model/ContextModuleConfig";
|
|
3
|
+
export declare const configModuleFactory: (config: ContextModuleConfig) => ContainerModule;
|
|
4
|
+
//# sourceMappingURL=configModuleFactory.d.ts.map
|
|
@@ -0,0 +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,WAAY,mBAAmB,oBAG3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configTypes.d.ts","sourceRoot":"","sources":["../../../../../src/config/di/configTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;CAEvB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ContextLoader } from "../../shared/domain/ContextLoader";
|
|
2
|
+
import { type TypedDataContextLoader } from "../../typed-data/domain/TypedDataContextLoader";
|
|
3
|
+
export type ContextModuleCalMode = "prod" | "test";
|
|
4
|
+
export type ContextModuleCalBranch = "next" | "main" | "demo";
|
|
5
|
+
export type ContextModuleCalConfig = {
|
|
6
|
+
url: string;
|
|
7
|
+
mode: ContextModuleCalMode;
|
|
8
|
+
branch: ContextModuleCalBranch;
|
|
9
|
+
};
|
|
10
|
+
export type ContextModuleConfig = {
|
|
11
|
+
cal: ContextModuleCalConfig;
|
|
12
|
+
defaultLoaders: boolean;
|
|
13
|
+
customLoaders: ContextLoader[];
|
|
14
|
+
customTypedDataLoader?: TypedDataContextLoader;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=ContextModuleConfig.d.ts.map
|
|
@@ -0,0 +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,CAAC;AACnE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEzF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,EAAE,sBAAsB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,sBAAsB,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;CAChD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Container } from "inversify";
|
|
2
|
+
import { type ContextModuleConfig } from "./config/model/ContextModuleConfig";
|
|
3
|
+
type MakeContainerArgs = {
|
|
4
|
+
config: ContextModuleConfig;
|
|
5
|
+
};
|
|
6
|
+
export declare const makeContainer: ({ config }: MakeContainerArgs) => Container;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=di.d.ts.map
|
|
@@ -0,0 +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;AAQ9E,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,aAAa,eAAgB,iBAAiB,cAc1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DAppDto.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/DAppDto.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,IAAI,CAAC;IACX,cAAc,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,GAAG;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,QAAQ;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAAA;KAAE,CAAC;CACrD;AAED,UAAU,gBAAgB;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,OAAO,EAAE,MAAM,GAAG;QACjB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;KAClC,CAAC;CACH;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type HexaString } from "@ledgerhq/device-management-kit";
|
|
2
|
+
import { type Either } from "purify-ts";
|
|
3
|
+
import { type DappInfos } from "../../external-plugin/model/DappInfos";
|
|
4
|
+
export type GetDappInfos = {
|
|
5
|
+
address: string;
|
|
6
|
+
selector: HexaString;
|
|
7
|
+
chainId: number;
|
|
8
|
+
};
|
|
9
|
+
export interface ExternalPluginDataSource {
|
|
10
|
+
getDappInfos(params: GetDappInfos): Promise<Either<Error, DappInfos | undefined>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ExternalPluginDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalPluginDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/ExternalPluginDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,YAAY,CACV,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;CAClD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Either } from "purify-ts";
|
|
2
|
+
import type { ContextModuleConfig } from "../../config/model/ContextModuleConfig";
|
|
3
|
+
import { ExternalPluginDataSource, GetDappInfos } from "../../external-plugin/data/ExternalPluginDataSource";
|
|
4
|
+
import { DappInfos } from "../../external-plugin/model/DappInfos";
|
|
5
|
+
export declare class HttpExternalPluginDataSource implements ExternalPluginDataSource {
|
|
6
|
+
private readonly config;
|
|
7
|
+
constructor(config: ContextModuleConfig);
|
|
8
|
+
getDappInfos({ chainId, address, selector, }: GetDappInfos): Promise<Either<Error, DappInfos | undefined>>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=HttpExternalPluginDataSource.d.ts.map
|
|
@@ -0,0 +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;AAI9D,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;CA8DhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpExternalPluginDataSource.test.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/HttpExternalPluginDataSource.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalPluginModuleFactory.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/di/externalPluginModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5C,eAAO,MAAM,2BAA2B,uBAQpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalPluginTypes.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/di/externalPluginTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC"}
|
package/lib/{external-plugin → types/src/external-plugin}/domain/ExternalPluginContextLoader.d.ts
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type { ExternalPluginDataSource } from "../../external-plugin/data/ExternalPluginDataSource";
|
|
1
2
|
import { ContextLoader } from "../../shared/domain/ContextLoader";
|
|
2
|
-
import { TransactionContext } from "../../shared/model/TransactionContext";
|
|
3
|
-
import { TokenDataSource } from "../../token/data/TokenDataSource";
|
|
4
3
|
import { ClearSignContext } from "../../shared/model/ClearSignContext";
|
|
5
|
-
import {
|
|
4
|
+
import { TransactionContext } from "../../shared/model/TransactionContext";
|
|
5
|
+
import type { TokenDataSource } from "../../token/data/TokenDataSource";
|
|
6
6
|
export declare class ExternalPluginContextLoader implements ContextLoader {
|
|
7
7
|
private _externalPluginDataSource;
|
|
8
8
|
private _tokenDataSource;
|
|
9
9
|
constructor(externalPluginDataSource: ExternalPluginDataSource, tokenDataSource: TokenDataSource);
|
|
10
10
|
load(transaction: TransactionContext): Promise<ClearSignContext[]>;
|
|
11
|
+
private getTokenPayload;
|
|
11
12
|
private getDecodedCallData;
|
|
12
13
|
private getAddressFromPath;
|
|
13
14
|
}
|
|
@@ -0,0 +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,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAyFxE,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,kBAAkB;CA6B3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalPluginContextLoader.test.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DappInfos.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/model/DappInfos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,MAAM,MAAM,SAAS,GAAG;IAAE,eAAe,EAAE,eAAe,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectorDetails.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/model/SelectorDetails.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
export * from "./config/model/ContextModuleConfig";
|
|
1
2
|
export * from "./ContextModule";
|
|
2
3
|
export * from "./ContextModuleBuilder";
|
|
3
4
|
export * from "./DefaultContextModule";
|
|
5
|
+
export * from "./external-plugin/domain/ExternalPluginContextLoader";
|
|
6
|
+
export * from "./nft/domain/NftContextLoader";
|
|
7
|
+
export * from "./shared/domain/ContextLoader";
|
|
4
8
|
export * from "./shared/model/ClearSignContext";
|
|
9
|
+
export * from "./shared/model/GenericPath";
|
|
5
10
|
export * from "./shared/model/TransactionContext";
|
|
6
11
|
export * from "./shared/model/TransactionSubset";
|
|
12
|
+
export * from "./shared/model/TypedDataClearSignContext";
|
|
13
|
+
export * from "./shared/model/TypedDataContext";
|
|
7
14
|
export * from "./token/domain/TokenContextLoader";
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./forward-domain/domain/ForwardDomainContextLoader";
|
|
10
|
-
export * from "./external-plugin/domain/ExternalPluginContextLoader";
|
|
15
|
+
export * from "./trusted-name/domain/TrustedNameContextLoader";
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sDAAsD,CAAC;AACrE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gDAAgD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Either } from "purify-ts";
|
|
2
|
+
import { GetNftInformationsParams, GetSetPluginPayloadParams, NftDataSource } from "../../nft/data/NftDataSource";
|
|
3
|
+
export declare class HttpNftDataSource implements NftDataSource {
|
|
4
|
+
getSetPluginPayload({ chainId, address, selector, }: GetSetPluginPayloadParams): Promise<Either<Error, string>>;
|
|
5
|
+
getNftInfosPayload({ chainId, address, }: GetNftInformationsParams): Promise<Either<Error, string>>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=HttpNftDataSource.d.ts.map
|
|
@@ -0,0 +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;AAEhD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAGlC,qBACa,iBAAkB,YAAW,aAAa;IACxC,mBAAmB,CAAC,EAC/B,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IA0BhD,kBAAkB,CAAC,EAC9B,OAAO,EACP,OAAO,GACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAqB7D"}
|