@zoralabs/protocol-sdk 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +12 -0
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.cjs +2023 -431
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2001 -412
- package/dist/index.js.map +1 -1
- package/dist/ipfs/arweave.d.ts +3 -0
- package/dist/ipfs/arweave.d.ts.map +1 -0
- package/dist/ipfs/gateway.d.ts +4 -0
- package/dist/ipfs/gateway.d.ts.map +1 -0
- package/dist/ipfs/index.d.ts +4 -0
- package/dist/ipfs/index.d.ts.map +1 -0
- package/dist/ipfs/ipfs.d.ts +5 -0
- package/dist/ipfs/ipfs.d.ts.map +1 -0
- package/dist/ipfs/mimeTypes.d.ts +25 -0
- package/dist/ipfs/mimeTypes.d.ts.map +1 -0
- package/dist/ipfs/text-metadata.d.ts +5 -0
- package/dist/ipfs/text-metadata.d.ts.map +1 -0
- package/dist/ipfs/token-metadata.d.ts +14 -0
- package/dist/ipfs/token-metadata.d.ts.map +1 -0
- package/dist/ipfs/types.d.ts +49 -0
- package/dist/ipfs/types.d.ts.map +1 -0
- package/dist/mint/mint-client.d.ts +28 -4071
- package/dist/mint/mint-client.d.ts.map +1 -1
- package/dist/mint/mint-queries.d.ts +38 -0
- package/dist/mint/mint-queries.d.ts.map +1 -0
- package/dist/mint/mint-transactions.d.ts +20 -0
- package/dist/mint/mint-transactions.d.ts.map +1 -0
- package/dist/mint/subgraph-mint-getter.d.ts +14 -7
- package/dist/mint/subgraph-mint-getter.d.ts.map +1 -1
- package/dist/mint/subgraph-queries.d.ts +55 -0
- package/dist/mint/subgraph-queries.d.ts.map +1 -0
- package/dist/mint/types.d.ts +117 -19
- package/dist/mint/types.d.ts.map +1 -1
- package/dist/mint/utils.d.ts +2 -0
- package/dist/mint/utils.d.ts.map +1 -0
- package/dist/mints/mints-contracts.d.ts +3 -4494
- package/dist/mints/mints-contracts.d.ts.map +1 -1
- package/dist/premint/conversions.d.ts +12 -15
- package/dist/premint/conversions.d.ts.map +1 -1
- package/dist/premint/premint-api-client.d.ts +14 -11
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +17 -6
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +1 -1
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/sdk.d.ts +4 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +10 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/constants.ts +0 -36
- package/src/create/1155-create-helper.test.ts +9 -7
- package/src/index.ts +2 -0
- package/src/ipfs/arweave.ts +5 -0
- package/src/ipfs/gateway.ts +48 -0
- package/src/ipfs/index.ts +7 -0
- package/src/ipfs/ipfs.ts +82 -0
- package/src/ipfs/mimeTypes.ts +141 -0
- package/src/ipfs/text-metadata.ts +128 -0
- package/src/ipfs/token-metadata.ts +99 -0
- package/src/ipfs/types.ts +54 -0
- package/src/mint/mint-client.test.ts +96 -47
- package/src/mint/mint-client.ts +75 -343
- package/src/mint/mint-queries.ts +320 -0
- package/src/mint/mint-transactions.ts +253 -0
- package/src/mint/subgraph-mint-getter.ts +216 -123
- package/src/mint/subgraph-queries.ts +170 -0
- package/src/mint/types.ts +140 -23
- package/src/mint/utils.ts +14 -0
- package/src/premint/conversions.ts +26 -2
- package/src/premint/premint-api-client.ts +48 -16
- package/src/premint/premint-client.test.ts +29 -23
- package/src/premint/premint-client.ts +73 -37
- package/src/premint/preminter.ts +2 -3
- package/src/sdk.ts +7 -4
- package/src/types.ts +18 -0
- package/src/utils.ts +29 -28
- package/test-integration/setup-test-contracts.ts +96 -0
- package/test-integration/premint-client.test.ts +0 -148
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arweave.d.ts","sourceRoot":"","sources":["../../src/ipfs/arweave.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,QAAQ,MAAM,EAAE,CAAC;AAE1C,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEpE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function arweaveGatewayUrl(normalizedArweaveUrl: string | null): string | null;
|
|
2
|
+
export declare function ipfsGatewayUrl(url: string | null): string | null;
|
|
3
|
+
export declare function getFetchableUrl(uri: string | null | undefined): string | null;
|
|
4
|
+
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/ipfs/gateway.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,iBAIpE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,iBAOhD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAyB7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ipfs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type IPFSUrl = `ipfs://${string}`;
|
|
2
|
+
export declare function isCID(str: string | null | undefined): boolean;
|
|
3
|
+
export declare function normalizeIPFSUrl(url: string | null | undefined): IPFSUrl | null;
|
|
4
|
+
export declare function isNormalizeableIPFSUrl(url: string | null | undefined): boolean;
|
|
5
|
+
//# sourceMappingURL=ipfs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipfs.d.ts","sourceRoot":"","sources":["../../src/ipfs/ipfs.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,UAAU,MAAM,EAAE,CAAC;AAEzC,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAU7D;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC7B,OAAO,GAAG,IAAI,CAgChB;AA2BD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC7B,OAAO,CAET"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const TEXT_PLAIN = "text/plain";
|
|
2
|
+
export declare const isImage: (mimeType: string | null | undefined) => boolean;
|
|
3
|
+
export declare enum MediaType {
|
|
4
|
+
CSV = "CSV",
|
|
5
|
+
NUMBERS = "NUMBERS",
|
|
6
|
+
EXCEL = "EXCEL",
|
|
7
|
+
IMAGE = "IMAGE",
|
|
8
|
+
VIDEO = "VIDEO",
|
|
9
|
+
AUDIO = "AUDIO",
|
|
10
|
+
TIFF = "TIFF",
|
|
11
|
+
TEXT = "TEXT",
|
|
12
|
+
PDF = "PDF",
|
|
13
|
+
MODEL = "MODEL",
|
|
14
|
+
HTML = "HTML",
|
|
15
|
+
ZIP = "ZIP",
|
|
16
|
+
UNKNOWN = "UNKNOWN"
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_THUMBNAIL_CID_HASHES: {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const JSON_MIME_TYPE = "application/json";
|
|
22
|
+
/** Return a MediaType for the given mime type. If mime type is unknown you can provide a filename as a fallback, where the type will be guessed based on extension. */
|
|
23
|
+
export declare function mimeTypeToMedia(mimeType?: string | null): MediaType;
|
|
24
|
+
export declare function getMimeType(uri?: string): Promise<string | null | undefined>;
|
|
25
|
+
//# sourceMappingURL=mimeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mimeTypes.d.ts","sourceRoot":"","sources":["../../src/ipfs/mimeTypes.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,eAAe,CAAC;AAevC,eAAO,MAAM,OAAO,aAAc,MAAM,GAAG,IAAI,GAAG,SAAS,YAG1D,CAAC;AAEF,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,4BAA4B,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAYjE,CAAC;AA2BF,eAAO,MAAM,cAAc,qBAAqB,CAAC;AA4CjD,uKAAuK;AACvK,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,aAOvD;AAED,wBAAsB,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,sCAM7C"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TextMetadataFiles } from "./types";
|
|
2
|
+
/** For text nfts, this will generate files that are needed for the metadata json, including the txt.file containing the text, and a thumbnail image containing a preview of the text
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateTextNftMetadataFiles(text: string): Promise<TextMetadataFiles>;
|
|
5
|
+
//# sourceMappingURL=text-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-metadata.d.ts","sourceRoot":"","sources":["../../src/ipfs/text-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAiH5C;GACG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAU5B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MakeMediaMetadataParams, MakeTextMetadataParams, TokenMetadataJson } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Takes properties for a text based nft and formats it as proper json metadata
|
|
4
|
+
* for the token, which should be uploaded to IPFS.
|
|
5
|
+
* @param parameters - The parameters to format into metadata {@link MakeTextMetadataParams}
|
|
6
|
+
*/
|
|
7
|
+
export declare const makeTextTokenMetadata: (parameters: MakeTextMetadataParams) => TokenMetadataJson;
|
|
8
|
+
/**
|
|
9
|
+
* Takes properties for a media based nft (video, image, etc) and formats it as proper json metadata
|
|
10
|
+
* for the token, which should be uploaded to IPFS.
|
|
11
|
+
* @param parameters - The parameters to format into metadata {@link MakeMediaMetadataParams}
|
|
12
|
+
*/
|
|
13
|
+
export declare const makeMediaTokenMetadata: ({ name, description, attributes, mediaUrl, thumbnailUrl, }: MakeMediaMetadataParams) => Promise<TokenMetadataJson>;
|
|
14
|
+
//# sourceMappingURL=token-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-metadata.d.ts","sourceRoot":"","sources":["../../src/ipfs/token-metadata.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,eACpB,sBAAsB,KACjC,iBAoBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,+DAMhC,uBAAuB,KAAG,QAAQ,iBAAiB,CA4CrD,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type CreateERC1155TokenAttributes = {
|
|
2
|
+
trait_type: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export type ContractMetadataJson = {
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
image?: string;
|
|
9
|
+
};
|
|
10
|
+
export type TokenMetadataJson = {
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Primary image file */
|
|
14
|
+
image?: string;
|
|
15
|
+
animation_url?: string | null;
|
|
16
|
+
content?: {
|
|
17
|
+
mime: string;
|
|
18
|
+
uri: string;
|
|
19
|
+
} | null;
|
|
20
|
+
attributes: Array<CreateERC1155TokenAttributes>;
|
|
21
|
+
};
|
|
22
|
+
export type BaseMetadataParams = {
|
|
23
|
+
/** Token name */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Optional description */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Optional attributes to tag the token with */
|
|
28
|
+
attributes?: CreateERC1155TokenAttributes[];
|
|
29
|
+
};
|
|
30
|
+
export type MakeTextMetadataParams = BaseMetadataParams & {
|
|
31
|
+
/** Ipfs url where media is hosted */
|
|
32
|
+
textFileUrl: string;
|
|
33
|
+
/** If thumbnail was generate for text file, thumbnail image url */
|
|
34
|
+
thumbnailUrl?: string;
|
|
35
|
+
};
|
|
36
|
+
export type TextMetadataFiles = {
|
|
37
|
+
name: string;
|
|
38
|
+
/** File that holds the text, and is the primary media */
|
|
39
|
+
mediaUrlFile: File;
|
|
40
|
+
/** Thumbnail image preview of the text */
|
|
41
|
+
thumbnailFile: File;
|
|
42
|
+
};
|
|
43
|
+
export type MakeMediaMetadataParams = BaseMetadataParams & {
|
|
44
|
+
/** Ipfs url where media is hosted */
|
|
45
|
+
mediaUrl: string;
|
|
46
|
+
/** Ipfs url where thumbnail of media is hosted */
|
|
47
|
+
thumbnailUrl?: string;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
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