Skip to content

Commit dae3602

Browse files
committed
Merge branch 'main' of https://github.com/rmrk-team/rmrk-js
2 parents ea18c5e + f0b78b3 commit dae3602

File tree

14 files changed

+70
-69
lines changed

14 files changed

+70
-69
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { expect, test } from "vitest";
2-
import { getIpfsCidFromGatewayUrl } from "./get-ipfs-cid.js";
1+
import { expect, test } from 'vitest';
2+
import { getIpfsCidFromGatewayUrl } from './get-ipfs-cid.js';
33

4-
test("getIpfsCidFromGatewayUrl", async () => {
4+
test('getIpfsCidFromGatewayUrl', async () => {
55
expect(
6-
getIpfsCidFromGatewayUrl("https://cloudflare-ipfs.com/ipfs/foo")
7-
).to.not.eq("bar");
6+
getIpfsCidFromGatewayUrl('https://cloudflare-ipfs.com/ipfs/foo'),
7+
).to.not.eq('bar');
88

99
expect(
10-
getIpfsCidFromGatewayUrl("https://cloudflare-ipfs.com/ipfs/foo")
11-
).to.eq("foo");
10+
getIpfsCidFromGatewayUrl('https://cloudflare-ipfs.com/ipfs/foo'),
11+
).to.eq('foo');
1212

1313
expect(
14-
getIpfsCidFromGatewayUrl("https://cloudflare-ipfs.com/ipfs/foo/bar")
15-
).to.eq("foo/bar");
14+
getIpfsCidFromGatewayUrl('https://cloudflare-ipfs.com/ipfs/foo/bar'),
15+
).to.eq('foo/bar');
1616
});

packages/ipfs-utils/src/lib/ipfs.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { expect, test } from 'vitest';
22
import {
3+
DEFAULT_IPFS_GATEWAY_KEYS,
4+
DEFAULT_IPFS_GATEWAY_URLS,
35
containsCID,
46
convertToDesiredGateway,
57
sanitizeIpfsUrl,
6-
DEFAULT_IPFS_GATEWAY_KEYS,
7-
DEFAULT_IPFS_GATEWAY_URLS,
88
} from './ipfs.js';
99

1010
test('containsCID', async () => {

packages/ipfs-utils/src/lib/ipfs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export const containsCID = (ipfsUrl?: string | null) => {
4747

4848
export const convertToDesiredGateway = (
4949
ipfsUrl?: string | null,
50-
gatewayPrefixovider = DEFAULT_IPFS_GATEWAY_URLS[DEFAULT_IPFS_GATEWAY_KEYS.pinata],
50+
gatewayPrefixovider = DEFAULT_IPFS_GATEWAY_URLS[
51+
DEFAULT_IPFS_GATEWAY_KEYS.pinata
52+
],
5153
) => {
5254
const results = containsCID(ipfsUrl);
5355
if (!ipfsUrl || results.containsCid !== true || !results.cid) {

packages/nft-renderer/panda.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { defineConfig } from "@pandacss/dev";
1+
import { defineConfig } from '@pandacss/dev';
22

33
export default defineConfig({
44
// Whether to use css reset
55
preflight: true,
66
prefix: 'rmrk-nft-renderer',
77

88
// Where to look for your css declarations
9-
include: ["./src/**/*.{js,jsx,ts,tsx}"],
9+
include: ['./src/**/*.{js,jsx,ts,tsx}'],
1010

1111
// Files to exclude
1212
exclude: [],
@@ -17,6 +17,6 @@ export default defineConfig({
1717
},
1818

1919
// The output directory for your css system
20-
outdir: "styled-system",
21-
jsxFramework: "react",
20+
outdir: 'styled-system',
21+
jsxFramework: 'react',
2222
});

packages/nft-renderer/postcss.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module.exports = {
22
plugins: {
33
'@pandacss/dev/postcss': {},
44
},
5-
}
5+
};

packages/nft-renderer/src/components/nft-renderer.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import "../styles/index.css";
2-
import { MultiLayer2DRenderer } from "@rmrk-team/rmrk-2d-renderer";
1+
import { MultiLayer2DRenderer } from '@rmrk-team/rmrk-2d-renderer';
32
import {
43
RMRKEquippableImpl,
54
mapChainIdToNetwork,
6-
} from "@rmrk-team/rmrk-evm-utils";
5+
} from '@rmrk-team/rmrk-evm-utils';
76
import {
87
useFetchIpfsMetadata,
98
useGetAssetData,
109
useGetComposedState,
1110
useGetInterfaceSupport,
12-
} from "@rmrk-team/rmrk-hooks";
13-
import React, { useEffect, useRef, useState } from "react";
14-
import { isAddress } from "viem";
15-
import type { Address } from "viem";
16-
import { usePublicClient, useReadContract } from "wagmi";
17-
import type { Chain } from "wagmi/chains";
18-
import type { RenderPart } from "../types/types.js";
11+
} from '@rmrk-team/rmrk-hooks';
12+
import React, { useEffect, useRef, useState } from 'react';
13+
import { css } from 'styled-system/css';
14+
import { isAddress } from 'viem';
15+
import type { Address } from 'viem';
16+
import { usePublicClient, useReadContract } from 'wagmi';
17+
import type { Chain } from 'wagmi/chains';
18+
import '../styles/index.css';
19+
import type { RenderPart } from '../types/types.js';
1920
// import { sanitizeIpfsUrl } from '../lib/ipfs';
20-
import { Providers } from "./providers.js";
21-
import { css } from "styled-system/css";
21+
import { Providers } from './providers.js';
2222

2323
interface INFTRenderer {
24-
chainId: Chain["id"];
24+
chainId: Chain['id'];
2525
contractAddress: Address;
2626
tokenId: bigint;
2727
advancedMode?: boolean;
@@ -82,7 +82,7 @@ export function NFTRenderer({
8282
interfaceSupport: { supports721, supportsEquippable, supportsMultiAsset },
8383
} = useGetInterfaceSupport(
8484
{ contractAddress, chainId },
85-
{ enabled: isContract }
85+
{ enabled: isContract },
8686
);
8787

8888
const {
@@ -92,7 +92,7 @@ export function NFTRenderer({
9292
} = useReadContract({
9393
address: contractAddress,
9494
abi: RMRKEquippableImpl,
95-
functionName: "tokenURI",
95+
functionName: 'tokenURI',
9696
args: [tokenIdBigint],
9797
chainId,
9898
query: { enabled: isContract && supports721 },
@@ -123,7 +123,7 @@ export function NFTRenderer({
123123
supportsEquippableInterface: supportsEquippable,
124124
supportsMultiAssetInterface: supportsMultiAsset,
125125
},
126-
{ enabled: isContract }
126+
{ enabled: isContract },
127127
);
128128

129129
const {
@@ -139,11 +139,11 @@ export function NFTRenderer({
139139
? [
140140
...fixedPartsWithMetadatas.map((p) => ({
141141
z: p.z,
142-
src: p.metadata?.mediaUri || "",
142+
src: p.metadata?.mediaUri || '',
143143
})),
144144
...slotPartsWithMetadatas.map((p) => ({
145145
z: p.z,
146-
src: p.metadata?.mediaUri || "",
146+
src: p.metadata?.mediaUri || '',
147147
})),
148148
]
149149
: undefined;
@@ -155,13 +155,13 @@ export function NFTRenderer({
155155
src:
156156
primaryAsset?.metadata?.mediaUri ||
157157
primaryAsset?.metadata?.image ||
158-
"",
158+
'',
159159
},
160160
]
161161
: undefined;
162162

163163
const tokenRenderPart: RenderPart[] | undefined = primaryAsset
164-
? [{ z: 1, src: tokenMetadata?.mediaUri || tokenMetadata?.image || "" }]
164+
? [{ z: 1, src: tokenMetadata?.mediaUri || tokenMetadata?.image || '' }]
165165
: undefined;
166166

167167
const renderParts = catalogRenderParts || assetRenderPart || tokenRenderPart;
@@ -203,17 +203,17 @@ export function NFTRenderer({
203203
<div
204204
ref={rendererContainerRef}
205205
className={css({
206-
width: "100%",
207-
height: "100%",
208-
position: "relative",
209-
display: "flex",
210-
justifyContent: "center",
206+
width: '100%',
207+
height: '100%',
208+
position: 'relative',
209+
display: 'flex',
210+
justifyContent: 'center',
211211
})}
212212
>
213213
{isLoading ? (
214214
<div
215215
className={css({
216-
alignSelf: "center",
216+
alignSelf: 'center',
217217
})}
218218
>
219219
{loader}
@@ -254,10 +254,10 @@ export function NFTRenderer({
254254
fillBgWithImageBlur
255255
loader={loader}
256256
className={css({
257-
aspectRatio: "1/1",
258-
objectFit: "contain",
259-
width: "100%",
260-
height: "100%",
257+
aspectRatio: '1/1',
258+
objectFit: 'contain',
259+
width: '100%',
260+
height: '100%',
261261
})}
262262
/>
263263
) : null}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { defineConfig } from "@pandacss/dev";
1+
import { defineConfig } from '@pandacss/dev';
22

33
export default defineConfig({
44
// Whether to use css reset
55
preflight: true,
66
prefix: 'rmrk-2d-renderer',
77

88
// Where to look for your css declarations
9-
include: ["./src/**/*.{js,jsx,ts,tsx}"],
9+
include: ['./src/**/*.{js,jsx,ts,tsx}'],
1010

1111
// Files to exclude
1212
exclude: [],
@@ -17,6 +17,6 @@ export default defineConfig({
1717
},
1818

1919
// The output directory for your css system
20-
outdir: "styled-system",
21-
jsxFramework: "react",
20+
outdir: 'styled-system',
21+
jsxFramework: 'react',
2222
});

packages/rmrk-2d-renderer/postcss.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module.exports = {
22
plugins: {
33
'@pandacss/dev/postcss': {},
44
},
5-
}
5+
};

packages/rmrk-2d-renderer/src/lib/rmrk-2d-renderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import type { ICanvas } from 'pixi.js';
88
import type { CSSProperties } from 'react';
99
import React, { useEffect, useMemo } from 'react';
1010
import { useCallback, useState } from 'react';
11+
import { css, cx } from 'styled-system/css';
1112
import useImage from 'use-image';
1213
import { Skeleton } from '../ui/skeleton.js';
1314
import { INHERIT_RENDER_CONTEXT } from './consts.js';
14-
import { css, cx } from 'styled-system/css';
1515

1616
const useObserveElementDimensions = (ref?: React.RefObject<HTMLDivElement>) => {
1717
const [width, setWidth] = useState(0);
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { expect, test } from 'vitest';
2-
import {EVM_NETWORKS, mapEvmNetworkToSupportedChain} from "./chain-mapping.js";
3-
import {base, mainnet} from "wagmi/chains";
2+
import { base, mainnet } from 'wagmi/chains';
3+
import {
4+
EVM_NETWORKS,
5+
mapEvmNetworkToSupportedChain,
6+
} from './chain-mapping.js';
47

58
test('mapEvmNetworkToSupportedChain', async () => {
6-
expect(mapEvmNetworkToSupportedChain(EVM_NETWORKS.base)).not.toBe(mainnet);
7-
expect(mapEvmNetworkToSupportedChain(EVM_NETWORKS.base)).toBe(base);
8-
})
9+
expect(mapEvmNetworkToSupportedChain(EVM_NETWORKS.base)).not.toBe(mainnet);
10+
expect(mapEvmNetworkToSupportedChain(EVM_NETWORKS.base)).toBe(base);
11+
});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { expect, test } from 'vitest';
2+
import { base, mainnet } from 'wagmi/chains';
3+
import { EVM_NETWORKS, mapChainIdToNetwork } from './chain-mapping.js';
24
import { getChainIdByNetworkName } from './get-chain-id-by-network-name.js';
3-
import {EVM_NETWORKS, mapChainIdToNetwork} from './chain-mapping.js';
4-
import {base, mainnet} from 'wagmi/chains';
55

66
test('getChainIdByNetworkName', async () => {
77
expect(getChainIdByNetworkName(EVM_NETWORKS.base)).toBe(base.id);
88
expect(getChainIdByNetworkName('foo')).toBe(undefined);
99
});
1010

1111
test('mapChainIdToNetwork', async () => {
12-
expect(mapChainIdToNetwork(base.id)).toBe(EVM_NETWORKS.base);
13-
expect(mapChainIdToNetwork(mainnet.id)).not.toBe(EVM_NETWORKS.base);
12+
expect(mapChainIdToNetwork(base.id)).toBe(EVM_NETWORKS.base);
13+
expect(mapChainIdToNetwork(mainnet.id)).not.toBe(EVM_NETWORKS.base);
1414
});

packages/rmrk-evm-utils/src/lib/get-is-evm-network.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect, test } from 'vitest';
2-
import { getIsEvmNetwork } from './get-is-evm-network.js';
32
import { EVM_NETWORKS } from './chain-mapping.js';
3+
import { getIsEvmNetwork } from './get-is-evm-network.js';
44

55
test('getIsEvmNetwork', async () => {
66
expect(getIsEvmNetwork('foo')).toBe(false);

packages/rmrk-evm-utils/src/lib/get-is-expected-network.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect, test } from 'vitest';
2-
import { getIsExpectedNetwork } from './get-is-expected-network.js';
32
import { EVM_NETWORKS } from './chain-mapping.js';
3+
import { getIsExpectedNetwork } from './get-is-expected-network.js';
44

55
test('getIsExpectedNetwork', async () => {
66
expect(getIsExpectedNetwork('ethereum', [EVM_NETWORKS.base])).toBe(false);

vitest.config.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ export default defineConfig({
44
test: {
55
coverage: {
66
reporter: process.env.CI ? ['lcov'] : ['text', 'json', 'html'],
7-
exclude: [
8-
'**/dist/**',
9-
'**/*.test.ts',
10-
'**/*.test-d.ts'
11-
],
7+
exclude: ['**/dist/**', '**/*.test.ts', '**/*.test-d.ts'],
128
},
139
// globalSetup: ['./packages/test/src/globalSetup.ts'],
1410
// setupFiles: ['./packages/test/src/setup.ts'],

0 commit comments

Comments
 (0)