@ledgerhq/context-module 0.0.0-develop-20260416002308 → 0.0.0-develop-20260417002136
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 +4 -4
package/lib/cjs/package.json
CHANGED
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
59
59
|
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
|
|
60
60
|
},
|
|
61
|
-
"version": "0.0.0-develop-
|
|
61
|
+
"version": "0.0.0-develop-20260417002136"
|
|
62
62
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var w=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},k=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of F(e))!v.call(r,o)&&o!==t&&p(r,o,{get:()=>e[o],enumerable:!(n=R(e,o))||n.enumerable});return r};var P=r=>k(p({},"__esModule",{value:!0}),r);var B={};w(B,{DefaultContextModule:()=>b});module.exports=P(B);var L=require("purify-ts"),g=require("./account-ownership/di/accountOwnershipTypes"),c=require("./calldata/di/calldataTypes"),y=require("./dynamic-network/di/dynamicNetworkTypes"),f=require("./reporter/di/reporterTypes"),s=require("./trusted-name/di/trustedNameTypes"),u=require("./external-plugin/di/externalPluginTypes"),l=require("./gated-signing/di/gatedSigningTypes"),C=require("./nft/di/nftTypes"),_=require("./proxy/di/proxyTypes"),h=require("./safe/di/safeTypes"),a=require("./shared/model/ClearSignContext"),T=require("./solana/di/solanaContextTypes"),m=require("./token/di/tokenTypes"),x=require("./transaction-check/di/transactionCheckTypes"),S=require("./typed-data/di/typedDataTypes"),D=require("./di");class b{_container;_loaders;_typedDataLoader;_solanaLoader;_fieldLoaders;_blindSigningReporter;constructor(e){this._container=(0,D.makeContainer)({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(C.nftTypes.NftContextFieldLoader),this._container.get(m.tokenTypes.TokenContextFieldLoader),this._container.get(s.trustedNameTypes.TrustedNameContextFieldLoader),this._container.get(_.proxyTypes.ProxyContextFieldLoader)]}_getDefaultLoaders(){return[this._container.get(g.accountOwnershipTypes.AccountOwnershipContextLoader),this._container.get(u.externalPluginTypes.ExternalPluginContextLoader),this._container.get(s.trustedNameTypes.TrustedNameContextLoader),this._container.get(C.nftTypes.NftContextLoader),this._container.get(m.tokenTypes.TokenContextLoader),this._container.get(c.calldataTypes.CalldataContextLoader),this._container.get(y.dynamicNetworkTypes.DynamicNetworkContextLoader),this._container.get(h.safeTypes.SafeAddressLoader),this._container.get(l.gatedSigningTypes.GatedSigningContextLoader),this._container.get(l.gatedSigningTypes.GatedSigningTypedDataContextLoader),this._container.get(x.transactionCheckTypes.TransactionCheckContextLoader),this._container.get(x.transactionCheckTypes.TypedDataCheckContextLoader)]}_getDefaultTypedDataLoader(){return this._container.get(S.typedDataTypes.TypedDataContextLoader)}_getBlindSigningReporter(){return this._container.get(f.reporterTypes.BlindSigningReporter)}_getSolanaLoader(){try{return this._container.get(T.solanaContextTypes.SolanaContextLoader)}catch{return{load:async e=>(0,L.Left)(new Error("[ContextModule] - DefaultContextModule: no SolanaContextLoader bound"))}}}async getContexts(e,t){const n=Object.values(a.ClearSignContextType),i=this._loaders.filter(d=>d.canHandle(e,t??n)).map(d=>d.load(e));return(await Promise.all(i)).flat()}async getFieldContext(e,t){const n=this._fieldLoaders.filter(o=>o.canHandle(e,t));if(n.length===0)return Promise.resolve({type:a.ClearSignContextType.ERROR,error:new Error(`Loader not found for field: ${e} and expected type: ${t}`)});for(const o of n){const i=await o.loadField(e);if(i.type!==a.ClearSignContextType.ERROR)return i}return{type:a.ClearSignContextType.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)}}0&&(module.exports={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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAqB,qBAErBC,EAA8B,uCAC9BC,EAAoC,oDAEpCC,EAA8B,uCAI9BC,EAAiC,8CAMjCC,EAAoC,oDACpCC,EAAkC,gDAClCC,EAAyB,6BACzBC,EAA2B,iCAC3BC,EAA0B,+BAG1BC,EAGO,2CAEPC,EAAmC,0CAGnCC,EAA2B,iCAC3BC,EAAsC,wDACtCC,EAA+B,0CAG/BC,EAA8B,gBAEvB,
|
|
6
|
-
"names": ["DefaultContextModule_exports", "__export", "DefaultContextModule", "__toCommonJS", "import_purify_ts", "import_calldataTypes", "import_dynamicNetworkTypes", "import_reporterTypes", "import_trustedNameTypes", "import_externalPluginTypes", "import_gatedSigningTypes", "import_nftTypes", "import_proxyTypes", "import_safeTypes", "import_ClearSignContext", "import_solanaContextTypes", "import_tokenTypes", "import_transactionCheckTypes", "import_typedDataTypes", "import_di", "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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAqB,qBAErBC,EAAsC,wDACtCC,EAA8B,uCAC9BC,EAAoC,oDAEpCC,EAA8B,uCAI9BC,EAAiC,8CAMjCC,EAAoC,oDACpCC,EAAkC,gDAClCC,EAAyB,6BACzBC,EAA2B,iCAC3BC,EAA0B,+BAG1BC,EAGO,2CAEPC,EAAmC,0CAGnCC,EAA2B,iCAC3BC,EAAsC,wDACtCC,EAA+B,0CAG/BC,EAA8B,gBAEvB,MAAMlB,CAA8C,CACjD,WACA,SACA,iBACA,cACA,cACA,sBAER,YAAYmB,EAA8D,CACxE,KAAK,cAAa,iBAAc,CAAE,OAAQA,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,IAAwB,WAAS,qBAAqB,EACtE,KAAK,WAAW,IACd,aAAW,uBACb,EACA,KAAK,WAAW,IACd,mBAAiB,6BACnB,EACA,KAAK,WAAW,IACd,aAAW,uBACb,CACF,CACF,CAEQ,oBAA+C,CACrD,MAAO,CACL,KAAK,WAAW,IACd,wBAAsB,6BACxB,EACA,KAAK,WAAW,IACd,sBAAoB,2BACtB,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AS,CAC5B,MAAME,EAAU,MAAMD,EAAO,UAAUH,CAAK,EAC5C,GAAII,EAAQ,OAAS,uBAAqB,MACxC,OAAOA,CAEX,CAEA,MAAO,CACL,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MACT,+BAA+BJ,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": ["DefaultContextModule_exports", "__export", "DefaultContextModule", "__toCommonJS", "import_purify_ts", "import_accountOwnershipTypes", "import_calldataTypes", "import_dynamicNetworkTypes", "import_reporterTypes", "import_trustedNameTypes", "import_externalPluginTypes", "import_gatedSigningTypes", "import_nftTypes", "import_proxyTypes", "import_safeTypes", "import_ClearSignContext", "import_solanaContextTypes", "import_tokenTypes", "import_transactionCheckTypes", "import_typedDataTypes", "import_di", "args", "_ctx", "input", "expectedTypes", "allContextTypes", "promises", "l", "fetcher", "field", "expectedType", "loaders", "loader", "context", "typedData", "transactionContext", "params"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var a=(r,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of c(e))!p.call(r,t)&&t!==i&&s(r,t,{get:()=>e[t],enumerable:!(n=o(e,t))||n.enumerable});return r};var g=r=>a(s({},"__esModule",{value:!0}),r);var h={};module.exports=g(h);
|
|
2
|
+
//# sourceMappingURL=AccountOwnershipDataSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/account-ownership/data/AccountOwnershipDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import { type Either } from \"purify-ts\";\n\nexport type AccountOwnershipNetwork = \"mainnet\" | \"testnet\";\n\nexport type GetAccountOwnershipParams = {\n publicKey: string;\n address: string;\n challenge: string;\n network: AccountOwnershipNetwork;\n};\n\nexport type AccountOwnershipDescriptor = {\n signedDescriptor: string;\n keyId: string;\n keyUsage: string;\n};\n\nexport interface AccountOwnershipDataSource {\n getDescriptor(\n params: GetAccountOwnershipParams,\n ): Promise<Either<Error, AccountOwnershipDescriptor>>;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["AccountOwnershipDataSource_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var A=Object.create;var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var C=(r,e)=>{for(var t in e)c(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of O(e))!l.call(r,o)&&o!==t&&c(r,o,{get:()=>e[o],enumerable:!(n=u(e,o))||n.enumerable});return r};var y=(r,e,t)=>(t=r!=null?A(k(r)):{},f(e||!r||!r.__esModule?c(t,"default",{value:r,enumerable:!0}):t,r)),x=r=>f(c({},"__esModule",{value:!0}),r),h=(r,e,t,n)=>{for(var o=n>1?void 0:n?u(e,t):e,i=r.length-1,d;i>=0;i--)(d=r[i])&&(o=(n?d(e,t,o):d(o))||o);return n&&o&&c(e,t,o),o},g=(r,e)=>(t,n)=>e(t,n,r);var I={};C(I,{HttpAccountOwnershipDataSource:()=>p});module.exports=x(I);var D=y(require("axios")),a=require("inversify"),s=require("purify-ts"),E=require("../../config/di/configTypes"),m=require("../../shared/constant/HttpHeaders"),w=y(require("../../../package.json"));let p=class{constructor(e){this.config=e}async getDescriptor({publicKey:e,address:t,challenge:n,network:o}){try{const i=await D.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/concordium/owner/${e}/${t}`,params:{challenge:n,network:o},headers:{[m.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${w.default.version}`,[m.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}});return i.data?this.isAccountOwnershipDto(i.data)?(0,s.Right)({signedDescriptor:i.data.signedDescriptor,keyId:i.data.keyId,keyUsage:i.data.keyUsage}):(0,s.Left)(new Error("[ContextModule] HttpAccountOwnershipDataSource: invalid response format")):(0,s.Left)(new Error("[ContextModule] HttpAccountOwnershipDataSource: unexpected empty response"))}catch{return(0,s.Left)(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"}};p=h([(0,a.injectable)(),g(0,(0,a.inject)(E.configTypes.Config))],p);0&&(module.exports={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": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAyC,qBAQzCC,EAA4B,mCAE5BC,EAGO,yCACPC,EAAoB,iCAGb,IAAMC,EAAN,KAEP,CACE,YAEmBC,EACjB,CADiB,YAAAA,CAChB,CAEH,MAAM,cAAc,CAClB,UAAAC,EACA,QAAAC,EACA,UAAAC,EACA,QAAAC,CACF,EAEE,CACA,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,wBAAwBL,CAAS,IAAIC,CAAO,GACzF,OAAQ,CACN,UAAAC,EACA,QAAAC,CACF,EACA,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAG,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAKF,EAAS,KAQT,KAAK,sBAAsBA,EAAS,IAAI,KAQtC,SAAM,CACX,iBAAkBA,EAAS,KAAK,iBAChC,MAAOA,EAAS,KAAK,MACrB,SAAUA,EAAS,KAAK,QAC1B,CAAC,KAXQ,QACL,IAAI,MACF,yEACF,CACF,KAZO,QACL,IAAI,MACF,2EACF,CACF,CAgBJ,MAAiB,CACf,SAAO,QACL,IAAI,MACF,8FACF,CACF,CACF,CACF,CAEQ,sBAAsBG,EAA8C,CAC1E,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,qBAAsBA,GACtB,UAAWA,GACX,aAAcA,GACd,OAAOA,EAAM,kBAAqB,UAClC,OAAOA,EAAM,OAAU,UACvB,OAAOA,EAAM,UAAa,QAE9B,CACF,EAxEaT,EAANU,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,cAAY,MAAM,IAJjBX",
|
|
6
|
+
"names": ["HttpAccountOwnershipDataSource_exports", "__export", "HttpAccountOwnershipDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpAccountOwnershipDataSource", "config", "publicKey", "address", "challenge", "network", "response", "axios", "PACKAGE", "value", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.create;var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var g=(t,o,e,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of k(o))!f.call(t,c)&&c!==e&&d(t,c,{get:()=>o[c],enumerable:!(s=m(o,c))||s.enumerable});return t};var u=(t,o,e)=>(e=t!=null?p(h(t)):{},g(o||!t||!t.__esModule?d(e,"default",{value:t,enumerable:!0}):e,t));var a=u(require("axios")),r=require("purify-ts"),i=require("../../shared/constant/HttpHeaders"),l=u(require("../../../package.json")),n=require("./HttpAccountOwnershipDataSource");vi.mock("axios");describe("HttpAccountOwnershipDataSource",()=>{const t={metadataServiceDomain:{url:"https://nft.api.live.ledger-test.com"},originToken:"test-origin-token"},o={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(a.default,"request").mockResolvedValue({status:200,data:o});const s=await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e);expect(a.default.request).toHaveBeenCalledWith({method:"GET",url:"https://nft.api.live.ledger-test.com/v2/concordium/owner/abcdef1234567890/3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",params:{challenge:"0xabcdef",network:"mainnet"},headers:{[i.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${l.default.version}`,[i.LEDGER_ORIGIN_TOKEN_HEADER]:"test-origin-token"}}),expect(s).toEqual((0,r.Right)({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(a.default,"request").mockResolvedValue({status:200,data:o}),await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e),expect(a.default.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(a.default,"request").mockResolvedValue({status:200,data:null});const s=await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e);expect(s).toEqual((0,r.Left)(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(a.default,"request").mockResolvedValue({status:200,data:{keyId:"domain_metadata_key",keyUsage:"trusted_name"}});const s=await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e);expect(s).toEqual((0,r.Left)(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(a.default,"request").mockResolvedValue({status:200,data:{signedDescriptor:"signed-descriptor-data",keyUsage:"trusted_name"}});const s=await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e);expect(s).toEqual((0,r.Left)(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(a.default,"request").mockResolvedValue({status:200,data:{signedDescriptor:"signed-descriptor-data",keyId:"domain_metadata_key"}});const s=await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e);expect(s).toEqual((0,r.Left)(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(a.default,"request").mockResolvedValue({status:200,data:{signedDescriptor:"signed-descriptor-data",keyId:123,keyUsage:"trusted_name"}});const s=await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e);expect(s).toEqual((0,r.Left)(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(a.default,"request").mockRejectedValue(new Error("Network error"));const s=await new n.HttpAccountOwnershipDataSource(t).getDescriptor(e);expect(s).toEqual((0,r.Left)(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"},s={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:o}),await new n.HttpAccountOwnershipDataSource(e).getDescriptor(s),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({url:"https://custom-metadata.example.com/v2/concordium/owner/abcdef1234567890/3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",headers:expect.objectContaining({[i.LEDGER_ORIGIN_TOKEN_HEADER]:"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": "wdAAA,IAAAA,EAAkB,oBAClBC,EAA4B,qBAG5BC,EAGO,yCACPC,EAAoB,iCAEpBC,EAA+C,4CAE/C,GAAG,KAAK,OAAO,EAEf,SAAS,iCAAkC,IAAM,CAC/C,MAAMC,EAAqC,CACzC,sBAAuB,CACrB,IAAK,sCACP,EACA,YAAa,mBACf,EAEMC,EAAW,CACf,iBAAkB,yBAClB,MAAO,sBACP,SAAU,cACZ,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,iDAAkD,SAAY,CAE/D,MAAMC,EAAS,CACb,UAAW,mBACX,QAAS,qDACT,UAAW,WACX,QAAS,SACX,EACA,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAMF,CACR,CAAC,EAGD,MAAMG,EAAS,MAAM,IAAI,iCACvBJ,CACF,EAAE,cAAcE,CAAM,EAGtB,OAAO,EAAAC,QAAM,OAAO,EAAE,qBAAqB,CACzC,OAAQ,MACR,IAAK,+HACL,OAAQ,CACN,UAAW,WACX,QAAS,SACX,EACA,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAE,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,mBAChC,CACF,CAAC,EACD,OAAOD,CAAM,EAAE,WACb,SAAM,CACJ,iBAAkB,yBAClB,MAAO,sBACP,SAAU,cACZ,CAAC,CACH,CACF,CAAC,EAED,GA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C,sBAAuB,CACrB,IAAK,qCACP,EACA,YAAa,cACf,EACMJ,EAAS,CACb,UAAW,mBACX,QAAS,qDACT,UAAW,WACX,QAAS,SACX,EACA,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAMF,CACR,CAAC,EAGD,MAAM,IAAI,iCAA+BK,CAAY,EAAE,cACrDJ,CACF,EAGA,OAAO,EAAAC,QAAM,OAAO,EAAE,qBACpB,OAAO,iBAAiB,CACtB,IAAK,8HACL,QAAS,OAAO,iBAAiB,CAC/B,CAAC,4BAA0B,EAAG,cAChC,CAAC,CACH,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_axios", "import_purify_ts", "import_HttpHeaders", "import_package", "import_HttpAccountOwnershipDataSource", "config", "validDto", "params", "axios", "result", "PACKAGE", "customConfig"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var c=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of o(e))!p.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(s=g(e,r))||s.enumerable});return t};var y=t=>c(i({},"__esModule",{value:!0}),t);var d={};module.exports=y(d);
|
|
2
|
+
//# sourceMappingURL=AccountOwnershipDto.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/account-ownership/data/dto/AccountOwnershipDto.ts"],
|
|
4
|
+
"sourcesContent": ["export type AccountOwnershipDto = {\n signedDescriptor: string;\n keyId: string;\n keyUsage: string;\n};\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["AccountOwnershipDto_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var h=(o,t)=>{for(var e in t)n(o,e,{get:t[e],enumerable:!0})},O=(o,t,e,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of s(t))!w.call(o,r)&&r!==e&&n(o,r,{get:()=>t[r],enumerable:!(p=m(t,r))||p.enumerable});return o};var f=o=>O(n({},"__esModule",{value:!0}),o);var d={};h(d,{accountOwnershipModuleFactory:()=>A});module.exports=f(d);var a=require("inversify"),i=require("../../account-ownership/data/HttpAccountOwnershipDataSource"),u=require("../../account-ownership/domain/AccountOwnershipContextLoader"),c=require("./accountOwnershipTypes");const A=()=>new a.ContainerModule(({bind:o})=>{o(c.accountOwnershipTypes.AccountOwnershipDataSource).to(i.HttpAccountOwnershipDataSource),o(c.accountOwnershipTypes.AccountOwnershipContextLoader).to(u.AccountOwnershipContextLoader)});0&&(module.exports={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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA+C,mEAC/CC,EAA8C,oEAE9CC,EAAsC,mCAE/B,MAAML,EAAgC,IAC3C,IAAI,kBAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAK,wBAAsB,0BAA0B,EAAE,GACrD,gCACF,EACAA,EAAK,wBAAsB,6BAA6B,EAAE,GACxD,+BACF,CACF,CAAC",
|
|
6
|
+
"names": ["accountOwnershipModuleFactory_exports", "__export", "accountOwnershipModuleFactory", "__toCommonJS", "import_inversify", "import_HttpAccountOwnershipDataSource", "import_AccountOwnershipContextLoader", "import_accountOwnershipTypes", "bind"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var u=(c,o)=>{for(var n in o)t(c,n,{get:o[n],enumerable:!0})},h=(c,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of p(o))!s.call(c,e)&&e!==n&&t(c,e,{get:()=>o[e],enumerable:!(r=a(o,e))||r.enumerable});return c};var i=c=>h(t({},"__esModule",{value:!0}),c);var O={};u(O,{accountOwnershipTypes:()=>w});module.exports=i(O);const w={AccountOwnershipDataSource:Symbol.for("AccountOwnershipDataSource"),AccountOwnershipContextLoader:Symbol.for("AccountOwnershipContextLoader")};0&&(module.exports={accountOwnershipTypes});
|
|
2
|
+
//# sourceMappingURL=accountOwnershipTypes.js.map
|
|
@@ -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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAwB,CACnC,2BAA4B,OAAO,IAAI,4BAA4B,EACnE,8BAA+B,OAAO,IAAI,+BAA+B,CAC3E",
|
|
6
|
+
"names": ["accountOwnershipTypes_exports", "__export", "accountOwnershipTypes", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var S=(o,e)=>{for(var t in e)p(o,t,{get:e[t],enumerable:!0})},k=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of h(e))!w.call(o,r)&&r!==t&&p(o,r,{get:()=>e[r],enumerable:!(i=g(e,r))||i.enumerable});return o};var O=o=>k(p({},"__esModule",{value:!0}),o),C=(o,e,t,i)=>{for(var r=i>1?void 0:i?g(e,t):e,n=o.length-1,d;n>=0;n--)(d=o[n])&&(r=(i?d(e,t,r):d(r))||r);return i&&r&&p(e,t,r),r},y=(o,e)=>(t,i)=>e(t,i,o);var I={};S(I,{AccountOwnershipContextLoader:()=>c});module.exports=O(I);var s=require("inversify"),m=require("../../account-ownership/di/accountOwnershipTypes"),f=require("../../pki/di/pkiTypes"),l=require("../../shared/model/ClearSignContext");const u=[l.ClearSignContextType.ACCOUNT_OWNERSHIP];let c=class{constructor(e,t){this._dataSource=e;this._certificateLoader=t}canHandle(e,t){return u.every(i=>t.includes(i))&&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:i,deviceModelId:r,challenge:n}){return(await this._dataSource.getDescriptor({publicKey:e,address:t,challenge:n,network:i})).caseOf({Left:a=>Promise.resolve([{type:l.ClearSignContextType.ERROR,error:a}]),Right:async a=>[{type:l.ClearSignContextType.ACCOUNT_OWNERSHIP,payload:a.signedDescriptor,certificate:await this._certificateLoader.loadCertificate({keyId:a.keyId,keyUsage:a.keyUsage,targetDevice:r})}]})}};c=C([(0,s.injectable)(),y(0,(0,s.inject)(m.accountOwnershipTypes.AccountOwnershipDataSource)),y(1,(0,s.inject)(f.pkiTypes.PkiCertificateLoader))],c);0&&(module.exports={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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAmC,qBAMnCC,EAAsC,wDACtCC,EAAyB,6BAGzBC,EAGO,2CAUP,MAAMC,EAA0C,CAC9C,uBAAqB,iBACvB,EAGO,IAAMC,EAAN,KAEP,CACE,YAEmBC,EAEAC,EACjB,CAHiB,iBAAAD,EAEA,wBAAAC,CAChB,CAEH,UACEC,EACAC,EACuC,CACvC,OACEL,EAAgB,MAAOM,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,KAAM,uBAAqB,MAC3B,MAAAA,CACF,CACF,CAAC,EACH,MAAO,MAAOC,GAAwC,CACpD,CACE,KAAM,uBAAqB,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,IADN,cAAW,EAKPC,EAAA,eAAO,wBAAsB,0BAA0B,GAEvDA,EAAA,eAAO,WAAS,oBAAoB,IAN5Bd",
|
|
6
|
+
"names": ["AccountOwnershipContextLoader_exports", "__export", "AccountOwnershipContextLoader", "__toCommonJS", "import_inversify", "import_accountOwnershipTypes", "import_pkiTypes", "import_ClearSignContext", "SUPPORTED_TYPES", "AccountOwnershipContextLoader", "_dataSource", "_certificateLoader", "input", "expectedTypes", "type", "publicKey", "address", "network", "deviceModelId", "challenge", "error", "result", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=require("@ledgerhq/device-management-kit"),c=require("purify-ts"),p=require("../../account-ownership/domain/AccountOwnershipContextLoader"),o=require("../../shared/model/ClearSignContext");describe("AccountOwnershipContextLoader",()=>{const i={getDescriptor:vi.fn()},r={loadCertificate:vi.fn()},n=new p.AccountOwnershipContextLoader(i,r),l={keyUsageNumber:4,payload:new Uint8Array([1,2,3])},s={signedDescriptor:"account-ownership-descriptor-payload",keyId:"domain_metadata_key",keyUsage:"trusted_name"};beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(r,"loadCertificate").mockResolvedValue(l)}),describe("canHandle",()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",network:"mainnet",deviceModelId:a.DeviceModelId.FLEX,challenge:"0xabcdef"};it("should return true for valid input with ACCOUNT_OWNERSHIP type",()=>{expect(n.canHandle(e,[o.ClearSignContextType.ACCOUNT_OWNERSHIP])).toBe(!0)}),it("should return false when expected types include unsupported types",()=>{expect(n.canHandle(e,[o.ClearSignContextType.TOKEN])).toBe(!1),expect(n.canHandle(e,[o.ClearSignContextType.TRUSTED_NAME])).toBe(!1)}),it("should return true when expected types include ACCOUNT_OWNERSHIP among others",()=>{expect(n.canHandle(e,[o.ClearSignContextType.ACCOUNT_OWNERSHIP,o.ClearSignContextType.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,d)=>{expect(n.canHandle(t,[o.ClearSignContextType.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,d)=>{expect(n.canHandle(t,[o.ClearSignContextType.ACCOUNT_OWNERSHIP])).toBe(!1)}),it.each([[{...e,publicKey:""},"empty publicKey"],[{...e,address:""},"empty address"],[{...e,challenge:""},"empty challenge"]])("should return false for %s",(t,d)=>{expect(n.canHandle(t,[o.ClearSignContextType.ACCOUNT_OWNERSHIP])).toBe(!1)}),it("should return false for invalid network value",()=>{expect(n.canHandle({...e,network:"devnet"},[o.ClearSignContextType.ACCOUNT_OWNERSHIP])).toBe(!1)}),it("should return true for testnet network",()=>{expect(n.canHandle({...e,network:"testnet"},[o.ClearSignContextType.ACCOUNT_OWNERSHIP])).toBe(!0)}),it("should return true for different device models",()=>{for(const t of[a.DeviceModelId.NANO_S,a.DeviceModelId.NANO_SP,a.DeviceModelId.NANO_X,a.DeviceModelId.STAX,a.DeviceModelId.FLEX])expect(n.canHandle({...e,deviceModelId:t},[o.ClearSignContextType.ACCOUNT_OWNERSHIP])).toBe(!0)})}),describe("load",()=>{const e={publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",network:"mainnet",deviceModelId:a.DeviceModelId.FLEX,challenge:"0xabcdef"};it("should return ACCOUNT_OWNERSHIP context with certificate",async()=>{vi.spyOn(i,"getDescriptor").mockResolvedValue((0,c.Right)(s));const t=await n.load(e);expect(i.getDescriptor).toHaveBeenCalledWith({publicKey:"abcdef1234567890",address:"3kFkntk2H5FGMzeR3GjQKPhdZK9LShKdPHsj2fiGKCdmDXj2WB",challenge:"0xabcdef",network:"mainnet"}),expect(r.loadCertificate).toHaveBeenCalledWith({keyId:"domain_metadata_key",keyUsage:"trusted_name",targetDevice:a.DeviceModelId.FLEX}),expect(t).toEqual([{type:o.ClearSignContextType.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((0,c.Right)(s)),vi.spyOn(r,"loadCertificate").mockResolvedValue(void 0);const t=await n.load(e);expect(t).toEqual([{type:o.ClearSignContextType.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((0,c.Left)(t));const d=await n.load(e);expect(d).toEqual([{type:o.ClearSignContextType.ERROR,error:t}]),expect(r.loadCertificate).not.toHaveBeenCalled()}),it("should pass correct device model to certificate loader",async()=>{const t={...e,deviceModelId:a.DeviceModelId.NANO_X};vi.spyOn(i,"getDescriptor").mockResolvedValue((0,c.Right)(s)),await n.load(t),expect(r.loadCertificate).toHaveBeenCalledWith(expect.objectContaining({targetDevice:a.DeviceModelId.NANO_X}))}),it("should pass testnet network to data source",async()=>{const t={...e,network:"testnet"};vi.spyOn(i,"getDescriptor").mockResolvedValue((0,c.Right)(s)),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((0,c.Right)({...s,signedDescriptor:t}));const d=await n.load(e);expect(d[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,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAM5BC,EAGO,oEAGPC,EAGO,2CAEP,SAAS,gCAAiC,IAAM,CAC9C,MAAMC,EAA6C,CACjD,cAAe,GAAG,GAAG,CACvB,EACMC,EAAiD,CACrD,gBAAiB,GAAG,GAAG,CACzB,EACMC,EAAS,IAAI,gCACjBF,EACAC,CACF,EAEME,EAAkC,CACtC,eAAgB,EAChB,QAAS,IAAI,WAAW,CAAC,EAAG,EAAG,CAAC,CAAC,CACnC,EAEMC,EAA6C,CACjD,iBAAkB,uCAClB,MAAO,sBACP,SAAU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BAC/C,OAAO,iBAAiB,CACtB,aAAc,gBAAc,MAC9B,CAAC,CACH,CACF,CAAC,EAED,GAAG,6CAA8C,SAAY,CAE3D,MAAMW,EAAe,CAAE,GAAGN,EAAO,QAAS,SAAmB,EAC7D,GAAG,MAAMN,EAAgB,eAAe,EAAE,qBACxC,SAAMI,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,qBACxC,SAAM,CAAE,GAAGI,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": ["import_device_management_kit", "import_purify_ts", "import_AccountOwnershipContextLoader", "import_ClearSignContext", "mockDataSource", "mockPkiCertificateLoader", "loader", "mockCertificate", "mockDescriptor", "validInput", "input", "_description", "deviceModelId", "result", "error", "inputNanoX", "inputTestnet", "longPayload"]
|
|
7
|
+
}
|
package/lib/cjs/src/di.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var T=(r,o)=>{for(var e in o)a(r,e,{get:o[e],enumerable:!0})},A=(r,o,e,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of b(o))!N.call(r,t)&&t!==e&&a(r,t,{get:()=>o[t],enumerable:!(m=P(o,t))||m.enumerable});return r};var D=r=>A(a({},"__esModule",{value:!0}),r);var V={};T(V,{makeContainer:()=>O});module.exports=D(V);var i=require("inversify"),n=require("./account-ownership/di/accountOwnershipModuleFactory"),c=require("./calldata/di/calldataModuleFactory"),l=require("./config/di/configModuleFactory"),u=require("./config/di/configTypes"),d=require("./dynamic-network/di/dynamicNetworkModuleFactory"),p=require("./external-plugin/di/externalPluginModuleFactory"),f=require("./gated-signing/di/gatedSigningModuleFactory"),y=require("./nft/di/nftModuleFactory"),M=require("./pki/di/pkiModuleFactory"),F=require("./proxy/di/proxyModuleFactory"),g=require("./reporter/di/reporterModuleFactory"),s=require("./safe/di/safeModuleFactory"),C=require("./solana/di/SolanaContextModuleFactory"),x=require("./solanaLifi/di/lifiModuleFactory"),k=require("./solanaToken/di/tokenModuleFactory"),S=require("./token/di/tokenModuleFactory"),L=require("./transaction-check/di/transactionCheckModuleFactory"),h=require("./trusted-name/di/trustedNameModuleFactory"),v=require("./typed-data/di/typedDataModuleFactory"),w=require("./uniswap/di/uniswapModuleFactory");const O=({config:r})=>{const o=new i.Container;return o.bind(u.configTypes.ContextModuleLoggerFactory).toConstantValue(r.loggerFactory),o.loadSync((0,l.configModuleFactory)(r),(0,n.accountOwnershipModuleFactory)(),(0,p.externalPluginModuleFactory)(),(0,d.dynamicNetworkModuleFactory)(),(0,y.nftModuleFactory)(),(0,F.proxyModuleFactory)(r.datasource),(0,s.safeModuleFactory)(),(0,f.gatedSigningModuleFactory)(),(0,S.tokenModuleFactory)(),(0,c.calldataModuleFactory)(),(0,h.trustedNameModuleFactory)(r.customTrustedNameDataSource),(0,v.typedDataModuleFactory)(),(0,M.nanoPkiModuleFactory)(),(0,w.uniswapModuleFactory)(),(0,L.transactionCheckModuleFactory)(),(0,C.solanaContextModuleFactory)(),(0,k.solanaTokenModuleFactory)(),(0,x.solanaLifiModuleFactory)(),(0,g.reporterModuleFactory)()),o};0&&(module.exports={makeContainer});
|
|
2
2
|
//# sourceMappingURL=di.js.map
|
package/lib/cjs/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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA0B,qBAE1BC,EAAsC,+CACtCC,EAAoC,2CACpCC,EAA4B,mCAK5BC,EAA4C,4DAC5CC,EAA4C,4DAC5CC,EAA0C,wDAC1CC,EAAiC,qCACjCC,EAAqC,qCACrCC,EAAmC,yCACnCC,EAAsC,+CACtCC,EAAkC,uCAClCC,EAA2C,kDAC3CC,EAAwC,6CACxCC,EAAyC,+CACzCA,EAAmC,yCACnCC,EAA8C,gEAC9CC,EAAyC,sDACzCC,EAAuC,kDACvCC,EAAqC,6CAM9B,
|
|
6
|
-
"names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_calldataModuleFactory", "import_configModuleFactory", "import_configTypes", "import_dynamicNetworkModuleFactory", "import_externalPluginModuleFactory", "import_gatedSigningModuleFactory", "import_nftModuleFactory", "import_pkiModuleFactory", "import_proxyModuleFactory", "import_reporterModuleFactory", "import_safeModuleFactory", "import_SolanaContextModuleFactory", "import_lifiModuleFactory", "import_tokenModuleFactory", "import_transactionCheckModuleFactory", "import_trustedNameModuleFactory", "import_typedDataModuleFactory", "import_uniswapModuleFactory", "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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA0B,qBAE1BC,EAA8C,gEAC9CC,EAAsC,+CACtCC,EAAoC,2CACpCC,EAA4B,mCAK5BC,EAA4C,4DAC5CC,EAA4C,4DAC5CC,EAA0C,wDAC1CC,EAAiC,qCACjCC,EAAqC,qCACrCC,EAAmC,yCACnCC,EAAsC,+CACtCC,EAAkC,uCAClCC,EAA2C,kDAC3CC,EAAwC,6CACxCC,EAAyC,+CACzCA,EAAmC,yCACnCC,EAA8C,gEAC9CC,EAAyC,sDACzCC,EAAuC,kDACvCC,EAAqC,6CAM9B,MAAMrB,EAAgB,CAAC,CAAE,OAAAsB,CAAO,IAAyB,CAC9D,MAAMC,EAAY,IAAI,YAEtB,OAAAA,EACG,KAEC,cAAY,0BAA0B,EACvC,gBAAgBD,EAAO,aAAa,EAEvCC,EAAU,YACR,uBAAoBD,CAAM,KAC1B,iCAA8B,KAC9B,+BAA4B,KAC5B,+BAA4B,KAC5B,oBAAiB,KACjB,sBAAmBA,EAAO,UAAU,KACpC,qBAAkB,KAClB,6BAA0B,KAC1B,sBAAmB,KACnB,yBAAsB,KACtB,4BAAyBA,EAAO,2BAA2B,KAC3D,0BAAuB,KACvB,wBAAqB,KACrB,wBAAqB,KACrB,iCAA8B,KAC9B,8BAA2B,KAC3B,4BAAyB,KACzB,2BAAwB,KACxB,yBAAsB,CACxB,EAEOC,CACT",
|
|
6
|
+
"names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_accountOwnershipModuleFactory", "import_calldataModuleFactory", "import_configModuleFactory", "import_configTypes", "import_dynamicNetworkModuleFactory", "import_externalPluginModuleFactory", "import_gatedSigningModuleFactory", "import_nftModuleFactory", "import_pkiModuleFactory", "import_proxyModuleFactory", "import_reporterModuleFactory", "import_safeModuleFactory", "import_SolanaContextModuleFactory", "import_lifiModuleFactory", "import_tokenModuleFactory", "import_transactionCheckModuleFactory", "import_trustedNameModuleFactory", "import_typedDataModuleFactory", "import_uniswapModuleFactory", "config", "container"]
|
|
7
7
|
}
|
package/lib/cjs/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var C=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(t,e,f,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of l(e))!d.call(t,x)&&x!==f&&C(t,x,{get:()=>e[x],enumerable:!(m=n(e,x))||m.enumerable});return t},r=(t,e,f)=>(p(t,e,"default"),f&&p(f,e,"default"));var M=t=>p(C({},"__esModule",{value:!0}),t);var o={};module.exports=M(o);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./gated-signing/data/GatedDescriptorDataSource"),module.exports);r(o,require("./gated-signing/data/HttpGatedDescriptorDataSource"),module.exports);r(o,require("./gated-signing/domain/GatedSigningContextLoader"),module.exports);r(o,require("./gated-signing/domain/GatedSigningTypedDataContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./reporter/data/BlindSigningReporterDatasource"),module.exports);r(o,require("./reporter/data/HttpBlindSigningReporterDatasource"),module.exports);r(o,require("./reporter/domain/BlindSigningReporter"),module.exports);r(o,require("./reporter/domain/DefaultBlindSigningReporter"),module.exports);r(o,require("./reporter/model/BlindSigningEvent"),module.exports);r(o,require("./reporter/model/BlindSigningModelId"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/SolanaContextTypes"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./solana/domain/solanaContextTypes"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./typed-data/utils/getSchemaHash"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);0&&(module.exports={...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./gated-signing/data/GatedDescriptorDataSource"),...require("./gated-signing/data/HttpGatedDescriptorDataSource"),...require("./gated-signing/domain/GatedSigningContextLoader"),...require("./gated-signing/domain/GatedSigningTypedDataContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./reporter/data/BlindSigningReporterDatasource"),...require("./reporter/data/HttpBlindSigningReporterDatasource"),...require("./reporter/domain/BlindSigningReporter"),...require("./reporter/domain/DefaultBlindSigningReporter"),...require("./reporter/model/BlindSigningEvent"),...require("./reporter/model/BlindSigningModelId"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/SolanaContextTypes"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./solana/domain/solanaContextTypes"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./typed-data/utils/getSchemaHash"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader")});
|
|
1
|
+
"use strict";var C=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(t,e,f,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of l(e))!d.call(t,x)&&x!==f&&C(t,x,{get:()=>e[x],enumerable:!(m=n(e,x))||m.enumerable});return t},r=(t,e,f)=>(p(t,e,"default"),f&&p(f,e,"default"));var M=t=>p(C({},"__esModule",{value:!0}),t);var o={};module.exports=M(o);r(o,require("./account-ownership/data/AccountOwnershipDataSource"),module.exports);r(o,require("./account-ownership/data/HttpAccountOwnershipDataSource"),module.exports);r(o,require("./account-ownership/domain/AccountOwnershipContextLoader"),module.exports);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./gated-signing/data/GatedDescriptorDataSource"),module.exports);r(o,require("./gated-signing/data/HttpGatedDescriptorDataSource"),module.exports);r(o,require("./gated-signing/domain/GatedSigningContextLoader"),module.exports);r(o,require("./gated-signing/domain/GatedSigningTypedDataContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./reporter/data/BlindSigningReporterDatasource"),module.exports);r(o,require("./reporter/data/HttpBlindSigningReporterDatasource"),module.exports);r(o,require("./reporter/domain/BlindSigningReporter"),module.exports);r(o,require("./reporter/domain/DefaultBlindSigningReporter"),module.exports);r(o,require("./reporter/model/BlindSigningEvent"),module.exports);r(o,require("./reporter/model/BlindSigningModelId"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/SolanaContextTypes"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./solana/domain/solanaContextTypes"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./typed-data/utils/getSchemaHash"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);0&&(module.exports={...require("./account-ownership/data/AccountOwnershipDataSource"),...require("./account-ownership/data/HttpAccountOwnershipDataSource"),...require("./account-ownership/domain/AccountOwnershipContextLoader"),...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./gated-signing/data/GatedDescriptorDataSource"),...require("./gated-signing/data/HttpGatedDescriptorDataSource"),...require("./gated-signing/domain/GatedSigningContextLoader"),...require("./gated-signing/domain/GatedSigningTypedDataContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./reporter/data/BlindSigningReporterDatasource"),...require("./reporter/data/HttpBlindSigningReporterDatasource"),...require("./reporter/domain/BlindSigningReporter"),...require("./reporter/domain/DefaultBlindSigningReporter"),...require("./reporter/model/BlindSigningEvent"),...require("./reporter/model/BlindSigningModelId"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/SolanaContextTypes"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./solana/domain/solanaContextTypes"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./typed-data/utils/getSchemaHash"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader")});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/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": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,
|
|
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": "iaAAA,IAAAA,EAA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;var T=Object.prototype.hasOwnProperty;var N=(n,t)=>{for(var c in t)i(n,c,{get:t[c],enumerable:!0})},u=(n,t,c,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of S(t))!T.call(n,r)&&r!==c&&i(n,r,{get:()=>t[r],enumerable:!(s=l(t,r))||s.enumerable});return n};var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var N=(n,t)=>{for(var c in t)i(n,c,{get:t[c],enumerable:!0})},u=(n,t,c,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of S(t))!T.call(n,r)&&r!==c&&i(n,r,{get:()=>t[r],enumerable:!(s=l(t,r))||s.enumerable});return n};var p=n=>u(i({},"__esModule",{value:!0}),n);var y={};N(y,{ClearSignContextReferenceType:()=>o,ClearSignContextType:()=>C});module.exports=p(y);var C=(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))(C||{}),o=(a=>(a.TOKEN="token",a.NFT="nft",a.TRUSTED_NAME="trustedName",a.ENUM="enum",a.CALLDATA="calldata",a))(o||{});0&&(module.exports={ClearSignContextReferenceType,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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAIO,IAAKG,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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAIO,IAAKG,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,IAoBAD,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,KAAO,OACPA,EAAA,SAAW,WALDA,OAAA",
|
|
6
6
|
"names": ["ClearSignContext_exports", "__export", "ClearSignContextReferenceType", "ClearSignContextType", "__toCommonJS"]
|
|
7
7
|
}
|
package/lib/esm/package.json
CHANGED
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
59
59
|
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
|
|
60
60
|
},
|
|
61
|
-
"version": "0.0.0-develop-
|
|
61
|
+
"version": "0.0.0-develop-20260417002136"
|
|
62
62
|
}
|