diff --git a/src/assets/doc_output.json b/src/assets/doc_output.json
index 86a61b1..88541c3 100644
--- a/src/assets/doc_output.json
+++ b/src/assets/doc_output.json
@@ -154,6 +154,16 @@
},
"type": "string",
"description": "Labelhash(v1) /Namehash(v2) of your ENS name.\n\nMore: https://docs.ens.domains/contract-api-reference/name-processing#hashing-names"
+ },
+ {
+ "name": "res",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "$ref": "#/components/schemas/res"
+ },
+ "type": "string",
+ "description": "Resolution option for the rasterization. Available options: low (default) | high"
}
],
"responses": {
@@ -405,6 +415,10 @@
"type": "string",
"example": "Token ID of NFT"
},
+ "res": {
+ "type": "string",
+ "example": "Resolution query parameter for rasterization"
+ },
"reference_url": {
"type": "string",
"example": "Marketplace URL of NFT"
@@ -526,6 +540,13 @@
"name": "tokenId"
}
},
+ "res": {
+ "type": "string",
+ "example": "high",
+ "xml": {
+ "name": "res"
+ }
+ },
"networkName": {
"description": "Name of the chain to query for.",
"type": "string",
diff --git a/src/assets/logo.svg b/src/assets/logo.svg
index 8569225..dcdf130 100644
--- a/src/assets/logo.svg
+++ b/src/assets/logo.svg
@@ -1,58 +1,6 @@
-
-
+
diff --git a/src/controller/ensRasterize.ts b/src/controller/ensRasterize.ts
index 5d0611e..2778cf7 100644
--- a/src/controller/ensRasterize.ts
+++ b/src/controller/ensRasterize.ts
@@ -8,8 +8,10 @@ export async function ensRasterize(req: Request, res: Response) {
// #swagger.parameters['{}'] = { name: 'contractAddress', description: 'Contract address which stores the NFT indicated by the tokenId', schema: { $ref: '#/definitions/contractAddress' } }
// #swagger.parameters['tokenId'] = { type: 'string', description: 'Labelhash(v1) /Namehash(v2) of your ENS name.\n\nMore: https://docs.ens.domains/contract-api-reference/name-processing#hashing-names', schema: { $ref: '#/definitions/tokenId' } }
const { contractAddress, networkName, tokenId } = req.params;
+ // limit resolution param to static options
+ const resolution = req.query.res === 'high' ? 'high' : 'low';
try {
- const raster = await rasterize(contractAddress, networkName, tokenId);
+ const raster = await rasterize(contractAddress, networkName, tokenId, resolution);
const base64 = raster.replace('data:image/png;base64,', '');
const buffer = Buffer.from(base64, 'base64');
/* #swagger.responses[200] = {
diff --git a/src/service/rasterize.ts b/src/service/rasterize.ts
index f27b02e..9c7a1cf 100644
--- a/src/service/rasterize.ts
+++ b/src/service/rasterize.ts
@@ -3,16 +3,19 @@ import { GoogleAuth } from 'google-auth-library';
const auth = new GoogleAuth();
const grRasterize = 'https://us-central1-ens-metadata-service.cloudfunctions.net/rasterize'
+type Resolution = 'low' | 'high';
+
export function rasterize(
contractAddress: string,
networkName: string,
- tokenId: string
+ tokenId: string,
+ resolution: Resolution
): Promise {
return new Promise(async (resolve, reject) => {
const client = await auth.getIdTokenClient(grRasterize);
client
.request({
- url: grRasterize,
+ url: `${grRasterize}?res=${resolution}`,
method: 'POST',
responseType: 'arraybuffer',
data: {