difftreelog
Connection test now detects disconnection and added transfer test.
in: master
11 files changed
tests/.vscode/launch.jsondiffbeforeafterboth10 "name": "Mocha Current File",10 "name": "Mocha Current File",11 "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",11 "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",12 "args": [12 "args": [13 "--timeout", "999999",13 "--timeout",14 "9999999",14 "--colors",15 "--colors",15 "--recursive",16 "--recursive",16 "--require", "ts-node/register",17 "--require",17 "./**/*.test.ts"18 "ts-node/register",19 "${file}"18 ],20 ],19 "console": "integratedTerminal",21 "console": "integratedTerminal",20 "internalConsoleOptions": "neverOpen"22 "internalConsoleOptions": "neverOpen"21 }23 },24 {25 "type": "node",26 "request": "launch",27 "name": "Mocha All tests",28 "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",29 "args": [30 "--timeout",31 "9999999",32 "--colors",33 "--recursive",34 "--require",35 "ts-node/register",36 "./**/*.test.ts"37 ],38 "console": "integratedTerminal",39 "internalConsoleOptions": "neverOpen"40 }22 ]41 ]23}42}tests/package-lock.jsondiffbeforeafterboth3916 }3916 }3917 },3917 },3918 "@polkadot/api": {3918 "@polkadot/api": {3919 "version": "1.32.1",3919 "version": "1.31.2",3920 "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.32.1.tgz",3920 "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.31.2.tgz",3921 "integrity": "sha512-YwqvD7lmH18xPFggwqpXAQHH0DmwQcePVGLHb5c9JjX9QxYqPS5r+Ed6lFPqTBTTiYhb1ep8QZrY7TrgceP41g==",3921 "integrity": "sha512-5nMraRQYFt+xeInQi5i7c00fwOiSeZgU3Y1LJWz+z+Vnxep7xzjVBMLgBi4fe7g2eWKUYB79ApFNV8r2thsQZg==",3922 "requires": {3922 "requires": {3923 "@babel/runtime": "^7.11.2",3923 "@babel/runtime": "^7.11.2",3924 "@polkadot/api-derive": "1.32.1",3924 "@polkadot/api-derive": "1.31.2",3925 "@polkadot/keyring": "^3.4.1",3925 "@polkadot/keyring": "^3.4.1",3926 "@polkadot/metadata": "1.32.1",3926 "@polkadot/metadata": "1.31.2",3927 "@polkadot/rpc-core": "1.32.1",3927 "@polkadot/rpc-core": "1.31.2",3928 "@polkadot/rpc-provider": "1.32.1",3928 "@polkadot/rpc-provider": "1.31.2",3929 "@polkadot/types": "1.32.1",3929 "@polkadot/types": "1.31.2",3930 "@polkadot/types-known": "1.32.1",3930 "@polkadot/types-known": "1.31.2",3931 "@polkadot/util": "^3.4.1",3931 "@polkadot/util": "^3.4.1",3932 "@polkadot/util-crypto": "^3.4.1",3932 "@polkadot/util-crypto": "^3.4.1",3933 "bn.js": "^5.1.3",3933 "bn.js": "^5.1.3",3934 "eventemitter3": "^4.0.7",3934 "eventemitter3": "^4.0.6",3935 "rxjs": "^6.6.2"3935 "rxjs": "^6.6.2"3936 },3936 },3937 "dependencies": {3937 "dependencies": {3938 "@polkadot/metadata": {3939 "version": "1.31.2",3940 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.31.2.tgz",3941 "integrity": "sha512-UAcZLxh6QFwhF2Ccmax6LUYa99NntBZrAe8oUN92UJlHbtAutd5sq322P+liG2EHfyhUZs5T5v8jLD79pMTjdA==",3942 "requires": {3943 "@babel/runtime": "^7.11.2",3944 "@polkadot/types": "1.31.2",3945 "@polkadot/types-known": "1.31.2",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.31.2",3953 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.31.2.tgz",3954 "integrity": "sha512-eJsWdMzBlkYYrowR7tl9LYvGW3Za05esDQPxPxc1z2kkwzU2IoX2qijhUb6J9ViESY/h0jWFyEbV/1mBn4uupg==",3955 "requires": {3956 "@babel/runtime": "^7.11.2",3957 "@polkadot/metadata": "1.31.2",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.2"3964 }3965 },3966 "@polkadot/types-known": {3967 "version": "1.31.2",3968 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.31.2.tgz",3969 "integrity": "sha512-sA9IEwYNCsN+Z4eZklxOluJA5OBN2eGNvLz0uUQ6TFvqbi9Z8Mba+h+RZU1iFO6+yq2U7ECvdWzET6RN7zv+oQ==",3970 "requires": {3971 "@babel/runtime": "^7.11.2",3972 "@polkadot/types": "1.31.2",3973 "@polkadot/util": "^3.4.1",3974 "bn.js": "^5.1.3"3975 }3976 },3938 "@polkadot/util": {3977 "@polkadot/util": {3939 "version": "3.4.1",3978 "version": "3.4.1",3940 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",3979 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",3951 }3990 }3952 },3991 },3953 "@polkadot/api-derive": {3992 "@polkadot/api-derive": {3954 "version": "1.32.1",3993 "version": "1.31.2",3955 "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.32.1.tgz",3994 "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.31.2.tgz",3956 "integrity": "sha512-i7kz2v8tHRl9RHKzvwc8OwjRyZVCwiP40CEpq0ZIgSl4wl2MpWcSMLrhbZdvRtBiVIfaogNb6esAZ1AFrtSDMQ==",3995 "integrity": "sha512-j33elEBZpY7/ucsBRYdUxeWHID8vlvPKm7k9dWgaH8txYuzms0SFfkMHyECgo15SL+RTNhu/VxzSRWryk6dvTA==",3957 "requires": {3996 "requires": {3958 "@babel/runtime": "^7.11.2",3997 "@babel/runtime": "^7.11.2",3959 "@polkadot/api": "1.32.1",3998 "@polkadot/api": "1.31.2",3960 "@polkadot/rpc-core": "1.32.1",3999 "@polkadot/rpc-core": "1.31.2",3961 "@polkadot/rpc-provider": "1.32.1",4000 "@polkadot/rpc-provider": "1.31.2",3962 "@polkadot/types": "1.32.1",4001 "@polkadot/types": "1.31.2",3963 "@polkadot/util": "^3.4.1",4002 "@polkadot/util": "^3.4.1",3964 "@polkadot/util-crypto": "^3.4.1",4003 "@polkadot/util-crypto": "^3.4.1",3965 "bn.js": "^5.1.3",4004 "bn.js": "^5.1.3",3966 "memoizee": "^0.4.14",4005 "memoizee": "^0.4.14",3967 "rxjs": "^6.6.2"4006 "rxjs": "^6.6.2"3968 },4007 },3969 "dependencies": {4008 "dependencies": {4009 "@polkadot/metadata": {4010 "version": "1.31.2",4011 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.31.2.tgz",4012 "integrity": "sha512-UAcZLxh6QFwhF2Ccmax6LUYa99NntBZrAe8oUN92UJlHbtAutd5sq322P+liG2EHfyhUZs5T5v8jLD79pMTjdA==",4013 "requires": {4014 "@babel/runtime": "^7.11.2",4015 "@polkadot/types": "1.31.2",4016 "@polkadot/types-known": "1.31.2",4017 "@polkadot/util": "^3.4.1",4018 "@polkadot/util-crypto": "^3.4.1",4019 "bn.js": "^5.1.3"4020 }4021 },4022 "@polkadot/types": {4023 "version": "1.31.2",4024 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.31.2.tgz",4025 "integrity": "sha512-eJsWdMzBlkYYrowR7tl9LYvGW3Za05esDQPxPxc1z2kkwzU2IoX2qijhUb6J9ViESY/h0jWFyEbV/1mBn4uupg==",4026 "requires": {4027 "@babel/runtime": "^7.11.2",4028 "@polkadot/metadata": "1.31.2",4029 "@polkadot/util": "^3.4.1",4030 "@polkadot/util-crypto": "^3.4.1",4031 "@types/bn.js": "^4.11.6",4032 "bn.js": "^5.1.3",4033 "memoizee": "^0.4.14",4034 "rxjs": "^6.6.2"4035 }4036 },4037 "@polkadot/types-known": {4038 "version": "1.31.2",4039 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.31.2.tgz",4040 "integrity": "sha512-sA9IEwYNCsN+Z4eZklxOluJA5OBN2eGNvLz0uUQ6TFvqbi9Z8Mba+h+RZU1iFO6+yq2U7ECvdWzET6RN7zv+oQ==",4041 "requires": {4042 "@babel/runtime": "^7.11.2",4043 "@polkadot/types": "1.31.2",4044 "@polkadot/util": "^3.4.1",4045 "bn.js": "^5.1.3"4046 }4047 },3970 "@polkadot/util": {4048 "@polkadot/util": {3971 "version": "3.4.1",4049 "version": "3.4.1",3972 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",4050 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",4117 }4195 }4118 },4196 },4119 "@polkadot/rpc-core": {4197 "@polkadot/rpc-core": {4120 "version": "1.32.1",4198 "version": "1.31.2",4121 "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.32.1.tgz",4199 "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.31.2.tgz",4122 "integrity": "sha512-pre6aUVCQZqsoffGewyFzjM3MQ+kPn18n2L+B9EKqVBBd3+9v05X6aNmbm1aXb6laa0DzcuxO3EQmOT21CdbNQ==",4200 "integrity": "sha512-amFN0UtxB94TnXVuL9oBSQDFheCrxUN6C/lmVlOBqnWj6ZA1RDAuPPJBNIjhSxNlGmJxS2yIexaCVKgF8kS8Cg==",4123 "requires": {4201 "requires": {4124 "@babel/runtime": "^7.11.2",4202 "@babel/runtime": "^7.11.2",4125 "@polkadot/metadata": "1.32.1",4203 "@polkadot/metadata": "1.31.2",4126 "@polkadot/rpc-provider": "1.32.1",4204 "@polkadot/rpc-provider": "1.31.2",4127 "@polkadot/types": "1.32.1",4205 "@polkadot/types": "1.31.2",4128 "@polkadot/util": "^3.4.1",4206 "@polkadot/util": "^3.4.1",4129 "memoizee": "^0.4.14",4207 "memoizee": "^0.4.14",4130 "rxjs": "^6.6.2"4208 "rxjs": "^6.6.2"4131 },4209 },4132 "dependencies": {4210 "dependencies": {4211 "@polkadot/metadata": {4212 "version": "1.31.2",4213 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.31.2.tgz",4214 "integrity": "sha512-UAcZLxh6QFwhF2Ccmax6LUYa99NntBZrAe8oUN92UJlHbtAutd5sq322P+liG2EHfyhUZs5T5v8jLD79pMTjdA==",4215 "requires": {4216 "@babel/runtime": "^7.11.2",4217 "@polkadot/types": "1.31.2",4218 "@polkadot/types-known": "1.31.2",4219 "@polkadot/util": "^3.4.1",4220 "@polkadot/util-crypto": "^3.4.1",4221 "bn.js": "^5.1.3"4222 }4223 },4224 "@polkadot/types": {4225 "version": "1.31.2",4226 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.31.2.tgz",4227 "integrity": "sha512-eJsWdMzBlkYYrowR7tl9LYvGW3Za05esDQPxPxc1z2kkwzU2IoX2qijhUb6J9ViESY/h0jWFyEbV/1mBn4uupg==",4228 "requires": {4229 "@babel/runtime": "^7.11.2",4230 "@polkadot/metadata": "1.31.2",4231 "@polkadot/util": "^3.4.1",4232 "@polkadot/util-crypto": "^3.4.1",4233 "@types/bn.js": "^4.11.6",4234 "bn.js": "^5.1.3",4235 "memoizee": "^0.4.14",4236 "rxjs": "^6.6.2"4237 }4238 },4239 "@polkadot/types-known": {4240 "version": "1.31.2",4241 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.31.2.tgz",4242 "integrity": "sha512-sA9IEwYNCsN+Z4eZklxOluJA5OBN2eGNvLz0uUQ6TFvqbi9Z8Mba+h+RZU1iFO6+yq2U7ECvdWzET6RN7zv+oQ==",4243 "requires": {4244 "@babel/runtime": "^7.11.2",4245 "@polkadot/types": "1.31.2",4246 "@polkadot/util": "^3.4.1",4247 "bn.js": "^5.1.3"4248 }4249 },4133 "@polkadot/util": {4250 "@polkadot/util": {4134 "version": "3.4.1",4251 "version": "3.4.1",4135 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",4252 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",4146 }4263 }4147 },4264 },4148 "@polkadot/rpc-provider": {4265 "@polkadot/rpc-provider": {4149 "version": "1.32.1",4266 "version": "1.31.2",4150 "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.32.1.tgz",4267 "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.31.2.tgz",4151 "integrity": "sha512-m3Vk7somPLrAfNM/z24XFQUD7lYrOZxa647uaCSGqGUNsszrcotBDBU3bE6WL5qOaR3EpLXs0Lhq6RpgowOqJg==",4268 "integrity": "sha512-vqS1lsk/BBGSuklGKJhJxduKXOyXjc/kZzPWmmH8B92Zh59LqlzoJ8a4gQIjDr0CFjeJZbaaL1yRhE6qwaEe2A==",4152 "requires": {4269 "requires": {4153 "@babel/runtime": "^7.11.2",4270 "@babel/runtime": "^7.11.2",4154 "@polkadot/metadata": "1.32.1",4271 "@polkadot/metadata": "1.31.2",4155 "@polkadot/types": "1.32.1",4272 "@polkadot/types": "1.31.2",4156 "@polkadot/util": "^3.4.1",4273 "@polkadot/util": "^3.4.1",4157 "@polkadot/util-crypto": "^3.4.1",4274 "@polkadot/util-crypto": "^3.4.1",4158 "bn.js": "^5.1.3",4275 "bn.js": "^5.1.3",4159 "eventemitter3": "^4.0.7",4276 "eventemitter3": "^4.0.6",4160 "isomorphic-fetch": "^2.2.1",4277 "isomorphic-fetch": "^2.2.1",4161 "websocket": "^1.0.32"4278 "websocket": "^1.0.31"4162 },4279 },4163 "dependencies": {4280 "dependencies": {4281 "@polkadot/metadata": {4282 "version": "1.31.2",4283 "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.31.2.tgz",4284 "integrity": "sha512-UAcZLxh6QFwhF2Ccmax6LUYa99NntBZrAe8oUN92UJlHbtAutd5sq322P+liG2EHfyhUZs5T5v8jLD79pMTjdA==",4285 "requires": {4286 "@babel/runtime": "^7.11.2",4287 "@polkadot/types": "1.31.2",4288 "@polkadot/types-known": "1.31.2",4289 "@polkadot/util": "^3.4.1",4290 "@polkadot/util-crypto": "^3.4.1",4291 "bn.js": "^5.1.3"4292 }4293 },4294 "@polkadot/types": {4295 "version": "1.31.2",4296 "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.31.2.tgz",4297 "integrity": "sha512-eJsWdMzBlkYYrowR7tl9LYvGW3Za05esDQPxPxc1z2kkwzU2IoX2qijhUb6J9ViESY/h0jWFyEbV/1mBn4uupg==",4298 "requires": {4299 "@babel/runtime": "^7.11.2",4300 "@polkadot/metadata": "1.31.2",4301 "@polkadot/util": "^3.4.1",4302 "@polkadot/util-crypto": "^3.4.1",4303 "@types/bn.js": "^4.11.6",4304 "bn.js": "^5.1.3",4305 "memoizee": "^0.4.14",4306 "rxjs": "^6.6.2"4307 }4308 },4309 "@polkadot/types-known": {4310 "version": "1.31.2",4311 "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.31.2.tgz",4312 "integrity": "sha512-sA9IEwYNCsN+Z4eZklxOluJA5OBN2eGNvLz0uUQ6TFvqbi9Z8Mba+h+RZU1iFO6+yq2U7ECvdWzET6RN7zv+oQ==",4313 "requires": {4314 "@babel/runtime": "^7.11.2",4315 "@polkadot/types": "1.31.2",4316 "@polkadot/util": "^3.4.1",4317 "bn.js": "^5.1.3"4318 }4319 },4164 "@polkadot/util": {4320 "@polkadot/util": {4165 "version": "3.4.1",4321 "version": "3.4.1",4166 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",4322 "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",tests/package.jsondiffbeforeafterboth16 "typescript": "^3.9.7"16 "typescript": "^3.9.7"17 },17 },18 "scripts": {18 "scripts": {19 "test": "mocha -r ts-node/register ./**/*.test.ts"19 "test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts"20 },20 },21 "author": "",21 "author": "",22 "license": "Apache 2.0",22 "license": "Apache 2.0",tests/src/config.tsdiffbeforeafterboth1import process from 'process';1import process from 'process';223const config = {3const config = {4 substrateUrl: process.env.substrateUrl || 'ws://127.0.0.1:9944'4 substrateUrl: process.env.substrateUrl || 'ws://127.0.0.1:9944',5 customTypes: process.env.customTypes || `{6 "Schedule": {7 "version": "u32",8 "put_code_per_byte_cost": "Gas",9 "grow_mem_cost": "Gas",10 "regular_op_cost": "Gas",11 "return_data_per_byte_cost": "Gas",12 "event_data_per_byte_cost": "Gas",13 "event_per_topic_cost": "Gas",14 "event_base_cost": "Gas",15 "call_base_cost": "Gas",16 "instantiate_base_cost": "Gas",17 "dispatch_base_cost": "Gas",18 "sandbox_data_read_cost": "Gas",19 "sandbox_data_write_cost": "Gas",20 "transfer_cost": "Gas",21 "instantiate_cost": "Gas",22 "max_event_topics": "u32",23 "max_stack_height": "u32",24 "max_memory_pages": "u32",25 "max_table_size": "u32",26 "enable_println": "bool",27 "max_subject_len": "u32"28 },29 "CollectionMode": {30 "_enum": {31 "Invalid": null,32 "NFT": "u32",33 "Fungible": "u32",34 "ReFungible": "(u32, u32)"35 }36 },37 "NftItemType": {38 "Collection": "u64",39 "Owner": "AccountId",40 "Data": "Vec<u8>"41 },42 "Ownership": {43 "owner": "AccountId",44 "fraction": "u128"45 },46 "ReFungibleItemType": {47 "Collection": "u64",48 "Owner": "Vec<Ownership<AccountId>>",49 "Data": "Vec<u8>"50 },51 "CollectionType": {52 "Owner": "AccountId",53 "Mode": "CollectionMode",54 "Access": "u8",55 "DecimalPoints": "u32",56 "Name": "Vec<u16>",57 "Description": "Vec<u16>",58 "TokenPrefix": "Vec<u8>",59 "CustomDataSize": "u32",60 "OffchainSchema": "Vec<u8>",61 "Sponsor": "AccountId",62 "UnconfirmedSponsor": "AccountId"63 },64 "RawData": "Vec<u8>",65 "Address": "AccountId",66 "LookupSource": "AccountId",67 "Weight": "u64"68 }`5}69}6707export default config;71export default config;tests/src/connection.test.tsdiffbeforeafterboth1import createSubstrateApi from "./substrate-api";1import {expect} from 'chai';2import {expect} from 'chai';2import usingApi from "./substrate/substrate-api";334describe('Connection', () => {4describe('Connection', () => {5 it('Connection can be established', async () => {5 it('Connection can be established', async () => {6 const api = await createSubstrateApi();6 await usingApi(async api => {7 const health = await api.rpc.system.health();7 const health = await api.rpc.system.health();8 expect(health).to.be.not.empty;8 expect(health).to.be.not.empty;9 });9 });10 });10});11});tests/src/substrate-api.tsdiffbeforeafterbothno changes
tests/src/substrate/promisify-substrate.tsdiffbeforeafterbothno changes
tests/src/substrate/substrate-api.tsdiffbeforeafterbothno changes
tests/src/substrate/wait-new-blocks.tsdiffbeforeafterbothno changes
tests/src/transfer.test.tsdiffbeforeafterbothno changes
tests/tsconfig.jsondiffbeforeafterboth5 "**/node_modules/**/*"5 "**/node_modules/**/*"6 ],6 ],7 "compilerOptions": {7 "compilerOptions": {8 "target": "es6",8 "target": "ES2020",9 "moduleResolution": "node",9 "moduleResolution": "node",10 "esModuleInterop": true,10 "esModuleInterop": true,11 "resolveJsonModule": true,11 "resolveJsonModule": true,18 "include": [18 "include": [19 "src/**/*"19 "src/**/*"20 ],20 ],21 "lib": ["es2015"]21 "lib": ["es2017"]22}22}2323