@trustvc/trustvc 1.6.0-alpha.2 → 1.6.0-alpha.4

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.
@@ -2,6 +2,7 @@ import { getTitleEscrowAddress, encrypt, isTitleEscrowVersion, TitleEscrowInterf
2
2
  import { v5Contracts, v5SupportInterfaceIds } from '../token-registry-v5';
3
3
  import { v4Contracts, v4SupportInterfaceIds } from '../token-registry-v4';
4
4
  import { getTxOptions } from './utils';
5
+ import { getEthersContractFromProvider, isV6EthersProvider } from '../utils/ethers';
5
6
 
6
7
  var __defProp = Object.defineProperty;
7
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
@@ -20,7 +21,6 @@ const returnToIssuer = /* @__PURE__ */ __name(async (contractOptions, signer, pa
20
21
  if (!titleEscrowAddress) throw new Error("Title Escrow address is required");
21
22
  if (!signer.provider) throw new Error("Provider is required");
22
23
  const { remarks } = params;
23
- let titleEscrowContract = v5Contracts.TitleEscrow__factory.connect(titleEscrowAddress, signer);
24
24
  const encryptedRemarks = remarks && options.id ? `0x${encrypt(remarks, options.id)}` : "0x";
25
25
  let isV5TT = titleEscrowVersion === "v5";
26
26
  let isV4TT = titleEscrowVersion === "v4";
@@ -41,19 +41,31 @@ const returnToIssuer = /* @__PURE__ */ __name(async (contractOptions, signer, pa
41
41
  if (!isV5TT && !isV4TT) {
42
42
  throw new Error("Only Token Registry V4/V5 is supported");
43
43
  }
44
- if (isV4TT) {
45
- titleEscrowContract = v4Contracts.TitleEscrow__factory.connect(
44
+ const Contract = getEthersContractFromProvider(signer.provider);
45
+ let titleEscrowContract;
46
+ if (isV5TT) {
47
+ titleEscrowContract = new Contract(
48
+ titleEscrowAddress,
49
+ v5Contracts.TitleEscrow__factory.abi,
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ signer
52
+ );
53
+ } else if (isV4TT) {
54
+ titleEscrowContract = new Contract(
46
55
  titleEscrowAddress,
56
+ v4Contracts.TitleEscrow__factory.abi,
57
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
58
  signer
48
59
  );
49
60
  }
50
61
  try {
51
- if (isV5TT) {
52
- await titleEscrowContract.callStatic.returnToIssuer(
53
- encryptedRemarks
54
- );
55
- } else if (isV4TT) {
56
- await titleEscrowContract.callStatic.surrender();
62
+ const isV6 = isV6EthersProvider(signer.provider);
63
+ const args = isV5TT ? [encryptedRemarks] : [];
64
+ const staticCallFxn = isV5TT ? "returnToIssuer" : "surrender";
65
+ if (isV6) {
66
+ await titleEscrowContract[staticCallFxn].staticCall(...args);
67
+ } else {
68
+ await titleEscrowContract.callStatic[staticCallFxn](...args);
57
69
  }
58
70
  } catch (e) {
59
71
  console.error("callStatic failed:", e);
@@ -61,10 +73,7 @@ const returnToIssuer = /* @__PURE__ */ __name(async (contractOptions, signer, pa
61
73
  }
62
74
  const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
63
75
  if (isV5TT) {
64
- return await titleEscrowContract.returnToIssuer(
65
- encryptedRemarks,
66
- txOptions
67
- );
76
+ return await titleEscrowContract.returnToIssuer(encryptedRemarks, txOptions);
68
77
  } else if (isV4TT) {
69
78
  return await titleEscrowContract.surrender(txOptions);
70
79
  }
@@ -94,27 +103,31 @@ const rejectReturned = /* @__PURE__ */ __name(async (contractOptions, signer, pa
94
103
  if (!isV4TT && !isV5TT) {
95
104
  throw new Error("Only Token Registry V4/V5 is supported");
96
105
  }
106
+ const Contract = getEthersContractFromProvider(signer.provider);
97
107
  let tradeTrustTokenContract;
98
108
  if (isV5TT) {
99
- tradeTrustTokenContract = v5Contracts.TradeTrustToken__factory.connect(
109
+ tradeTrustTokenContract = new Contract(
100
110
  tokenRegistryAddress,
111
+ v5Contracts.TradeTrustToken__factory.abi,
112
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
113
  signer
102
114
  );
103
115
  } else if (isV4TT) {
104
- tradeTrustTokenContract = v4Contracts.TradeTrustToken__factory.connect(
116
+ tradeTrustTokenContract = new Contract(
105
117
  tokenRegistryAddress,
118
+ v4Contracts.TradeTrustToken__factory.abi,
119
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
120
  signer
107
121
  );
108
122
  }
109
123
  const encryptedRemarks = remarks && isV5TT ? `0x${encrypt(remarks, options.id)}` : "0x";
110
124
  try {
111
- if (isV5TT) {
112
- await tradeTrustTokenContract.callStatic.restore(
113
- tokenId,
114
- encryptedRemarks
115
- );
116
- } else if (isV4TT) {
117
- await tradeTrustTokenContract.callStatic.restore(tokenId);
125
+ const isV6 = isV6EthersProvider(signer.provider);
126
+ const args = isV5TT ? [tokenId, encryptedRemarks] : [tokenId];
127
+ if (isV6) {
128
+ await tradeTrustTokenContract.restore.staticCall(...args);
129
+ } else {
130
+ await tradeTrustTokenContract.callStatic.restore(...args);
118
131
  }
119
132
  } catch (e) {
120
133
  console.error("callStatic failed:", e);
@@ -122,16 +135,9 @@ const rejectReturned = /* @__PURE__ */ __name(async (contractOptions, signer, pa
122
135
  }
123
136
  const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
124
137
  if (isV5TT) {
125
- return await tradeTrustTokenContract.restore(
126
- tokenId,
127
- encryptedRemarks,
128
- txOptions
129
- );
138
+ return await tradeTrustTokenContract.restore(tokenId, encryptedRemarks, txOptions);
130
139
  } else if (isV4TT) {
131
- return await tradeTrustTokenContract.restore(
132
- tokenId,
133
- txOptions
134
- );
140
+ return await tradeTrustTokenContract.restore(tokenId, txOptions);
135
141
  }
136
142
  }, "rejectReturned");
137
143
  const acceptReturned = /* @__PURE__ */ __name(async (contractOptions, signer, params, options) => {
@@ -159,27 +165,31 @@ const acceptReturned = /* @__PURE__ */ __name(async (contractOptions, signer, pa
159
165
  if (!isV4TT && !isV5TT) {
160
166
  throw new Error("Only Token Registry V4/V5 is supported");
161
167
  }
168
+ const Contract = getEthersContractFromProvider(signer.provider);
162
169
  let tradeTrustTokenContract;
163
170
  if (isV5TT) {
164
- tradeTrustTokenContract = v5Contracts.TradeTrustToken__factory.connect(
171
+ tradeTrustTokenContract = new Contract(
165
172
  tokenRegistryAddress,
173
+ v5Contracts.TradeTrustToken__factory.abi,
174
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
175
  signer
167
176
  );
168
177
  } else if (isV4TT) {
169
- tradeTrustTokenContract = v4Contracts.TradeTrustToken__factory.connect(
178
+ tradeTrustTokenContract = new Contract(
170
179
  tokenRegistryAddress,
180
+ v4Contracts.TradeTrustToken__factory.abi,
181
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
171
182
  signer
172
183
  );
173
184
  }
174
185
  const encryptedRemarks = remarks && isV5TT ? `0x${encrypt(remarks, options.id)}` : "0x";
175
186
  try {
176
- if (isV5TT) {
177
- await tradeTrustTokenContract.callStatic.burn(
178
- tokenId,
179
- encryptedRemarks
180
- );
181
- } else if (isV4TT) {
182
- await tradeTrustTokenContract.callStatic.burn(tokenId);
187
+ const isV6 = isV6EthersProvider(signer.provider);
188
+ const args = isV5TT ? [encryptedRemarks] : [];
189
+ if (isV6) {
190
+ await tradeTrustTokenContract.burn.staticCall(...args);
191
+ } else {
192
+ await tradeTrustTokenContract.callStatic.burn(...args);
183
193
  }
184
194
  } catch (e) {
185
195
  console.error("callStatic failed:", e);
@@ -187,11 +197,7 @@ const acceptReturned = /* @__PURE__ */ __name(async (contractOptions, signer, pa
187
197
  }
188
198
  const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
189
199
  if (isV5TT) {
190
- return await tradeTrustTokenContract.burn(
191
- tokenId,
192
- encryptedRemarks,
193
- txOptions
194
- );
200
+ return await tradeTrustTokenContract.burn(tokenId, encryptedRemarks, txOptions);
195
201
  } else if (isV4TT) {
196
202
  return await tradeTrustTokenContract.burn(tokenId, txOptions);
197
203
  }
@@ -2,6 +2,7 @@ import { getTitleEscrowAddress, encrypt, isTitleEscrowVersion, TitleEscrowInterf
2
2
  import { v4Contracts } from '../token-registry-v4';
3
3
  import { v5Contracts } from '../token-registry-v5';
4
4
  import { getTxOptions } from './utils';
5
+ import { getEthersContractFromProvider, isV6EthersProvider } from '../utils/ethers';
5
6
 
6
7
  var __defProp = Object.defineProperty;
7
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
@@ -13,6 +14,8 @@ const transferHolder = /* @__PURE__ */ __name(async (contractOptions, signer, pa
13
14
  let isV5TT = titleEscrowVersion === "v5";
14
15
  let isV4TT = titleEscrowVersion === "v4";
15
16
  if (!titleEscrowAddress) {
17
+ if (!tokenRegistryAddress) throw new Error("Token registry address is required");
18
+ if (!tokenId) throw new Error("Token ID is required");
16
19
  titleEscrowAddress = await getTitleEscrowAddress(
17
20
  tokenRegistryAddress,
18
21
  tokenId,
@@ -23,7 +26,6 @@ const transferHolder = /* @__PURE__ */ __name(async (contractOptions, signer, pa
23
26
  if (!titleEscrowAddress) throw new Error("Token registry address is required");
24
27
  if (!signer.provider) throw new Error("Provider is required");
25
28
  const { holderAddress, remarks } = params;
26
- let titleEscrowContract = v5Contracts.TitleEscrow__factory.connect(titleEscrowAddress, signer);
27
29
  const encryptedRemarks = remarks ? `0x${encrypt(remarks, options.id)}` : "0x";
28
30
  if (titleEscrowVersion === void 0) {
29
31
  [isV4TT, isV5TT] = await Promise.all([
@@ -42,22 +44,30 @@ const transferHolder = /* @__PURE__ */ __name(async (contractOptions, signer, pa
42
44
  if (!isV4TT && !isV5TT) {
43
45
  throw new Error("Only Token Registry V4/V5 is supported");
44
46
  }
45
- if (isV4TT) {
46
- titleEscrowContract = v4Contracts.TitleEscrow__factory.connect(
47
+ const Contract = getEthersContractFromProvider(signer.provider);
48
+ let titleEscrowContract;
49
+ if (isV5TT) {
50
+ titleEscrowContract = new Contract(
51
+ titleEscrowAddress,
52
+ v5Contracts.TitleEscrow__factory.abi,
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
+ signer
55
+ );
56
+ } else if (isV4TT) {
57
+ titleEscrowContract = new Contract(
47
58
  titleEscrowAddress,
59
+ v4Contracts.TitleEscrow__factory.abi,
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
61
  signer
49
62
  );
50
63
  }
51
64
  try {
52
- if (isV5TT) {
53
- await titleEscrowContract.callStatic.transferHolder(
54
- holderAddress,
55
- encryptedRemarks
56
- );
57
- } else if (isV4TT) {
58
- await titleEscrowContract.callStatic.transferHolder(
59
- holderAddress
60
- );
65
+ const isV6 = isV6EthersProvider(signer.provider);
66
+ const args = isV5TT ? [holderAddress, encryptedRemarks] : [holderAddress];
67
+ if (isV6) {
68
+ await titleEscrowContract.transferHolder.staticCall(...args);
69
+ } else {
70
+ await titleEscrowContract.callStatic.transferHolder(...args);
61
71
  }
62
72
  } catch (e) {
63
73
  console.error("callStatic failed:", e);
@@ -65,16 +75,9 @@ const transferHolder = /* @__PURE__ */ __name(async (contractOptions, signer, pa
65
75
  }
66
76
  const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
67
77
  if (isV5TT) {
68
- return await titleEscrowContract.transferHolder(
69
- holderAddress,
70
- encryptedRemarks,
71
- txOptions
72
- );
78
+ return await titleEscrowContract.transferHolder(holderAddress, encryptedRemarks, txOptions);
73
79
  } else if (isV4TT) {
74
- return await titleEscrowContract.transferHolder(
75
- holderAddress,
76
- txOptions
77
- );
80
+ return await titleEscrowContract.transferHolder(holderAddress, txOptions);
78
81
  }
79
82
  }, "transferHolder");
80
83
  const transferBeneficiary = /* @__PURE__ */ __name(async (contractOptions, signer, params, options) => {
@@ -95,7 +98,6 @@ const transferBeneficiary = /* @__PURE__ */ __name(async (contractOptions, signe
95
98
  if (!titleEscrowAddress) throw new Error("Token registry address is required");
96
99
  if (!signer.provider) throw new Error("Provider is required");
97
100
  const { newBeneficiaryAddress, remarks } = params;
98
- let titleEscrowContract = v5Contracts.TitleEscrow__factory.connect(titleEscrowAddress, signer);
99
101
  const encryptedRemarks = remarks ? `0x${encrypt(remarks, options.id)}` : "0x";
100
102
  if (titleEscrowVersion === void 0) {
101
103
  [isV4TT, isV5TT] = await Promise.all([
@@ -114,22 +116,30 @@ const transferBeneficiary = /* @__PURE__ */ __name(async (contractOptions, signe
114
116
  if (!isV4TT && !isV5TT) {
115
117
  throw new Error("Only Token Registry V4/V5 is supported");
116
118
  }
117
- if (!isV5TT) {
118
- titleEscrowContract = v4Contracts.TitleEscrow__factory.connect(
119
+ const Contract = getEthersContractFromProvider(signer.provider);
120
+ let titleEscrowContract;
121
+ if (isV5TT) {
122
+ titleEscrowContract = new Contract(
119
123
  titleEscrowAddress,
124
+ v5Contracts.TitleEscrow__factory.abi,
125
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
126
+ signer
127
+ );
128
+ } else if (isV4TT) {
129
+ titleEscrowContract = new Contract(
130
+ titleEscrowAddress,
131
+ v4Contracts.TitleEscrow__factory.abi,
132
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
120
133
  signer
121
134
  );
122
135
  }
123
136
  try {
124
- if (isV5TT) {
125
- await titleEscrowContract.callStatic.transferBeneficiary(
126
- newBeneficiaryAddress,
127
- encryptedRemarks
128
- );
129
- } else if (isV4TT) {
130
- await titleEscrowContract.callStatic.transferBeneficiary(
131
- newBeneficiaryAddress
132
- );
137
+ const isV6 = isV6EthersProvider(signer.provider);
138
+ const args = isV5TT ? [newBeneficiaryAddress, encryptedRemarks] : [newBeneficiaryAddress];
139
+ if (isV6) {
140
+ await titleEscrowContract.transferBeneficiary.staticCall(...args);
141
+ } else {
142
+ await titleEscrowContract.callStatic.transferBeneficiary(...args);
133
143
  }
134
144
  } catch (e) {
135
145
  console.error("callStatic failed:", e);
@@ -137,18 +147,13 @@ const transferBeneficiary = /* @__PURE__ */ __name(async (contractOptions, signe
137
147
  }
138
148
  const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
139
149
  if (isV5TT) {
140
- const tx = await titleEscrowContract.transferBeneficiary(
150
+ return await titleEscrowContract.transferBeneficiary(
141
151
  newBeneficiaryAddress,
142
152
  encryptedRemarks,
143
153
  txOptions
144
154
  );
145
- return tx;
146
155
  } else if (isV4TT) {
147
- const tx = await titleEscrowContract.transferBeneficiary(
148
- newBeneficiaryAddress,
149
- txOptions
150
- );
151
- return tx;
156
+ return await titleEscrowContract.transferBeneficiary(newBeneficiaryAddress, txOptions);
152
157
  }
153
158
  }, "transferBeneficiary");
154
159
  const transferOwners = /* @__PURE__ */ __name(async (contractOptions, signer, params, options) => {
@@ -169,7 +174,6 @@ const transferOwners = /* @__PURE__ */ __name(async (contractOptions, signer, pa
169
174
  if (!titleEscrowAddress) throw new Error("Token registry address is required");
170
175
  if (!signer.provider) throw new Error("Provider is required");
171
176
  const { newBeneficiaryAddress, newHolderAddress, remarks } = params;
172
- let titleEscrowContract = v5Contracts.TitleEscrow__factory.connect(titleEscrowAddress, signer);
173
177
  const encryptedRemarks = remarks ? `0x${encrypt(remarks, options.id)}` : "0x";
174
178
  if (titleEscrowVersion === void 0) {
175
179
  [isV4TT, isV5TT] = await Promise.all([
@@ -188,24 +192,30 @@ const transferOwners = /* @__PURE__ */ __name(async (contractOptions, signer, pa
188
192
  if (!isV4TT && !isV5TT) {
189
193
  throw new Error("Only Token Registry V4/V5 is supported");
190
194
  }
191
- if (!isV5TT) {
192
- titleEscrowContract = v4Contracts.TitleEscrow__factory.connect(
195
+ const Contract = getEthersContractFromProvider(signer.provider);
196
+ let titleEscrowContract;
197
+ if (isV5TT) {
198
+ titleEscrowContract = new Contract(
199
+ titleEscrowAddress,
200
+ v5Contracts.TitleEscrow__factory.abi,
201
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
202
+ signer
203
+ );
204
+ } else if (isV4TT) {
205
+ titleEscrowContract = new Contract(
193
206
  titleEscrowAddress,
207
+ v4Contracts.TitleEscrow__factory.abi,
208
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
194
209
  signer
195
210
  );
196
211
  }
197
212
  try {
198
- if (isV5TT) {
199
- await titleEscrowContract.callStatic.transferOwners(
200
- newBeneficiaryAddress,
201
- newHolderAddress,
202
- encryptedRemarks
203
- );
204
- } else if (isV4TT) {
205
- await titleEscrowContract.callStatic.transferOwners(
206
- newBeneficiaryAddress,
207
- newHolderAddress
208
- );
213
+ const isV6 = isV6EthersProvider(signer.provider);
214
+ const args = isV5TT ? [newBeneficiaryAddress, newHolderAddress, encryptedRemarks] : [newBeneficiaryAddress, newHolderAddress];
215
+ if (isV6) {
216
+ await titleEscrowContract.transferOwners.staticCall(...args);
217
+ } else {
218
+ await titleEscrowContract.callStatic.transferOwners(...args);
209
219
  }
210
220
  } catch (e) {
211
221
  console.error("callStatic failed:", e);
@@ -245,7 +255,6 @@ const nominate = /* @__PURE__ */ __name(async (contractOptions, signer, params,
245
255
  if (!titleEscrowAddress) throw new Error("Token registry address is required");
246
256
  if (!signer.provider) throw new Error("Provider is required");
247
257
  const { newBeneficiaryAddress, remarks } = params;
248
- let titleEscrowContract = v5Contracts.TitleEscrow__factory.connect(titleEscrowAddress, signer);
249
258
  const encryptedRemarks = remarks ? `0x${encrypt(remarks, options.id)}` : "0x";
250
259
  if (titleEscrowVersion === void 0) {
251
260
  [isV4TT, isV5TT] = await Promise.all([
@@ -261,22 +270,30 @@ const nominate = /* @__PURE__ */ __name(async (contractOptions, signer, params,
261
270
  })
262
271
  ]);
263
272
  }
264
- if (!isV5TT) {
265
- titleEscrowContract = v4Contracts.TitleEscrow__factory.connect(
273
+ const Contract = getEthersContractFromProvider(signer.provider);
274
+ let titleEscrowContract;
275
+ if (isV5TT) {
276
+ titleEscrowContract = new Contract(
266
277
  titleEscrowAddress,
278
+ v5Contracts.TitleEscrow__factory.abi,
279
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
280
+ signer
281
+ );
282
+ } else if (isV4TT) {
283
+ titleEscrowContract = new Contract(
284
+ titleEscrowAddress,
285
+ v4Contracts.TitleEscrow__factory.abi,
286
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
267
287
  signer
268
288
  );
269
289
  }
270
290
  try {
271
- if (isV5TT) {
272
- await titleEscrowContract.callStatic.nominate(
273
- newBeneficiaryAddress,
274
- encryptedRemarks
275
- );
276
- } else if (isV4TT) {
277
- await titleEscrowContract.callStatic.nominate(
278
- newBeneficiaryAddress
279
- );
291
+ const isV6 = isV6EthersProvider(signer.provider);
292
+ const args = isV5TT ? [newBeneficiaryAddress, encryptedRemarks] : [newBeneficiaryAddress];
293
+ if (isV6) {
294
+ await titleEscrowContract.nominate.staticCall(...args);
295
+ } else {
296
+ await titleEscrowContract.callStatic.nominate(...args);
280
297
  }
281
298
  } catch (e) {
282
299
  console.error("callStatic failed:", e);
@@ -284,16 +301,9 @@ const nominate = /* @__PURE__ */ __name(async (contractOptions, signer, params,
284
301
  }
285
302
  const txOptions = await getTxOptions(signer, chainId, maxFeePerGas, maxPriorityFeePerGas);
286
303
  if (isV5TT) {
287
- return await titleEscrowContract.nominate(
288
- newBeneficiaryAddress,
289
- encryptedRemarks,
290
- txOptions
291
- );
304
+ return await titleEscrowContract.nominate(newBeneficiaryAddress, encryptedRemarks, txOptions);
292
305
  } else if (isV4TT) {
293
- return await titleEscrowContract.nominate(
294
- newBeneficiaryAddress,
295
- txOptions
296
- );
306
+ return await titleEscrowContract.nominate(newBeneficiaryAddress, txOptions);
297
307
  }
298
308
  }, "nominate");
299
309
 
@@ -13,7 +13,7 @@ const getTxOptions = /* @__PURE__ */ __name(async (signer, chainId, maxFeePerGas
13
13
  maxPriorityFeePerGas = gasFees?.maxPriorityFeePerGas ?? 0;
14
14
  }
15
15
  }
16
- return maxFeePerGas && maxPriorityFeePerGas ? { maxFeePerGas, maxPriorityFeePerGas } : void 0;
16
+ return maxFeePerGas && maxPriorityFeePerGas ? { maxFeePerGas, maxPriorityFeePerGas } : {};
17
17
  }, "getTxOptions");
18
18
  const getChainIdSafe = /* @__PURE__ */ __name(async (signer) => {
19
19
  if (isV6EthersProvider(signer.provider)) {
@@ -26,6 +26,6 @@ interface TitleEscrowVersionParams {
26
26
  * @returns {Promise<boolean>} - return true if titleEscrow matches supportInterface
27
27
  */
28
28
  declare const isTitleEscrowVersion: ({ tokenRegistryAddress, tokenId, titleEscrowAddress, versionInterface, provider, }: TitleEscrowVersionParams) => Promise<boolean>;
29
- declare const fetchEndorsementChain: (tokenRegistryAddress: string, tokenId: string, provider: Provider | ethers.Provider, keyId?: string) => Promise<EndorsementChain>;
29
+ declare const fetchEndorsementChain: (tokenRegistryAddress: string, tokenId: string, provider: Provider | ethers.Provider, keyId?: string, titleEscrowAddress?: string) => Promise<EndorsementChain>;
30
30
 
31
31
  export { TitleEscrowInterface, checkSupportsInterface, fetchEndorsementChain, getDocumentOwner, getTitleEscrowAddress, isTitleEscrowVersion };
@@ -6,6 +6,9 @@ import { Signer } from 'ethersV6';
6
6
  declare const getTxOptions: (signer: Signer | Signer$1, chainId: CHAIN_ID, maxFeePerGas: GasValue, maxPriorityFeePerGas: GasValue) => Promise<{
7
7
  maxFeePerGas: GasValue;
8
8
  maxPriorityFeePerGas: GasValue;
9
+ } | {
10
+ maxFeePerGas?: undefined;
11
+ maxPriorityFeePerGas?: undefined;
9
12
  }>;
10
13
  declare const getChainIdSafe: (signer: Signer | Signer$1) => Promise<bigint | number>;
11
14
  declare const getSignerAddressSafe: (signer: Signer | Signer$1) => Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "1.6.0-alpha.2",
3
+ "version": "1.6.0-alpha.4",
4
4
  "description": "TrustVC library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -10,6 +10,10 @@
10
10
  ],
11
11
  "scripts": {
12
12
  "test": "npx vitest --run --test-timeout=15000",
13
+ "test:e2e": "concurrently -k \"npm run e2e:node\" \"npm run wait-and-test\"",
14
+ "e2e:node": "npx hardhat node",
15
+ "wait-and-test": "wait-on tcp:8545 && npm run e2e:test",
16
+ "e2e:test": "npx hardhat test src/__tests__/e2e/**/*.test.ts --network hardhat",
13
17
  "type-check": "tsc --noEmit",
14
18
  "lint": "npx eslint . --color --format=table --max-warnings=0",
15
19
  "lint:fix": "npx eslint . --fix",
@@ -131,13 +135,18 @@
131
135
  "@commitlint/config-conventional": "^19.8.0",
132
136
  "@commitlint/config-nx-scopes": "^19.8.0",
133
137
  "@commitlint/prompt": "^19.8.0",
138
+ "@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
139
+ "@nomiclabs/hardhat-ethers": "^2.2.3",
140
+ "@openzeppelin/contracts": "^5.3.0",
134
141
  "@semantic-release/changelog": "^6.0.3",
135
142
  "@semantic-release/git": "^10.0.1",
136
143
  "@semantic-release/npm": "^9.0.2",
137
144
  "@types/conventional-commits-parser": "^5.0.1",
138
145
  "@types/lodash": "^4.17.16",
146
+ "@types/mocha": "^10.0.10",
139
147
  "@types/node": "^18.19.86",
140
148
  "@vitest/coverage-v8": "^1.6.1",
149
+ "concurrently": "^9.2.0",
141
150
  "cpy": "^11.1.0",
142
151
  "dotenv": "^16.5.0",
143
152
  "eslint": "^9.25.1",
@@ -149,17 +158,20 @@
149
158
  "eslint-plugin-promise": "^7.2.1",
150
159
  "eth-testing": "^1.14.0",
151
160
  "execa": "^9.5.2",
161
+ "hardhat": "^2.25.0",
152
162
  "husky": "^9.1.7",
153
163
  "lint-staged": "^15.5.1",
154
164
  "prettier": "^3.5.3",
155
165
  "rimraf": "^5.0.10",
156
166
  "semantic-release": "^20.1.3",
157
167
  "ts-node": "^10.9.2",
168
+ "tsconfig-paths": "^4.2.0",
158
169
  "tsup": "^8.4.0",
159
170
  "typescript": "^5.8.3",
160
171
  "typescript-eslint": "^8.31.0",
161
172
  "vite-plugin-dts": "^3.9.1",
162
- "vitest": "^1.6.1"
173
+ "vitest": "^1.6.1",
174
+ "wait-on": "^8.0.3"
163
175
  },
164
176
  "overrides": {
165
177
  "ethers": "^5.8.0"