Skip to content

Commit

Permalink
update useElven and sdk core
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed May 2, 2023
1 parent 22df06e commit bb31169
Show file tree
Hide file tree
Showing 8 changed files with 1,292 additions and 1,297 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### [6.1.0](https://github.com/ElvenTools/elven-tools-dapp/releases/tag/v6.1.0) (2023-05-02)
- update `useElven` and `sdk-core`, adjust the code
- update other dependencies

### [6.0.0](https://github.com/ElvenTools/elven-tools-dapp/releases/tag/v6.0.0) (2023-03-05)
- switch to v0.1.0 of [useElven](https://www.useelven.com/) with support for xPortal when signing
- changes for Wallet Connect pairings list
Expand Down
17 changes: 12 additions & 5 deletions components/NftImageHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { FC, CSSProperties, PropsWithChildren } from 'react';
import { Box } from '@chakra-ui/react';
import Image, { ImageProps } from 'next/image';
import { useConfig } from '@useelven/core';
import { customIPFSGateway } from '../config/dappCustoms';
import {
customIPFSGateway,
getOldElrondIPFSGateway,
} from '../config/dappCustoms';

const commonImageStyles: CSSProperties = {
objectFit: 'contain',
Expand Down Expand Up @@ -38,11 +41,14 @@ const isDefaultThumbnail = (thumbnail: string) => {
const getImageUrlFromIPFS = (
multiversxIPFSGatewayUrl: string,
thumbnail: string,
IPFSGateway: string
IPFSGateway: string,
chainType?: string
) => {
if (multiversxIPFSGatewayUrl) {
const CIDandImageFileName = multiversxIPFSGatewayUrl.replace(
IPFSGateway,
multiversxIPFSGatewayUrl.includes('elrond')
? getOldElrondIPFSGateway(chainType || 'devnet')
: IPFSGateway,
''
);
return `${customIPFSGateway}${CIDandImageFileName}`;
Expand Down Expand Up @@ -80,7 +86,7 @@ export const NftImageHelper: FC<NftImageHelperProps> = ({
multiversxIPFSGatewayUrl,
href,
}) => {
const { IPFSGateway } = useConfig();
const { IPFSGateway, chainType } = useConfig();
return (
<>
{isDefaultThumbnail(thumbnail) && IPFSGateway ? (
Expand All @@ -89,7 +95,8 @@ export const NftImageHelper: FC<NftImageHelperProps> = ({
src={getImageUrlFromIPFS(
multiversxIPFSGatewayUrl,
thumbnail,
IPFSGateway
IPFSGateway,
chainType
)}
alt=""
{...commonImagesProps}
Expand Down
3 changes: 3 additions & 0 deletions config/dappCustoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ export const avatarIdUrl = (address: string) =>
`https://id.maiar.com/users/photos/profile/${address}`;

export const customIPFSGateway = 'https://nftstorage.link/ipfs/';

export const getOldElrondIPFSGateway = (chain: string) =>
`https://${chain}-media.elrond.com/nfts/asset/`;
3 changes: 2 additions & 1 deletion hooks/useElvenScQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ interface ScConfigDataArgs {
abiJSON?: {
name: string;
endpoints: unknown[];
types: unknown;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
types: Record<string, any> | undefined;
};
}

Expand Down
4 changes: 2 additions & 2 deletions hooks/useMintTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ContractFunction,
U32Value,
ContractCallPayloadBuilder,
TokenPayment,
TokenTransfer,
} from '@multiversx/sdk-core';
import BigNumber from 'bignumber.js';
import { useElvenScQuery } from './useElvenScQuery';
Expand Down Expand Up @@ -64,7 +64,7 @@ export function useMintTransaction(
address: smartContractAddress,
gasLimit:
mintTxBaseGasLimit + (mintTxBaseGasLimit / 2) * (tokensAmount - 1),
value: TokenPayment.egldFromBigInteger(totalPayment),
value: TokenTransfer.egldFromBigInteger(totalPayment),
data,
});
};
Expand Down
Loading

0 comments on commit bb31169

Please sign in to comment.