@trustvc/trustvc 1.4.5 → 1.4.7

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.
@@ -141,7 +141,7 @@ const fetchAllTransfers = /* @__PURE__ */ __name(async (titleEscrowContract, tit
141
141
  remark: event.args?.remark
142
142
  };
143
143
  } else if (event?.name === "Nomination") {
144
- return undefined;
144
+ return void 0;
145
145
  } else if (event?.name === "RejectTransferOwners") {
146
146
  return {
147
147
  type: "REJECT_TRANSFER_OWNERS",
@@ -177,8 +177,8 @@ const fetchAllTransfers = /* @__PURE__ */ __name(async (titleEscrowContract, tit
177
177
  remark: event.args?.remark
178
178
  };
179
179
  }
180
- return undefined;
181
- }).filter((event) => event !== undefined);
180
+ return void 0;
181
+ }).filter((event) => event !== void 0);
182
182
  }, "fetchAllTransfers");
183
183
  function identifyTokenReceivedType(event) {
184
184
  if (event.args.isMinting) {
@@ -55,8 +55,8 @@ const mergeTransfersV5 = /* @__PURE__ */ __name((transferEvents) => {
55
55
  if (groupedEvents.length === 1) return groupedEvents;
56
56
  if (groupedEvents.length > 1) {
57
57
  const { owner, holder } = getHolderOwner(groupedEvents);
58
- const base = groupedEvents[0];
59
58
  const type = identifyEventTypeFromLogs(groupedEvents);
59
+ const base = groupedEvents.find((event) => event.type === type) ?? groupedEvents[0];
60
60
  return [{ ...base, owner, holder, type }];
61
61
  }
62
62
  throw new Error("Invalid hash, update your configuration");
@@ -53,7 +53,7 @@ function processOAChainId(document) {
53
53
  console.warn(
54
54
  "You are using an older version of Open-Attestation Document, to use the auto network feature, please use an updated version. Otherwise, please make sure that you select the correct network."
55
55
  );
56
- return undefined;
56
+ return void 0;
57
57
  }
58
58
  __name(processOAChainId, "processOAChainId");
59
59
  const getChainId = /* @__PURE__ */ __name((document) => {
@@ -63,14 +63,14 @@ const getChainId = /* @__PURE__ */ __name((document) => {
63
63
  } else if (openAttestation.isWrappedV2Document(document)) {
64
64
  const documentData = openAttestation.getDataV2(document);
65
65
  const identityProofType = documentData?.issuers?.[0]?.identityProof?.type;
66
- if (identityProofType === "DNS-DID" || identityProofType === "DID") return undefined;
66
+ if (identityProofType === "DNS-DID" || identityProofType === "DID") return void 0;
67
67
  return processOAChainId(documentData);
68
68
  } else if (openAttestation.isWrappedV3Document(document)) {
69
69
  const identityProofType = document?.openAttestationMetadata?.identityProof?.type;
70
- if (identityProofType === "DNS-DID" || identityProofType === "DID") return undefined;
70
+ if (identityProofType === "DNS-DID" || identityProofType === "DID") return void 0;
71
71
  return processOAChainId(document);
72
72
  } else {
73
- return undefined;
73
+ return void 0;
74
74
  }
75
75
  }, "getChainId");
76
76
 
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var w3cIssuer = require('@trustvc/w3c-issuer');
4
+
3
5
  var __defProp = Object.defineProperty;
4
6
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
7
  const checkDidWebResolve = /* @__PURE__ */ __name(async (did, documentLoader) => {
@@ -7,13 +9,8 @@ const checkDidWebResolve = /* @__PURE__ */ __name(async (did, documentLoader) =>
7
9
  if (documentLoader) {
8
10
  return !!(await documentLoader(did)).document;
9
11
  }
10
- const { Resolver } = await import('did-resolver');
11
- const { getResolver: getWebDidResolver } = await import('web-did-resolver');
12
- const resolver = new Resolver({
13
- ...getWebDidResolver()
14
- });
15
- const didDocument = await resolver.resolve(did);
16
- if (!didDocument || !didDocument.didDocument) {
12
+ const { wellKnownDid } = await w3cIssuer.queryDidDocument({ did });
13
+ if (!wellKnownDid) {
17
14
  throw new Error(`Failed to resolve DID: ${did}`);
18
15
  }
19
16
  return true;
@@ -139,7 +139,7 @@ const fetchAllTransfers = /* @__PURE__ */ __name(async (titleEscrowContract, tit
139
139
  remark: event.args?.remark
140
140
  };
141
141
  } else if (event?.name === "Nomination") {
142
- return undefined;
142
+ return void 0;
143
143
  } else if (event?.name === "RejectTransferOwners") {
144
144
  return {
145
145
  type: "REJECT_TRANSFER_OWNERS",
@@ -175,8 +175,8 @@ const fetchAllTransfers = /* @__PURE__ */ __name(async (titleEscrowContract, tit
175
175
  remark: event.args?.remark
176
176
  };
177
177
  }
178
- return undefined;
179
- }).filter((event) => event !== undefined);
178
+ return void 0;
179
+ }).filter((event) => event !== void 0);
180
180
  }, "fetchAllTransfers");
181
181
  function identifyTokenReceivedType(event) {
182
182
  if (event.args.isMinting) {
@@ -53,8 +53,8 @@ const mergeTransfersV5 = /* @__PURE__ */ __name((transferEvents) => {
53
53
  if (groupedEvents.length === 1) return groupedEvents;
54
54
  if (groupedEvents.length > 1) {
55
55
  const { owner, holder } = getHolderOwner(groupedEvents);
56
- const base = groupedEvents[0];
57
56
  const type = identifyEventTypeFromLogs(groupedEvents);
57
+ const base = groupedEvents.find((event) => event.type === type) ?? groupedEvents[0];
58
58
  return [{ ...base, owner, holder, type }];
59
59
  }
60
60
  throw new Error("Invalid hash, update your configuration");
@@ -51,7 +51,7 @@ function processOAChainId(document) {
51
51
  console.warn(
52
52
  "You are using an older version of Open-Attestation Document, to use the auto network feature, please use an updated version. Otherwise, please make sure that you select the correct network."
53
53
  );
54
- return undefined;
54
+ return void 0;
55
55
  }
56
56
  __name(processOAChainId, "processOAChainId");
57
57
  const getChainId = /* @__PURE__ */ __name((document) => {
@@ -61,14 +61,14 @@ const getChainId = /* @__PURE__ */ __name((document) => {
61
61
  } else if (isWrappedV2Document(document)) {
62
62
  const documentData = getDataV2(document);
63
63
  const identityProofType = documentData?.issuers?.[0]?.identityProof?.type;
64
- if (identityProofType === "DNS-DID" || identityProofType === "DID") return undefined;
64
+ if (identityProofType === "DNS-DID" || identityProofType === "DID") return void 0;
65
65
  return processOAChainId(documentData);
66
66
  } else if (isWrappedV3Document(document)) {
67
67
  const identityProofType = document?.openAttestationMetadata?.identityProof?.type;
68
- if (identityProofType === "DNS-DID" || identityProofType === "DID") return undefined;
68
+ if (identityProofType === "DNS-DID" || identityProofType === "DID") return void 0;
69
69
  return processOAChainId(document);
70
70
  } else {
71
- return undefined;
71
+ return void 0;
72
72
  }
73
73
  }, "getChainId");
74
74
 
@@ -1,3 +1,5 @@
1
+ import { queryDidDocument } from '@trustvc/w3c-issuer';
2
+
1
3
  var __defProp = Object.defineProperty;
2
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
5
  const checkDidWebResolve = /* @__PURE__ */ __name(async (did, documentLoader) => {
@@ -5,13 +7,8 @@ const checkDidWebResolve = /* @__PURE__ */ __name(async (did, documentLoader) =>
5
7
  if (documentLoader) {
6
8
  return !!(await documentLoader(did)).document;
7
9
  }
8
- const { Resolver } = await import('did-resolver');
9
- const { getResolver: getWebDidResolver } = await import('web-did-resolver');
10
- const resolver = new Resolver({
11
- ...getWebDidResolver()
12
- });
13
- const didDocument = await resolver.resolve(did);
14
- if (!didDocument || !didDocument.didDocument) {
10
+ const { wellKnownDid } = await queryDidDocument({ did });
11
+ if (!wellKnownDid) {
15
12
  throw new Error(`Failed to resolve DID: ${did}`);
16
13
  }
17
14
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "TrustVC library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -114,52 +114,50 @@
114
114
  "@tradetrust-tt/token-registry-v4": "npm:@tradetrust-tt/token-registry@^4.15.2",
115
115
  "@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.2.0",
116
116
  "@tradetrust-tt/tradetrust": "^6.10.1",
117
- "@tradetrust-tt/tradetrust-utils": "^2.2.1",
118
- "@tradetrust-tt/tt-verify": "^9.3.3",
119
- "@trustvc/w3c-context": "^1.2.4",
120
- "@trustvc/w3c-credential-status": "^1.2.4",
121
- "@trustvc/w3c-issuer": "^1.2.1",
122
- "@trustvc/w3c-vc": "^1.2.8",
123
- "did-resolver": "^4.1.0",
117
+ "@tradetrust-tt/tradetrust-utils": "^2.3.0",
118
+ "@tradetrust-tt/tt-verify": "^9.4.0",
119
+ "@trustvc/w3c-context": "^1.2.5",
120
+ "@trustvc/w3c-credential-status": "^1.2.5",
121
+ "@trustvc/w3c-issuer": "^1.2.2",
122
+ "@trustvc/w3c-vc": "^1.2.9",
124
123
  "ethers": "^5.8.0",
125
124
  "ethersV6": "npm:ethers@^6.13.6",
126
125
  "js-sha3": "^0.9.3",
127
- "ts-chacha20": "^1.2.0",
128
- "web-did-resolver": "^2.0.27"
126
+ "ts-chacha20": "^1.2.0"
129
127
  },
130
128
  "devDependencies": {
131
- "@commitlint/cli": "^19.6.0",
132
- "@commitlint/config-conventional": "^19.6.0",
133
- "@commitlint/config-nx-scopes": "^19.5.0",
134
- "@commitlint/prompt": "^19.6.0",
129
+ "@commitlint/cli": "^19.8.0",
130
+ "@commitlint/config-conventional": "^19.8.0",
131
+ "@commitlint/config-nx-scopes": "^19.8.0",
132
+ "@commitlint/prompt": "^19.8.0",
135
133
  "@semantic-release/changelog": "^6.0.3",
136
134
  "@semantic-release/git": "^10.0.1",
137
135
  "@semantic-release/npm": "^9.0.2",
138
136
  "@types/conventional-commits-parser": "^5.0.1",
139
- "@types/lodash": "^4.17.13",
140
- "@types/node": "^18.19.67",
141
- "@vitest/coverage-v8": "^1.6.0",
137
+ "@types/lodash": "^4.17.16",
138
+ "@types/node": "^18.19.86",
139
+ "@vitest/coverage-v8": "^1.6.1",
142
140
  "cpy": "^11.1.0",
143
- "dotenv": "^16.4.7",
144
- "eslint": "^9.16.0",
141
+ "dotenv": "^16.5.0",
142
+ "eslint": "^9.25.1",
145
143
  "eslint-config-prettier": "^9.1.0",
146
144
  "eslint-formatter-table": "^7.32.1",
147
- "eslint-plugin-jsdoc": "^50.6.3",
145
+ "eslint-plugin-jsdoc": "^50.6.9",
148
146
  "eslint-plugin-node": "^11.1.0",
149
- "eslint-plugin-prettier": "^5.2.1",
147
+ "eslint-plugin-prettier": "^5.2.6",
150
148
  "eslint-plugin-promise": "^7.2.1",
151
- "execa": "^9.5.1",
149
+ "execa": "^9.5.2",
152
150
  "husky": "^9.1.7",
153
- "lint-staged": "^15.2.10",
154
- "prettier": "^3.4.2",
151
+ "lint-staged": "^15.5.1",
152
+ "prettier": "^3.5.3",
155
153
  "rimraf": "^5.0.10",
156
154
  "semantic-release": "^20.1.3",
157
155
  "ts-node": "^10.9.2",
158
- "tsup": "^8.3.5",
159
- "typescript": "^5.7.2",
160
- "typescript-eslint": "^8.17.0",
156
+ "tsup": "^8.4.0",
157
+ "typescript": "^5.8.3",
158
+ "typescript-eslint": "^8.31.0",
161
159
  "vite-plugin-dts": "^3.9.1",
162
- "vitest": "^1.6.0"
160
+ "vitest": "^1.6.1"
163
161
  },
164
162
  "overrides": {
165
163
  "ethers": "^5.8.0"
@@ -168,7 +166,7 @@
168
166
  "ethers": "^5.8.0"
169
167
  },
170
168
  "optionalDependencies": {
171
- "@rollup/rollup-linux-x64-gnu": "~4.28.0"
169
+ "@rollup/rollup-linux-x64-gnu": "~4.40.0"
172
170
  },
173
171
  "lint-staged": {
174
172
  "*.{js,ts}": [