@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
package/LICENSE.MD
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2024-present Ledger
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Ledger Context Module Implementation
|
|
2
|
+
|
|
3
|
+
> [!CAUTION]
|
|
4
|
+
> This is still under development and we are free to make new interfaces which may lead to Device Management Kit breaking changes.
|
|
5
|
+
|
|
6
|
+
## Introduction
|
|
7
|
+
|
|
8
|
+
The purpose of the **Context Module** is to provide all the necessary context for the clear signing operation.
|
|
9
|
+
This module includes the Ledger implementation of the context module and all the default context loaders used to fetch the context of a transaction.
|
|
10
|
+
This open-source module can serve as an example for implementing custom context modules or loaders.
|
|
11
|
+
|
|
12
|
+
## How does it work
|
|
13
|
+
|
|
14
|
+
The Context Module features an interface utilized by the Signer module to retrieve the context of a transaction. This module comprises multiple loaders, each capable of being specified individually. Each loader attempts to fetch context from the backend relevant to its domain. For example, one loader retrieves information about tokens, another fetches information about NFTs, and so on.
|
|
15
|
+
|
|
16
|
+
The following diagram illustrates the communication between the various modules when the context for a token transaction is successfully retrieved:
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart LR;
|
|
20
|
+
Signer --Transaction--> ContextModule
|
|
21
|
+
ContextModule --Transaction--> TokenContextLoader
|
|
22
|
+
ContextModule --Transaction--> NftContextLoader
|
|
23
|
+
ContextModule --Transaction--> OtherContextLoader
|
|
24
|
+
TokenContextLoader --> Backend1(Backend)
|
|
25
|
+
NftContextLoader --> Backend2(Backend)
|
|
26
|
+
OtherContextLoader --> Backend3(Backend)
|
|
27
|
+
Backend1 --Context--> TokenContextLoader
|
|
28
|
+
TokenContextLoader --Context--> ContextModule
|
|
29
|
+
ContextModule --Context--> Signer
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
To install the context-module package, run the following command:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm install @ledgerhq/context-module
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### Main Features
|
|
43
|
+
|
|
44
|
+
It currently supports the following features:
|
|
45
|
+
|
|
46
|
+
- Tokens: provide information about tokens used in the transaction.
|
|
47
|
+
- NFTs: provide information about NFTs used in the transaction.
|
|
48
|
+
- Domain name: provide information about domain names.
|
|
49
|
+
- Custom plugins: provide complex informations to external plugins such as the **1inch** or **paraswap** plugin.
|
|
50
|
+
|
|
51
|
+
> [!NOTE]
|
|
52
|
+
> At the moment the context module is available only for Ethereum blockchain.
|
|
53
|
+
|
|
54
|
+
### Setting up
|
|
55
|
+
|
|
56
|
+
The context-module package exposes a builder `ContextModuleBuilder` which will be used to initialise the context module with your configuration.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
const contextModule = new ContextModuleBuilder().build();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
You can use a custom configuration for your context module.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
const config: ContextModuleCalConfig = {
|
|
66
|
+
// config to use
|
|
67
|
+
};
|
|
68
|
+
const contextModule = new ContextModuleBuilder().addCalConfig(config).build();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
It is also possible to instantiate the context module without the default loaders.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const contextModule = new ContextModuleBuilder().removeDefaultLoaders().build();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> [!NOTE]
|
|
78
|
+
> Without loaders, a transaction cannot be clear signed. Use it with caution.
|
|
79
|
+
|
|
80
|
+
You can add a custom list of loader to the context module.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
// Default Token Loader
|
|
84
|
+
const tokenLoader = new TokenContextLoader(new TokenDataSource());
|
|
85
|
+
|
|
86
|
+
// Custom Loader
|
|
87
|
+
const myCustomLoader = new MyCustomLoader();
|
|
88
|
+
|
|
89
|
+
// Custom datasource for a default Token Loader
|
|
90
|
+
const myCustomTokenDataSource = new MyCustomTokenDataSource();
|
|
91
|
+
const myTokenLoader = new TokenCOntextLoader();
|
|
92
|
+
|
|
93
|
+
const contextModule = new ContextModuleBuilder()
|
|
94
|
+
.removeDefaultLoaders()
|
|
95
|
+
.addLoader(tokenLoader)
|
|
96
|
+
.addLoader(myTokenLoader)
|
|
97
|
+
.addLoader(myCustomLoader)
|
|
98
|
+
.build();
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Create a custom loader
|
|
102
|
+
|
|
103
|
+
A custom loader must implement the ContextLoader interface, defined as follows:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
type ContextLoader = {
|
|
107
|
+
load: (transaction: TransactionContext) => Promise<ClearSignContext[]>;
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
with ClearSignContextSuccess defined as follows:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
type ClearSignContextSuccess = {
|
|
115
|
+
type: "token" | "nft" | "domainName" | "plugin" | "externalPlugin";
|
|
116
|
+
payload: string;
|
|
117
|
+
};
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The payload should represent the data sent to the device to provide information and must be signed by a trusted authority.
|
|
121
|
+
|
|
122
|
+
### Errors handling
|
|
123
|
+
|
|
124
|
+
> [!CAUTION]
|
|
125
|
+
> To be defined
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var x=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(r,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let m of b(o))!c.call(r,m)&&m!==t&&x(r,m,{get:()=>o[m],enumerable:!(i=a(o,m))||i.enumerable});return r},e=(r,o,t)=>(f(r,o,"default"),t&&f(t,o,"default"));var d=r=>f(x({},"__esModule",{value:!0}),r);var p={};module.exports=d(p);var h=require("reflect-metadata");e(p,require("./src/index"),module.exports);0&&(module.exports={...require("./src/index")});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../index.ts"],
|
|
4
|
+
"sourcesContent": ["// inversify requirement\nimport \"reflect-metadata\";\n\nexport * from \"./src/index\";\n"],
|
|
5
|
+
"mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GACA,IAAAE,EAAO,4BAEPC,EAAAH,EAAc,uBAHd",
|
|
6
|
+
"names": ["context_module_exports", "__toCommonJS", "import_reflect_metadata", "__reExport"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ledgerhq/context-module",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./lib/types/index.d.ts",
|
|
8
|
+
"import": "./lib/esm/index.js",
|
|
9
|
+
"require": "./lib/cjs/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./*": {
|
|
12
|
+
"types": "./lib/types/*",
|
|
13
|
+
"import": "./lib/esm/*",
|
|
14
|
+
"require": "./lib/cjs/*"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"./lib"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"prebuild": "rimraf lib",
|
|
22
|
+
"build": "pnpm lmdk-build --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
23
|
+
"dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"",
|
|
24
|
+
"watch:builds": "pnpm lmdk-watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
25
|
+
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"",
|
|
26
|
+
"lint": "eslint",
|
|
27
|
+
"lint:fix": "pnpm lint --fix",
|
|
28
|
+
"postpack": "find . -name '*.tgz' -exec cp {} ../../../dist/ \\; ",
|
|
29
|
+
"prettier": "prettier . --check",
|
|
30
|
+
"prettier:fix": "prettier . --write",
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"test:watch": "pnpm test -- --watch",
|
|
33
|
+
"test:coverage": "pnpm test -- --coverage",
|
|
34
|
+
"typecheck": "tsc --noEmit"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@ledgerhq/device-management-kit": "workspace:*",
|
|
38
|
+
"@ledgerhq/esbuild-tools": "workspace:*",
|
|
39
|
+
"@ledgerhq/eslint-config-dsdk": "workspace:*",
|
|
40
|
+
"@ledgerhq/jest-config-dsdk": "workspace:*",
|
|
41
|
+
"@ledgerhq/prettier-config-dsdk": "workspace:*",
|
|
42
|
+
"@ledgerhq/tsconfig-dsdk": "workspace:*",
|
|
43
|
+
"@types/crypto-js": "^4.2.2",
|
|
44
|
+
"ts-node": "^10.9.2"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"axios": "^1.7.9",
|
|
48
|
+
"crypto-js": "^4.2.0",
|
|
49
|
+
"ethers": "6.13.4",
|
|
50
|
+
"inversify": "^6.1.6",
|
|
51
|
+
"purify-ts": "^2.1.0",
|
|
52
|
+
"reflect-metadata": "^0.2.2"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@ledgerhq/device-management-kit": "^0.5.1"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var x=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!p.call(e,o)&&o!==r&&a(e,o,{get:()=>t[o],enumerable:!(n=i(t,o))||n.enumerable});return e};var m=e=>x(a({},"__esModule",{value:!0}),e);var y={};module.exports=m(y);
|
|
2
|
+
//# sourceMappingURL=ContextModule.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ContextModule.ts"],
|
|
4
|
+
"sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\n\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { type TypedDataClearSignContext } from \"./shared/model/TypedDataClearSignContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\n\nexport interface ContextModule {\n getContext(field: TransactionFieldContext): Promise<ClearSignContext>;\n getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;\n getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext>;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["ContextModule_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var C=(o,t)=>{for(var r in t)a(o,r,{get:t[r],enumerable:!0})},f=(o,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of u(t))!l.call(o,e)&&e!==r&&a(o,e,{get:()=>t[e],enumerable:!(n=s(t,e))||n.enumerable});return o};var p=o=>f(a({},"__esModule",{value:!0}),o);var L={};C(L,{ContextModuleBuilder:()=>m,DEFAULT_CONFIG:()=>d});module.exports=p(L);var i=require("./DefaultContextModule");const c="https://crypto-assets-service.api.ledger.com/v1",d={cal:{url:c,mode:"prod",branch:"main"},defaultLoaders:!0,customLoaders:[],customTypedDataLoader:void 0};class m{config=d;constructor(){}removeDefaultLoaders(){return this.config.defaultLoaders=!1,this}addLoader(t){return this.config.customLoaders.push(t),this}addTypedDataLoader(t){return this.config.customTypedDataLoader=t,this}addCalConfig(t){return this.config.cal={...d.cal,...t},this}build(){return new i.DefaultContextModule(this.config)}}0&&(module.exports={ContextModuleBuilder,DEFAULT_CONFIG});
|
|
2
|
+
//# sourceMappingURL=ContextModuleBuilder.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ContextModuleBuilder.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport { type TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst DEFAULT_CAL_URL = \"https://crypto-assets-service.api.ledger.com/v1\";\n\nexport const DEFAULT_CONFIG: ContextModuleConfig = {\n cal: {\n url: DEFAULT_CAL_URL,\n mode: \"prod\",\n branch: \"main\",\n },\n defaultLoaders: true,\n customLoaders: [],\n customTypedDataLoader: undefined,\n};\n\nexport class ContextModuleBuilder {\n private config: ContextModuleConfig = DEFAULT_CONFIG;\n\n constructor() {}\n\n /**\n * Remove default loaders from the list of loaders\n *\n * @returns this\n */\n removeDefaultLoaders() {\n this.config.defaultLoaders = false;\n return this;\n }\n\n /**\n * Add a custom loader to the list of loaders\n *\n * @param loader loader to add to the list of loaders\n * @returns this\n */\n addLoader(loader: ContextLoader) {\n this.config.customLoaders.push(loader);\n return this;\n }\n\n /**\n * Replace the default loader for typed data clear signing contexts\n *\n * @param loader loader to use for typed data clear signing contexts\n * @returns this\n */\n addTypedDataLoader(loader: TypedDataContextLoader) {\n this.config.customTypedDataLoader = loader;\n return this;\n }\n\n /**\n * Add a custom CAL configuration\n *\n * @param calConfig\n * @returns this\n */\n addCalConfig(calConfig: ContextModuleCalConfig) {\n this.config.cal = { ...DEFAULT_CONFIG.cal, ...calConfig };\n return this;\n }\n\n /**\n * Build the context module\n *\n * @returns the context module\n */\n build(): ContextModule {\n return new DefaultContextModule(this.config);\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,mBAAAC,IAAA,eAAAC,EAAAJ,GAOA,IAAAK,EAAqC,kCAErC,MAAMC,EAAkB,kDAEXH,EAAsC,CACjD,IAAK,CACH,IAAKG,EACL,KAAM,OACN,OAAQ,MACV,EACA,eAAgB,GAChB,cAAe,CAAC,EAChB,sBAAuB,MACzB,EAEO,MAAMJ,CAAqB,CACxB,OAA8BC,EAEtC,aAAc,CAAC,CAOf,sBAAuB,CACrB,YAAK,OAAO,eAAiB,GACtB,IACT,CAQA,UAAUI,EAAuB,CAC/B,YAAK,OAAO,cAAc,KAAKA,CAAM,EAC9B,IACT,CAQA,mBAAmBA,EAAgC,CACjD,YAAK,OAAO,sBAAwBA,EAC7B,IACT,CAQA,aAAaC,EAAmC,CAC9C,YAAK,OAAO,IAAM,CAAE,GAAGL,EAAe,IAAK,GAAGK,CAAU,EACjD,IACT,CAOA,OAAuB,CACrB,OAAO,IAAI,uBAAqB,KAAK,MAAM,CAC7C,CACF",
|
|
6
|
+
"names": ["ContextModuleBuilder_exports", "__export", "ContextModuleBuilder", "DEFAULT_CONFIG", "__toCommonJS", "import_DefaultContextModule", "DEFAULT_CAL_URL", "loader", "calConfig"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=require("./ContextModuleBuilder"),d=require("./DefaultContextModule");describe("ContextModuleBuilder",()=>{const u={url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"};it("should return a default context module",()=>{const e=new o.ContextModuleBuilder().build();expect(e).toBeInstanceOf(d.DefaultContextModule)}),it("should return a custom context module",()=>{const t=new o.ContextModuleBuilder,e={load:jest.fn()},n=t.removeDefaultLoaders().addLoader(e).build();expect(n).toBeInstanceOf(d.DefaultContextModule)}),it("should return a custom context module with a custom typed data loader",()=>{const t=new o.ContextModuleBuilder,e={load:jest.fn()},n=t.removeDefaultLoaders().addTypedDataLoader(e).build();expect(n).toBeInstanceOf(d.DefaultContextModule)}),it("should return a custom context module with a custom config",()=>{const e=new o.ContextModuleBuilder().addCalConfig(u).build();expect(e).toBeInstanceOf(d.DefaultContextModule)})});
|
|
2
|
+
//# sourceMappingURL=ContextModuleBuilder.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ContextModuleBuilder.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { type ContextModuleCalConfig } from \"./config/model/ContextModuleConfig\";\nimport { ContextModuleBuilder } from \"./ContextModuleBuilder\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\ndescribe(\"ContextModuleBuilder\", () => {\n const defaultCalConfig: ContextModuleCalConfig = {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n };\n it(\"should return a default context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n\n const res = contextModuleBuilder.build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n const customLoader = { load: jest.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module with a custom typed data loader\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n const customLoader = { load: jest.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addTypedDataLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module with a custom config\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n\n const res = contextModuleBuilder.addCalConfig(defaultCalConfig).build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n});\n"],
|
|
5
|
+
"mappings": "aACA,IAAAA,EAAqC,kCACrCC,EAAqC,kCAErC,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA2C,CAC/C,IAAK,kDACL,KAAM,OACN,OAAQ,MACV,EACA,GAAG,yCAA0C,IAAM,CAGjD,MAAMC,EAFuB,IAAI,uBAAqB,EAErB,MAAM,EAEvC,OAAOA,CAAG,EAAE,eAAe,sBAAoB,CACjD,CAAC,EAED,GAAG,wCAAyC,IAAM,CAChD,MAAMC,EAAuB,IAAI,uBAC3BC,EAAe,CAAE,KAAM,KAAK,GAAG,CAAE,EAEjCF,EAAMC,EACT,qBAAqB,EACrB,UAAUC,CAAY,EACtB,MAAM,EAET,OAAOF,CAAG,EAAE,eAAe,sBAAoB,CACjD,CAAC,EAED,GAAG,wEAAyE,IAAM,CAChF,MAAMC,EAAuB,IAAI,uBAC3BC,EAAe,CAAE,KAAM,KAAK,GAAG,CAAE,EAEjCF,EAAMC,EACT,qBAAqB,EACrB,mBAAmBC,CAAY,EAC/B,MAAM,EAET,OAAOF,CAAG,EAAE,eAAe,sBAAoB,CACjD,CAAC,EAED,GAAG,6DAA8D,IAAM,CAGrE,MAAMA,EAFuB,IAAI,uBAAqB,EAErB,aAAaD,CAAgB,EAAE,MAAM,EAEtE,OAAOC,CAAG,EAAE,eAAe,sBAAoB,CACjD,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_ContextModuleBuilder", "import_DefaultContextModule", "defaultCalConfig", "res", "contextModuleBuilder", "customLoader"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var L=(o,t)=>{for(var a in t)n(o,a,{get:t[a],enumerable:!0})},u=(o,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of f(t))!T.call(o,e)&&e!==a&&n(o,e,{get:()=>t[e],enumerable:!(r=y(t,e))||r.enumerable});return o};var c=o=>u(n({},"__esModule",{value:!0}),o);var g={};L(g,{DefaultContextModule:()=>D});module.exports=c(g);var i=require("./transaction/di/transactionTypes"),p=require("./trusted-name/di/trustedNameTypes"),d=require("./external-plugin/di/externalPluginTypes"),s=require("./nft/di/nftTypes"),m=require("./shared/model/ClearSignContext"),C=require("./token/di/tokenTypes"),l=require("./typed-data/di/typedDataTypes"),x=require("./di");class D{_container;_loaders;_typedDataLoader;constructor(t){this._container=(0,x.makeContainer)({config:t}),this._loaders=t.defaultLoaders?this._getDefaultLoaders():[],this._loaders.push(...t.customLoaders),this._typedDataLoader=t.customTypedDataLoader??this._getDefaultTypedDataLoader()}_getDefaultLoaders(){return[this._container.get(d.externalPluginTypes.ExternalPluginContextLoader),this._container.get(p.trustedNameTypes.TrustedNameContextLoader),this._container.get(s.nftTypes.NftContextLoader),this._container.get(C.tokenTypes.TokenContextLoader),this._container.get(i.transactionTypes.TransactionContextLoader)]}_getDefaultTypedDataLoader(){return this._container.get(l.typedDataTypes.TypedDataContextLoader)}async getContexts(t){const a=this._loaders.map(e=>e.load(t));return(await Promise.all(a)).flat()}async getContext(t){const a=this._loaders.filter(e=>e.loadField).map(e=>e.loadField(t));return(await Promise.all(a)).find(e=>e!==null)||{type:m.ClearSignContextType.ERROR,error:new Error(`Field type not supported: ${t.type}`)}}async getTypedDataFilters(t){return this._typedDataLoader.load(t)}}0&&(module.exports={DefaultContextModule});
|
|
2
|
+
//# sourceMappingURL=DefaultContextModule.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/DefaultContextModule.ts"],
|
|
4
|
+
"sourcesContent": ["import { type Container } from \"inversify\";\n\nimport type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport { externalPluginTypes } from \"./external-plugin/di/externalPluginTypes\";\nimport { type ExternalPluginContextLoader } from \"./external-plugin/domain/ExternalPluginContextLoader\";\nimport { nftTypes } from \"./nft/di/nftTypes\";\nimport { type NftContextLoader } from \"./nft/domain/NftContextLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { tokenTypes } from \"./token/di/tokenTypes\";\nimport { type TokenContextLoader } from \"./token/domain/TokenContextLoader\";\nimport { type TransactionContextLoader } from \"./transaction/domain/TransactionContextLoader\";\nimport { type TrustedNameContextLoader } from \"./trusted-name/domain/TrustedNameContextLoader\";\nimport { typedDataTypes } from \"./typed-data/di/typedDataTypes\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { makeContainer } from \"./di\";\n\nexport class DefaultContextModule implements ContextModule {\n private _container: Container;\n private _loaders: ContextLoader[];\n private _typedDataLoader: TypedDataContextLoader;\n\n constructor(args: ContextModuleConfig) {\n this._container = makeContainer({ config: args });\n this._loaders = args.defaultLoaders ? this._getDefaultLoaders() : [];\n this._loaders.push(...args.customLoaders);\n this._typedDataLoader =\n args.customTypedDataLoader ?? this._getDefaultTypedDataLoader();\n }\n\n private _getDefaultLoaders(): ContextLoader[] {\n return [\n this._container.get<ExternalPluginContextLoader>(\n externalPluginTypes.ExternalPluginContextLoader,\n ),\n this._container.get<TrustedNameContextLoader>(\n trustedNameTypes.TrustedNameContextLoader,\n ),\n this._container.get<NftContextLoader>(nftTypes.NftContextLoader),\n this._container.get<TokenContextLoader>(tokenTypes.TokenContextLoader),\n this._container.get<TransactionContextLoader>(\n transactionTypes.TransactionContextLoader,\n ),\n ];\n }\n\n private _getDefaultTypedDataLoader(): TypedDataContextLoader {\n return this._container.get<TypedDataContextLoader>(\n typedDataTypes.TypedDataContextLoader,\n );\n }\n\n public async getContexts(\n transaction: TransactionContext,\n ): Promise<ClearSignContext[]> {\n const promises = this._loaders.map((fetcher) => fetcher.load(transaction));\n const responses = await Promise.all(promises);\n return responses.flat();\n }\n\n public async getContext(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext> {\n const promises = this._loaders\n .filter((fetcher) => fetcher.loadField)\n .map((fetcher) => fetcher.loadField!(field));\n const responses = await Promise.all(promises);\n return (\n responses.find((resp) => resp !== null) || {\n type: ClearSignContextType.ERROR,\n error: new Error(`Field type not supported: ${field.type}`),\n }\n );\n }\n\n public async getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext> {\n return this._typedDataLoader.load(typedData);\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAIA,IAAAI,EAAiC,6CACjCC,EAAiC,8CAGjCC,EAAoC,oDAEpCC,EAAyB,6BAGzBC,EAGO,2CAKPC,EAA2B,iCAI3BC,EAA+B,0CAG/BC,EAA8B,gBAEvB,MAAMT,CAA8C,CACjD,WACA,SACA,iBAER,YAAYU,EAA2B,CACrC,KAAK,cAAa,iBAAc,CAAE,OAAQA,CAAK,CAAC,EAChD,KAAK,SAAWA,EAAK,eAAiB,KAAK,mBAAmB,EAAI,CAAC,EACnE,KAAK,SAAS,KAAK,GAAGA,EAAK,aAAa,EACxC,KAAK,iBACHA,EAAK,uBAAyB,KAAK,2BAA2B,CAClE,CAEQ,oBAAsC,CAC5C,MAAO,CACL,KAAK,WAAW,IACd,sBAAoB,2BACtB,EACA,KAAK,WAAW,IACd,mBAAiB,wBACnB,EACA,KAAK,WAAW,IAAsB,WAAS,gBAAgB,EAC/D,KAAK,WAAW,IAAwB,aAAW,kBAAkB,EACrE,KAAK,WAAW,IACd,mBAAiB,wBACnB,CACF,CACF,CAEQ,4BAAqD,CAC3D,OAAO,KAAK,WAAW,IACrB,iBAAe,sBACjB,CACF,CAEA,MAAa,YACXC,EAC6B,CAC7B,MAAMC,EAAW,KAAK,SAAS,IAAKC,GAAYA,EAAQ,KAAKF,CAAW,CAAC,EAEzE,OADkB,MAAM,QAAQ,IAAIC,CAAQ,GAC3B,KAAK,CACxB,CAEA,MAAa,WACXE,EAC2B,CAC3B,MAAMF,EAAW,KAAK,SACnB,OAAQC,GAAYA,EAAQ,SAAS,EACrC,IAAKA,GAAYA,EAAQ,UAAWC,CAAK,CAAC,EAE7C,OADkB,MAAM,QAAQ,IAAIF,CAAQ,GAEhC,KAAMG,GAASA,IAAS,IAAI,GAAK,CACzC,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,6BAA6BD,EAAM,IAAI,EAAE,CAC5D,CAEJ,CAEA,MAAa,oBACXE,EACoC,CACpC,OAAO,KAAK,iBAAiB,KAAKA,CAAS,CAC7C,CACF",
|
|
6
|
+
"names": ["DefaultContextModule_exports", "__export", "DefaultContextModule", "__toCommonJS", "import_transactionTypes", "import_trustedNameTypes", "import_externalPluginTypes", "import_nftTypes", "import_ClearSignContext", "import_tokenTypes", "import_typedDataTypes", "import_di", "args", "transaction", "promises", "fetcher", "field", "resp", "typedData"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=require("./DefaultContextModule");const l=()=>({load:jest.fn(),loadField:jest.fn()});describe("DefaultContextModule",()=>{const s={load:jest.fn()},a={customLoaders:[],defaultLoaders:!1,customTypedDataLoader:s,cal:{url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"}};beforeEach(()=>{jest.restoreAllMocks()}),it("should initialize the context module with all the default loaders",async()=>{const t=await new o.DefaultContextModule(a).getContexts({});expect(t).toEqual([])}),it("should return an empty array when no loaders",async()=>{const t=await new o.DefaultContextModule(a).getContexts({});expect(t).toEqual([])}),it("should call all fetch method from metadata fetcher",async()=>{const e=l();await new o.DefaultContextModule({...a,customLoaders:[e,e]}).getContexts({}),expect(e.load).toHaveBeenCalledTimes(2)}),it("should return an array of context response",async()=>{const e=l(),t=[[{type:"provideERC20Info",payload:"payload1"}],[{type:"provideERC20Info",payload:"payload2"},{type:"plugin",payload:"payload3"}]];jest.spyOn(e,"load").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const n=await new o.DefaultContextModule({...a,customLoaders:[e,e]}).getContexts({});expect(e.load).toHaveBeenCalledTimes(2),expect(n).toEqual(t.flat())}),it("should call the typed data loader",async()=>{await new o.DefaultContextModule({...a,customTypedDataLoader:s}).getTypedDataFilters({}),expect(s.load).toHaveBeenCalledTimes(1)}),it("should return a single context",async()=>{const e=l(),t=[null,{type:"token",payload:"payload"}];jest.spyOn(e,"loadField").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const n=await new o.DefaultContextModule({...a,customLoaders:[e,{load:jest.fn()},e]}).getContext({type:"token"});expect(e.loadField).toHaveBeenCalledTimes(2),expect(n).toEqual({type:"token",payload:"payload"})}),it("context field not supported",async()=>{const e=l(),t=[null,null];jest.spyOn(e,"loadField").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const n=await new o.DefaultContextModule({...a,customLoaders:[e,{load:jest.fn()},e]}).getContext({type:"token"});expect(e.loadField).toHaveBeenCalledTimes(2),expect(n).toEqual({type:"error",error:new Error("Field type not supported: token")})}),it("getField not implemented",async()=>{const t=await new o.DefaultContextModule({...a,customLoaders:[{load:jest.fn()}]}).getContext({type:"token"});expect(t).toEqual({type:"error",error:new Error("Field type not supported: token")})})});
|
|
2
|
+
//# sourceMappingURL=DefaultContextModule.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/DefaultContextModule.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"./shared/model/TransactionContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst contextLoaderStubBuilder = () => {\n return { load: jest.fn(), loadField: jest.fn() };\n};\n\ndescribe(\"DefaultContextModule\", () => {\n const typedDataLoader: TypedDataContextLoader = { load: jest.fn() };\n const defaultContextModuleConfig: ContextModuleConfig = {\n customLoaders: [],\n defaultLoaders: false,\n customTypedDataLoader: typedDataLoader,\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n };\n\n beforeEach(() => {\n jest.restoreAllMocks();\n });\n\n it(\"should initialize the context module with all the default loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(res).toEqual([]);\n });\n\n it(\"should return an empty array when no loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(res).toEqual([]);\n });\n\n it(\"should call all fetch method from metadata fetcher\", async () => {\n const loader = contextLoaderStubBuilder();\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n await contextModule.getContexts({} as TransactionContext);\n\n expect(loader.load).toHaveBeenCalledTimes(2);\n });\n\n it(\"should return an array of context response\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [\n [{ type: \"provideERC20Info\", payload: \"payload1\" }],\n [\n { type: \"provideERC20Info\", payload: \"payload2\" },\n { type: \"plugin\", payload: \"payload3\" },\n ],\n ];\n jest\n .spyOn(loader, \"load\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n const res = await contextModule.getContexts({} as TransactionContext);\n\n expect(loader.load).toHaveBeenCalledTimes(2);\n expect(res).toEqual(responses.flat());\n });\n\n it(\"should call the typed data loader\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customTypedDataLoader: typedDataLoader,\n });\n\n await contextModule.getTypedDataFilters({} as TypedDataContext);\n\n expect(typedDataLoader.load).toHaveBeenCalledTimes(1);\n });\n\n it(\"should return a single context\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [null, { type: \"token\", payload: \"payload\" }];\n jest\n .spyOn(loader, \"loadField\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, { load: jest.fn() }, loader],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(loader.loadField).toHaveBeenCalledTimes(2);\n expect(res).toEqual({ type: \"token\", payload: \"payload\" });\n });\n\n it(\"context field not supported\", async () => {\n const loader = contextLoaderStubBuilder();\n const responses = [null, null];\n jest\n .spyOn(loader, \"loadField\")\n .mockResolvedValueOnce(responses[0])\n .mockResolvedValueOnce(responses[1]);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, { load: jest.fn() }, loader],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(loader.loadField).toHaveBeenCalledTimes(2);\n expect(res).toEqual({\n type: \"error\",\n error: new Error(\"Field type not supported: token\"),\n });\n });\n\n it(\"getField not implemented\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [{ load: jest.fn() }],\n });\n\n const res = await contextModule.getContext({\n type: \"token\",\n } as TransactionFieldContext);\n\n expect(res).toEqual({\n type: \"error\",\n error: new Error(\"Field type not supported: token\"),\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAOA,IAAAA,EAAqC,kCAErC,MAAMC,EAA2B,KACxB,CAAE,KAAM,KAAK,GAAG,EAAG,UAAW,KAAK,GAAG,CAAE,GAGjD,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA0C,CAAE,KAAM,KAAK,GAAG,CAAE,EAC5DC,EAAkD,CACtD,cAAe,CAAC,EAChB,eAAgB,GAChB,sBAAuBD,EACvB,IAAK,CACH,IAAK,kDACL,KAAM,OACN,OAAQ,MACV,CACF,EAEA,WAAW,IAAM,CACf,KAAK,gBAAgB,CACvB,CAAC,EAED,GAAG,oEAAqE,SAAY,CAGlF,MAAME,EAAM,MAFU,IAAI,uBAAqBD,CAA0B,EAEzC,YAAY,CAAC,CAAuB,EAEpE,OAAOC,CAAG,EAAE,QAAQ,CAAC,CAAC,CACxB,CAAC,EAED,GAAG,+CAAgD,SAAY,CAG7D,MAAMA,EAAM,MAFU,IAAI,uBAAqBD,CAA0B,EAEzC,YAAY,CAAC,CAAuB,EAEpE,OAAOC,CAAG,EAAE,QAAQ,CAAC,CAAC,CACxB,CAAC,EAED,GAAG,qDAAsD,SAAY,CACnE,MAAMC,EAASJ,EAAyB,EAMxC,MALsB,IAAI,uBAAqB,CAC7C,GAAGE,EACH,cAAe,CAACE,EAAQA,CAAM,CAChC,CAAC,EAEmB,YAAY,CAAC,CAAuB,EAExD,OAAOA,EAAO,IAAI,EAAE,sBAAsB,CAAC,CAC7C,CAAC,EAED,GAAG,6CAA8C,SAAY,CAC3D,MAAMA,EAASJ,EAAyB,EAClCK,EAAY,CAChB,CAAC,CAAE,KAAM,mBAAoB,QAAS,UAAW,CAAC,EAClD,CACE,CAAE,KAAM,mBAAoB,QAAS,UAAW,EAChD,CAAE,KAAM,SAAU,QAAS,UAAW,CACxC,CACF,EACA,KACG,MAAMD,EAAQ,MAAM,EACpB,sBAAsBC,EAAU,CAAC,CAAC,EAClC,sBAAsBA,EAAU,CAAC,CAAC,EAMrC,MAAMF,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAACE,EAAQA,CAAM,CAChC,CAAC,EAE+B,YAAY,CAAC,CAAuB,EAEpE,OAAOA,EAAO,IAAI,EAAE,sBAAsB,CAAC,EAC3C,OAAOD,CAAG,EAAE,QAAQE,EAAU,KAAK,CAAC,CACtC,CAAC,EAED,GAAG,oCAAqC,SAAY,CAMlD,MALsB,IAAI,uBAAqB,CAC7C,GAAGH,EACH,sBAAuBD,CACzB,CAAC,EAEmB,oBAAoB,CAAC,CAAqB,EAE9D,OAAOA,EAAgB,IAAI,EAAE,sBAAsB,CAAC,CACtD,CAAC,EAED,GAAG,iCAAkC,SAAY,CAC/C,MAAMG,EAASJ,EAAyB,EAClCK,EAAY,CAAC,KAAM,CAAE,KAAM,QAAS,QAAS,SAAU,CAAC,EAC9D,KACG,MAAMD,EAAQ,WAAW,EACzB,sBAAsBC,EAAU,CAAC,CAAC,EAClC,sBAAsBA,EAAU,CAAC,CAAC,EAMrC,MAAMF,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAACE,EAAQ,CAAE,KAAM,KAAK,GAAG,CAAE,EAAGA,CAAM,CACrD,CAAC,EAE+B,WAAW,CACzC,KAAM,OACR,CAA4B,EAE5B,OAAOA,EAAO,SAAS,EAAE,sBAAsB,CAAC,EAChD,OAAOD,CAAG,EAAE,QAAQ,CAAE,KAAM,QAAS,QAAS,SAAU,CAAC,CAC3D,CAAC,EAED,GAAG,8BAA+B,SAAY,CAC5C,MAAMC,EAASJ,EAAyB,EAClCK,EAAY,CAAC,KAAM,IAAI,EAC7B,KACG,MAAMD,EAAQ,WAAW,EACzB,sBAAsBC,EAAU,CAAC,CAAC,EAClC,sBAAsBA,EAAU,CAAC,CAAC,EAMrC,MAAMF,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAACE,EAAQ,CAAE,KAAM,KAAK,GAAG,CAAE,EAAGA,CAAM,CACrD,CAAC,EAE+B,WAAW,CACzC,KAAM,OACR,CAA4B,EAE5B,OAAOA,EAAO,SAAS,EAAE,sBAAsB,CAAC,EAChD,OAAOD,CAAG,EAAE,QAAQ,CAClB,KAAM,QACN,MAAO,IAAI,MAAM,iCAAiC,CACpD,CAAC,CACH,CAAC,EAED,GAAG,2BAA4B,SAAY,CAMzC,MAAMA,EAAM,MALU,IAAI,uBAAqB,CAC7C,GAAGD,EACH,cAAe,CAAC,CAAE,KAAM,KAAK,GAAG,CAAE,CAAC,CACrC,CAAC,EAE+B,WAAW,CACzC,KAAM,OACR,CAA4B,EAE5B,OAAOC,CAAG,EAAE,QAAQ,CAClB,KAAM,QACN,MAAO,IAAI,MAAM,iCAAiC,CACpD,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_DefaultContextModule", "contextLoaderStubBuilder", "typedDataLoader", "defaultContextModuleConfig", "res", "loader", "responses"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var l=(n,o)=>{for(var e in o)r(n,e,{get:o[e],enumerable:!0})},m=(n,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of u(o))!g.call(n,t)&&t!==e&&r(n,t,{get:()=>o[t],enumerable:!(i=d(o,t))||i.enumerable});return n};var p=n=>m(r({},"__esModule",{value:!0}),n);var a={};l(a,{configModuleFactory:()=>M});module.exports=p(a);var f=require("inversify"),C=require("./configTypes");const M=n=>new f.ContainerModule((o,e,i,t)=>{o(C.configTypes.Config).toConstantValue(n)});0&&(module.exports={configModuleFactory});
|
|
2
|
+
//# sourceMappingURL=configModuleFactory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/config/di/configModuleFactory.ts"],
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\n\nimport { configTypes } from \"./configTypes\";\n\nexport const configModuleFactory = (config: ContextModuleConfig) =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind<ContextModuleConfig>(configTypes.Config).toConstantValue(config);\n });\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAIhCC,EAA4B,yBAErB,MAAMH,EAAuBI,GAClC,IAAI,kBAAgB,CAACC,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAA0B,cAAY,MAAM,EAAE,gBAAgBD,CAAM,CACtE,CAAC",
|
|
6
|
+
"names": ["configModuleFactory_exports", "__export", "configModuleFactory", "__toCommonJS", "import_inversify", "import_configTypes", "config", "bind", "_unbind", "_isBound", "_rebind"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var s=(f,o)=>{for(var c in o)g(f,c,{get:o[c],enumerable:!0})},t=(f,o,c,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of p(o))!r.call(f,n)&&n!==c&&g(f,n,{get:()=>o[n],enumerable:!(i=e(o,n))||i.enumerable});return f};var y=f=>t(g({},"__esModule",{value:!0}),f);var l={};s(l,{configTypes:()=>b});module.exports=y(l);const b={Config:Symbol.for("config")};0&&(module.exports={configTypes});
|
|
2
|
+
//# sourceMappingURL=configTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/config/di/configTypes.ts"],
|
|
4
|
+
"sourcesContent": ["export const configTypes = {\n Config: Symbol.for(\"config\"),\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAc,CACzB,OAAQ,OAAO,IAAI,QAAQ,CAC7B",
|
|
6
|
+
"names": ["configTypes_exports", "__export", "configTypes", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var p=(o,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of C(e))!l.call(o,t)&&t!==n&&d(o,t,{get:()=>e[t],enumerable:!(a=r(e,t))||a.enumerable});return o};var x=o=>p(d({},"__esModule",{value:!0}),o);var u={};module.exports=x(u);
|
|
2
|
+
//# sourceMappingURL=ContextModuleConfig.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/config/model/ContextModuleConfig.ts"],
|
|
4
|
+
"sourcesContent": ["import { type ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport { type TypedDataContextLoader } from \"@/typed-data/domain/TypedDataContextLoader\";\n\nexport type ContextModuleCalMode = \"prod\" | \"test\";\nexport type ContextModuleCalBranch = \"next\" | \"main\" | \"demo\";\n\nexport type ContextModuleCalConfig = {\n url: string;\n mode: ContextModuleCalMode;\n branch: ContextModuleCalBranch;\n};\n\nexport type ContextModuleConfig = {\n cal: ContextModuleCalConfig;\n defaultLoaders: boolean;\n customLoaders: ContextLoader[];\n customTypedDataLoader?: TypedDataContextLoader;\n};\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["ContextModuleConfig_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var g=(t,o)=>{for(var e in o)n(t,e,{get:o[e],enumerable:!0})},F=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of y(o))!C.call(t,r)&&r!==e&&n(t,r,{get:()=>o[r],enumerable:!(a=M(o,r))||a.enumerable});return t};var s=t=>F(n({},"__esModule",{value:!0}),t);var x={};g(x,{makeContainer:()=>k});module.exports=s(x);var i=require("inversify"),m=require("./config/di/configModuleFactory"),f=require("./external-plugin/di/externalPluginModuleFactory"),c=require("./nft/di/nftModuleFactory"),p=require("./token/di/tokenModuleFactory"),d=require("./transaction/di/transactionModuleFactory"),l=require("./trusted-name/di/trustedNameModuleFactory"),u=require("./typed-data/di/typedDataModuleFactory");const k=({config:t})=>{const o=new i.Container;return o.load((0,m.configModuleFactory)(t),(0,f.externalPluginModuleFactory)(),(0,c.nftModuleFactory)(),(0,p.tokenModuleFactory)(),(0,d.transactionModuleFactory)(),(0,l.trustedNameModuleFactory)(),(0,u.typedDataModuleFactory)()),o};0&&(module.exports={makeContainer});
|
|
2
|
+
//# sourceMappingURL=di.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/di.ts"],
|
|
4
|
+
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { configModuleFactory } from \"@/config/di/configModuleFactory\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { externalPluginModuleFactory } from \"@/external-plugin/di/externalPluginModuleFactory\";\nimport { nftModuleFactory } from \"@/nft/di/nftModuleFactory\";\nimport { tokenModuleFactory } from \"@/token/di/tokenModuleFactory\";\nimport { transactionModuleFactory } from \"@/transaction/di/transactionModuleFactory\";\nimport { trustedNameModuleFactory } from \"@/trusted-name/di/trustedNameModuleFactory\";\nimport { typedDataModuleFactory } from \"@/typed-data/di/typedDataModuleFactory\";\n\ntype MakeContainerArgs = {\n config: ContextModuleConfig;\n};\n\nexport const makeContainer = ({ config }: MakeContainerArgs) => {\n const container = new Container();\n\n container.load(\n configModuleFactory(config),\n externalPluginModuleFactory(),\n nftModuleFactory(),\n tokenModuleFactory(),\n transactionModuleFactory(),\n trustedNameModuleFactory(),\n typedDataModuleFactory(),\n );\n\n return container;\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0B,qBAE1BC,EAAoC,2CAEpCC,EAA4C,4DAC5CC,EAAiC,qCACjCC,EAAmC,yCACnCC,EAAyC,qDACzCC,EAAyC,sDACzCC,EAAuC,kDAMhC,MAAMT,EAAgB,CAAC,CAAE,OAAAU,CAAO,IAAyB,CAC9D,MAAMC,EAAY,IAAI,YAEtB,OAAAA,EAAU,QACR,uBAAoBD,CAAM,KAC1B,+BAA4B,KAC5B,oBAAiB,KACjB,sBAAmB,KACnB,4BAAyB,KACzB,4BAAyB,KACzB,0BAAuB,CACzB,EAEOC,CACT",
|
|
6
|
+
"names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_configModuleFactory", "import_externalPluginModuleFactory", "import_nftModuleFactory", "import_tokenModuleFactory", "import_transactionModuleFactory", "import_trustedNameModuleFactory", "import_typedDataModuleFactory", "config", "container"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var o=(r,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of a(t))!g.call(r,e)&&e!==s&&i(r,e,{get:()=>t[e],enumerable:!(n=c(t,e))||n.enumerable});return r};var d=r=>o(i({},"__esModule",{value:!0}),r);var l={};module.exports=d(l);
|
|
2
|
+
//# sourceMappingURL=DAppDto.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/external-plugin/data/DAppDto.ts"],
|
|
4
|
+
"sourcesContent": ["export interface DAppDto {\n b2c: B2c;\n abis: Abis;\n b2c_signatures: B2cSignatures;\n}\n\nexport interface B2c {\n blockchainName: string;\n chainId: number;\n contracts: Contract[];\n name: string;\n}\n\ninterface Contract {\n address: string;\n contractName: string;\n selectors: { [selector: string]: ContractSelector };\n}\n\ninterface ContractSelector {\n erc20OfInterest: string[];\n method: string;\n plugin: string;\n}\n\nexport interface Abis {\n [address: string]: object[];\n}\n\nexport interface B2cSignatures {\n [address: string]: {\n [selector: string]: B2cSignature;\n };\n}\n\ninterface B2cSignature {\n plugin: string;\n serialized_data: string;\n signature: string;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["DAppDto_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var f=(r,e,a,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of i(e))!s.call(r,t)&&t!==a&&o(r,t,{get:()=>e[t],enumerable:!(p=n(e,t))||p.enumerable});return r};var m=r=>f(o({},"__esModule",{value:!0}),r);var D={};module.exports=m(D);
|
|
2
|
+
//# sourceMappingURL=ExternalPluginDataSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/external-plugin/data/ExternalPluginDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\nimport { type Either } from \"purify-ts\";\n\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\n\nexport type GetDappInfos = {\n address: string;\n selector: HexaString;\n chainId: number;\n};\n\nexport interface ExternalPluginDataSource {\n getDappInfos(\n params: GetDappInfos,\n ): Promise<Either<Error, DappInfos | undefined>>;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["ExternalPluginDataSource_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var _=Object.create;var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var L=(e,t)=>{for(var o in t)f(e,o,{get:t[o],enumerable:!0})},D=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of w(t))!G.call(e,r)&&r!==o&&f(e,r,{get:()=>t[r],enumerable:!(i=g(t,r))||i.enumerable});return e};var C=(e,t,o)=>(o=e!=null?_(A(e)):{},D(t||!e||!e.__esModule?f(o,"default",{value:e,enumerable:!0}):o,e)),M=e=>D(f({},"__esModule",{value:!0}),e),h=(e,t,o,i)=>{for(var r=i>1?void 0:i?g(t,o):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=(i?s(t,o,r):s(r))||r);return i&&r&&f(t,o,r),r},b=(e,t)=>(o,i)=>t(o,i,e);var $={};L($,{HttpExternalPluginDataSource:()=>p});module.exports=M($);var x=C(require("axios")),c=require("inversify"),n=require("purify-ts"),E=require("../../config/di/configTypes"),I=C(require("../../../package.json"));let p=class{constructor(t){this.config=t}async getDappInfos({chainId:t,address:o,selector:i}){try{const r=await x.default.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"b2c,b2c_signatures,abis",chain_id:t,contracts:o},headers:{"X-Ledger-Client-Version":`context-module/${I.default.version}`}});if(!r.data[0])return(0,n.Right)(void 0);o=o.toLowerCase(),i=`0x${i.slice(2).toLowerCase()}`;const{erc20OfInterest:a,method:s,plugin:m}=r.data[0].b2c?.contracts?.find(y=>y.address===o)?.selectors?.[i]||{},{signature:l,serialized_data:u}=r.data[0].b2c_signatures?.[o]?.[i]||{};if(!a||!s||!m||!l||!u)return(0,n.Right)(void 0);const d=r.data[0].abis?.[o];return d?(0,n.Right)({selectorDetails:{method:s,plugin:m,erc20OfInterest:a,signature:l,serializedData:u},abi:d}):(0,n.Right)(void 0)}catch{return(0,n.Left)(new Error("[ContextModule] HttpExternalPluginDataSource: Error fetching dapp infos"))}}};p=h([(0,c.injectable)(),b(0,(0,c.inject)(E.configTypes.Config))],p);0&&(module.exports={HttpExternalPluginDataSource});
|
|
2
|
+
//# sourceMappingURL=HttpExternalPluginDataSource.js.map
|