diff --git a/packages/apps/.env.defaults b/packages/apps/.env.defaults index aba49d9..bc0ef9a 100644 --- a/packages/apps/.env.defaults +++ b/packages/apps/.env.defaults @@ -2,11 +2,11 @@ DECIMALS=6 DISCORD_CHANNEL=https://discord.com/invite/8jghD8V9PU FAVICON_PATH=favicons/marketplace GRAPH_QL_ADMIN_SECRET=hepM3wfsATBoI-ix2uhsAodr1j99MThPF5LBZJI2YtHAax7W9BIP9F8IWuzcNUC4 -GRAPH_QL_API=https://hasura.dev.uniquenetwork.dev/v1/graphql +GRAPH_QL_API=https://hasura.quartz.uniquenetwork.dev/v1/graphql IMAGE_SERVER_URL=https://image-uploader.unique.network IPFS_GATEWAY=https://ipfs.unique.network/ipfs MIN_PRICE=0.000001 -UNIQUE_SUBSTRATE_API=wss://ws-rc.unique.network +UNIQUE_SUBSTRATE_API=wss://ws-quartz.unique.network UNQ_TELEGRAM=https://t.me/unique2faucet_opal_bot UNQ_WALLET="https://wallet-opal.unique.network/#/myStuff/nft?collectionId=" UNQ_SCAN="https://uniquescan.io" diff --git a/packages/apps/webpack.serve.cjs b/packages/apps/webpack.serve.cjs index 43aa534..f361189 100644 --- a/packages/apps/webpack.serve.cjs +++ b/packages/apps/webpack.serve.cjs @@ -17,7 +17,7 @@ module.exports = merge( proxy: { '/v1/graphql/': { changeOrigin: true, - target: 'https://hasura.dev.uniquenetwork.dev' + target: 'https://hasura.quartz.uniquenetwork.dev' } }, static: path.resolve(__dirname, 'build') diff --git a/packages/page-builder/src/CollectionFormContext/CollectionFormContext.ts b/packages/page-builder/src/CollectionFormContext/CollectionFormContext.ts index ca109e3..71bbd74 100644 --- a/packages/page-builder/src/CollectionFormContext/CollectionFormContext.ts +++ b/packages/page-builder/src/CollectionFormContext/CollectionFormContext.ts @@ -29,7 +29,7 @@ export interface CollectionFormProps { setTokenPrefix: (tokenPrefix: string) => void; setVariableSchema: (variableSchema: string) => void; tokenImg: File | null; - tokenLimit: number; + tokenLimit: number | undefined; tokenPrefix: string; variableSchema: string; } diff --git a/packages/page-builder/src/CollectionFormContext/index.tsx b/packages/page-builder/src/CollectionFormContext/index.tsx index 9ffc23d..866c62f 100644 --- a/packages/page-builder/src/CollectionFormContext/index.tsx +++ b/packages/page-builder/src/CollectionFormContext/index.tsx @@ -31,7 +31,7 @@ function CollectionForm ({ children }: Props): React.ReactElement | null const [ownerCanTransfer, setOwnerCanTransfer] = useState(false); const [ownerCanDestroy, setOwnerCanDestroy] = useState(true); const [tokenPrefix, setTokenPrefix] = useState(''); - const [tokenLimit, setTokenLimit] = useState(0); + const [tokenLimit, setTokenLimit] = useState(); const [variableSchema, setVariableSchema] = useState(''); const [tokenImg, setTokenImg] = useState(null); diff --git a/packages/page-builder/src/components/CreateNFT/index.tsx b/packages/page-builder/src/components/CreateNFT/index.tsx index 6bfac3e..adbe44a 100644 --- a/packages/page-builder/src/components/CreateNFT/index.tsx +++ b/packages/page-builder/src/components/CreateNFT/index.tsx @@ -51,7 +51,7 @@ interface IValueType { const transactionText = 'Creating token and saving it to blockchain'; function CreateNFT ({ account, collectionId, collectionInfo, constAttributes, constOnChainSchema, isOwner, resetAttributes, setTokenConstAttributes, setTokenImg, tokenConstAttributes, tokenImg }: CreateNFTProps): React.ReactElement { - const { calculateCreateItemFee, createNft, getDetailedTokenInfo } = useToken(); + const { calculateCreateItemFee, createNft } = useToken(); const [createFees, setCreateFees] = useState(null); const [isDisabled, setIsDisabled] = useState(true); const [imageUploading, setImageUploading] = useState(false); @@ -172,6 +172,7 @@ function CreateNFT ({ account, collectionId, collectionInfo, constAttributes, co payload[tokenConstAttributes[key].name] = attributeValue || attributeValue === 0 ? attributeValue : null; }); + const cData = serializeNft(constOnChainSchema, payload); constData = '0x' + Buffer.from(cData).toString('hex'); @@ -224,12 +225,6 @@ function CreateNFT ({ account, collectionId, collectionInfo, constAttributes, co void calculateFee(); }, [calculateFee]); - useEffect(() => { - if (collectionInfo) { - void getDetailedTokenInfo(collectionId, '1'); - } - }, [collectionInfo, collectionId, getDetailedTokenInfo]); - if (collectionInfo && !isOwner) { return (
diff --git a/packages/page-builder/src/components/TokenAttributes/index.tsx b/packages/page-builder/src/components/TokenAttributes/index.tsx index 38dad60..b09f1f0 100644 --- a/packages/page-builder/src/components/TokenAttributes/index.tsx +++ b/packages/page-builder/src/components/TokenAttributes/index.tsx @@ -468,7 +468,7 @@ function TokenAttributes ({ account, collectionId, collectionInfo }: TokenAttrib onKeyDown={onLimitKeyDown} placeholder='Token limit' type='number' - value={tokenLimit.toString()} + value={tokenLimit?.toString()} />
diff --git a/packages/react-hooks/src/useToken.ts b/packages/react-hooks/src/useToken.ts index f87c4c1..afe72e9 100644 --- a/packages/react-hooks/src/useToken.ts +++ b/packages/react-hooks/src/useToken.ts @@ -76,11 +76,12 @@ export function useToken (): UseTokenInterface { } try { - const tokenInfo = (await api.rpc.unique.tokenData(collectionId, tokenId)).toHuman() as TokenDetailsInterface; + const tokenInfo = (await api.rpc.unique.tokenData(collectionId, tokenId)) as TokenDetailsInterface; - console.log('tokenInfo', tokenInfo); - - return tokenInfo; + return { + owner: tokenInfo?.owner?.toHuman(), + properties: tokenInfo?.properties?.map((x) => ({ key: x.key.toHuman(), value: x?.value?.toJSON() })), + }; } catch (e) { console.log('getDetailedTokenInfo error', e);