diff --git a/scripts/getContractMeta.ts b/scripts/getContractMeta.ts index 961d5cff1..2bc31599d 100755 --- a/scripts/getContractMeta.ts +++ b/scripts/getContractMeta.ts @@ -5,7 +5,7 @@ import * as fs from "fs"; import * as path from "path"; import { format } from "prettier"; import { argv } from "process"; -import { deflateSync } from "zlib"; +import { deflateRawSync } from "zlib"; import ContractMetaSchema from "../schema/meta/v0/contract.meta.schema.json"; const readFile = (_path: string) => { @@ -125,7 +125,7 @@ const main = async () => { let contractMetaHexString = "0x"; const opmetaBytes = Uint8Array.from( - deflateSync( + deflateRawSync( format(JSON.stringify(contractMeta, null, 4), { parser: "json" }) ) ); @@ -136,7 +136,9 @@ const main = async () => { let schemaHexString = "0x"; const schemaBytes = Uint8Array.from( - deflateSync(format(JSON.stringify(schema, null, 4), { parser: "json" })) + deflateRawSync( + format(JSON.stringify(schema, null, 4), { parser: "json" }) + ) ); for (let i = 0; i < schemaBytes.length; i++) { schemaHexString = diff --git a/scripts/getOpmeta.ts b/scripts/getOpmeta.ts index 6e287e07d..068cfecd6 100755 --- a/scripts/getOpmeta.ts +++ b/scripts/getOpmeta.ts @@ -5,7 +5,7 @@ import * as fs from "fs"; import * as path from "path"; import { format } from "prettier"; import { argv } from "process"; -import { deflateSync } from "zlib"; +import { deflateRawSync } from "zlib"; import OpmetaSchema from "../schema/meta/v0/op.meta.schema.json"; const readFile = (_path: string) => { @@ -126,7 +126,7 @@ const main = async () => { let opmetaHexString = "0x"; const opmetaBytes = Uint8Array.from( - deflateSync( + deflateRawSync( format(JSON.stringify(opmetas, null, 4), { parser: "json" }) ) ); @@ -137,7 +137,9 @@ const main = async () => { let schemaHexString = "0x"; const schemaBytes = Uint8Array.from( - deflateSync(format(JSON.stringify(schema, null, 4), { parser: "json" })) + deflateRawSync( + format(JSON.stringify(schema, null, 4), { parser: "json" }) + ) ); for (let i = 0; i < schemaBytes.length; i++) { schemaHexString = diff --git a/scripts/getRainContractMeta.ts b/scripts/getRainContractMeta.ts index 001dfc38f..9f9fd7052 100755 --- a/scripts/getRainContractMeta.ts +++ b/scripts/getRainContractMeta.ts @@ -4,7 +4,7 @@ import * as fs from "fs"; import * as path from "path"; import { format } from "prettier"; import { argv } from "process"; -import { deflateSync } from "zlib"; +import { deflateRawSync } from "zlib"; import ContractMetaSchema from "../schema/meta/v0/contract.meta.schema.json"; import FlowERC20 from "../contracts/flow/erc20/FlowERC20.meta.json"; import FlowERC721 from "../contracts/flow/erc721/FlowERC721.meta.json"; @@ -109,7 +109,7 @@ const main = async () => { let contractMetaHexString = "0x"; const opmetaBytes = Uint8Array.from( - deflateSync( + deflateRawSync( format(JSON.stringify(contractMeta, null, 4), { parser: "json" }) ) ); @@ -120,7 +120,9 @@ const main = async () => { let schemaHexString = "0x"; const schemaBytes = Uint8Array.from( - deflateSync(format(JSON.stringify(schema, null, 4), { parser: "json" })) + deflateRawSync( + format(JSON.stringify(schema, null, 4), { parser: "json" }) + ) ); for (let i = 0; i < schemaBytes.length; i++) { schemaHexString = diff --git a/scripts/getRainterpreterOpmeta.ts b/scripts/getRainterpreterOpmeta.ts index 417fd3349..600f76e88 100755 --- a/scripts/getRainterpreterOpmeta.ts +++ b/scripts/getRainterpreterOpmeta.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; import * as path from "path"; import { argv } from "process"; -import { deflateSync } from "zlib"; +import { deflateRawSync } from "zlib"; import { format } from "prettier"; import OpmetaSchema from "../schema/meta/v0/op.meta.schema.json"; import { rainterpreterOpmeta } from "../utils/meta/op/allStandardOpMeta"; @@ -38,7 +38,7 @@ const main = async () => { } else { let opmetaHexString = "0x"; const opmetaBytes = Uint8Array.from( - deflateSync( + deflateRawSync( format(JSON.stringify(rainterpreterOpmeta, null, 4), { parser: "json" }) ) ); @@ -49,7 +49,7 @@ const main = async () => { let schemaHexString = "0x"; const schemaBytes = Uint8Array.from( - deflateSync( + deflateRawSync( format(JSON.stringify(OpmetaSchema, null, 4), { parser: "json" }) ) ); diff --git a/utils/meta/general.ts b/utils/meta/general.ts index fb4f419d3..33a15d3e9 100644 --- a/utils/meta/general.ts +++ b/utils/meta/general.ts @@ -3,7 +3,7 @@ import fs from "fs"; import { resolve } from "path"; import { format } from "prettier"; import stringMath from "string-math"; -import { deflateSync, inflateSync } from "zlib"; +import { deflateRawSync, inflateRawSync } from "zlib"; import { arrayify, BytesLike, isBytesLike } from "ethers/lib/utils"; /** @@ -321,7 +321,7 @@ export const metaFromBytes = ( export const deflateJson = (data_: any): string => { const content = format(JSON.stringify(data_, null, 4), { parser: "json" }); - return "0x" + deflateSync(content).toString("hex"); + return "0x" + deflateRawSync(content).toString("hex"); }; /** @@ -334,5 +334,5 @@ export const deflateJson = (data_: any): string => { export const inflateJson = (bytes: BytesLike): string => { if (!isBytesLike(bytes)) throw new Error("invalid bytes"); const _uint8Arr = arrayify(bytes, { allowMissingPrefix: true }); - return format(inflateSync(_uint8Arr).toString(), { parser: "json" }); + return format(inflateRawSync(_uint8Arr).toString(), { parser: "json" }); }; diff --git a/utils/meta/op/allStandardOpMeta.ts b/utils/meta/op/allStandardOpMeta.ts index 4b60b7796..a34481b5e 100644 --- a/utils/meta/op/allStandardOpMeta.ts +++ b/utils/meta/op/allStandardOpMeta.ts @@ -1,6 +1,6 @@ import OpMetaSchema from "../../../schema/meta/v0/op.meta.schema.json"; import path from "path"; -import { deflateSync } from "zlib"; +import { deflateRawSync } from "zlib"; import fs from "fs"; import { resolve } from "path"; import { format } from "prettier"; @@ -83,7 +83,7 @@ export const getRainterpreterOpMetaBytes = (): string => { if (!validateMeta(rainterpreterOpmeta, OpMetaSchema)) throw new Error("invalid op meta"); const opmetaBytes = Uint8Array.from( - deflateSync( + deflateRawSync( format(JSON.stringify(rainterpreterOpmeta, null, 4), { parser: "json" }) ) );