Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add cheqd-sdk module #1334

Merged
merged 21 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "^2.0.1",
DaevMithran marked this conversation as resolved.
Show resolved Hide resolved
"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