git.delta.rocks / unique-network / refs/commits / bfa69d53442e

difftreelog

Merge pull request #6 from usetech-llc/feature/NFTPAR-93

usetech-llc2020-10-07parents: #ab1a681 #8eb82cd.patch.diff
in: master
Feature/nftpar-93

15 files changed

addedpurge-running-node.shdiffbeforeafterboth
--- /dev/null
+++ b/purge-running-node.sh
@@ -0,0 +1,3 @@
+docker-compose exec node nft purge-chain --dev --base-path=/chain-data -y
+docker-compose down
+docker-compose up -d
addedtests/flipper-src/.gitignorediffbeforeafterboth
--- /dev/null
+++ b/tests/flipper-src/.gitignore
@@ -0,0 +1,9 @@
+# Ignore build artifacts from the local tests sub-crate.
+/target/
+
+# Ignore backup files creates by cargo fmt.
+**/*.rs.bk
+
+# Remove Cargo.lock when creating an executable, leave it for libraries
+# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
+Cargo.lock
addedtests/flipper-src/.ink/abi_gen/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/tests/flipper-src/.ink/abi_gen/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+name = "abi-gen"
+version = "0.1.0"
+authors = ["Parity Technologies <admin@parity.io>"]
+edition = "2018"
+publish = false
+
+[[bin]]
+name = "abi-gen"
+path = "main.rs"
+
+[dependencies]
+contract = { path = "../..", package = "flipper", default-features = false, features = ["ink-generate-abi"] }
+ink_lang = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_lang", default-features = false, features = ["ink-generate-abi"] }
+serde = "1.0"
+serde_json = "1.0"
addedtests/flipper-src/.ink/abi_gen/main.rsdiffbeforeafterboth
--- /dev/null
+++ b/tests/flipper-src/.ink/abi_gen/main.rs
@@ -0,0 +1,7 @@
+fn main() -> Result<(), std::io::Error> {
+    let abi = <contract::Flipper as ink_lang::GenerateAbi>::generate_abi();
+    let contents = serde_json::to_string_pretty(&abi)?;
+    std::fs::create_dir("target").ok();
+    std::fs::write("target/metadata.json", contents)?;
+    Ok(())
+}
addedtests/flipper-src/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/tests/flipper-src/Cargo.toml
@@ -0,0 +1,67 @@
+[package]
+name = "flipper"
+version = "0.1.0"
+authors = ["[your_name] <[your_email]>"]
+edition = "2018"
+
+[dependencies]
+ink_abi = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_abi", default-features = false, features = ["derive"], optional = true }
+ink_primitives = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_primitives", default-features = false }
+ink_core = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_core", default-features = false }
+ink_lang = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_lang", default-features = false }
+
+scale = { package = "parity-scale-codec", version = "1.2", default-features = false, features = ["derive"] }
+
+[dependencies.type-metadata]
+git = "https://github.com/type-metadata/type-metadata.git"
+rev = "02eae9f35c40c943b56af5b60616219f2b72b47d"
+default-features = false
+features = ["derive"]
+optional = true
+
+[lib]
+name = "flipper"
+path = "lib.rs"
+crate-type = [
+	# Used for normal contract Wasm blobs.
+	"cdylib",
+	# Required for ABI generation, and using this contract as a dependency.
+	# If using `cargo contract build`, it will be automatically disabled to produce a smaller Wasm binary
+	"rlib",
+]
+
+[features]
+default = ["test-env"]
+std = [
+    "ink_abi/std",
+    "ink_core/std",
+    "ink_primitives/std",
+    "scale/std",
+    "type-metadata/std",
+]
+test-env = [
+    "std",
+    "ink_lang/test-env",
+]
+ink-generate-abi = [
+    "std",
+    "ink_abi",
+    "type-metadata",
+    "ink_core/ink-generate-abi",
+    "ink_lang/ink-generate-abi",
+]
+ink-as-dependency = []
+
+[profile.release]
+panic = "abort"
+lto = true
+opt-level = "z"
+overflow-checks = true
+
+[workspace]
+members = [
+	".ink/abi_gen"
+]
+exclude = [
+	".ink"
+]
addedtests/flipper-src/build.shdiffbeforeafterboth
--- /dev/null
+++ b/tests/flipper-src/build.sh
@@ -0,0 +1,2 @@
+cargo +nightly contract build
+cargo +nightly contract generate-metadata
addedtests/flipper-src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/tests/flipper-src/lib.rs
@@ -0,0 +1,76 @@
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use ink_lang as ink;
+
+#[ink::contract(version = "0.1.0")]
+mod flipper {
+    use ink_core::storage;
+
+    /// Defines the storage of your contract.
+    /// Add new fields to the below struct in order
+    /// to add new static storage fields to your contract.
+    #[ink(storage)]
+    struct Flipper {
+        /// Stores a single `bool` value on the storage.
+        value: storage::Value<bool>,
+    }
+
+    impl Flipper {
+        /// Constructor that initializes the `bool` value to the given `init_value`.
+        #[ink(constructor)]
+        fn new(&mut self, init_value: bool) {
+            self.value.set(init_value);
+        }
+
+        /// Constructor that initializes the `bool` value to `false`.
+        ///
+        /// Constructors can delegate to other constructors.
+        #[ink(constructor)]
+        fn default(&mut self) {
+            self.new(false)
+        }
+
+        /// A message that can be called on instantiated contracts.
+        /// This one flips the value of the stored `bool` from `true`
+        /// to `false` and vice versa.
+        #[ink(message)]
+        fn flip(&mut self) {
+            *self.value = !self.get();
+        }
+
+        /// Simply returns the current value of our `bool`.
+        #[ink(message)]
+        fn get(&self) -> bool {
+            *self.value
+        }
+    }
+
+    /// Unit tests in Rust are normally defined within such a `#[cfg(test)]`
+    /// module and test functions are marked with a `#[test]` attribute.
+    /// The below code is technically just normal Rust code.
+    #[cfg(test)]
+    mod tests {
+        /// Imports all the definitions from the outer scope so we can use them here.
+        use super::*;
+
+        /// We test if the default constructor does its job.
+        #[test]
+        fn default_works() {
+            // Note that even though we defined our `#[ink(constructor)]`
+            // above as `&mut self` functions that return nothing we can call
+            // them in test code as if they were normal Rust constructors
+            // that take no `self` argument but return `Self`.
+            let flipper = Flipper::default();
+            assert_eq!(flipper.get(), false);
+        }
+
+        /// We test a simple use case of our contract.
+        #[test]
+        fn it_works() {
+            let mut flipper = Flipper::new(false);
+            assert_eq!(flipper.get(), false);
+            flipper.flip();
+            assert_eq!(flipper.get(), true);
+        }
+    }
+}
modifiedtests/package-lock.jsondiffbeforeafterboth
3915 "@types/node": ">= 8"3915 "@types/node": ">= 8"
3916 }3916 }
3917 },3917 },
3918 "@polkadot/api": {
3919 "version": "1.34.1",
3920 "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz",
3921 "integrity": "sha512-3gCibNRchH+XbEdULS1bwiV1RgarZW1PDw1Y1mAQBVqPrUpkYqntp1D52SQOpAbRzldkwk296Sj+mx9/IeDRXA==",
3922 "requires": {
3923 "@babel/runtime": "^7.11.2",
3924 "@polkadot/api-derive": "1.34.1",
3925 "@polkadot/keyring": "^3.4.1",
3926 "@polkadot/metadata": "1.34.1",
3927 "@polkadot/rpc-core": "1.34.1",
3928 "@polkadot/rpc-provider": "1.34.1",
3929 "@polkadot/types": "1.34.1",
3930 "@polkadot/types-known": "1.34.1",
3931 "@polkadot/util": "^3.4.1",
3932 "@polkadot/util-crypto": "^3.4.1",
3933 "bn.js": "^5.1.3",
3934 "eventemitter3": "^4.0.7",
3935 "rxjs": "^6.6.3"
3936 },
3937 "dependencies": {
3938 "@polkadot/metadata": {
3939 "version": "1.34.1",
3940 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
3941 "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
3942 "requires": {
3943 "@babel/runtime": "^7.11.2",
3944 "@polkadot/types": "1.34.1",
3945 "@polkadot/types-known": "1.34.1",
3946 "@polkadot/util": "^3.4.1",
3947 "@polkadot/util-crypto": "^3.4.1",
3948 "bn.js": "^5.1.3"
3949 }
3950 },
3951 "@polkadot/types": {
3952 "version": "1.34.1",
3953 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
3954 "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
3955 "requires": {
3956 "@babel/runtime": "^7.11.2",
3957 "@polkadot/metadata": "1.34.1",
3958 "@polkadot/util": "^3.4.1",
3959 "@polkadot/util-crypto": "^3.4.1",
3960 "@types/bn.js": "^4.11.6",
3961 "bn.js": "^5.1.3",
3962 "memoizee": "^0.4.14",
3963 "rxjs": "^6.6.3"
3964 }
3965 },
3966 "@polkadot/types-known": {
3967 "version": "1.34.1",
3968 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
3969 "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
3970 "requires": {
3971 "@babel/runtime": "^7.11.2",
3972 "@polkadot/types": "1.34.1",
3973 "@polkadot/util": "^3.4.1",
3974 "bn.js": "^5.1.3"
3975 }
3976 },
3977 "@polkadot/util": {
3978 "version": "3.4.1",
3979 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
3980 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
3981 "requires": {
3982 "@babel/runtime": "^7.11.2",
3983 "@types/bn.js": "^4.11.6",
3984 "bn.js": "^5.1.3",
3985 "camelcase": "^5.3.1",
3986 "chalk": "^4.1.0",
3987 "ip-regex": "^4.1.0"
3988 }
3989 }
3990 }
3991 },
3992 "@polkadot/api-contract": {
3993 "version": "1.34.1",
3994 "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-1.34.1.tgz",
3995 "integrity": "sha512-oXh7An6E9wdbczXQhw+TfIkoKLQr4t0j3OwxubrhS5Qn6f99xGoAkk0BIKjsHPGIbMHEJoywmmLrDUAeTxExgg==",
3996 "requires": {
3997 "@babel/runtime": "^7.11.2",
3998 "@polkadot/api": "1.34.1",
3999 "@polkadot/rpc-core": "1.34.1",
4000 "@polkadot/types": "1.34.1",
4001 "@polkadot/util": "^3.4.1",
4002 "bn.js": "^5.1.3",
4003 "rxjs": "^6.6.3"
4004 },
4005 "dependencies": {
3918 "@polkadot/api": {4006 "@polkadot/api": {
3919 "version": "1.34.1",4007 "version": "1.34.1",
3920 "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz",4008 "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz",
3951 "memoizee": "^0.4.14",4039 "memoizee": "^0.4.14",
3952 "rxjs": "^6.6.3"4040 "rxjs": "^6.6.3"
3953 }4041 }
3954 },4042 },
4043 "@polkadot/metadata": {
4044 "version": "1.34.1",
4045 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
4046 "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
4047 "requires": {
4048 "@babel/runtime": "^7.11.2",
4049 "@polkadot/types": "1.34.1",
4050 "@polkadot/types-known": "1.34.1",
4051 "@polkadot/util": "^3.4.1",
4052 "@polkadot/util-crypto": "^3.4.1",
4053 "bn.js": "^5.1.3"
4054 }
4055 },
4056 "@polkadot/rpc-core": {
4057 "version": "1.34.1",
4058 "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.34.1.tgz",
4059 "integrity": "sha512-BVQDyBEkbRe5b/u8p9UPpTCj0sDZ32sTmPEP43Klc4s9+oHtiNvOFYvkjK5oyW9dlcOwXi8HpLsQxGAeMtM7Tw==",
4060 "requires": {
4061 "@babel/runtime": "^7.11.2",
4062 "@polkadot/metadata": "1.34.1",
4063 "@polkadot/rpc-provider": "1.34.1",
4064 "@polkadot/types": "1.34.1",
4065 "@polkadot/util": "^3.4.1",
4066 "memoizee": "^0.4.14",
4067 "rxjs": "^6.6.3"
4068 }
4069 },
4070 "@polkadot/rpc-provider": {
4071 "version": "1.34.1",
4072 "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.34.1.tgz",
4073 "integrity": "sha512-bebeis9mB4LS9Spk1WSHoadZHsyHmK4gyyC6uKSLZxHZmnopWna6zWnOBIrYHRz7qDHSZC5eNTseuU8NJXtscA==",
4074 "requires": {
4075 "@babel/runtime": "^7.11.2",
4076 "@polkadot/metadata": "1.34.1",
4077 "@polkadot/types": "1.34.1",
4078 "@polkadot/util": "^3.4.1",
4079 "@polkadot/util-crypto": "^3.4.1",
4080 "@polkadot/x-fetch": "^0.3.2",
4081 "@polkadot/x-ws": "^0.3.2",
4082 "bn.js": "^5.1.3",
4083 "eventemitter3": "^4.0.7"
4084 }
4085 },
4086 "@polkadot/types": {
4087 "version": "1.34.1",
4088 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
4089 "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
4090 "requires": {
4091 "@babel/runtime": "^7.11.2",
4092 "@polkadot/metadata": "1.34.1",
4093 "@polkadot/util": "^3.4.1",
4094 "@polkadot/util-crypto": "^3.4.1",
4095 "@types/bn.js": "^4.11.6",
4096 "bn.js": "^5.1.3",
4097 "memoizee": "^0.4.14",
4098 "rxjs": "^6.6.3"
4099 }
4100 },
4101 "@polkadot/types-known": {
4102 "version": "1.34.1",
4103 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
4104 "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
4105 "requires": {
4106 "@babel/runtime": "^7.11.2",
4107 "@polkadot/types": "1.34.1",
4108 "@polkadot/util": "^3.4.1",
4109 "bn.js": "^5.1.3"
4110 }
4111 },
4112 "@polkadot/util": {
4113 "version": "3.4.1",
4114 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4115 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4116 "requires": {
4117 "@babel/runtime": "^7.11.2",
4118 "@types/bn.js": "^4.11.6",
4119 "bn.js": "^5.1.3",
4120 "camelcase": "^5.3.1",
4121 "chalk": "^4.1.0",
4122 "ip-regex": "^4.1.0"
4123 }
4124 }
4125 }
4126 },
4127 "@polkadot/api-derive": {
4128 "version": "1.34.1",
4129 "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.34.1.tgz",
4130 "integrity": "sha512-LMlCkNJRp29MwKa36crYuY6cZpnkHCFrPCv9dmJEuDbMqrK+EAhXM9/6sTDYJ4uKNhyetJKe9rXslkXdI6pidA==",
4131 "requires": {
4132 "@babel/runtime": "^7.11.2",
4133 "@polkadot/api": "1.34.1",
4134 "@polkadot/rpc-core": "1.34.1",
4135 "@polkadot/rpc-provider": "1.34.1",
4136 "@polkadot/types": "1.34.1",
4137 "@polkadot/util": "^3.4.1",
4138 "@polkadot/util-crypto": "^3.4.1",
4139 "bn.js": "^5.1.3",
4140 "memoizee": "^0.4.14",
4141 "rxjs": "^6.6.3"
4142 },
4143 "dependencies": {
4144 "@polkadot/metadata": {
4145 "version": "1.34.1",
4146 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
4147 "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
4148 "requires": {
4149 "@babel/runtime": "^7.11.2",
4150 "@polkadot/types": "1.34.1",
4151 "@polkadot/types-known": "1.34.1",
4152 "@polkadot/util": "^3.4.1",
4153 "@polkadot/util-crypto": "^3.4.1",
4154 "bn.js": "^5.1.3"
4155 }
4156 },
4157 "@polkadot/types": {
4158 "version": "1.34.1",
4159 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
4160 "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
4161 "requires": {
4162 "@babel/runtime": "^7.11.2",
4163 "@polkadot/metadata": "1.34.1",
4164 "@polkadot/util": "^3.4.1",
4165 "@polkadot/util-crypto": "^3.4.1",
4166 "@types/bn.js": "^4.11.6",
4167 "bn.js": "^5.1.3",
4168 "memoizee": "^0.4.14",
4169 "rxjs": "^6.6.3"
4170 }
4171 },
4172 "@polkadot/types-known": {
4173 "version": "1.34.1",
4174 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
4175 "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
4176 "requires": {
4177 "@babel/runtime": "^7.11.2",
4178 "@polkadot/types": "1.34.1",
4179 "@polkadot/util": "^3.4.1",
4180 "bn.js": "^5.1.3"
4181 }
4182 },
4183 "@polkadot/util": {
4184 "version": "3.4.1",
4185 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4186 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4187 "requires": {
4188 "@babel/runtime": "^7.11.2",
4189 "@types/bn.js": "^4.11.6",
4190 "bn.js": "^5.1.3",
4191 "camelcase": "^5.3.1",
4192 "chalk": "^4.1.0",
4193 "ip-regex": "^4.1.0"
4194 }
4195 }
4196 }
4197 },
3955 "@polkadot/dev": {4198 "@polkadot/dev": {
3956 "version": "0.52.19",4199 "version": "0.52.19",
3957 "resolved": "https://registry.npmjs.org/@polkadot/dev/-/dev-0.52.19.tgz",4200 "resolved": "https://registry.npmjs.org/@polkadot/dev/-/dev-0.52.19.tgz",
4034 }4277 }
4035 },4278 },
4036 "@polkadot/keyring": {4279 "@polkadot/keyring": {
4037 "version": "3.5.1",4280 "version": "3.4.1",
4038 "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.5.1.tgz",4281 "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.4.1.tgz",
4039 "integrity": "sha512-Wg8PBACl+RobbmcShl659/5a+foU1j7PGdvdr2pZowkZul8jvwyAN+piIyPSfrsaJkbUoDUR9Pe+oVoeF4ZoXg==",4282 "integrity": "sha512-x8FxzDzyFX5ai+tnPaxAFUBV/2Mw/om8sRoMh+fT6Jzh3nC7pXfecH5ticJPKe73v/y42hn9xM0tiAI5P8Ohcw==",
4040 "requires": {4283 "requires": {
4041 "@babel/runtime": "^7.11.2",4284 "@babel/runtime": "^7.11.2",
4042 "@polkadot/util": "3.5.1",4285 "@polkadot/util": "3.4.1",
4043 "@polkadot/util-crypto": "3.5.1"4286 "@polkadot/util-crypto": "3.4.1"
4044 }4287 },
4288 "dependencies": {
4289 "@polkadot/util": {
4290 "version": "3.4.1",
4291 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4292 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4293 "requires": {
4294 "@babel/runtime": "^7.11.2",
4295 "@types/bn.js": "^4.11.6",
4296 "bn.js": "^5.1.3",
4297 "camelcase": "^5.3.1",
4298 "chalk": "^4.1.0",
4299 "ip-regex": "^4.1.0"
4300 }
4301 }
4302 }
4045 },4303 },
4046 "@polkadot/metadata": {4304 "@polkadot/metadata": {
4047 "version": "1.34.1",4305 "version": "1.34.1",
4054 "@polkadot/util": "^3.4.1",4312 "@polkadot/util": "^3.4.1",
4055 "@polkadot/util-crypto": "^3.4.1",4313 "@polkadot/util-crypto": "^3.4.1",
4056 "bn.js": "^5.1.3"4314 "bn.js": "^5.1.3"
4057 }4315 },
4316 "dependencies": {
4317 "@polkadot/util": {
4318 "version": "3.4.1",
4319 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4320 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4321 "requires": {
4322 "@babel/runtime": "^7.11.2",
4323 "@types/bn.js": "^4.11.6",
4324 "bn.js": "^5.1.3",
4325 "camelcase": "^5.3.1",
4326 "chalk": "^4.1.0",
4327 "ip-regex": "^4.1.0"
4328 }
4329 }
4330 }
4058 },4331 },
4059 "@polkadot/rpc-core": {4332 "@polkadot/rpc-core": {
4060 "version": "1.34.1",4333 "version": "1.34.1",
4068 "@polkadot/util": "^3.4.1",4341 "@polkadot/util": "^3.4.1",
4069 "memoizee": "^0.4.14",4342 "memoizee": "^0.4.14",
4070 "rxjs": "^6.6.3"4343 "rxjs": "^6.6.3"
4071 }4344 },
4345 "dependencies": {
4346 "@polkadot/metadata": {
4347 "version": "1.34.1",
4348 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
4349 "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
4350 "requires": {
4351 "@babel/runtime": "^7.11.2",
4352 "@polkadot/types": "1.34.1",
4353 "@polkadot/types-known": "1.34.1",
4354 "@polkadot/util": "^3.4.1",
4355 "@polkadot/util-crypto": "^3.4.1",
4356 "bn.js": "^5.1.3"
4357 }
4358 },
4359 "@polkadot/types": {
4360 "version": "1.34.1",
4361 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
4362 "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
4363 "requires": {
4364 "@babel/runtime": "^7.11.2",
4365 "@polkadot/metadata": "1.34.1",
4366 "@polkadot/util": "^3.4.1",
4367 "@polkadot/util-crypto": "^3.4.1",
4368 "@types/bn.js": "^4.11.6",
4369 "bn.js": "^5.1.3",
4370 "memoizee": "^0.4.14",
4371 "rxjs": "^6.6.3"
4372 }
4373 },
4374 "@polkadot/types-known": {
4375 "version": "1.34.1",
4376 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
4377 "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
4378 "requires": {
4379 "@babel/runtime": "^7.11.2",
4380 "@polkadot/types": "1.34.1",
4381 "@polkadot/util": "^3.4.1",
4382 "bn.js": "^5.1.3"
4383 }
4384 },
4385 "@polkadot/util": {
4386 "version": "3.4.1",
4387 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4388 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4389 "requires": {
4390 "@babel/runtime": "^7.11.2",
4391 "@types/bn.js": "^4.11.6",
4392 "bn.js": "^5.1.3",
4393 "camelcase": "^5.3.1",
4394 "chalk": "^4.1.0",
4395 "ip-regex": "^4.1.0"
4396 }
4397 }
4398 }
4072 },4399 },
4073 "@polkadot/rpc-provider": {4400 "@polkadot/rpc-provider": {
4074 "version": "1.34.1",4401 "version": "1.34.1",
4084 "@polkadot/x-ws": "^0.3.2",4411 "@polkadot/x-ws": "^0.3.2",
4085 "bn.js": "^5.1.3",4412 "bn.js": "^5.1.3",
4086 "eventemitter3": "^4.0.7"4413 "eventemitter3": "^4.0.7"
4087 }4414 },
4415 "dependencies": {
4416 "@polkadot/metadata": {
4417 "version": "1.34.1",
4418 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
4419 "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
4420 "requires": {
4421 "@babel/runtime": "^7.11.2",
4422 "@polkadot/types": "1.34.1",
4423 "@polkadot/types-known": "1.34.1",
4424 "@polkadot/util": "^3.4.1",
4425 "@polkadot/util-crypto": "^3.4.1",
4426 "bn.js": "^5.1.3"
4427 }
4428 },
4429 "@polkadot/types": {
4430 "version": "1.34.1",
4431 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
4432 "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
4433 "requires": {
4434 "@babel/runtime": "^7.11.2",
4435 "@polkadot/metadata": "1.34.1",
4436 "@polkadot/util": "^3.4.1",
4437 "@polkadot/util-crypto": "^3.4.1",
4438 "@types/bn.js": "^4.11.6",
4439 "bn.js": "^5.1.3",
4440 "memoizee": "^0.4.14",
4441 "rxjs": "^6.6.3"
4442 }
4443 },
4444 "@polkadot/types-known": {
4445 "version": "1.34.1",
4446 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
4447 "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
4448 "requires": {
4449 "@babel/runtime": "^7.11.2",
4450 "@polkadot/types": "1.34.1",
4451 "@polkadot/util": "^3.4.1",
4452 "bn.js": "^5.1.3"
4453 }
4454 },
4455 "@polkadot/util": {
4456 "version": "3.4.1",
4457 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4458 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4459 "requires": {
4460 "@babel/runtime": "^7.11.2",
4461 "@types/bn.js": "^4.11.6",
4462 "bn.js": "^5.1.3",
4463 "camelcase": "^5.3.1",
4464 "chalk": "^4.1.0",
4465 "ip-regex": "^4.1.0"
4466 }
4467 }
4468 }
4088 },4469 },
4089 "@polkadot/ts": {4470 "@polkadot/ts": {
4090 "version": "0.3.44",4471 "version": "0.3.44",
4108 "bn.js": "^5.1.3",4489 "bn.js": "^5.1.3",
4109 "memoizee": "^0.4.14",4490 "memoizee": "^0.4.14",
4110 "rxjs": "^6.6.3"4491 "rxjs": "^6.6.3"
4111 }4492 },
4493 "dependencies": {
4494 "@polkadot/util": {
4495 "version": "3.4.1",
4496 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4497 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4498 "requires": {
4499 "@babel/runtime": "^7.11.2",
4500 "@types/bn.js": "^4.11.6",
4501 "bn.js": "^5.1.3",
4502 "camelcase": "^5.3.1",
4503 "chalk": "^4.1.0",
4504 "ip-regex": "^4.1.0"
4505 }
4506 }
4507 }
4112 },4508 },
4113 "@polkadot/types-known": {4509 "@polkadot/types-known": {
4114 "version": "1.34.1",4510 "version": "1.34.1",
4119 "@polkadot/types": "1.34.1",4515 "@polkadot/types": "1.34.1",
4120 "@polkadot/util": "^3.4.1",4516 "@polkadot/util": "^3.4.1",
4121 "bn.js": "^5.1.3"4517 "bn.js": "^5.1.3"
4122 }4518 },
4519 "dependencies": {
4520 "@polkadot/util": {
4521 "version": "3.4.1",
4522 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4523 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4524 "requires": {
4525 "@babel/runtime": "^7.11.2",
4526 "@types/bn.js": "^4.11.6",
4527 "bn.js": "^5.1.3",
4528 "camelcase": "^5.3.1",
4529 "chalk": "^4.1.0",
4530 "ip-regex": "^4.1.0"
4531 }
4532 }
4533 }
4123 },4534 },
4124 "@polkadot/util": {4535 "@polkadot/util": {
4125 "version": "3.5.1",4536 "version": "3.4.1",
4126 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz",4537 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4127 "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==",4538 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4128 "requires": {4539 "requires": {
4129 "@babel/runtime": "^7.11.2",4540 "@babel/runtime": "^7.11.2",
4130 "@polkadot/x-textdecoder": "^0.3.2",
4131 "@polkadot/x-textencoder": "^0.3.2",
4132 "@types/bn.js": "^4.11.6",4541 "@types/bn.js": "^4.11.6",
4133 "bn.js": "^5.1.3",4542 "bn.js": "^5.1.3",
4134 "camelcase": "^5.3.1",4543 "camelcase": "^5.3.1",
4137 }4546 }
4138 },4547 },
4139 "@polkadot/util-crypto": {4548 "@polkadot/util-crypto": {
4140 "version": "3.5.1",4549 "version": "3.4.1",
4141 "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.5.1.tgz",4550 "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz",
4142 "integrity": "sha512-7SWxOYG+dUCAkGW2xCJc9gutLJ02T9LwiumTW8cXFysRai4qLA3XRl+XQHAEdRzKA+97IQmtGMl4/Tjq9TGwYw==",4551 "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==",
4143 "requires": {4552 "requires": {
4144 "@babel/runtime": "^7.11.2",4553 "@babel/runtime": "^7.11.2",
4145 "@polkadot/util": "3.5.1",4554 "@polkadot/util": "3.4.1",
4146 "@polkadot/wasm-crypto": "^1.4.1",4555 "@polkadot/wasm-crypto": "^1.4.1",
4147 "base-x": "^3.0.8",4556 "base-x": "^3.0.8",
4148 "bip39": "^3.0.2",4557 "bip39": "^3.0.2",
4154 "scryptsy": "^2.1.0",4563 "scryptsy": "^2.1.0",
4155 "tweetnacl": "^1.0.3",4564 "tweetnacl": "^1.0.3",
4156 "xxhashjs": "^0.2.2"4565 "xxhashjs": "^0.2.2"
4157 }4566 },
4567 "dependencies": {
4568 "@polkadot/util": {
4569 "version": "3.4.1",
4570 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
4571 "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
4572 "requires": {
4573 "@babel/runtime": "^7.11.2",
4574 "@types/bn.js": "^4.11.6",
4575 "bn.js": "^5.1.3",
4576 "camelcase": "^5.3.1",
4577 "chalk": "^4.1.0",
4578 "ip-regex": "^4.1.0"
4579 }
4580 }
4581 }
4158 },4582 },
4159 "@polkadot/wasm-crypto": {4583 "@polkadot/wasm-crypto": {
4160 "version": "1.4.1",4584 "version": "1.4.1",
4161 "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.4.1.tgz",4585 "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.4.1.tgz",
4162 "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ=="4586 "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ=="
4163 },4587 },
4164 "@polkadot/x-fetch": {4588 "@polkadot/x-fetch": {
4165 "version": "0.3.2",4589 "version": "0.3.2",
4166 "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.2.tgz",4590 "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.2.tgz",
4167 "integrity": "sha512-lk9M8ql/kBBqiZ8KOWj7LFK7P9OxDgVn2fZPNELJzQbfFZwFF8umBPDIWlQIK7wTnlRsQlzOuf6MGEyMK5p42w==",4591 "integrity": "sha512-lk9M8ql/kBBqiZ8KOWj7LFK7P9OxDgVn2fZPNELJzQbfFZwFF8umBPDIWlQIK7wTnlRsQlzOuf6MGEyMK5p42w==",
4170 "@types/node-fetch": "^2.5.7",4594 "@types/node-fetch": "^2.5.7",
4171 "node-fetch": "^2.6.1"4595 "node-fetch": "^2.6.1"
4172 }4596 },
4173 },
4174 "@polkadot/x-textdecoder": {
4175 "version": "0.3.2",
4176 "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-0.3.2.tgz",
4177 "integrity": "sha512-W3KK6mMzOH5kts8pSkyYyfsQuAsKUHmIm8jQkhQnSR6FRyhwJtHLZnxP3feEwkNkRbGggG6CtDPrxYCuEO0MvA==",
4178 "requires": {
4179 "@babel/runtime": "^7.11.2"
4180 }
4181 },
4182 "@polkadot/x-textencoder": {4597 "dependencies": {
4598 "node-fetch": {
4183 "version": "0.3.2",4599 "version": "2.6.1",
4184 "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-0.3.2.tgz",4600 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
4185 "integrity": "sha512-nm7N9gWgKsZv8In1Fgfm+jYOPjprna/03Cd8hOqkCMRlSq0L4LS+d8BPrFhPOiT57VFTTW/7csLivFdeKv0GMA==",4601 "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
4186 "requires": {4602 }
4187 "@babel/runtime": "^7.11.2"
4188 }
4189 },4603 }
4604 },
4190 "@polkadot/x-ws": {4605 "@polkadot/x-ws": {
4191 "version": "0.3.2",4606 "version": "0.3.2",
4192 "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.2.tgz",4607 "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.2.tgz",
13113 "dev": true13528 "dev": true
13114 },13529 },
13115 "ip-regex": {13530 "ip-regex": {
13116 "version": "4.2.0",13531 "version": "4.1.0",
13117 "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",13532 "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.1.0.tgz",
13118 "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="13533 "integrity": "sha512-pKnZpbgCTfH/1NLIlOduP/V+WRXzC2MOz3Qo8xmxk8C5GudJLgK5QyLVXOSWy3ParAH7Eemurl3xjv/WXYFvMA=="
13119 },13534 },
13120 "ipaddr.js": {13535 "ipaddr.js": {
13121 "version": "1.9.1",13536 "version": "1.9.1",
16425 "lower-case": "^1.1.1"16840 "lower-case": "^1.1.1"
16426 }16841 }
16427 },16842 },
16428 "node-fetch": {
16429 "version": "2.6.1",
16430 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
16431 "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
16432 },
16433 "node-fetch-npm": {16843 "node-fetch-npm": {
16434 "version": "2.0.4",16844 "version": "2.0.4",
16435 "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz",16845 "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz",
modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -24,6 +24,7 @@
   "homepage": "",
   "dependencies": {
     "@polkadot/api": "^1.34.1",
+    "@polkadot/api-contract": "^1.34.1",
     "@polkadot/types": "^1.34.1",
     "@polkadot/util": "^3.4.1",
     "@types/bn.js": "^4.11.6",
addedtests/src/accounts.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/accounts.ts
@@ -0,0 +1,2 @@
+export const bobsPublicKey = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
+export const alicesPublicKey = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
addedtests/src/deploy-flipper.test.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/deploy-flipper.test.ts
@@ -0,0 +1,102 @@
+import { expect } from "chai";
+import usingApi from "./substrate/substrate-api";
+import promisifySubstrate from "./substrate/promisify-substrate";
+import fs from "fs";
+import privateKey from "./substrate/privateKey";
+import { compactAddLength, u8aToU8a } from '@polkadot/util';
+import { Hash, AccountId } from "@polkadot/types/interfaces";
+import { Abi, PromiseContract } from "@polkadot/api-contract";
+import { ISubmittableResult } from "@polkadot/types/types";
+import BN from "bn.js";
+import { alicesPublicKey } from "./accounts";
+
+describe('Flipper', () => {
+  it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => {
+    await usingApi(async api => {
+      const wasm = fs.readFileSync('./src/flipper/flipper.wasm');
+      const contract = compactAddLength(u8aToU8a(wasm));
+
+      const metadata = JSON.parse(fs.readFileSync('./src/flipper/metadata.json').toString('utf-8'));
+      const abi = new Abi(api.registry as any, metadata);
+
+      const alicesPrivateKey = privateKey('//Alice');
+
+      const contractHash = await promisifySubstrate(api, () => {
+        return new Promise<Hash>(async (resolve, reject) => {
+          const unsubscribe = api.tx.contracts.putCode(contract).signAndSend(alicesPrivateKey, async result => {
+            if(!result.isInBlock){
+              return;
+            }
+
+            const record = result.findRecord('contracts', 'CodeStored');
+
+            if(record) {
+              (await unsubscribe)();
+              resolve(record.event.data[0] as unknown as Hash);
+            } else {
+              reject('Failed to find contract hash in putCode transaction result.');
+            }
+          });
+        })
+      })();
+
+
+      const instanceAccountId = await promisifySubstrate(api, () => {
+        return new Promise<AccountId>((resolve, reject) => {
+          const args = abi.constructors[0](true);
+          const unsubscribe = api.tx.contracts.instantiate(1000000000000000n, 1000000000000n, contractHash, args)
+            .signAndSend(alicesPrivateKey, async (result:ISubmittableResult) => {
+              if(!result.isInBlock) {
+                return;
+              }
+              const record = result.findRecord('contracts', 'Instantiated');
+              if(record) {
+                (await unsubscribe)();
+                expect(alicesPublicKey).to.be.equal(record.event.data[0].toString());
+                resolve(record.event.data[1] as AccountId);
+              } else {
+                reject('Failed to find instantiated event,');
+              }
+            });
+        });
+      })();
+
+      const contractInstance = new PromiseContract(api, abi, instanceAccountId);
+      const getFlipValue = async () => {
+        return await promisifySubstrate(api, async () => {
+          const result = await contractInstance.call('rpc', 'get', 0, new BN('1000000000000'))
+            .send(alicesPublicKey);
+          if(!result.isSuccess) {
+            throw 'Failed to get flipper value';
+          }
+          return result.output && result.output.valueOf && result.output.valueOf();
+        })();
+      }
+
+      const initialGetResponse = await getFlipValue();
+      expect(initialGetResponse).to.be.true;
+
+      await promisifySubstrate(api, async () => {
+        return new Promise<void>(async (resolve, reject) => {
+          api.tx.contracts.call(contractInstance.address.toString(), 0, 1000000000000n, contractInstance.getMessage('flip').fn())
+            .signAndSend(alicesPrivateKey, async result => {
+              if(!result.isInBlock) {
+                return;
+              }
+
+              if(result.findRecord('system', 'ExtrinsicSuccess')) {
+                resolve();
+              }
+              else {
+                reject('Failed to flip value.');
+              }
+            })
+        });
+      })();
+
+      const afterFlipGetResponse = await getFlipValue();
+
+      expect(afterFlipGetResponse).to.be.false;
+    });
+  });
+});
addedtests/src/flipper/flipper.wasmdiffbeforeafterboth

binary blob — no preview

addedtests/src/flipper/metadata.jsondiffbeforeafterboth
--- /dev/null
+++ b/tests/src/flipper/metadata.json
@@ -0,0 +1,204 @@
+{
+  "registry": {
+    "strings": [
+      "Storage",
+      "flipper",
+      "__ink_private",
+      "__ink_storage",
+      "value",
+      "Value",
+      "ink_core",
+      "storage",
+      "cell",
+      "SyncCell",
+      "sync_cell",
+      "Key",
+      "ink_primitives",
+      "new",
+      "init_value",
+      "bool",
+      "default",
+      "flip",
+      "get"
+    ],
+    "types": [
+      {
+        "id": {
+          "custom.name": 1,
+          "custom.namespace": [
+            2,
+            2,
+            3,
+            4
+          ],
+          "custom.params": []
+        },
+        "def": {
+          "struct.fields": [
+            {
+              "name": 5,
+              "type": 2
+            }
+          ]
+        }
+      },
+      {
+        "id": {
+          "custom.name": 6,
+          "custom.namespace": [
+            7,
+            8,
+            5
+          ],
+          "custom.params": [
+            3
+          ]
+        },
+        "def": {
+          "struct.fields": [
+            {
+              "name": 9,
+              "type": 4
+            }
+          ]
+        }
+      },
+      {
+        "id": "bool",
+        "def": "builtin"
+      },
+      {
+        "id": {
+          "custom.name": 10,
+          "custom.namespace": [
+            7,
+            8,
+            9,
+            11
+          ],
+          "custom.params": [
+            3
+          ]
+        },
+        "def": {
+          "struct.fields": [
+            {
+              "name": 9,
+              "type": 5
+            }
+          ]
+        }
+      },
+      {
+        "id": {
+          "custom.name": 12,
+          "custom.namespace": [
+            13
+          ],
+          "custom.params": []
+        },
+        "def": {
+          "tuple_struct.types": [
+            6
+          ]
+        }
+      },
+      {
+        "id": {
+          "array.len": 32,
+          "array.type": 7
+        },
+        "def": "builtin"
+      },
+      {
+        "id": "u8",
+        "def": "builtin"
+      }
+    ]
+  },
+  "storage": {
+    "struct.type": 1,
+    "struct.fields": [
+      {
+        "name": 5,
+        "layout": {
+          "struct.type": 2,
+          "struct.fields": [
+            {
+              "name": 9,
+              "layout": {
+                "range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000",
+                "range.len": 1,
+                "range.elem_type": 3
+              }
+            }
+          ]
+        }
+      }
+    ]
+  },
+  "contract": {
+    "name": 2,
+    "constructors": [
+      {
+        "name": 14,
+        "selector": "[\"0x5E\",\"0xBD\",\"0x88\",\"0xD6\"]",
+        "args": [
+          {
+            "name": 15,
+            "type": {
+              "ty": 3,
+              "display_name": [
+                16
+              ]
+            }
+          }
+        ],
+        "docs": [
+          "Constructor that initializes the `bool` value to the given `init_value`."
+        ]
+      },
+      {
+        "name": 17,
+        "selector": "[\"0x02\",\"0x22\",\"0xFF\",\"0x18\"]",
+        "args": [],
+        "docs": [
+          "Constructor that initializes the `bool` value to `false`.",
+          "",
+          "Constructors can delegate to other constructors."
+        ]
+      }
+    ],
+    "messages": [
+      {
+        "name": 18,
+        "selector": "[\"0x8C\",\"0x97\",\"0xDB\",\"0x39\"]",
+        "mutates": true,
+        "args": [],
+        "return_type": null,
+        "docs": [
+          "A message that can be called on instantiated contracts.",
+          "This one flips the value of the stored `bool` from `true`",
+          "to `false` and vice versa."
+        ]
+      },
+      {
+        "name": 19,
+        "selector": "[\"0x25\",\"0x44\",\"0x4A\",\"0xFE\"]",
+        "mutates": false,
+        "args": [],
+        "return_type": {
+          "ty": 3,
+          "display_name": [
+            16
+          ]
+        },
+        "docs": [
+          "Simply returns the current value of our `bool`."
+        ]
+      }
+    ],
+    "events": [],
+    "docs": []
+  }
+}
\ No newline at end of file
addedtests/src/substrate/privateKey.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/substrate/privateKey.ts
@@ -0,0 +1,7 @@
+import { Keyring } from "@polkadot/api";
+
+export default function privateKey(account: string) {
+  const keyring = new Keyring({ type: 'sr25519' });
+  
+  return keyring.addFromUri(account);
+}
\ No newline at end of file
modifiedtests/src/transfer.test.tsdiffbeforeafterboth
--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -5,6 +5,8 @@
 import usingApi from "./substrate/substrate-api";
 import promisifySubstrate from "./substrate/promisify-substrate";
 import waitNewBlocks from "./substrate/wait-new-blocks";
+import { alicesPublicKey, bobsPublicKey } from "./accounts";
+import privateKey from "./substrate/privateKey";
 
 async function getBalance(api: ApiPromise, accounts: string[]): Promise<bigint[]> {
   const balance = promisifySubstrate(api, (accounts: string[]) => api.query.system.account.multi(accounts));
@@ -14,18 +16,14 @@
 
 describe('Transfer', () => {
   it('Balance transfers', async () => {
-    const bobsPublicKey = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
-    const alicesPublicKey = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
     await usingApi(async api => {
       const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
 
-      const keyring = new Keyring({ type: 'sr25519' });
-      
-      const alicePrivateKey = keyring.addFromUri('//Alice');
+      const alicePrivateKey = privateKey('//Alice');
       
       const transfer = api.tx.balances.transfer(bobsPublicKey, 1n);
       
-      const hash = await transfer.signAndSend(alicePrivateKey);
+      await promisifySubstrate(api, () => transfer.signAndSend(alicePrivateKey))();
 
       await waitNewBlocks(api);