diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 59c2db6..3fbb52b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,22 +26,22 @@ jobs: uses: actions-rs/cargo@v1 with: command: fmt - args: -- --check + args: --check --manifest-path ./cardano/Cargo.toml --all - name: "Linter checks" uses: actions-rs/cargo@v1 with: command: clippy - args: --all-features --all-targets -- --deny "clippy::all" + args: --all-features --all-targets --manifest-path ./cardano/Cargo.toml -- --deny "clippy::all" - name: "Check" uses: actions-rs/cargo@v1 with: command: check - args: --all-features --all-targets + args: --all-features --all-targets --manifest-path ./cardano/Cargo.toml - name: "Test" uses: actions-rs/cargo@v1 with: command: test - args: --all-features --all-targets + args: --all-features --all-targets --manifest-path ./cardano/Cargo.toml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3425394..742f3b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,6 @@ jobs: with: version: v1.0.19-alpha - - run: aiken fmt --check - - run: aiken check - - run: aiken build + - run: aiken fmt ./cardano --check + - run: aiken check ./cardano + - run: aiken build ./cardano diff --git a/.gitignore b/.gitignore index 9a0e761..8654f19 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,3 @@ sdk/Cargo.lock **/target **/pkg **/node_modules -**/package-lock.json diff --git a/README.md b/README.md index 26b2cfc..cb3f2f0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The Projected NFT Whirlpool is a new protocol for the Paima Whirlpool vision to You can find the full docs on this [here](https://docs.paimastudios.com/home/multichain-support/projected-nfts/cross-chain/basics) -# Building +## Published packages -1. Install [Aiken](https://aiken-lang.org/installation-instructions) -2. Run `aiken build` or `aiken check` +- [Cardano NodeJS](https://www.npmjs.com/package/@paima/cardano-projected-nft-nodejs) +- [Cardano Browser](https://www.npmjs.com/package/@paima/cardano-projected-nft-browser) diff --git a/Cargo.lock b/cardano/Cargo.lock similarity index 99% rename from Cargo.lock rename to cardano/Cargo.lock index af30eb7..769a21d 100644 --- a/Cargo.lock +++ b/cardano/Cargo.lock @@ -161,7 +161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] -name = "cardano-projected-nft-sdk" +name = "cardano-projected-nft" version = "0.1.0" dependencies = [ "anyhow", @@ -182,10 +182,21 @@ dependencies = [ ] [[package]] -name = "cardano-projected-nft-sdk-wasm" +name = "cardano-projected-nft-json-schema-gen" +version = "0.0.1" +dependencies = [ + "cardano-projected-nft", + "cml-chain", + "cml-crypto", + "schemars", + "serde_json", +] + +[[package]] +name = "cardano-projected-nft-wasm" version = "0.1.0" dependencies = [ - "cardano-projected-nft-sdk", + "cardano-projected-nft", "cbor_event", "cml-chain", "cml-chain-wasm", diff --git a/Cargo.toml b/cardano/Cargo.toml similarity index 82% rename from Cargo.toml rename to cardano/Cargo.toml index 36c8c10..6a58c8d 100644 --- a/Cargo.toml +++ b/cardano/Cargo.toml @@ -2,6 +2,7 @@ members = [ "sdk/rust", "sdk/wasm", + "sdk/wasm/json-gen", ] [workspace.metadata.release] diff --git a/cardano/README.md b/cardano/README.md new file mode 100644 index 0000000..867a7f5 --- /dev/null +++ b/cardano/README.md @@ -0,0 +1,4 @@ +# Building + +1. Install [Aiken](https://aiken-lang.org/installation-instructions) +2. Run `aiken build` or `aiken check` diff --git a/aiken.lock b/cardano/aiken.lock similarity index 100% rename from aiken.lock rename to cardano/aiken.lock diff --git a/aiken.toml b/cardano/aiken.toml similarity index 100% rename from aiken.toml rename to cardano/aiken.toml diff --git a/plutus.json b/cardano/plutus.json similarity index 100% rename from plutus.json rename to cardano/plutus.json diff --git a/cardano/sdk/README.md b/cardano/sdk/README.md new file mode 100644 index 0000000..4da3e0d --- /dev/null +++ b/cardano/sdk/README.md @@ -0,0 +1,5 @@ +Generated inspired from the code generated using [projected-nft.cddl](./projected-nft.cddl) with the following cddl-codegen command + +```bash +cargo run -- --input=projected-nft.cddl.cddl --output=. --json-serde-derives true --json-schema-export true --to-from-bytes-methods false --common-import-override=cml_core +``` \ No newline at end of file diff --git a/cardano/sdk/projected-nft.cddl b/cardano/sdk/projected-nft.cddl new file mode 100644 index 0000000..2319a5c --- /dev/null +++ b/cardano/sdk/projected-nft.cddl @@ -0,0 +1,30 @@ +policy_id = _CDDL_CODEGEN_RAW_BYTES_TYPE_ +asset_name = _CDDL_CODEGEN_EXTERN_TYPE_ +ed25519_key_hash = _CDDL_CODEGEN_RAW_BYTES_TYPE_ +out_ref = _CDDL_CODEGEN_EXTERN_TYPE_ +big_int = _CDDL_CODEGEN_EXTERN_TYPE_ ; https://github.com/dcSpark/cddl-codegen/issues/220 + +owner = + ed25519_key_hash ; @name PKH + / [policy_id, asset_name] ; @name NFT + / asset_name ; @name Receipt + +status = + 0 ; @name Locked + / [out_ref: out_ref, for_how_long: big_int] ; @name Unlocking + + +state = + [ owner: owner + , status: status + ] + +redeem = + [ partial_withdraw: bool + , nft_input_owner: out_ref / null + , new_receipt_owner: asset_name / null + ] + +mint_redeemer = + [total: big_int] ; @name MintTokens + / 1 ; @name BurnTokens diff --git a/sdk/rust/Cargo.toml b/cardano/sdk/rust/Cargo.toml similarity index 95% rename from sdk/rust/Cargo.toml rename to cardano/sdk/rust/Cargo.toml index d6d0dfd..dfb18b0 100644 --- a/sdk/rust/Cargo.toml +++ b/cardano/sdk/rust/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "cardano-projected-nft-sdk" +name = "cardano-projected-nft" version = "0.1.0" edition = "2021" diff --git a/sdk/rust/examples/configs/claim.yml b/cardano/sdk/rust/examples/configs/claim.yml similarity index 100% rename from sdk/rust/examples/configs/claim.yml rename to cardano/sdk/rust/examples/configs/claim.yml diff --git a/sdk/rust/examples/configs/lock.yml b/cardano/sdk/rust/examples/configs/lock.yml similarity index 100% rename from sdk/rust/examples/configs/lock.yml rename to cardano/sdk/rust/examples/configs/lock.yml diff --git a/sdk/rust/examples/configs/lock_nft.yml b/cardano/sdk/rust/examples/configs/lock_nft.yml similarity index 100% rename from sdk/rust/examples/configs/lock_nft.yml rename to cardano/sdk/rust/examples/configs/lock_nft.yml diff --git a/sdk/rust/examples/configs/unlock.yml b/cardano/sdk/rust/examples/configs/unlock.yml similarity index 100% rename from sdk/rust/examples/configs/unlock.yml rename to cardano/sdk/rust/examples/configs/unlock.yml diff --git a/sdk/rust/examples/contract_deploy.rs b/cardano/sdk/rust/examples/contract_deploy.rs similarity index 99% rename from sdk/rust/examples/contract_deploy.rs rename to cardano/sdk/rust/examples/contract_deploy.rs index 15a8e7f..1bc68e7 100644 --- a/sdk/rust/examples/contract_deploy.rs +++ b/cardano/sdk/rust/examples/contract_deploy.rs @@ -13,6 +13,7 @@ use cml_chain::transaction::{ DatumOption, RequiredSigners, Transaction, TransactionInput, TransactionOutput, TransactionWitnessSet, }; +use cml_chain::utils::BigInt; use reqwest::header::{HeaderMap, HeaderValue}; use reqwest::{header, Client, StatusCode}; use serde::de::Error; @@ -27,7 +28,7 @@ use std::path::PathBuf; use std::str::FromStr; use std::time::UNIX_EPOCH; -use cardano_projected_nft_sdk::{OutRef, Owner, Redeem, State, Status}; +use cardano_projected_nft::{OutRef, Owner, Redeem, State, Status}; use cml_chain::builders::redeemer_builder::RedeemerWitnessKey; use cml_chain::builders::tx_builder::{ ChangeSelectionAlgo, TransactionBuilder, TransactionBuilderConfigBuilder, @@ -683,7 +684,7 @@ async fn handle_unlock( let validity = ttl_by_posix(now - 100); let ttl = ttl_by_posix(now + 100); - let for_how_long = (now + 400) * 1000; + let for_how_long = BigInt::from((now + 400) * 1000); let new_datum = match config.control_nft.clone() { None => State { diff --git a/sdk/rust/src/lib.rs b/cardano/sdk/rust/src/lib.rs similarity index 100% rename from sdk/rust/src/lib.rs rename to cardano/sdk/rust/src/lib.rs diff --git a/sdk/rust/src/mint_redeemer.rs b/cardano/sdk/rust/src/mint_redeemer.rs similarity index 85% rename from sdk/rust/src/mint_redeemer.rs rename to cardano/sdk/rust/src/mint_redeemer.rs index b4e63dc..0b9a706 100644 --- a/sdk/rust/src/mint_redeemer.rs +++ b/cardano/sdk/rust/src/mint_redeemer.rs @@ -5,12 +5,12 @@ use std::fmt::Debug; #[derive(Clone, Debug, Eq, PartialEq, Hash, Deserialize, Serialize, schemars::JsonSchema)] pub enum MintRedeemer { - MintTokens { total: u64 }, + MintTokens { total: BigInt }, BurnTokens, } impl MintRedeemer { - pub fn new_mint(total: u64) -> MintRedeemer { + pub fn new_mint(total: BigInt) -> MintRedeemer { MintRedeemer::MintTokens { total } } @@ -23,7 +23,7 @@ impl From for PlutusData { fn from(value: MintRedeemer) -> Self { match value { MintRedeemer::MintTokens { total } => PlutusData::new_constr_plutus_data( - ConstrPlutusData::new(0, vec![PlutusData::new_integer(BigInt::from(total))]), + ConstrPlutusData::new(0, vec![PlutusData::new_integer(total)]), ), MintRedeemer::BurnTokens => { PlutusData::new_constr_plutus_data(ConstrPlutusData::new(1, vec![])) @@ -44,9 +44,7 @@ impl TryFrom for MintRedeemer { match constr.alternative { 0 => match constr.fields.get(0) { Some(PlutusData::Integer(bigint)) => Ok(MintRedeemer::MintTokens { - total: bigint - .as_u64() - .ok_or("Mint tokens total valus can't be represented as u64".to_string())?, + total: bigint.clone(), }), _ => Err("constr field is not bigint".to_string()), }, @@ -62,12 +60,14 @@ impl TryFrom for MintRedeemer { #[cfg(test)] mod tests { use crate::MintRedeemer; - use cml_chain::plutus::PlutusData; + use cml_chain::{plutus::PlutusData, utils::BigInt}; #[test] fn test_mint_redeemer() { let mint_redeemer = vec![ - MintRedeemer::MintTokens { total: 253 }, + MintRedeemer::MintTokens { + total: BigInt::from(253), + }, MintRedeemer::BurnTokens, ]; for redeem in mint_redeemer.into_iter() { diff --git a/sdk/rust/src/output_reference.rs b/cardano/sdk/rust/src/output_reference.rs similarity index 100% rename from sdk/rust/src/output_reference.rs rename to cardano/sdk/rust/src/output_reference.rs diff --git a/sdk/rust/src/redeem.rs b/cardano/sdk/rust/src/redeem.rs similarity index 100% rename from sdk/rust/src/redeem.rs rename to cardano/sdk/rust/src/redeem.rs diff --git a/sdk/rust/src/state.rs b/cardano/sdk/rust/src/state.rs similarity index 96% rename from sdk/rust/src/state.rs rename to cardano/sdk/rust/src/state.rs index 0fee934..ba65cf1 100644 --- a/sdk/rust/src/state.rs +++ b/cardano/sdk/rust/src/state.rs @@ -71,7 +71,10 @@ impl TryFrom for Owner { )] pub enum Status { Locked, - Unlocking { out_ref: OutRef, for_how_long: u64 }, + Unlocking { + out_ref: OutRef, + for_how_long: BigInt, + }, } impl Status { @@ -79,7 +82,7 @@ impl Status { Self::Locked } - pub fn new_unlocking(out_ref: OutRef, for_how_long: u64) -> Self { + pub fn new_unlocking(out_ref: OutRef, for_how_long: BigInt) -> Self { Self::Unlocking { out_ref, for_how_long, @@ -97,7 +100,7 @@ impl From for PlutusData { } => { let out_ref = PlutusData::from(out_ref); - let for_how_long = PlutusData::new_integer(BigInt::from(for_how_long)); + let for_how_long = PlutusData::new_integer(for_how_long); PlutusData::new_constr_plutus_data(ConstrPlutusData::new( 1, @@ -242,10 +245,7 @@ fn get_status(constr: ConstrPlutusData) -> Result { let for_how_long = match constr.fields.get(1).ok_or( "no field found for for_how_long while parsing unlocking status".to_string(), )? { - PlutusData::Integer(bigint) => bigint.as_u64().ok_or(format!( - "can't convert for_how_long bigint {} to u64 while parsing unlocking status", - bigint - ))?, + PlutusData::Integer(bigint) => bigint.clone(), _ => { return Err("expected to see for_how_long bigint field type while parsing unlocking status".to_string()); } @@ -272,6 +272,7 @@ mod tests { use cml_chain::plutus::PlutusData; use cml_chain::PolicyId; + use cml_chain::utils::BigInt; use cml_crypto::{Ed25519KeyHash, TransactionHash}; #[test] @@ -338,7 +339,7 @@ mod tests { .unwrap(), index: 2, }, - for_how_long: 300, + for_how_long: BigInt::from(300), }, }; let plutus_datum = PlutusData::from(datum.clone()); diff --git a/sdk/wasm/Cargo.toml b/cardano/sdk/wasm/Cargo.toml similarity index 84% rename from sdk/wasm/Cargo.toml rename to cardano/sdk/wasm/Cargo.toml index 766fa8d..f3e9258 100644 --- a/sdk/wasm/Cargo.toml +++ b/cardano/sdk/wasm/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "cardano-projected-nft-sdk-wasm" +name = "cardano-projected-nft-wasm" version = "0.1.0" edition = "2021" @@ -7,7 +7,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -cardano-projected-nft-sdk = { path = "../rust" } +cardano-projected-nft = { path = "../rust" } cml-core = { version = "0.1.0" } cml-chain = { version = "0.1.0" } diff --git a/sdk/wasm/example_dapp/package.json b/cardano/sdk/wasm/example_dapp/package.json similarity index 92% rename from sdk/wasm/example_dapp/package.json rename to cardano/sdk/wasm/example_dapp/package.json index eaf054a..c767a12 100644 --- a/sdk/wasm/example_dapp/package.json +++ b/cardano/sdk/wasm/example_dapp/package.json @@ -13,7 +13,7 @@ "cbor": "^9.0.1", "deno": "^0.1.1", "lucid-cardano": "^0.10.7", - "cardano-projected-nft-sdk": "file:../pkg" + "cardano-projected-nft": "file:../pkg" }, "keywords": [], "author": "", diff --git a/sdk/wasm/example_dapp/src/run.ts b/cardano/sdk/wasm/example_dapp/src/run.ts similarity index 94% rename from sdk/wasm/example_dapp/src/run.ts rename to cardano/sdk/wasm/example_dapp/src/run.ts index 6a352c0..f2196fb 100644 --- a/sdk/wasm/example_dapp/src/run.ts +++ b/cardano/sdk/wasm/example_dapp/src/run.ts @@ -1,4 +1,4 @@ -import * as projected_nft from "cardano-projected-nft-sdk"; +import * as projected_nft from "cardano-projected-nft"; let state = projected_nft.State.new( projected_nft.Owner.new_nft( diff --git a/sdk/wasm/example_dapp/tsconfig.json b/cardano/sdk/wasm/example_dapp/tsconfig.json similarity index 100% rename from sdk/wasm/example_dapp/tsconfig.json rename to cardano/sdk/wasm/example_dapp/tsconfig.json diff --git a/cardano/sdk/wasm/json-gen/Cargo.toml b/cardano/sdk/wasm/json-gen/Cargo.toml new file mode 100644 index 0000000..0b51413 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "cardano-projected-nft-json-schema-gen" +version = "0.0.1" +edition = "2018" + + +[dependencies] +serde_json = "1.0.57" +schemars = "0.8.8" +cardano-projected-nft = { path = "../../rust" } +cml-chain = { version = "0.1.0" } +cml-crypto = { version = "0.1.0" } diff --git a/cardano/sdk/wasm/json-gen/output/json-types.d.ts b/cardano/sdk/wasm/json-gen/output/json-types.d.ts new file mode 100644 index 0000000..12f07e5 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/output/json-types.d.ts @@ -0,0 +1,46 @@ +export type MintRedeemerJSON = + | "BurnTokens" + | { + MintTokens: { + total: string; + [k: string]: unknown; + }; + }; +export interface OutRefJSON { + index: number; + tx_id: string; +} +export type OwnerJSON = + | { + PKH: string; + } + | { + NFT: [string, AssetNameJSON]; + } + | { + Receipt: AssetNameJSON; + }; +export interface RedeemJSON { + new_receipt_owner?: AssetNameJSON | null; + nft_input_owner?: OutRefJSON | null; + partial_withdraw: boolean; +} +export interface StateJSON { + owner: OwnerJSON; + status: StatusJSON; +} +export type StatusJSON = + | "Locked" + | { + Unlocking: { + for_how_long: string; + out_ref: OutRefJSON; + [k: string]: unknown; + }; + }; +export type ScriptHashJSON = string; +export interface AssetNameJSON { + inner: number[]; +} +export type BigIntJSON = string; +export type Ed25519KeyHashJSON = string; diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::MintRedeemer.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::MintRedeemer.json new file mode 100644 index 0000000..53436a4 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::MintRedeemer.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintRedeemer", + "oneOf": [ + { + "type": "string", + "enum": [ + "BurnTokens" + ] + }, + { + "type": "object", + "required": [ + "MintTokens" + ], + "properties": { + "MintTokens": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::OutRef.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::OutRef.json new file mode 100644 index 0000000..ece1a0e --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::OutRef.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OutRef", + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Owner.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Owner.json new file mode 100644 index 0000000..e39d996 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Owner.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Owner", + "oneOf": [ + { + "type": "object", + "required": [ + "PKH" + ], + "properties": { + "PKH": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "NFT" + ], + "properties": { + "NFT": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/AssetName" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "Receipt" + ], + "properties": { + "Receipt": { + "$ref": "#/definitions/AssetName" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "AssetName": { + "type": "object", + "required": [ + "inner" + ], + "properties": { + "inner": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Redeem.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Redeem.json new file mode 100644 index 0000000..451aad7 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Redeem.json @@ -0,0 +1,68 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Redeem", + "type": "object", + "required": [ + "partial_withdraw" + ], + "properties": { + "new_receipt_owner": { + "anyOf": [ + { + "$ref": "#/definitions/AssetName" + }, + { + "type": "null" + } + ] + }, + "nft_input_owner": { + "anyOf": [ + { + "$ref": "#/definitions/OutRef" + }, + { + "type": "null" + } + ] + }, + "partial_withdraw": { + "type": "boolean" + } + }, + "definitions": { + "AssetName": { + "type": "object", + "required": [ + "inner" + ], + "properties": { + "inner": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + }, + "OutRef": { + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::State.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::State.json new file mode 100644 index 0000000..170fd7e --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::State.json @@ -0,0 +1,136 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "State", + "type": "object", + "required": [ + "owner", + "status" + ], + "properties": { + "owner": { + "$ref": "#/definitions/Owner" + }, + "status": { + "$ref": "#/definitions/Status" + } + }, + "definitions": { + "AssetName": { + "type": "object", + "required": [ + "inner" + ], + "properties": { + "inner": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + }, + "OutRef": { + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } + }, + "Owner": { + "oneOf": [ + { + "type": "object", + "required": [ + "PKH" + ], + "properties": { + "PKH": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "NFT" + ], + "properties": { + "NFT": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/AssetName" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "Receipt" + ], + "properties": { + "Receipt": { + "$ref": "#/definitions/AssetName" + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "type": "string", + "enum": [ + "Locked" + ] + }, + { + "type": "object", + "required": [ + "Unlocking" + ], + "properties": { + "Unlocking": { + "type": "object", + "required": [ + "for_how_long", + "out_ref" + ], + "properties": { + "for_how_long": { + "type": "string" + }, + "out_ref": { + "$ref": "#/definitions/OutRef" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Status.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Status.json new file mode 100644 index 0000000..d8fa6c0 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft::Status.json @@ -0,0 +1,55 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Status", + "oneOf": [ + { + "type": "string", + "enum": [ + "Locked" + ] + }, + { + "type": "object", + "required": [ + "Unlocking" + ], + "properties": { + "Unlocking": { + "type": "object", + "required": [ + "for_how_long", + "out_ref" + ], + "properties": { + "for_how_long": { + "type": "string" + }, + "out_ref": { + "$ref": "#/definitions/OutRef" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "OutRef": { + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::MintRedeemer.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::MintRedeemer.json new file mode 100644 index 0000000..53436a4 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::MintRedeemer.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintRedeemer", + "oneOf": [ + { + "type": "string", + "enum": [ + "BurnTokens" + ] + }, + { + "type": "object", + "required": [ + "MintTokens" + ], + "properties": { + "MintTokens": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::OutRef.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::OutRef.json new file mode 100644 index 0000000..ece1a0e --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::OutRef.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OutRef", + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Owner.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Owner.json new file mode 100644 index 0000000..e39d996 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Owner.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Owner", + "oneOf": [ + { + "type": "object", + "required": [ + "PKH" + ], + "properties": { + "PKH": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "NFT" + ], + "properties": { + "NFT": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/AssetName" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "Receipt" + ], + "properties": { + "Receipt": { + "$ref": "#/definitions/AssetName" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "AssetName": { + "type": "object", + "required": [ + "inner" + ], + "properties": { + "inner": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Redeem.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Redeem.json new file mode 100644 index 0000000..451aad7 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Redeem.json @@ -0,0 +1,68 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Redeem", + "type": "object", + "required": [ + "partial_withdraw" + ], + "properties": { + "new_receipt_owner": { + "anyOf": [ + { + "$ref": "#/definitions/AssetName" + }, + { + "type": "null" + } + ] + }, + "nft_input_owner": { + "anyOf": [ + { + "$ref": "#/definitions/OutRef" + }, + { + "type": "null" + } + ] + }, + "partial_withdraw": { + "type": "boolean" + } + }, + "definitions": { + "AssetName": { + "type": "object", + "required": [ + "inner" + ], + "properties": { + "inner": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + }, + "OutRef": { + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::State.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::State.json new file mode 100644 index 0000000..170fd7e --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::State.json @@ -0,0 +1,136 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "State", + "type": "object", + "required": [ + "owner", + "status" + ], + "properties": { + "owner": { + "$ref": "#/definitions/Owner" + }, + "status": { + "$ref": "#/definitions/Status" + } + }, + "definitions": { + "AssetName": { + "type": "object", + "required": [ + "inner" + ], + "properties": { + "inner": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + }, + "OutRef": { + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } + }, + "Owner": { + "oneOf": [ + { + "type": "object", + "required": [ + "PKH" + ], + "properties": { + "PKH": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "NFT" + ], + "properties": { + "NFT": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/AssetName" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "Receipt" + ], + "properties": { + "Receipt": { + "$ref": "#/definitions/AssetName" + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "type": "string", + "enum": [ + "Locked" + ] + }, + { + "type": "object", + "required": [ + "Unlocking" + ], + "properties": { + "Unlocking": { + "type": "object", + "required": [ + "for_how_long", + "out_ref" + ], + "properties": { + "for_how_long": { + "type": "string" + }, + "out_ref": { + "$ref": "#/definitions/OutRef" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Status.json b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Status.json new file mode 100644 index 0000000..d8fa6c0 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cardano_projected_nft_sdk::Status.json @@ -0,0 +1,55 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Status", + "oneOf": [ + { + "type": "string", + "enum": [ + "Locked" + ] + }, + { + "type": "object", + "required": [ + "Unlocking" + ], + "properties": { + "Unlocking": { + "type": "object", + "required": [ + "for_how_long", + "out_ref" + ], + "properties": { + "for_how_long": { + "type": "string" + }, + "out_ref": { + "$ref": "#/definitions/OutRef" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "OutRef": { + "type": "object", + "required": [ + "index", + "tx_id" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cml_chain::PolicyId.json b/cardano/sdk/wasm/json-gen/schemas/cml_chain::PolicyId.json new file mode 100644 index 0000000..6cd730e --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cml_chain::PolicyId.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ScriptHash", + "type": "string" +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cml_chain::assets::AssetName.json b/cardano/sdk/wasm/json-gen/schemas/cml_chain::assets::AssetName.json new file mode 100644 index 0000000..23d2345 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cml_chain::assets::AssetName.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AssetName", + "type": "object", + "required": [ + "inner" + ], + "properties": { + "inner": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cml_chain::utils::BigInt.json b/cardano/sdk/wasm/json-gen/schemas/cml_chain::utils::BigInt.json new file mode 100644 index 0000000..8651f4d --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cml_chain::utils::BigInt.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "BigInt", + "type": "string" +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/schemas/cml_crypto::Ed25519KeyHash.json b/cardano/sdk/wasm/json-gen/schemas/cml_crypto::Ed25519KeyHash.json new file mode 100644 index 0000000..921871a --- /dev/null +++ b/cardano/sdk/wasm/json-gen/schemas/cml_crypto::Ed25519KeyHash.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Ed25519KeyHash", + "type": "string" +} \ No newline at end of file diff --git a/cardano/sdk/wasm/json-gen/src/lib.rs b/cardano/sdk/wasm/json-gen/src/lib.rs new file mode 100644 index 0000000..2047042 --- /dev/null +++ b/cardano/sdk/wasm/json-gen/src/lib.rs @@ -0,0 +1,30 @@ +macro_rules! gen_json_schema { + ($name:ty) => { + let dest_path = + std::path::Path::new(&"schemas").join(&format!("{}.json", stringify!($name))); + std::fs::write( + &dest_path, + serde_json::to_string_pretty(&schemars::schema_for!($name)).unwrap(), + ) + .unwrap(); + }; +} + +pub fn export_schemas() { + let schema_path = std::path::Path::new(&"schemas"); + if !schema_path.exists() { + std::fs::create_dir(schema_path).unwrap(); + } + gen_json_schema!(cardano_projected_nft::MintRedeemer); + gen_json_schema!(cardano_projected_nft::OutRef); + gen_json_schema!(cardano_projected_nft::Owner); + gen_json_schema!(cardano_projected_nft::Redeem); + gen_json_schema!(cardano_projected_nft::State); + gen_json_schema!(cardano_projected_nft::Status); + + // TODO: update once this is merged https://github.com/dcSpark/cardano-multiplatform-lib/pull/287 + gen_json_schema!(cml_chain::assets::AssetName); + gen_json_schema!(cml_chain::utils::BigInt); + gen_json_schema!(cml_crypto::Ed25519KeyHash); + gen_json_schema!(cml_chain::PolicyId); +} diff --git a/cardano/sdk/wasm/json-gen/src/main.rs b/cardano/sdk/wasm/json-gen/src/main.rs new file mode 100644 index 0000000..f9cb40c --- /dev/null +++ b/cardano/sdk/wasm/json-gen/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + cardano_projected_nft_json_schema_gen::export_schemas(); +} diff --git a/cardano/sdk/wasm/package-lock.json b/cardano/sdk/wasm/package-lock.json new file mode 100644 index 0000000..213c890 --- /dev/null +++ b/cardano/sdk/wasm/package-lock.json @@ -0,0 +1,1208 @@ +{ + "name": "cardano-projected-nft-wasm", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "cardano-projected-nft-wasm", + "version": "1.0.0", + "license": "MIT", + "devDependencies": { + "cross-env": "^7.0.3", + "husky": "4.2.5", + "json-schema-to-typescript": "^10.1.5", + "rimraf": "3.0.2" + } + }, + "node_modules/@apidevtools/json-schema-ref-parser": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz", + "integrity": "sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w==", + "dev": true, + "dependencies": { + "@jsdevtools/ono": "^7.1.3", + "@types/json-schema": "^7.0.6", + "call-me-maybe": "^1.0.1", + "js-yaml": "^4.1.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "dev": true + }, + "node_modules/@types/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==", + "dev": true, + "dependencies": { + "@types/minimatch": "^5.1.2", + "@types/node": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "node_modules/@types/lodash": { + "version": "4.14.202", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.202.tgz", + "integrity": "sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==", + "dev": true + }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "dev": true + }, + "node_modules/@types/prettier": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "dev": true + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", + "dev": true + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "node_modules/cli-color": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.3.tgz", + "integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==", + "dev": true, + "dependencies": { + "d": "^1.0.1", + "es5-ext": "^0.10.61", + "es6-iterator": "^2.0.3", + "memoizee": "^0.4.15", + "timers-ext": "^0.1.7" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dev": true, + "dependencies": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es5-ext": { + "version": "0.10.62", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", + "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "dev": true, + "dependencies": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "dev": true, + "dependencies": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "node_modules/es6-weak-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", + "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", + "dev": true, + "dependencies": { + "d": "1", + "es5-ext": "^0.10.46", + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/event-emitter": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", + "dev": true, + "dependencies": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "node_modules/ext": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "dev": true, + "dependencies": { + "type": "^2.7.2" + } + }, + "node_modules/ext/node_modules/type": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", + "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", + "dev": true + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-versions": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", + "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", + "dev": true, + "dependencies": { + "semver-regex": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-promise": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/glob-promise/-/glob-promise-3.4.0.tgz", + "integrity": "sha512-q08RJ6O+eJn+dVanerAndJwIcumgbDdYiUT7zFQl3Wm1xD6fBKtah7H8ZJChj4wP+8C+QfeVy8xautR7rdmKEw==", + "dev": true, + "dependencies": { + "@types/glob": "*" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "glob": "*" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/husky": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.2.5.tgz", + "integrity": "sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^6.0.0", + "find-versions": "^3.2.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^4.2.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + }, + "bin": { + "husky-run": "bin/run.js", + "husky-upgrade": "lib/upgrader/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/husky" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-promise": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-ref-parser": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz", + "integrity": "sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q==", + "deprecated": "Please switch to @apidevtools/json-schema-ref-parser", + "dev": true, + "dependencies": { + "@apidevtools/json-schema-ref-parser": "9.0.9" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/json-schema-to-typescript": { + "version": "10.1.5", + "resolved": "https://registry.npmjs.org/json-schema-to-typescript/-/json-schema-to-typescript-10.1.5.tgz", + "integrity": "sha512-X8bNNksfCQo6LhEuqNxmZr4eZpPjXZajmimciuk8eWXzZlif9Brq7WuMGD/SOhBKcRKP2SGVDNZbC28WQqx9Rg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.6", + "@types/lodash": "^4.14.168", + "@types/prettier": "^2.1.5", + "cli-color": "^2.0.0", + "get-stdin": "^8.0.0", + "glob": "^7.1.6", + "glob-promise": "^3.4.0", + "is-glob": "^4.0.1", + "json-schema-ref-parser": "^9.0.6", + "json-stringify-safe": "^5.0.1", + "lodash": "^4.17.20", + "minimist": "^1.2.5", + "mkdirp": "^1.0.4", + "mz": "^2.7.0", + "prettier": "^2.2.0" + }, + "bin": { + "json2ts": "dist/src/cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lru-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", + "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==", + "dev": true, + "dependencies": { + "es5-ext": "~0.10.2" + } + }, + "node_modules/memoizee": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", + "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==", + "dev": true, + "dependencies": { + "d": "^1.0.1", + "es5-ext": "^0.10.53", + "es6-weak-map": "^2.0.3", + "event-emitter": "^0.3.5", + "is-promise": "^2.2.2", + "lru-queue": "^0.1.0", + "next-tick": "^1.1.0", + "timers-ext": "^0.1.7" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", + "dev": true + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "dev": true, + "bin": { + "opencollective-postinstall": "index.js" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "dependencies": { + "semver-compare": "^1.0.0" + } + }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", + "dev": true + }, + "node_modules/semver-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", + "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/timers-ext": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", + "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", + "dev": true, + "dependencies": { + "es5-ext": "~0.10.46", + "next-tick": "1" + } + }, + "node_modules/type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", + "dev": true + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-pm-runs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz", + "integrity": "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + } + } +} diff --git a/cardano/sdk/wasm/package.json b/cardano/sdk/wasm/package.json new file mode 100644 index 0000000..7286d97 --- /dev/null +++ b/cardano/sdk/wasm/package.json @@ -0,0 +1,40 @@ +{ + "name": "cardano-projected-nft", + "version": "1.0.0", + "description": "Cardano Projected NFT SDK", + "keywords": [ + "cardano" + ], + "scripts": { + "rust:build-nodejs": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=nodejs --out-name cardano_projected_nft; npm run js:ts-json-gen; wasm-pack pack", + "rust:build-browser": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=browser --out-name cardano_projected_nft; npm run js:ts-json-gen; wasm-pack pack", + "rust:build-web": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=web --out-name cardano_projected_nft; npm run js:ts-json-gen; wasm-pack pack", + "rust:publish": "cargo publish", + "rust:check-warnings": "(RUSTFLAGS=\"-D warnings\" cargo +stable build)", + "rust:test": "cargo test", + "js:prepublish": "npm run rust:test && rimraf ./publish && cp -r ./pkg ./publish && cp ../../../README.md publish/ && cp ../../../LICENSE publish/", + "js:test-publish": "npm run rust:build-nodejs && npm run js:prepublish && node ../../../scripts/publish-helper cardano/sdk cardano-projected-nft -nodejs && cd publish", + "js:publish-nodejs:prod": "npm run rust:build-nodejs && npm run js:prepublish && node ../../../scripts/publish-helper cardano/sdk cardano-projected-nft -nodejs && cd publish && npm publish --access public", + "js:publish-nodejs:beta": "npm run rust:build-nodejs && npm run js:prepublish && node ../../../scripts/publish-helper cardano/sdk cardano-projected-nft -nodejs && cd publish && npm publish --tag beta --access public", + "js:publish-browser:prod": "npm run rust:build-browser && npm run js:prepublish && node ../../../scripts/publish-helper cardano/sdk cardano-projected-nft -browser && cd publish && npm publish --access public", + "js:publish-browser:beta": "npm run rust:build-browser && npm run js:prepublish && node ../../../scripts/publish-helper cardano/sdk cardano-projected-nft -browser && cd publish && npm publish --tag beta --access public", + "js:ts-json-gen": "cd json-gen && cargo +stable run && cd .. && NODE_PATH=./node_modules node ../../../scripts/run-json2ts.js && node ../../../scripts/json-ts-types.js cardano/sdk cardano-projected-nft" + }, + "husky": { + "hooks": { + "pre-push": "cargo fmt --check --manifest-path ../../Cargo.toml --all && cargo clippy --all-features --all-targets --manifest-path ../../Cargo.toml -- --deny 'clippy::all' && cargo check --all-features --all-targets --manifest-path ../../Cargo.toml && cargo test --all-features --all-targets --manifest-path ../../Cargo.toml" + } + }, + "author": "dcSpark", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/dcSpark/projected-nft-whirlpool.git" + }, + "devDependencies": { + "husky": "4.2.5", + "json-schema-to-typescript": "^10.1.5", + "rimraf": "3.0.2", + "cross-env": "^7.0.3" + } +} diff --git a/cardano/sdk/wasm/src/lib.rs b/cardano/sdk/wasm/src/lib.rs new file mode 100644 index 0000000..9093d80 --- /dev/null +++ b/cardano/sdk/wasm/src/lib.rs @@ -0,0 +1,416 @@ +#![allow( + clippy::len_without_is_empty, + clippy::too_many_arguments, + clippy::new_without_default +)] +// This file was code-generated using an experimental CDDL to rust tool: +// https://github.com/dcSpark/cddl-codegen + +mod output_reference; + +use output_reference::OutRef; +use wasm_bindgen::prelude::{wasm_bindgen, JsError, JsValue}; + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct MintRedeemer(cardano_projected_nft::MintRedeemer); + +#[wasm_bindgen] +impl MintRedeemer { + pub fn to_json(&self) -> Result { + serde_json::to_string_pretty(&self.0).map_err(|e| JsError::new(&format!("to_json: {}", e))) + } + + pub fn to_json_value(&self) -> Result { + serde_wasm_bindgen::to_value(&self.0) + .map_err(|e| JsError::new(&format!("to_js_value: {}", e))) + } + + pub fn from_json(json: &str) -> Result { + serde_json::from_str(json) + .map(Self) + .map_err(|e| JsError::new(&format!("from_json: {}", e))) + } + + pub fn new_mint(total: &cml_chain_wasm::utils::BigInt) -> Self { + Self(cardano_projected_nft::MintRedeemer::new_mint( + total.clone().into(), + )) + } + + pub fn new_burn() -> Self { + Self(cardano_projected_nft::MintRedeemer::new_burn()) + } + + pub fn kind(&self) -> MintRedeemerKind { + match &self.0 { + cardano_projected_nft::MintRedeemer::MintTokens { .. } => MintRedeemerKind::MintTokens, + cardano_projected_nft::MintRedeemer::BurnTokens => MintRedeemerKind::BurnTokens, + } + } + + pub fn as_mint_tokens(&self) -> Option { + match &self.0 { + cardano_projected_nft::MintRedeemer::MintTokens { total } => Some(total.clone().into()), + _ => None, + } + } +} + +impl From for MintRedeemer { + fn from(native: cardano_projected_nft::MintRedeemer) -> Self { + Self(native) + } +} + +impl From for cardano_projected_nft::MintRedeemer { + fn from(wasm: MintRedeemer) -> Self { + wasm.0 + } +} + +impl AsRef for MintRedeemer { + fn as_ref(&self) -> &cardano_projected_nft::MintRedeemer { + &self.0 + } +} + +#[wasm_bindgen] +pub enum MintRedeemerKind { + MintTokens, + BurnTokens, +} + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct NFT(cml_chain::PolicyId, cml_chain::assets::AssetName); + +#[wasm_bindgen] +impl NFT { + pub fn policy_id(&self) -> cml_chain_wasm::PolicyId { + self.0.into() + } + + pub fn asset_name(&self) -> cml_chain_wasm::assets::AssetName { + self.1.clone().into() + } + + pub fn new( + policy_id: &cml_chain_wasm::PolicyId, + asset_name: &cml_chain_wasm::assets::AssetName, + ) -> NFT { + Self( + policy_id.clone().into(), + Into::::into(asset_name.clone()), + ) + } +} + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct Owner(cardano_projected_nft::Owner); + +#[wasm_bindgen] +impl Owner { + pub fn to_json(&self) -> Result { + serde_json::to_string_pretty(&self.0).map_err(|e| JsError::new(&format!("to_json: {}", e))) + } + + pub fn to_json_value(&self) -> Result { + serde_wasm_bindgen::to_value(&self.0) + .map_err(|e| JsError::new(&format!("to_js_value: {}", e))) + } + + pub fn from_json(json: &str) -> Result { + serde_json::from_str(json) + .map(Self) + .map_err(|e| JsError::new(&format!("from_json: {}", e))) + } + + pub fn new_keyhash(keyhash: &cml_crypto_wasm::Ed25519KeyHash) -> Self { + Self(cardano_projected_nft::Owner::new_keyhash( + keyhash.clone().into(), + )) + } + + pub fn new_nft(nft: &NFT) -> Self { + Self(cardano_projected_nft::Owner::new_nft(nft.0, nft.1.clone())) + } + + pub fn new_receipt(receipt: &cml_chain_wasm::assets::AssetName) -> Self { + Self(cardano_projected_nft::Owner::new_receipt( + receipt.clone().into(), + )) + } + + pub fn kind(&self) -> OwnerKind { + match &self.0 { + cardano_projected_nft::Owner::PKH(_) => OwnerKind::PublicKeyHash, + cardano_projected_nft::Owner::NFT(_, _) => OwnerKind::NFT, + cardano_projected_nft::Owner::Receipt(_) => OwnerKind::Receipt, + } + } + + pub fn as_public_keyhash(&self) -> Option { + match &self.0 { + cardano_projected_nft::Owner::PKH(pkh) => Some((*pkh).into()), + _ => None, + } + } + + pub fn as_nft(&self) -> Option { + match &self.0 { + cardano_projected_nft::Owner::NFT(policy_id, asset_name) => { + Some(NFT(*policy_id, asset_name.clone())) + } + _ => None, + } + } + + pub fn as_receipt(&self) -> Option { + match &self.0 { + cardano_projected_nft::Owner::Receipt(receipt) => Some(receipt.clone().into()), + _ => None, + } + } +} + +impl From for Owner { + fn from(native: cardano_projected_nft::Owner) -> Self { + Self(native) + } +} + +impl From for cardano_projected_nft::Owner { + fn from(wasm: Owner) -> Self { + wasm.0 + } +} + +impl AsRef for Owner { + fn as_ref(&self) -> &cardano_projected_nft::Owner { + &self.0 + } +} + +#[wasm_bindgen] +pub enum OwnerKind { + PublicKeyHash, + NFT, + Receipt, +} + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct Redeem(cardano_projected_nft::Redeem); + +#[wasm_bindgen] +impl Redeem { + pub fn to_json(&self) -> Result { + serde_json::to_string_pretty(&self.0).map_err(|e| JsError::new(&format!("to_json: {}", e))) + } + + pub fn to_json_value(&self) -> Result { + serde_wasm_bindgen::to_value(&self.0) + .map_err(|e| JsError::new(&format!("to_js_value: {}", e))) + } + + pub fn from_json(json: &str) -> Result { + serde_json::from_str(json) + .map(Self) + .map_err(|e| JsError::new(&format!("from_json: {}", e))) + } + + pub fn partial_withdraw(&self) -> bool { + self.0.partial_withdraw + } + + pub fn nft_input_owner(&self) -> Option { + self.0.nft_input_owner.clone().map(std::convert::Into::into) + } + + pub fn new_receipt_owner(&self) -> Option { + self.0 + .new_receipt_owner + .clone() + .map(std::convert::Into::into) + } + + pub fn new( + partial_withdraw: bool, + nft_input_owner: Option, + new_receipt_owner: Option, + ) -> Self { + Self(cardano_projected_nft::Redeem::new( + partial_withdraw, + nft_input_owner.map(Into::into), + new_receipt_owner.map(Into::into), + )) + } +} + +impl From for Redeem { + fn from(native: cardano_projected_nft::Redeem) -> Self { + Self(native) + } +} + +impl From for cardano_projected_nft::Redeem { + fn from(wasm: Redeem) -> Self { + wasm.0 + } +} + +impl AsRef for Redeem { + fn as_ref(&self) -> &cardano_projected_nft::Redeem { + &self.0 + } +} + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct State(cardano_projected_nft::State); + +#[wasm_bindgen] +impl State { + pub fn to_json(&self) -> Result { + serde_json::to_string_pretty(&self.0).map_err(|e| JsError::new(&format!("to_json: {}", e))) + } + + pub fn to_json_value(&self) -> Result { + serde_wasm_bindgen::to_value(&self.0) + .map_err(|e| JsError::new(&format!("to_js_value: {}", e))) + } + + pub fn from_json(json: &str) -> Result { + serde_json::from_str(json) + .map(Self) + .map_err(|e| JsError::new(&format!("from_json: {}", e))) + } + + pub fn owner(&self) -> Owner { + self.0.owner.clone().into() + } + + pub fn status(&self) -> Status { + self.0.status.clone().into() + } + + pub fn new(owner: &Owner, status: &Status) -> Self { + Self(cardano_projected_nft::State::new( + owner.clone().into(), + status.clone().into(), + )) + } +} + +impl From for State { + fn from(native: cardano_projected_nft::State) -> Self { + Self(native) + } +} + +impl From for cardano_projected_nft::State { + fn from(wasm: State) -> Self { + wasm.0 + } +} + +impl AsRef for State { + fn as_ref(&self) -> &cardano_projected_nft::State { + &self.0 + } +} + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct Status(cardano_projected_nft::Status); + +#[wasm_bindgen] +impl Status { + pub fn to_json(&self) -> Result { + serde_json::to_string_pretty(&self.0).map_err(|e| JsError::new(&format!("to_json: {}", e))) + } + + pub fn to_json_value(&self) -> Result { + serde_wasm_bindgen::to_value(&self.0) + .map_err(|e| JsError::new(&format!("to_js_value: {}", e))) + } + + pub fn from_json(json: &str) -> Result { + serde_json::from_str(json) + .map(Self) + .map_err(|e| JsError::new(&format!("from_json: {}", e))) + } + + pub fn new_locked() -> Self { + Self(cardano_projected_nft::Status::new_locked()) + } + + pub fn new_unlocking(unlocking: &UnlockingStatus) -> Self { + Self(cardano_projected_nft::Status::new_unlocking( + unlocking.out_ref().clone().into(), + unlocking.for_how_long().into(), + )) + } + + pub fn kind(&self) -> StatusKind { + match &self.0 { + cardano_projected_nft::Status::Locked { .. } => StatusKind::Locked, + cardano_projected_nft::Status::Unlocking { .. } => StatusKind::Unlocking, + } + } + + pub fn as_unlocking(&self) -> Option { + match &self.0 { + cardano_projected_nft::Status::Unlocking { + out_ref, + for_how_long, + } => Some(UnlockingStatus(out_ref.clone(), for_how_long.clone())), + _ => None, + } + } +} + +impl From for Status { + fn from(native: cardano_projected_nft::Status) -> Self { + Self(native) + } +} + +impl From for cardano_projected_nft::Status { + fn from(wasm: Status) -> Self { + wasm.0 + } +} + +impl AsRef for Status { + fn as_ref(&self) -> &cardano_projected_nft::Status { + &self.0 + } +} + +#[wasm_bindgen] +pub enum StatusKind { + Locked, + Unlocking, +} + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct UnlockingStatus(cardano_projected_nft::OutRef, cml_chain::utils::BigInt); + +#[wasm_bindgen] +impl UnlockingStatus { + pub fn out_ref(&self) -> OutRef { + self.0.clone().into() + } + + pub fn for_how_long(&self) -> cml_chain_wasm::utils::BigInt { + self.1.clone().into() + } + + pub fn new(out_ref: &OutRef, for_how_long: &cml_chain_wasm::utils::BigInt) -> Self { + UnlockingStatus(out_ref.clone().into(), for_how_long.clone().into()) + } +} diff --git a/cardano/sdk/wasm/src/output_reference.rs b/cardano/sdk/wasm/src/output_reference.rs new file mode 100644 index 0000000..17ee43d --- /dev/null +++ b/cardano/sdk/wasm/src/output_reference.rs @@ -0,0 +1,62 @@ +use wasm_bindgen::prelude::{wasm_bindgen, JsError, JsValue}; + +#[derive(Clone, Debug)] +#[wasm_bindgen] +pub struct OutRef(cardano_projected_nft::OutRef); + +#[wasm_bindgen] +impl OutRef { + pub fn to_json(&self) -> Result { + serde_json::to_string_pretty(&self.0).map_err(|e| JsError::new(&format!("to_json: {}", e))) + } + + pub fn to_json_value(&self) -> Result { + serde_wasm_bindgen::to_value(&self.0) + .map_err(|e| JsError::new(&format!("to_js_value: {}", e))) + } + + pub fn from_json(json: &str) -> Result { + serde_json::from_str(json) + .map(Self) + .map_err(|e| JsError::new(&format!("from_json: {}", e))) + } + + pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { + cml_chain::plutus::PlutusData::from(self.0.clone()).into() + } + + pub fn from_plutus_data( + out_ref: &cml_chain_wasm::plutus::PlutusData, + ) -> Result { + cardano_projected_nft::OutRef::try_from(Into::::into( + out_ref.clone(), + )) + .map(OutRef) + .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) + } + + pub fn new(tx_id: &cml_crypto_wasm::TransactionHash, index: u64) -> Self { + Self(cardano_projected_nft::OutRef::new( + tx_id.clone().into(), + index, + )) + } +} + +impl From for OutRef { + fn from(native: cardano_projected_nft::OutRef) -> Self { + Self(native) + } +} + +impl From for cardano_projected_nft::OutRef { + fn from(wasm: OutRef) -> Self { + wasm.0 + } +} + +impl AsRef for OutRef { + fn as_ref(&self) -> &cardano_projected_nft::OutRef { + &self.0 + } +} diff --git a/cardano/sdk/wasm/src/utils.rs b/cardano/sdk/wasm/src/utils.rs new file mode 100644 index 0000000..ec19674 --- /dev/null +++ b/cardano/sdk/wasm/src/utils.rs @@ -0,0 +1,81 @@ +use crate::*; + +#[wasm_bindgen] +impl MintRedeemer { + pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { + cml_chain::plutus::PlutusData::from(self.0.clone()).into() + } + + pub fn from_plutus_data( + redeemer: &cml_chain_wasm::plutus::PlutusData, + ) -> Result { + cardano_projected_nft::MintRedeemer::try_from( + Into::::into(redeemer.clone()), + ) + .map(MintRedeemer) + .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) + } +} + +#[wasm_bindgen] +impl Owner { + pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { + cml_chain::plutus::PlutusData::from(self.0.clone()).into() + } + + pub fn from_plutus_data(owner: &cml_chain_wasm::plutus::PlutusData) -> Result { + cardano_projected_nft::Owner::try_from(Into::::into( + owner.clone(), + )) + .map(Owner) + .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) + } +} + +impl Redeem { + pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { + cml_chain::plutus::PlutusData::from(self.0.clone()).into() + } + + pub fn from_plutus_data( + redeemer: &cml_chain_wasm::plutus::PlutusData, + ) -> Result { + cardano_projected_nft::Redeem::try_from(Into::::into( + redeemer.clone(), + )) + .map(Redeem) + .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) + } +} + +#[wasm_bindgen] +impl State { + pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { + cml_chain::plutus::PlutusData::from(self.0.clone()).into() + } + + pub fn from_plutus_data(state: &cml_chain_wasm::plutus::PlutusData) -> Result { + cardano_projected_nft::State::try_from(Into::::into( + state.clone(), + )) + .map(State) + .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) + } +} + +#[wasm_bindgen] +impl Status { + pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { + cml_chain::plutus::PlutusData::from(self.0.clone()).into() + } + + pub fn from_plutus_data( + status: &cml_chain_wasm::plutus::PlutusData, + ) -> Result { + cardano_projected_nft::Status::try_from(Into::::into( + status.clone(), + )) + .map(Status) + .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) + } +} diff --git a/validators/hololocker.ak b/cardano/validators/hololocker.ak similarity index 100% rename from validators/hololocker.ak rename to cardano/validators/hololocker.ak diff --git a/scripts/json-ts-types.js b/scripts/json-ts-types.js index 1bd95a3..2ffabb6 100644 --- a/scripts/json-ts-types.js +++ b/scripts/json-ts-types.js @@ -1,12 +1,12 @@ const fs = require('fs'); const path = require('path') -const repoName = `projected_nft_whirlpool`; -const pkgModName = process.argv.slice(2)[0]; // hyphen name -const pathToRepo = path.join(__dirname, '..', pkgModName, 'wasm'); -const underscorePkgModName = pkgModName.replaceAll('-', '_'); +const crateName = process.argv.slice(2)[0]; +const pathToRepo = path.join(__dirname, '..', crateName, 'wasm'); +const hyphenRepoName = process.argv.slice(2)[1].replaceAll('_', '-'); +const underscoreRepoName = hyphenRepoName.replaceAll('-', '_'); -const inputFile = fs.readFileSync(`${pathToRepo}/pkg/${repoName}_${underscorePkgModName}_wasm.d.ts`, 'utf8').split(/\r?\n/); +const inputFile = fs.readFileSync(`${pathToRepo}/pkg/${underscoreRepoName}.d.ts`, 'utf8').split(/\r?\n/); //console.log(inputFile); let currentClass = null; @@ -34,7 +34,7 @@ for (let i = 0; i < inputFile.length; ++i) { } const jsonDefs = fs.readFileSync('./json-gen/output/json-types.d.ts', 'utf8'); fs.writeFile( - `${pathToRepo}/pkg/${repoName}_${pkgModName}_wasm.d.ts`, + `${pathToRepo}/pkg/${underscoreRepoName}_wasm.d.ts`, `${inputFile.join('\n')}\n${jsonDefs}`, (err) => { if (err != null) { diff --git a/scripts/publish-helper.js b/scripts/publish-helper.js index 79a085c..64e5730 100644 --- a/scripts/publish-helper.js +++ b/scripts/publish-helper.js @@ -1,32 +1,31 @@ const fs = require('fs'); const path = require('path') -const pkgModName = process.argv.slice(2)[0]; // hyphen names -const buildType /* : '-browser' | '-asmjs' | '-nodejs' */ = process.argv.slice(2)[1]; +const crateName = process.argv.slice(2)[0]; +const hyphenRepoName = process.argv.slice(2)[1].replaceAll('_', '-'); +const buildType /* : '-browser' | '-asmjs' | '-nodejs' */ = process.argv.slice(2)[2]; -const pathToRepo = path.join(__dirname, '..', pkgModName, 'wasm'); +const underscoreRepoName = hyphenRepoName.replaceAll('-', '_'); +const pathToRepo = path.join(__dirname, '..', crateName, 'wasm'); const oldPkg = require(`${pathToRepo}/publish/package.json`); -const repoName = `projected_nft_whirlpool`; -const baseHyphenName = repoName.replaceAll('_', '-'); -const underscorePkgModName = pkgModName.replaceAll('-', '_'); - -if (oldPkg.name === `${baseHyphenName}-${pkgModName}-wasm`) { +oldPkg.name = oldPkg.name.split("-wasm")[0]; +if (oldPkg.name === hyphenRepoName) { oldPkg.name = '@paima/' + oldPkg.name + buildType; } if (buildType === '-browser' || buildType === '-asmjs') { // due to a bug in wasm-pack, this file is missing from browser builds - const missingFile = `${repoName}_${underscorePkgModName}_bg.js`; + const missingFile = `${underscoreRepoName}_bg.js`; if (oldPkg.files.find(entry => entry === missingFile) == null) { oldPkg.files.push(missingFile); } } if (buildType === '-asmjs') { // need to replace WASM with ASM package - const missingFile = `${repoName}_${underscorePkgModName}_bg.wasm`; + const missingFile = `${underscoreRepoName}_bg.wasm`; oldPkg.files = [ - `${repoName}_${underscorePkgModName}.asm.js`, - ...oldPkg.files.filter(file => file !== `${repoName}_${underscorePkgModName}_bg.wasm`) + `${underscoreRepoName}.asm.js`, + ...oldPkg.files.filter(file => file !== `${underscoreRepoName}_bg.wasm`) ]; } diff --git a/scripts/wasm-to-asm.js b/scripts/wasm-to-asm.js index c22c2d7..b3c7118 100755 --- a/scripts/wasm-to-asm.js +++ b/scripts/wasm-to-asm.js @@ -2,7 +2,7 @@ const fs = require('fs') const pkgModName = process.argv.slice(2)[0]; -const repoName = `projected_nft_whirlpool`; +const repoName = `cardano_projected_nft`; const paths = [ `./pkg/${repoName}_${pkgModName}_bg.js`, diff --git a/sdk/wasm/package.json b/sdk/wasm/package.json deleted file mode 100644 index 5009099..0000000 --- a/sdk/wasm/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "cardano-projected-nft-sdk-wasm", - "version": "1.0.0", - "description": "Cardano Projected NFT SDK", - "keywords": [ - "cardano" - ], - "scripts": { - "rust:build-nodejs": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=nodejs; npm run js:ts-json-gen; wasm-pack pack", - "rust:build-browser": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=browser; npm run js:ts-json-gen; wasm-pack pack", - "rust:build-web": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=web; npm run js:ts-json-gen; wasm-pack pack", - "rust:publish": "cargo publish", - "rust:check-warnings": "(RUSTFLAGS=\"-D warnings\" cargo +stable build)", - "rust:test": "cargo test", - "js:prepublish": "npm run rust:test && rimraf ./publish && cp -r ./pkg ./publish && cp README.md publish/ && cp ../../LICENSE publish/", - "js:test-publish": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper cardano-projected-nft-sdk-wasm -nodejs && cd publish", - "js:publish-nodejs:prod": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper cardano-projected-nft-sdk-wasm -nodejs && cd publish && npm publish --access public", - "js:publish-nodejs:beta": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper cardano-projected-nft-sdk-wasm -nodejs && cd publish && npm publish --tag beta --access public", - "js:publish-browser:prod": "npm run rust:build-browser && npm run js:prepublish && node ../../scripts/publish-helper cardano-projected-nft-sdk-wasm -browser && cd publish && npm publish --access public", - "js:publish-browser:beta": "npm run rust:build-browser && npm run js:prepublish && node ../../scripts/publish-helper cardano-projected-nft-sdk-wasm -browser && cd publish && npm publish --tag beta --access public", - "js:ts-json-gen": "cd json-gen && cargo +stable run && cd .. && node ../../scripts/run-json2ts.js && node ../../scripts/json-ts-types.js cardano-projected-nft-sdk-wasm" - }, - "husky": { - "hooks": { - "pre-push": "npm run rust:test && npm run rust:build-nodejs" - } - }, - "author": "dcSpark", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/dcSpark/projected-nft-whirlpool.git" - }, - "devDependencies": { - "husky": "4.2.5", - "json-schema-to-typescript": "^10.1.5", - "rimraf": "3.0.2", - "cross-env": "^7.0.3" - } -} diff --git a/sdk/wasm/src/lib.rs b/sdk/wasm/src/lib.rs deleted file mode 100644 index 5d7d300..0000000 --- a/sdk/wasm/src/lib.rs +++ /dev/null @@ -1,534 +0,0 @@ -#![allow( - clippy::len_without_is_empty, - clippy::too_many_arguments, - clippy::new_without_default -)] -// This file was code-generated using an experimental CDDL to rust tool: -// https://github.com/dcSpark/cddl-codegen - -use cml_chain::assets::AssetName; - -use wasm_bindgen::prelude::{wasm_bindgen, JsValue}; - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct MintRedeemer(cardano_projected_nft_sdk::MintRedeemer); - -#[wasm_bindgen] -impl MintRedeemer { - pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { - cml_chain::plutus::PlutusData::from(self.0.clone()).into() - } - - pub fn from_plutus_data( - redeemer: &cml_chain_wasm::plutus::PlutusData, - ) -> Result { - cardano_projected_nft_sdk::MintRedeemer::try_from( - Into::::into(redeemer.clone()), - ) - .map(MintRedeemer) - .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) - } - - pub fn to_json(&self) -> Result { - serde_json::to_string_pretty(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_json: {}", e))) - } - - pub fn to_json_value(&self) -> Result { - serde_wasm_bindgen::to_value(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_js_value: {}", e))) - } - - pub fn from_json(json: &str) -> Result { - serde_json::from_str(json) - .map(Self) - .map_err(|e| JsValue::from_str(&format!("from_json: {}", e))) - } - - pub fn new_mint(total: u64) -> Self { - Self(cardano_projected_nft_sdk::MintRedeemer::new_mint(total)) - } - - pub fn new_burn() -> Self { - Self(cardano_projected_nft_sdk::MintRedeemer::new_burn()) - } - - pub fn kind(&self) -> MintRedeemerKind { - match &self.0 { - cardano_projected_nft_sdk::MintRedeemer::MintTokens { .. } => { - MintRedeemerKind::MintTokens - } - cardano_projected_nft_sdk::MintRedeemer::BurnTokens => MintRedeemerKind::BurnTokens, - } - } - - pub fn as_mint_tokens(&self) -> Option { - match &self.0 { - cardano_projected_nft_sdk::MintRedeemer::MintTokens { total } => Some(*total), - _ => None, - } - } -} - -impl From for MintRedeemer { - fn from(native: cardano_projected_nft_sdk::MintRedeemer) -> Self { - Self(native) - } -} - -impl From for cardano_projected_nft_sdk::MintRedeemer { - fn from(wasm: MintRedeemer) -> Self { - wasm.0 - } -} - -impl AsRef for MintRedeemer { - fn as_ref(&self) -> &cardano_projected_nft_sdk::MintRedeemer { - &self.0 - } -} - -#[wasm_bindgen] -pub enum MintRedeemerKind { - MintTokens, - BurnTokens, -} - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct NFT(cml_chain::PolicyId, cml_chain::assets::AssetName); - -#[wasm_bindgen] -impl NFT { - pub fn new( - policy_id: &cml_chain_wasm::PolicyId, - asset_name: &cml_chain_wasm::assets::AssetName, - ) -> NFT { - Self( - policy_id.clone().into(), - Into::::into(asset_name.clone()), - ) - } - - pub fn policy_id(&self) -> cml_chain_wasm::PolicyId { - self.0.into() - } - - pub fn asset_name(&self) -> cml_chain_wasm::assets::AssetName { - self.1.clone().into() - } -} - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct Owner(cardano_projected_nft_sdk::Owner); - -#[wasm_bindgen] -impl Owner { - pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { - cml_chain::plutus::PlutusData::from(self.0.clone()).into() - } - - pub fn from_plutus_data(owner: &cml_chain_wasm::plutus::PlutusData) -> Result { - cardano_projected_nft_sdk::Owner::try_from(Into::::into( - owner.clone(), - )) - .map(Owner) - .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) - } - - pub fn to_json(&self) -> Result { - serde_json::to_string_pretty(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_json: {}", e))) - } - - pub fn to_json_value(&self) -> Result { - serde_wasm_bindgen::to_value(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_js_value: {}", e))) - } - - pub fn from_json(json: &str) -> Result { - serde_json::from_str(json) - .map(Self) - .map_err(|e| JsValue::from_str(&format!("from_json: {}", e))) - } - - pub fn new_keyhash(keyhash: &cml_crypto_wasm::Ed25519KeyHash) -> Self { - Self(cardano_projected_nft_sdk::Owner::new_keyhash( - keyhash.clone().into(), - )) - } - - pub fn new_nft(nft: &NFT) -> Self { - Self(cardano_projected_nft_sdk::Owner::new_nft( - nft.0, - nft.1.clone(), - )) - } - - pub fn new_receipt(receipt: &cml_chain_wasm::assets::AssetName) -> Self { - Self(cardano_projected_nft_sdk::Owner::new_receipt( - receipt.clone().into(), - )) - } - - pub fn kind(&self) -> OwnerKind { - match &self.0 { - cardano_projected_nft_sdk::Owner::PKH(_) => OwnerKind::PublicKeyHash, - cardano_projected_nft_sdk::Owner::NFT(_, _) => OwnerKind::NFT, - cardano_projected_nft_sdk::Owner::Receipt(_) => OwnerKind::Receipt, - } - } - - pub fn as_public_keyhash(&self) -> Option { - match &self.0 { - cardano_projected_nft_sdk::Owner::PKH(pkh) => Some((*pkh).into()), - _ => None, - } - } - - pub fn as_nft(&self) -> Option { - match &self.0 { - cardano_projected_nft_sdk::Owner::NFT(policy_id, asset_name) => { - Some(NFT(*policy_id, asset_name.clone())) - } - _ => None, - } - } - - pub fn as_receipt(&self) -> Option { - match &self.0 { - cardano_projected_nft_sdk::Owner::Receipt(receipt) => Some(receipt.clone().into()), - _ => None, - } - } -} - -impl From for Owner { - fn from(native: cardano_projected_nft_sdk::Owner) -> Self { - Self(native) - } -} - -impl From for cardano_projected_nft_sdk::Owner { - fn from(wasm: Owner) -> Self { - wasm.0 - } -} - -impl AsRef for Owner { - fn as_ref(&self) -> &cardano_projected_nft_sdk::Owner { - &self.0 - } -} - -#[wasm_bindgen] -pub enum OwnerKind { - PublicKeyHash, - NFT, - Receipt, -} - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct Redeem(cardano_projected_nft_sdk::Redeem); - -impl Redeem { - pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { - cml_chain::plutus::PlutusData::from(self.0.clone()).into() - } - - pub fn from_plutus_data( - redeemer: &cml_chain_wasm::plutus::PlutusData, - ) -> Result { - cardano_projected_nft_sdk::Redeem::try_from(Into::::into( - redeemer.clone(), - )) - .map(Redeem) - .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) - } - - pub fn to_json(&self) -> Result { - serde_json::to_string_pretty(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_json: {}", e))) - } - - pub fn to_json_value(&self) -> Result { - serde_wasm_bindgen::to_value(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_js_value: {}", e))) - } - - pub fn from_json(json: &str) -> Result { - serde_json::from_str(json) - .map(Self) - .map_err(|e| JsValue::from_str(&format!("from_json: {}", e))) - } - - pub fn partial_withdraw(&self) -> bool { - self.0.partial_withdraw - } - - pub fn nft_input_owner(&self) -> Option { - self.0.nft_input_owner.clone().map(std::convert::Into::into) - } - - pub fn new_receipt_owner(&self) -> Option { - self.0 - .new_receipt_owner - .clone() - .map(std::convert::Into::into) - } - - pub fn new( - partial_withdraw: bool, - nft_input_owner: Option, - new_receipt_owner: Option, - ) -> Self { - Self(cardano_projected_nft_sdk::Redeem::new( - partial_withdraw, - nft_input_owner.map(Into::into), - new_receipt_owner.map(Into::into), - )) - } -} - -impl From for Redeem { - fn from(native: cardano_projected_nft_sdk::Redeem) -> Self { - Self(native) - } -} - -impl From for cardano_projected_nft_sdk::Redeem { - fn from(wasm: Redeem) -> Self { - wasm.0 - } -} - -impl AsRef for Redeem { - fn as_ref(&self) -> &cardano_projected_nft_sdk::Redeem { - &self.0 - } -} - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct State(cardano_projected_nft_sdk::State); - -#[wasm_bindgen] -impl State { - pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { - cml_chain::plutus::PlutusData::from(self.0.clone()).into() - } - - pub fn from_plutus_data(state: &cml_chain_wasm::plutus::PlutusData) -> Result { - cardano_projected_nft_sdk::State::try_from(Into::::into( - state.clone(), - )) - .map(State) - .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) - } - - pub fn to_json(&self) -> Result { - serde_json::to_string_pretty(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_json: {}", e))) - } - - pub fn to_json_value(&self) -> Result { - serde_wasm_bindgen::to_value(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_js_value: {}", e))) - } - - pub fn from_json(json: &str) -> Result { - serde_json::from_str(json) - .map(Self) - .map_err(|e| JsValue::from_str(&format!("from_json: {}", e))) - } - - pub fn owner(&self) -> Owner { - self.0.owner.clone().into() - } - - pub fn status(&self) -> Status { - self.0.status.clone().into() - } - - pub fn new(owner: &Owner, status: &Status) -> Self { - Self(cardano_projected_nft_sdk::State::new( - owner.clone().into(), - status.clone().into(), - )) - } -} - -impl From for State { - fn from(native: cardano_projected_nft_sdk::State) -> Self { - Self(native) - } -} - -impl From for cardano_projected_nft_sdk::State { - fn from(wasm: State) -> Self { - wasm.0 - } -} - -impl AsRef for State { - fn as_ref(&self) -> &cardano_projected_nft_sdk::State { - &self.0 - } -} - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct Status(cardano_projected_nft_sdk::Status); - -#[wasm_bindgen] -impl Status { - pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { - cml_chain::plutus::PlutusData::from(self.0.clone()).into() - } - - pub fn from_plutus_data( - status: &cml_chain_wasm::plutus::PlutusData, - ) -> Result { - cardano_projected_nft_sdk::Status::try_from(Into::::into( - status.clone(), - )) - .map(Status) - .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) - } - - pub fn to_json(&self) -> Result { - serde_json::to_string_pretty(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_json: {}", e))) - } - - pub fn to_json_value(&self) -> Result { - serde_wasm_bindgen::to_value(&self.0) - .map_err(|e| JsValue::from_str(&format!("to_js_value: {}", e))) - } - - pub fn from_json(json: &str) -> Result { - serde_json::from_str(json) - .map(Self) - .map_err(|e| JsValue::from_str(&format!("from_json: {}", e))) - } - - pub fn new_locked() -> Self { - Self(cardano_projected_nft_sdk::Status::new_locked()) - } - - pub fn new_unlocking(unlocking: &UnlockingStatus) -> Self { - Self(cardano_projected_nft_sdk::Status::new_unlocking( - unlocking.out_ref().clone().into(), - unlocking.for_how_long(), - )) - } - - pub fn kind(&self) -> StatusKind { - match &self.0 { - cardano_projected_nft_sdk::Status::Locked { .. } => StatusKind::Locked, - cardano_projected_nft_sdk::Status::Unlocking { .. } => StatusKind::Unlocking, - } - } - - pub fn as_unlocking(&self) -> Option { - match &self.0 { - cardano_projected_nft_sdk::Status::Unlocking { - out_ref, - for_how_long, - } => Some(UnlockingStatus(out_ref.clone(), *for_how_long)), - _ => None, - } - } -} - -impl From for Status { - fn from(native: cardano_projected_nft_sdk::Status) -> Self { - Self(native) - } -} - -impl From for cardano_projected_nft_sdk::Status { - fn from(wasm: Status) -> Self { - wasm.0 - } -} - -impl AsRef for Status { - fn as_ref(&self) -> &cardano_projected_nft_sdk::Status { - &self.0 - } -} - -#[wasm_bindgen] -pub enum StatusKind { - Locked, - Unlocking, -} - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct UnlockingStatus(cardano_projected_nft_sdk::OutRef, u64); - -#[wasm_bindgen] -impl UnlockingStatus { - pub fn out_ref(&self) -> OutRef { - self.0.clone().into() - } - - pub fn for_how_long(&self) -> u64 { - self.1 - } - - pub fn new(out_ref: &OutRef, for_how_long: u64) -> Self { - UnlockingStatus(out_ref.clone().into(), for_how_long) - } -} - -#[derive(Clone, Debug)] -#[wasm_bindgen] -pub struct OutRef(cardano_projected_nft_sdk::OutRef); - -#[wasm_bindgen] -impl OutRef { - pub fn to_plutus_data(&self) -> cml_chain_wasm::plutus::PlutusData { - cml_chain::plutus::PlutusData::from(self.0.clone()).into() - } - - pub fn from_plutus_data( - out_ref: &cml_chain_wasm::plutus::PlutusData, - ) -> Result { - cardano_projected_nft_sdk::OutRef::try_from(Into::::into( - out_ref.clone(), - )) - .map(OutRef) - .map_err(|e| JsValue::from_str(&format!("from_plutus_data: {}", e))) - } - - pub fn new(tx_id: &cml_crypto_wasm::TransactionHash, index: u64) -> Self { - Self(cardano_projected_nft_sdk::OutRef::new( - tx_id.clone().into(), - index, - )) - } -} - -impl From for OutRef { - fn from(native: cardano_projected_nft_sdk::OutRef) -> Self { - Self(native) - } -} - -impl From for cardano_projected_nft_sdk::OutRef { - fn from(wasm: OutRef) -> Self { - wasm.0 - } -} - -impl AsRef for OutRef { - fn as_ref(&self) -> &cardano_projected_nft_sdk::OutRef { - &self.0 - } -}