From c1ce785e67864cb384ef4f485f92f58379e7630d Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 19 Oct 2020 14:29:35 +0000 Subject: [PATCH] Fix contract tests --- --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -3916,104 +3916,143 @@ } }, "@polkadot/api": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-2.2.1.tgz", - "integrity": "sha512-h6G1nYeXGnnUB//JXZcSKDNZNuasB4DDE0Hf+G5rf/9/aDxbkN+T1Wc6+saFxrxSmDGx2/qEUNVx6PluFKLvJA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-2.3.1.tgz", + "integrity": "sha512-B9ZOb1PiPaAlke4wQHoivVQ5ZCQWn5bgLjhVIGdcEZ4WjIcxApmzTV4ruSfqVoRKpRiVOyV3Dx/VUQDD/WgBFw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api-derive": "2.2.1", - "@polkadot/keyring": "^3.5.1", - "@polkadot/metadata": "2.2.1", - "@polkadot/rpc-core": "2.2.1", - "@polkadot/rpc-provider": "2.2.1", - "@polkadot/types": "2.2.1", - "@polkadot/types-known": "2.2.1", - "@polkadot/util": "^3.5.1", - "@polkadot/util-crypto": "^3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/api-derive": "2.3.1", + "@polkadot/keyring": "^3.6.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/rpc-core": "2.3.1", + "@polkadot/rpc-provider": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/types-known": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7", "rxjs": "^6.6.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/api-contract": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-2.2.1.tgz", - "integrity": "sha512-7Kb9pAx9n7qske7p3yI+YYZX8Z5/MCNET1SCEE6t3fkwtYxs+BMw2Wucq5yt/EbVgJDLM3NmZyh9xmJiLwLxHQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-2.3.1.tgz", + "integrity": "sha512-hqRU2mGkHK84dtqZSX71tFCuBmBiV/6H7pJwj5E7UPcd124LM2ETXYJ9T0ElxbAHmZQD7yv+2ZM/ncvGC/A68Q==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api": "2.2.1", - "@polkadot/rpc-core": "2.2.1", - "@polkadot/types": "2.2.1", - "@polkadot/util": "^3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/api": "2.3.1", + "@polkadot/rpc-core": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", "bn.js": "^5.1.3", "rxjs": "^6.6.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/api-derive": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-2.2.1.tgz", - "integrity": "sha512-4J9nA9bDBlE+yn06VjgeCnElnRn8IhTpkGhtT4J/agBe+4I0tYSz+DR5o2Rb5mQDMXu3aayYpfVDaJk1mRJsPQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-2.3.1.tgz", + "integrity": "sha512-FcDEx+/1Io7zOHPjbQAEzXB0KenA9emgY+96aHS4yPV/OVmAifU0IAxudZdMVp7uVC2dWq9iFvjxx84yCXgVRA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api": "2.2.1", - "@polkadot/rpc-core": "2.2.1", - "@polkadot/rpc-provider": "2.2.1", - "@polkadot/types": "2.2.1", - "@polkadot/util": "^3.5.1", - "@polkadot/util-crypto": "^3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/api": "2.3.1", + "@polkadot/rpc-core": "2.3.1", + "@polkadot/rpc-provider": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4099,123 +4138,193 @@ } }, "@polkadot/keyring": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.5.1.tgz", - "integrity": "sha512-Wg8PBACl+RobbmcShl659/5a+foU1j7PGdvdr2pZowkZul8jvwyAN+piIyPSfrsaJkbUoDUR9Pe+oVoeF4ZoXg==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.6.1.tgz", + "integrity": "sha512-JbW4M5Ct3HaX3vgoa/UWAQVF/0sc1PbbA2D6v0KKaJkXl+EYVP9uyOYAoRCppB6ENZThz7CUJVQp8trs8WTrFQ==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.5.1", - "@polkadot/util-crypto": "3.5.1" + "@babel/runtime": "^7.12.1", + "@polkadot/util": "3.6.1", + "@polkadot/util-crypto": "3.6.1" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/metadata": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-2.2.1.tgz", - "integrity": "sha512-Xp5S2ukNS2rvSeK4cT/xhWzIMmOQZ8BssZU9pqK8u1ttv36CKCD9CRUGxAvG42+SiHV6WMG1S2NAt3UgLthQyw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-2.3.1.tgz", + "integrity": "sha512-F/QwDDR/d9mcqToDqndRTUYvMt/GYzjQ+kNGjQYBOIDRqF9zDbPHAXruqcHd0Y5MMpPMRBZGNaqPOb3BMrIdOQ==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "2.2.1", - "@polkadot/types-known": "2.2.1", - "@polkadot/util": "^3.5.1", - "@polkadot/util-crypto": "^3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/types": "2.3.1", + "@polkadot/types-known": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "bn.js": "^5.1.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, + "@polkadot/networks": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-3.6.1.tgz", + "integrity": "sha512-PEEw/vTZaKf32vuAUeFXYNJei+b/s3hr7msMKfvoYeKDU/otgt9Mgkqrh6VCaE6+lHHgX8vLbH70pCqQrGG/uA==", + "requires": { + "@babel/runtime": "^7.12.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, "@polkadot/rpc-core": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-2.2.1.tgz", - "integrity": "sha512-t3XoR6QPE6TaYsuKXCfOvTW9C6Lvjgcn++0DT33EANANtgtT9b6e+08mEOjf8VtYkwExgzK2aSGwCCoRccYcsg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-2.3.1.tgz", + "integrity": "sha512-SWYU6azxNwWkhz6bm/wpRPQZ/5KJ2hnEXPS4EN77q7EFH4c4k9mNtVyjUQFkKJsG7T85vxaCCWwhx60aYCZVeA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "2.2.1", - "@polkadot/rpc-provider": "2.2.1", - "@polkadot/types": "2.2.1", - "@polkadot/util": "^3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/rpc-provider": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/rpc-provider": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-2.2.1.tgz", - "integrity": "sha512-s6iIRazo2O8xcyXaNrnWW48qJEx0FqMHD506Z8RzuYzh3jQxlAd53zw0InWZpFTfrvk46VN3tvQJaq9LYvcliA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-2.3.1.tgz", + "integrity": "sha512-lRN68RosWvtBA844PWqhYEV2ifT3T9SUyAP2WvRYyWVPiMmXjw57qG1zHKQWgZk5aFzeaHKSYgsKTmkWz9IM4g==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "2.2.1", - "@polkadot/types": "2.2.1", - "@polkadot/util": "^3.5.1", - "@polkadot/util-crypto": "^3.5.1", - "@polkadot/x-fetch": "^0.3.2", - "@polkadot/x-ws": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", + "@polkadot/x-fetch": "^0.3.3", + "@polkadot/x-ws": "^0.3.3", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4229,62 +4338,88 @@ } }, "@polkadot/types": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-2.2.1.tgz", - "integrity": "sha512-4kW+pdCgXoUQ4bXIdHMs5/JV7tsxseqlV2O0p6j60CeXZQOaRQJkIeC2I9J+HwpmnkT1SAgakX3wZniFp9nDeA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-2.3.1.tgz", + "integrity": "sha512-G3cyYYV+vYmpkMjPirwOA/zLreb1uBrKpEMWTvtTuCz/sNwcbCT5hI/KZCzNo1PueOQAowroKPe4yQ793dqVPw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "2.2.1", - "@polkadot/util": "^3.5.1", - "@polkadot/util-crypto": "^3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/types-known": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-2.2.1.tgz", - "integrity": "sha512-RmxDg1C5bz1GWe1Bk21Lf75PdtwdWWO4mPVkXsZi1zGfFLxoCYcsO4duEab/kAJk2hKyhxANn88SF1tIBpJ2ww==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-2.3.1.tgz", + "integrity": "sha512-34yuvDraW9Sjy5ookQZf55sBKLOsTqos+WQdTu6DUxtRuwvMP9DEAGcs2m6AFvWxwZps+3zFGUvzn6SMHsSJ5Q==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "2.2.1", - "@polkadot/util": "^3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", "bn.js": "^5.1.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4302,12 +4437,13 @@ } }, "@polkadot/util-crypto": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.5.1.tgz", - "integrity": "sha512-7SWxOYG+dUCAkGW2xCJc9gutLJ02T9LwiumTW8cXFysRai4qLA3XRl+XQHAEdRzKA+97IQmtGMl4/Tjq9TGwYw==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.6.1.tgz", + "integrity": "sha512-mRCijOXrxTa2JD5vpNvr1MHSj3NaSGaImg1yzAf3l7nw7zNGjLy1K3qQNcFgr8+0NHyPKk5lCIehtwGTRZYsiA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.5.1", + "@babel/runtime": "^7.12.1", + "@polkadot/networks": "3.6.1", + "@polkadot/util": "3.6.1", "@polkadot/wasm-crypto": "^1.4.1", "base-x": "^3.0.8", "bip39": "^3.0.2", @@ -4321,20 +4457,33 @@ "xxhashjs": "^0.2.2" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.5.1.tgz", - "integrity": "sha512-9CBVeQlhmghlVeOttZDxwOtDVWLKpHSP0iAE2vG2bnI6T1dSjD0cFHCG9q7GeD6UAN8z+m17/M9WDV2WXzT6kA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/x-textdecoder": "^0.3.2", - "@polkadot/x-textencoder": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4344,39 +4493,79 @@ "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ==" }, "@polkadot/x-fetch": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.2.tgz", - "integrity": "sha512-lk9M8ql/kBBqiZ8KOWj7LFK7P9OxDgVn2fZPNELJzQbfFZwFF8umBPDIWlQIK7wTnlRsQlzOuf6MGEyMK5p42w==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.3.tgz", + "integrity": "sha512-Osa+ifkqlndIW5U5jLnuugLYTd6q/cHkjdfisyYgNev/etsEtXkqesbGvF/UKw5FgZBxhK8sj6jjfProfh2NZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", "@types/node-fetch": "^2.5.7", "node-fetch": "^2.6.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } } }, "@polkadot/x-textdecoder": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-0.3.2.tgz", - "integrity": "sha512-W3KK6mMzOH5kts8pSkyYyfsQuAsKUHmIm8jQkhQnSR6FRyhwJtHLZnxP3feEwkNkRbGggG6CtDPrxYCuEO0MvA==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-0.3.3.tgz", + "integrity": "sha512-ehbPUUNn34kJh/RV8eQwyLnAFcMQSbtGPKqGRB7GSa/bL7P6hh1QGxB4DwvtlFU//bDTlofsv44ydpjDNmfWLg==", "requires": { - "@babel/runtime": "^7.11.2" + "@babel/runtime": "^7.12.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } } }, "@polkadot/x-textencoder": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-0.3.2.tgz", - "integrity": "sha512-nm7N9gWgKsZv8In1Fgfm+jYOPjprna/03Cd8hOqkCMRlSq0L4LS+d8BPrFhPOiT57VFTTW/7csLivFdeKv0GMA==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-0.3.3.tgz", + "integrity": "sha512-klbz82L5LxDJTFoCO64G/EFfY1mKXHDlteJMDGFTOim/1oK1ypLOG8/7BmncmQAw2BevA0r1YkvWN+F3muJSag==", "requires": { - "@babel/runtime": "^7.11.2" + "@babel/runtime": "^7.12.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } } }, "@polkadot/x-ws": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.2.tgz", - "integrity": "sha512-1aiG11Py8sgzJsz19melMzvBOn5zeMmfjCPoMryX4//063E0mcfnkujg4O6pTMygxJdFGAV1INB9wvMU9Dg9Wg==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.3.tgz", + "integrity": "sha512-t06ID5QLYi5B8bzlT2fcYsQ09yfLf5Uq9idunKRZj13EwSELaqvZFfn2UmiDFiIB1H5u7c2y+VDWbIdqE8ZxKw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", "@types/websocket": "^1.0.1", "websocket": "^1.0.32" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } } }, "@sindresorhus/is": { --- a/tests/package.json +++ b/tests/package.json @@ -23,9 +23,9 @@ "license": "Apache 2.0", "homepage": "", "dependencies": { - "@polkadot/api": "^2.0.1", - "@polkadot/api-contract": "^2.0.1", - "@polkadot/types": "^2.0.1", + "@polkadot/api": "^2.3.1", + "@polkadot/api-contract": "^2.3.1", + "@polkadot/types": "^2.3.1", "@polkadot/util": "^3.4.1", "@types/bn.js": "^4.11.6", "chai-as-promised": "^7.1.1" --- a/tests/src/contracts.test.ts +++ b/tests/src/contracts.test.ts @@ -1,129 +1,91 @@ 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, IKeyringPair } from "@polkadot/types/types"; -import BN from "bn.js"; -import { alicesPublicKey, bobsPublicKey } from "./accounts"; -import { ApiPromise } from "@polkadot/api"; -import { GenericAccountId, u128 } from "@polkadot/types"; -import getBalance from "./substrate/get-balance"; - - -function deployContract(api: ApiPromise, contract: Uint8Array, privateKey: IKeyringPair): Promise { - return promisifySubstrate(api, () => { - return new Promise(async (resolve, reject) => { - const unsubscribe = api.tx.contracts.putCode(contract).signAndSend(privateKey, async result => { - if(!result.isInBlock){ - return; - } +import { Abi, BlueprintPromise, CodePromise } from "@polkadot/api-contract"; +import { IKeyringPair } from "@polkadot/types/types"; +import { Keyring } from "@polkadot/api"; +import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types"; - const record = result.findRecord('contracts', 'CodeStored'); +const value = 0; +const gasLimit = 3000n * 1000000n; - if(record) { - (await unsubscribe)(); - resolve(record.event.data[0] as unknown as Hash); - } else { - reject('Failed to find contract hash in putCode transaction result.'); +function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise { + return new Promise(async (resolve, reject) => { + const unsub = await code + .createBlueprint() + .signAndSend(alice, (result) => { + if (result.status.isInBlock || result.status.isFinalized) { + // here we have an additional field in the result, containing the blueprint + resolve(result.blueprint); + unsub(); } - }); - }) - })(); + }) + }); } -function instantiateContract(api: ApiPromise, contractHash: Hash, args: Uint8Array, privateKey: IKeyringPair): Promise { - return promisifySubstrate(api, () => { - return new Promise((resolve, reject) => { - const unsubscribe = api.tx.contracts.instantiate(1000000000000000n, 1000000000000n, contractHash, args) - .signAndSend(privateKey, 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.'); - } - }); - }); - })(); +function deployContract(alice: IKeyringPair, blueprint: BlueprintPromise) : Promise { + return new Promise(async (resolve, reject) => { + const endowment = 1000000000000000n; + const initValue = true; + + const unsub = await blueprint.tx + .new(endowment, gasLimit, initValue) + .signAndSend(alice, (result) => { + if (result.status.isInBlock || result.status.isFinalized) { + unsub(); + resolve(result); + } + }); + }); } -function txContractCall(api: ApiPromise, privateKey: IKeyringPair, address: string, call: Uint8Array): Promise { - return promisifySubstrate(api, async () => { - return new Promise(async (resolve, reject) => { - api.tx.contracts.call(address, 0, 1000000000000n, call) - .signAndSend(privateKey, async result => { - if(!result.isInBlock) { - return; - } +function runTransaction(privateKey: IKeyringPair, extrinsic: SubmittableExtrinsic) { + return new Promise(async (resolve, reject) => { + extrinsic.signAndSend(privateKey, async result => { + if(!result.isInBlock) { + return; + } - if(result.findRecord('system', 'ExtrinsicSuccess')) { - resolve(); - } - else { - reject('Failed to execute tx call.'); - } - }) - }); - })(); + if(result.findRecord('system', 'ExtrinsicSuccess')) { + resolve(); + } + else { + reject('Failed to flip value.'); + } + }) + }); } describe('Contracts', () => { it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => { await usingApi(async api => { + const keyring = new Keyring({ type: 'sr25519' }); + const alice = keyring.addFromUri("//Alice"); + 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 abi = new Abi(metadata); - const alicesPrivateKey = privateKey('//Alice'); + const code = new CodePromise(api, abi, wasm); - const contractHash = await deployContract(api, contract, alicesPrivateKey); + const blueprint = await deployBlueprint(alice, code); + const contract = (await deployContract(alice, blueprint))['contract']; - const args = abi.constructors[0](true); - const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey); + const getFlipValue = async () => { + const result = await contract.query.get(alice.address, value, gasLimit); - 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(); - })(); + if(!result.result.isSuccess) { + throw `Failed to get flipper value`; + } + return (result.result.asSuccess.data[0] == 0x00) ? false : true; } const initialGetResponse = await getFlipValue(); expect(initialGetResponse).to.be.true; - await promisifySubstrate(api, async () => { - return new Promise(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 flip = contract.exec('flip', value, gasLimit); + await runTransaction(alice, flip); const afterFlipGetResponse = await getFlipValue(); @@ -133,28 +95,29 @@ it.skip('Can transfer balance using smart contract.', async () => { await usingApi(async api => { - const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); - const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm'); - const contract = compactAddLength(u8aToU8a(wasm)); + // const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); + // const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm'); + // const contract = compactAddLength(u8aToU8a(wasm)); + + // const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8')); + // const abi = new Abi(api.registry as any, metadata); - const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8')); - const abi = new Abi(api.registry as any, metadata); + // const alicesPrivateKey = privateKey('//Alice'); - const alicesPrivateKey = privateKey('//Alice'); + // const contractHash = await deployContract(api, contract, alicesPrivateKey); - const contractHash = await deployContract(api, contract, alicesPrivateKey); + // // const args = abi.constructors[0](); + // const instanceAccountId = await instantiateContract(api, contractHash, /*args,*/ alicesPrivateKey); + // const contractInstance = new ContractPromise(api, abi, instanceAccountId); + // const bob = new GenericAccountId(api.registry, bobsPublicKey); - const args = abi.constructors[0](); - const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey); - const contractInstance = new PromiseContract(api, abi, instanceAccountId); - const bob = new GenericAccountId(api.registry, bobsPublicKey); - const call = contractInstance.getMessage('balance_transfer').fn(bob, new u128(api.registry, 1000000)); - await txContractCall(api, alicesPrivateKey, contractInstance.address.toString(), call); + // const transfer = contractInstance.exec('balance_transfer', 0, 1000000000000n, [bob, new u128(api.registry, 1000000)]); + // await runTransaction(alicesPrivateKey, transfer); - const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); + // const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); - expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true; - expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true; + // expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true; + // expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true; }); }) }); -- gitstuff