@ledgerhq/context-module 0.0.0-develop-20260416002308 → 0.0.0-develop-20260417094200
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/src/DefaultContextModule.js +1 -1
- package/lib/cjs/src/DefaultContextModule.js.map +3 -3
- package/lib/cjs/src/account-ownership/data/AccountOwnershipDataSource.js +2 -0
- package/lib/cjs/src/account-ownership/data/AccountOwnershipDataSource.js.map +7 -0
- package/lib/cjs/src/account-ownership/data/HttpAccountOwnershipDataSource.js +2 -0
- package/lib/cjs/src/account-ownership/data/HttpAccountOwnershipDataSource.js.map +7 -0
- package/lib/cjs/src/account-ownership/data/HttpAccountOwnershipDataSource.test.js +2 -0
- package/lib/cjs/src/account-ownership/data/HttpAccountOwnershipDataSource.test.js.map +7 -0
- package/lib/cjs/src/account-ownership/data/dto/AccountOwnershipDto.js +2 -0
- package/lib/cjs/src/account-ownership/data/dto/AccountOwnershipDto.js.map +7 -0
- package/lib/cjs/src/account-ownership/di/accountOwnershipModuleFactory.js +2 -0
- package/lib/cjs/src/account-ownership/di/accountOwnershipModuleFactory.js.map +7 -0
- package/lib/cjs/src/account-ownership/di/accountOwnershipTypes.js +2 -0
- package/lib/cjs/src/account-ownership/di/accountOwnershipTypes.js.map +7 -0
- package/lib/cjs/src/account-ownership/domain/AccountOwnershipContextLoader.js +2 -0
- package/lib/cjs/src/account-ownership/domain/AccountOwnershipContextLoader.js.map +7 -0
- package/lib/cjs/src/account-ownership/domain/AccountOwnershipContextLoader.test.js +2 -0
- package/lib/cjs/src/account-ownership/domain/AccountOwnershipContextLoader.test.js.map +7 -0
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +3 -3
- package/lib/cjs/src/index.js +1 -1
- package/lib/cjs/src/index.js.map +2 -2
- package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
- package/lib/cjs/src/shared/model/ClearSignContext.js.map +2 -2
- package/lib/esm/package.json +1 -1
- package/lib/esm/src/DefaultContextModule.js +1 -1
- package/lib/esm/src/DefaultContextModule.js.map +3 -3
- package/lib/esm/src/account-ownership/data/AccountOwnershipDataSource.js +1 -0
- package/lib/esm/src/account-ownership/data/AccountOwnershipDataSource.js.map +7 -0
- package/lib/esm/src/account-ownership/data/HttpAccountOwnershipDataSource.js +2 -0
- package/lib/esm/src/account-ownership/data/HttpAccountOwnershipDataSource.js.map +7 -0
- package/lib/esm/src/account-ownership/data/HttpAccountOwnershipDataSource.test.js +2 -0
- package/lib/esm/src/account-ownership/data/HttpAccountOwnershipDataSource.test.js.map +7 -0
- package/lib/esm/src/account-ownership/data/dto/AccountOwnershipDto.js +1 -0
- package/lib/esm/src/account-ownership/data/dto/AccountOwnershipDto.js.map +7 -0
- package/lib/esm/src/account-ownership/di/accountOwnershipModuleFactory.js +2 -0
- package/lib/esm/src/account-ownership/di/accountOwnershipModuleFactory.js.map +7 -0
- package/lib/esm/src/account-ownership/di/accountOwnershipTypes.js +2 -0
- package/lib/esm/src/account-ownership/di/accountOwnershipTypes.js.map +7 -0
- package/lib/esm/src/account-ownership/domain/AccountOwnershipContextLoader.js +2 -0
- package/lib/esm/src/account-ownership/domain/AccountOwnershipContextLoader.js.map +7 -0
- package/lib/esm/src/account-ownership/domain/AccountOwnershipContextLoader.test.js +2 -0
- package/lib/esm/src/account-ownership/domain/AccountOwnershipContextLoader.test.js.map +7 -0
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/index.js +1 -1
- package/lib/esm/src/index.js.map +2 -2
- package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
- package/lib/esm/src/shared/model/ClearSignContext.js.map +2 -2
- package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
- package/lib/types/src/account-ownership/data/AccountOwnershipDataSource.d.ts +17 -0
- package/lib/types/src/account-ownership/data/AccountOwnershipDataSource.d.ts.map +1 -0
- package/lib/types/src/account-ownership/data/HttpAccountOwnershipDataSource.d.ts +10 -0
- package/lib/types/src/account-ownership/data/HttpAccountOwnershipDataSource.d.ts.map +1 -0
- package/lib/types/src/account-ownership/data/HttpAccountOwnershipDataSource.test.d.ts +2 -0
- package/lib/types/src/account-ownership/data/HttpAccountOwnershipDataSource.test.d.ts.map +1 -0
- package/lib/types/src/account-ownership/data/dto/AccountOwnershipDto.d.ts +6 -0
- package/lib/types/src/account-ownership/data/dto/AccountOwnershipDto.d.ts.map +1 -0
- package/lib/types/src/account-ownership/di/accountOwnershipModuleFactory.d.ts +3 -0
- package/lib/types/src/account-ownership/di/accountOwnershipModuleFactory.d.ts.map +1 -0
- package/lib/types/src/account-ownership/di/accountOwnershipTypes.d.ts +5 -0
- package/lib/types/src/account-ownership/di/accountOwnershipTypes.d.ts.map +1 -0
- package/lib/types/src/account-ownership/domain/AccountOwnershipContextLoader.d.ts +20 -0
- package/lib/types/src/account-ownership/domain/AccountOwnershipContextLoader.d.ts.map +1 -0
- package/lib/types/src/account-ownership/domain/AccountOwnershipContextLoader.test.d.ts +2 -0
- package/lib/types/src/account-ownership/domain/AccountOwnershipContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/index.d.ts +3 -0
- package/lib/types/src/index.d.ts.map +1 -1
- package/lib/types/src/shared/model/ClearSignContext.d.ts +2 -1
- package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Left as m}from"purify-ts";import{
|
|
1
|
+
import{Left as m}from"purify-ts";import{accountOwnershipTypes as x}from"./account-ownership/di/accountOwnershipTypes";import{calldataTypes as L}from"./calldata/di/calldataTypes";import{dynamicNetworkTypes as g}from"./dynamic-network/di/dynamicNetworkTypes";import{reporterTypes as c}from"./reporter/di/reporterTypes";import{trustedNameTypes as d}from"./trusted-name/di/trustedNameTypes";import{externalPluginTypes as y}from"./external-plugin/di/externalPluginTypes";import{gatedSigningTypes as p}from"./gated-signing/di/gatedSigningTypes";import{nftTypes as s}from"./nft/di/nftTypes";import{proxyTypes as f}from"./proxy/di/proxyTypes";import{safeTypes as u}from"./safe/di/safeTypes";import{ClearSignContextType as a}from"./shared/model/ClearSignContext";import{solanaContextTypes as _}from"./solana/di/solanaContextTypes";import{tokenTypes as l}from"./token/di/tokenTypes";import{transactionCheckTypes as C}from"./transaction-check/di/transactionCheckTypes";import{typedDataTypes as h}from"./typed-data/di/typedDataTypes";import{makeContainer as T}from"./di";class j{_container;_loaders;_typedDataLoader;_solanaLoader;_fieldLoaders;_blindSigningReporter;constructor(e){this._container=T({config:e}),this._loaders=e.defaultLoaders?this._getDefaultLoaders():[],this._loaders.push(...e.customLoaders),this._fieldLoaders=e.defaultFieldLoaders?this._getDefaultFieldLoaders():[],this._fieldLoaders.push(...e.customFieldLoaders),this._typedDataLoader=e.customTypedDataLoader??this._getDefaultTypedDataLoader(),this._solanaLoader=e.customSolanaLoader??this._getSolanaLoader(),this._blindSigningReporter=e.customBlindSigningReporter??this._getBlindSigningReporter()}_getDefaultFieldLoaders(){return[this._container.get(s.NftContextFieldLoader),this._container.get(l.TokenContextFieldLoader),this._container.get(d.TrustedNameContextFieldLoader),this._container.get(f.ProxyContextFieldLoader)]}_getDefaultLoaders(){return[this._container.get(x.AccountOwnershipContextLoader),this._container.get(y.ExternalPluginContextLoader),this._container.get(d.TrustedNameContextLoader),this._container.get(s.NftContextLoader),this._container.get(l.TokenContextLoader),this._container.get(L.CalldataContextLoader),this._container.get(g.DynamicNetworkContextLoader),this._container.get(u.SafeAddressLoader),this._container.get(p.GatedSigningContextLoader),this._container.get(p.GatedSigningTypedDataContextLoader),this._container.get(C.TransactionCheckContextLoader),this._container.get(C.TypedDataCheckContextLoader)]}_getDefaultTypedDataLoader(){return this._container.get(h.TypedDataContextLoader)}_getBlindSigningReporter(){return this._container.get(c.BlindSigningReporter)}_getSolanaLoader(){try{return this._container.get(_.SolanaContextLoader)}catch{return{load:async e=>m(new Error("[ContextModule] - DefaultContextModule: no SolanaContextLoader bound"))}}}async getContexts(e,t){const o=Object.values(a),n=this._loaders.filter(i=>i.canHandle(e,t??o)).map(i=>i.load(e));return(await Promise.all(n)).flat()}async getFieldContext(e,t){const o=this._fieldLoaders.filter(r=>r.canHandle(e,t));if(o.length===0)return Promise.resolve({type:a.ERROR,error:new Error(`Loader not found for field: ${e} and expected type: ${t}`)});for(const r of o){const n=await r.loadField(e);if(n.type!==a.ERROR)return n}return{type:a.ERROR,error:new Error(`Loader not found for field: ${e} and expected type: ${t}`)}}async getTypedDataFilters(e){return this._typedDataLoader.load(e)}async getSolanaContext(e){return await this._solanaLoader.load(e)}async report(e){await this._blindSigningReporter.report(e)}}export{j as DefaultContextModule};
|
|
2
2
|
//# sourceMappingURL=DefaultContextModule.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/DefaultContextModule.ts"],
|
|
4
|
-
"sourcesContent": ["import { type Container } from \"inversify\";\nimport { Left } from \"purify-ts\";\n\nimport { calldataTypes } from \"@/calldata/di/calldataTypes\";\nimport { dynamicNetworkTypes } from \"@/dynamic-network/di/dynamicNetworkTypes\";\nimport { type BlindSigningReportParams } from \"@/reporter/data/BlindSigningReporterDatasource\";\nimport { reporterTypes } from \"@/reporter/di/reporterTypes\";\nimport { type BlindSigningReporter } from \"@/reporter/domain/BlindSigningReporter\";\nimport type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\nimport {\n type ContextModuleLoaderConfig,\n type ContextModuleServiceConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { externalPluginTypes } from \"./external-plugin/di/externalPluginTypes\";\nimport { gatedSigningTypes } from \"./gated-signing/di/gatedSigningTypes\";\nimport { nftTypes } from \"./nft/di/nftTypes\";\nimport { proxyTypes } from \"./proxy/di/proxyTypes\";\nimport { safeTypes } from \"./safe/di/safeTypes\";\nimport { type ContextFieldLoader } from \"./shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport { solanaContextTypes } from \"./solana/di/solanaContextTypes\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\nimport { tokenTypes } from \"./token/di/tokenTypes\";\nimport { transactionCheckTypes } from \"./transaction-check/di/transactionCheckTypes\";\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<unknown>[];\n private _typedDataLoader: TypedDataContextLoader;\n private _solanaLoader: SolanaContextLoader;\n private _fieldLoaders: ContextFieldLoader<unknown>[];\n private _blindSigningReporter: BlindSigningReporter;\n\n constructor(args: ContextModuleServiceConfig & ContextModuleLoaderConfig) {\n this._container = makeContainer({ config: args });\n\n this._loaders = args.defaultLoaders ? this._getDefaultLoaders() : [];\n this._loaders.push(...args.customLoaders);\n\n this._fieldLoaders = args.defaultFieldLoaders\n ? this._getDefaultFieldLoaders()\n : [];\n this._fieldLoaders.push(...args.customFieldLoaders);\n\n this._typedDataLoader =\n args.customTypedDataLoader ?? this._getDefaultTypedDataLoader();\n this._solanaLoader = args.customSolanaLoader ?? this._getSolanaLoader();\n this._blindSigningReporter =\n args.customBlindSigningReporter ?? this._getBlindSigningReporter();\n }\n\n private _getDefaultFieldLoaders(): ContextFieldLoader[] {\n return [\n this._container.get<ContextFieldLoader>(nftTypes.NftContextFieldLoader),\n this._container.get<ContextFieldLoader>(\n tokenTypes.TokenContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n trustedNameTypes.TrustedNameContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n proxyTypes.ProxyContextFieldLoader,\n ),\n ];\n }\n\n private _getDefaultLoaders(): ContextLoader<unknown>[] {\n return [\n this._container.get<ContextLoader>(\n externalPluginTypes.ExternalPluginContextLoader,\n ),\n this._container.get<ContextLoader>(\n trustedNameTypes.TrustedNameContextLoader,\n ),\n this._container.get<ContextLoader>(nftTypes.NftContextLoader),\n this._container.get<ContextLoader>(tokenTypes.TokenContextLoader),\n this._container.get<ContextLoader>(calldataTypes.CalldataContextLoader),\n this._container.get<ContextLoader>(\n dynamicNetworkTypes.DynamicNetworkContextLoader,\n ),\n this._container.get<ContextLoader>(safeTypes.SafeAddressLoader),\n this._container.get<ContextLoader>(\n gatedSigningTypes.GatedSigningContextLoader,\n ),\n this._container.get<ContextLoader>(\n gatedSigningTypes.GatedSigningTypedDataContextLoader,\n ),\n this._container.get<ContextLoader>(\n transactionCheckTypes.TransactionCheckContextLoader,\n ),\n this._container.get<ContextLoader>(\n transactionCheckTypes.TypedDataCheckContextLoader,\n ),\n ];\n }\n\n private _getDefaultTypedDataLoader(): TypedDataContextLoader {\n return this._container.get<TypedDataContextLoader>(\n typedDataTypes.TypedDataContextLoader,\n );\n }\n\n private _getBlindSigningReporter(): BlindSigningReporter {\n return this._container.get<BlindSigningReporter>(\n reporterTypes.BlindSigningReporter,\n );\n }\n\n private _getSolanaLoader(): SolanaContextLoader {\n try {\n return this._container.get<SolanaContextLoader>(\n solanaContextTypes.SolanaContextLoader,\n );\n } catch {\n return {\n load: async (_ctx) =>\n Left(\n new Error(\n \"[ContextModule] - DefaultContextModule: no SolanaContextLoader bound\",\n ),\n ),\n };\n }\n }\n\n public async getContexts(\n input: unknown,\n expectedTypes?: ClearSignContextType[],\n ): Promise<ClearSignContext[]> {\n const allContextTypes = Object.values(ClearSignContextType);\n const loaders = this._loaders.filter((l) =>\n l.canHandle(input, expectedTypes ?? allContextTypes),\n );\n const promises = loaders.map((fetcher) => fetcher.load(input));\n const responses = await Promise.all(promises);\n return responses.flat();\n }\n\n public async getFieldContext<TInput>(\n field: TInput,\n expectedType: ClearSignContextType,\n ): Promise<ClearSignContext> {\n const loaders = this._fieldLoaders.filter((l) =>\n l.canHandle(field, expectedType),\n );\n if (loaders.length === 0) {\n return Promise.resolve({\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n });\n }\n\n for (const loader of loaders) {\n const context = await loader.loadField(field);\n if (context.type !== ClearSignContextType.ERROR) {\n return context;\n }\n }\n\n return {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n };\n }\n\n public async getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext> {\n return this._typedDataLoader.load(typedData);\n }\n\n public async getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult> {\n return await this._solanaLoader.load(transactionContext);\n }\n\n public async report(params: BlindSigningReportParams): Promise<void> {\n await this._blindSigningReporter.report(params);\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,OAAS,QAAAA,MAAY,YAErB,OAAS,iBAAAC,MAAqB,8BAC9B,OAAS,uBAAAC,MAA2B,2CAEpC,OAAS,iBAAAC,MAAqB,8BAI9B,OAAS,oBAAAC,MAAwB,qCAMjC,OAAS,uBAAAC,MAA2B,2CACpC,OAAS,qBAAAC,MAAyB,uCAClC,OAAS,YAAAC,MAAgB,oBACzB,OAAS,cAAAC,MAAkB,wBAC3B,OAAS,aAAAC,MAAiB,sBAG1B,OAEE,wBAAAC,MACK,kCAEP,OAAS,sBAAAC,MAA0B,iCAGnC,OAAS,cAAAC,MAAkB,wBAC3B,OAAS,yBAAAC,MAA6B,+CACtC,OAAS,kBAAAC,MAAsB,iCAG/B,OAAS,iBAAAC,MAAqB,OAEvB,MAAMC,CAA8C,CACjD,WACA,SACA,iBACA,cACA,cACA,sBAER,YAAYC,EAA8D,CACxE,KAAK,WAAaF,EAAc,CAAE,OAAQE,CAAK,CAAC,EAEhD,KAAK,SAAWA,EAAK,eAAiB,KAAK,mBAAmB,EAAI,CAAC,EACnE,KAAK,SAAS,KAAK,GAAGA,EAAK,aAAa,EAExC,KAAK,cAAgBA,EAAK,oBACtB,KAAK,wBAAwB,EAC7B,CAAC,EACL,KAAK,cAAc,KAAK,GAAGA,EAAK,kBAAkB,EAElD,KAAK,iBACHA,EAAK,uBAAyB,KAAK,2BAA2B,EAChE,KAAK,cAAgBA,EAAK,oBAAsB,KAAK,iBAAiB,EACtE,KAAK,sBACHA,EAAK,4BAA8B,KAAK,yBAAyB,CACrE,CAEQ,yBAAgD,CACtD,MAAO,CACL,KAAK,WAAW,IAAwBV,EAAS,qBAAqB,EACtE,KAAK,WAAW,IACdK,EAAW,uBACb,EACA,KAAK,WAAW,IACdR,EAAiB,6BACnB,EACA,KAAK,WAAW,IACdI,EAAW,uBACb,CACF,CACF,CAEQ,oBAA+C,CACrD,MAAO,CACL,KAAK,WAAW,
|
|
6
|
-
"names": ["Left", "calldataTypes", "dynamicNetworkTypes", "reporterTypes", "trustedNameTypes", "externalPluginTypes", "gatedSigningTypes", "nftTypes", "proxyTypes", "safeTypes", "ClearSignContextType", "solanaContextTypes", "tokenTypes", "transactionCheckTypes", "typedDataTypes", "makeContainer", "DefaultContextModule", "args", "_ctx", "input", "expectedTypes", "allContextTypes", "promises", "l", "fetcher", "field", "expectedType", "loaders", "loader", "context", "typedData", "transactionContext", "params"]
|
|
4
|
+
"sourcesContent": ["import { type Container } from \"inversify\";\nimport { Left } from \"purify-ts\";\n\nimport { accountOwnershipTypes } from \"@/account-ownership/di/accountOwnershipTypes\";\nimport { calldataTypes } from \"@/calldata/di/calldataTypes\";\nimport { dynamicNetworkTypes } from \"@/dynamic-network/di/dynamicNetworkTypes\";\nimport { type BlindSigningReportParams } from \"@/reporter/data/BlindSigningReporterDatasource\";\nimport { reporterTypes } from \"@/reporter/di/reporterTypes\";\nimport { type BlindSigningReporter } from \"@/reporter/domain/BlindSigningReporter\";\nimport type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\nimport {\n type ContextModuleLoaderConfig,\n type ContextModuleServiceConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { externalPluginTypes } from \"./external-plugin/di/externalPluginTypes\";\nimport { gatedSigningTypes } from \"./gated-signing/di/gatedSigningTypes\";\nimport { nftTypes } from \"./nft/di/nftTypes\";\nimport { proxyTypes } from \"./proxy/di/proxyTypes\";\nimport { safeTypes } from \"./safe/di/safeTypes\";\nimport { type ContextFieldLoader } from \"./shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport { solanaContextTypes } from \"./solana/di/solanaContextTypes\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\nimport { tokenTypes } from \"./token/di/tokenTypes\";\nimport { transactionCheckTypes } from \"./transaction-check/di/transactionCheckTypes\";\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<unknown>[];\n private _typedDataLoader: TypedDataContextLoader;\n private _solanaLoader: SolanaContextLoader;\n private _fieldLoaders: ContextFieldLoader<unknown>[];\n private _blindSigningReporter: BlindSigningReporter;\n\n constructor(args: ContextModuleServiceConfig & ContextModuleLoaderConfig) {\n this._container = makeContainer({ config: args });\n\n this._loaders = args.defaultLoaders ? this._getDefaultLoaders() : [];\n this._loaders.push(...args.customLoaders);\n\n this._fieldLoaders = args.defaultFieldLoaders\n ? this._getDefaultFieldLoaders()\n : [];\n this._fieldLoaders.push(...args.customFieldLoaders);\n\n this._typedDataLoader =\n args.customTypedDataLoader ?? this._getDefaultTypedDataLoader();\n this._solanaLoader = args.customSolanaLoader ?? this._getSolanaLoader();\n this._blindSigningReporter =\n args.customBlindSigningReporter ?? this._getBlindSigningReporter();\n }\n\n private _getDefaultFieldLoaders(): ContextFieldLoader[] {\n return [\n this._container.get<ContextFieldLoader>(nftTypes.NftContextFieldLoader),\n this._container.get<ContextFieldLoader>(\n tokenTypes.TokenContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n trustedNameTypes.TrustedNameContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n proxyTypes.ProxyContextFieldLoader,\n ),\n ];\n }\n\n private _getDefaultLoaders(): ContextLoader<unknown>[] {\n return [\n this._container.get<ContextLoader>(\n accountOwnershipTypes.AccountOwnershipContextLoader,\n ),\n this._container.get<ContextLoader>(\n externalPluginTypes.ExternalPluginContextLoader,\n ),\n this._container.get<ContextLoader>(\n trustedNameTypes.TrustedNameContextLoader,\n ),\n this._container.get<ContextLoader>(nftTypes.NftContextLoader),\n this._container.get<ContextLoader>(tokenTypes.TokenContextLoader),\n this._container.get<ContextLoader>(calldataTypes.CalldataContextLoader),\n this._container.get<ContextLoader>(\n dynamicNetworkTypes.DynamicNetworkContextLoader,\n ),\n this._container.get<ContextLoader>(safeTypes.SafeAddressLoader),\n this._container.get<ContextLoader>(\n gatedSigningTypes.GatedSigningContextLoader,\n ),\n this._container.get<ContextLoader>(\n gatedSigningTypes.GatedSigningTypedDataContextLoader,\n ),\n this._container.get<ContextLoader>(\n transactionCheckTypes.TransactionCheckContextLoader,\n ),\n this._container.get<ContextLoader>(\n transactionCheckTypes.TypedDataCheckContextLoader,\n ),\n ];\n }\n\n private _getDefaultTypedDataLoader(): TypedDataContextLoader {\n return this._container.get<TypedDataContextLoader>(\n typedDataTypes.TypedDataContextLoader,\n );\n }\n\n private _getBlindSigningReporter(): BlindSigningReporter {\n return this._container.get<BlindSigningReporter>(\n reporterTypes.BlindSigningReporter,\n );\n }\n\n private _getSolanaLoader(): SolanaContextLoader {\n try {\n return this._container.get<SolanaContextLoader>(\n solanaContextTypes.SolanaContextLoader,\n );\n } catch {\n return {\n load: async (_ctx) =>\n Left(\n new Error(\n \"[ContextModule] - DefaultContextModule: no SolanaContextLoader bound\",\n ),\n ),\n };\n }\n }\n\n public async getContexts(\n input: unknown,\n expectedTypes?: ClearSignContextType[],\n ): Promise<ClearSignContext[]> {\n const allContextTypes = Object.values(ClearSignContextType);\n const loaders = this._loaders.filter((l) =>\n l.canHandle(input, expectedTypes ?? allContextTypes),\n );\n const promises = loaders.map((fetcher) => fetcher.load(input));\n const responses = await Promise.all(promises);\n return responses.flat();\n }\n\n public async getFieldContext<TInput>(\n field: TInput,\n expectedType: ClearSignContextType,\n ): Promise<ClearSignContext> {\n const loaders = this._fieldLoaders.filter((l) =>\n l.canHandle(field, expectedType),\n );\n if (loaders.length === 0) {\n return Promise.resolve({\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n });\n }\n\n for (const loader of loaders) {\n const context = await loader.loadField(field);\n if (context.type !== ClearSignContextType.ERROR) {\n return context;\n }\n }\n\n return {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n };\n }\n\n public async getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext> {\n return this._typedDataLoader.load(typedData);\n }\n\n public async getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult> {\n return await this._solanaLoader.load(transactionContext);\n }\n\n public async report(params: BlindSigningReportParams): Promise<void> {\n await this._blindSigningReporter.report(params);\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,OAAS,QAAAA,MAAY,YAErB,OAAS,yBAAAC,MAA6B,+CACtC,OAAS,iBAAAC,MAAqB,8BAC9B,OAAS,uBAAAC,MAA2B,2CAEpC,OAAS,iBAAAC,MAAqB,8BAI9B,OAAS,oBAAAC,MAAwB,qCAMjC,OAAS,uBAAAC,MAA2B,2CACpC,OAAS,qBAAAC,MAAyB,uCAClC,OAAS,YAAAC,MAAgB,oBACzB,OAAS,cAAAC,MAAkB,wBAC3B,OAAS,aAAAC,MAAiB,sBAG1B,OAEE,wBAAAC,MACK,kCAEP,OAAS,sBAAAC,MAA0B,iCAGnC,OAAS,cAAAC,MAAkB,wBAC3B,OAAS,yBAAAC,MAA6B,+CACtC,OAAS,kBAAAC,MAAsB,iCAG/B,OAAS,iBAAAC,MAAqB,OAEvB,MAAMC,CAA8C,CACjD,WACA,SACA,iBACA,cACA,cACA,sBAER,YAAYC,EAA8D,CACxE,KAAK,WAAaF,EAAc,CAAE,OAAQE,CAAK,CAAC,EAEhD,KAAK,SAAWA,EAAK,eAAiB,KAAK,mBAAmB,EAAI,CAAC,EACnE,KAAK,SAAS,KAAK,GAAGA,EAAK,aAAa,EAExC,KAAK,cAAgBA,EAAK,oBACtB,KAAK,wBAAwB,EAC7B,CAAC,EACL,KAAK,cAAc,KAAK,GAAGA,EAAK,kBAAkB,EAElD,KAAK,iBACHA,EAAK,uBAAyB,KAAK,2BAA2B,EAChE,KAAK,cAAgBA,EAAK,oBAAsB,KAAK,iBAAiB,EACtE,KAAK,sBACHA,EAAK,4BAA8B,KAAK,yBAAyB,CACrE,CAEQ,yBAAgD,CACtD,MAAO,CACL,KAAK,WAAW,IAAwBV,EAAS,qBAAqB,EACtE,KAAK,WAAW,IACdK,EAAW,uBAC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,UAAUE,EAAOC,CAAY,CACjC,EACA,GAAIC,EAAQ,SAAW,EACrB,OAAO,QAAQ,QAAQ,CACrB,KAAMjB,EAAqB,MAC3B,MAAO,IAAI,MACT,+BAA+Be,CAAK,uBAAuBC,CAAY,EACzE,CACF,CAAC,EAGH,UAAWE,KAAUD,EAAS,CAC5B,MAAME,EAAU,MAAMD,EAAO,UAAUH,CAAK,EAC5C,GAAII,EAAQ,OAASnB,EAAqB,MACxC,OAAOmB,CAEX,CAEA,MAAO,CACL,KAAMnB,EAAqB,MAC3B,MAAO,IAAI,MACT,+BAA+Be,CAAK,uBAAuBC,CAAY,EACzE,CACF,CACF,CAEA,MAAa,oBACXI,EACoC,CACpC,OAAO,KAAK,iBAAiB,KAAKA,CAAS,CAC7C,CAEA,MAAa,iBACXC,EACyC,CACzC,OAAO,MAAM,KAAK,cAAc,KAAKA,CAAkB,CACzD,CAEA,MAAa,OAAOC,EAAiD,CACnE,MAAM,KAAK,sBAAsB,OAAOA,CAAM,CAChD,CACF",
|
|
6
|
+
"names": ["Left", "accountOwnershipTypes", "calldataTypes", "dynamicNetworkTypes", "reporterTypes", "trustedNameTypes", "externalPluginTypes", "gatedSigningTypes", "nftTypes", "proxyTypes", "safeTypes", "ClearSignContextType", "solanaContextTypes", "tokenTypes", "transactionCheckTypes", "typedDataTypes", "makeContainer", "DefaultContextModule", "args", "_ctx", "input", "expectedTypes", "allContextTypes", "promises", "l", "fetcher", "field", "expectedType", "loaders", "loader", "context", "typedData", "transactionContext", "params"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=AccountOwnershipDataSource.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=(i,e,n,o)=>{for(var t=o>1?void 0:o?u(e,n):e,r=i.length-1,c;r>=0;r--)(c=i[r])&&(t=(o?c(e,n,t):c(t))||t);return o&&t&&d(e,n,t),t},m=(i,e)=>(n,o)=>e(n,o,i);import f from"axios";import{inject as y,injectable as h}from"inversify";import{Left as p,Right as g}from"purify-ts";import{configTypes as D}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as E,LEDGER_ORIGIN_TOKEN_HEADER as w}from"../../shared/constant/HttpHeaders";import A from"../../../package.json";let s=class{constructor(e){this.config=e}async getDescriptor({publicKey:e,address:n,challenge:o,network:t}){try{const r=await f.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/concordium/owner/${e}/${n}`,params:{challenge:o,network:t},headers:{[E]:`context-module/${A.version}`,[w]:this.config.originToken}});return r.data?this.isAccountOwnershipDto(r.data)?g({signedDescriptor:r.data.signedDescriptor,keyId:r.data.keyId,keyUsage:r.data.keyUsage}):p(new Error("[ContextModule] HttpAccountOwnershipDataSource: invalid response format")):p(new Error("[ContextModule] HttpAccountOwnershipDataSource: unexpected empty response"))}catch{return p(new Error("[ContextModule] HttpAccountOwnershipDataSource: Failed to fetch account ownership descriptor"))}}isAccountOwnershipDto(e){return typeof e=="object"&&e!==null&&"signedDescriptor"in e&&"keyId"in e&&"keyUsage"in e&&typeof e.signedDescriptor=="string"&&typeof e.keyId=="string"&&typeof e.keyUsage=="string"}};s=a([h(),m(0,y(D.Config))],s);export{s as HttpAccountOwnershipDataSource};
|
|
2
|
+
//# sourceMappingURL=HttpAccountOwnershipDataSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/account-ownership/data/HttpAccountOwnershipDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { type Either, Left, Right } from \"purify-ts\";\n\nimport {\n type AccountOwnershipDataSource,\n type AccountOwnershipDescriptor,\n type GetAccountOwnershipParams,\n} from \"@/account-ownership/data/AccountOwnershipDataSource\";\nimport { type AccountOwnershipDto } from \"@/account-ownership/data/dto/AccountOwnershipDto\";\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleServiceConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\n@injectable()\nexport class HttpAccountOwnershipDataSource\n implements AccountOwnershipDataSource\n{\n constructor(\n @inject(configTypes.Config)\n private readonly config: ContextModuleServiceConfig,\n ) {}\n\n async getDescriptor({\n publicKey,\n address,\n challenge,\n network,\n }: GetAccountOwnershipParams): Promise<\n Either<Error, AccountOwnershipDescriptor>\n > {\n try {\n const response = await axios.request<AccountOwnershipDto>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v2/concordium/owner/${publicKey}/${address}`,\n params: {\n challenge,\n network,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n if (!response.data) {\n return Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: unexpected empty response\",\n ),\n );\n }\n\n if (!this.isAccountOwnershipDto(response.data)) {\n return Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: invalid response format\",\n ),\n );\n }\n\n return Right({\n signedDescriptor: response.data.signedDescriptor,\n keyId: response.data.keyId,\n keyUsage: response.data.keyUsage,\n });\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: Failed to fetch account ownership descriptor\",\n ),\n );\n }\n }\n\n private isAccountOwnershipDto(value: unknown): value is AccountOwnershipDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"signedDescriptor\" in value &&\n \"keyId\" in value &&\n \"keyUsage\" in value &&\n typeof value.signedDescriptor === \"string\" &&\n typeof value.keyId === \"string\" &&\n typeof value.keyUsage === \"string\"\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "iOAAA,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ER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpAccountOwnershipDataSource", "config", "publicKey", "address", "challenge", "network", "response", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "Right", "Left", "value", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import s from"axios";import{Left as n,Right as i}from"purify-ts";import{LEDGER_CLIENT_VERSION_HEADER as d,LEDGER_ORIGIN_TOKEN_HEADER as c}from"../../shared/constant/HttpHeaders";import u from"../../../package.json";import{HttpAccountOwnershipDataSource as a}from"./HttpAccountOwnershipDataSource";vi.mock("axios");describe("HttpAccountOwnershipDataSource",()=>{const o={metadataServiceDomain:{url:"https://nft.api.live.ledger-test.com"},originToken:"test-origin-token"},r={signedDescriptor:"signed-descriptor-data",keyId:"domain_metadata_key",keyUsage:"trusted_name"};beforeEach(()=>{vi.clearAllMocks()}),describe("getDescriptor",()=>{it("should return descriptor on successful request",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:r});const t=await new a(o).getDescriptor(e);expect(s.request).toHaveBeenCalledWith({method:"GET",url:"https://nft.api.live.ledger-test.com/v2/concordium/owner/abcdef1234567890/3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",params:{challenge:"0xabcdef",network:"mainnet"},headers:{[d]:`context-module/${u.version}`,[c]:"test-origin-token"}}),expect(t).toEqual(i({signedDescriptor:"signed-descriptor-data",keyId:"domain_metadata_key",keyUsage:"trusted_name"}))}),it("should pass testnet network parameter",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"testnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:r}),await new a(o).getDescriptor(e),expect(s.request).toHaveBeenCalledWith(expect.objectContaining({params:{challenge:"0xabcdef",network:"testnet"}}))}),it("should return error when response data is empty",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:null});const t=await new a(o).getDescriptor(e);expect(t).toEqual(n(new Error("[ContextModule] HttpAccountOwnershipDataSource: unexpected empty response")))}),it("should return error when signedDescriptor is missing",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:{keyId:"domain_metadata_key",keyUsage:"trusted_name"}});const t=await new a(o).getDescriptor(e);expect(t).toEqual(n(new Error("[ContextModule] HttpAccountOwnershipDataSource: invalid response format")))}),it("should return error when keyId is missing",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:{signedDescriptor:"signed-descriptor-data",keyUsage:"trusted_name"}});const t=await new a(o).getDescriptor(e);expect(t).toEqual(n(new Error("[ContextModule] HttpAccountOwnershipDataSource: invalid response format")))}),it("should return error when keyUsage is missing",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:{signedDescriptor:"signed-descriptor-data",keyId:"domain_metadata_key"}});const t=await new a(o).getDescriptor(e);expect(t).toEqual(n(new Error("[ContextModule] HttpAccountOwnershipDataSource: invalid response format")))}),it("should return error when field has wrong type",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:{signedDescriptor:"signed-descriptor-data",keyId:123,keyUsage:"trusted_name"}});const t=await new a(o).getDescriptor(e);expect(t).toEqual(n(new Error("[ContextModule] HttpAccountOwnershipDataSource: invalid response format")))}),it("should return error when axios request fails",async()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockRejectedValue(new Error("Network error"));const t=await new a(o).getDescriptor(e);expect(t).toEqual(n(new Error("[ContextModule] HttpAccountOwnershipDataSource: Failed to fetch account ownership descriptor")))}),it("should use correct metadata service URL from config",async()=>{const e={metadataServiceDomain:{url:"https://custom-metadata.example.com"},originToken:"custom-token"},t={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(s,"request").mockResolvedValue({status:200,data:r}),await new a(e).getDescriptor(t),expect(s.request).toHaveBeenCalledWith(expect.objectContaining({url:"https://custom-metadata.example.com/v2/concordium/owner/abcdef1234567890/3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",headers:expect.objectContaining({[c]:"custom-token"})}))})})});
|
|
2
|
+
//# sourceMappingURL=HttpAccountOwnershipDataSource.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/account-ownership/data/HttpAccountOwnershipDataSource.test.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleServiceConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { HttpAccountOwnershipDataSource } from \"./HttpAccountOwnershipDataSource\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpAccountOwnershipDataSource\", () => {\n const config: ContextModuleServiceConfig = {\n metadataServiceDomain: {\n url: \"https://nft.api.live.ledger-test.com\",\n },\n originToken: \"test-origin-token\",\n } as ContextModuleServiceConfig;\n\n const validDto = {\n signedDescriptor: \"signed-descriptor-data\",\n keyId: \"domain_metadata_key\",\n keyUsage: \"trusted_name\",\n };\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n describe(\"getDescriptor\", () => {\n it(\"should return descriptor on successful request\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validDto,\n });\n\n // WHEN\n const result = await new HttpAccountOwnershipDataSource(\n config,\n ).getDescriptor(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith({\n method: \"GET\",\n url: \"https://nft.api.live.ledger-test.com/v2/concordium/owner/abcdef1234567890/3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n params: {\n challenge: \"0xabcdef\",\n network: \"mainnet\",\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: \"test-origin-token\",\n },\n });\n expect(result).toEqual(\n Right({\n signedDescriptor: \"signed-descriptor-data\",\n keyId: \"domain_metadata_key\",\n keyUsage: \"trusted_name\",\n }),\n );\n });\n\n it(\"should pass testnet network parameter\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"testnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validDto,\n });\n\n // WHEN\n await new HttpAccountOwnershipDataSource(config).getDescriptor(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n params: {\n challenge: \"0xabcdef\",\n network: \"testnet\",\n },\n }),\n );\n });\n\n it(\"should return error when response data is empty\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: null,\n });\n\n // WHEN\n const result = await new HttpAccountOwnershipDataSource(\n config,\n ).getDescriptor(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: unexpected empty response\",\n ),\n ),\n );\n });\n\n it(\"should return error when signedDescriptor is missing\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n keyId: \"domain_metadata_key\",\n keyUsage: \"trusted_name\",\n },\n });\n\n // WHEN\n const result = await new HttpAccountOwnershipDataSource(\n config,\n ).getDescriptor(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: invalid response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when keyId is missing\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n signedDescriptor: \"signed-descriptor-data\",\n keyUsage: \"trusted_name\",\n },\n });\n\n // WHEN\n const result = await new HttpAccountOwnershipDataSource(\n config,\n ).getDescriptor(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: invalid response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when keyUsage is missing\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n signedDescriptor: \"signed-descriptor-data\",\n keyId: \"domain_metadata_key\",\n },\n });\n\n // WHEN\n const result = await new HttpAccountOwnershipDataSource(\n config,\n ).getDescriptor(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: invalid response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when field has wrong type\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n signedDescriptor: \"signed-descriptor-data\",\n keyId: 123,\n keyUsage: \"trusted_name\",\n },\n });\n\n // WHEN\n const result = await new HttpAccountOwnershipDataSource(\n config,\n ).getDescriptor(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: invalid response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when axios request fails\", async () => {\n // GIVEN\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"Network error\"));\n\n // WHEN\n const result = await new HttpAccountOwnershipDataSource(\n config,\n ).getDescriptor(params);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpAccountOwnershipDataSource: Failed to fetch account ownership descriptor\",\n ),\n ),\n );\n });\n\n it(\"should use correct metadata service URL from config\", async () => {\n // GIVEN\n const customConfig: ContextModuleServiceConfig = {\n metadataServiceDomain: {\n url: \"https://custom-metadata.example.com\",\n },\n originToken: \"custom-token\",\n } as ContextModuleServiceConfig;\n const params = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\" as const,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validDto,\n });\n\n // WHEN\n await new HttpAccountOwnershipDataSource(customConfig).getDescriptor(\n params,\n );\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n url: \"https://custom-metadata.example.com/v2/concordium/owner/abcdef1234567890/3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n headers: expect.objectContaining({\n [LEDGER_ORIGIN_TOKEN_HEADER]: \"custom-token\",\n }),\n }),\n );\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAW,QAClB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAG5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAOC,MAAa,qBAEpB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6
|
+
"names": ["axios", "Left", "Right", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpAccountOwnershipDataSource", "config", "validDto", "params", "result", "customConfig"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=AccountOwnershipDto.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ContainerModule as r}from"inversify";import{HttpAccountOwnershipDataSource as e}from"../../account-ownership/data/HttpAccountOwnershipDataSource";import{AccountOwnershipContextLoader as n}from"../../account-ownership/domain/AccountOwnershipContextLoader";import{accountOwnershipTypes as t}from"./accountOwnershipTypes";const u=()=>new r(({bind:o})=>{o(t.AccountOwnershipDataSource).to(e),o(t.AccountOwnershipContextLoader).to(n)});export{u as accountOwnershipModuleFactory};
|
|
2
|
+
//# sourceMappingURL=accountOwnershipModuleFactory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/account-ownership/di/accountOwnershipModuleFactory.ts"],
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpAccountOwnershipDataSource } from \"@/account-ownership/data/HttpAccountOwnershipDataSource\";\nimport { AccountOwnershipContextLoader } from \"@/account-ownership/domain/AccountOwnershipContextLoader\";\n\nimport { accountOwnershipTypes } from \"./accountOwnershipTypes\";\n\nexport const accountOwnershipModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(accountOwnershipTypes.AccountOwnershipDataSource).to(\n HttpAccountOwnershipDataSource,\n );\n bind(accountOwnershipTypes.AccountOwnershipContextLoader).to(\n AccountOwnershipContextLoader,\n );\n });\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,kCAAAC,MAAsC,0DAC/C,OAAS,iCAAAC,MAAqC,2DAE9C,OAAS,yBAAAC,MAA6B,0BAE/B,MAAMC,EAAgC,IAC3C,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKF,EAAsB,0BAA0B,EAAE,GACrDF,CACF,EACAI,EAAKF,EAAsB,6BAA6B,EAAE,GACxDD,CACF,CACF,CAAC",
|
|
6
|
+
"names": ["ContainerModule", "HttpAccountOwnershipDataSource", "AccountOwnershipContextLoader", "accountOwnershipTypes", "accountOwnershipModuleFactory", "bind"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/account-ownership/di/accountOwnershipTypes.ts"],
|
|
4
|
+
"sourcesContent": ["export const accountOwnershipTypes = {\n AccountOwnershipDataSource: Symbol.for(\"AccountOwnershipDataSource\"),\n AccountOwnershipContextLoader: Symbol.for(\"AccountOwnershipContextLoader\"),\n};\n"],
|
|
5
|
+
"mappings": "AAAO,MAAMA,EAAwB,CACnC,2BAA4B,OAAO,IAAI,4BAA4B,EACnE,8BAA+B,OAAO,IAAI,+BAA+B,CAC3E",
|
|
6
|
+
"names": ["accountOwnershipTypes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var g=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var l=(i,e,t,r)=>{for(var o=r>1?void 0:r?C(e,t):e,n=i.length-1,c;n>=0;n--)(c=i[n])&&(o=(r?c(e,t,o):c(o))||o);return r&&o&&g(e,t,o),o},d=(i,e)=>(t,r)=>e(t,r,i);import{inject as y,injectable as m}from"inversify";import{accountOwnershipTypes as f}from"../../account-ownership/di/accountOwnershipTypes";import{pkiTypes as h}from"../../pki/di/pkiTypes";import{ClearSignContextType as p}from"../../shared/model/ClearSignContext";const w=[p.ACCOUNT_OWNERSHIP];let s=class{constructor(e,t){this._dataSource=e;this._certificateLoader=t}canHandle(e,t){return w.every(r=>t.includes(r))&&typeof e=="object"&&e!==null&&"publicKey"in e&&typeof e.publicKey=="string"&&e.publicKey.length>0&&"address"in e&&typeof e.address=="string"&&e.address.length>0&&"network"in e&&(e.network==="mainnet"||e.network==="testnet")&&"deviceModelId"in e&&e.deviceModelId!==void 0&&"challenge"in e&&typeof e.challenge=="string"&&e.challenge.length>0}async load({publicKey:e,address:t,network:r,deviceModelId:o,challenge:n}){return(await this._dataSource.getDescriptor({publicKey:e,address:t,challenge:n,network:r})).caseOf({Left:a=>Promise.resolve([{type:p.ERROR,error:a}]),Right:async a=>[{type:p.ACCOUNT_OWNERSHIP,payload:a.signedDescriptor,certificate:await this._certificateLoader.loadCertificate({keyId:a.keyId,keyUsage:a.keyUsage,targetDevice:o})}]})}};s=l([m(),d(0,y(f.AccountOwnershipDataSource)),d(1,y(h.PkiCertificateLoader))],s);export{s as AccountOwnershipContextLoader};
|
|
2
|
+
//# sourceMappingURL=AccountOwnershipContextLoader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/account-ownership/domain/AccountOwnershipContextLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type {\n AccountOwnershipDataSource,\n AccountOwnershipNetwork,\n} from \"@/account-ownership/data/AccountOwnershipDataSource\";\nimport { accountOwnershipTypes } from \"@/account-ownership/di/accountOwnershipTypes\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { type ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\nexport type AccountOwnershipContextInput = {\n publicKey: string;\n address: string;\n network: AccountOwnershipNetwork;\n deviceModelId: DeviceModelId;\n challenge: string;\n};\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [\n ClearSignContextType.ACCOUNT_OWNERSHIP,\n];\n\n@injectable()\nexport class AccountOwnershipContextLoader\n implements ContextLoader<AccountOwnershipContextInput>\n{\n constructor(\n @inject(accountOwnershipTypes.AccountOwnershipDataSource)\n private readonly _dataSource: AccountOwnershipDataSource,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is AccountOwnershipContextInput {\n return (\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type)) &&\n typeof input === \"object\" &&\n input !== null &&\n \"publicKey\" in input &&\n typeof input.publicKey === \"string\" &&\n input.publicKey.length > 0 &&\n \"address\" in input &&\n typeof input.address === \"string\" &&\n input.address.length > 0 &&\n \"network\" in input &&\n (input.network === \"mainnet\" || input.network === \"testnet\") &&\n \"deviceModelId\" in input &&\n input.deviceModelId !== undefined &&\n \"challenge\" in input &&\n typeof input.challenge === \"string\" &&\n input.challenge.length > 0\n );\n }\n\n async load({\n publicKey,\n address,\n network,\n deviceModelId,\n challenge,\n }: AccountOwnershipContextInput): Promise<ClearSignContext[]> {\n const descriptor = await this._dataSource.getDescriptor({\n publicKey,\n address,\n challenge,\n network,\n });\n\n return descriptor.caseOf({\n Left: (error): Promise<ClearSignContext[]> =>\n Promise.resolve([\n {\n type: ClearSignContextType.ERROR,\n error,\n },\n ]),\n Right: async (result): Promise<ClearSignContext[]> => [\n {\n type: ClearSignContextType.ACCOUNT_OWNERSHIP,\n payload: result.signedDescriptor,\n certificate: await this._certificateLoader.loadCertificate({\n keyId: result.keyId,\n keyUsage: result.keyUsage,\n targetDevice: deviceModelId,\n }),\n },\n ],\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "iOACA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAMnC,OAAS,yBAAAC,MAA6B,+CACtC,OAAS,YAAAC,MAAgB,oBAGzB,OAEE,wBAAAC,MACK,kCAUP,MAAMC,EAA0C,CAC9CC,EAAqB,iBACvB,EAGO,IAAMC,EAAN,KAEP,CACE,YAEmBC,EAEAC,EACjB,CAHiB,iBAAAD,EAEA,wBAAAC,CAChB,CAEH,UACEC,EACAC,EACuC,CACvC,OACEN,EAAgB,MAAOO,GAASD,EAAc,SAASC,CAAI,CAAC,GAC5D,OAAOF,GAAU,UACjBA,IAAU,MACV,cAAeA,GACf,OAAOA,EAAM,WAAc,UAC3BA,EAAM,UAAU,OAAS,GACzB,YAAaA,GACb,OAAOA,EAAM,SAAY,UACzBA,EAAM,QAAQ,OAAS,GACvB,YAAaA,IACZA,EAAM,UAAY,WAAaA,EAAM,UAAY,YAClD,kBAAmBA,GACnBA,EAAM,gBAAkB,QACxB,cAAeA,GACf,OAAOA,EAAM,WAAc,UAC3BA,EAAM,UAAU,OAAS,CAE7B,CAEA,MAAM,KAAK,CACT,UAAAG,EACA,QAAAC,EACA,QAAAC,EACA,cAAAC,EACA,UAAAC,CACF,EAA8D,CAQ5D,OAPmB,MAAM,KAAK,YAAY,cAAc,CACtD,UAAAJ,EACA,QAAAC,EACA,UAAAG,EACA,QAAAF,CACF,CAAC,GAEiB,OAAO,CACvB,KAAOG,GACL,QAAQ,QAAQ,CACd,CACE,KAAMZ,EAAqB,MAC3B,MAAAY,CACF,CACF,CAAC,EACH,MAAO,MAAOC,GAAwC,CACpD,CACE,KAAMb,EAAqB,kBAC3B,QAASa,EAAO,iBAChB,YAAa,MAAM,KAAK,mBAAmB,gBAAgB,CACzD,MAAOA,EAAO,MACd,SAAUA,EAAO,SACjB,aAAcH,CAChB,CAAC,CACH,CACF,CACF,CAAC,CACH,CACF,EArEaT,EAANa,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAsB,0BAA0B,GAEvDF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAN5BlB",
|
|
6
|
+
"names": ["inject", "injectable", "accountOwnershipTypes", "pkiTypes", "ClearSignContextType", "SUPPORTED_TYPES", "ClearSignContextType", "AccountOwnershipContextLoader", "_dataSource", "_certificateLoader", "input", "expectedTypes", "type", "publicKey", "address", "network", "deviceModelId", "challenge", "error", "result", "__decorateClass", "injectable", "__decorateParam", "inject", "accountOwnershipTypes", "pkiTypes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{DeviceModelId as a}from"@ledgerhq/device-management-kit";import{Left as p,Right as s}from"purify-ts";import{AccountOwnershipContextLoader as u}from"../../account-ownership/domain/AccountOwnershipContextLoader";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";describe("AccountOwnershipContextLoader",()=>{const i={getDescriptor:vi.fn()},c={loadCertificate:vi.fn()},n=new u(i,c),l={keyUsageNumber:4,payload:new Uint8Array([1,2,3])},d={signedDescriptor:"account-ownership-descriptor-payload",keyId:"domain_metadata_key",keyUsage:"trusted_name"};beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(c,"loadCertificate").mockResolvedValue(l)}),describe("canHandle",()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",network:"mainnet",deviceModelId:a.FLEX,challenge:"0xabcdef"};it("should return true for valid input with ACCOUNT_OWNERSHIP type",()=>{expect(n.canHandle(e,[o.ACCOUNT_OWNERSHIP])).toBe(!0)}),it("should return false when expected types include unsupported types",()=>{expect(n.canHandle(e,[o.TOKEN])).toBe(!1),expect(n.canHandle(e,[o.TRUSTED_NAME])).toBe(!1)}),it("should return true when expected types include ACCOUNT_OWNERSHIP among others",()=>{expect(n.canHandle(e,[o.ACCOUNT_OWNERSHIP,o.TOKEN])).toBe(!0)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"]])("should return false for %s",(t,r)=>{expect(n.canHandle(t,[o.ACCOUNT_OWNERSHIP])).toBe(!1)}),it.each([[{...e,publicKey:void 0},"missing publicKey"],[{...e,address:void 0},"missing address"],[{...e,network:void 0},"missing network"],[{...e,deviceModelId:void 0},"missing deviceModelId"],[{...e,challenge:void 0},"missing challenge"]])("should return false for %s",(t,r)=>{expect(n.canHandle(t,[o.ACCOUNT_OWNERSHIP])).toBe(!1)}),it.each([[{...e,publicKey:""},"empty publicKey"],[{...e,address:""},"empty address"],[{...e,challenge:""},"empty challenge"]])("should return false for %s",(t,r)=>{expect(n.canHandle(t,[o.ACCOUNT_OWNERSHIP])).toBe(!1)}),it("should return false for invalid network value",()=>{expect(n.canHandle({...e,network:"devnet"},[o.ACCOUNT_OWNERSHIP])).toBe(!1)}),it("should return true for testnet network",()=>{expect(n.canHandle({...e,network:"testnet"},[o.ACCOUNT_OWNERSHIP])).toBe(!0)}),it("should return true for different device models",()=>{for(const t of[a.NANO_S,a.NANO_SP,a.NANO_X,a.STAX,a.FLEX])expect(n.canHandle({...e,deviceModelId:t},[o.ACCOUNT_OWNERSHIP])).toBe(!0)})}),describe("load",()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",network:"mainnet",deviceModelId:a.FLEX,challenge:"0xabcdef"};it("should return ACCOUNT_OWNERSHIP context with certificate",async()=>{vi.spyOn(i,"getDescriptor").mockResolvedValue(s(d));const t=await n.load(e);expect(i.getDescriptor).toHaveBeenCalledWith({publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"}),expect(c.loadCertificate).toHaveBeenCalledWith({keyId:"domain_metadata_key",keyUsage:"trusted_name",targetDevice:a.FLEX}),expect(t).toEqual([{type:o.ACCOUNT_OWNERSHIP,payload:"account-ownership-descriptor-payload",certificate:l}])}),it("should return ACCOUNT_OWNERSHIP context without certificate when loadCertificate returns undefined",async()=>{vi.spyOn(i,"getDescriptor").mockResolvedValue(s(d)),vi.spyOn(c,"loadCertificate").mockResolvedValue(void 0);const t=await n.load(e);expect(t).toEqual([{type:o.ACCOUNT_OWNERSHIP,payload:"account-ownership-descriptor-payload",certificate:void 0}])}),it("should return ERROR context when data source returns Left",async()=>{const t=new Error("Failed to get descriptor");vi.spyOn(i,"getDescriptor").mockResolvedValue(p(t));const r=await n.load(e);expect(r).toEqual([{type:o.ERROR,error:t}]),expect(c.loadCertificate).not.toHaveBeenCalled()}),it("should pass correct device model to certificate loader",async()=>{const t={...e,deviceModelId:a.NANO_X};vi.spyOn(i,"getDescriptor").mockResolvedValue(s(d)),await n.load(t),expect(c.loadCertificate).toHaveBeenCalledWith(expect.objectContaining({targetDevice:a.NANO_X}))}),it("should pass testnet network to data source",async()=>{const t={...e,network:"testnet"};vi.spyOn(i,"getDescriptor").mockResolvedValue(s(d)),await n.load(t),expect(i.getDescriptor).toHaveBeenCalledWith(expect.objectContaining({network:"testnet"}))}),it("should handle long descriptor payloads",async()=>{const t="a".repeat(1e3);vi.spyOn(i,"getDescriptor").mockResolvedValue(s({...d,signedDescriptor:t}));const r=await n.load(e);expect(r[0].payload).toBe(t)})})});
|
|
2
|
+
//# sourceMappingURL=AccountOwnershipContextLoader.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/account-ownership/domain/AccountOwnershipContextLoader.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport type {\n AccountOwnershipDataSource,\n AccountOwnershipDescriptor,\n} from \"@/account-ownership/data/AccountOwnershipDataSource\";\nimport {\n type AccountOwnershipContextInput,\n AccountOwnershipContextLoader,\n} from \"@/account-ownership/domain/AccountOwnershipContextLoader\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport {\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\ndescribe(\"AccountOwnershipContextLoader\", () => {\n const mockDataSource: AccountOwnershipDataSource = {\n getDescriptor: vi.fn(),\n };\n const mockPkiCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n const loader = new AccountOwnershipContextLoader(\n mockDataSource,\n mockPkiCertificateLoader,\n );\n\n const mockCertificate: PkiCertificate = {\n keyUsageNumber: 4,\n payload: new Uint8Array([1, 2, 3]),\n };\n\n const mockDescriptor: AccountOwnershipDescriptor = {\n signedDescriptor: \"account-ownership-descriptor-payload\",\n keyId: \"domain_metadata_key\",\n keyUsage: \"trusted_name\",\n };\n\n beforeEach(() => {\n vi.clearAllMocks();\n vi.spyOn(mockPkiCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n });\n\n describe(\"canHandle\", () => {\n const validInput: AccountOwnershipContextInput = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n network: \"mainnet\",\n deviceModelId: DeviceModelId.FLEX,\n challenge: \"0xabcdef\",\n };\n\n it(\"should return true for valid input with ACCOUNT_OWNERSHIP type\", () => {\n expect(\n loader.canHandle(validInput, [ClearSignContextType.ACCOUNT_OWNERSHIP]),\n ).toBe(true);\n });\n\n it(\"should return false when expected types include unsupported types\", () => {\n expect(loader.canHandle(validInput, [ClearSignContextType.TOKEN])).toBe(\n false,\n );\n expect(\n loader.canHandle(validInput, [ClearSignContextType.TRUSTED_NAME]),\n ).toBe(false);\n });\n\n it(\"should return true when expected types include ACCOUNT_OWNERSHIP among others\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.ACCOUNT_OWNERSHIP,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(true);\n });\n\n it.each([\n [null, \"null input\"],\n [undefined, \"undefined input\"],\n [{}, \"empty object\"],\n [\"string\", \"string input\"],\n [123, \"number input\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [ClearSignContextType.ACCOUNT_OWNERSHIP]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, publicKey: undefined }, \"missing publicKey\"],\n [{ ...validInput, address: undefined }, \"missing address\"],\n [{ ...validInput, network: undefined }, \"missing network\"],\n [{ ...validInput, deviceModelId: undefined }, \"missing deviceModelId\"],\n [{ ...validInput, challenge: undefined }, \"missing challenge\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [ClearSignContextType.ACCOUNT_OWNERSHIP]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, publicKey: \"\" }, \"empty publicKey\"],\n [{ ...validInput, address: \"\" }, \"empty address\"],\n [{ ...validInput, challenge: \"\" }, \"empty challenge\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [ClearSignContextType.ACCOUNT_OWNERSHIP]),\n ).toBe(false);\n });\n\n it(\"should return false for invalid network value\", () => {\n expect(\n loader.canHandle({ ...validInput, network: \"devnet\" }, [\n ClearSignContextType.ACCOUNT_OWNERSHIP,\n ]),\n ).toBe(false);\n });\n\n it(\"should return true for testnet network\", () => {\n expect(\n loader.canHandle({ ...validInput, network: \"testnet\" }, [\n ClearSignContextType.ACCOUNT_OWNERSHIP,\n ]),\n ).toBe(true);\n });\n\n it(\"should return true for different device models\", () => {\n for (const deviceModelId of [\n DeviceModelId.NANO_S,\n DeviceModelId.NANO_SP,\n DeviceModelId.NANO_X,\n DeviceModelId.STAX,\n DeviceModelId.FLEX,\n ]) {\n expect(\n loader.canHandle({ ...validInput, deviceModelId }, [\n ClearSignContextType.ACCOUNT_OWNERSHIP,\n ]),\n ).toBe(true);\n }\n });\n });\n\n describe(\"load\", () => {\n const input: AccountOwnershipContextInput = {\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n network: \"mainnet\",\n deviceModelId: DeviceModelId.FLEX,\n challenge: \"0xabcdef\",\n };\n\n it(\"should return ACCOUNT_OWNERSHIP context with certificate\", async () => {\n // GIVEN\n vi.spyOn(mockDataSource, \"getDescriptor\").mockResolvedValue(\n Right(mockDescriptor),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockDataSource.getDescriptor).toHaveBeenCalledWith({\n publicKey: \"abcdef1234567890\",\n address: \"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB\",\n challenge: \"0xabcdef\",\n network: \"mainnet\",\n });\n expect(mockPkiCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: \"domain_metadata_key\",\n keyUsage: \"trusted_name\",\n targetDevice: DeviceModelId.FLEX,\n });\n expect(result).toEqual([\n {\n type: ClearSignContextType.ACCOUNT_OWNERSHIP,\n payload: \"account-ownership-descriptor-payload\",\n certificate: mockCertificate,\n },\n ]);\n });\n\n it(\"should return ACCOUNT_OWNERSHIP context without certificate when loadCertificate returns undefined\", async () => {\n // GIVEN\n vi.spyOn(mockDataSource, \"getDescriptor\").mockResolvedValue(\n Right(mockDescriptor),\n );\n vi.spyOn(mockPkiCertificateLoader, \"loadCertificate\").mockResolvedValue(\n undefined,\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ACCOUNT_OWNERSHIP,\n payload: \"account-ownership-descriptor-payload\",\n certificate: undefined,\n },\n ]);\n });\n\n it(\"should return ERROR context when data source returns Left\", async () => {\n // GIVEN\n const error = new Error(\"Failed to get descriptor\");\n vi.spyOn(mockDataSource, \"getDescriptor\").mockResolvedValue(Left(error));\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error,\n },\n ]);\n expect(mockPkiCertificateLoader.loadCertificate).not.toHaveBeenCalled();\n });\n\n it(\"should pass correct device model to certificate loader\", async () => {\n // GIVEN\n const inputNanoX = { ...input, deviceModelId: DeviceModelId.NANO_X };\n vi.spyOn(mockDataSource, \"getDescriptor\").mockResolvedValue(\n Right(mockDescriptor),\n );\n\n // WHEN\n await loader.load(inputNanoX);\n\n // THEN\n expect(mockPkiCertificateLoader.loadCertificate).toHaveBeenCalledWith(\n expect.objectContaining({\n targetDevice: DeviceModelId.NANO_X,\n }),\n );\n });\n\n it(\"should pass testnet network to data source\", async () => {\n // GIVEN\n const inputTestnet = { ...input, network: \"testnet\" as const };\n vi.spyOn(mockDataSource, \"getDescriptor\").mockResolvedValue(\n Right(mockDescriptor),\n );\n\n // WHEN\n await loader.load(inputTestnet);\n\n // THEN\n expect(mockDataSource.getDescriptor).toHaveBeenCalledWith(\n expect.objectContaining({\n network: \"testnet\",\n }),\n );\n });\n\n it(\"should handle long descriptor payloads\", async () => {\n // GIVEN\n const longPayload = \"a\".repeat(1000);\n vi.spyOn(mockDataSource, \"getDescriptor\").mockResolvedValue(\n Right({ ...mockDescriptor, signedDescriptor: longPayload }),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect((result[0] as ClearSignContextSuccess).payload).toBe(longPayload);\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAM5B,OAEE,iCAAAC,MACK,2DAGP,OAEE,wBAAAC,MACK,kCAEP,SAAS,gCAAiC,IAAM,CAC9C,MAAMC,EAA6C,CACjD,cAAe,GAAG,GAAG,CACvB,EACMC,EAAiD,CACrD,gBAAiB,GAAG,GAAG,CACzB,EACMC,EAAS,IAAIJ,EACjBE,EACAC,CACF,EAEME,EAAkC,CACtC,eAAgB,EAChB,QAAS,IAAI,WAAW,CAAC,EAAG,EAAG,CAAC,CAAC,CACnC,EAEMC,EAA6C,CACjD,iBAAkB,uCAClB,MAAO,sBACP,SAAU,cACZ,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,EACjB,GAAG,MAAMH,EAA0B,iBAAiB,EAAE,kBACpDE,CACF,CACF,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,MAAME,EAA2C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C7D,GAAG,MAAMN,EAAgB,eAAe,EAAE,kBACxCH,EAAMO,CAAc,CACtB,EAGA,MAAMF,EAAO,KAAKU,CAAY,EAG9B,OAAOZ,EAAe,aAAa,EAAE,qBACnC,OAAO,iBAAiB,CACtB,QAAS,SACX,CAAC,CACH,CACF,CAAC,EAED,GAAG,yCAA0C,SAAY,CAEvD,MAAMa,EAAc,IAAI,OAAO,GAAI,EACnC,GAAG,MAAMb,EAAgB,eAAe,EAAE,kBACxCH,EAAM,CAAE,GAAGO,EAAgB,iBAAkBS,CAAY,CAAC,CAC5D,EAGA,MAAMJ,EAAS,MAAMP,EAAO,KAAKI,CAAK,EAGtC,OAAQG,EAAO,CAAC,EAA8B,OAAO,EAAE,KAAKI,CAAW,CACzE,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["DeviceModelId", "Left", "Right", "AccountOwnershipContextLoader", "ClearSignContextType", "mockDataSource", "mockPkiCertificateLoader", "loader", "mockCertificate", "mockDescriptor", "validInput", "input", "_description", "deviceModelId", "result", "error", "inputNanoX", "inputTestnet", "longPayload"]
|
|
7
|
+
}
|
package/lib/esm/src/di.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Container as t}from"inversify";import{
|
|
1
|
+
import{Container as t}from"inversify";import{accountOwnershipModuleFactory as e}from"./account-ownership/di/accountOwnershipModuleFactory";import{calldataModuleFactory as a}from"./calldata/di/calldataModuleFactory";import{configModuleFactory as m}from"./config/di/configModuleFactory";import{configTypes as i}from"./config/di/configTypes";import{dynamicNetworkModuleFactory as n}from"./dynamic-network/di/dynamicNetworkModuleFactory";import{externalPluginModuleFactory as c}from"./external-plugin/di/externalPluginModuleFactory";import{gatedSigningModuleFactory as l}from"./gated-signing/di/gatedSigningModuleFactory";import{nftModuleFactory as u}from"./nft/di/nftModuleFactory";import{nanoPkiModuleFactory as d}from"./pki/di/pkiModuleFactory";import{proxyModuleFactory as p}from"./proxy/di/proxyModuleFactory";import{reporterModuleFactory as f}from"./reporter/di/reporterModuleFactory";import{safeModuleFactory as y}from"./safe/di/safeModuleFactory";import{solanaContextModuleFactory as M}from"./solana/di/SolanaContextModuleFactory";import{solanaLifiModuleFactory as F}from"./solanaLifi/di/lifiModuleFactory";import{solanaTokenModuleFactory as g}from"./solanaToken/di/tokenModuleFactory";import{tokenModuleFactory as s}from"./token/di/tokenModuleFactory";import{transactionCheckModuleFactory as C}from"./transaction-check/di/transactionCheckModuleFactory";import{trustedNameModuleFactory as x}from"./trusted-name/di/trustedNameModuleFactory";import{typedDataModuleFactory as k}from"./typed-data/di/typedDataModuleFactory";import{uniswapModuleFactory as S}from"./uniswap/di/uniswapModuleFactory";const K=({config:o})=>{const r=new t;return r.bind(i.ContextModuleLoggerFactory).toConstantValue(o.loggerFactory),r.loadSync(m(o),e(),c(),n(),u(),p(o.datasource),y(),l(),s(),a(),x(o.customTrustedNameDataSource),k(),d(),S(),C(),M(),g(),F(),f()),r};export{K as makeContainer};
|
|
2
2
|
//# sourceMappingURL=di.js.map
|
package/lib/esm/src/di.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/di.ts"],
|
|
4
|
-
"sourcesContent": ["import { type LoggerPublisherService } from \"@ledgerhq/device-management-kit\";\nimport { Container } from \"inversify\";\n\nimport { calldataModuleFactory } from \"@/calldata/di/calldataModuleFactory\";\nimport { configModuleFactory } from \"@/config/di/configModuleFactory\";\nimport { configTypes } from \"@/config/di/configTypes\";\nimport {\n type ContextModuleLoaderConfig,\n type ContextModuleServiceConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { dynamicNetworkModuleFactory } from \"@/dynamic-network/di/dynamicNetworkModuleFactory\";\nimport { externalPluginModuleFactory } from \"@/external-plugin/di/externalPluginModuleFactory\";\nimport { gatedSigningModuleFactory } from \"@/gated-signing/di/gatedSigningModuleFactory\";\nimport { nftModuleFactory } from \"@/nft/di/nftModuleFactory\";\nimport { nanoPkiModuleFactory } from \"@/pki/di/pkiModuleFactory\";\nimport { proxyModuleFactory } from \"@/proxy/di/proxyModuleFactory\";\nimport { reporterModuleFactory } from \"@/reporter/di/reporterModuleFactory\";\nimport { safeModuleFactory } from \"@/safe/di/safeModuleFactory\";\nimport { solanaContextModuleFactory } from \"@/solana/di/SolanaContextModuleFactory\";\nimport { solanaLifiModuleFactory } from \"@/solanaLifi/di/lifiModuleFactory\";\nimport { solanaTokenModuleFactory } from \"@/solanaToken/di/tokenModuleFactory\";\nimport { tokenModuleFactory } from \"@/token/di/tokenModuleFactory\";\nimport { transactionCheckModuleFactory } from \"@/transaction-check/di/transactionCheckModuleFactory\";\nimport { trustedNameModuleFactory } from \"@/trusted-name/di/trustedNameModuleFactory\";\nimport { typedDataModuleFactory } from \"@/typed-data/di/typedDataModuleFactory\";\nimport { uniswapModuleFactory } from \"@/uniswap/di/uniswapModuleFactory\";\n\ntype MakeContainerArgs = {\n config: ContextModuleServiceConfig & ContextModuleLoaderConfig;\n};\n\nexport const makeContainer = ({ config }: MakeContainerArgs) => {\n const container = new Container();\n\n container\n .bind<\n (tag: string) => LoggerPublisherService\n >(configTypes.ContextModuleLoggerFactory)\n .toConstantValue(config.loggerFactory);\n\n container.loadSync(\n configModuleFactory(config),\n externalPluginModuleFactory(),\n dynamicNetworkModuleFactory(),\n nftModuleFactory(),\n proxyModuleFactory(config.datasource),\n safeModuleFactory(),\n gatedSigningModuleFactory(),\n tokenModuleFactory(),\n calldataModuleFactory(),\n trustedNameModuleFactory(config.customTrustedNameDataSource),\n typedDataModuleFactory(),\n nanoPkiModuleFactory(),\n uniswapModuleFactory(),\n transactionCheckModuleFactory(),\n solanaContextModuleFactory(),\n solanaTokenModuleFactory(),\n solanaLifiModuleFactory(),\n reporterModuleFactory(),\n );\n\n return container;\n};\n"],
|
|
5
|
-
"mappings": "AACA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,yBAAAC,MAA6B,sCACtC,OAAS,uBAAAC,MAA2B,kCACpC,OAAS,eAAAC,MAAmB,0BAK5B,OAAS,+BAAAC,MAAmC,mDAC5C,OAAS,+BAAAC,MAAmC,mDAC5C,OAAS,6BAAAC,MAAiC,+CAC1C,OAAS,oBAAAC,MAAwB,4BACjC,OAAS,wBAAAC,MAA4B,4BACrC,OAAS,sBAAAC,MAA0B,gCACnC,OAAS,yBAAAC,MAA6B,sCACtC,OAAS,qBAAAC,MAAyB,8BAClC,OAAS,8BAAAC,MAAkC,yCAC3C,OAAS,2BAAAC,MAA+B,oCACxC,OAAS,4BAAAC,MAAgC,sCACzC,OAAS,sBAAAC,MAA0B,gCACnC,OAAS,iCAAAC,MAAqC,uDAC9C,OAAS,4BAAAC,MAAgC,6CACzC,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,wBAAAC,MAA4B,oCAM9B,MAAMC,EAAgB,CAAC,CAAE,OAAAC,CAAO,IAAyB,CAC9D,MAAMC,EAAY,
|
|
6
|
-
"names": ["Container", "calldataModuleFactory", "configModuleFactory", "configTypes", "dynamicNetworkModuleFactory", "externalPluginModuleFactory", "gatedSigningModuleFactory", "nftModuleFactory", "nanoPkiModuleFactory", "proxyModuleFactory", "reporterModuleFactory", "safeModuleFactory", "solanaContextModuleFactory", "solanaLifiModuleFactory", "solanaTokenModuleFactory", "tokenModuleFactory", "transactionCheckModuleFactory", "trustedNameModuleFactory", "typedDataModuleFactory", "uniswapModuleFactory", "makeContainer", "config", "container"]
|
|
4
|
+
"sourcesContent": ["import { type LoggerPublisherService } from \"@ledgerhq/device-management-kit\";\nimport { Container } from \"inversify\";\n\nimport { accountOwnershipModuleFactory } from \"@/account-ownership/di/accountOwnershipModuleFactory\";\nimport { calldataModuleFactory } from \"@/calldata/di/calldataModuleFactory\";\nimport { configModuleFactory } from \"@/config/di/configModuleFactory\";\nimport { configTypes } from \"@/config/di/configTypes\";\nimport {\n type ContextModuleLoaderConfig,\n type ContextModuleServiceConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { dynamicNetworkModuleFactory } from \"@/dynamic-network/di/dynamicNetworkModuleFactory\";\nimport { externalPluginModuleFactory } from \"@/external-plugin/di/externalPluginModuleFactory\";\nimport { gatedSigningModuleFactory } from \"@/gated-signing/di/gatedSigningModuleFactory\";\nimport { nftModuleFactory } from \"@/nft/di/nftModuleFactory\";\nimport { nanoPkiModuleFactory } from \"@/pki/di/pkiModuleFactory\";\nimport { proxyModuleFactory } from \"@/proxy/di/proxyModuleFactory\";\nimport { reporterModuleFactory } from \"@/reporter/di/reporterModuleFactory\";\nimport { safeModuleFactory } from \"@/safe/di/safeModuleFactory\";\nimport { solanaContextModuleFactory } from \"@/solana/di/SolanaContextModuleFactory\";\nimport { solanaLifiModuleFactory } from \"@/solanaLifi/di/lifiModuleFactory\";\nimport { solanaTokenModuleFactory } from \"@/solanaToken/di/tokenModuleFactory\";\nimport { tokenModuleFactory } from \"@/token/di/tokenModuleFactory\";\nimport { transactionCheckModuleFactory } from \"@/transaction-check/di/transactionCheckModuleFactory\";\nimport { trustedNameModuleFactory } from \"@/trusted-name/di/trustedNameModuleFactory\";\nimport { typedDataModuleFactory } from \"@/typed-data/di/typedDataModuleFactory\";\nimport { uniswapModuleFactory } from \"@/uniswap/di/uniswapModuleFactory\";\n\ntype MakeContainerArgs = {\n config: ContextModuleServiceConfig & ContextModuleLoaderConfig;\n};\n\nexport const makeContainer = ({ config }: MakeContainerArgs) => {\n const container = new Container();\n\n container\n .bind<\n (tag: string) => LoggerPublisherService\n >(configTypes.ContextModuleLoggerFactory)\n .toConstantValue(config.loggerFactory);\n\n container.loadSync(\n configModuleFactory(config),\n accountOwnershipModuleFactory(),\n externalPluginModuleFactory(),\n dynamicNetworkModuleFactory(),\n nftModuleFactory(),\n proxyModuleFactory(config.datasource),\n safeModuleFactory(),\n gatedSigningModuleFactory(),\n tokenModuleFactory(),\n calldataModuleFactory(),\n trustedNameModuleFactory(config.customTrustedNameDataSource),\n typedDataModuleFactory(),\n nanoPkiModuleFactory(),\n uniswapModuleFactory(),\n transactionCheckModuleFactory(),\n solanaContextModuleFactory(),\n solanaTokenModuleFactory(),\n solanaLifiModuleFactory(),\n reporterModuleFactory(),\n );\n\n return container;\n};\n"],
|
|
5
|
+
"mappings": "AACA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,iCAAAC,MAAqC,uDAC9C,OAAS,yBAAAC,MAA6B,sCACtC,OAAS,uBAAAC,MAA2B,kCACpC,OAAS,eAAAC,MAAmB,0BAK5B,OAAS,+BAAAC,MAAmC,mDAC5C,OAAS,+BAAAC,MAAmC,mDAC5C,OAAS,6BAAAC,MAAiC,+CAC1C,OAAS,oBAAAC,MAAwB,4BACjC,OAAS,wBAAAC,MAA4B,4BACrC,OAAS,sBAAAC,MAA0B,gCACnC,OAAS,yBAAAC,MAA6B,sCACtC,OAAS,qBAAAC,MAAyB,8BAClC,OAAS,8BAAAC,MAAkC,yCAC3C,OAAS,2BAAAC,MAA+B,oCACxC,OAAS,4BAAAC,MAAgC,sCACzC,OAAS,sBAAAC,MAA0B,gCACnC,OAAS,iCAAAC,MAAqC,uDAC9C,OAAS,4BAAAC,MAAgC,6CACzC,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,wBAAAC,MAA4B,oCAM9B,MAAMC,EAAgB,CAAC,CAAE,OAAAC,CAAO,IAAyB,CAC9D,MAAMC,EAAY,IAAIvB,EAEtB,OAAAuB,EACG,KAECnB,EAAY,0BAA0B,EACvC,gBAAgBkB,EAAO,aAAa,EAEvCC,EAAU,SACRpB,EAAoBmB,CAAM,EAC1BrB,EAA8B,EAC9BK,EAA4B,EAC5BD,EAA4B,EAC5BG,EAAiB,EACjBE,EAAmBY,EAAO,UAAU,EACpCV,EAAkB,EAClBL,EAA0B,EAC1BS,EAAmB,EACnBd,EAAsB,EACtBgB,EAAyBI,EAAO,2BAA2B,EAC3DH,EAAuB,EACvBV,EAAqB,EACrBW,EAAqB,EACrBH,EAA8B,EAC9BJ,EAA2B,EAC3BE,EAAyB,EACzBD,EAAwB,EACxBH,EAAsB,CACxB,EAEOY,CACT",
|
|
6
|
+
"names": ["Container", "accountOwnershipModuleFactory", "calldataModuleFactory", "configModuleFactory", "configTypes", "dynamicNetworkModuleFactory", "externalPluginModuleFactory", "gatedSigningModuleFactory", "nftModuleFactory", "nanoPkiModuleFactory", "proxyModuleFactory", "reporterModuleFactory", "safeModuleFactory", "solanaContextModuleFactory", "solanaLifiModuleFactory", "solanaTokenModuleFactory", "tokenModuleFactory", "transactionCheckModuleFactory", "trustedNameModuleFactory", "typedDataModuleFactory", "uniswapModuleFactory", "makeContainer", "config", "container"]
|
|
7
7
|
}
|
package/lib/esm/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./calldata/data/CalldataDescriptorDataSource";export*from"./calldata/data/HttpCalldataDescriptorDataSource";export*from"./calldata/domain/CalldataContextLoader";export*from"./ContextModule";export*from"./ContextModuleBuilder";export*from"./DefaultContextModule";export*from"./dynamic-network/data/DynamicNetworkDataSource";export*from"./dynamic-network/data/HttpDynamicNetworkDataSource";export*from"./dynamic-network/domain/DynamicNetworkContextLoader";export*from"./dynamic-network/model/DynamicNetworkConfiguration";export*from"./external-plugin/data/ExternalPluginDataSource";export*from"./external-plugin/data/HttpExternalPluginDataSource";export*from"./external-plugin/domain/ExternalPluginContextLoader";export*from"./gated-signing/data/GatedDescriptorDataSource";export*from"./gated-signing/data/HttpGatedDescriptorDataSource";export*from"./gated-signing/domain/GatedSigningContextLoader";export*from"./gated-signing/domain/GatedSigningTypedDataContextLoader";export*from"./nft/data/HttpNftDataSource";export*from"./nft/data/NftDataSource";export*from"./nft/domain/NftContextFieldLoader";export*from"./nft/domain/NftContextLoader";export*from"./pki/data/HttpPkiCertificateDataSource";export*from"./pki/data/PkiCertificateDataSource";export*from"./pki/domain/DefaultPkiCertificateLoader";export*from"./pki/domain/PkiCertificateLoader";export*from"./pki/model/KeyId";export*from"./pki/model/KeyUsage";export*from"./pki/model/PkiCertificate";export*from"./pki/model/PkiCertificateInfo";export*from"./proxy/data/HttpProxyDataSource";export*from"./proxy/data/HttpSafeProxyDataSource";export*from"./proxy/data/ProxyDataSource";export*from"./proxy/domain/ProxyContextFieldLoader";export*from"./reporter/data/BlindSigningReporterDatasource";export*from"./reporter/data/HttpBlindSigningReporterDatasource";export*from"./reporter/domain/BlindSigningReporter";export*from"./reporter/domain/DefaultBlindSigningReporter";export*from"./reporter/model/BlindSigningEvent";export*from"./reporter/model/BlindSigningModelId";export*from"./shared/domain/ContextFieldLoader";export*from"./shared/domain/ContextLoader";export*from"./shared/model/ClearSignContext";export*from"./shared/model/GenericPath";export*from"./shared/model/SolanaContextTypes";export*from"./shared/model/TransactionSubset";export*from"./shared/model/TypedDataClearSignContext";export*from"./shared/model/TypedDataContext";export*from"./solana/data/HttpSolanaOwnerInfoDataSource";export*from"./solana/data/SolanaDataSource";export*from"./solana/domain/DefaultSolanaContextLoader";export*from"./solana/domain/SolanaContextLoader";export*from"./solana/domain/solanaContextTypes";export*from"./token/data/HttpTokenDataSource";export*from"./token/data/TokenDataSource";export*from"./token/domain/TokenContextFieldLoader";export*from"./token/domain/TokenContextLoader";export*from"./trusted-name/data/HttpTrustedNameDataSource";export*from"./trusted-name/data/TrustedNameDataSource";export*from"./trusted-name/domain/TrustedNameContextFieldLoader";export*from"./trusted-name/domain/TrustedNameContextLoader";export*from"./typed-data/data/HttpTypedDataDataSource";export*from"./typed-data/data/TypedDataDataSource";export*from"./typed-data/domain/DefaultTypedDataContextLoader";export*from"./typed-data/domain/TypedDataContextLoader";export*from"./typed-data/utils/getSchemaHash";export*from"./uniswap/data/AbiDecoderDataSource";export*from"./uniswap/data/CommandDecoderDataSource";export*from"./uniswap/data/DefaultCommandDecoderDataSource";export*from"./uniswap/data/EthersAbiDecoderDataSource";export*from"./uniswap/domain/UniswapContextLoader";
|
|
1
|
+
export*from"./account-ownership/data/AccountOwnershipDataSource";export*from"./account-ownership/data/HttpAccountOwnershipDataSource";export*from"./account-ownership/domain/AccountOwnershipContextLoader";export*from"./calldata/data/CalldataDescriptorDataSource";export*from"./calldata/data/HttpCalldataDescriptorDataSource";export*from"./calldata/domain/CalldataContextLoader";export*from"./ContextModule";export*from"./ContextModuleBuilder";export*from"./DefaultContextModule";export*from"./dynamic-network/data/DynamicNetworkDataSource";export*from"./dynamic-network/data/HttpDynamicNetworkDataSource";export*from"./dynamic-network/domain/DynamicNetworkContextLoader";export*from"./dynamic-network/model/DynamicNetworkConfiguration";export*from"./external-plugin/data/ExternalPluginDataSource";export*from"./external-plugin/data/HttpExternalPluginDataSource";export*from"./external-plugin/domain/ExternalPluginContextLoader";export*from"./gated-signing/data/GatedDescriptorDataSource";export*from"./gated-signing/data/HttpGatedDescriptorDataSource";export*from"./gated-signing/domain/GatedSigningContextLoader";export*from"./gated-signing/domain/GatedSigningTypedDataContextLoader";export*from"./nft/data/HttpNftDataSource";export*from"./nft/data/NftDataSource";export*from"./nft/domain/NftContextFieldLoader";export*from"./nft/domain/NftContextLoader";export*from"./pki/data/HttpPkiCertificateDataSource";export*from"./pki/data/PkiCertificateDataSource";export*from"./pki/domain/DefaultPkiCertificateLoader";export*from"./pki/domain/PkiCertificateLoader";export*from"./pki/model/KeyId";export*from"./pki/model/KeyUsage";export*from"./pki/model/PkiCertificate";export*from"./pki/model/PkiCertificateInfo";export*from"./proxy/data/HttpProxyDataSource";export*from"./proxy/data/HttpSafeProxyDataSource";export*from"./proxy/data/ProxyDataSource";export*from"./proxy/domain/ProxyContextFieldLoader";export*from"./reporter/data/BlindSigningReporterDatasource";export*from"./reporter/data/HttpBlindSigningReporterDatasource";export*from"./reporter/domain/BlindSigningReporter";export*from"./reporter/domain/DefaultBlindSigningReporter";export*from"./reporter/model/BlindSigningEvent";export*from"./reporter/model/BlindSigningModelId";export*from"./shared/domain/ContextFieldLoader";export*from"./shared/domain/ContextLoader";export*from"./shared/model/ClearSignContext";export*from"./shared/model/GenericPath";export*from"./shared/model/SolanaContextTypes";export*from"./shared/model/TransactionSubset";export*from"./shared/model/TypedDataClearSignContext";export*from"./shared/model/TypedDataContext";export*from"./solana/data/HttpSolanaOwnerInfoDataSource";export*from"./solana/data/SolanaDataSource";export*from"./solana/domain/DefaultSolanaContextLoader";export*from"./solana/domain/SolanaContextLoader";export*from"./solana/domain/solanaContextTypes";export*from"./token/data/HttpTokenDataSource";export*from"./token/data/TokenDataSource";export*from"./token/domain/TokenContextFieldLoader";export*from"./token/domain/TokenContextLoader";export*from"./trusted-name/data/HttpTrustedNameDataSource";export*from"./trusted-name/data/TrustedNameDataSource";export*from"./trusted-name/domain/TrustedNameContextFieldLoader";export*from"./trusted-name/domain/TrustedNameContextLoader";export*from"./typed-data/data/HttpTypedDataDataSource";export*from"./typed-data/data/TypedDataDataSource";export*from"./typed-data/domain/DefaultTypedDataContextLoader";export*from"./typed-data/domain/TypedDataContextLoader";export*from"./typed-data/utils/getSchemaHash";export*from"./uniswap/data/AbiDecoderDataSource";export*from"./uniswap/data/CommandDecoderDataSource";export*from"./uniswap/data/DefaultCommandDecoderDataSource";export*from"./uniswap/data/EthersAbiDecoderDataSource";export*from"./uniswap/domain/UniswapContextLoader";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/src/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./calldata/data/CalldataDescriptorDataSource\";\nexport * from \"./calldata/data/HttpCalldataDescriptorDataSource\";\nexport * from \"./calldata/domain/CalldataContextLoader\";\nexport type {\n ContextModuleCalBranch,\n ContextModuleCalConfig,\n ContextModuleCalMode,\n ContextModuleConfig,\n ContextModuleDatasourceConfig,\n ContextModuleMetadataServiceConfig,\n ContextModuleReporterConfig,\n ContextModuleWeb3ChecksConfig,\n} from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./dynamic-network/data/DynamicNetworkDataSource\";\nexport * from \"./dynamic-network/data/HttpDynamicNetworkDataSource\";\nexport * from \"./dynamic-network/domain/DynamicNetworkContextLoader\";\nexport * from \"./dynamic-network/model/DynamicNetworkConfiguration\";\nexport * from \"./external-plugin/data/ExternalPluginDataSource\";\nexport * from \"./external-plugin/data/HttpExternalPluginDataSource\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./gated-signing/data/GatedDescriptorDataSource\";\nexport * from \"./gated-signing/data/HttpGatedDescriptorDataSource\";\nexport * from \"./gated-signing/domain/GatedSigningContextLoader\";\nexport * from \"./gated-signing/domain/GatedSigningTypedDataContextLoader\";\nexport * from \"./nft/data/HttpNftDataSource\";\nexport * from \"./nft/data/NftDataSource\";\nexport * from \"./nft/domain/NftContextFieldLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/data/HttpPkiCertificateDataSource\";\nexport * from \"./pki/data/PkiCertificateDataSource\";\nexport * from \"./pki/domain/DefaultPkiCertificateLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./proxy/data/HttpProxyDataSource\";\nexport * from \"./proxy/data/HttpSafeProxyDataSource\";\nexport * from \"./proxy/data/ProxyDataSource\";\nexport * from \"./proxy/domain/ProxyContextFieldLoader\";\nexport * from \"./reporter/data/BlindSigningReporterDatasource\";\nexport * from \"./reporter/data/HttpBlindSigningReporterDatasource\";\nexport * from \"./reporter/domain/BlindSigningReporter\";\nexport * from \"./reporter/domain/DefaultBlindSigningReporter\";\nexport * from \"./reporter/model/BlindSigningEvent\";\nexport * from \"./reporter/model/BlindSigningModelId\";\nexport * from \"./shared/domain/ContextFieldLoader\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/SolanaContextTypes\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./solana/data/HttpSolanaOwnerInfoDataSource\";\nexport * from \"./solana/data/SolanaDataSource\";\nexport * from \"./solana/domain/DefaultSolanaContextLoader\";\nexport * from \"./solana/domain/SolanaContextLoader\";\nexport * from \"./solana/domain/solanaContextTypes\";\nexport * from \"./token/data/HttpTokenDataSource\";\nexport * from \"./token/data/TokenDataSource\";\nexport * from \"./token/domain/TokenContextFieldLoader\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/data/HttpTrustedNameDataSource\";\nexport * from \"./trusted-name/data/TrustedNameDataSource\";\nexport * from \"./trusted-name/domain/TrustedNameContextFieldLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./typed-data/data/HttpTypedDataDataSource\";\nexport * from \"./typed-data/data/TypedDataDataSource\";\nexport * from \"./typed-data/domain/DefaultTypedDataContextLoader\";\nexport * from \"./typed-data/domain/TypedDataContextLoader\";\nexport * from \"./typed-data/utils/getSchemaHash\";\nexport * from \"./uniswap/data/AbiDecoderDataSource\";\nexport * from \"./uniswap/data/CommandDecoderDataSource\";\nexport * from \"./uniswap/data/DefaultCommandDecoderDataSource\";\nexport * from \"./uniswap/data/EthersAbiDecoderDataSource\";\nexport * from \"./uniswap/domain/UniswapContextLoader\";\n"],
|
|
5
|
-
"mappings": "AAAA,WAAc,+CACd,WAAc,mDACd,WAAc,0CAWd,WAAc,kBACd,WAAc,yBACd,WAAc,yBACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,sDACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,iDACd,WAAc,qDACd,WAAc,mDACd,WAAc,4DACd,WAAc,+BACd,WAAc,2BACd,WAAc,qCACd,WAAc,gCACd,WAAc,0CACd,WAAc,sCACd,WAAc,2CACd,WAAc,oCACd,WAAc,oBACd,WAAc,uBACd,WAAc,6BACd,WAAc,iCACd,WAAc,mCACd,WAAc,uCACd,WAAc,+BACd,WAAc,yCACd,WAAc,iDACd,WAAc,qDACd,WAAc,yCACd,WAAc,gDACd,WAAc,qCACd,WAAc,uCACd,WAAc,qCACd,WAAc,gCACd,WAAc,kCACd,WAAc,6BACd,WAAc,oCACd,WAAc,mCACd,WAAc,2CACd,WAAc,kCACd,WAAc,8CACd,WAAc,iCACd,WAAc,6CACd,WAAc,sCACd,WAAc,qCACd,WAAc,mCACd,WAAc,+BACd,WAAc,yCACd,WAAc,oCACd,WAAc,gDACd,WAAc,4CACd,WAAc,sDACd,WAAc,iDACd,WAAc,4CACd,WAAc,wCACd,WAAc,oDACd,WAAc,6CACd,WAAc,mCACd,WAAc,sCACd,WAAc,0CACd,WAAc,iDACd,WAAc,4CACd,WAAc",
|
|
4
|
+
"sourcesContent": ["export * from \"./account-ownership/data/AccountOwnershipDataSource\";\nexport * from \"./account-ownership/data/HttpAccountOwnershipDataSource\";\nexport * from \"./account-ownership/domain/AccountOwnershipContextLoader\";\nexport * from \"./calldata/data/CalldataDescriptorDataSource\";\nexport * from \"./calldata/data/HttpCalldataDescriptorDataSource\";\nexport * from \"./calldata/domain/CalldataContextLoader\";\nexport type {\n ContextModuleCalBranch,\n ContextModuleCalConfig,\n ContextModuleCalMode,\n ContextModuleConfig,\n ContextModuleDatasourceConfig,\n ContextModuleMetadataServiceConfig,\n ContextModuleReporterConfig,\n ContextModuleWeb3ChecksConfig,\n} from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./dynamic-network/data/DynamicNetworkDataSource\";\nexport * from \"./dynamic-network/data/HttpDynamicNetworkDataSource\";\nexport * from \"./dynamic-network/domain/DynamicNetworkContextLoader\";\nexport * from \"./dynamic-network/model/DynamicNetworkConfiguration\";\nexport * from \"./external-plugin/data/ExternalPluginDataSource\";\nexport * from \"./external-plugin/data/HttpExternalPluginDataSource\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./gated-signing/data/GatedDescriptorDataSource\";\nexport * from \"./gated-signing/data/HttpGatedDescriptorDataSource\";\nexport * from \"./gated-signing/domain/GatedSigningContextLoader\";\nexport * from \"./gated-signing/domain/GatedSigningTypedDataContextLoader\";\nexport * from \"./nft/data/HttpNftDataSource\";\nexport * from \"./nft/data/NftDataSource\";\nexport * from \"./nft/domain/NftContextFieldLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/data/HttpPkiCertificateDataSource\";\nexport * from \"./pki/data/PkiCertificateDataSource\";\nexport * from \"./pki/domain/DefaultPkiCertificateLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./proxy/data/HttpProxyDataSource\";\nexport * from \"./proxy/data/HttpSafeProxyDataSource\";\nexport * from \"./proxy/data/ProxyDataSource\";\nexport * from \"./proxy/domain/ProxyContextFieldLoader\";\nexport * from \"./reporter/data/BlindSigningReporterDatasource\";\nexport * from \"./reporter/data/HttpBlindSigningReporterDatasource\";\nexport * from \"./reporter/domain/BlindSigningReporter\";\nexport * from \"./reporter/domain/DefaultBlindSigningReporter\";\nexport * from \"./reporter/model/BlindSigningEvent\";\nexport * from \"./reporter/model/BlindSigningModelId\";\nexport * from \"./shared/domain/ContextFieldLoader\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/SolanaContextTypes\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./solana/data/HttpSolanaOwnerInfoDataSource\";\nexport * from \"./solana/data/SolanaDataSource\";\nexport * from \"./solana/domain/DefaultSolanaContextLoader\";\nexport * from \"./solana/domain/SolanaContextLoader\";\nexport * from \"./solana/domain/solanaContextTypes\";\nexport * from \"./token/data/HttpTokenDataSource\";\nexport * from \"./token/data/TokenDataSource\";\nexport * from \"./token/domain/TokenContextFieldLoader\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/data/HttpTrustedNameDataSource\";\nexport * from \"./trusted-name/data/TrustedNameDataSource\";\nexport * from \"./trusted-name/domain/TrustedNameContextFieldLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./typed-data/data/HttpTypedDataDataSource\";\nexport * from \"./typed-data/data/TypedDataDataSource\";\nexport * from \"./typed-data/domain/DefaultTypedDataContextLoader\";\nexport * from \"./typed-data/domain/TypedDataContextLoader\";\nexport * from \"./typed-data/utils/getSchemaHash\";\nexport * from \"./uniswap/data/AbiDecoderDataSource\";\nexport * from \"./uniswap/data/CommandDecoderDataSource\";\nexport * from \"./uniswap/data/DefaultCommandDecoderDataSource\";\nexport * from \"./uniswap/data/EthersAbiDecoderDataSource\";\nexport * from \"./uniswap/domain/UniswapContextLoader\";\n"],
|
|
5
|
+
"mappings": "AAAA,WAAc,sDACd,WAAc,0DACd,WAAc,2DACd,WAAc,+CACd,WAAc,mDACd,WAAc,0CAWd,WAAc,kBACd,WAAc,yBACd,WAAc,yBACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,sDACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,iDACd,WAAc,qDACd,WAAc,mDACd,WAAc,4DACd,WAAc,+BACd,WAAc,2BACd,WAAc,qCACd,WAAc,gCACd,WAAc,0CACd,WAAc,sCACd,WAAc,2CACd,WAAc,oCACd,WAAc,oBACd,WAAc,uBACd,WAAc,6BACd,WAAc,iCACd,WAAc,mCACd,WAAc,uCACd,WAAc,+BACd,WAAc,yCACd,WAAc,iDACd,WAAc,qDACd,WAAc,yCACd,WAAc,gDACd,WAAc,qCACd,WAAc,uCACd,WAAc,qCACd,WAAc,gCACd,WAAc,kCACd,WAAc,6BACd,WAAc,oCACd,WAAc,mCACd,WAAc,2CACd,WAAc,kCACd,WAAc,8CACd,WAAc,iCACd,WAAc,6CACd,WAAc,sCACd,WAAc,qCACd,WAAc,mCACd,WAAc,+BACd,WAAc,yCACd,WAAc,oCACd,WAAc,gDACd,WAAc,4CACd,WAAc,sDACd,WAAc,iDACd,WAAc,4CACd,WAAc,wCACd,WAAc,oDACd,WAAc,6CACd,WAAc,mCACd,WAAc,sCACd,WAAc,0CACd,WAAc,iDACd,WAAc,4CACd,WAAc",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=(e=>(e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trustedName",e.PLUGIN="plugin",e.EXTERNAL_PLUGIN="externalPlugin",e.TRANSACTION_INFO="transactionInfo",e.PROXY_INFO="proxyInfo",e.ENUM="enum",e.TRANSACTION_FIELD_DESCRIPTION="transactionFieldDescription",e.TRANSACTION_CHECK="transactionCheck",e.DYNAMIC_NETWORK="dynamicNetwork",e.DYNAMIC_NETWORK_ICON="dynamicNetworkIcon",e.ERROR="error",e.SAFE="safe",e.SIGNER="signer",e.GATED_SIGNING="gatedSigning",e))(n||{}),r=(t=>(t.TOKEN="token",t.NFT="nft",t.TRUSTED_NAME="trustedName",t.ENUM="enum",t.CALLDATA="calldata",t))(r||{});export{r as ClearSignContextReferenceType,n as ClearSignContextType};
|
|
1
|
+
var n=(e=>(e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trustedName",e.PLUGIN="plugin",e.EXTERNAL_PLUGIN="externalPlugin",e.TRANSACTION_INFO="transactionInfo",e.PROXY_INFO="proxyInfo",e.ENUM="enum",e.TRANSACTION_FIELD_DESCRIPTION="transactionFieldDescription",e.TRANSACTION_CHECK="transactionCheck",e.DYNAMIC_NETWORK="dynamicNetwork",e.DYNAMIC_NETWORK_ICON="dynamicNetworkIcon",e.ERROR="error",e.SAFE="safe",e.SIGNER="signer",e.GATED_SIGNING="gatedSigning",e.ACCOUNT_OWNERSHIP="accountOwnership",e))(n||{}),r=(t=>(t.TOKEN="token",t.NFT="nft",t.TRUSTED_NAME="trustedName",t.ENUM="enum",t.CALLDATA="calldata",t))(r||{});export{r as ClearSignContextReferenceType,n as ClearSignContextType};
|
|
2
2
|
//# sourceMappingURL=ClearSignContext.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/shared/model/ClearSignContext.ts"],
|
|
4
|
-
"sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nimport { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n PROXY_INFO = \"proxyInfo\",\n ENUM = \"enum\",\n TRANSACTION_FIELD_DESCRIPTION = \"transactionFieldDescription\",\n TRANSACTION_CHECK = \"transactionCheck\",\n DYNAMIC_NETWORK = \"dynamicNetwork\",\n DYNAMIC_NETWORK_ICON = \"dynamicNetworkIcon\",\n ERROR = \"error\",\n SAFE = \"safe\",\n SIGNER = \"signer\",\n GATED_SIGNING = \"gatedSigning\",\n}\n\nexport enum ClearSignContextReferenceType {\n TOKEN = ClearSignContextType.TOKEN,\n NFT = ClearSignContextType.NFT,\n TRUSTED_NAME = ClearSignContextType.TRUSTED_NAME,\n ENUM = ClearSignContextType.ENUM,\n CALLDATA = \"calldata\",\n}\n\ntype PathOnly = {\n valuePath: GenericPath;\n value?: never;\n callee?: GenericPath;\n selector?: GenericPath;\n amount?: GenericPath;\n spender?: GenericPath;\n chainId?: GenericPath;\n};\n\ntype ValueOnly = {\n value: string;\n valuePath?: never;\n};\n\ntype PathOrValue = PathOnly | ValueOnly;\n\n// per-type payloads for references\ntype ClearSignContextReferencePayloads = {\n [ClearSignContextReferenceType.ENUM]: {\n valuePath: GenericPath;\n id: number; // enum id to reference\n };\n [ClearSignContextReferenceType.TRUSTED_NAME]: {\n valuePath: GenericPath;\n types: string[];\n sources: string[];\n };\n [ClearSignContextReferenceType.CALLDATA]: {\n callee: GenericPath;\n valuePath: GenericPath;\n selector?: GenericPath;\n amount?: GenericPath;\n spender?: GenericPath;\n chainId?: GenericPath;\n };\n [ClearSignContextReferenceType.TOKEN]: PathOrValue;\n [ClearSignContextReferenceType.NFT]: PathOrValue;\n};\n\n// discriminated union of all reference shapes, built from the payload map\ntype ClearSignContextReferenceUnion = {\n [T in ClearSignContextReferenceType]: {\n type: T;\n } & ClearSignContextReferencePayloads[T];\n}[ClearSignContextReferenceType];\n\nexport type ClearSignContextReference<\n T extends ClearSignContextReferenceType = ClearSignContextReferenceType,\n> = Extract<ClearSignContextReferenceUnion, { type: T }>;\n\nexport type ClearSignContextSuccessType = Exclude<\n ClearSignContextType,\n ClearSignContextType.ERROR\n>;\n\n// base payload shared by most success contexts\ntype ClearSignContextSuccessBase = {\n payload: string;\n certificate?: PkiCertificate;\n};\n\n// map from ClearSign success type to payload\ntype ClearSignContextSuccessPayloadsBase = {\n [K in ClearSignContextSuccessType]: ClearSignContextSuccessBase;\n};\n\n// special cases overrides for certain context types\ntype ClearSignContextSuccessPayloadOverrides = {\n [ClearSignContextType.ENUM]: ClearSignContextSuccessBase & {\n id: number;\n value: number;\n };\n [ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION]: ClearSignContextSuccessBase & {\n reference?: ClearSignContextReference;\n };\n};\n\ntype ClearSignContextSuccessPayloads = Omit<\n ClearSignContextSuccessPayloadsBase,\n ClearSignContextType.ENUM | ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION\n> &\n ClearSignContextSuccessPayloadOverrides;\n\n// union of all success contexts, built from the payload map.\ntype ClearSignContextSuccessUnion = {\n [T in ClearSignContextSuccessType]: {\n type: T;\n } & ClearSignContextSuccessPayloads[T];\n}[ClearSignContextSuccessType];\n\nexport type ClearSignContextSuccess<\n T extends ClearSignContextSuccessType = ClearSignContextSuccessType,\n> = Extract<ClearSignContextSuccessUnion, { type: T }>;\n\nexport type ClearSignContextError = {\n type: ClearSignContextType.ERROR;\n error: Error;\n};\n\nexport type ClearSignContext = ClearSignContextSuccess | ClearSignContextError;\n"],
|
|
5
|
-
"mappings": "AAIO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,iBAAmB,kBACnBA,EAAA,WAAa,YACbA,EAAA,KAAO,OACPA,EAAA,8BAAgC,8BAChCA,EAAA,kBAAoB,mBACpBA,EAAA,gBAAkB,iBAClBA,EAAA,qBAAuB,qBACvBA,EAAA,MAAQ,QACRA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,cAAgB,
|
|
4
|
+
"sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nimport { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n PROXY_INFO = \"proxyInfo\",\n ENUM = \"enum\",\n TRANSACTION_FIELD_DESCRIPTION = \"transactionFieldDescription\",\n TRANSACTION_CHECK = \"transactionCheck\",\n DYNAMIC_NETWORK = \"dynamicNetwork\",\n DYNAMIC_NETWORK_ICON = \"dynamicNetworkIcon\",\n ERROR = \"error\",\n SAFE = \"safe\",\n SIGNER = \"signer\",\n GATED_SIGNING = \"gatedSigning\",\n ACCOUNT_OWNERSHIP = \"accountOwnership\",\n}\n\nexport enum ClearSignContextReferenceType {\n TOKEN = ClearSignContextType.TOKEN,\n NFT = ClearSignContextType.NFT,\n TRUSTED_NAME = ClearSignContextType.TRUSTED_NAME,\n ENUM = ClearSignContextType.ENUM,\n CALLDATA = \"calldata\",\n}\n\ntype PathOnly = {\n valuePath: GenericPath;\n value?: never;\n callee?: GenericPath;\n selector?: GenericPath;\n amount?: GenericPath;\n spender?: GenericPath;\n chainId?: GenericPath;\n};\n\ntype ValueOnly = {\n value: string;\n valuePath?: never;\n};\n\ntype PathOrValue = PathOnly | ValueOnly;\n\n// per-type payloads for references\ntype ClearSignContextReferencePayloads = {\n [ClearSignContextReferenceType.ENUM]: {\n valuePath: GenericPath;\n id: number; // enum id to reference\n };\n [ClearSignContextReferenceType.TRUSTED_NAME]: {\n valuePath: GenericPath;\n types: string[];\n sources: string[];\n };\n [ClearSignContextReferenceType.CALLDATA]: {\n callee: GenericPath;\n valuePath: GenericPath;\n selector?: GenericPath;\n amount?: GenericPath;\n spender?: GenericPath;\n chainId?: GenericPath;\n };\n [ClearSignContextReferenceType.TOKEN]: PathOrValue;\n [ClearSignContextReferenceType.NFT]: PathOrValue;\n};\n\n// discriminated union of all reference shapes, built from the payload map\ntype ClearSignContextReferenceUnion = {\n [T in ClearSignContextReferenceType]: {\n type: T;\n } & ClearSignContextReferencePayloads[T];\n}[ClearSignContextReferenceType];\n\nexport type ClearSignContextReference<\n T extends ClearSignContextReferenceType = ClearSignContextReferenceType,\n> = Extract<ClearSignContextReferenceUnion, { type: T }>;\n\nexport type ClearSignContextSuccessType = Exclude<\n ClearSignContextType,\n ClearSignContextType.ERROR\n>;\n\n// base payload shared by most success contexts\ntype ClearSignContextSuccessBase = {\n payload: string;\n certificate?: PkiCertificate;\n};\n\n// map from ClearSign success type to payload\ntype ClearSignContextSuccessPayloadsBase = {\n [K in ClearSignContextSuccessType]: ClearSignContextSuccessBase;\n};\n\n// special cases overrides for certain context types\ntype ClearSignContextSuccessPayloadOverrides = {\n [ClearSignContextType.ENUM]: ClearSignContextSuccessBase & {\n id: number;\n value: number;\n };\n [ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION]: ClearSignContextSuccessBase & {\n reference?: ClearSignContextReference;\n };\n};\n\ntype ClearSignContextSuccessPayloads = Omit<\n ClearSignContextSuccessPayloadsBase,\n ClearSignContextType.ENUM | ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION\n> &\n ClearSignContextSuccessPayloadOverrides;\n\n// union of all success contexts, built from the payload map.\ntype ClearSignContextSuccessUnion = {\n [T in ClearSignContextSuccessType]: {\n type: T;\n } & ClearSignContextSuccessPayloads[T];\n}[ClearSignContextSuccessType];\n\nexport type ClearSignContextSuccess<\n T extends ClearSignContextSuccessType = ClearSignContextSuccessType,\n> = Extract<ClearSignContextSuccessUnion, { type: T }>;\n\nexport type ClearSignContextError = {\n type: ClearSignContextType.ERROR;\n error: Error;\n};\n\nexport type ClearSignContext = ClearSignContextSuccess | ClearSignContextError;\n"],
|
|
5
|
+
"mappings": "AAIO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,iBAAmB,kBACnBA,EAAA,WAAa,YACbA,EAAA,KAAO,OACPA,EAAA,8BAAgC,8BAChCA,EAAA,kBAAoB,mBACpBA,EAAA,gBAAkB,iBAClBA,EAAA,qBAAuB,qBACvBA,EAAA,MAAQ,QACRA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,cAAgB,eAChBA,EAAA,kBAAoB,mBAjBVA,OAAA,IAoBAC,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,KAAO,OACPA,EAAA,SAAW,WALDA,OAAA",
|
|
6
6
|
"names": ["ClearSignContextType", "ClearSignContextReferenceType"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAG/F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,oCAAoC,CAAC;AAQ5C,OAAO,EACL,KAAK,gBAAgB,EACrB,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAGxF,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AAKzF,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,qBAAqB,CAAuB;gBAExC,IAAI,EAAE,0BAA0B,GAAG,yBAAyB;IAkBxE,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,kBAAkB;IAiC1B,OAAO,CAAC,0BAA0B;IAMlC,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,gBAAgB;IAiBX,WAAW,CACtB,KAAK,EAAE,OAAO,EACd,aAAa,CAAC,EAAE,oBAAoB,EAAE,GACrC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAUjB,eAAe,CAAC,MAAM,EACjC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,oBAAoB,GACjC,OAAO,CAAC,gBAAgB,CAAC;IA4Bf,mBAAmB,CAC9B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC;IAIxB,gBAAgB,CAC3B,kBAAkB,EAAE,wBAAwB,GAC3C,OAAO,CAAC,8BAA8B,CAAC;IAI7B,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Either } from "purify-ts";
|
|
2
|
+
export type AccountOwnershipNetwork = "mainnet" | "testnet";
|
|
3
|
+
export type GetAccountOwnershipParams = {
|
|
4
|
+
publicKey: string;
|
|
5
|
+
address: string;
|
|
6
|
+
challenge: string;
|
|
7
|
+
network: AccountOwnershipNetwork;
|
|
8
|
+
};
|
|
9
|
+
export type AccountOwnershipDescriptor = {
|
|
10
|
+
signedDescriptor: string;
|
|
11
|
+
keyId: string;
|
|
12
|
+
keyUsage: string;
|
|
13
|
+
};
|
|
14
|
+
export interface AccountOwnershipDataSource {
|
|
15
|
+
getDescriptor(params: GetAccountOwnershipParams): Promise<Either<Error, AccountOwnershipDescriptor>>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=AccountOwnershipDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountOwnershipDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/account-ownership/data/AccountOwnershipDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5D,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,uBAAuB,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC,aAAa,CACX,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC,CAAC;CACvD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Either } from "purify-ts";
|
|
2
|
+
import { type AccountOwnershipDataSource, type AccountOwnershipDescriptor, type GetAccountOwnershipParams } from "../../account-ownership/data/AccountOwnershipDataSource";
|
|
3
|
+
import { type ContextModuleServiceConfig } from "../../config/model/ContextModuleConfig";
|
|
4
|
+
export declare class HttpAccountOwnershipDataSource implements AccountOwnershipDataSource {
|
|
5
|
+
private readonly config;
|
|
6
|
+
constructor(config: ContextModuleServiceConfig);
|
|
7
|
+
getDescriptor({ publicKey, address, challenge, network, }: GetAccountOwnershipParams): Promise<Either<Error, AccountOwnershipDescriptor>>;
|
|
8
|
+
private isAccountOwnershipDto;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=HttpAccountOwnershipDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpAccountOwnershipDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/account-ownership/data/HttpAccountOwnershipDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,WAAW,CAAC;AAErD,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC/B,MAAM,qDAAqD,CAAC;AAG7D,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAOrF,qBACa,8BACX,YAAW,0BAA0B;IAInC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,0BAA0B;IAG/C,aAAa,CAAC,EAClB,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,GACR,EAAE,yBAAyB,GAAG,OAAO,CACpC,MAAM,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAC1C;IA6CD,OAAO,CAAC,qBAAqB;CAY9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpAccountOwnershipDataSource.test.d.ts","sourceRoot":"","sources":["../../../../../src/account-ownership/data/HttpAccountOwnershipDataSource.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountOwnershipDto.d.ts","sourceRoot":"","sources":["../../../../../../src/account-ownership/data/dto/AccountOwnershipDto.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountOwnershipModuleFactory.d.ts","sourceRoot":"","sources":["../../../../../src/account-ownership/di/accountOwnershipModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAO5C,eAAO,MAAM,6BAA6B,uBAQtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountOwnershipTypes.d.ts","sourceRoot":"","sources":["../../../../../src/account-ownership/di/accountOwnershipTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC"}
|