-
Notifications
You must be signed in to change notification settings - Fork 524
/
Copy pathnft.ts
88 lines (81 loc) · 2.05 KB
/
nft.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { OptionalPropertiesInput } from "./properties";
import {
BigNumberTransformSchema,
FileOrBufferOrStringSchema,
HexColor,
} from "./shared";
import { z } from "zod";
/**
* @internal
*/
export const BasicNFTInput = /* @__PURE__ */ (() =>
z.object({
name: z.union([z.string(), z.number()]).optional().nullable(),
description: z.string().nullable().optional().nullable(),
image: FileOrBufferOrStringSchema.nullable().optional(),
animation_url: FileOrBufferOrStringSchema.optional().nullable(),
}))();
/**
* @internal
*/
export const CommonNFTInput = /* @__PURE__ */ (() =>
BasicNFTInput.extend({
external_url: FileOrBufferOrStringSchema.nullable().optional(),
background_color: HexColor.optional().nullable(),
properties: OptionalPropertiesInput,
attributes: OptionalPropertiesInput,
}).catchall(z.union([BigNumberTransformSchema, z.unknown()])))();
/**
* @internal
*/
export const NFTInputOrUriSchema = /* @__PURE__ */ (() =>
z.union([CommonNFTInput, z.string()]))();
/**
* @internal
*/
export const CommonNFTOutput = /* @__PURE__ */ (() =>
CommonNFTInput.extend({
id: z.string(),
uri: z.string(),
image: z.string().nullable().optional(),
external_url: z.string().nullable().optional(),
animation_url: z.string().nullable().optional(),
}))();
/**
* @public
*/
export type BasicNFTInput = /* @__PURE__ */ z.input<typeof BasicNFTInput>;
/**
* @public
*/
export type NFTMetadataInput = /* @__PURE__ */ z.input<typeof CommonNFTInput>;
/**
* @public
*/
export type NFTMetadataOrUri = /* @__PURE__ */ z.input<
typeof NFTInputOrUriSchema
>;
/**
* @public
*/
export type NFTMetadata = /* @__PURE__ */ z.output<typeof CommonNFTOutput>;
/**
* @public
*/
export type NFT = {
metadata: NFTMetadata;
owner: string;
type: "ERC1155" | "ERC721" | "metaplex";
supply: string;
quantityOwned?: string;
};
/**
* @public
*/
export type NFTWithoutMetadata = {
metadata: Pick<NFTMetadata, "id">;
owner: string;
type: "ERC1155" | "ERC721" | "metaplex";
supply: string;
quantityOwned?: string;
};