@trustvc/trustvc 1.5.5 → 1.6.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.
@@ -122,19 +122,19 @@ const isTitleEscrowVersion = /* @__PURE__ */ __name(async ({
122
122
  return false;
123
123
  }
124
124
  }, "isTitleEscrowVersion");
125
- const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId) => {
125
+ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId, titleEscrowAddress) => {
126
126
  if (!tokenRegistryAddress || !tokenId || !provider) {
127
127
  throw new Error("Missing required dependencies");
128
128
  }
129
- const titleEscrowAddress = await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
129
+ const resolvedTitleEscrowAddress = titleEscrowAddress ?? await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
130
130
  const [isV4, isV5] = await Promise.all([
131
131
  isTitleEscrowVersion({
132
- titleEscrowAddress,
132
+ titleEscrowAddress: resolvedTitleEscrowAddress,
133
133
  versionInterface: TitleEscrowInterface.V4,
134
134
  provider
135
135
  }),
136
136
  isTitleEscrowVersion({
137
- titleEscrowAddress,
137
+ titleEscrowAddress: resolvedTitleEscrowAddress,
138
138
  versionInterface: TitleEscrowInterface.V5,
139
139
  provider
140
140
  })
@@ -146,13 +146,13 @@ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress
146
146
  if (isV4) {
147
147
  const [tokenLogs, titleEscrowLogs] = await Promise.all([
148
148
  fetchTokenTransfer.fetchTokenTransfers(provider, tokenRegistryAddress, tokenId),
149
- fetchEscrowTransfer.fetchEscrowTransfersV4(provider, titleEscrowAddress)
149
+ fetchEscrowTransfer.fetchEscrowTransfersV4(provider, resolvedTitleEscrowAddress)
150
150
  ]);
151
151
  transferEvents = helpers.mergeTransfersV4([...titleEscrowLogs, ...tokenLogs]);
152
152
  } else if (isV5) {
153
153
  const titleEscrowLogs = await fetchEscrowTransfer.fetchEscrowTransfersV5(
154
154
  provider,
155
- titleEscrowAddress,
155
+ resolvedTitleEscrowAddress,
156
156
  tokenRegistryAddress
157
157
  );
158
158
  transferEvents = helpers.mergeTransfersV5(titleEscrowLogs);
@@ -120,19 +120,19 @@ const isTitleEscrowVersion = /* @__PURE__ */ __name(async ({
120
120
  return false;
121
121
  }
122
122
  }, "isTitleEscrowVersion");
123
- const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId) => {
123
+ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId, titleEscrowAddress) => {
124
124
  if (!tokenRegistryAddress || !tokenId || !provider) {
125
125
  throw new Error("Missing required dependencies");
126
126
  }
127
- const titleEscrowAddress = await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
127
+ const resolvedTitleEscrowAddress = titleEscrowAddress ?? await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
128
128
  const [isV4, isV5] = await Promise.all([
129
129
  isTitleEscrowVersion({
130
- titleEscrowAddress,
130
+ titleEscrowAddress: resolvedTitleEscrowAddress,
131
131
  versionInterface: TitleEscrowInterface.V4,
132
132
  provider
133
133
  }),
134
134
  isTitleEscrowVersion({
135
- titleEscrowAddress,
135
+ titleEscrowAddress: resolvedTitleEscrowAddress,
136
136
  versionInterface: TitleEscrowInterface.V5,
137
137
  provider
138
138
  })
@@ -144,13 +144,13 @@ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress
144
144
  if (isV4) {
145
145
  const [tokenLogs, titleEscrowLogs] = await Promise.all([
146
146
  fetchTokenTransfers(provider, tokenRegistryAddress, tokenId),
147
- fetchEscrowTransfersV4(provider, titleEscrowAddress)
147
+ fetchEscrowTransfersV4(provider, resolvedTitleEscrowAddress)
148
148
  ]);
149
149
  transferEvents = mergeTransfersV4([...titleEscrowLogs, ...tokenLogs]);
150
150
  } else if (isV5) {
151
151
  const titleEscrowLogs = await fetchEscrowTransfersV5(
152
152
  provider,
153
- titleEscrowAddress,
153
+ resolvedTitleEscrowAddress,
154
154
  tokenRegistryAddress
155
155
  );
156
156
  transferEvents = mergeTransfersV5(titleEscrowLogs);
@@ -25,6 +25,6 @@ interface TitleEscrowVersionParams {
25
25
  * @returns {Promise<boolean>} - return true if titleEscrow matches supportInterface
26
26
  */
27
27
  declare const isTitleEscrowVersion: ({ tokenRegistryAddress, tokenId, titleEscrowAddress, versionInterface, provider, }: TitleEscrowVersionParams) => Promise<boolean>;
28
- declare const fetchEndorsementChain: (tokenRegistryAddress: string, tokenId: string, provider: Provider | ethers.Provider, keyId?: string) => Promise<EndorsementChain>;
28
+ declare const fetchEndorsementChain: (tokenRegistryAddress: string, tokenId: string, provider: Provider | ethers.Provider, keyId?: string, titleEscrowAddress?: string) => Promise<EndorsementChain>;
29
29
 
30
30
  export { TitleEscrowInterface, fetchEndorsementChain, getDocumentOwner, getTitleEscrowAddress, isTitleEscrowVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "1.5.5",
3
+ "version": "1.6.0",
4
4
  "description": "TrustVC library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",