@ledgerhq/context-module 0.0.0-develop-20240926001103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -0
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +20 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +63 -0
- package/lib/cjs/src/ContextModule.d.ts +9 -0
- package/lib/cjs/src/ContextModule.d.ts.map +1 -0
- package/lib/cjs/src/ContextModule.js +3 -0
- package/lib/cjs/src/ContextModule.js.map +1 -0
- package/lib/cjs/src/ContextModuleBuilder.d.ts +35 -0
- package/lib/cjs/src/ContextModuleBuilder.d.ts.map +1 -0
- package/lib/cjs/src/ContextModuleBuilder.js +67 -0
- package/lib/cjs/src/ContextModuleBuilder.js.map +1 -0
- package/lib/cjs/src/DefaultContextModule.d.ts +20 -0
- package/lib/cjs/src/DefaultContextModule.d.ts.map +1 -0
- package/lib/cjs/src/DefaultContextModule.js +21 -0
- package/lib/cjs/src/DefaultContextModule.js.map +1 -0
- package/lib/cjs/src/di.d.ts +3 -0
- package/lib/cjs/src/di.d.ts.map +1 -0
- package/lib/cjs/src/di.js +16 -0
- package/lib/cjs/src/di.js.map +1 -0
- package/lib/cjs/src/external-plugin/data/DAppDto.d.ts +38 -0
- package/lib/cjs/src/external-plugin/data/DAppDto.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/data/DAppDto.js +3 -0
- package/lib/cjs/src/external-plugin/data/DAppDto.js.map +1 -0
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.d.ts +12 -0
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js +3 -0
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js.map +1 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +8 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +71 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +1 -0
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.d.ts +3 -0
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +13 -0
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +1 -0
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.d.ts +5 -0
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.js +8 -0
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.js.map +1 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +15 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +136 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +1 -0
- package/lib/cjs/src/external-plugin/model/DappInfos.d.ts +6 -0
- package/lib/cjs/src/external-plugin/model/DappInfos.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/model/DappInfos.js +3 -0
- package/lib/cjs/src/external-plugin/model/DappInfos.js.map +1 -0
- package/lib/cjs/src/external-plugin/model/SelectorDetails.d.ts +8 -0
- package/lib/cjs/src/external-plugin/model/SelectorDetails.d.ts.map +1 -0
- package/lib/cjs/src/external-plugin/model/SelectorDetails.js +3 -0
- package/lib/cjs/src/external-plugin/model/SelectorDetails.js.map +1 -0
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts +9 -0
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +1 -0
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js +3 -0
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js.map +1 -0
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +6 -0
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +1 -0
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js +40 -0
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js.map +1 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts +3 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +1 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js +13 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js.map +1 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts +5 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts.map +1 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js +8 -0
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js.map +1 -0
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +11 -0
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +1 -0
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js +66 -0
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js.map +1 -0
- package/lib/cjs/src/index.d.ts +13 -0
- package/lib/cjs/src/index.d.ts.map +1 -0
- package/lib/cjs/src/index.js +29 -0
- package/lib/cjs/src/index.js.map +1 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.d.ts +7 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.d.ts.map +1 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.js +57 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +1 -0
- package/lib/cjs/src/nft/data/NftDataSource.d.ts +15 -0
- package/lib/cjs/src/nft/data/NftDataSource.d.ts.map +1 -0
- package/lib/cjs/src/nft/data/NftDataSource.js +3 -0
- package/lib/cjs/src/nft/data/NftDataSource.js.map +1 -0
- package/lib/cjs/src/nft/di/nftModuleFactory.d.ts +3 -0
- package/lib/cjs/src/nft/di/nftModuleFactory.d.ts.map +1 -0
- package/lib/cjs/src/nft/di/nftModuleFactory.js +13 -0
- package/lib/cjs/src/nft/di/nftModuleFactory.js.map +1 -0
- package/lib/cjs/src/nft/di/nftTypes.d.ts +5 -0
- package/lib/cjs/src/nft/di/nftTypes.d.ts.map +1 -0
- package/lib/cjs/src/nft/di/nftTypes.js +8 -0
- package/lib/cjs/src/nft/di/nftTypes.js.map +1 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.d.ts +11 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.d.ts.map +1 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.js +111 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.js.map +1 -0
- package/lib/cjs/src/shared/domain/ContextLoader.d.ts +6 -0
- package/lib/cjs/src/shared/domain/ContextLoader.d.ts.map +1 -0
- package/lib/cjs/src/shared/domain/ContextLoader.js +3 -0
- package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -0
- package/lib/cjs/src/shared/model/ClearSignContext.d.ts +21 -0
- package/lib/cjs/src/shared/model/ClearSignContext.d.ts.map +1 -0
- package/lib/cjs/src/shared/model/ClearSignContext.js +13 -0
- package/lib/cjs/src/shared/model/ClearSignContext.js.map +1 -0
- package/lib/cjs/src/shared/model/TransactionContext.d.ts +6 -0
- package/lib/cjs/src/shared/model/TransactionContext.d.ts.map +1 -0
- package/lib/cjs/src/shared/model/TransactionContext.js +3 -0
- package/lib/cjs/src/shared/model/TransactionContext.js.map +1 -0
- package/lib/cjs/src/shared/model/TransactionSubset.d.ts +6 -0
- package/lib/cjs/src/shared/model/TransactionSubset.d.ts.map +1 -0
- package/lib/cjs/src/shared/model/TransactionSubset.js +3 -0
- package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -0
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.d.ts +33 -0
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -0
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +6 -0
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +1 -0
- package/lib/cjs/src/shared/model/TypedDataContext.d.ts +16 -0
- package/lib/cjs/src/shared/model/TypedDataContext.d.ts.map +1 -0
- package/lib/cjs/src/shared/model/TypedDataContext.js +3 -0
- package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -0
- package/lib/cjs/src/shared/utils/HexStringUtils.d.ts +4 -0
- package/lib/cjs/src/shared/utils/HexStringUtils.d.ts.map +1 -0
- package/lib/cjs/src/shared/utils/HexStringUtils.js +15 -0
- package/lib/cjs/src/shared/utils/HexStringUtils.js.map +1 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.d.ts +6 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.d.ts.map +1 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.js +70 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +1 -0
- package/lib/cjs/src/token/data/TokenDataSource.d.ts +9 -0
- package/lib/cjs/src/token/data/TokenDataSource.d.ts.map +1 -0
- package/lib/cjs/src/token/data/TokenDataSource.js +3 -0
- package/lib/cjs/src/token/data/TokenDataSource.js.map +1 -0
- package/lib/cjs/src/token/data/TokenDto.d.ts +6 -0
- package/lib/cjs/src/token/data/TokenDto.d.ts.map +1 -0
- package/lib/cjs/src/token/data/TokenDto.js +3 -0
- package/lib/cjs/src/token/data/TokenDto.js.map +1 -0
- package/lib/cjs/src/token/di/tokenModuleFactory.d.ts +3 -0
- package/lib/cjs/src/token/di/tokenModuleFactory.d.ts.map +1 -0
- package/lib/cjs/src/token/di/tokenModuleFactory.js +13 -0
- package/lib/cjs/src/token/di/tokenModuleFactory.js.map +1 -0
- package/lib/cjs/src/token/di/tokenTypes.d.ts +5 -0
- package/lib/cjs/src/token/di/tokenTypes.d.ts.map +1 -0
- package/lib/cjs/src/token/di/tokenTypes.js +8 -0
- package/lib/cjs/src/token/di/tokenTypes.js.map +1 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.d.ts +15 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.d.ts.map +1 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.js +74 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.js.map +1 -0
- package/lib/cjs/src/typed-data/data/FiltersDto.d.ts +35 -0
- package/lib/cjs/src/typed-data/data/FiltersDto.d.ts.map +1 -0
- package/lib/cjs/src/typed-data/data/FiltersDto.js +3 -0
- package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.d.ts +10 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +128 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +1 -0
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.d.ts +17 -0
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -0
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +3 -0
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -0
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.d.ts +3 -0
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.d.ts.map +1 -0
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +13 -0
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +1 -0
- package/lib/cjs/src/typed-data/di/typedDataTypes.d.ts +5 -0
- package/lib/cjs/src/typed-data/di/typedDataTypes.d.ts.map +1 -0
- package/lib/cjs/src/typed-data/di/typedDataTypes.js +8 -0
- package/lib/cjs/src/typed-data/di/typedDataTypes.js.map +1 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +13 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +127 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +1 -0
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.d.ts +6 -0
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.d.ts.map +1 -0
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js +3 -0
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js.map +1 -0
- package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/esm/index.d.ts +3 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +4 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/package.json +63 -0
- package/lib/esm/src/ContextModule.d.ts +9 -0
- package/lib/esm/src/ContextModule.d.ts.map +1 -0
- package/lib/esm/src/ContextModule.js +2 -0
- package/lib/esm/src/ContextModule.js.map +1 -0
- package/lib/esm/src/ContextModuleBuilder.d.ts +35 -0
- package/lib/esm/src/ContextModuleBuilder.d.ts.map +1 -0
- package/lib/esm/src/ContextModuleBuilder.js +63 -0
- package/lib/esm/src/ContextModuleBuilder.js.map +1 -0
- package/lib/esm/src/DefaultContextModule.d.ts +20 -0
- package/lib/esm/src/DefaultContextModule.d.ts.map +1 -0
- package/lib/esm/src/DefaultContextModule.js +17 -0
- package/lib/esm/src/DefaultContextModule.js.map +1 -0
- package/lib/esm/src/di.d.ts +3 -0
- package/lib/esm/src/di.d.ts.map +1 -0
- package/lib/esm/src/di.js +12 -0
- package/lib/esm/src/di.js.map +1 -0
- package/lib/esm/src/external-plugin/data/DAppDto.d.ts +38 -0
- package/lib/esm/src/external-plugin/data/DAppDto.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/data/DAppDto.js +2 -0
- package/lib/esm/src/external-plugin/data/DAppDto.js.map +1 -0
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts +12 -0
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js +2 -0
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js.map +1 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +8 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +65 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +1 -0
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts +3 -0
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +9 -0
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +1 -0
- package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts +5 -0
- package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/di/externalPluginTypes.js +5 -0
- package/lib/esm/src/external-plugin/di/externalPluginTypes.js.map +1 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +15 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +133 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +1 -0
- package/lib/esm/src/external-plugin/model/DappInfos.d.ts +6 -0
- package/lib/esm/src/external-plugin/model/DappInfos.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/model/DappInfos.js +2 -0
- package/lib/esm/src/external-plugin/model/DappInfos.js.map +1 -0
- package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts +8 -0
- package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts.map +1 -0
- package/lib/esm/src/external-plugin/model/SelectorDetails.js +2 -0
- package/lib/esm/src/external-plugin/model/SelectorDetails.js.map +1 -0
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts +9 -0
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +1 -0
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js +2 -0
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js.map +1 -0
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +6 -0
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +1 -0
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js +34 -0
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js.map +1 -0
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts +3 -0
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +1 -0
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js +9 -0
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js.map +1 -0
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts +5 -0
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts.map +1 -0
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.js +5 -0
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.js.map +1 -0
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +11 -0
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +1 -0
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js +63 -0
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js.map +1 -0
- package/lib/esm/src/index.d.ts +13 -0
- package/lib/esm/src/index.d.ts.map +1 -0
- package/lib/esm/src/index.js +13 -0
- package/lib/esm/src/index.js.map +1 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.d.ts +7 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.d.ts.map +1 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.js +51 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.js.map +1 -0
- package/lib/esm/src/nft/data/NftDataSource.d.ts +15 -0
- package/lib/esm/src/nft/data/NftDataSource.d.ts.map +1 -0
- package/lib/esm/src/nft/data/NftDataSource.js +2 -0
- package/lib/esm/src/nft/data/NftDataSource.js.map +1 -0
- package/lib/esm/src/nft/di/nftModuleFactory.d.ts +3 -0
- package/lib/esm/src/nft/di/nftModuleFactory.d.ts.map +1 -0
- package/lib/esm/src/nft/di/nftModuleFactory.js +9 -0
- package/lib/esm/src/nft/di/nftModuleFactory.js.map +1 -0
- package/lib/esm/src/nft/di/nftTypes.d.ts +5 -0
- package/lib/esm/src/nft/di/nftTypes.d.ts.map +1 -0
- package/lib/esm/src/nft/di/nftTypes.js +5 -0
- package/lib/esm/src/nft/di/nftTypes.js.map +1 -0
- package/lib/esm/src/nft/domain/NftContextLoader.d.ts +11 -0
- package/lib/esm/src/nft/domain/NftContextLoader.d.ts.map +1 -0
- package/lib/esm/src/nft/domain/NftContextLoader.js +108 -0
- package/lib/esm/src/nft/domain/NftContextLoader.js.map +1 -0
- package/lib/esm/src/shared/domain/ContextLoader.d.ts +6 -0
- package/lib/esm/src/shared/domain/ContextLoader.d.ts.map +1 -0
- package/lib/esm/src/shared/domain/ContextLoader.js +2 -0
- package/lib/esm/src/shared/domain/ContextLoader.js.map +1 -0
- package/lib/esm/src/shared/model/ClearSignContext.d.ts +21 -0
- package/lib/esm/src/shared/model/ClearSignContext.d.ts.map +1 -0
- package/lib/esm/src/shared/model/ClearSignContext.js +10 -0
- package/lib/esm/src/shared/model/ClearSignContext.js.map +1 -0
- package/lib/esm/src/shared/model/TransactionContext.d.ts +6 -0
- package/lib/esm/src/shared/model/TransactionContext.d.ts.map +1 -0
- package/lib/esm/src/shared/model/TransactionContext.js +2 -0
- package/lib/esm/src/shared/model/TransactionContext.js.map +1 -0
- package/lib/esm/src/shared/model/TransactionSubset.d.ts +6 -0
- package/lib/esm/src/shared/model/TransactionSubset.d.ts.map +1 -0
- package/lib/esm/src/shared/model/TransactionSubset.js +2 -0
- package/lib/esm/src/shared/model/TransactionSubset.js.map +1 -0
- package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts +33 -0
- package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -0
- package/lib/esm/src/shared/model/TypedDataClearSignContext.js +3 -0
- package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +1 -0
- package/lib/esm/src/shared/model/TypedDataContext.d.ts +16 -0
- package/lib/esm/src/shared/model/TypedDataContext.d.ts.map +1 -0
- package/lib/esm/src/shared/model/TypedDataContext.js +2 -0
- package/lib/esm/src/shared/model/TypedDataContext.js.map +1 -0
- package/lib/esm/src/shared/utils/HexStringUtils.d.ts +4 -0
- package/lib/esm/src/shared/utils/HexStringUtils.d.ts.map +1 -0
- package/lib/esm/src/shared/utils/HexStringUtils.js +11 -0
- package/lib/esm/src/shared/utils/HexStringUtils.js.map +1 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.d.ts +6 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.d.ts.map +1 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.js +64 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.js.map +1 -0
- package/lib/esm/src/token/data/TokenDataSource.d.ts +9 -0
- package/lib/esm/src/token/data/TokenDataSource.d.ts.map +1 -0
- package/lib/esm/src/token/data/TokenDataSource.js +2 -0
- package/lib/esm/src/token/data/TokenDataSource.js.map +1 -0
- package/lib/esm/src/token/data/TokenDto.d.ts +6 -0
- package/lib/esm/src/token/data/TokenDto.d.ts.map +1 -0
- package/lib/esm/src/token/data/TokenDto.js +2 -0
- package/lib/esm/src/token/data/TokenDto.js.map +1 -0
- package/lib/esm/src/token/di/tokenModuleFactory.d.ts +3 -0
- package/lib/esm/src/token/di/tokenModuleFactory.d.ts.map +1 -0
- package/lib/esm/src/token/di/tokenModuleFactory.js +9 -0
- package/lib/esm/src/token/di/tokenModuleFactory.js.map +1 -0
- package/lib/esm/src/token/di/tokenTypes.d.ts +5 -0
- package/lib/esm/src/token/di/tokenTypes.d.ts.map +1 -0
- package/lib/esm/src/token/di/tokenTypes.js +5 -0
- package/lib/esm/src/token/di/tokenTypes.js.map +1 -0
- package/lib/esm/src/token/domain/TokenContextLoader.d.ts +15 -0
- package/lib/esm/src/token/domain/TokenContextLoader.d.ts.map +1 -0
- package/lib/esm/src/token/domain/TokenContextLoader.js +71 -0
- package/lib/esm/src/token/domain/TokenContextLoader.js.map +1 -0
- package/lib/esm/src/typed-data/data/FiltersDto.d.ts +35 -0
- package/lib/esm/src/typed-data/data/FiltersDto.d.ts.map +1 -0
- package/lib/esm/src/typed-data/data/FiltersDto.js +2 -0
- package/lib/esm/src/typed-data/data/FiltersDto.js.map +1 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts +10 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +122 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +1 -0
- package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts +17 -0
- package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -0
- package/lib/esm/src/typed-data/data/TypedDataDataSource.js +2 -0
- package/lib/esm/src/typed-data/data/TypedDataDataSource.js.map +1 -0
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts +3 -0
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts.map +1 -0
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +9 -0
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +1 -0
- package/lib/esm/src/typed-data/di/typedDataTypes.d.ts +5 -0
- package/lib/esm/src/typed-data/di/typedDataTypes.d.ts.map +1 -0
- package/lib/esm/src/typed-data/di/typedDataTypes.js +5 -0
- package/lib/esm/src/typed-data/di/typedDataTypes.js.map +1 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +13 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +124 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +1 -0
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts +6 -0
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts.map +1 -0
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js +2 -0
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js.map +1 -0
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ContextLoader } from "./shared/domain/ContextLoader";
|
|
2
|
+
import { type TypedDataContextLoader } from "./typed-data/domain/TypedDataContextLoader";
|
|
3
|
+
import { ContextModule } from "./ContextModule";
|
|
4
|
+
export declare class ContextModuleBuilder {
|
|
5
|
+
private customLoaders;
|
|
6
|
+
private defaultLoaders;
|
|
7
|
+
private typedDataLoader;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Remove default loaders from the list of loaders
|
|
11
|
+
*
|
|
12
|
+
* @returns this
|
|
13
|
+
*/
|
|
14
|
+
withoutDefaultLoaders(): this;
|
|
15
|
+
/**
|
|
16
|
+
* Add a custom loader to the list of loaders
|
|
17
|
+
*
|
|
18
|
+
* @param loader loader to add to the list of loaders
|
|
19
|
+
* @returns this
|
|
20
|
+
*/
|
|
21
|
+
addLoader(loader: ContextLoader): this;
|
|
22
|
+
/**
|
|
23
|
+
* Replace the default loader for typed data clear signing contexts
|
|
24
|
+
*
|
|
25
|
+
* @returns this
|
|
26
|
+
*/
|
|
27
|
+
withTypedDataLoader(loader: TypedDataContextLoader): this;
|
|
28
|
+
/**
|
|
29
|
+
* Build the context module
|
|
30
|
+
*
|
|
31
|
+
* @returns the context module
|
|
32
|
+
*/
|
|
33
|
+
build(): ContextModule;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ContextModuleBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextModuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/ContextModuleBuilder.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,eAAe,CAAyB;;IAoBhD;;;;OAIG;IACH,qBAAqB;IAKrB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa;IAK/B;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,sBAAsB;IAKlD;;;;OAIG;IACH,KAAK,IAAI,aAAa;CAOvB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { externalPluginTypes } from "./external-plugin/di/externalPluginTypes";
|
|
2
|
+
import { forwardDomainTypes } from "./forward-domain/di/forwardDomainTypes";
|
|
3
|
+
import { nftTypes } from "./nft/di/nftTypes";
|
|
4
|
+
import { tokenTypes } from "./token/di/tokenTypes";
|
|
5
|
+
import { typedDataTypes } from "./typed-data/di/typedDataTypes";
|
|
6
|
+
import { DefaultContextModule } from "./DefaultContextModule";
|
|
7
|
+
import { makeContainer } from "./di";
|
|
8
|
+
export class ContextModuleBuilder {
|
|
9
|
+
customLoaders = [];
|
|
10
|
+
defaultLoaders = [];
|
|
11
|
+
typedDataLoader;
|
|
12
|
+
constructor() {
|
|
13
|
+
const container = makeContainer();
|
|
14
|
+
this.defaultLoaders = [
|
|
15
|
+
container.get(externalPluginTypes.ExternalPluginContextLoader),
|
|
16
|
+
container.get(forwardDomainTypes.ForwardDomainContextLoader),
|
|
17
|
+
container.get(nftTypes.NftContextLoader),
|
|
18
|
+
container.get(tokenTypes.TokenContextLoader),
|
|
19
|
+
];
|
|
20
|
+
this.typedDataLoader = container.get(typedDataTypes.TypedDataContextLoader);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Remove default loaders from the list of loaders
|
|
24
|
+
*
|
|
25
|
+
* @returns this
|
|
26
|
+
*/
|
|
27
|
+
withoutDefaultLoaders() {
|
|
28
|
+
this.defaultLoaders = [];
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Add a custom loader to the list of loaders
|
|
33
|
+
*
|
|
34
|
+
* @param loader loader to add to the list of loaders
|
|
35
|
+
* @returns this
|
|
36
|
+
*/
|
|
37
|
+
addLoader(loader) {
|
|
38
|
+
this.customLoaders.push(loader);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Replace the default loader for typed data clear signing contexts
|
|
43
|
+
*
|
|
44
|
+
* @returns this
|
|
45
|
+
*/
|
|
46
|
+
withTypedDataLoader(loader) {
|
|
47
|
+
this.typedDataLoader = loader;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build the context module
|
|
52
|
+
*
|
|
53
|
+
* @returns the context module
|
|
54
|
+
*/
|
|
55
|
+
build() {
|
|
56
|
+
const loaders = [...this.defaultLoaders, ...this.customLoaders];
|
|
57
|
+
return new DefaultContextModule({
|
|
58
|
+
loaders,
|
|
59
|
+
typedDataLoader: this.typedDataLoader,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=ContextModuleBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|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;OAIG;IACH,mBAAmB,CAAC,MAA8B;QAChD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;QAChE,OAAO,IAAI,oBAAoB,CAAC;YAC9B,OAAO;YACP,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
|
|
2
|
+
import type { TypedDataContext } from "./shared/model/TypedDataContext";
|
|
3
|
+
import { ContextLoader } from "./shared/domain/ContextLoader";
|
|
4
|
+
import { ClearSignContext } from "./shared/model/ClearSignContext";
|
|
5
|
+
import { TransactionContext } from "./shared/model/TransactionContext";
|
|
6
|
+
import type { TypedDataContextLoader } from "./typed-data/domain/TypedDataContextLoader";
|
|
7
|
+
import { ContextModule } from "./ContextModule";
|
|
8
|
+
type DefaultContextModuleConstructorArgs = {
|
|
9
|
+
loaders: ContextLoader[];
|
|
10
|
+
typedDataLoader: TypedDataContextLoader;
|
|
11
|
+
};
|
|
12
|
+
export declare class DefaultContextModule implements ContextModule {
|
|
13
|
+
private _loaders;
|
|
14
|
+
private _typedDataLoader;
|
|
15
|
+
constructor(args: DefaultContextModuleConstructorArgs);
|
|
16
|
+
getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;
|
|
17
|
+
getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=DefaultContextModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,mCAAmC,GAAG;IACzC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,eAAe,EAAE,sBAAsB,CAAC;CACzC,CAAC;AAEF,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,gBAAgB,CAAyB;gBAErC,IAAI,EAAE,mCAAmC;IAKxC,WAAW,CACtB,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAMjB,mBAAmB,CAC9B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC;CAGtC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class DefaultContextModule {
|
|
2
|
+
_loaders;
|
|
3
|
+
_typedDataLoader;
|
|
4
|
+
constructor(args) {
|
|
5
|
+
this._loaders = args.loaders;
|
|
6
|
+
this._typedDataLoader = args.typedDataLoader;
|
|
7
|
+
}
|
|
8
|
+
async getContexts(transaction) {
|
|
9
|
+
const promises = this._loaders.map((fetcher) => fetcher.load(transaction));
|
|
10
|
+
const responses = await Promise.all(promises);
|
|
11
|
+
return responses.flat();
|
|
12
|
+
}
|
|
13
|
+
async getTypedDataFilters(typedData) {
|
|
14
|
+
return this._typedDataLoader.load(typedData);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=DefaultContextModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultContextModule.js","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAcA,MAAM,OAAO,oBAAoB;IACvB,QAAQ,CAAkB;IAC1B,gBAAgB,CAAyB;IAEjD,YAAY,IAAyC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,eAAe,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,WAAW,CACtB,WAA+B;QAE/B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3E,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,SAA2B;QAE3B,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"di.d.ts","sourceRoot":"","sources":["../../../src/di.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAQtC,eAAO,MAAM,aAAa,iBAYzB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Container } from "inversify";
|
|
2
|
+
import { externalPluginModuleFactory } from "./external-plugin/di/externalPluginModuleFactory";
|
|
3
|
+
import { forwardDomainModuleFactory } from "./forward-domain/di/forwardDomainModuleFactory";
|
|
4
|
+
import { nftModuleFactory } from "./nft/di/nftModuleFactory";
|
|
5
|
+
import { tokenModuleFactory } from "./token/di/tokenModuleFactory";
|
|
6
|
+
import { typedDataModuleFactory } from "./typed-data/di/typedDataModuleFactory";
|
|
7
|
+
export const makeContainer = () => {
|
|
8
|
+
const container = new Container();
|
|
9
|
+
container.load(externalPluginModuleFactory(), forwardDomainModuleFactory(), nftModuleFactory(), tokenModuleFactory(), typedDataModuleFactory());
|
|
10
|
+
return container;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=di.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"di.js","sourceRoot":"","sources":["../../../src/di.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;IAElC,SAAS,CAAC,IAAI,CACZ,2BAA2B,EAAE,EAC7B,0BAA0B,EAAE,EAC5B,gBAAgB,EAAE,EAClB,kBAAkB,EAAE,EACpB,sBAAsB,EAAE,CACzB,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface DAppDto {
|
|
2
|
+
b2c: B2c;
|
|
3
|
+
abis: Abis;
|
|
4
|
+
b2c_signatures: B2cSignatures;
|
|
5
|
+
}
|
|
6
|
+
export interface B2c {
|
|
7
|
+
blockchainName: string;
|
|
8
|
+
chainId: number;
|
|
9
|
+
contracts: Contract[];
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
interface Contract {
|
|
13
|
+
address: string;
|
|
14
|
+
contractName: string;
|
|
15
|
+
selectors: {
|
|
16
|
+
[selector: string]: ContractSelector;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface ContractSelector {
|
|
20
|
+
erc20OfInterest: string[];
|
|
21
|
+
method: string;
|
|
22
|
+
plugin: string;
|
|
23
|
+
}
|
|
24
|
+
export interface Abis {
|
|
25
|
+
[address: string]: object[];
|
|
26
|
+
}
|
|
27
|
+
export interface B2cSignatures {
|
|
28
|
+
[address: string]: {
|
|
29
|
+
[selector: string]: B2cSignature;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface B2cSignature {
|
|
33
|
+
plugin: string;
|
|
34
|
+
serialized_data: string;
|
|
35
|
+
signature: string;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=DAppDto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DAppDto.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/DAppDto.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,IAAI,CAAC;IACX,cAAc,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,GAAG;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,QAAQ;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAAA;KAAE,CAAC;CACrD;AAED,UAAU,gBAAgB;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,OAAO,EAAE,MAAM,GAAG;QACjB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;KAClC,CAAC;CACH;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DAppDto.js","sourceRoot":"","sources":["../../../../../src/external-plugin/data/DAppDto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HexaString } from "@ledgerhq/device-management-kit";
|
|
2
|
+
import { Either } from "purify-ts";
|
|
3
|
+
import { DappInfos } from "../../external-plugin/model/DappInfos";
|
|
4
|
+
export type GetDappInfos = {
|
|
5
|
+
address: string;
|
|
6
|
+
selector: HexaString;
|
|
7
|
+
chainId: number;
|
|
8
|
+
};
|
|
9
|
+
export interface ExternalPluginDataSource {
|
|
10
|
+
getDappInfos(params: GetDappInfos): Promise<Either<Error, DappInfos | undefined>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ExternalPluginDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalPluginDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/ExternalPluginDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,YAAY,CACV,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalPluginDataSource.js","sourceRoot":"","sources":["../../../../../src/external-plugin/data/ExternalPluginDataSource.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Either } from "purify-ts";
|
|
2
|
+
import { ExternalPluginDataSource, GetDappInfos } from "../../external-plugin/data/ExternalPluginDataSource";
|
|
3
|
+
import { DappInfos } from "../../external-plugin/model/DappInfos";
|
|
4
|
+
export declare class HttpExternalPluginDataSource implements ExternalPluginDataSource {
|
|
5
|
+
constructor();
|
|
6
|
+
getDappInfos({ chainId, address, selector, }: GetDappInfos): Promise<Either<Error, DappInfos | undefined>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=HttpExternalPluginDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpExternalPluginDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/data/HttpExternalPluginDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAGhD,OAAO,EACL,wBAAwB,EACxB,YAAY,EACb,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAI9D,qBACa,4BAA6B,YAAW,wBAAwB;;IAGrE,YAAY,CAAC,EACjB,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;CAyDhE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import axios from "axios";
|
|
11
|
+
import { injectable } from "inversify";
|
|
12
|
+
import { Left, Right } from "purify-ts";
|
|
13
|
+
import PACKAGE from "../../../package.json";
|
|
14
|
+
let HttpExternalPluginDataSource = class HttpExternalPluginDataSource {
|
|
15
|
+
constructor() { }
|
|
16
|
+
async getDappInfos({ chainId, address, selector, }) {
|
|
17
|
+
try {
|
|
18
|
+
const dappInfos = await axios.request({
|
|
19
|
+
method: "GET",
|
|
20
|
+
url: "https://crypto-assets-service.api.ledger.com/v1/dapps",
|
|
21
|
+
params: {
|
|
22
|
+
output: "b2c,b2c_signatures,abis",
|
|
23
|
+
chain_id: chainId,
|
|
24
|
+
contracts: address,
|
|
25
|
+
},
|
|
26
|
+
headers: {
|
|
27
|
+
"X-Ledger-Client-Version": `context-module/${PACKAGE.version}`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
if (!dappInfos.data[0]) {
|
|
31
|
+
return Right(undefined);
|
|
32
|
+
}
|
|
33
|
+
const { erc20OfInterest, method, plugin } = dappInfos.data[0].b2c?.contracts?.[0]?.selectors?.[selector] || {};
|
|
34
|
+
const { signature, serialized_data: serializedData } = dappInfos.data[0].b2c_signatures?.[address]?.[selector] || {};
|
|
35
|
+
if (!erc20OfInterest ||
|
|
36
|
+
!method ||
|
|
37
|
+
!plugin ||
|
|
38
|
+
!signature ||
|
|
39
|
+
!serializedData) {
|
|
40
|
+
return Right(undefined);
|
|
41
|
+
}
|
|
42
|
+
const abi = dappInfos.data[0].abis?.[address];
|
|
43
|
+
if (!abi) {
|
|
44
|
+
return Right(undefined);
|
|
45
|
+
}
|
|
46
|
+
const selectorDetails = {
|
|
47
|
+
method,
|
|
48
|
+
plugin,
|
|
49
|
+
erc20OfInterest,
|
|
50
|
+
signature,
|
|
51
|
+
serializedData,
|
|
52
|
+
};
|
|
53
|
+
return Right({ selectorDetails, abi });
|
|
54
|
+
}
|
|
55
|
+
catch (_error) {
|
|
56
|
+
return Left(new Error("[ContextModule] HttpExternalPluginDataSource: Error fetching dapp infos"));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
HttpExternalPluginDataSource = __decorate([
|
|
61
|
+
injectable(),
|
|
62
|
+
__metadata("design:paramtypes", [])
|
|
63
|
+
], HttpExternalPluginDataSource);
|
|
64
|
+
export { HttpExternalPluginDataSource };
|
|
65
|
+
//# sourceMappingURL=HttpExternalPluginDataSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpExternalPluginDataSource.js","sourceRoot":"","sources":["../../../../../src/external-plugin/data/HttpExternalPluginDataSource.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAU,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAShD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAGlC,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,gBAAe,CAAC;IAEhB,KAAK,CAAC,YAAY,CAAC,EACjB,OAAO,EACP,OAAO,EACP,QAAQ,GAC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BACN,eAAe;gBACf,SAAS;gBACT,cAAc;aACf,CAAC;YAEF,OAAO,KAAK,CAAC,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,OAAO,IAAI,CACT,IAAI,KAAK,CACP,yEAAyE,CAC1E,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAhEY,4BAA4B;IADxC,UAAU,EAAE;;GACA,4BAA4B,CAgExC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalPluginModuleFactory.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/di/externalPluginModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5C,eAAO,MAAM,2BAA2B,uBAQpC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContainerModule } from "inversify";
|
|
2
|
+
import { HttpExternalPluginDataSource } from "../../external-plugin/data/HttpExternalPluginDataSource";
|
|
3
|
+
import { externalPluginTypes } from "../../external-plugin/di/externalPluginTypes";
|
|
4
|
+
import { ExternalPluginContextLoader } from "../../external-plugin/domain/ExternalPluginContextLoader";
|
|
5
|
+
export const externalPluginModuleFactory = () => new ContainerModule((bind, _unbind, _isBound, _rebind) => {
|
|
6
|
+
bind(externalPluginTypes.ExternalPluginDataSource).to(HttpExternalPluginDataSource);
|
|
7
|
+
bind(externalPluginTypes.ExternalPluginContextLoader).to(ExternalPluginContextLoader);
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=externalPluginModuleFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalPluginModuleFactory.js","sourceRoot":"","sources":["../../../../../src/external-plugin/di/externalPluginModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAEnG,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE,CAC9C,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IACvD,IAAI,CAAC,mBAAmB,CAAC,wBAAwB,CAAC,CAAC,EAAE,CACnD,4BAA4B,CAC7B,CAAC;IACF,IAAI,CAAC,mBAAmB,CAAC,2BAA2B,CAAC,CAAC,EAAE,CACtD,2BAA2B,CAC5B,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalPluginTypes.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/di/externalPluginTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalPluginTypes.js","sourceRoot":"","sources":["../../../../../src/external-plugin/di/externalPluginTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,wBAAwB,EAAE,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAChE,2BAA2B,EAAE,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC;CACvE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ExternalPluginDataSource } from "../../external-plugin/data/ExternalPluginDataSource";
|
|
2
|
+
import { ContextLoader } from "../../shared/domain/ContextLoader";
|
|
3
|
+
import { ClearSignContext } from "../../shared/model/ClearSignContext";
|
|
4
|
+
import { TransactionContext } from "../../shared/model/TransactionContext";
|
|
5
|
+
import type { TokenDataSource } from "../../token/data/TokenDataSource";
|
|
6
|
+
export declare class ExternalPluginContextLoader implements ContextLoader {
|
|
7
|
+
private _externalPluginDataSource;
|
|
8
|
+
private _tokenDataSource;
|
|
9
|
+
constructor(externalPluginDataSource: ExternalPluginDataSource, tokenDataSource: TokenDataSource);
|
|
10
|
+
load(transaction: TransactionContext): Promise<ClearSignContext[]>;
|
|
11
|
+
private getTokenPayload;
|
|
12
|
+
private getDecodedCallData;
|
|
13
|
+
private getAddressFromPath;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ExternalPluginContextLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalPluginContextLoader.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,qBACa,2BAA4B,YAAW,aAAa;IAC/D,OAAO,CAAC,yBAAyB,CAA2B;IAC5D,OAAO,CAAC,gBAAgB,CAAkB;gBAIxC,wBAAwB,EAAE,wBAAwB,EACd,eAAe,EAAE,eAAe;IAMhE,IAAI,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAyFxE,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,kBAAkB;CA6B3B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { isHexaString } from "@ledgerhq/device-management-kit";
|
|
14
|
+
import { Interface } from "ethers";
|
|
15
|
+
import { inject, injectable } from "inversify";
|
|
16
|
+
import { EitherAsync, Left, Right } from "purify-ts";
|
|
17
|
+
import { externalPluginTypes } from "../../external-plugin/di/externalPluginTypes";
|
|
18
|
+
import { ClearSignContextType, } from "../../shared/model/ClearSignContext";
|
|
19
|
+
import { tokenTypes } from "../../token/di/tokenTypes";
|
|
20
|
+
let ExternalPluginContextLoader = class ExternalPluginContextLoader {
|
|
21
|
+
_externalPluginDataSource;
|
|
22
|
+
_tokenDataSource;
|
|
23
|
+
constructor(externalPluginDataSource, tokenDataSource) {
|
|
24
|
+
this._externalPluginDataSource = externalPluginDataSource;
|
|
25
|
+
this._tokenDataSource = tokenDataSource;
|
|
26
|
+
}
|
|
27
|
+
async load(transaction) {
|
|
28
|
+
if (!transaction.to || !transaction.data || transaction.data === "0x") {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const selector = transaction.data.slice(0, 10);
|
|
32
|
+
if (!isHexaString(selector)) {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
type: ClearSignContextType.ERROR,
|
|
36
|
+
error: new Error("Invalid selector"),
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
const eitherDappInfos = await this._externalPluginDataSource.getDappInfos({
|
|
41
|
+
address: transaction.to,
|
|
42
|
+
chainId: transaction.chainId,
|
|
43
|
+
selector,
|
|
44
|
+
});
|
|
45
|
+
return EitherAsync(async ({ liftEither }) => {
|
|
46
|
+
const dappInfos = await liftEither(eitherDappInfos);
|
|
47
|
+
// if the dappInfos is null, return an empty array
|
|
48
|
+
// this means that the selector is not a known selector
|
|
49
|
+
if (!dappInfos) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const externalPluginContext = {
|
|
53
|
+
type: ClearSignContextType.EXTERNAL_PLUGIN,
|
|
54
|
+
payload: dappInfos.selectorDetails.serializedData.concat(dappInfos.selectorDetails.signature),
|
|
55
|
+
};
|
|
56
|
+
const decodedCallData = this.getDecodedCallData(dappInfos.abi, dappInfos.selectorDetails.method, transaction.data);
|
|
57
|
+
// if the call data cannot be decoded, return the error
|
|
58
|
+
// but also the externalPluginContext because it is still valid
|
|
59
|
+
if (decodedCallData.isLeft()) {
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
type: ClearSignContextType.ERROR,
|
|
63
|
+
error: decodedCallData.extract(),
|
|
64
|
+
},
|
|
65
|
+
externalPluginContext,
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
// decodedCallData is a Right so we can extract it safely
|
|
69
|
+
const extractedDecodedCallData = decodedCallData.extract();
|
|
70
|
+
// get the token payload for each erc20OfInterest
|
|
71
|
+
// and return the payload or the error
|
|
72
|
+
const promises = dappInfos.selectorDetails.erc20OfInterest.map(async (erc20Path) => this.getTokenPayload(transaction, erc20Path, extractedDecodedCallData));
|
|
73
|
+
const tokensPayload = await Promise.all(promises);
|
|
74
|
+
// map the payload or the error to a ClearSignContext
|
|
75
|
+
const contexts = tokensPayload.map((eitherToken) => eitherToken.caseOf({
|
|
76
|
+
Left: (error) => ({ type: ClearSignContextType.ERROR, error }),
|
|
77
|
+
Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),
|
|
78
|
+
}));
|
|
79
|
+
return [...contexts, externalPluginContext];
|
|
80
|
+
}).caseOf({
|
|
81
|
+
// parse all errors into ClearSignContext
|
|
82
|
+
Left: (error) => [{ type: ClearSignContextType.ERROR, error }],
|
|
83
|
+
Right: (contexts) => contexts,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
getTokenPayload(transaction, erc20Path, decodedCallData) {
|
|
87
|
+
const address = this.getAddressFromPath(erc20Path, decodedCallData);
|
|
88
|
+
return EitherAsync(({ fromPromise }) => fromPromise(this._tokenDataSource.getTokenInfosPayload({
|
|
89
|
+
address,
|
|
90
|
+
chainId: transaction.chainId,
|
|
91
|
+
})));
|
|
92
|
+
}
|
|
93
|
+
getDecodedCallData(abi, method, data) {
|
|
94
|
+
try {
|
|
95
|
+
const contractInterface = new Interface(abi);
|
|
96
|
+
return Right(contractInterface.decodeFunctionData(method, data));
|
|
97
|
+
}
|
|
98
|
+
catch (_error) {
|
|
99
|
+
return Left(new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi"));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
getAddressFromPath(path, decodedCallData) {
|
|
103
|
+
// ethers.Result is a record string, any
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
|
+
let value = decodedCallData;
|
|
106
|
+
for (const key of path.split(".")) {
|
|
107
|
+
// In Solidity, a struct cannot begin with a number
|
|
108
|
+
// Additionally, when we use -1, it signifies the last element of the array.
|
|
109
|
+
if (key === "-1") {
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
111
|
+
value = value[value.length - 1];
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// This access can throw a RangeError error in case of an invalid key
|
|
115
|
+
// but is correctly caught by the liftEither above
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
117
|
+
value = value[key];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (!isHexaString(value)) {
|
|
121
|
+
throw new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address");
|
|
122
|
+
}
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
ExternalPluginContextLoader = __decorate([
|
|
127
|
+
injectable(),
|
|
128
|
+
__param(0, inject(externalPluginTypes.ExternalPluginDataSource)),
|
|
129
|
+
__param(1, inject(tokenTypes.TokenDataSource)),
|
|
130
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
131
|
+
], ExternalPluginContextLoader);
|
|
132
|
+
export { ExternalPluginContextLoader };
|
|
133
|
+
//# sourceMappingURL=ExternalPluginContextLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalPluginContextLoader.js","sourceRoot":"","sources":["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAU,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAU,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAEL,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAG5C,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAC9B,yBAAyB,CAA2B;IACpD,gBAAgB,CAAkB;IAE1C,YAEE,wBAAkD,EACd,eAAgC;QAEpE,IAAI,CAAC,yBAAyB,GAAG,wBAAwB,CAAC;QAC1D,IAAI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AAC;QACH,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AArKY,2BAA2B;IADvC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,mBAAmB,CAAC,wBAAwB,CAAC,CAAA;IAEpD,WAAA,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;;GAP1B,2BAA2B,CAqKvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DappInfos.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/model/DappInfos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,MAAM,MAAM,SAAS,GAAG;IAAE,eAAe,EAAE,eAAe,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DappInfos.js","sourceRoot":"","sources":["../../../../../src/external-plugin/model/DappInfos.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectorDetails.d.ts","sourceRoot":"","sources":["../../../../../src/external-plugin/model/SelectorDetails.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectorDetails.js","sourceRoot":"","sources":["../../../../../src/external-plugin/model/SelectorDetails.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Either } from "purify-ts/Either";
|
|
2
|
+
export type GetForwardDomainInfosParams = {
|
|
3
|
+
domain: string;
|
|
4
|
+
challenge: string;
|
|
5
|
+
};
|
|
6
|
+
export interface ForwardDomainDataSource {
|
|
7
|
+
getDomainNamePayload(params: GetForwardDomainInfosParams): Promise<Either<Error, string>>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ForwardDomainDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForwardDomainDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/forward-domain/data/ForwardDomainDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,oBAAoB,CAClB,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForwardDomainDataSource.js","sourceRoot":"","sources":["../../../../../src/forward-domain/data/ForwardDomainDataSource.ts"],"names":[],"mappings":""}
|