Skip to content

Commit

Permalink
Merge branch 'v4' into fix/update-v5-url
Browse files Browse the repository at this point in the history
  • Loading branch information
rongquan1 authored Dec 3, 2024
2 parents ce2d01f + 9a42490 commit a72b224
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@reduxjs/toolkit": "^1.6.1",
"@tradetrust-tt/decentralized-renderer-react-components": "^3.14.1",
"@tradetrust-tt/document-store": "^3.2.0",
"@tradetrust-tt/token-registry": "^4.12.1",
"@tradetrust-tt/token-registry": "^4.14.0",
"@tradetrust-tt/tradetrust": "^6.9.4",
"@tradetrust-tt/tradetrust-ui-components": "^2.22.2",
"@tradetrust-tt/tradetrust-utils": "^1.14.1",
Expand Down
16 changes: 9 additions & 7 deletions src/utils/shared.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { getData, utils, v2, v3, OpenAttestationDocument, WrappedDocument } from "@tradetrust-tt/tradetrust";
import { getSupportedChainIds } from "../common/utils/chain-utils";
import { AvailableBlockChains, BurnAddress, ChainId } from "../constants/chain-info";
import {
TitleEscrow__factory,
TitleEscrowFactory__factory,
TradeTrustToken__factory,
} from "@tradetrust-tt/token-registry/contracts";
import { TitleEscrow__factory, TradeTrustToken__factory } from "@tradetrust-tt/token-registry/contracts";
import { TitleEscrowInterface } from "../common/contexts/TokenInformationContext";
import { getCurrentProvider } from "../common/contexts/provider";
import { ethers } from "ethers";

export type WrappedOrSignedOpenAttestationDocument = WrappedDocument<OpenAttestationDocument>;
// note that the return type for getting attachments will normalise the structure into v2.Attachment
Expand Down Expand Up @@ -108,8 +105,13 @@ export async function isTokenRegistryV5(registryAddress: string, tokenId: string
if (inactiveEscrow) {
const titleEscrowFactoryAddress = await tokenRegistry.titleEscrowFactory();
const tokenRegistryAddress = await tokenRegistry.address;
const titleEscrowFactory = TitleEscrowFactory__factory.connect(titleEscrowFactoryAddress, provider);
titleEscrowAddress = await titleEscrowFactory.getAddress(tokenRegistryAddress, tokenId);
// Resolve V5 TitleEscrowFactory__factory contract function rename from getAddress to getEscrowAddress
const titleEscrowFactory = new ethers.Contract(
titleEscrowFactoryAddress,
`[{"inputs":[{"internalType":"address","name":"tokenRegistry","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getEscrowAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]`,
provider
);
titleEscrowAddress = await titleEscrowFactory.getEscrowAddress(tokenRegistryAddress, tokenId);
}
const titleEscrow = TitleEscrow__factory.connect(titleEscrowAddress, provider);
const isTitleEscrowV5 = await titleEscrow.supportsInterface(TitleEscrowInterface.V5);
Expand Down

0 comments on commit a72b224

Please sign in to comment.