@trustvc/trustvc 1.6.0-alpha.3 → 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.
@@ -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
  fetchTokenTransfer.fetchTokenTransfers(provider, tokenRegistryAddress, tokenId),
147
- fetchEscrowTransfer.fetchEscrowTransfersV4(provider, titleEscrowAddress)
147
+ fetchEscrowTransfer.fetchEscrowTransfersV4(provider, resolvedTitleEscrowAddress)
148
148
  ]);
149
149
  transferEvents = helpers.mergeTransfersV4([...titleEscrowLogs, ...tokenLogs]);
150
150
  } else if (isV5) {
151
151
  const titleEscrowLogs = await fetchEscrowTransfer.fetchEscrowTransfersV5(
152
152
  provider,
153
- titleEscrowAddress,
153
+ resolvedTitleEscrowAddress,
154
154
  tokenRegistryAddress
155
155
  );
156
156
  transferEvents = helpers.mergeTransfersV5(titleEscrowLogs);
@@ -118,19 +118,19 @@ const isTitleEscrowVersion = /* @__PURE__ */ __name(async ({
118
118
  return false;
119
119
  }
120
120
  }, "isTitleEscrowVersion");
121
- const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId) => {
121
+ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId, titleEscrowAddress) => {
122
122
  if (!tokenRegistryAddress || !tokenId || !provider) {
123
123
  throw new Error("Missing required dependencies");
124
124
  }
125
- const titleEscrowAddress = await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
125
+ const resolvedTitleEscrowAddress = titleEscrowAddress ?? await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
126
126
  const [isV4, isV5] = await Promise.all([
127
127
  isTitleEscrowVersion({
128
- titleEscrowAddress,
128
+ titleEscrowAddress: resolvedTitleEscrowAddress,
129
129
  versionInterface: TitleEscrowInterface.V4,
130
130
  provider
131
131
  }),
132
132
  isTitleEscrowVersion({
133
- titleEscrowAddress,
133
+ titleEscrowAddress: resolvedTitleEscrowAddress,
134
134
  versionInterface: TitleEscrowInterface.V5,
135
135
  provider
136
136
  })
@@ -142,13 +142,13 @@ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress
142
142
  if (isV4) {
143
143
  const [tokenLogs, titleEscrowLogs] = await Promise.all([
144
144
  fetchTokenTransfers(provider, tokenRegistryAddress, tokenId),
145
- fetchEscrowTransfersV4(provider, titleEscrowAddress)
145
+ fetchEscrowTransfersV4(provider, resolvedTitleEscrowAddress)
146
146
  ]);
147
147
  transferEvents = mergeTransfersV4([...titleEscrowLogs, ...tokenLogs]);
148
148
  } else if (isV5) {
149
149
  const titleEscrowLogs = await fetchEscrowTransfersV5(
150
150
  provider,
151
- titleEscrowAddress,
151
+ resolvedTitleEscrowAddress,
152
152
  tokenRegistryAddress
153
153
  );
154
154
  transferEvents = mergeTransfersV5(titleEscrowLogs);
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "1.6.0-alpha.3",
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",