diff --git a/.gitignore b/.gitignore
index 8295450d89..00a4be02e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
**/target/**
+**/dist
# Remove Cargo.lock from the framework, but not from the wasm contracts.
# In contracts it helps with tracing builds.
diff --git a/Cargo.lock b/Cargo.lock
index 18b8fbb93d..bb46cc1359 100755
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -164,6 +164,12 @@ version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
+[[package]]
+name = "anymap2"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c"
+
[[package]]
name = "arbitrary"
version = "1.3.2"
@@ -236,6 +242,7 @@ dependencies = [
"clap",
"multiversx-sc-snippets",
"serde",
+ "tokio",
"toml",
]
@@ -255,6 +262,7 @@ dependencies = [
"clap",
"multiversx-sc-snippets",
"serde",
+ "tokio",
"toml",
]
@@ -289,6 +297,15 @@ dependencies = [
"multiversx-sc-meta-lib",
]
+[[package]]
+name = "bincode"
+version = "1.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "bip39"
version = "2.0.0"
@@ -340,6 +357,12 @@ dependencies = [
"multiversx-sc-meta-lib",
]
+[[package]]
+name = "boolinator"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9"
+
[[package]]
name = "bstr"
version = "1.10.0"
@@ -475,7 +498,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -524,6 +547,26 @@ dependencies = [
"vault",
]
+[[package]]
+name = "console_error_panic_hook"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
+dependencies = [
+ "cfg-if",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "console_log"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f"
+dependencies = [
+ "log",
+ "web-sys",
+]
+
[[package]]
name = "const-oid"
version = "0.9.6"
@@ -718,7 +761,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -739,7 +782,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -777,7 +820,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -1076,9 +1119,9 @@ dependencies = [
[[package]]
name = "flate2"
-version = "1.0.33"
+version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253"
+checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0"
dependencies = [
"crc32fast",
"miniz_oxide",
@@ -1269,7 +1312,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -1344,6 +1387,209 @@ dependencies = [
"regex-syntax",
]
+[[package]]
+name = "gloo"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d"
+dependencies = [
+ "gloo-console",
+ "gloo-dialogs",
+ "gloo-events",
+ "gloo-file",
+ "gloo-history",
+ "gloo-net 0.3.1",
+ "gloo-render",
+ "gloo-storage",
+ "gloo-timers",
+ "gloo-utils 0.1.7",
+ "gloo-worker",
+]
+
+[[package]]
+name = "gloo-console"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f"
+dependencies = [
+ "gloo-utils 0.1.7",
+ "js-sys",
+ "serde",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-dialogs"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6"
+dependencies = [
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-events"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc"
+dependencies = [
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-file"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7"
+dependencies = [
+ "futures-channel",
+ "gloo-events",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-history"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f"
+dependencies = [
+ "gloo-events",
+ "gloo-utils 0.1.7",
+ "serde",
+ "serde-wasm-bindgen",
+ "serde_urlencoded",
+ "thiserror",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-net"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-sink",
+ "gloo-utils 0.1.7",
+ "http 0.2.12",
+ "js-sys",
+ "pin-project",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-net"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c06f627b1a58ca3d42b45d6104bf1e1a03799df472df00988b6ba21accc10580"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-sink",
+ "gloo-utils 0.2.0",
+ "http 1.1.0",
+ "js-sys",
+ "pin-project",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-render"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764"
+dependencies = [
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-storage"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480"
+dependencies = [
+ "gloo-utils 0.1.7",
+ "js-sys",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-timers"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "gloo-utils"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e"
+dependencies = [
+ "js-sys",
+ "serde",
+ "serde_json",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-utils"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa"
+dependencies = [
+ "js-sys",
+ "serde",
+ "serde_json",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "gloo-worker"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a"
+dependencies = [
+ "anymap2",
+ "bincode",
+ "gloo-console",
+ "gloo-utils 0.1.7",
+ "js-sys",
+ "serde",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
[[package]]
name = "h2"
version = "0.4.6"
@@ -1355,14 +1601,20 @@ dependencies = [
"fnv",
"futures-core",
"futures-sink",
- "http",
- "indexmap",
+ "http 1.1.0",
+ "indexmap 2.5.0",
"slab",
"tokio",
"tokio-util",
"tracing",
]
+[[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+
[[package]]
name = "hashbrown"
version = "0.14.5"
@@ -1406,6 +1658,17 @@ dependencies = [
"digest",
]
+[[package]]
+name = "http"
+version = "0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
+dependencies = [
+ "bytes",
+ "fnv",
+ "itoa",
+]
+
[[package]]
name = "http"
version = "1.1.0"
@@ -1424,7 +1687,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
dependencies = [
"bytes",
- "http",
+ "http 1.1.0",
]
[[package]]
@@ -1435,7 +1698,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
dependencies = [
"bytes",
"futures-util",
- "http",
+ "http 1.1.0",
"http-body",
"pin-project-lite",
]
@@ -1462,7 +1725,7 @@ dependencies = [
"futures-channel",
"futures-util",
"h2",
- "http",
+ "http 1.1.0",
"http-body",
"httparse",
"itoa",
@@ -1479,7 +1742,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
dependencies = [
"futures-util",
- "http",
+ "http 1.1.0",
"hyper",
"hyper-util",
"rustls",
@@ -1514,7 +1777,7 @@ dependencies = [
"bytes",
"futures-channel",
"futures-util",
- "http",
+ "http 1.1.0",
"http-body",
"hyper",
"pin-project-lite",
@@ -1550,6 +1813,25 @@ dependencies = [
"winapi-util",
]
+[[package]]
+name = "implicit-clone"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfd6201e7c30ccb24773cac7efa6fec1e06189d414b7439ce756a481c8bfbf53"
+dependencies = [
+ "indexmap 1.9.3",
+]
+
+[[package]]
+name = "indexmap"
+version = "1.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
+dependencies = [
+ "autocfg",
+ "hashbrown 0.12.3",
+]
+
[[package]]
name = "indexmap"
version = "2.5.0"
@@ -1557,7 +1839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
dependencies = [
"equivalent",
- "hashbrown",
+ "hashbrown 0.14.5",
"serde",
]
@@ -1578,6 +1860,7 @@ dependencies = [
"multiversx-sc",
"multiversx-sc-snippets",
"serde",
+ "tokio",
"toml",
]
@@ -1920,6 +2203,7 @@ dependencies = [
"multiversx-sc-scenario",
"multiversx-sc-snippets",
"serde",
+ "tokio",
"toml",
]
@@ -2019,7 +2303,7 @@ dependencies = [
"hex",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -2030,7 +2314,7 @@ dependencies = [
"proc-macro2",
"quote",
"radix_trie",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -2123,6 +2407,24 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "multiversx-sc-snippets-dapp"
+version = "0.53.0"
+dependencies = [
+ "base64",
+ "env_logger",
+ "futures",
+ "hex",
+ "js-sys",
+ "log",
+ "multiversx-chain-scenario-format",
+ "multiversx-sc-scenario",
+ "multiversx-sdk-wbg",
+ "serde_json",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
[[package]]
name = "multiversx-sc-wasm-adapter"
version = "0.53.0"
@@ -2170,6 +2472,22 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "multiversx-sdk-wbg"
+version = "0.6.0"
+dependencies = [
+ "anyhow",
+ "gloo-net 0.6.0",
+ "hex",
+ "itertools",
+ "js-sys",
+ "log",
+ "multiversx-sdk",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
[[package]]
name = "multiversx-wegld-swap-sc"
version = "0.53.0"
@@ -2302,6 +2620,16 @@ dependencies = [
"autocfg",
]
+[[package]]
+name = "num_cpus"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
[[package]]
name = "object"
version = "0.36.4"
@@ -2340,7 +2668,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -2504,6 +2832,26 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
+[[package]]
+name = "pin-project"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
+dependencies = [
+ "pin-project-internal",
+]
+
+[[package]]
+name = "pin-project-internal"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.77",
+]
+
[[package]]
name = "pin-project-lite"
version = "0.2.14"
@@ -2516,6 +2864,21 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+[[package]]
+name = "ping-pong-dapp"
+version = "0.1.0"
+dependencies = [
+ "console_log",
+ "log",
+ "multiversx-sc-snippets-dapp",
+ "serde",
+ "serde_json",
+ "wasm-bindgen-futures",
+ "yew",
+ "yew-router",
+ "yew_icons",
+]
+
[[package]]
name = "ping-pong-egld"
version = "0.0.2"
@@ -2532,6 +2895,17 @@ dependencies = [
"ping-pong-egld",
]
+[[package]]
+name = "pinned"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b"
+dependencies = [
+ "futures",
+ "rustversion",
+ "thiserror",
+]
+
[[package]]
name = "pkcs8"
version = "0.10.2"
@@ -2557,6 +2931,40 @@ dependencies = [
"zerocopy",
]
+[[package]]
+name = "prettyplease"
+version = "0.1.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86"
+dependencies = [
+ "proc-macro2",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
[[package]]
name = "proc-macro2"
version = "1.0.86"
@@ -2566,6 +2974,23 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "prokio"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488"
+dependencies = [
+ "futures",
+ "gloo",
+ "num_cpus",
+ "once_cell",
+ "pin-project",
+ "pinned",
+ "tokio",
+ "tokio-stream",
+ "wasm-bindgen-futures",
+]
+
[[package]]
name = "promises-features"
version = "0.0.0"
@@ -2781,7 +3206,7 @@ dependencies = [
"futures-core",
"futures-util",
"h2",
- "http",
+ "http 1.1.0",
"http-body",
"http-body-util",
"hyper",
@@ -2844,6 +3269,12 @@ dependencies = [
"windows-sys 0.52.0",
]
+[[package]]
+name = "route-recognizer"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746"
+
[[package]]
name = "ruplacer"
version = "0.8.2"
@@ -2965,6 +3396,12 @@ dependencies = [
"untrusted",
]
+[[package]]
+name = "rustversion"
+version = "1.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
+
[[package]]
name = "ryu"
version = "1.0.18"
@@ -3120,6 +3557,17 @@ dependencies = [
"serde_derive",
]
+[[package]]
+name = "serde-wasm-bindgen"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e"
+dependencies = [
+ "js-sys",
+ "serde",
+ "wasm-bindgen",
+]
+
[[package]]
name = "serde_derive"
version = "1.0.210"
@@ -3128,7 +3576,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -3137,7 +3585,7 @@ version = "1.0.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
dependencies = [
- "indexmap",
+ "indexmap 2.5.0",
"itoa",
"memchr",
"ryu",
@@ -3152,7 +3600,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -3330,6 +3778,17 @@ version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+[[package]]
+name = "syn"
+version = "1.0.109"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
[[package]]
name = "syn"
version = "2.0.77"
@@ -3378,6 +3837,7 @@ dependencies = [
"clap",
"multiversx-sc-snippets",
"serde",
+ "tokio",
"toml",
]
@@ -3420,7 +3880,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -3480,7 +3940,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -3504,6 +3964,17 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "tokio-stream"
+version = "0.1.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1"
+dependencies = [
+ "futures-core",
+ "pin-project-lite",
+ "tokio",
+]
+
[[package]]
name = "tokio-util"
version = "0.7.12"
@@ -3523,7 +3994,7 @@ version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
dependencies = [
- "indexmap",
+ "indexmap 2.5.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -3545,7 +4016,7 @@ version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
- "indexmap",
+ "indexmap 2.5.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -3565,9 +4036,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
"pin-project-lite",
+ "tracing-attributes",
"tracing-core",
]
+[[package]]
+name = "tracing-attributes"
+version = "0.1.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.77",
+]
+
[[package]]
name = "tracing-core"
version = "0.1.32"
@@ -3782,7 +4265,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
"wasm-bindgen-shared",
]
@@ -3816,7 +4299,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -3835,8 +4318,8 @@ checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3"
dependencies = [
"ahash",
"bitflags",
- "hashbrown",
- "indexmap",
+ "hashbrown 0.14.5",
+ "indexmap 2.5.0",
"semver",
"serde",
]
@@ -4058,6 +4541,84 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "yew"
+version = "0.20.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc"
+dependencies = [
+ "console_error_panic_hook",
+ "futures",
+ "gloo",
+ "implicit-clone",
+ "indexmap 1.9.3",
+ "js-sys",
+ "prokio",
+ "rustversion",
+ "serde",
+ "slab",
+ "thiserror",
+ "tokio",
+ "tracing",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+ "yew-macro",
+]
+
+[[package]]
+name = "yew-macro"
+version = "0.20.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b64c253c1d401f1ea868ca9988db63958cfa15a69f739101f338d6f05eea8301"
+dependencies = [
+ "boolinator",
+ "once_cell",
+ "prettyplease",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "yew-router"
+version = "0.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "426ee0486d2572a6c5e39fbdbc48b58d59bb555f3326f54631025266cf04146e"
+dependencies = [
+ "gloo",
+ "js-sys",
+ "route-recognizer",
+ "serde",
+ "serde_urlencoded",
+ "tracing",
+ "wasm-bindgen",
+ "web-sys",
+ "yew",
+ "yew-router-macro",
+]
+
+[[package]]
+name = "yew-router-macro"
+version = "0.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89b249cdb39e0cddaf0644dedc781854524374664793479fdc01e6a65d6e6ae3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "yew_icons"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2f01768685c7bba96996a1ba91902653a37b2bfd6e937c73cfd132201693d4b"
+dependencies = [
+ "yew",
+]
+
[[package]]
name = "zerocopy"
version = "0.7.35"
@@ -4076,7 +4637,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.77",
]
[[package]]
@@ -4096,7 +4657,7 @@ dependencies = [
"crossbeam-utils",
"displaydoc",
"flate2",
- "indexmap",
+ "indexmap 2.5.0",
"memchr",
"thiserror",
"zopfli",
diff --git a/Cargo.toml b/Cargo.toml
index 2ba98c81a2..e3916f4e9f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,10 +11,12 @@ members = [
"framework/meta-lib",
"framework/scenario",
"framework/snippets",
+ "framework/snippets-dapp",
"framework/wasm-adapter",
"sdk/core",
"sdk/reqwest",
+ "sdk/wbg",
"sdk/scenario-format",
"tools/mxpy-snippet-generator",
@@ -99,6 +101,7 @@ members = [
"contracts/examples/proxy-pause/meta",
"contracts/examples/ping-pong-egld",
"contracts/examples/ping-pong-egld/meta",
+ "contracts/examples/ping-pong-egld/dapp",
"contracts/examples/rewards-distribution",
"contracts/examples/rewards-distribution/meta",
"contracts/examples/seed-nft-minter",
diff --git a/contracts/examples/adder/interact/Cargo.toml b/contracts/examples/adder/interact/Cargo.toml
index b9c18b391b..0663180c81 100644
--- a/contracts/examples/adder/interact/Cargo.toml
+++ b/contracts/examples/adder/interact/Cargo.toml
@@ -13,6 +13,7 @@ path = "src/basic_interact.rs"
clap = { version = "4.4.7", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
toml = "0.8.6"
+tokio = { version = "1.24" }
[dependencies.adder]
path = ".."
diff --git a/contracts/examples/multisig/interact/Cargo.toml b/contracts/examples/multisig/interact/Cargo.toml
index 7d6914bd60..e161ee4a42 100644
--- a/contracts/examples/multisig/interact/Cargo.toml
+++ b/contracts/examples/multisig/interact/Cargo.toml
@@ -13,6 +13,7 @@ path = "src/multisig_interact.rs"
clap = { version = "4.4.7", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
toml = "0.8.6"
+tokio = { version = "1.24" }
[dependencies.multisig]
path = ".."
diff --git a/contracts/examples/ping-pong-egld/dapp/Cargo.toml b/contracts/examples/ping-pong-egld/dapp/Cargo.toml
new file mode 100644
index 0000000000..cdd0300159
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/Cargo.toml
@@ -0,0 +1,17 @@
+[package]
+name = "ping-pong-dapp"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+console_log = "0.2"
+log = "0.4"
+serde = "1.0.210"
+serde_json = "1.0"
+wasm-bindgen-futures = "0.4"
+yew = { version = "0.20.0", features = ["csr"] }
+yew_icons = { version = "0.7.3", features = ["BootstrapHeartFill"] }
+yew-router = { version = "0.17.0" }
+
+[dependencies.multiversx-sc-snippets-dapp]
+path = "../../../../framework/snippets-dapp"
diff --git a/contracts/examples/ping-pong-egld/dapp/index.html b/contracts/examples/ping-pong-egld/dapp/index.html
new file mode 100644
index 0000000000..162a2a7a50
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/contracts/examples/ping-pong-egld/dapp/ping-pong-egld.wasm b/contracts/examples/ping-pong-egld/dapp/ping-pong-egld.wasm
new file mode 100644
index 0000000000..7426d32c86
Binary files /dev/null and b/contracts/examples/ping-pong-egld/dapp/ping-pong-egld.wasm differ
diff --git a/contracts/examples/ping-pong-egld/dapp/readme.md b/contracts/examples/ping-pong-egld/dapp/readme.md
new file mode 100644
index 0000000000..032b2c3d29
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/readme.md
@@ -0,0 +1,9 @@
+# Ping pong dapp example
+
+## Prerequisites
+- trunk
+
+```bash
+cargo install trunk
+```
+Run this example locally with `trunk serve --open`.
\ No newline at end of file
diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/button.rs b/contracts/examples/ping-pong-egld/dapp/src/components/button.rs
new file mode 100644
index 0000000000..cdb898bd59
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/components/button.rs
@@ -0,0 +1,18 @@
+use yew::prelude::*;
+
+#[derive(Properties, PartialEq)]
+pub struct ButtonProps {
+ pub name: String,
+ pub class_name: String,
+ pub button_type: String,
+ pub on_click: Callback,
+}
+
+#[function_component(Button)]
+pub fn button(props: &ButtonProps) -> Html {
+ html! {
+
+ }
+}
diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/footer.rs b/contracts/examples/ping-pong-egld/dapp/src/components/footer.rs
new file mode 100644
index 0000000000..e5d7066c55
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/components/footer.rs
@@ -0,0 +1,15 @@
+use yew::prelude::*;
+use yew_icons::{Icon, IconId};
+
+#[function_component(Footer)]
+pub fn footer() -> Html {
+ html! {
+
+ }
+}
diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/mod.rs b/contracts/examples/ping-pong-egld/dapp/src/components/mod.rs
new file mode 100644
index 0000000000..f55f57e4d0
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/components/mod.rs
@@ -0,0 +1,7 @@
+pub mod button;
+pub mod footer;
+pub mod network_status;
+
+pub use button::Button;
+pub use footer::Footer;
+pub use network_status::NetworkStatusComponent;
diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/network_status.rs b/contracts/examples/ping-pong-egld/dapp/src/components/network_status.rs
new file mode 100644
index 0000000000..74f085f23c
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/components/network_status.rs
@@ -0,0 +1,17 @@
+use yew::prelude::*;
+
+use crate::context::ConfigContext;
+
+#[function_component(NetworkStatusComponent)]
+pub fn network_status() -> Html {
+ let context = use_context::().unwrap();
+ let response = format!("{:?}", &context.network_status);
+
+ html! {
+
+ }
+}
diff --git a/contracts/examples/ping-pong-egld/dapp/src/context.rs b/contracts/examples/ping-pong-egld/dapp/src/context.rs
new file mode 100644
index 0000000000..f09c50fea3
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/context.rs
@@ -0,0 +1,66 @@
+use crate::requests::query;
+
+use html::ChildrenProps;
+use multiversx_sc_snippets_dapp::sdk::data::network_status::NetworkStatus;
+use yew::prelude::*;
+
+#[derive(Clone, Debug, PartialEq)]
+pub struct ConfigContext {
+ pub network_status: NetworkStatus,
+ pub set_network_status: Callback,
+}
+
+pub async fn refresh_context() -> NetworkStatus {
+ log::info!("refreshing context");
+ query::get_network_status().await.unwrap_or_default()
+}
+
+impl Default for ConfigContext {
+ fn default() -> Self {
+ ConfigContext {
+ network_status: NetworkStatus::default(),
+ set_network_status: Callback::noop(),
+ }
+ }
+}
+
+#[function_component(ConfigProvider)]
+pub fn config_provider(props: &ChildrenProps) -> Html {
+ let network_status = use_state(NetworkStatus::default);
+
+ // Clone the state here for use in the callback
+ let set_network_status = {
+ let network_status = network_status.clone();
+ Callback::from(move |new_status: NetworkStatus| {
+ network_status.set(new_status);
+ })
+ };
+
+ // Clone the callback for async usage in the effect
+ let set_network_status_async = set_network_status.clone();
+
+ // refresh context on component mount
+ use_effect_with_deps(
+ move |_| {
+ wasm_bindgen_futures::spawn_local(async move {
+ let new_status = refresh_context().await;
+
+ // Emit the new status inside the async block
+ set_network_status_async.emit(new_status);
+ });
+ || () // no cleanup fn
+ },
+ (), // empty dependency array, run once on mount
+ );
+
+ let context = ConfigContext {
+ network_status: (*network_status).clone(),
+ set_network_status,
+ };
+
+ html! {
+ context={context}>
+ { for props.children.iter() }
+ >
+ }
+}
diff --git a/contracts/examples/ping-pong-egld/dapp/src/interactor.rs b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs
new file mode 100644
index 0000000000..740b3ba609
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs
@@ -0,0 +1,58 @@
+use imports::{Address, Bech32Address, BytesValue};
+use multiversx_sc_snippets_dapp::*;
+use serde::{Deserialize, Serialize};
+
+const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY;
+const CONTRACT_ADDRESS: &str = "erd1qqqqqqqqqqqqqpgq6tqvj5f59xrgxwrtwy30elgpu7l4zrv6d8ssnjdwxq";
+const PING_PONG_CODE: &[u8] = include_bytes!("../ping-pong-egld.wasm");
+
+#[derive(Debug, Default, Serialize, Deserialize)]
+pub struct Config {
+ gateway: String,
+ contract_address: String,
+}
+
+impl Config {
+ // Deserializes state from file
+ pub fn new() -> Self {
+ Config {
+ gateway: GATEWAY.to_string(),
+ contract_address: CONTRACT_ADDRESS.to_string(),
+ }
+ }
+
+ /// Sets the contract address
+ #[allow(unused)]
+ pub fn set_address(&mut self, address: Bech32Address) {
+ self.contract_address = address.to_string()
+ }
+
+ /// Returns the contract address
+ pub fn current_address(&self) -> &String {
+ &self.contract_address
+ }
+}
+
+pub struct ContractInteract {
+ pub interactor: Interactor,
+ pub wallet_address: Address,
+ pub contract_code: BytesValue,
+ pub config: Config,
+}
+
+impl ContractInteract {
+ pub async fn new() -> Self {
+ let config = Config::new();
+ let mut interactor = Interactor::new(&config.gateway).await;
+ let wallet_address = interactor.register_wallet(test_wallets::mike());
+
+ let contract_code = BytesValue::from(PING_PONG_CODE);
+
+ ContractInteract {
+ interactor,
+ wallet_address,
+ contract_code,
+ config,
+ }
+ }
+}
diff --git a/contracts/examples/ping-pong-egld/dapp/src/main.rs b/contracts/examples/ping-pong-egld/dapp/src/main.rs
new file mode 100644
index 0000000000..bb2b4170dc
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/main.rs
@@ -0,0 +1,33 @@
+mod components;
+mod context;
+mod interactor;
+mod pages;
+mod requests;
+mod routes;
+
+use components::Footer;
+use context::ConfigProvider;
+use log::Level;
+use routes::{switch, Route};
+use yew::prelude::*;
+use yew_router::{BrowserRouter, Switch};
+
+#[function_component(App)]
+fn app() -> Html {
+ html! {
+
+
+ render={switch} />
+
+
+
+ }
+}
+
+fn main() {
+ // initialize the logger
+ console_log::init_with_level(Level::Debug).expect("Failed to initialize logger");
+
+ // render the app
+ yew::Renderer::::new().render();
+}
diff --git a/contracts/examples/ping-pong-egld/dapp/src/pages/home.rs b/contracts/examples/ping-pong-egld/dapp/src/pages/home.rs
new file mode 100644
index 0000000000..bc9cf26f40
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/pages/home.rs
@@ -0,0 +1,115 @@
+use crate::{
+ components::{Button, NetworkStatusComponent},
+ requests::transaction,
+};
+use yew::prelude::*;
+
+#[function_component(HomePage)]
+pub fn home_page() -> Html {
+ let show_status = use_state(|| false);
+ let ping_result = use_state(String::new);
+ let new_sc_address = use_state(String::new);
+
+ let show_network_status = {
+ let show_status = show_status.clone();
+
+ Callback::from(move |_| {
+ show_status.set(true);
+ })
+ };
+
+ let deploy_sc = {
+ let new_sc_address = new_sc_address.clone();
+
+ Callback::from(move |_| {
+ let new_sc_address = new_sc_address.clone();
+
+ log::info!("SC setup request triggered");
+
+ wasm_bindgen_futures::spawn_local(async move {
+ match transaction::deploy_sc().await {
+ Ok(result) => {
+ new_sc_address.set(format!(
+ "New deployed address: {}",
+ result.to_bech32_string()
+ ));
+ },
+ Err(err) => {
+ log::error!("SC Setup failed: {:?}", err);
+ new_sc_address.set("SC Setup failed!".to_string());
+ },
+ }
+ });
+ })
+ };
+
+ let ping = {
+ let ping_result = ping_result.clone();
+
+ Callback::from(move |_| {
+ let ping_result = ping_result.clone();
+
+ log::info!("Ping request triggered");
+
+ wasm_bindgen_futures::spawn_local(async move {
+ match transaction::ping().await {
+ Ok(result) => {
+ ping_result.set(result);
+ },
+ Err(err) => {
+ log::error!("Ping failed: {:?}", err);
+ ping_result.set("Ping failed!".to_string());
+ },
+ }
+ });
+ })
+ };
+
+ html! {
+ <>
+
+
+
+
+
+ {
+ if *show_status {
+ html! {
+
+ }
+ }
+ else {
+ html! {}
+ }
+ }
+ {
+ if !new_sc_address.is_empty() {
+ html! {
+
+ {
+ (*new_sc_address).clone()
+ }
+
+ }
+ }
+ else {
+ html! {}
+ }
+ }
+ {
+ if !ping_result.is_empty() {
+ html! {
+
+ {
+ (*ping_result).clone()
+ }
+
+ }
+ }
+ else {
+ html! {}
+ }
+ }
+ >
+ }
+}
diff --git a/contracts/examples/ping-pong-egld/dapp/src/pages/mod.rs b/contracts/examples/ping-pong-egld/dapp/src/pages/mod.rs
new file mode 100644
index 0000000000..0193241d0e
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/pages/mod.rs
@@ -0,0 +1,3 @@
+pub mod home;
+
+pub use home::*;
diff --git a/contracts/examples/ping-pong-egld/dapp/src/requests/mod.rs b/contracts/examples/ping-pong-egld/dapp/src/requests/mod.rs
new file mode 100644
index 0000000000..27f8d7c408
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/requests/mod.rs
@@ -0,0 +1,3 @@
+mod proxy;
+pub mod query;
+pub mod transaction;
diff --git a/contracts/examples/ping-pong-egld/dapp/src/requests/proxy.rs b/contracts/examples/ping-pong-egld/dapp/src/requests/proxy.rs
new file mode 100644
index 0000000000..e5cdd4d4e0
--- /dev/null
+++ b/contracts/examples/ping-pong-egld/dapp/src/requests/proxy.rs
@@ -0,0 +1,264 @@
+// Code generated by the multiversx-sc proxy generator. DO NOT EDIT.
+
+////////////////////////////////////////////////////
+////////////////// AUTO-GENERATED //////////////////
+////////////////////////////////////////////////////
+
+#![allow(dead_code)]
+#![allow(clippy::all)]
+
+use multiversx_sc::proxy_imports::*;
+use multiversx_sc_snippets_dapp::multiversx_sc;
+
+pub struct PingPongProxy;
+
+impl TxProxyTrait for PingPongProxy
+where
+ Env: TxEnv,
+ From: TxFrom,
+ To: TxTo,
+ Gas: TxGas,
+{
+ type TxProxyMethods = PingPongProxyMethods;
+
+ fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods {
+ PingPongProxyMethods { wrapped_tx: tx }
+ }
+}
+
+pub struct PingPongProxyMethods
+where
+ Env: TxEnv,
+ From: TxFrom,
+ To: TxTo,
+ Gas: TxGas,
+{
+ wrapped_tx: Tx,
+}
+
+#[rustfmt::skip]
+impl PingPongProxyMethods
+where
+ Env: TxEnv,
+ Env::Api: VMApi,
+ From: TxFrom,
+ Gas: TxGas,
+{
+ /// Necessary configuration when deploying:
+ /// `ping_amount` - the exact EGLD amount that needs to be sent when `ping`-ing.
+ /// `duration_in_seconds` - how much time (in seconds) until contract expires.
+ /// `opt_activation_timestamp` - optionally specify the contract to only actvivate at a later date.
+ /// `max_funds` - optional funding cap, no more funds than this can be added to the contract.
+ pub fn init<
+ Arg0: ProxyArg>,
+ Arg1: ProxyArg,
+ Arg2: ProxyArg