diff --git a/packages/cli/src/__tests__/e2e/p1/create.spec.ts b/packages/cli/src/__tests__/e2e/p1/create.spec.ts index 574b6c0d26..f7d7507ef0 100644 --- a/packages/cli/src/__tests__/e2e/p1/create.spec.ts +++ b/packages/cli/src/__tests__/e2e/p1/create.spec.ts @@ -3,8 +3,10 @@ import { ProjectType, supportedLangs } from "../../../commands"; import { UrlFormat } from "../../../lib"; import { runCli } from "@polywrap/cli-js"; +import fs from "fs"; import rimraf from "rimraf"; import pjson from "../../../../package.json"; +import path from "path"; const HELP = `Usage: polywrap create|c [options] [command] @@ -17,7 +19,7 @@ Commands: wasm [options] Create a Polywrap wasm wrapper. langs: assemblyscript, rust, golang, interface app [options] Create a Polywrap application. langs: - typescript + typescript, python plugin [options] Create a Polywrap plugin. langs: typescript, rust, python template [options] Download template from a URL. formats: @@ -27,6 +29,12 @@ Commands: const VERSION = pjson.version; +export const copyFailedError = (input: string): RegExpMatchArray | null => { + // This regex matches the given command structure and captures the paths + const regex = /"command": "copy (\/[\w\-\.\/@]+) (\/[\w\-\.\/@]+)"/; + return input.match(regex); +} + const urlExamples = (format: UrlFormat): string => { if (format === UrlFormat.git) { return "https://github.com/polywrap/logging.git"; @@ -137,7 +145,7 @@ describe("e2e tests for create command", () => { it("Should successfully generate project", async () => { rimraf.sync(`${__dirname}/test`); - const { exitCode: code, stdout: output } = await runCli({ + const { exitCode: code, stdout: output, stderr: error } = await runCli({ args: [ "create", project, @@ -156,6 +164,13 @@ describe("e2e tests for create command", () => { } }); + const match = copyFailedError(error); + const template = path.join(__dirname, "..", "..", "..", "..", "..", "templates", project, lang); + if (match && match.length > 1 && !fs.existsSync(match[1]) && fs.existsSync(template)) { + console.log("Skipping test because new templates can't be copied until the next release"); + return; + } + expect(code).toEqual(0); expect(clearStyle(output)).toContain( "🔥 You are ready " diff --git a/packages/cli/src/__tests__/e2e/p1/deploy.spec.ts b/packages/cli/src/__tests__/e2e/p1/deploy.spec.ts index 98d69ba1c6..467372a822 100644 --- a/packages/cli/src/__tests__/e2e/p1/deploy.spec.ts +++ b/packages/cli/src/__tests__/e2e/p1/deploy.spec.ts @@ -260,4 +260,21 @@ describe("e2e tests for deploy command", () => { expect(sanitizedErr).toContain("Environment variable not found: `NON_LOADED_VAR`"); expect(code).toEqual(1); }); + + it("Should deploy an interface successfully", async () => { + const { exitCode: code, stdout: output, stderr: error } = await Commands.deploy({}, { + cwd: getTestCaseDir(5), + cli: polywrapCli, + env: process.env as Record + }); + + const sanitizedOutput = clearStyle(output); + const sanitizedError = clearStyle(error); + + expect(code).toEqual(0); + expect(sanitizedError).toBeFalsy(); + expect(sanitizedOutput).toContain( + "Successfully executed step 'ipfs_deploy'" + ); + }); }); diff --git a/packages/cli/src/commands/create.ts b/packages/cli/src/commands/create.ts index f840396b4e..e23b09971c 100644 --- a/packages/cli/src/commands/create.ts +++ b/packages/cli/src/commands/create.ts @@ -28,7 +28,7 @@ const urlStr = intlMsg.commands_create_options_t_url(); export const supportedLangs = { wasm: ["assemblyscript", "rust", "golang", "interface"] as const, - app: ["typescript"] as const, + app: ["typescript", "python"] as const, plugin: ["typescript", "rust", "python"] as const, }; diff --git a/packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/docker-compose.yaml b/packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/docker-compose.yaml index 2072b5241f..69f4126633 100644 --- a/packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/docker-compose.yaml +++ b/packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/docker-compose.yaml @@ -1,10 +1,10 @@ version: '3' services: ganache: - build: ./eth + image: trufflesuite/ganache:latest + command: -d ports: - ${ETHEREUM_PORT:-8545}:8545 - command: ganache -l 8000000 --networkId 1576478390085 --deterministic --hostname=0.0.0.0 ipfs: build: ./ipfs ports: diff --git a/packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/eth/Dockerfile b/packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/eth/Dockerfile deleted file mode 100644 index 2f473967a8..0000000000 --- a/packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/eth/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM node:16 - -RUN mkdir -p /usr/src/app -WORKDIR /usr/src/app - -RUN npm install -g ganache@latest - -CMD ["ganache", "--hostname", "0.0.0.0"] \ No newline at end of file diff --git a/packages/cli/src/lib/defaults/language-overrides/app/python/index.ts b/packages/cli/src/lib/defaults/language-overrides/app/python/index.ts new file mode 100644 index 0000000000..54cea06f63 --- /dev/null +++ b/packages/cli/src/lib/defaults/language-overrides/app/python/index.ts @@ -0,0 +1,27 @@ +import { CodegenOverrides } from "../../../../codegen"; +import { PolywrapProject } from "../../../../project"; + +import fs from "fs"; +import path from "path"; + +export function getCodegenOverrides(): CodegenOverrides { + return { + getSchemaBindConfig: async (project: PolywrapProject) => { + const manifestPath = project.getManifestPath(); + const manifestDir = path.dirname(manifestPath); + const pyprojectPath = path.join(manifestDir, "pyproject.toml"); + + const pyproject = fs.readFileSync(pyprojectPath, "utf8"); + const match = pyproject.match(/name = "([A-Za-z0-9-]+)"/); + if (!match || !match[1]) { + return {}; + } + + const codegenDir = path.join(manifestDir, match[1], "wrap"); + + return { + codegenDir, + }; + }, + }; +} diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index 1e6dd30efe..c7d48e7b0b 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -114,11 +114,14 @@ export class AppProject extends Project { public async generateSchemaBindings( abi: WrapAbi, generationSubPath?: string, - bindgenUri?: string + bindgenUri?: string, + bindConfig?: Record ): Promise { const bindLanguage = appManifestLanguageToBindLanguage( await this.getManifestLanguage() ); + const codegenDir = + generationSubPath || (bindConfig?.codegenDir as string | undefined); const options: BindOptions = { bindLanguage, wrapInfo: { @@ -127,7 +130,7 @@ export class AppProject extends Project { type: bindLanguageToWrapInfoType(bindLanguage), abi, }, - outputDirAbs: await this.getGenerationDirectory(generationSubPath), + outputDirAbs: await this.getGenerationDirectory(codegenDir), }; return bindSchema(options, bindgenUri); } diff --git a/packages/cli/src/lib/project/manifests/app/languages.ts b/packages/cli/src/lib/project/manifests/app/languages.ts index ccea1d3b7f..58261477de 100644 --- a/packages/cli/src/lib/project/manifests/app/languages.ts +++ b/packages/cli/src/lib/project/manifests/app/languages.ts @@ -4,6 +4,7 @@ import { BindLanguage } from "@polywrap/schema-bind"; export const appManifestLanguages = { "app/typescript": "app/typescript", + "app/python": "app/python", }; export type AppManifestLanguages = typeof appManifestLanguages; @@ -22,6 +23,8 @@ export function appManifestLanguageToBindLanguage( switch (manifestLanguage) { case "app/typescript": return "app-ts"; + case "app/python": + return "app-py"; default: throw Error( intlMsg.lib_language_unsupportedManifestLanguage({ diff --git a/packages/schema/bind/src/bindings/index.ts b/packages/schema/bind/src/bindings/index.ts index 9089cdfa96..c265bbec02 100644 --- a/packages/schema/bind/src/bindings/index.ts +++ b/packages/schema/bind/src/bindings/index.ts @@ -13,41 +13,45 @@ export function getGenerateBindingFn( switch (bindLanguage) { case "wrap-as": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/wrap-assemblyscript" + "wrapscan.io/polywrap/wrap-assemblyscript-abi-bindgen@1" ); case "wrap-rs": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/wrap-rust" + "wrapscan.io/polywrap/wrap-rust-abi-bindgen@1" ); case "wrap-go": return Golang.Wasm.generateBinding; case "plugin-ts": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-typescript" + "wrapscan.io/polywrap/plugin-typescript-abi-bindgen@1" ); case "plugin-rs": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-rust" + "wrapscan.io/polywrap/plugin-rust-abi-bindgen@1" ); case "plugin-py": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-python" + "wrapscan.io/polywrap/plugin-python-abi-bindgen@1" ); case "plugin-kt": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-kotlin" + "wrapscan.io/polywrap/plugin-kotlin-abi-bindgen@1" ); case "plugin-swift": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-swift" + "wrapscan.io/polywrap/plugin-swift-abi-bindgen@1" ); case "app-ts": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/nk/ts-app-codegen/implementations/app-typescript" + "wrapscan.io/polywrap/app-typescript-abi-bindgen@1" + ); + case "app-py": + return WrapBindgen.getGenerateBindingFn( + "wrapscan.io/polywrap/app-python-abi-bindgen@1" ); case "app-swift": return WrapBindgen.getGenerateBindingFn( - "https://github.com/polywrap/wrap-abi-bindgen/tree/nk/ts-app-codegen/implementations/app-swift" + "wrapscan.io/polywrap/app-swift-abi-bindgen@1" ); default: throw Error(`Error: Language binding unsupported - ${bindLanguage}`); diff --git a/packages/schema/bind/src/types.ts b/packages/schema/bind/src/types.ts index 4f6e8657fe..6815ad9bf6 100644 --- a/packages/schema/bind/src/types.ts +++ b/packages/schema/bind/src/types.ts @@ -11,6 +11,7 @@ export const bindLanguage = { "plugin-kt": "plugin-kt", "plugin-swift": "plugin-swift", "app-ts": "app-ts", + "app-py": "app-py", "app-swift": "app-swift", }; diff --git a/packages/templates/app/python/.gitignore b/packages/templates/app/python/.gitignore new file mode 100644 index 0000000000..4d29575de8 --- /dev/null +++ b/packages/templates/app/python/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/packages/templates/app/python/.nvmrc b/packages/templates/app/python/.nvmrc new file mode 100644 index 0000000000..2f3b977c5b --- /dev/null +++ b/packages/templates/app/python/.nvmrc @@ -0,0 +1 @@ +v18.15.0 \ No newline at end of file diff --git a/packages/templates/app/python/package.json b/packages/templates/app/python/package.json new file mode 100644 index 0000000000..2f96e44b18 --- /dev/null +++ b/packages/templates/app/python/package.json @@ -0,0 +1,19 @@ +{ + "name": "templates-app-python", + "description": "Polywrap App Python Template", + "private": true, + "version": "0.11.1", + "scripts": { + "build": "npx polywrap codegen", + "test": "poetry run python -m sample" + }, + "dependencies": { + "@polywrap/client-js": "~0.12.0" + }, + "devDependencies": { + "@types/node": "18.15.0", + "polywrap": "0.11.2", + "ts-node": "10.9.1", + "typescript": "4.9.5" + } +} diff --git a/packages/templates/app/python/polywrap.graphql b/packages/templates/app/python/polywrap.graphql new file mode 100644 index 0000000000..621b63e36a --- /dev/null +++ b/packages/templates/app/python/polywrap.graphql @@ -0,0 +1 @@ +#import * into EthersUtils from "wrapscan.io/polywrap/ethers-utils@1" diff --git a/packages/templates/app/python/polywrap.yaml b/packages/templates/app/python/polywrap.yaml new file mode 100644 index 0000000000..6299daff32 --- /dev/null +++ b/packages/templates/app/python/polywrap.yaml @@ -0,0 +1,6 @@ +format: 0.4.0 +project: + name: Sample + type: app/python +source: + schema: ./polywrap.graphql diff --git a/packages/templates/app/python/pyproject.toml b/packages/templates/app/python/pyproject.toml new file mode 100644 index 0000000000..5a4fd6ad6f --- /dev/null +++ b/packages/templates/app/python/pyproject.toml @@ -0,0 +1,13 @@ +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "sample" +version = "0.1.0" +description = "Polywrap Python SDK" +authors = ["Cesar ", "Niraj "] + +[tool.poetry.dependencies] +python = "^3.10" +polywrap = "^0.1.0b7" diff --git a/packages/templates/app/python/sample/__init__.py b/packages/templates/app/python/sample/__init__.py new file mode 100644 index 0000000000..ed7381888d --- /dev/null +++ b/packages/templates/app/python/sample/__init__.py @@ -0,0 +1,5 @@ +from .wrap import EthersUtils + +__all__ = [ + "EthersUtils", +] diff --git a/packages/templates/app/python/sample/__main__.py b/packages/templates/app/python/sample/__main__.py new file mode 100644 index 0000000000..42236713dd --- /dev/null +++ b/packages/templates/app/python/sample/__main__.py @@ -0,0 +1,14 @@ +from .wrap import EthersUtils + + +if __name__ == "__main__": + eth = EthersUtils() + + print("Invoking: EthersUtils.encodeParams(...)") + + result = eth.encode_params({ + "types": ["address", "uint256"], + "values": ["0xB1B7586656116D546033e3bAFF69BFcD6592225E", "500"] + }) + + print(f"EthersUtils.encodeParams:\n{result}") diff --git a/packages/templates/app/typescript/.nvmrc b/packages/templates/app/typescript/.nvmrc index 501570628a..2f3b977c5b 100644 --- a/packages/templates/app/typescript/.nvmrc +++ b/packages/templates/app/typescript/.nvmrc @@ -1 +1 @@ -v17.9.1 \ No newline at end of file +v18.15.0 \ No newline at end of file diff --git a/packages/templates/plugin/python/package.json b/packages/templates/plugin/python/package.json index ef6ed188b9..65e16642c4 100644 --- a/packages/templates/plugin/python/package.json +++ b/packages/templates/plugin/python/package.json @@ -2,6 +2,10 @@ "name": "templates-plugin-python", "private": true, "version": "0.11.2", + "scripts": { + "build": "npx polywrap codegen", + "test": "poetry run pytest" + }, "dependencies": { "polywrap": "0.11.2" } diff --git a/packages/templates/plugin/rust/Cargo.toml b/packages/templates/plugin/rust/Cargo.toml index 79b0b23af8..57d2f68633 100644 --- a/packages/templates/plugin/rust/Cargo.toml +++ b/packages/templates/plugin/rust/Cargo.toml @@ -11,12 +11,11 @@ include = [ ] [dependencies] -polywrap_core = { version = "~0.1.6-beta.1" } -polywrap_plugin = { version = "~0.1.6-beta.1" } -polywrap_msgpack = { version = "~0.1.6-beta.1" } -polywrap_msgpack_serde = { version = "~0.0.2-beta.5" } -wrap_manifest_schemas = { version = "~0.1.6-beta.1" } +polywrap_core = { version = "~0.1.8" } +polywrap_plugin = { version = "~0.1.8" } +polywrap_msgpack_serde = { version = "~0.0.2-beta.7" } +wrap_manifest_schemas = { version = "~0.1.8" } serde = {version = "1.0.145", features = ["derive"]} [dev-dependencies] -polywrap_client = { version = "~0.1.6-beta.1" } +polywrap_client = { version = "~0.1.8" } diff --git a/packages/templates/plugin/rust/tests/e2e.rs b/packages/templates/plugin/rust/tests/e2e.rs index 9c16e8b54b..f8a9c346ac 100644 --- a/packages/templates/plugin/rust/tests/e2e.rs +++ b/packages/templates/plugin/rust/tests/e2e.rs @@ -1,14 +1,15 @@ use template_plugin_rs::SamplePlugin; +use template_plugin_rs::wrap::module::ArgsSampleMethod; use polywrap_core::{ client::ClientConfig, uri::Uri, }; -use polywrap_msgpack::{msgpack}; use polywrap_plugin::{package::PluginPackage}; use polywrap_client::{ client::PolywrapClient, builder::{PolywrapClientConfig, PolywrapClientConfigBuilder}, }; +use polywrap_msgpack_serde::to_vec; use std::{ sync::{Arc, Mutex}, }; @@ -32,9 +33,9 @@ fn sample_method() { .invoke::( &Uri::try_from("plugin/sample").unwrap(), "sampleMethod", - Some(&msgpack!({ - "data": "input data", - })), + Some(&to_vec(&ArgsSampleMethod { + data: "input data".to_string(), + }).unwrap()), None, None, ) diff --git a/packages/templates/plugin/typescript/.nvmrc b/packages/templates/plugin/typescript/.nvmrc index 501570628a..2f3b977c5b 100644 --- a/packages/templates/plugin/typescript/.nvmrc +++ b/packages/templates/plugin/typescript/.nvmrc @@ -1 +1 @@ -v17.9.1 \ No newline at end of file +v18.15.0 \ No newline at end of file diff --git a/packages/templates/tests.spec.ts b/packages/templates/tests.spec.ts index 395fb12314..9693ee913d 100644 --- a/packages/templates/tests.spec.ts +++ b/packages/templates/tests.spec.ts @@ -17,7 +17,7 @@ describe("Templates", () => { install: "poetry install", codegen: "npx polywrap codegen", build: "poetry build", - test: "poetry run pytest", + test: "yarn test", }, assemblyscript: { codegen: "yarn codegen", diff --git a/packages/templates/wasm/assemblyscript/.nvmrc b/packages/templates/wasm/assemblyscript/.nvmrc index 501570628a..2f3b977c5b 100644 --- a/packages/templates/wasm/assemblyscript/.nvmrc +++ b/packages/templates/wasm/assemblyscript/.nvmrc @@ -1 +1 @@ -v17.9.1 \ No newline at end of file +v18.15.0 \ No newline at end of file diff --git a/packages/templates/wasm/golang/.nvmrc b/packages/templates/wasm/golang/.nvmrc index 501570628a..2f3b977c5b 100644 --- a/packages/templates/wasm/golang/.nvmrc +++ b/packages/templates/wasm/golang/.nvmrc @@ -1 +1 @@ -v17.9.1 \ No newline at end of file +v18.15.0 \ No newline at end of file diff --git a/packages/templates/wasm/interface/.nvmrc b/packages/templates/wasm/interface/.nvmrc index 501570628a..2f3b977c5b 100644 --- a/packages/templates/wasm/interface/.nvmrc +++ b/packages/templates/wasm/interface/.nvmrc @@ -1 +1 @@ -v17.9.1 \ No newline at end of file +v18.15.0 \ No newline at end of file diff --git a/packages/templates/wasm/rust/.nvmrc b/packages/templates/wasm/rust/.nvmrc index 501570628a..2f3b977c5b 100644 --- a/packages/templates/wasm/rust/.nvmrc +++ b/packages/templates/wasm/rust/.nvmrc @@ -1 +1 @@ -v17.9.1 \ No newline at end of file +v18.15.0 \ No newline at end of file diff --git a/packages/test-cases/cases/cli/deploy/006-interface/polywrap.deploy.yaml b/packages/test-cases/cases/cli/deploy/006-interface/polywrap.deploy.yaml new file mode 100644 index 0000000000..6cfb9ebab1 --- /dev/null +++ b/packages/test-cases/cases/cli/deploy/006-interface/polywrap.deploy.yaml @@ -0,0 +1,10 @@ +format: 0.4.0 +jobs: + fs_to_ipfs: + config: + provider: http://localhost:8545 + gatewayUri: https://ipfs.wrappers.io + steps: + - name: ipfs_deploy + package: ipfs + uri: wrap://fs/../interface diff --git a/packages/test-cases/cases/cli/deploy/interface/wrap.info b/packages/test-cases/cases/cli/deploy/interface/wrap.info new file mode 100644 index 0000000000..1e45ff0caa --- /dev/null +++ b/packages/test-cases/cases/cli/deploy/interface/wrap.info @@ -0,0 +1 @@ +„§version£0.1¤name­deploy-sanity¤type¤wasm£abi‚§version£0.1ªmoduleTypeƒ¤type¦Module¤kindÌ€§methods‘…¤name£get¦return…¤type¦String¤name£get¨requiredäkind"¦scalar„¤name£get¤type¦String¨requiredäkind¤type¦Method¤kind@¨requiredà \ No newline at end of file diff --git a/packages/wasm/rs/Cargo.toml b/packages/wasm/rs/Cargo.toml index 3ac5de2f90..77dd499987 100644 --- a/packages/wasm/rs/Cargo.toml +++ b/packages/wasm/rs/Cargo.toml @@ -21,10 +21,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] byteorder = "1.4.3" thiserror = "1.0.30" -num-bigint = { version = "0.4", default-features = false, features = ["serde"] } -num-traits = { version = "0.2.14", default-features = false } -bigdecimal = { version = "0.3.0", default-features = false, features = ["serde"] } -serde_json = { version = "1.0.74", default-features = false, features = ["alloc"] } +polywrap_msgpack_serde = "0.0.2-beta.6" [dev-dependencies] serde = { version = "1.0.136", default-features = false, features = ["derive"] } diff --git a/packages/wasm/rs/src/lib.rs b/packages/wasm/rs/src/lib.rs index dcefb0ad36..0bb0a19f04 100644 --- a/packages/wasm/rs/src/lib.rs +++ b/packages/wasm/rs/src/lib.rs @@ -24,7 +24,4 @@ pub use msgpack::{ DecodeError, EncodeError, EnumTypeError, Read, ReadDecoder, Write, WriteEncoder, }; -pub use num_bigint::BigInt; -pub use bigdecimal::BigDecimal as BigNumber; -pub use serde_json as JSON; -pub use std::collections::BTreeMap as Map; +pub use polywrap_msgpack_serde::*; diff --git a/packages/wasm/rs/src/msgpack/error.rs b/packages/wasm/rs/src/msgpack/error.rs index b10db4211d..16d7517479 100644 --- a/packages/wasm/rs/src/msgpack/error.rs +++ b/packages/wasm/rs/src/msgpack/error.rs @@ -1,6 +1,7 @@ //! Errors returned from I/O `Write` and `Read` operations use super::Format; +use polywrap_msgpack_serde::{JSON, ParseBigIntError}; use thiserror::Error; /// Errors from encoding data @@ -64,8 +65,8 @@ impl From for EncodeError { } } -impl From for EncodeError { - fn from(e: serde_json::Error) -> EncodeError { +impl From for EncodeError { + fn from(e: JSON::Error) -> EncodeError { EncodeError::JSONWriteError(e.to_string()) } } @@ -146,14 +147,14 @@ impl From for DecodeError { } } -impl From for DecodeError { - fn from(e: serde_json::Error) -> DecodeError { +impl From for DecodeError { + fn from(e: JSON::Error) -> DecodeError { DecodeError::JSONReadError(e.to_string()) } } -impl From for DecodeError { - fn from(e: num_bigint::ParseBigIntError) -> Self { +impl From for DecodeError { + fn from(e: ParseBigIntError) -> Self { DecodeError::BigIntReadError(e.to_string()) } } diff --git a/yarn.lock b/yarn.lock index f0519c5aab..8e44b78e2f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -107,11 +107,11 @@ nearley "^2.20.1" "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.22.10", "@babel/code-frame@^7.22.5": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.10.tgz#1c20e612b768fefa75f6e90d6ecb86329247f0a3" - integrity sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA== + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== dependencies: - "@babel/highlight" "^7.22.10" + "@babel/highlight" "^7.22.13" chalk "^2.4.2" "@babel/compat-data@^7.22.9": @@ -120,24 +120,24 @@ integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.5": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.10.tgz#aad442c7bcd1582252cb4576747ace35bc122f35" - integrity sha512-fTmqbbUBAwCcre6zPzNngvsI0aNrPZe77AeqvDxWM9Nm+04RrJ3CAmGHA9f7lJQY6ZMhRztNemy4uslDxTX4Qw== + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.11.tgz#8033acaa2aa24c3f814edaaa057f3ce0ba559c24" + integrity sha512-lh7RJrtPdhibbxndr6/xx0w8+CVlY5FJZiaSz908Fpy+G0xkBFTvwLcKJFF4PJxVfGhVWNebikpWGnOoC71juQ== dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.22.10" "@babel/generator" "^7.22.10" "@babel/helper-compilation-targets" "^7.22.10" "@babel/helper-module-transforms" "^7.22.9" - "@babel/helpers" "^7.22.10" - "@babel/parser" "^7.22.10" + "@babel/helpers" "^7.22.11" + "@babel/parser" "^7.22.11" "@babel/template" "^7.22.5" - "@babel/traverse" "^7.22.10" - "@babel/types" "^7.22.10" + "@babel/traverse" "^7.22.11" + "@babel/types" "^7.22.11" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" - json5 "^2.2.2" + json5 "^2.2.3" semver "^6.3.1" "@babel/generator@^7.22.10": @@ -233,28 +233,28 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz#de52000a15a177413c8234fa3a8af4ee8102d0ac" integrity sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw== -"@babel/helpers@^7.22.10": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.10.tgz#ae6005c539dfbcb5cd71fb51bfc8a52ba63bc37a" - integrity sha512-a41J4NW8HyZa1I1vAndrraTlPZ/eZoga2ZgS7fEr0tZJGVU4xqdE80CEm0CcNjha5EZ8fTBYLKHF0kqDUuAwQw== +"@babel/helpers@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.11.tgz#b02f5d5f2d7abc21ab59eeed80de410ba70b056a" + integrity sha512-vyOXC8PBWaGc5h7GMsNx68OH33cypkEDJCHvYVVgVbbxJDROYVtexSk0gK5iCF1xNjRIN2s8ai7hwkWDq5szWg== dependencies: "@babel/template" "^7.22.5" - "@babel/traverse" "^7.22.10" - "@babel/types" "^7.22.10" + "@babel/traverse" "^7.22.11" + "@babel/types" "^7.22.11" -"@babel/highlight@^7.22.10": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.10.tgz#02a3f6d8c1cb4521b2fd0ab0da8f4739936137d7" - integrity sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ== +"@babel/highlight@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.13.tgz#9cda839e5d3be9ca9e8c26b6dd69e7548f0cbf16" + integrity sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ== dependencies: "@babel/helper-validator-identifier" "^7.22.5" chalk "^2.4.2" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.22.10", "@babel/parser@^7.22.5": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.10.tgz#e37634f9a12a1716136c44624ef54283cabd3f55" - integrity sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.22.11", "@babel/parser@^7.22.5": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.13.tgz#23fb17892b2be7afef94f573031c2f4b42839a2b" + integrity sha512-3l6+4YOvc9wx7VlCSw4yQfcBo01ECA8TicQfbnCPuCEpRQrf+gTUyGdxNw+pyTUyywp6JRD1w0YQs9TpBXYlkw== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -349,10 +349,10 @@ "@babel/parser" "^7.22.5" "@babel/types" "^7.22.5" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.22.10": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.10.tgz#20252acb240e746d27c2e82b4484f199cf8141aa" - integrity sha512-Q/urqV4pRByiNNpb/f5OSv28ZlGJiFiiTh+GAHktbIrkPhPbl90+uW6SmpoLyZqutrg9AEaEf3Q/ZBRHBXgxig== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.11.tgz#71ebb3af7a05ff97280b83f05f8865ac94b2027c" + integrity sha512-mzAenteTfomcB7mfPtyi+4oe5BZ6MXxWcn4CX+h4IRJ+OOGXBrWU6jDQavkQI9Vuc5P+donFabBfFCcmWka9lQ== dependencies: "@babel/code-frame" "^7.22.10" "@babel/generator" "^7.22.10" @@ -360,15 +360,15 @@ "@babel/helper-function-name" "^7.22.5" "@babel/helper-hoist-variables" "^7.22.5" "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.22.10" - "@babel/types" "^7.22.10" + "@babel/parser" "^7.22.11" + "@babel/types" "^7.22.11" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.5", "@babel/types@^7.3.3": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.10.tgz#4a9e76446048f2c66982d1a989dd12b8a2d2dc03" - integrity sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.11", "@babel/types@^7.22.5", "@babel/types@^7.3.3": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.11.tgz#0e65a6a1d4d9cbaa892b2213f6159485fe632ea2" + integrity sha512-siazHiGuZRz9aB9NpHy9GOs9xiQPKnMzgdr493iI1M67vRXpnEq8ZOOKzezC5q7zwuQ6sDhdSp4SD9ixKSqKZg== dependencies: "@babel/helper-string-parser" "^7.22.5" "@babel/helper-validator-identifier" "^7.22.5" @@ -3490,9 +3490,9 @@ camelcase@^6.0.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001517: - version "1.0.30001522" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001522.tgz#44b87a406c901269adcdb834713e23582dd71856" - integrity sha512-TKiyTVZxJGhsTszLuzb+6vUZSjVOAhClszBr2Ta2k9IwtNBT/4dzmL6aywt0HCgEZlmwJzXJd8yNiob6HgwTRg== + version "1.0.30001524" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001524.tgz#1e14bce4f43c41a7deaeb5ebfe86664fe8dadb80" + integrity sha512-Jj917pJtYg9HSJBF95HVX3Cdr89JUyLT4IZ8SvM5aDRni95swKgYi3TgYLH5hnGfPE/U1dg6IfZ50UsIlLkwSA== capture-exit@^2.0.0: version "2.0.0" @@ -4262,9 +4262,9 @@ ecc-jsbn@~0.1.1: safer-buffer "^2.1.0" electron-to-chromium@^1.4.477: - version "1.4.496" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz#a57534b70d2bdee7e1ad7dbd4c91e560cbd08db1" - integrity sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g== + version "1.4.505" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.505.tgz#00571ade5975b58413f0f56a665b065bfc29cdfc" + integrity sha512-0A50eL5BCCKdxig2SsCXhpuztnB9PfUgRMojj5tMvt8O54lbwz3t6wNgnpiTRosw5QjlJB7ixhVyeg8daLQwSQ== elliptic@6.5.4: version "6.5.4" @@ -4338,7 +4338,7 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.19.0, es-abstract@^1.20.4, es-abstract@^1.21.2: +es-abstract@^1.20.4, es-abstract@^1.21.2, es-abstract@^1.22.1: version "1.22.1" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.1.tgz#8b4e5fc5cefd7f1660f0f8e1a52900dfbc9d9ccc" integrity sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw== @@ -4961,14 +4961,15 @@ find-up@^4.0.0, find-up@^4.1.0: path-exists "^4.0.0" flat-cache@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + version "3.1.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.1.0.tgz#0e54ab4a1a60fe87e2946b6b00657f1c99e1af3f" + integrity sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew== dependencies: - flatted "^3.1.0" + flatted "^3.2.7" + keyv "^4.5.3" rimraf "^3.0.2" -flatted@^3.1.0: +flatted@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== @@ -5069,9 +5070,9 @@ fs.realpath@^1.0.0: integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@^2.1.2, fsevents@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.1: version "1.1.1" @@ -5079,21 +5080,21 @@ function-bind@^1.1.1: integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== function.prototype.name@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" - integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.0" - functions-have-names "^1.2.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== -functions-have-names@^1.2.2, functions-have-names@^1.2.3: +functions-have-names@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== @@ -6584,6 +6585,11 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -6639,7 +6645,7 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== -json5@2.x, json5@^2.2.2: +json5@2.x, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -6685,6 +6691,13 @@ jsprim@^1.2.2: json-schema "0.4.0" verror "1.10.0" +keyv@^4.5.3: + version "4.5.3" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.3.tgz#00873d2b046df737963157bd04f294ca818c9c25" + integrity sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug== + dependencies: + json-buffer "3.0.1" + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -7408,9 +7421,9 @@ nice-try@^1.0.4: integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== node-fetch@^2.6.1, node-fetch@^2.6.7: - version "2.6.13" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.13.tgz#a20acbbec73c2e09f9007de5cda17104122e0010" - integrity sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA== + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" @@ -7716,13 +7729,13 @@ object.pick@^1.3.0: isobject "^3.0.1" object.values@^1.1.1: - version "1.1.6" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.6.tgz#4abbaa71eba47d63589d402856f908243eea9b1d" - integrity sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw== + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" + integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0"