Skip to content

Commit

Permalink
feat: Add cheqd-sdk module (#1334)
Browse files Browse the repository at this point in the history
Signed-off-by: DaevMithran <daevmithran1999@gmail.com>
  • Loading branch information
DaevMithran committed Apr 13, 2023
1 parent 4e7a380 commit b38525f
Show file tree
Hide file tree
Showing 30 changed files with 2,659 additions and 14 deletions.
13 changes: 13 additions & 0 deletions packages/cheqd/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Config } from '@jest/types'

import base from '../../jest.config.base'

import packageJson from './package.json'

const config: Config.InitialOptions = {
...base,
displayName: packageJson.name,
setupFilesAfterEnv: ['./tests/setup.ts'],
}

export default config
45 changes: 45 additions & 0 deletions packages/cheqd/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@aries-framework/cheqd",
"main": "build/index",
"types": "build/index",
"version": "0.3.3",
"files": [
"build"
],
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"homepage": "https://github.com/hyperledger/aries-framework-javascript/tree/main/packages/cheqd",
"repository": {
"type": "git",
"url": "https://github.com/hyperledger/aries-framework-javascript",
"directory": "packages/cheqd"
},
"scripts": {
"build": "yarn run clean && yarn run compile",
"clean": "rimraf ./build",
"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "yarn run build",
"test": "jest"
},
"dependencies": {
"@aries-framework/anoncreds": "0.3.3",
"@aries-framework/core": "0.3.3",
"@cheqd/sdk": "cjs",
"@cheqd/ts-proto": "cjs",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"rxjs": "^7.2.0",
"tsyringe": "^4.7.0",
"@cosmjs/proto-signing": "^0.29.5",
"@cosmjs/crypto": "^0.29.5",
"@stablelib/ed25519": "^1.0.3"
},
"devDependencies": {
"rimraf": "^4.0.7",
"typescript": "~4.9.4",
"@aries-framework/indy-sdk": "*",
"@types/indy-sdk": "*"
}
}
26 changes: 26 additions & 0 deletions packages/cheqd/src/CheqdModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { CheqdModuleConfigOptions } from './CheqdModuleConfig'
import type { AgentContext, DependencyManager, Module } from '@aries-framework/core'

import { CheqdModuleConfig } from './CheqdModuleConfig'
import { CheqdLedgerService } from './ledger'

export class CheqdModule implements Module {
public readonly config: CheqdModuleConfig

public constructor(config: CheqdModuleConfigOptions) {
this.config = new CheqdModuleConfig(config)
}

public register(dependencyManager: DependencyManager) {
// Register config
dependencyManager.registerInstance(CheqdModuleConfig, this.config)

dependencyManager.registerSingleton(CheqdLedgerService)
}

public async initialize(agentContext: AgentContext): Promise<void> {
// not required
const cheqdLedgerService = agentContext.dependencyManager.resolve(CheqdLedgerService)
await cheqdLedgerService.connect()
}
}
25 changes: 25 additions & 0 deletions packages/cheqd/src/CheqdModuleConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* CheqdModuleConfigOptions defines the interface for the options of the CheqdModuleConfig class.
*/
export interface CheqdModuleConfigOptions {
networks: NetworkConfig[]
}

export interface NetworkConfig {
rpcUrl?: string
cosmosPayerSeed: string
network: string
}

export class CheqdModuleConfig {
private options: CheqdModuleConfigOptions

public constructor(options: CheqdModuleConfigOptions) {
this.options = options
}

/** See {@link CheqdModuleConfigOptions.networks} */
public get networks() {
return this.options.networks
}
}
1 change: 1 addition & 0 deletions packages/cheqd/src/anoncreds/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { CheqdAnonCredsRegistry } from './services/CheqdAnonCredsRegistry'
Loading

0 comments on commit b38525f

Please sign in to comment.