@ayanworks/credo-polygon-w3c-module 2.0.0-alpha.1 → 2.0.0
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/build/PolygonApi.d.mts +53 -0
- package/build/PolygonApi.d.mts.map +1 -0
- package/build/PolygonApi.mjs +41 -0
- package/build/PolygonApi.mjs.map +1 -0
- package/build/PolygonModule.d.mts +14 -0
- package/build/PolygonModule.d.mts.map +1 -0
- package/build/PolygonModule.mjs +31 -0
- package/build/PolygonModule.mjs.map +1 -0
- package/build/PolygonModuleConfig.d.mts +28 -0
- package/build/PolygonModuleConfig.d.mts.map +1 -0
- package/build/PolygonModuleConfig.mjs +14 -0
- package/build/PolygonModuleConfig.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.110.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.110.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.110.0/helpers/decorateParam.mjs +9 -0
- package/build/dids/PolygonDidRegistrar.d.mts +39 -0
- package/build/dids/PolygonDidRegistrar.d.mts.map +1 -0
- package/build/dids/PolygonDidRegistrar.mjs +260 -0
- package/build/dids/PolygonDidRegistrar.mjs.map +1 -0
- package/build/dids/PolygonDidResolver.d.mts +14 -0
- package/build/dids/PolygonDidResolver.d.mts.map +1 -0
- package/build/dids/PolygonDidResolver.mjs +38 -0
- package/build/dids/PolygonDidResolver.mjs.map +1 -0
- package/build/dids/didPolygonUtil.d.mts +2 -0
- package/build/dids/didPolygonUtil.mjs +64 -0
- package/build/dids/didPolygonUtil.mjs.map +1 -0
- package/build/dids/index.d.mts +3 -0
- package/build/dids/index.mjs +3 -0
- package/build/index.d.mts +10 -0
- package/build/index.mjs +11 -0
- package/build/ledger/PolygonLedgerService.d.mts +116 -0
- package/build/ledger/PolygonLedgerService.d.mts.map +1 -0
- package/build/ledger/PolygonLedgerService.mjs +172 -0
- package/build/ledger/PolygonLedgerService.mjs.map +1 -0
- package/build/ledger/index.d.mts +1 -0
- package/build/ledger/index.mjs +1 -0
- package/build/signature-suites/EcdsaSecp256k1Signature2019.mjs +117 -0
- package/build/signature-suites/EcdsaSecp256k1Signature2019.mjs.map +1 -0
- package/build/signature-suites/index.mjs +1 -0
- package/build/utils/index.d.mts +1 -0
- package/build/utils/index.mjs +1 -0
- package/build/utils/utils.d.mts +12 -0
- package/build/utils/utils.d.mts.map +1 -0
- package/build/utils/utils.mjs +39 -0
- package/build/utils/utils.mjs.map +1 -0
- package/package.json +26 -47
- package/README.md +0 -30
- package/build/PolygonApi.d.ts +0 -35
- package/build/PolygonApi.js +0 -42
- package/build/PolygonApi.js.map +0 -1
- package/build/PolygonModule.d.ts +0 -10
- package/build/PolygonModule.js +0 -31
- package/build/PolygonModule.js.map +0 -1
- package/build/PolygonModuleConfig.d.ts +0 -18
- package/build/PolygonModuleConfig.js +0 -14
- package/build/PolygonModuleConfig.js.map +0 -1
- package/build/dids/PolygonDidRegistrar.d.ts +0 -30
- package/build/dids/PolygonDidRegistrar.js +0 -267
- package/build/dids/PolygonDidRegistrar.js.map +0 -1
- package/build/dids/PolygonDidResolver.d.ts +0 -9
- package/build/dids/PolygonDidResolver.js +0 -40
- package/build/dids/PolygonDidResolver.js.map +0 -1
- package/build/dids/didPolygonUtil.d.ts +0 -7
- package/build/dids/didPolygonUtil.js +0 -98
- package/build/dids/didPolygonUtil.js.map +0 -1
- package/build/dids/index.d.ts +0 -3
- package/build/dids/index.js +0 -20
- package/build/dids/index.js.map +0 -1
- package/build/index.d.ts +0 -5
- package/build/index.js +0 -28
- package/build/index.js.map +0 -1
- package/build/ledger/PolygonLedgerService.d.ts +0 -87
- package/build/ledger/PolygonLedgerService.js +0 -210
- package/build/ledger/PolygonLedgerService.js.map +0 -1
- package/build/ledger/index.d.ts +0 -1
- package/build/ledger/index.js +0 -18
- package/build/ledger/index.js.map +0 -1
- package/build/signature-suites/EcdsaSecp256k1Signature2019.d.ts +0 -60
- package/build/signature-suites/EcdsaSecp256k1Signature2019.js +0 -126
- package/build/signature-suites/EcdsaSecp256k1Signature2019.js.map +0 -1
- package/build/signature-suites/index.d.ts +0 -1
- package/build/signature-suites/index.js +0 -18
- package/build/signature-suites/index.js.map +0 -1
- package/build/utils/index.d.ts +0 -1
- package/build/utils/index.js +0 -18
- package/build/utils/index.js.map +0 -1
- package/build/utils/utils.d.ts +0 -7
- package/build/utils/utils.js +0 -38
- package/build/utils/utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { generateSecp256k1KeyPair, getSecp256k1DidDocWithPublicKey } from "./utils.mjs";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DidDocument } from "@credo-ts/core";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/utils.d.ts
|
|
4
|
+
declare const generateSecp256k1KeyPair: () => Promise<{
|
|
5
|
+
privateKey: string;
|
|
6
|
+
publicKeyBase58: string;
|
|
7
|
+
address: string;
|
|
8
|
+
}>;
|
|
9
|
+
declare function getSecp256k1DidDocWithPublicKey(did: string, publicKeyBase58: string, serviceEndpoint?: string): DidDocument;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { generateSecp256k1KeyPair, getSecp256k1DidDocWithPublicKey };
|
|
12
|
+
//# sourceMappingURL=utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/utils/utils.ts"],"mappings":";;;cAWa,wBAAA,QAAwB,OAAA;;;;;iBAKrB,+BAAA,CACd,GAAA,UACA,eAAA,UACA,eAAA,YACC,WAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SECURITY_CONTEXT_SECP256k1_URL } from "../signature-suites/EcdsaSecp256k1Signature2019.mjs";
|
|
2
|
+
import "../signature-suites/index.mjs";
|
|
3
|
+
import { DidDocumentBuilder, DidDocumentService, VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019, VerificationMethod } from "@credo-ts/core";
|
|
4
|
+
import { PolygonDID } from "@ayanworks/polygon-did-registrar";
|
|
5
|
+
|
|
6
|
+
//#region src/utils/utils.ts
|
|
7
|
+
const generateSecp256k1KeyPair = async () => {
|
|
8
|
+
const { privateKey, publicKeyBase58, address } = await PolygonDID.createKeyPair("testnet");
|
|
9
|
+
return {
|
|
10
|
+
privateKey,
|
|
11
|
+
publicKeyBase58,
|
|
12
|
+
address
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
function getSecp256k1DidDocWithPublicKey(did, publicKeyBase58, serviceEndpoint) {
|
|
16
|
+
const verificationMethod = new VerificationMethod({
|
|
17
|
+
id: `${did}#key-1`,
|
|
18
|
+
type: VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019,
|
|
19
|
+
controller: did,
|
|
20
|
+
publicKeyBase58
|
|
21
|
+
});
|
|
22
|
+
const didDocumentBuilder = new DidDocumentBuilder(did);
|
|
23
|
+
didDocumentBuilder.addContext(SECURITY_CONTEXT_SECP256k1_URL).addVerificationMethod(verificationMethod);
|
|
24
|
+
if (serviceEndpoint) {
|
|
25
|
+
const service = new DidDocumentService({
|
|
26
|
+
id: `${did}#linked-domain`,
|
|
27
|
+
serviceEndpoint,
|
|
28
|
+
type: "LinkedDomains"
|
|
29
|
+
});
|
|
30
|
+
didDocumentBuilder.addService(service);
|
|
31
|
+
}
|
|
32
|
+
didDocumentBuilder.addAuthentication(verificationMethod.id).addAssertionMethod(verificationMethod.id).addCapabilityDelegation(verificationMethod.id).addCapabilityInvocation(verificationMethod.id);
|
|
33
|
+
didDocumentBuilder.addKeyAgreement(verificationMethod.id);
|
|
34
|
+
return didDocumentBuilder.build();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { generateSecp256k1KeyPair, getSecp256k1DidDocWithPublicKey };
|
|
39
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/utils/utils.ts"],"sourcesContent":["import { PolygonDID } from '@ayanworks/polygon-did-registrar'\nimport type { DidDocument } from '@credo-ts/core'\nimport {\n DidDocumentBuilder,\n DidDocumentService,\n VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019,\n VerificationMethod,\n} from '@credo-ts/core'\n\nimport { SECURITY_CONTEXT_SECP256k1_URL } from '../signature-suites'\n\nexport const generateSecp256k1KeyPair = async () => {\n const { privateKey, publicKeyBase58, address } = await PolygonDID.createKeyPair('testnet')\n return { privateKey, publicKeyBase58, address }\n}\n\nexport function getSecp256k1DidDocWithPublicKey(\n did: string,\n publicKeyBase58: string,\n serviceEndpoint?: string\n): DidDocument {\n const verificationMethod = new VerificationMethod({\n id: `${did}#key-1`,\n type: VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019,\n controller: did,\n publicKeyBase58,\n })\n\n const didDocumentBuilder = new DidDocumentBuilder(did)\n didDocumentBuilder.addContext(SECURITY_CONTEXT_SECP256k1_URL).addVerificationMethod(verificationMethod)\n\n if (serviceEndpoint) {\n const service = new DidDocumentService({\n id: `${did}#linked-domain`,\n serviceEndpoint,\n type: 'LinkedDomains',\n })\n\n didDocumentBuilder.addService(service)\n }\n\n didDocumentBuilder\n .addAuthentication(verificationMethod.id)\n .addAssertionMethod(verificationMethod.id)\n .addCapabilityDelegation(verificationMethod.id)\n .addCapabilityInvocation(verificationMethod.id)\n\n didDocumentBuilder.addKeyAgreement(verificationMethod.id)\n\n return didDocumentBuilder.build()\n}\n"],"mappings":";;;;;;AAWA,MAAa,2BAA2B,YAAY;CAClD,MAAM,EAAE,YAAY,iBAAiB,YAAY,MAAM,WAAW,cAAc,UAAU;AAC1F,QAAO;EAAE;EAAY;EAAiB;EAAS;;AAGjD,SAAgB,gCACd,KACA,iBACA,iBACa;CACb,MAAM,qBAAqB,IAAI,mBAAmB;EAChD,IAAI,GAAG,IAAI;EACX,MAAM;EACN,YAAY;EACZ;EACD,CAAC;CAEF,MAAM,qBAAqB,IAAI,mBAAmB,IAAI;AACtD,oBAAmB,WAAW,+BAA+B,CAAC,sBAAsB,mBAAmB;AAEvG,KAAI,iBAAiB;EACnB,MAAM,UAAU,IAAI,mBAAmB;GACrC,IAAI,GAAG,IAAI;GACX;GACA,MAAM;GACP,CAAC;AAEF,qBAAmB,WAAW,QAAQ;;AAGxC,oBACG,kBAAkB,mBAAmB,GAAG,CACxC,mBAAmB,mBAAmB,GAAG,CACzC,wBAAwB,mBAAmB,GAAG,CAC9C,wBAAwB,mBAAmB,GAAG;AAEjD,oBAAmB,gBAAgB,mBAAmB,GAAG;AAEzD,QAAO,mBAAmB,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ayanworks/credo-polygon-w3c-module",
|
|
3
|
-
"
|
|
4
|
-
"types": "build/index",
|
|
5
|
-
"version": "2.0.0-alpha.1",
|
|
3
|
+
"version": "2.0.0",
|
|
6
4
|
"files": [
|
|
7
5
|
"build"
|
|
8
6
|
],
|
|
@@ -10,58 +8,39 @@
|
|
|
10
8
|
"publishConfig": {
|
|
11
9
|
"access": "public"
|
|
12
10
|
},
|
|
13
|
-
"homepage": "https://github.com/ayanworks/
|
|
11
|
+
"homepage": "https://github.com/ayanworks/polygon-did-modules/tree/main/packages/credo-module",
|
|
14
12
|
"repository": {
|
|
15
13
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/ayanworks/
|
|
17
|
-
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "yarn run clean && yarn run compile",
|
|
20
|
-
"clean": "rimraf -rf ./build",
|
|
21
|
-
"compile": "tsc -p tsconfig.build.json",
|
|
22
|
-
"prepublishOnly": "yarn run build",
|
|
23
|
-
"check-types": "tsc --noEmit -p tsconfig.build.json",
|
|
24
|
-
"check-format": "yarn prettier --check",
|
|
25
|
-
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|json|ts|md|yml|yaml)'",
|
|
26
|
-
"test": "jest",
|
|
27
|
-
"lint": "eslint --ignore-path .gitignore ."
|
|
14
|
+
"url": "https://github.com/ayanworks/polygon-did-modules",
|
|
15
|
+
"directory": "packages/credo-module"
|
|
28
16
|
},
|
|
29
17
|
"dependencies": {
|
|
30
|
-
"@credo-ts/askar": "0.
|
|
31
|
-
"@credo-ts/core": "0.
|
|
32
|
-
"@ayanworks/polygon-did-registrar": "2.
|
|
33
|
-
"@ayanworks/polygon-did-resolver": "
|
|
34
|
-
"@ayanworks/polygon-schema-manager": "2.
|
|
18
|
+
"@credo-ts/askar": "^0.6.1",
|
|
19
|
+
"@credo-ts/core": "^0.6.1",
|
|
20
|
+
"@ayanworks/polygon-did-registrar": "2.2.0",
|
|
21
|
+
"@ayanworks/polygon-did-resolver": "1.0.2",
|
|
22
|
+
"@ayanworks/polygon-schema-manager": "2.2.0",
|
|
35
23
|
"did-resolver": "^4.1.0",
|
|
36
|
-
"ethers": "^6.
|
|
24
|
+
"ethers": "^6.16.0"
|
|
37
25
|
},
|
|
38
26
|
"devDependencies": {
|
|
39
|
-
"@credo-ts/node": "0.
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@types/jest": "^26.0.23",
|
|
43
|
-
"@types/node": "^18.18.8",
|
|
44
|
-
"@types/uuid": "^9.0.0",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
|
46
|
-
"@typescript-eslint/parser": "^6.19.1",
|
|
47
|
-
"eslint": "^7.32.0",
|
|
48
|
-
"eslint-config-prettier": "^8.8.0",
|
|
49
|
-
"eslint-import-resolver-typescript": "^3.5.5",
|
|
50
|
-
"eslint-plugin-import": "^2.27.5",
|
|
51
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
52
|
-
"jest": "^29.5.0",
|
|
53
|
-
"prettier": "^2.2.1",
|
|
27
|
+
"@credo-ts/node": "^0.6.1",
|
|
28
|
+
"@credo-ts/didcomm": "^0.6.1",
|
|
29
|
+
"@openwallet-foundation/askar-nodejs": "^0.4.3",
|
|
54
30
|
"reflect-metadata": "^0.2.1",
|
|
55
|
-
"release-it": "^16.3.0",
|
|
56
|
-
"rimraf": "^4.4.0",
|
|
57
31
|
"rxjs": "^7.8.1",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"typescript": "~4.9.5"
|
|
32
|
+
"@types/node": "^20.19.25",
|
|
33
|
+
"typescript": "~5.9.3",
|
|
34
|
+
"vitest": "^4.0.18"
|
|
62
35
|
},
|
|
63
|
-
"
|
|
64
|
-
"
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsdown --config-loader unconfig",
|
|
38
|
+
"test": "vitest run"
|
|
65
39
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
40
|
+
"types": "./build/index.d.mts",
|
|
41
|
+
"module": "./build/index.mjs",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": "./build/index.mjs",
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/README.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Credo did:polygon W3C Module
|
|
2
|
-
|
|
3
|
-
- W3C did:polygon method registry for [credo-ts](https://github.com/openwallet-foundation/credo-ts).
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
import { PolygonDidResolver, PolygonDidRegistrar, PolygonModule } from 'afj-polygon-w3c-module'
|
|
9
|
-
|
|
10
|
-
const agent = new Agent({
|
|
11
|
-
config: {
|
|
12
|
-
/* agent config */
|
|
13
|
-
},
|
|
14
|
-
dependencies,
|
|
15
|
-
modules: {
|
|
16
|
-
/* ... */
|
|
17
|
-
dids: new DidsModule({
|
|
18
|
-
resolvers: [ /* ... */, new PolygonDidResolver()],
|
|
19
|
-
registrars: [ /* ... */, new PolygonDidRegistrar()],
|
|
20
|
-
}),
|
|
21
|
-
/* ... */
|
|
22
|
-
polygon: new PolygonModule({
|
|
23
|
-
rpcUrl: 'rpcUrl' // polygon rpc url,
|
|
24
|
-
didContractAddress: 'didContractAddress' // polygon did contract address,
|
|
25
|
-
fileServerToken: 'fileServerToken' // polygon file server token to store schema json,
|
|
26
|
-
schemaManagerContractAddress: 'schemaManagerContractAddress' // polygon schema manager contract address,
|
|
27
|
-
serverUrl: 'serverUrl' // polygon file server url,
|
|
28
|
-
}),
|
|
29
|
-
})
|
|
30
|
-
```
|
package/build/PolygonApi.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { CreateSchemaOperationOptions, DidOperationOptions } from './ledger';
|
|
2
|
-
import { AgentContext } from '@credo-ts/core';
|
|
3
|
-
import { PolygonLedgerService } from './ledger';
|
|
4
|
-
export declare class PolygonApi {
|
|
5
|
-
private agentContext;
|
|
6
|
-
private ledgerService;
|
|
7
|
-
constructor(agentContext: AgentContext, ledgerService: PolygonLedgerService);
|
|
8
|
-
createSchema({ did, schemaName, schema }: {
|
|
9
|
-
did: string;
|
|
10
|
-
schemaName: string;
|
|
11
|
-
schema: object;
|
|
12
|
-
}): Promise<{
|
|
13
|
-
did: string;
|
|
14
|
-
schemaId: string;
|
|
15
|
-
schemaTxnHash: any;
|
|
16
|
-
resourceTxnHash: any;
|
|
17
|
-
tnxSchemaId?: undefined;
|
|
18
|
-
schemaTxhash?: undefined;
|
|
19
|
-
schemaState?: undefined;
|
|
20
|
-
} | {
|
|
21
|
-
tnxSchemaId: string;
|
|
22
|
-
schemaTxhash: string;
|
|
23
|
-
schemaState: {
|
|
24
|
-
state: string;
|
|
25
|
-
reason: string;
|
|
26
|
-
};
|
|
27
|
-
did?: undefined;
|
|
28
|
-
schemaId?: undefined;
|
|
29
|
-
schemaTxnHash?: undefined;
|
|
30
|
-
resourceTxnHash?: undefined;
|
|
31
|
-
}>;
|
|
32
|
-
getSchemaById(did: string, schemaId: string): Promise<any>;
|
|
33
|
-
estimateFeeForDidOperation(options: DidOperationOptions): Promise<import("@ayanworks/polygon-did-registrar/build/registrar").EstimatedTxDetails | null | undefined>;
|
|
34
|
-
estimateFeeForSchemaOperation(options: CreateSchemaOperationOptions): Promise<{} | undefined>;
|
|
35
|
-
}
|
package/build/PolygonApi.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PolygonApi = void 0;
|
|
13
|
-
const core_1 = require("@credo-ts/core");
|
|
14
|
-
const ledger_1 = require("./ledger");
|
|
15
|
-
let PolygonApi = class PolygonApi {
|
|
16
|
-
constructor(agentContext, ledgerService) {
|
|
17
|
-
this.agentContext = agentContext;
|
|
18
|
-
this.ledgerService = ledgerService;
|
|
19
|
-
}
|
|
20
|
-
async createSchema({ did, schemaName, schema }) {
|
|
21
|
-
const schemaDetails = await this.ledgerService.createSchema(this.agentContext, { did, schemaName, schema });
|
|
22
|
-
return schemaDetails;
|
|
23
|
-
}
|
|
24
|
-
async getSchemaById(did, schemaId) {
|
|
25
|
-
const schemaDetails = await this.ledgerService.getSchemaByDidAndSchemaId(this.agentContext, did, schemaId);
|
|
26
|
-
return schemaDetails;
|
|
27
|
-
}
|
|
28
|
-
async estimateFeeForDidOperation(options) {
|
|
29
|
-
const estimatedFee = await this.ledgerService.estimateFeeForDidOperation(this.agentContext, options);
|
|
30
|
-
return estimatedFee;
|
|
31
|
-
}
|
|
32
|
-
async estimateFeeForSchemaOperation(options) {
|
|
33
|
-
const estimatedFee = await this.ledgerService.estimateFeeForSchemaOperation(this.agentContext, options);
|
|
34
|
-
return estimatedFee;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
PolygonApi = __decorate([
|
|
38
|
-
(0, core_1.injectable)(),
|
|
39
|
-
__metadata("design:paramtypes", [core_1.AgentContext, ledger_1.PolygonLedgerService])
|
|
40
|
-
], PolygonApi);
|
|
41
|
-
exports.PolygonApi = PolygonApi;
|
|
42
|
-
//# sourceMappingURL=PolygonApi.js.map
|
package/build/PolygonApi.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonApi.js","sourceRoot":"","sources":["../src/PolygonApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAyD;AAEzD,qCAA+C;AAGxC,IAAM,UAAU,GAAhB,MAAM,UAAU;IAIrB,YAAmB,YAA0B,EAAE,aAAmC;QAChF,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACpC,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAuD;QACxG,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;QAC3G,OAAO,aAAa,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,GAAW,EAAE,QAAgB;QACtD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;QAC1G,OAAO,aAAa,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,0BAA0B,CAAC,OAA4B;QAClE,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QACpG,OAAO,YAAY,CAAA;IACrB,CAAC;IAEM,KAAK,CAAC,6BAA6B,CAAC,OAAqC;QAC9E,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,6BAA6B,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QACvG,OAAO,YAAY,CAAA;IACrB,CAAC;CACF,CAAA;AA5BY,UAAU;IADtB,IAAA,iBAAU,GAAE;qCAKsB,mBAAY,EAAiB,6BAAoB;GAJvE,UAAU,CA4BtB;AA5BY,gCAAU"}
|
package/build/PolygonModule.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PolygonModuleConfigOptions } from './PolygonModuleConfig';
|
|
2
|
-
import { type DependencyManager, type Module } from '@credo-ts/core';
|
|
3
|
-
import { PolygonApi } from './PolygonApi';
|
|
4
|
-
import { PolygonModuleConfig } from './PolygonModuleConfig';
|
|
5
|
-
export declare class PolygonModule implements Module {
|
|
6
|
-
readonly config: PolygonModuleConfig;
|
|
7
|
-
readonly api: typeof PolygonApi;
|
|
8
|
-
constructor(options: PolygonModuleConfigOptions);
|
|
9
|
-
register(dependencyManager: DependencyManager): void;
|
|
10
|
-
}
|
package/build/PolygonModule.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PolygonModule = void 0;
|
|
4
|
-
const core_1 = require("@credo-ts/core");
|
|
5
|
-
const PolygonApi_1 = require("./PolygonApi");
|
|
6
|
-
const PolygonModuleConfig_1 = require("./PolygonModuleConfig");
|
|
7
|
-
const ledger_1 = require("./ledger");
|
|
8
|
-
const signature_suites_1 = require("./signature-suites");
|
|
9
|
-
class PolygonModule {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this.api = PolygonApi_1.PolygonApi;
|
|
12
|
-
this.config = new PolygonModuleConfig_1.PolygonModuleConfig(options);
|
|
13
|
-
}
|
|
14
|
-
register(dependencyManager) {
|
|
15
|
-
// Warn about experimental module
|
|
16
|
-
dependencyManager.registerInstance(PolygonModuleConfig_1.PolygonModuleConfig, this.config);
|
|
17
|
-
// Services
|
|
18
|
-
dependencyManager.registerSingleton(ledger_1.PolygonLedgerService);
|
|
19
|
-
// Api
|
|
20
|
-
dependencyManager.registerContextScoped(PolygonApi_1.PolygonApi);
|
|
21
|
-
// Signature suites.
|
|
22
|
-
dependencyManager.registerInstance(core_1.SignatureSuiteToken, {
|
|
23
|
-
suiteClass: signature_suites_1.EcdsaSecp256k1Signature2019,
|
|
24
|
-
proofType: 'EcdsaSecp256k1Signature2019',
|
|
25
|
-
verificationMethodTypes: [core_1.VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019],
|
|
26
|
-
keyTypes: [core_1.KeyType.K256],
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.PolygonModule = PolygonModule;
|
|
31
|
-
//# sourceMappingURL=PolygonModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonModule.js","sourceRoot":"","sources":["../src/PolygonModule.ts"],"names":[],"mappings":";;;AAEA,yCAMuB;AAEvB,6CAAyC;AACzC,+DAA2D;AAC3D,qCAA+C;AAC/C,yDAAgE;AAEhE,MAAa,aAAa;IAIxB,YAAmB,OAAmC;QAFtC,QAAG,GAAG,uBAAU,CAAA;QAG9B,IAAI,CAAC,MAAM,GAAG,IAAI,yCAAmB,CAAC,OAAO,CAAC,CAAA;IAChD,CAAC;IAEM,QAAQ,CAAC,iBAAoC;QAClD,iCAAiC;QACjC,iBAAiB,CAAC,gBAAgB,CAAC,yCAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpE,WAAW;QACX,iBAAiB,CAAC,iBAAiB,CAAC,6BAAoB,CAAC,CAAA;QAEzD,MAAM;QACN,iBAAiB,CAAC,qBAAqB,CAAC,uBAAU,CAAC,CAAA;QAEnD,oBAAoB;QACpB,iBAAiB,CAAC,gBAAgB,CAAC,0BAAmB,EAAE;YACtD,UAAU,EAAE,8CAA2B;YACvC,SAAS,EAAE,6BAA6B;YACxC,uBAAuB,EAAE,CAAC,qEAA8D,CAAC;YACzF,QAAQ,EAAE,CAAC,cAAO,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;IACJ,CAAC;CACF;AA1BD,sCA0BC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PolygonModuleConfigOptions defines the interface for the options of the PolygonModuleConfig class.
|
|
3
|
-
*/
|
|
4
|
-
export interface PolygonModuleConfigOptions {
|
|
5
|
-
rpcUrl?: string;
|
|
6
|
-
didContractAddress?: string;
|
|
7
|
-
fileServerToken?: string;
|
|
8
|
-
schemaManagerContractAddress?: string;
|
|
9
|
-
serverUrl?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare class PolygonModuleConfig {
|
|
12
|
-
readonly rpcUrl: string | undefined;
|
|
13
|
-
readonly didContractAddress: string | undefined;
|
|
14
|
-
readonly fileServerToken: string | undefined;
|
|
15
|
-
readonly schemaManagerContractAddress: string | undefined;
|
|
16
|
-
readonly serverUrl: string | undefined;
|
|
17
|
-
constructor({ didContractAddress, fileServerToken, rpcUrl, schemaManagerContractAddress, serverUrl, }: PolygonModuleConfigOptions);
|
|
18
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PolygonModuleConfig = void 0;
|
|
4
|
-
class PolygonModuleConfig {
|
|
5
|
-
constructor({ didContractAddress, fileServerToken, rpcUrl, schemaManagerContractAddress, serverUrl, }) {
|
|
6
|
-
this.rpcUrl = rpcUrl;
|
|
7
|
-
this.didContractAddress = didContractAddress;
|
|
8
|
-
this.fileServerToken = fileServerToken;
|
|
9
|
-
this.schemaManagerContractAddress = schemaManagerContractAddress;
|
|
10
|
-
this.serverUrl = serverUrl;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.PolygonModuleConfig = PolygonModuleConfig;
|
|
14
|
-
//# sourceMappingURL=PolygonModuleConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonModuleConfig.js","sourceRoot":"","sources":["../src/PolygonModuleConfig.ts"],"names":[],"mappings":";;;AAWA,MAAa,mBAAmB;IAO9B,YAAmB,EACjB,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,4BAA4B,EAC5B,SAAS,GACkB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;QAC5C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;QACtC,IAAI,CAAC,4BAA4B,GAAG,4BAA4B,CAAA;QAChE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;CACF;AApBD,kDAoBC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AgentContext, DidCreateOptions, DidCreateResult, DidDeactivateOptions, DidDeactivateResult, DidRegistrar, DidUpdateOptions, DidUpdateResult, Buffer } from '@credo-ts/core';
|
|
2
|
-
import { DidDocument } from '@credo-ts/core';
|
|
3
|
-
export declare class PolygonDidRegistrar implements DidRegistrar {
|
|
4
|
-
readonly supportedMethods: string[];
|
|
5
|
-
private resolver;
|
|
6
|
-
create(agentContext: AgentContext, options: PolygonDidCreateOptions): Promise<DidCreateResult>;
|
|
7
|
-
update(agentContext: AgentContext, options: PolygonDidUpdateOptions): Promise<DidUpdateResult>;
|
|
8
|
-
deactivate(agentContext: AgentContext, options: DidDeactivateOptions): Promise<DidDeactivateResult>;
|
|
9
|
-
private getSigningKey;
|
|
10
|
-
private getPublicKeyFromDid;
|
|
11
|
-
}
|
|
12
|
-
export interface PolygonDidCreateOptions extends DidCreateOptions {
|
|
13
|
-
method: 'polygon';
|
|
14
|
-
did?: never;
|
|
15
|
-
options: {
|
|
16
|
-
network: 'mainnet' | 'testnet';
|
|
17
|
-
endpoint?: string;
|
|
18
|
-
};
|
|
19
|
-
secret: {
|
|
20
|
-
privateKey: Buffer;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface PolygonDidUpdateOptions extends DidUpdateOptions {
|
|
24
|
-
method: 'polygon';
|
|
25
|
-
did: string;
|
|
26
|
-
didDocument: DidDocument;
|
|
27
|
-
secret?: {
|
|
28
|
-
privateKey: Buffer;
|
|
29
|
-
};
|
|
30
|
-
}
|