Skip to content

Commit cb6494f

Browse files
formatting
1 parent 68e24f9 commit cb6494f

File tree

5 files changed

+44
-36
lines changed

5 files changed

+44
-36
lines changed

clients/js/src/decorator.ts

+27-25
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export interface DasApiInterface {
9999
function cleanInput<T extends Record<string, unknown>>(obj: T): Partial<T> {
100100
return Object.fromEntries(
101101
Object.entries(obj).filter(
102-
([_, value]) => value !== null && (typeof value !== 'object' || (value && Object.keys(value).length > 0))
102+
([_, value]) =>
103+
value !== null &&
104+
(typeof value !== 'object' || (value && Object.keys(value).length > 0))
103105
)
104106
) as Partial<T>;
105107
}
@@ -184,10 +186,10 @@ export const createDasApiDecorator = (
184186
displayOptions: input.displayOptions ?? {},
185187
cursor: input.cursor ?? null,
186188
});
187-
const assetList = await rpc.call<DasApiAssetList | null, typeof cleanedInput>(
188-
'getAssetsByAuthority',
189-
cleanedInput
190-
);
189+
const assetList = await rpc.call<
190+
DasApiAssetList | null,
191+
typeof cleanedInput
192+
>('getAssetsByAuthority', cleanedInput);
191193
if (!assetList) {
192194
throw new DasApiError(
193195
`No assets found for authority: ${input.authority}`
@@ -208,10 +210,10 @@ export const createDasApiDecorator = (
208210
displayOptions: input.displayOptions ?? {},
209211
cursor: input.cursor ?? null,
210212
});
211-
const assetList = await rpc.call<DasApiAssetList | null, typeof cleanedInput>(
212-
'getAssetsByCreator',
213-
cleanedInput
214-
);
213+
const assetList = await rpc.call<
214+
DasApiAssetList | null,
215+
typeof cleanedInput
216+
>('getAssetsByCreator', cleanedInput);
215217
if (!assetList) {
216218
throw new DasApiError(`No assets found for creator: ${input.creator}`);
217219
}
@@ -230,10 +232,10 @@ export const createDasApiDecorator = (
230232
displayOptions: input.displayOptions ?? {},
231233
cursor: input.cursor ?? null,
232234
});
233-
const assetList = await rpc.call<DasApiAssetList | null, typeof cleanedInput>(
234-
'getAssetsByGroup',
235-
cleanedInput
236-
);
235+
const assetList = await rpc.call<
236+
DasApiAssetList | null,
237+
typeof cleanedInput
238+
>('getAssetsByGroup', cleanedInput);
237239
if (!assetList) {
238240
throw new DasApiError(
239241
`No assets found for group: ${input.groupKey} => ${input.groupValue}`
@@ -253,10 +255,10 @@ export const createDasApiDecorator = (
253255
displayOptions: input.displayOptions ?? {},
254256
cursor: input.cursor ?? null,
255257
});
256-
const assetList = await rpc.call<DasApiAssetList | null, typeof cleanedInput>(
257-
'getAssetsByOwner',
258-
cleanedInput
259-
);
258+
const assetList = await rpc.call<
259+
DasApiAssetList | null,
260+
typeof cleanedInput
261+
>('getAssetsByOwner', cleanedInput);
260262
if (!assetList) {
261263
throw new DasApiError(`No assets found for owner: ${input.owner}`);
262264
}
@@ -295,10 +297,10 @@ export const createDasApiDecorator = (
295297
displayOptions: input.displayOptions ?? {},
296298
tokenType: input.tokenType ?? null,
297299
});
298-
const assetList = await rpc.call<DasApiAssetList | null, typeof cleanedInput>(
299-
'searchAssets',
300-
cleanedInput
301-
);
300+
const assetList = await rpc.call<
301+
DasApiAssetList | null,
302+
typeof cleanedInput
303+
>('searchAssets', cleanedInput);
302304
if (!assetList) {
303305
throw new DasApiError('No assets found for the given search criteria');
304306
}
@@ -317,10 +319,10 @@ export const createDasApiDecorator = (
317319
cursor: input.cursor ?? null,
318320
sortDirection: input.sort_direction ?? null,
319321
});
320-
const signatures = await rpc.call<GetAssetSignaturesRpcResponse | null, typeof cleanedInput>(
321-
'getAssetSignaturesV2',
322-
cleanedInput
323-
);
322+
const signatures = await rpc.call<
323+
GetAssetSignaturesRpcResponse | null,
324+
typeof cleanedInput
325+
>('getAssetSignaturesV2', cleanedInput);
324326
if (!signatures) {
325327
const identifier =
326328
'assetId' in input

clients/js/test/getAsset.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
7979
assetId,
8080
displayOptions: { showUnverifiedCollections: false },
8181
});
82-
82+
8383
t.like(asset, <DasApiAsset>{
8484
interface: 'V1_NFT',
8585
id: assetId,

clients/js/test/getAssetsByCreator.test.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
4343
const assetWithUnverifiedCreator = assets.items.find((asset) =>
4444
asset.creators.some((creator) => creator.verified === false)
4545
);
46-
t.truthy(assetWithUnverifiedCreator, 'Expected to find at least one asset with an unverified creator');
46+
t.truthy(
47+
assetWithUnverifiedCreator,
48+
'Expected to find at least one asset with an unverified creator'
49+
);
4750
});
4851

4952
test(`it can fetch assets by creator limiting to verified creators (${endpoint.name})`, async (t) => {
@@ -111,7 +114,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
111114
showUnverifiedCollections: false,
112115
},
113116
});
114-
console.log(JSON.stringify(assets, null, 2))
117+
console.log(JSON.stringify(assets, null, 2));
115118
// Then we expect to find assets.
116119
t.true(assets.items.length > 1);
117120

@@ -124,7 +127,10 @@ console.log(JSON.stringify(assets, null, 2))
124127
asset.grouping?.filter((group) => group.group_key === 'collection') ??
125128
[];
126129
collectionGroups.forEach((group) => {
127-
t.true(group.verified !== false, 'Expected all collection groups to be verified or have no verified field');
130+
t.true(
131+
group.verified !== false,
132+
'Expected all collection groups to be verified or have no verified field'
133+
);
128134
});
129135
});
130136
});

clients/js/test/getAssetsByGroup.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
7676
displayOptions: {
7777
showUnverifiedCollections: true,
7878
},
79-
8079
});
8180

82-
8381
// And at least one asset should have an unverified collection
8482
const assetWithUnverifiedCollection = assets.items.find((asset) =>
8583
asset.grouping?.some(
@@ -99,9 +97,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
9997
// Given a group (key, value) pair.
10098
const umi = createUmi(endpoint.url);
10199
const groupKey = 'collection';
102-
const groupValue = publicKey(
103-
'SMBtHCCC6RYRutFEPb4gZqeBLUZbMNhRKaMKZZLHi7W'
104-
);
100+
const groupValue = publicKey('SMBtHCCC6RYRutFEPb4gZqeBLUZbMNhRKaMKZZLHi7W');
105101

106102
// When we fetch the asset using the group information with display options.
107103
const assets = await umi.rpc.getAssetsByGroup({

clients/js/test/searchAssets.test.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
1515
const assets = await umi.rpc.searchAssets({
1616
owner: publicKey('9Qo4631XNdLYVUw1S1iBhDmu1DtcPwHqrg5ZjPbzUqGQ'),
1717
compressed: true,
18-
jsonUri: "https://example.com/my-nft.json"
18+
jsonUri: 'https://example.com/my-nft.json',
1919
});
2020

2121
// Then we expect to find an asset.
@@ -141,6 +141,10 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
141141
);
142142

143143
t.truthy(specificAsset, 'Expected to find the specific asset');
144-
t.is(specificAsset?.grouping.length, 0, 'Expected grouping array to be empty');
144+
t.is(
145+
specificAsset?.grouping.length,
146+
0,
147+
'Expected grouping array to be empty'
148+
);
145149
});
146150
});

0 commit comments

Comments
 (0)