@trustvc/trustvc 2.7.0 → 2.8.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.
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ var core = require('../core');
4
+ var supportInterfaceIds = require('./supportInterfaceIds');
5
+ var ttDocumentStoreAbi = require('./tt-document-store-abi');
6
+ var ethers = require('../utils/ethers');
7
+ var documentStore = require('@trustvc/document-store');
8
+ var utils = require('../token-registry-functions/utils');
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
+ const documentStoreGrantRole = /* @__PURE__ */ __name(async (documentStoreAddress, role, account, signer, options = {}) => {
13
+ if (!documentStoreAddress) throw new Error("Document store address is required");
14
+ if (!signer.provider) throw new Error("Provider is required");
15
+ if (!role) throw new Error("Role is required");
16
+ if (!account) throw new Error("Account is required");
17
+ const { chainId, maxFeePerGas, maxPriorityFeePerGas, isTransferable } = options;
18
+ let isDocumentStore = !isTransferable;
19
+ let isTransferableDocumentStore = isTransferable;
20
+ let isTTDocumentStore = false;
21
+ if (isTransferable === void 0) {
22
+ [isDocumentStore, isTransferableDocumentStore] = await Promise.all([
23
+ core.checkSupportsInterface(
24
+ documentStoreAddress,
25
+ supportInterfaceIds.supportInterfaceIds.IDocumentStore,
26
+ signer.provider
27
+ ),
28
+ core.checkSupportsInterface(
29
+ documentStoreAddress,
30
+ supportInterfaceIds.supportInterfaceIds.ITransferableDocumentStore,
31
+ signer.provider
32
+ )
33
+ ]);
34
+ if (!isDocumentStore && !isTransferableDocumentStore) {
35
+ isTTDocumentStore = true;
36
+ }
37
+ }
38
+ const Contract = ethers.getEthersContractFromProvider(signer.provider);
39
+ let documentStoreAbi;
40
+ if (isTTDocumentStore) {
41
+ documentStoreAbi = ttDocumentStoreAbi.TT_DOCUMENT_STORE_ABI;
42
+ } else {
43
+ const DocumentStoreFactory = isTransferableDocumentStore ? documentStore.TransferableDocumentStore__factory : documentStore.DocumentStore__factory;
44
+ documentStoreAbi = DocumentStoreFactory.abi;
45
+ }
46
+ const documentStoreContract = new Contract(
47
+ documentStoreAddress,
48
+ documentStoreAbi,
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ signer
51
+ );
52
+ try {
53
+ const isV6 = ethers.isV6EthersProvider(signer.provider);
54
+ if (isV6) {
55
+ await documentStoreContract.grantRole.staticCall(role, account);
56
+ } else {
57
+ await documentStoreContract.callStatic.grantRole(role, account);
58
+ }
59
+ } catch (e) {
60
+ console.error("callStatic failed:", e);
61
+ throw new Error("Pre-check (callStatic) for grant-role failed");
62
+ }
63
+ const txOptions = await utils.getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
64
+ return await documentStoreContract.grantRole(role, account, txOptions);
65
+ }, "documentStoreGrantRole");
66
+
67
+ exports.documentStoreGrantRole = documentStoreGrantRole;
@@ -2,31 +2,34 @@
2
2
 
3
3
  var issue = require('./issue');
4
4
  var revoke = require('./revoke');
5
+ var revokeRole = require('./revoke-role');
6
+ var grantRole = require('./grant-role');
7
+ var transferOwnership = require('./transferOwnership');
5
8
  var deploy = require('./deploy');
6
9
  var supportInterfaceIds = require('./supportInterfaceIds');
7
10
  var documentStore = require('@trustvc/document-store');
8
11
 
9
12
 
10
13
 
11
- Object.defineProperty(exports, "IssueOptions", {
12
- enumerable: true,
13
- get: function () { return issue.IssueOptions; }
14
- });
15
14
  Object.defineProperty(exports, "documentStoreIssue", {
16
15
  enumerable: true,
17
16
  get: function () { return issue.documentStoreIssue; }
18
17
  });
19
- Object.defineProperty(exports, "RevokeOptions", {
20
- enumerable: true,
21
- get: function () { return revoke.RevokeOptions; }
22
- });
23
18
  Object.defineProperty(exports, "documentStoreRevoke", {
24
19
  enumerable: true,
25
20
  get: function () { return revoke.documentStoreRevoke; }
26
21
  });
27
- Object.defineProperty(exports, "DeployOptions", {
22
+ Object.defineProperty(exports, "documentStoreRevokeRole", {
23
+ enumerable: true,
24
+ get: function () { return revokeRole.documentStoreRevokeRole; }
25
+ });
26
+ Object.defineProperty(exports, "documentStoreGrantRole", {
27
+ enumerable: true,
28
+ get: function () { return grantRole.documentStoreGrantRole; }
29
+ });
30
+ Object.defineProperty(exports, "documentStoreTransferOwnership", {
28
31
  enumerable: true,
29
- get: function () { return deploy.DeployOptions; }
32
+ get: function () { return transferOwnership.documentStoreTransferOwnership; }
30
33
  });
31
34
  Object.defineProperty(exports, "deployDocumentStore", {
32
35
  enumerable: true,
@@ -34,11 +34,6 @@ const documentStoreIssue = /* @__PURE__ */ __name(async (documentStoreAddress, d
34
34
  isTTDocumentStore = true;
35
35
  }
36
36
  }
37
- if (!isDocumentStore && !isTransferableDocumentStore && !isTTDocumentStore) {
38
- throw new Error(
39
- "Contract does not support DocumentStore, TransferableDocumentStore, or TT Document Store interface"
40
- );
41
- }
42
37
  const Contract = ethers.getEthersContractFromProvider(signer.provider);
43
38
  let documentStoreAbi;
44
39
  if (isTTDocumentStore) {
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ var core = require('../core');
4
+ var supportInterfaceIds = require('./supportInterfaceIds');
5
+ var ttDocumentStoreAbi = require('./tt-document-store-abi');
6
+ var ethers = require('../utils/ethers');
7
+ var documentStore = require('@trustvc/document-store');
8
+ var utils = require('../token-registry-functions/utils');
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
+ const documentStoreRevokeRole = /* @__PURE__ */ __name(async (documentStoreAddress, role, account, signer, options = {}) => {
13
+ if (!documentStoreAddress) throw new Error("Document store address is required");
14
+ if (!signer.provider) throw new Error("Provider is required");
15
+ if (!role) throw new Error("Role is required");
16
+ if (!account) throw new Error("Account is required");
17
+ const { chainId, maxFeePerGas, maxPriorityFeePerGas, isTransferable } = options;
18
+ let isDocumentStore = !isTransferable;
19
+ let isTransferableDocumentStore = isTransferable;
20
+ let isTTDocumentStore = false;
21
+ if (isTransferable === void 0) {
22
+ [isDocumentStore, isTransferableDocumentStore] = await Promise.all([
23
+ core.checkSupportsInterface(
24
+ documentStoreAddress,
25
+ supportInterfaceIds.supportInterfaceIds.IDocumentStore,
26
+ signer.provider
27
+ ),
28
+ core.checkSupportsInterface(
29
+ documentStoreAddress,
30
+ supportInterfaceIds.supportInterfaceIds.ITransferableDocumentStore,
31
+ signer.provider
32
+ )
33
+ ]);
34
+ if (!isDocumentStore && !isTransferableDocumentStore) {
35
+ isTTDocumentStore = true;
36
+ }
37
+ }
38
+ const Contract = ethers.getEthersContractFromProvider(signer.provider);
39
+ let documentStoreAbi;
40
+ if (isTTDocumentStore) {
41
+ documentStoreAbi = ttDocumentStoreAbi.TT_DOCUMENT_STORE_ABI;
42
+ } else {
43
+ const DocumentStoreFactory = isTransferableDocumentStore ? documentStore.TransferableDocumentStore__factory : documentStore.DocumentStore__factory;
44
+ documentStoreAbi = DocumentStoreFactory.abi;
45
+ }
46
+ const documentStoreContract = new Contract(
47
+ documentStoreAddress,
48
+ documentStoreAbi,
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ signer
51
+ );
52
+ try {
53
+ const isV6 = ethers.isV6EthersProvider(signer.provider);
54
+ if (isV6) {
55
+ await documentStoreContract.revokeRole.staticCall(role, account);
56
+ } else {
57
+ await documentStoreContract.callStatic.revokeRole(role, account);
58
+ }
59
+ } catch (e) {
60
+ console.error("callStatic failed:", e);
61
+ throw new Error("Pre-check (callStatic) for revoke-role failed");
62
+ }
63
+ const txOptions = await utils.getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
64
+ return await documentStoreContract.revokeRole(role, account, txOptions);
65
+ }, "documentStoreRevokeRole");
66
+
67
+ exports.documentStoreRevokeRole = documentStoreRevokeRole;
@@ -34,11 +34,6 @@ const documentStoreRevoke = /* @__PURE__ */ __name(async (documentStoreAddress,
34
34
  isTTDocumentStore = true;
35
35
  }
36
36
  }
37
- if (!isDocumentStore && !isTransferableDocumentStore && !isTTDocumentStore) {
38
- throw new Error(
39
- "Contract does not support DocumentStore, TransferableDocumentStore, or TT Document Store interface"
40
- );
41
- }
42
37
  const Contract = ethers.getEthersContractFromProvider(signer.provider);
43
38
  let documentStoreAbi;
44
39
  if (isTTDocumentStore) {
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var revokeRole = require('./revoke-role');
4
+ var grantRole = require('./grant-role');
5
+ var documentStoreRoles = require('./document-store-roles');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ const documentStoreTransferOwnership = /* @__PURE__ */ __name(async (documentStoreAddress, account, signer, options = {}) => {
10
+ if (!documentStoreAddress) throw new Error("Document store address is required");
11
+ if (!signer.provider) throw new Error("Provider is required");
12
+ if (!account) throw new Error("Account is required");
13
+ const ownerAddress = await signer.getAddress();
14
+ const roleString = await documentStoreRoles.getRoleString(documentStoreAddress, "admin", {
15
+ provider: signer.provider
16
+ });
17
+ const grantTransaction = grantRole.documentStoreGrantRole(
18
+ documentStoreAddress,
19
+ roleString,
20
+ account,
21
+ signer,
22
+ options
23
+ );
24
+ const grantTransactionResult = await grantTransaction;
25
+ if (!grantTransactionResult) {
26
+ throw new Error("Grant transaction failed, not proceeding with revoke transaction");
27
+ }
28
+ const revokeTransaction = revokeRole.documentStoreRevokeRole(
29
+ documentStoreAddress,
30
+ roleString,
31
+ ownerAddress,
32
+ signer,
33
+ options
34
+ );
35
+ const revokeTransactionResult = await revokeTransaction;
36
+ if (!revokeTransactionResult) {
37
+ throw new Error("Revoke transaction failed");
38
+ }
39
+ return { grantTransaction, revokeTransaction };
40
+ }, "documentStoreTransferOwnership");
41
+
42
+ exports.documentStoreTransferOwnership = documentStoreTransferOwnership;
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/dist/cjs/index.js CHANGED
@@ -94,6 +94,10 @@ Object.defineProperty(exports, "deployDocumentStore", {
94
94
  enumerable: true,
95
95
  get: function () { return documentStore.deployDocumentStore; }
96
96
  });
97
+ Object.defineProperty(exports, "documentStoreGrantRole", {
98
+ enumerable: true,
99
+ get: function () { return documentStore.documentStoreGrantRole; }
100
+ });
97
101
  Object.defineProperty(exports, "documentStoreIssue", {
98
102
  enumerable: true,
99
103
  get: function () { return documentStore.documentStoreIssue; }
@@ -102,6 +106,10 @@ Object.defineProperty(exports, "documentStoreRevoke", {
102
106
  enumerable: true,
103
107
  get: function () { return documentStore.documentStoreRevoke; }
104
108
  });
109
+ Object.defineProperty(exports, "documentStoreRevokeRole", {
110
+ enumerable: true,
111
+ get: function () { return documentStore.documentStoreRevokeRole; }
112
+ });
105
113
  Object.keys(tokenRegistryFunctions).forEach(function (k) {
106
114
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
107
115
  enumerable: true,
@@ -0,0 +1,65 @@
1
+ import { checkSupportsInterface } from '../core';
2
+ import { supportInterfaceIds } from './supportInterfaceIds';
3
+ import { TT_DOCUMENT_STORE_ABI } from './tt-document-store-abi';
4
+ import { getEthersContractFromProvider, isV6EthersProvider } from '../utils/ethers';
5
+ import { TransferableDocumentStore__factory, DocumentStore__factory } from '@trustvc/document-store';
6
+ import { getTxOptions } from '../token-registry-functions/utils';
7
+
8
+ var __defProp = Object.defineProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ const documentStoreGrantRole = /* @__PURE__ */ __name(async (documentStoreAddress, role, account, signer, options = {}) => {
11
+ if (!documentStoreAddress) throw new Error("Document store address is required");
12
+ if (!signer.provider) throw new Error("Provider is required");
13
+ if (!role) throw new Error("Role is required");
14
+ if (!account) throw new Error("Account is required");
15
+ const { chainId, maxFeePerGas, maxPriorityFeePerGas, isTransferable } = options;
16
+ let isDocumentStore = !isTransferable;
17
+ let isTransferableDocumentStore = isTransferable;
18
+ let isTTDocumentStore = false;
19
+ if (isTransferable === void 0) {
20
+ [isDocumentStore, isTransferableDocumentStore] = await Promise.all([
21
+ checkSupportsInterface(
22
+ documentStoreAddress,
23
+ supportInterfaceIds.IDocumentStore,
24
+ signer.provider
25
+ ),
26
+ checkSupportsInterface(
27
+ documentStoreAddress,
28
+ supportInterfaceIds.ITransferableDocumentStore,
29
+ signer.provider
30
+ )
31
+ ]);
32
+ if (!isDocumentStore && !isTransferableDocumentStore) {
33
+ isTTDocumentStore = true;
34
+ }
35
+ }
36
+ const Contract = getEthersContractFromProvider(signer.provider);
37
+ let documentStoreAbi;
38
+ if (isTTDocumentStore) {
39
+ documentStoreAbi = TT_DOCUMENT_STORE_ABI;
40
+ } else {
41
+ const DocumentStoreFactory = isTransferableDocumentStore ? TransferableDocumentStore__factory : DocumentStore__factory;
42
+ documentStoreAbi = DocumentStoreFactory.abi;
43
+ }
44
+ const documentStoreContract = new Contract(
45
+ documentStoreAddress,
46
+ documentStoreAbi,
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ signer
49
+ );
50
+ try {
51
+ const isV6 = isV6EthersProvider(signer.provider);
52
+ if (isV6) {
53
+ await documentStoreContract.grantRole.staticCall(role, account);
54
+ } else {
55
+ await documentStoreContract.callStatic.grantRole(role, account);
56
+ }
57
+ } catch (e) {
58
+ console.error("callStatic failed:", e);
59
+ throw new Error("Pre-check (callStatic) for grant-role failed");
60
+ }
61
+ const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
62
+ return await documentStoreContract.grantRole(role, account, txOptions);
63
+ }, "documentStoreGrantRole");
64
+
65
+ export { documentStoreGrantRole };
@@ -1,5 +1,8 @@
1
- export { IssueOptions, documentStoreIssue } from './issue';
2
- export { RevokeOptions, documentStoreRevoke } from './revoke';
3
- export { DeployOptions, deployDocumentStore } from './deploy';
1
+ export { documentStoreIssue } from './issue';
2
+ export { documentStoreRevoke } from './revoke';
3
+ export { documentStoreRevokeRole } from './revoke-role';
4
+ export { documentStoreGrantRole } from './grant-role';
5
+ export { documentStoreTransferOwnership } from './transferOwnership';
6
+ export { deployDocumentStore } from './deploy';
4
7
  export { supportInterfaceIds } from './supportInterfaceIds';
5
8
  export { DocumentStore__factory, TransferableDocumentStore__factory } from '@trustvc/document-store';
@@ -32,11 +32,6 @@ const documentStoreIssue = /* @__PURE__ */ __name(async (documentStoreAddress, d
32
32
  isTTDocumentStore = true;
33
33
  }
34
34
  }
35
- if (!isDocumentStore && !isTransferableDocumentStore && !isTTDocumentStore) {
36
- throw new Error(
37
- "Contract does not support DocumentStore, TransferableDocumentStore, or TT Document Store interface"
38
- );
39
- }
40
35
  const Contract = getEthersContractFromProvider(signer.provider);
41
36
  let documentStoreAbi;
42
37
  if (isTTDocumentStore) {
@@ -0,0 +1,65 @@
1
+ import { checkSupportsInterface } from '../core';
2
+ import { supportInterfaceIds } from './supportInterfaceIds';
3
+ import { TT_DOCUMENT_STORE_ABI } from './tt-document-store-abi';
4
+ import { getEthersContractFromProvider, isV6EthersProvider } from '../utils/ethers';
5
+ import { TransferableDocumentStore__factory, DocumentStore__factory } from '@trustvc/document-store';
6
+ import { getTxOptions } from '../token-registry-functions/utils';
7
+
8
+ var __defProp = Object.defineProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ const documentStoreRevokeRole = /* @__PURE__ */ __name(async (documentStoreAddress, role, account, signer, options = {}) => {
11
+ if (!documentStoreAddress) throw new Error("Document store address is required");
12
+ if (!signer.provider) throw new Error("Provider is required");
13
+ if (!role) throw new Error("Role is required");
14
+ if (!account) throw new Error("Account is required");
15
+ const { chainId, maxFeePerGas, maxPriorityFeePerGas, isTransferable } = options;
16
+ let isDocumentStore = !isTransferable;
17
+ let isTransferableDocumentStore = isTransferable;
18
+ let isTTDocumentStore = false;
19
+ if (isTransferable === void 0) {
20
+ [isDocumentStore, isTransferableDocumentStore] = await Promise.all([
21
+ checkSupportsInterface(
22
+ documentStoreAddress,
23
+ supportInterfaceIds.IDocumentStore,
24
+ signer.provider
25
+ ),
26
+ checkSupportsInterface(
27
+ documentStoreAddress,
28
+ supportInterfaceIds.ITransferableDocumentStore,
29
+ signer.provider
30
+ )
31
+ ]);
32
+ if (!isDocumentStore && !isTransferableDocumentStore) {
33
+ isTTDocumentStore = true;
34
+ }
35
+ }
36
+ const Contract = getEthersContractFromProvider(signer.provider);
37
+ let documentStoreAbi;
38
+ if (isTTDocumentStore) {
39
+ documentStoreAbi = TT_DOCUMENT_STORE_ABI;
40
+ } else {
41
+ const DocumentStoreFactory = isTransferableDocumentStore ? TransferableDocumentStore__factory : DocumentStore__factory;
42
+ documentStoreAbi = DocumentStoreFactory.abi;
43
+ }
44
+ const documentStoreContract = new Contract(
45
+ documentStoreAddress,
46
+ documentStoreAbi,
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ signer
49
+ );
50
+ try {
51
+ const isV6 = isV6EthersProvider(signer.provider);
52
+ if (isV6) {
53
+ await documentStoreContract.revokeRole.staticCall(role, account);
54
+ } else {
55
+ await documentStoreContract.callStatic.revokeRole(role, account);
56
+ }
57
+ } catch (e) {
58
+ console.error("callStatic failed:", e);
59
+ throw new Error("Pre-check (callStatic) for revoke-role failed");
60
+ }
61
+ const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
62
+ return await documentStoreContract.revokeRole(role, account, txOptions);
63
+ }, "documentStoreRevokeRole");
64
+
65
+ export { documentStoreRevokeRole };
@@ -32,11 +32,6 @@ const documentStoreRevoke = /* @__PURE__ */ __name(async (documentStoreAddress,
32
32
  isTTDocumentStore = true;
33
33
  }
34
34
  }
35
- if (!isDocumentStore && !isTransferableDocumentStore && !isTTDocumentStore) {
36
- throw new Error(
37
- "Contract does not support DocumentStore, TransferableDocumentStore, or TT Document Store interface"
38
- );
39
- }
40
35
  const Contract = getEthersContractFromProvider(signer.provider);
41
36
  let documentStoreAbi;
42
37
  if (isTTDocumentStore) {
@@ -0,0 +1,40 @@
1
+ import { documentStoreRevokeRole } from './revoke-role';
2
+ import { documentStoreGrantRole } from './grant-role';
3
+ import { getRoleString } from './document-store-roles';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ const documentStoreTransferOwnership = /* @__PURE__ */ __name(async (documentStoreAddress, account, signer, options = {}) => {
8
+ if (!documentStoreAddress) throw new Error("Document store address is required");
9
+ if (!signer.provider) throw new Error("Provider is required");
10
+ if (!account) throw new Error("Account is required");
11
+ const ownerAddress = await signer.getAddress();
12
+ const roleString = await getRoleString(documentStoreAddress, "admin", {
13
+ provider: signer.provider
14
+ });
15
+ const grantTransaction = documentStoreGrantRole(
16
+ documentStoreAddress,
17
+ roleString,
18
+ account,
19
+ signer,
20
+ options
21
+ );
22
+ const grantTransactionResult = await grantTransaction;
23
+ if (!grantTransactionResult) {
24
+ throw new Error("Grant transaction failed, not proceeding with revoke transaction");
25
+ }
26
+ const revokeTransaction = documentStoreRevokeRole(
27
+ documentStoreAddress,
28
+ roleString,
29
+ ownerAddress,
30
+ signer,
31
+ options
32
+ );
33
+ const revokeTransactionResult = await revokeTransaction;
34
+ if (!revokeTransactionResult) {
35
+ throw new Error("Revoke transaction failed");
36
+ }
37
+ return { grantTransaction, revokeTransaction };
38
+ }, "documentStoreTransferOwnership");
39
+
40
+ export { documentStoreTransferOwnership };
@@ -0,0 +1 @@
1
+
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { v4ComputeInterfaceId, v4ComputeTitleEscrowAddress, v4ContractAddress, v4Contracts, v4EncodeInitParams, v4GetEventFromReceipt, v4RoleHash, v4SupportInterfaceIds, v4Utils } from './token-registry-v4';
2
2
  export { v5ComputeInterfaceId, v5ContractAddress, v5Contracts, v5EncodeInitParams, v5GetEventFromReceipt, v5RoleHash, v5SupportInterfaceIds, v5Utils } from './token-registry-v5';
3
- export { DocumentStore__factory, TransferableDocumentStore__factory, deployDocumentStore, documentStoreIssue, documentStoreRevoke } from './document-store';
3
+ export { DocumentStore__factory, TransferableDocumentStore__factory, deployDocumentStore, documentStoreGrantRole, documentStoreIssue, documentStoreRevoke, documentStoreRevokeRole } from './document-store';
4
4
  export * from './token-registry-functions';
5
5
  export * from './core';
6
6
  export * from './open-attestation';
@@ -0,0 +1,28 @@
1
+ import { Signer as Signer$1, ContractTransaction as ContractTransaction$1 } from 'ethersV6';
2
+ import { Signer, ContractTransaction } from 'ethers';
3
+ import { CommandOptions } from './types.js';
4
+ import '../utils/supportedChains/index.js';
5
+ import '../utils/gasStation/index.js';
6
+ import '../utils/network/index.js';
7
+ import '../token-registry-functions/types.js';
8
+
9
+ /**
10
+ * Grants a role to an account on the DocumentStore contract.
11
+ * Supports both Ethers v5 and v6 signers.
12
+ * Supports three types of document stores:
13
+ * 1. DocumentStore (ERC-165 compliant)
14
+ * 2. TransferableDocumentStore (ERC-165 compliant)
15
+ * 3. TT Document Store (legacy, no ERC-165 support - used as fallback)
16
+ * @param {string} documentStoreAddress - The address of the DocumentStore contract.
17
+ * @param {string} role - The role to grant (e.g., 'ISSUER', 'REVOKER', 'ADMIN').
18
+ * @param {string} account - The account to grant the role to.
19
+ * @param {SignerV5 | SignerV6} signer - Signer instance (Ethers v5 or v6) that authorizes the grant role transaction.
20
+ * @param {CommandOptions} options - Optional transaction metadata including gas values and chain ID.
21
+ * @returns {Promise<ContractTransactionV5 | ContractTransactionV6>} A promise resolving to the transaction result from the grant role call.
22
+ * @throws {Error} If the document store address or signer provider is not provided.
23
+ * @throws {Error} If the role is invalid.
24
+ * @throws {Error} If the `callStatic.grantRole` fails as a pre-check.
25
+ */
26
+ declare const documentStoreGrantRole: (documentStoreAddress: string, role: string, account: string, signer: Signer | Signer$1, options?: CommandOptions) => Promise<ContractTransaction | ContractTransaction$1>;
27
+
28
+ export { documentStoreGrantRole };
@@ -1,10 +1,14 @@
1
- export { IssueOptions, documentStoreIssue } from './issue.js';
2
- export { RevokeOptions, documentStoreRevoke } from './revoke.js';
3
- export { DeployOptions, deployDocumentStore } from './deploy.js';
1
+ export { documentStoreIssue } from './issue.js';
2
+ export { documentStoreRevoke } from './revoke.js';
3
+ export { documentStoreRevokeRole } from './revoke-role.js';
4
+ export { documentStoreGrantRole } from './grant-role.js';
5
+ export { documentStoreTransferOwnership } from './transferOwnership.js';
6
+ export { deployDocumentStore } from './deploy.js';
4
7
  export { supportInterfaceIds } from './supportInterfaceIds.js';
5
8
  export { DocumentStore__factory, TransferableDocumentStore__factory } from '@trustvc/document-store';
6
9
  import 'ethersV6';
7
10
  import 'ethers';
11
+ import './types.js';
8
12
  import '../utils/supportedChains/index.js';
9
13
  import '../utils/gasStation/index.js';
10
14
  import '../utils/network/index.js';
@@ -1,9 +1,10 @@
1
1
  import { Signer as Signer$1, ContractTransactionResponse } from 'ethersV6';
2
2
  import { Signer, ContractTransaction } from 'ethers';
3
- import { CHAIN_ID } from '../utils/supportedChains/index.js';
4
- import { GasValue } from '../token-registry-functions/types.js';
3
+ import { CommandOptions } from './types.js';
4
+ import '../utils/supportedChains/index.js';
5
5
  import '../utils/gasStation/index.js';
6
6
  import '../utils/network/index.js';
7
+ import '../token-registry-functions/types.js';
7
8
 
8
9
  /**
9
10
  * Issues a document hash to the DocumentStore contract.
@@ -15,18 +16,12 @@ import '../utils/network/index.js';
15
16
  * @param {string} documentStoreAddress - The address of the DocumentStore contract.
16
17
  * @param {string} documentHash - The hash of the document to issue (must be a valid hex string).
17
18
  * @param {SignerV5 | SignerV6} signer - Signer instance (Ethers v5 or v6) that authorizes the issue transaction.
18
- * @param {IssueOptions} options - Optional transaction metadata including gas values and chain ID.
19
+ * @param {CommandOptions} options - Optional transaction metadata including gas values and chain ID.
19
20
  * @returns {Promise<ContractTransactionV5 | ContractTransactionV6>} A promise resolving to the transaction result from the issue call.
20
21
  * @throws {Error} If the document store address or signer provider is not provided.
21
22
  * @throws {Error} If the document hash is invalid.
22
23
  * @throws {Error} If the `callStatic.issue` fails as a pre-check.
23
24
  */
24
- interface IssueOptions {
25
- chainId?: CHAIN_ID;
26
- maxFeePerGas?: GasValue;
27
- maxPriorityFeePerGas?: GasValue;
28
- isTransferable?: boolean;
29
- }
30
- declare const documentStoreIssue: (documentStoreAddress: string, documentHash: string, signer: Signer | Signer$1, options?: IssueOptions) => Promise<ContractTransaction | ContractTransactionResponse>;
25
+ declare const documentStoreIssue: (documentStoreAddress: string, documentHash: string, signer: Signer | Signer$1, options?: CommandOptions) => Promise<ContractTransaction | ContractTransactionResponse>;
31
26
 
32
- export { type IssueOptions, documentStoreIssue };
27
+ export { documentStoreIssue };
@@ -0,0 +1,28 @@
1
+ import { Signer as Signer$1, ContractTransactionResponse } from 'ethersV6';
2
+ import { Signer, ContractTransaction } from 'ethers';
3
+ import { CommandOptions } from './types.js';
4
+ import '../utils/supportedChains/index.js';
5
+ import '../utils/gasStation/index.js';
6
+ import '../utils/network/index.js';
7
+ import '../token-registry-functions/types.js';
8
+
9
+ /**
10
+ * Revokes a role from an account on the DocumentStore contract.
11
+ * Supports both Ethers v5 and v6 signers.
12
+ * Supports three types of document stores:
13
+ * 1. DocumentStore (ERC-165 compliant)
14
+ * 2. TransferableDocumentStore (ERC-165 compliant)
15
+ * 3. TT Document Store (legacy, no ERC-165 support - used as fallback)
16
+ * @param {string} documentStoreAddress - The address of the DocumentStore contract.
17
+ * @param {string} role - The role to revoke (e.g., 'ISSUER', 'REVOKER', 'ADMIN').
18
+ * @param {string} account - The account to revoke the role from.
19
+ * @param {SignerV5 | SignerV6} signer - Signer instance (Ethers v5 or v6) that authorizes the revoke role transaction.
20
+ * @param {CommandOptions} options - Optional transaction metadata including gas values and chain ID.
21
+ * @returns {Promise<ContractTransactionV5 | ContractTransactionV6>} A promise resolving to the transaction result from the revoke role call.
22
+ * @throws {Error} If the document store address or signer provider is not provided.
23
+ * @throws {Error} If the role is invalid.
24
+ * @throws {Error} If the `callStatic.revokeRole` fails as a pre-check.
25
+ */
26
+ declare const documentStoreRevokeRole: (documentStoreAddress: string, role: string, account: string, signer: Signer | Signer$1, options?: CommandOptions) => Promise<ContractTransaction | ContractTransactionResponse>;
27
+
28
+ export { documentStoreRevokeRole };
@@ -0,0 +1,30 @@
1
+ import { Signer as Signer$1, ContractTransaction as ContractTransaction$1 } from 'ethersV6';
2
+ import { Signer, ContractTransaction } from 'ethers';
3
+ import { CommandOptions } from './types.js';
4
+ import '../utils/supportedChains/index.js';
5
+ import '../utils/gasStation/index.js';
6
+ import '../utils/network/index.js';
7
+ import '../token-registry-functions/types.js';
8
+
9
+ /**
10
+ * Transfers ownership of a DocumentStore contract to a new owner.
11
+ * Supports both Ethers v5 and v6 signers.
12
+ * Supports three types of document stores:
13
+ * 1. DocumentStore (ERC-165 compliant)
14
+ * 2. TransferableDocumentStore (ERC-165 compliant)
15
+ * 3. TT Document Store (legacy, no ERC-165 support - used as fallback)
16
+ * @param {string} documentStoreAddress - The address of the DocumentStore contract.
17
+ * @param {string} account - The account to transfer ownership to.
18
+ * @param {SignerV5 | SignerV6} signer - Signer instance (Ethers v5 or v6) that authorizes the transfer ownership transaction.
19
+ * @param {CommandOptions} options - Optional transaction metadata including gas values and chain ID.
20
+ * @returns {Promise<{grantTransaction: Promise<ContractTransactionV5 | ContractTransactionV6>; revokeTransaction: Promise<ContractTransactionV5 | ContractTransactionV6>}>} A promise resolving to the transaction result from the grant and revoke role calls.
21
+ * @throws {Error} If the document store address or signer provider is not provided.
22
+ * @throws {Error} If the role is invalid.
23
+ * @throws {Error} If the `callStatic.revokeRole` fails as a pre-check.
24
+ */
25
+ declare const documentStoreTransferOwnership: (documentStoreAddress: string, account: string, signer: Signer | Signer$1, options?: CommandOptions) => Promise<{
26
+ grantTransaction: Promise<ContractTransaction | ContractTransaction$1>;
27
+ revokeTransaction: Promise<ContractTransaction | ContractTransaction$1>;
28
+ }>;
29
+
30
+ export { documentStoreTransferOwnership };
@@ -0,0 +1,15 @@
1
+ import { CHAIN_ID } from '../utils/supportedChains/index.js';
2
+ import { GasValue } from '../token-registry-functions/types.js';
3
+ import '../utils/gasStation/index.js';
4
+ import 'ethers';
5
+ import '../utils/network/index.js';
6
+ import 'ethersV6';
7
+
8
+ interface CommandOptions {
9
+ chainId?: CHAIN_ID;
10
+ maxFeePerGas?: GasValue;
11
+ maxPriorityFeePerGas?: GasValue;
12
+ isTransferable?: boolean;
13
+ }
14
+
15
+ export type { CommandOptions };
@@ -12,6 +12,17 @@ export { computeInterfaceId as v5ComputeInterfaceId, encodeInitParams as v5Encod
12
12
  export { TypedContractMethod } from '@tradetrust-tt/token-registry-v5/contracts/common';
13
13
  export { documentStoreIssue } from './document-store/issue.js';
14
14
  export { documentStoreRevoke } from './document-store/revoke.js';
15
+ export { documentStoreRevokeRole } from './document-store/revoke-role.js';
16
+ export { documentStoreGrantRole } from './document-store/grant-role.js';
17
+ export { OAErrorMessageHandling, errorMessageHandling, interpretFragments, w3cCredentialStatusRevoked, w3cCredentialStatusSuspended } from './utils/fragment/index.js';
18
+ export { networkCurrency, networkName, networkType, networks } from './utils/network/index.js';
19
+ export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './utils/stringUtils/index.js';
20
+ export { CHAIN_ID, SUPPORTED_CHAINS, chainInfo } from './utils/supportedChains/index.js';
21
+ export { errorMessages } from './utils/errorMessages/index.js';
22
+ export { WrappedOrSignedOpenAttestationDocument, getChainId, getObfuscatedData, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isObfuscated, isTransferableRecord } from './utils/documents/index.js';
23
+ export { GasStationFeeData, GasStationFunction, calculateMaxFee, gasStation, scaleBigNumber } from './utils/gasStation/index.js';
24
+ export { AwsKmsSigner, AwsKmsSignerCredentials } from '@tradetrust-tt/ethers-aws-kms-signer';
25
+ export { gaEvent, gaPageView, validateGaEvent, validateGtag, validatePageViewEvent } from './utils/analytics/analytics.js';
15
26
  export { deployDocumentStore } from './document-store/deploy.js';
16
27
  export { DocumentStore__factory, TransferableDocumentStore__factory } from '@trustvc/document-store';
17
28
  export { nominate, transferBeneficiary, transferHolder, transferOwners } from './token-registry-functions/transfer.js';
@@ -46,15 +57,6 @@ export { PrivateKeyPair } from '@trustvc/w3c-issuer';
46
57
  export { i as vc } from './index-1ws_BWZW.js';
47
58
  export { verifyW3CSignature } from './w3c/verify.js';
48
59
  export { deriveW3C } from './w3c/derive.js';
49
- export { OAErrorMessageHandling, errorMessageHandling, interpretFragments, w3cCredentialStatusRevoked, w3cCredentialStatusSuspended } from './utils/fragment/index.js';
50
- export { networkCurrency, networkName, networkType, networks } from './utils/network/index.js';
51
- export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './utils/stringUtils/index.js';
52
- export { CHAIN_ID, SUPPORTED_CHAINS, chainInfo } from './utils/supportedChains/index.js';
53
- export { errorMessages } from './utils/errorMessages/index.js';
54
- export { WrappedOrSignedOpenAttestationDocument, getChainId, getObfuscatedData, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isObfuscated, isTransferableRecord } from './utils/documents/index.js';
55
- export { GasStationFeeData, GasStationFunction, calculateMaxFee, gasStation, scaleBigNumber } from './utils/gasStation/index.js';
56
- export { AwsKmsSigner, AwsKmsSignerCredentials } from '@tradetrust-tt/ethers-aws-kms-signer';
57
- export { gaEvent, gaPageView, validateGaEvent, validateGtag, validatePageViewEvent } from './utils/analytics/analytics.js';
58
60
  export { CustomDnsResolver, IDNSQueryResponse, IDNSRecord, OpenAttestationDNSTextRecord, OpenAttestationDnsDidRecord, defaultDnsResolvers, getDnsDidRecords, getDocumentStoreRecords, parseDnsDidResults, parseDocumentStoreResults, parseOpenAttestationRecord, queryDns } from '@tradetrust-tt/dnsprove';
59
61
  export { OpenAttestationDocument, SUPPORTED_SIGNING_ALGORITHM, SchemaId, SignedWrappedDocument, WrappedDocument, getData as getDataV2, isSchemaValidationError, obfuscateDocument, v2, v3, validateSchema, __unsafe__use__it__at__your__own__risks__wrapDocument as wrapOADocumentV3, __unsafe__use__it__at__your__own__risks__wrapDocuments as wrapOADocumentsV3 } from '@tradetrust-tt/tradetrust';
60
62
  export { DiagnoseError } from '@tradetrust-tt/tradetrust/dist/types/shared/utils';
@@ -67,7 +69,9 @@ import '@typechain/ethers-v5/static/common';
67
69
  import '@tradetrust-tt/token-registry-v5/contracts';
68
70
  import '@tradetrust-tt/token-registry-v5';
69
71
  import 'ethersV6';
72
+ import './document-store/types.js';
70
73
  import './token-registry-functions/types.js';
74
+ import '@trustvc/w3c-credential-status';
71
75
  import '@ethersproject/abstract-provider';
72
76
  import 'ethers/lib/utils';
73
77
  import '@ethersproject/abstract-signer';
@@ -85,4 +89,3 @@ import './verify/fragments/issuer-identity/w3cIssuerIdentity.js';
85
89
  import './verify/fragments/document-status/w3cEmptyCredentialStatus/index.js';
86
90
  import 'runtypes';
87
91
  import '@trustvc/w3c-context';
88
- import '@trustvc/w3c-credential-status';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "TrustVC library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",