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 1 commit
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
14 changes: 14 additions & 0 deletions packages/cheqd-sdk/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Config } from '@jest/types'

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

import packageJson from './package.json'

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

export default config
48 changes: 48 additions & 0 deletions packages/cheqd-sdk/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@aries-framework/cheqd-sdk",
DaevMithran marked this conversation as resolved.
Show resolved Hide resolved
"main": "build/index",
"types": "build/index",
"version": "0.1.0",
DaevMithran marked this conversation as resolved.
Show resolved Hide resolved
"private": true,
DaevMithran marked this conversation as resolved.
Show resolved Hide resolved
"files": [
"build"
],
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"homepage": "https://github.com/hyperledger/aries-framework-javascript/tree/main/packages/cheqd-sdk",
"repository": {
"type": "git",
"url": "https://github.com/hyperledger/aries-framework-javascript",
"directory": "packages/cheqd-sdk"
},
"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": "^3.0.2",
"@cheqd/ts-proto": "^2.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"rxjs": "^7.2.0",
"tsyringe": "^4.7.0",
"uint8arrays": "*"
},
"devDependencies": {
"rimraf": "^4.0.7",
"typescript": "~4.9.4",
"@aries-framework/indy-sdk": "*",
"@types/indy-sdk": "*",
"@cheqd/ts-proto": "*",
"@cosmjs/proto-signing": "*",
"@cosmjs/crypto": "*",
"@types/uuid": "*"
}
}
26 changes: 26 additions & 0 deletions packages/cheqd-sdk/src/CheqdSdkModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { CheqdSdkModuleConfigOptions } from './CheqdSdkModuleConfig'
import type { AgentContext, DependencyManager, Module } from '@aries-framework/core'

import { CheqdSdkModuleConfig } from './CheqdSdkModuleConfig'
import { CheqdSdkLedgerService } from './ledger'

export class CheqdSdkModule implements Module {
public readonly config: CheqdSdkModuleConfig

public constructor(config: CheqdSdkModuleConfigOptions) {
this.config = new CheqdSdkModuleConfig(config)
}

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

dependencyManager.registerSingleton(CheqdSdkLedgerService)
}

public async initialize(agentContext: AgentContext): Promise<void> {
// not required
const cheqdSdkLedgerService = agentContext.dependencyManager.resolve(CheqdSdkLedgerService)
await cheqdSdkLedgerService.connect()
}
}
25 changes: 25 additions & 0 deletions packages/cheqd-sdk/src/CheqdSdkModuleConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* CheqdSdkModuleConfigOptions defines the interface for the options of the CheqdSdkModuleConfig class.
*/
export interface CheqdSdkModuleConfigOptions {
rpcUrl?: string
cosmosPayerSeed: string
}

export class CheqdSdkModuleConfig {
private options: CheqdSdkModuleConfigOptions

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

/** See {@link CheqdSdkModuleConfigOptions.rpcUrl} */
public get rpcUrl() {
return this.options.rpcUrl
}

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