difftreelog
Fix contract tests
in: master
3 files changed
tests/package-lock.jsondiffbeforeafterboth--- 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": {
tests/package.jsondiffbeforeafterboth--- 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"
tests/src/contracts.test.tsdiffbeforeafterboth1import { expect } from "chai";1import { expect } from "chai";2import usingApi from "./substrate/substrate-api";2import usingApi from "./substrate/substrate-api";3import promisifySubstrate from "./substrate/promisify-substrate";4import fs from "fs";3import fs from "fs";5import privateKey from "./substrate/privateKey";6import { compactAddLength, u8aToU8a } from '@polkadot/util';7import { Hash, AccountId } from "@polkadot/types/interfaces";8import { Abi, PromiseContract } from "@polkadot/api-contract";4import { Abi, BlueprintPromise, CodePromise } from "@polkadot/api-contract";9import { ISubmittableResult, IKeyringPair } from "@polkadot/types/types";5import { IKeyringPair } from "@polkadot/types/types";10import BN from "bn.js";11import { alicesPublicKey, bobsPublicKey } from "./accounts";12import { ApiPromise } from "@polkadot/api";6import { Keyring } from "@polkadot/api";13import { GenericAccountId, u128 } from "@polkadot/types";7import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types";814import getBalance from "./substrate/get-balance";9const value = 0;1510const gasLimit = 3000n * 1000000n;161117function deployContract(api: ApiPromise, contract: Uint8Array, privateKey: IKeyringPair): Promise<Hash> {12function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise<BlueprintPromise> {18 return promisifySubstrate(api, () => {13 return new Promise<BlueprintPromise>(async (resolve, reject) => {19 return new Promise<Hash>(async (resolve, reject) => {20 const unsubscribe = api.tx.contracts.putCode(contract).signAndSend(privateKey, async result => {14 const unsub = await code15 .createBlueprint()16 .signAndSend(alice, (result) => {21 if(!result.isInBlock){17 if (result.status.isInBlock || result.status.isFinalized) {22 return;18 // here we have an additional field in the result, containing the blueprint23 }2425 const record = result.findRecord('contracts', 'CodeStored');2627 if(record) {28 (await unsubscribe)();29 resolve(record.event.data[0] as unknown as Hash);19 resolve(result.blueprint);30 } else {31 reject('Failed to find contract hash in putCode transaction result.');20 unsub();32 }21 }33 });22 })34 })23 });35 })();36}24}372538function instantiateContract(api: ApiPromise, contractHash: Hash, args: Uint8Array, privateKey: IKeyringPair): Promise<AccountId> {26function deployContract(alice: IKeyringPair, blueprint: BlueprintPromise) : Promise<any> {39 return promisifySubstrate(api, () => {27 return new Promise<any>(async (resolve, reject) => {40 return new Promise<AccountId>((resolve, reject) => {28 const endowment = 1000000000000000n;29 const initValue = true;3041 const unsubscribe = api.tx.contracts.instantiate(1000000000000000n, 1000000000000n, contractHash, args)31 const unsub = await blueprint.tx32 .new(endowment, gasLimit, initValue)42 .signAndSend(privateKey, async (result:ISubmittableResult) => {33 .signAndSend(alice, (result) => {43 if(!result.isInBlock) {44 return;45 }46 const record = result.findRecord('contracts', 'Instantiated');47 if(record) {34 if (result.status.isInBlock || result.status.isFinalized) {48 (await unsubscribe)();49 expect(alicesPublicKey).to.be.equal(record.event.data[0].toString());50 resolve(record.event.data[1] as AccountId);35 unsub();51 } else {52 reject('Failed to find instantiated event.');36 resolve(result);53 }37 }54 });38 }); 55 });39 });56 })();57}40}584159function txContractCall(api: ApiPromise, privateKey: IKeyringPair, address: string, call: Uint8Array): Promise<void> {42function runTransaction(privateKey: IKeyringPair, extrinsic: SubmittableExtrinsic<ApiTypes>) {60 return promisifySubstrate(api, async () => {43 return new Promise<void>(async (resolve, reject) => {61 return new Promise<void>(async (resolve, reject) => {62 api.tx.contracts.call(address, 0, 1000000000000n, call)63 .signAndSend(privateKey, async result => {44 extrinsic.signAndSend(privateKey, async result => {64 if(!result.isInBlock) {45 if(!result.isInBlock) {65 return;46 return;66 }47 }69 resolve();50 resolve();70 }51 }71 else {52 else {72 reject('Failed to execute tx call.');53 reject('Failed to flip value.');73 }54 }74 })55 })75 });56 });76 })();77}57}785879describe('Contracts', () => {59describe('Contracts', () => {80 it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => {60 it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => {81 await usingApi(async api => {61 await usingApi(async api => {62 const keyring = new Keyring({ type: 'sr25519' });82 const wasm = fs.readFileSync('./src/flipper/flipper.wasm');63 const alice = keyring.addFromUri("//Alice");64 83 const contract = compactAddLength(u8aToU8a(wasm));65 const wasm = fs.readFileSync('./src/flipper/flipper.wasm');8466 85 const metadata = JSON.parse(fs.readFileSync('./src/flipper/metadata.json').toString('utf-8'));67 const metadata = JSON.parse(fs.readFileSync('./src/flipper/metadata.json').toString('utf-8'));86 const abi = new Abi(api.registry as any, metadata);68 const abi = new Abi(metadata);8788 const alicesPrivateKey = privateKey('//Alice');896990 const contractHash = await deployContract(api, contract, alicesPrivateKey);70 const code = new CodePromise(api, abi, wasm);917192 const args = abi.constructors[0](true);93 const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey);72 const blueprint = await deployBlueprint(alice, code);9495 const contractInstance = new PromiseContract(api, abi, instanceAccountId);73 const contract = (await deployContract(alice, blueprint))['contract'];7496 const getFlipValue = async () => {75 const getFlipValue = async () => {97 return await promisifySubstrate(api, async () => {98 const result = await contractInstance.call('rpc', 'get', 0, new BN('1000000000000'))76 const result = await contract.query.get(alice.address, value, gasLimit);99 .send(alicesPublicKey);77100 if(!result.isSuccess) {78 if(!result.result.isSuccess) {101 throw 'Failed to get flipper value';79 throw `Failed to get flipper value`;102 }80 }103 return result.output && result.output.valueOf && result.output.valueOf();104 })();81 return (result.result.asSuccess.data[0] == 0x00) ? false : true;105 }82 }10683107 const initialGetResponse = await getFlipValue();84 const initialGetResponse = await getFlipValue();108 expect(initialGetResponse).to.be.true;85 expect(initialGetResponse).to.be.true;10986110 await promisifySubstrate(api, async () => {111 return new Promise<void>(async (resolve, reject) => {112 api.tx.contracts.call(contractInstance.address.toString(), 0, 1000000000000n, contractInstance.getMessage('flip').fn())87 const flip = contract.exec('flip', value, gasLimit);113 .signAndSend(alicesPrivateKey, async result => {88 await runTransaction(alice, flip);114 if(!result.isInBlock) {115 return;116 }117118 if(result.findRecord('system', 'ExtrinsicSuccess')) {119 resolve();120 }121 else {122 reject('Failed to flip value.');123 }124 })125 });126 })();12789128 const afterFlipGetResponse = await getFlipValue();90 const afterFlipGetResponse = await getFlipValue();1299113395134 it.skip('Can transfer balance using smart contract.', async () => {96 it.skip('Can transfer balance using smart contract.', async () => {135 await usingApi(async api => {97 await usingApi(async api => {136 const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);98 // const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);137 const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm');99 // const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm');138 const contract = compactAddLength(u8aToU8a(wasm));100 // const contract = compactAddLength(u8aToU8a(wasm));139101140 const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8'));102 // const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8'));141 const abi = new Abi(api.registry as any, metadata);103 // const abi = new Abi(api.registry as any, metadata);142104143 const alicesPrivateKey = privateKey('//Alice');105 // const alicesPrivateKey = privateKey('//Alice');144106145 const contractHash = await deployContract(api, contract, alicesPrivateKey);107 // const contractHash = await deployContract(api, contract, alicesPrivateKey);146108147 const args = abi.constructors[0]();109 // // const args = abi.constructors[0]();148 const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey);110 // const instanceAccountId = await instantiateContract(api, contractHash, /*args,*/ alicesPrivateKey);149 const contractInstance = new PromiseContract(api, abi, instanceAccountId);111 // const contractInstance = new ContractPromise(api, abi, instanceAccountId);150 const bob = new GenericAccountId(api.registry, bobsPublicKey);112 // const bob = new GenericAccountId(api.registry, bobsPublicKey);151 const call = contractInstance.getMessage('balance_transfer').fn(bob, new u128(api.registry, 1000000));113152 await txContractCall(api, alicesPrivateKey, contractInstance.address.toString(), call);114 // const transfer = contractInstance.exec('balance_transfer', 0, 1000000000000n, [bob, new u128(api.registry, 1000000)]);153115 // await runTransaction(alicesPrivateKey, transfer);154 const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);116155117 // const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);156 expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true;118157 expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true;119 // expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true;120 // expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true;158 });121 });159 })122 })160});123});