diff --git a/.env b/.env new file mode 100644 index 0000000..2c4cee8 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +NETWORK_ADDRESS=ws://127.0.0.1:9944 +ANCHOR_URI=//Alice +DID_NAME=solar.sailer \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4c11f84..14bf103 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,178 +8,298 @@ "name": "cord-demo-scripts", "version": "0.0.2", "dependencies": { - "@cord.network/sdk": "^0.8.0-3" + "@cord.network/sdk": "0.9.0-1beta6", + "dotenv": "^16.3.1" }, "devDependencies": { "moment": "^2.29.1", "tsx": "^3.4.3" } }, - "node_modules/@babel/runtime": { - "version": "7.22.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz", - "integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==", + "node_modules/@cbor-extract/cbor-extract-darwin-arm64": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-darwin-arm64/-/cbor-extract-darwin-arm64-2.1.1.tgz", + "integrity": "sha512-blVBy5MXz6m36Vx0DfLd7PChOQKEs8lK2bD1WJn/vVgG4FXZiZmZb2GECHFvVPA5T7OnODd9xZiL3nMCv6QUhA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@cbor-extract/cbor-extract-darwin-x64": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-darwin-x64/-/cbor-extract-darwin-x64-2.1.1.tgz", + "integrity": "sha512-h6KFOzqk8jXTvkOftyRIWGrd7sKQzQv2jVdTL9nKSf3D2drCvQB/LHUxAOpPXo3pv2clDtKs3xnHalpEh3rDsw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@cbor-extract/cbor-extract-linux-arm": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-linux-arm/-/cbor-extract-linux-arm-2.1.1.tgz", + "integrity": "sha512-ds0uikdcIGUjPyraV4oJqyVE5gl/qYBpa/Wnh6l6xLE2lj/hwnjT2XcZCChdXwW/YFZ1LUHs6waoYN8PmK0nKQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@cbor-extract/cbor-extract-linux-arm64": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-linux-arm64/-/cbor-extract-linux-arm64-2.1.1.tgz", + "integrity": "sha512-SxAaRcYf8S0QHaMc7gvRSiTSr7nUYMqbUdErBEu+HYA4Q6UNydx1VwFE68hGcp1qvxcy9yT5U7gA+a5XikfwSQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@cbor-extract/cbor-extract-linux-x64": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-linux-x64/-/cbor-extract-linux-x64-2.1.1.tgz", + "integrity": "sha512-GVK+8fNIE9lJQHAlhOROYiI0Yd4bAZ4u++C2ZjlkS3YmO6hi+FUxe6Dqm+OKWTcMpL/l71N6CQAmaRcb4zyJuA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@cbor-extract/cbor-extract-win32-x64": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-win32-x64/-/cbor-extract-win32-x64-2.1.1.tgz", + "integrity": "sha512-2Niq1C41dCRIDeD8LddiH+mxGlO7HJ612Ll3D/E73ZWBmycued+8ghTr/Ho3CMOWPUEr08XtyBMVXAjqF+TcKw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@cord.network/augment-api": { + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/augment-api/-/augment-api-0.9.0-1beta6.tgz", + "integrity": "sha512-nxQGsgg/qdv+LIO2ZEa0ySEoz5UGynkEiO6lmHUhDd0AIkwlccs9nEXbYYYNizQod+JRmA0MTTk4VsD5Z8Z/WA==", "dependencies": { - "regenerator-runtime": "^0.13.11" + "@cord.network/type-definitions": "0.9.0-1beta6", + "@polkadot/rpc-augment": "^10.10.1", + "@polkadot/rpc-core": "^10.10.1", + "@polkadot/rpc-provider": "^10.10.1", + "glob": "^7.1.1" }, "engines": { - "node": ">=6.9.0" + "node": ">=18.0" } }, - "node_modules/@cord.network/augment-api": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/augment-api/-/augment-api-0.8.0-3.tgz", - "integrity": "sha512-Klt4s0ioRv8Lo9eC2zd0xdG5Q7XX9E5p4n373UlRzXQuLPedGlntAv1DeugxyF+UOM7lIKjbPz+56K8Rz8IFTA==", + "node_modules/@cord.network/chain-space": { + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/chain-space/-/chain-space-0.9.0-1beta6.tgz", + "integrity": "sha512-63LNCxwLxbTf1Dr4wKKWhO9RJnZfagjzBeq5AAceks0HGy+t7TdIqt+cbfDPTUNY718u8x7qdM86YDo4HKUHiQ==", "dependencies": { - "@cord.network/type-definitions": "0.8.0-3" + "@cord.network/config": "0.9.0-1beta6", + "@cord.network/did": "0.9.0-1beta6", + "@cord.network/identifier": "0.9.0-1beta6", + "@cord.network/network": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, "node_modules/@cord.network/config": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/config/-/config-0.8.0-3.tgz", - "integrity": "sha512-8mRS74fORcx5V7J2sHuPI3ksMXzWGioLc321qeZlA1Qj3H+FNgfiWyx6iZNZPr1CtnbwfOXAn/xRg8FeaqOqAQ==", + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/config/-/config-0.9.0-1beta6.tgz", + "integrity": "sha512-MWr71MPoc8ULEZbq9epHaAABHgBl6SsQnAn9h7XH4R3wEfpD3BFXXSn3qxRAfH/dfDTs/QghPsP2nnQb8G3wGQ==", "dependencies": { - "@cord.network/types": "0.8.0-3", - "@cord.network/utils": "0.8.0-3", - "@polkadot/api": "^9.10.2", + "@cord.network/type-definitions": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6", "typescript-logging": "^1.0.0" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, "node_modules/@cord.network/did": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/did/-/did-0.8.0-3.tgz", - "integrity": "sha512-85+rqLjoGgVQWccUhvmwy4+G30pcKm6qAI++KsnWJcmhT1SIWRawaKR6PduGFKb9pKEkUTvmN7pCxinZiyvX/w==", + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/did/-/did-0.9.0-1beta6.tgz", + "integrity": "sha512-amzpOyB570dS34OjiCEjVwSs47rXvPFSw9mfnIDC+kfn9r5eDmRK51GTr7bulxl+iNkaqg90VKvPS2Sw6ix51g==", "dependencies": { - "@cord.network/augment-api": "0.8.0-3", - "@cord.network/config": "0.8.0-3", - "@cord.network/types": "0.8.0-3", - "@cord.network/utils": "0.8.0-3", - "@polkadot/api": "^9.10.2", - "@polkadot/keyring": "^10.2.1", - "@polkadot/types": "^9.10.2", - "@polkadot/types-codec": "^9.10.2", - "@polkadot/util": "^10.2.1", - "@polkadot/util-crypto": "^10.2.1" + "@cord.network/augment-api": "0.9.0-1beta6", + "@cord.network/config": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6", + "@digitalbazaar/security-context": "^1.0.0", + "@polkadot/api": "^10.10.1", + "@polkadot/keyring": "^12.5.1", + "@polkadot/types": "^10.10.1", + "@polkadot/types-codec": "^10.10.1", + "@polkadot/util": "^12.5.1", + "@polkadot/util-crypto": "^12.5.1" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, - "node_modules/@cord.network/messaging": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/messaging/-/messaging-0.8.0-3.tgz", - "integrity": "sha512-379K+tL/4icVA4uuBIu/OOWacMAtjflNLzEdOZV/IWzYrpUqKu+xM64XK8Yu2S10GcCs03CX6NUJF2PYdSEnWQ==", + "node_modules/@cord.network/identifier": { + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/identifier/-/identifier-0.9.0-1beta6.tgz", + "integrity": "sha512-dhA0VgV2M38PgQm9cmf9UfH+Oij2iClTYreFfQL7oCN8Y10HHcjSW9A16USW7NRSL5l2hEQxvdB7ptvm9sNWhQ==", "dependencies": { - "@cord.network/did": "0.8.0-3", - "@cord.network/modules": "0.8.0-3", - "@cord.network/types": "0.8.0-3", - "@cord.network/utils": "0.8.0-3", - "@polkadot/util": "^10.2.1" + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, - "node_modules/@cord.network/modules": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/modules/-/modules-0.8.0-3.tgz", - "integrity": "sha512-zFUylFrIOW6qAX4wZkdILJZCjBwjGPY8t9yMRgl3xzgNKZYzchmDnPO3+UPSb9yDKXRZVab3zvKE7U+DYGvpBw==", + "node_modules/@cord.network/network": { + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/network/-/network-0.9.0-1beta6.tgz", + "integrity": "sha512-fddTcho8lkqnWFDtXc9GTn7D0ObDfzJfFNIdngTdVY2qcSNeUzSqYucqxiofozYpsRuXOU/6myOp4ez4o0vRAg==", "dependencies": { - "@cord.network/augment-api": "0.8.0-3", - "@cord.network/config": "0.8.0-3", - "@cord.network/did": "0.8.0-3", - "@cord.network/network": "0.8.0-3", - "@cord.network/type-definitions": "0.8.0-3", - "@cord.network/types": "0.8.0-3", - "@cord.network/utils": "0.8.0-3", - "@polkadot/api": "^9.10.2", - "@polkadot/keyring": "^10.0.0", - "@polkadot/types": "^9.10.2", - "@polkadot/util": "^10.2.1", - "@polkadot/util-crypto": "^10.2.1" + "@cord.network/config": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6", + "@polkadot/api": "^10.10.1", + "@polkadot/types": "^10.10.1" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, - "node_modules/@cord.network/network": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/network/-/network-0.8.0-3.tgz", - "integrity": "sha512-bEzV2I35Jvfa75VmE9L/Gqt6Db1tJdBuAeqUfu/GvZO4CIT4HnzOsHzdtF1zQGxkasdpc7GTetksf3hvxGWvsA==", + "node_modules/@cord.network/network-score": { + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/network-score/-/network-score-0.9.0-1beta6.tgz", + "integrity": "sha512-/xzNmOwM7/XFHCTQhHCi3CvYJDX7T3yp2FytPf06b118Yc+7ZFSAqrWnt+qwOHxdyMYBfYSSViLKiVIZDdSYXQ==", "dependencies": { - "@cord.network/config": "0.8.0-3", - "@cord.network/types": "0.8.0-3", - "@cord.network/utils": "0.8.0-3", - "@polkadot/api": "^9.10.2", - "@polkadot/types": "^9.10.2" + "@cord.network/config": "0.9.0-1beta6", + "@cord.network/did": "0.9.0-1beta6", + "@cord.network/identifier": "0.9.0-1beta6", + "@cord.network/network": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" + } + }, + "node_modules/@cord.network/schema": { + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/schema/-/schema-0.9.0-1beta6.tgz", + "integrity": "sha512-FzmrWw0ocV/YzdunIUbOo4Zuw4a6lpn6vy5nh9bf9F2/RKAQKU29WiBpmZ/w0lwxdXXJbDCVys9kJuzYldPHBQ==", + "dependencies": { + "@cord.network/augment-api": "0.9.0-1beta6", + "@cord.network/chain-space": "0.9.0-1beta6", + "@cord.network/config": "0.9.0-1beta6", + "@cord.network/did": "0.9.0-1beta6", + "@cord.network/identifier": "0.9.0-1beta6", + "@cord.network/network": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6" + }, + "engines": { + "node": ">=18.0" } }, "node_modules/@cord.network/sdk": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/sdk/-/sdk-0.8.0-3.tgz", - "integrity": "sha512-d/5GauZJhkKeuEKO1Lwc+HUEQlcuXDBTTU4o1KTHVn5Wn+mQ8I/ADq45+hDtYEnVhuCSgCrgeY6eB7TLvGly1g==", + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/sdk/-/sdk-0.9.0-1beta6.tgz", + "integrity": "sha512-8mScj6CJCuXA/7QofFsDVY5/xLD+3Bpl0OoVZ2eHUJOnztekMbiqveM3wZ/uMRVm3txsHnDfyq2+AJLUy8ig8A==", "dependencies": { - "@cord.network/config": "0.8.0-3", - "@cord.network/did": "0.8.0-3", - "@cord.network/messaging": "0.8.0-3", - "@cord.network/modules": "0.8.0-3", - "@cord.network/network": "0.8.0-3", - "@cord.network/types": "0.8.0-3", - "@cord.network/utils": "0.8.0-3" + "@cord.network/chain-space": "0.9.0-1beta6", + "@cord.network/config": "0.9.0-1beta6", + "@cord.network/did": "0.9.0-1beta6", + "@cord.network/identifier": "0.9.0-1beta6", + "@cord.network/network": "0.9.0-1beta6", + "@cord.network/network-score": "0.9.0-1beta6", + "@cord.network/schema": "0.9.0-1beta6", + "@cord.network/statement": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" + } + }, + "node_modules/@cord.network/statement": { + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/statement/-/statement-0.9.0-1beta6.tgz", + "integrity": "sha512-5XGD2zORZbF+6ZxoOQNvM6e7zkubtl7fGdtNMv8AnrFdj2FaH1HG/9vGt3vtIzkOgCk2cNBueHhZA3QB0LOlrQ==", + "dependencies": { + "@cord.network/config": "0.9.0-1beta6", + "@cord.network/did": "0.9.0-1beta6", + "@cord.network/identifier": "0.9.0-1beta6", + "@cord.network/network": "0.9.0-1beta6", + "@cord.network/types": "0.9.0-1beta6", + "@cord.network/utils": "0.9.0-1beta6" + }, + "engines": { + "node": ">=18.0" } }, "node_modules/@cord.network/type-definitions": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/type-definitions/-/type-definitions-0.8.0-3.tgz", - "integrity": "sha512-wDXtDDUDGmMscuP4XGwuEn8AvzgXEoOwN1NSjDH7/rD4SpnaRNkJyxvBaJ8OhaXXNXRl1YDkcVmt2cd7DaBuGg==", + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/type-definitions/-/type-definitions-0.9.0-1beta6.tgz", + "integrity": "sha512-v8PPFYd57ubtVXc30ZC5fyUHq2iPl3nxwH58ySnySuhA7C/7HFR7xx2mGJZpyKmRgSCEaLQB6wlF0RCGuda5zw==", + "dependencies": { + "@polkadot/types": "^10.10.1" + }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, "node_modules/@cord.network/types": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/types/-/types-0.8.0-3.tgz", - "integrity": "sha512-mzFb7m9s7/NZpBvWLtEL0Rr9EjQfRa7OeEQB6okg4A58JSlAaDeu0RpBknRC3PIGXhn9MLKUJ5qWb5uOj/fBmg==", + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/types/-/types-0.9.0-1beta6.tgz", + "integrity": "sha512-N2t7oTILdAUQiT7uZxaGe75GkuK+/sGcx2zISR5eUlbf1gE01cyQuibpLkmO4bjqGUZbWsoLL60NIKV2au5Eig==", "dependencies": { - "@polkadot/api": "^9.10.2", - "@polkadot/keyring": "^10.2.1", - "@polkadot/types": "^9.10.2", - "@polkadot/util": "^10.2.1", - "@polkadot/util-crypto": "^10.2.1" + "@polkadot/api": "^10.10.1", + "@polkadot/keyring": "^12.5.1", + "@polkadot/types": "^10.10.1", + "@polkadot/util": "^12.5.1", + "@polkadot/util-crypto": "^12.5.1" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, "node_modules/@cord.network/utils": { - "version": "0.8.0-3", - "resolved": "https://registry.npmjs.org/@cord.network/utils/-/utils-0.8.0-3.tgz", - "integrity": "sha512-ybS25xIkNHKXHstNOybVbZBeLtdKySynWOJ7NPKTHVanhCcYP14vzqgf4NFE9rBa327lM/R/BLx3K4TmbZyY2A==", - "dependencies": { - "@cord.network/types": "0.8.0-3", - "@polkadot/api": "^9.10.2", - "@polkadot/keyring": "^10.2.1", - "@polkadot/util": "^10.2.1", - "@polkadot/util-crypto": "^10.2.1", + "version": "0.9.0-1beta6", + "resolved": "https://registry.npmjs.org/@cord.network/utils/-/utils-0.9.0-1beta6.tgz", + "integrity": "sha512-Uus4lzaBlemZXoCfSIn6a1g65SGQodvvJsmri7iRrZ79t4dSAtbWk3bf1boPnoaiCz6aAOSPp22W6q9Kjn7j5g==", + "dependencies": { + "@cord.network/types": "0.9.0-1beta6", + "@polkadot/api": "^10.10.1", + "@polkadot/keyring": "^12.5.1", + "@polkadot/util": "^12.5.1", + "@polkadot/util-crypto": "^12.5.1", + "cbor-x": "^1.5.4", "tweetnacl": "^1.0.3", "uuid": "^9.0.0" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, + "node_modules/@digitalbazaar/security-context": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@digitalbazaar/security-context/-/security-context-1.0.1.tgz", + "integrity": "sha512-0WZa6tPiTZZF8leBtQgYAfXQePFQp2z5ivpCEN/iZguYYZ0TB9qRmWtan5XH6mNFuusHtMcyIzAcReyE6rZPhA==" + }, "node_modules/@esbuild-kit/cjs-loader": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@esbuild-kit/cjs-loader/-/cjs-loader-2.4.2.tgz", @@ -562,329 +682,329 @@ "node": ">=12" } }, - "node_modules/@noble/hashes": { + "node_modules/@noble/curves": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", - "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } }, - "node_modules/@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@polkadot/api": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-9.14.2.tgz", - "integrity": "sha512-R3eYFj2JgY1zRb+OCYQxNlJXCs2FA+AU4uIEiVcXnVLmR3M55tkRNEwYAZmiFxx0pQmegGgPMc33q7TWGdw24A==", - "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/api-augment": "9.14.2", - "@polkadot/api-base": "9.14.2", - "@polkadot/api-derive": "9.14.2", - "@polkadot/keyring": "^10.4.2", - "@polkadot/rpc-augment": "9.14.2", - "@polkadot/rpc-core": "9.14.2", - "@polkadot/rpc-provider": "9.14.2", - "@polkadot/types": "9.14.2", - "@polkadot/types-augment": "9.14.2", - "@polkadot/types-codec": "9.14.2", - "@polkadot/types-create": "9.14.2", - "@polkadot/types-known": "9.14.2", - "@polkadot/util": "^10.4.2", - "@polkadot/util-crypto": "^10.4.2", - "eventemitter3": "^5.0.0", - "rxjs": "^7.8.0" - }, - "engines": { - "node": ">=14.0.0" + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-10.11.1.tgz", + "integrity": "sha512-WEgUYvY90AHX9drmsvWQ4DDuqlE7h4x3f28K5eOoJF4dQ5AkWsFogxwJ4TH57POWLfyi8AIn6/f1vsqPtReDhA==", + "dependencies": { + "@polkadot/api-augment": "10.11.1", + "@polkadot/api-base": "10.11.1", + "@polkadot/api-derive": "10.11.1", + "@polkadot/keyring": "^12.6.1", + "@polkadot/rpc-augment": "10.11.1", + "@polkadot/rpc-core": "10.11.1", + "@polkadot/rpc-provider": "10.11.1", + "@polkadot/types": "10.11.1", + "@polkadot/types-augment": "10.11.1", + "@polkadot/types-codec": "10.11.1", + "@polkadot/types-create": "10.11.1", + "@polkadot/types-known": "10.11.1", + "@polkadot/util": "^12.6.1", + "@polkadot/util-crypto": "^12.6.1", + "eventemitter3": "^5.0.1", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" } }, "node_modules/@polkadot/api-augment": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-9.14.2.tgz", - "integrity": "sha512-19MmW8AHEcLkdcUIo3LLk0eCQgREWqNSxkUyOeWn7UiNMY1AhDOOwMStUBNCvrIDK6VL6GGc1sY7rkPCLMuKSw==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-10.11.1.tgz", + "integrity": "sha512-9Sk7fi6wzvxAoxvGJPcMt0hU4WzuIAlBy4Rng6WPiS6Ed0HJLr1dkZaqFFmV5my2pb3tu//1JGYkt+MUVB0Kqw==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/api-base": "9.14.2", - "@polkadot/rpc-augment": "9.14.2", - "@polkadot/types": "9.14.2", - "@polkadot/types-augment": "9.14.2", - "@polkadot/types-codec": "9.14.2", - "@polkadot/util": "^10.4.2" + "@polkadot/api-base": "10.11.1", + "@polkadot/rpc-augment": "10.11.1", + "@polkadot/types": "10.11.1", + "@polkadot/types-augment": "10.11.1", + "@polkadot/types-codec": "10.11.1", + "@polkadot/util": "^12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/api-base": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-9.14.2.tgz", - "integrity": "sha512-ky9fmzG1Tnrjr/SBZ0aBB21l0TFr+CIyQenQczoUyVgiuxVaI/2Bp6R2SFrHhG28P+PW2/RcYhn2oIAR2Z2fZQ==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-10.11.1.tgz", + "integrity": "sha512-A645Hj9bGtq0EOEWcwTaGoD40vp8/ih1suwinl5il8Psg+bdDmzodnVH5Jhuwe1dNKOuXuvxZvOmbYUPWyIqyg==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/rpc-core": "9.14.2", - "@polkadot/types": "9.14.2", - "@polkadot/util": "^10.4.2", - "rxjs": "^7.8.0" + "@polkadot/rpc-core": "10.11.1", + "@polkadot/types": "10.11.1", + "@polkadot/util": "^12.6.1", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/api-derive": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-9.14.2.tgz", - "integrity": "sha512-yw9OXucmeggmFqBTMgza0uZwhNjPxS7MaT7lSCUIRKckl1GejdV+qMhL3XFxPFeYzXwzFpdPG11zWf+qJlalqw==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-10.11.1.tgz", + "integrity": "sha512-i48okJr0l1IrFTPa9KVkoJnDL2EHKExR6XC0Z7I9+kW9noxYWqo0tIoi5s1bNVD475xWK/rUjT7qHxiDbPaCUQ==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/api": "9.14.2", - "@polkadot/api-augment": "9.14.2", - "@polkadot/api-base": "9.14.2", - "@polkadot/rpc-core": "9.14.2", - "@polkadot/types": "9.14.2", - "@polkadot/types-codec": "9.14.2", - "@polkadot/util": "^10.4.2", - "@polkadot/util-crypto": "^10.4.2", - "rxjs": "^7.8.0" + "@polkadot/api": "10.11.1", + "@polkadot/api-augment": "10.11.1", + "@polkadot/api-base": "10.11.1", + "@polkadot/rpc-core": "10.11.1", + "@polkadot/types": "10.11.1", + "@polkadot/types-codec": "10.11.1", + "@polkadot/util": "^12.6.1", + "@polkadot/util-crypto": "^12.6.1", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/keyring": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-10.4.2.tgz", - "integrity": "sha512-7iHhJuXaHrRTG6cJDbZE9G+c1ts1dujp0qbO4RfAPmT7YUvphHvAtCKueN9UKPz5+TYDL+rP/jDEaSKU8jl/qQ==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.1.tgz", + "integrity": "sha512-cicTctZr5Jy5vgNT2FsNiKoTZnz6zQkgDoIYv79NI+p1Fhwc9C+DN/iMCnk3Cm9vR2gSAd2fSV+Y5iKVDhAmUw==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/util": "10.4.2", - "@polkadot/util-crypto": "10.4.2" + "@polkadot/util": "12.6.1", + "@polkadot/util-crypto": "12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { - "@polkadot/util": "10.4.2", - "@polkadot/util-crypto": "10.4.2" + "@polkadot/util": "12.6.1", + "@polkadot/util-crypto": "12.6.1" } }, "node_modules/@polkadot/networks": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-10.4.2.tgz", - "integrity": "sha512-FAh/znrEvWBiA/LbcT5GXHsCFUl//y9KqxLghSr/CreAmAergiJNT0MVUezC7Y36nkATgmsr4ylFwIxhVtuuCw==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-12.6.1.tgz", + "integrity": "sha512-pzyirxTYAnsx+6kyLYcUk26e4TLz3cX6p2KhTgAVW77YnpGX5VTKTbYykyXC8fXFd/migeQsLaa2raFN47mwoA==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/util": "10.4.2", - "@substrate/ss58-registry": "^1.38.0" + "@polkadot/util": "12.6.1", + "@substrate/ss58-registry": "^1.44.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/rpc-augment": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-9.14.2.tgz", - "integrity": "sha512-mOubRm3qbKZTbP9H01XRrfTk7k5it9WyzaWAg72DJBQBYdgPUUkGSgpPD/Srkk5/5GAQTWVWL1I2UIBKJ4TJjQ==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-10.11.1.tgz", + "integrity": "sha512-wrtxHnEwqS3b1GuZ3sA1pzLuUjjLnW4FPawOklONRcIuKbGmFuvu7QvEIHmxBV1FAS/fs8gbvp8ImKWUPnT93Q==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/rpc-core": "9.14.2", - "@polkadot/types": "9.14.2", - "@polkadot/types-codec": "9.14.2", - "@polkadot/util": "^10.4.2" + "@polkadot/rpc-core": "10.11.1", + "@polkadot/types": "10.11.1", + "@polkadot/types-codec": "10.11.1", + "@polkadot/util": "^12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/rpc-core": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-9.14.2.tgz", - "integrity": "sha512-krA/mtQ5t9nUQEsEVC1sjkttLuzN6z6gyJxK2IlpMS3S5ncy/R6w4FOpy+Q0H18Dn83JBo0p7ZtY7Y6XkK48Kw==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-10.11.1.tgz", + "integrity": "sha512-3l4l+zL7MDWzQx3WnaieXXUKsbeA1Miu4wsje5trYJEE+hm+nMW8h7fiFKfYzXBi7ty/wMS+S7BfQPTrDkYHxA==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/rpc-augment": "9.14.2", - "@polkadot/rpc-provider": "9.14.2", - "@polkadot/types": "9.14.2", - "@polkadot/util": "^10.4.2", - "rxjs": "^7.8.0" + "@polkadot/rpc-augment": "10.11.1", + "@polkadot/rpc-provider": "10.11.1", + "@polkadot/types": "10.11.1", + "@polkadot/util": "^12.6.1", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/rpc-provider": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-9.14.2.tgz", - "integrity": "sha512-YTSywjD5PF01V47Ru5tln2LlpUwJiSOdz6rlJXPpMaY53hUp7+xMU01FVAQ1bllSBNisSD1Msv/mYHq84Oai2g==", - "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/keyring": "^10.4.2", - "@polkadot/types": "9.14.2", - "@polkadot/types-support": "9.14.2", - "@polkadot/util": "^10.4.2", - "@polkadot/util-crypto": "^10.4.2", - "@polkadot/x-fetch": "^10.4.2", - "@polkadot/x-global": "^10.4.2", - "@polkadot/x-ws": "^10.4.2", - "eventemitter3": "^5.0.0", - "mock-socket": "^9.2.1", - "nock": "^13.3.0" - }, - "engines": { - "node": ">=14.0.0" + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-10.11.1.tgz", + "integrity": "sha512-86aDUOnaG42si0jSOAgn6Fs3F3rz57x+iNBK1JpM0PLL2XvmPuoMZL5dZwzqSIey3nVdGJqRYfnFquWuyQpnOQ==", + "dependencies": { + "@polkadot/keyring": "^12.6.1", + "@polkadot/types": "10.11.1", + "@polkadot/types-support": "10.11.1", + "@polkadot/util": "^12.6.1", + "@polkadot/util-crypto": "^12.6.1", + "@polkadot/x-fetch": "^12.6.1", + "@polkadot/x-global": "^12.6.1", + "@polkadot/x-ws": "^12.6.1", + "eventemitter3": "^5.0.1", + "mock-socket": "^9.3.1", + "nock": "^13.3.8", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" }, "optionalDependencies": { - "@substrate/connect": "0.7.19" + "@substrate/connect": "0.7.35" } }, "node_modules/@polkadot/types": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-9.14.2.tgz", - "integrity": "sha512-hGLddTiJbvowhhUZJ3k+olmmBc1KAjWIQxujIUIYASih8FQ3/YJDKxaofGOzh0VygOKW3jxQBN2VZPofyDP9KQ==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-10.11.1.tgz", + "integrity": "sha512-4uKnzW2GZqNA5qRZpTPJ7z+G/ARTvXI89etv9xXXVttUdfTaYZsMf4rMuMThOAE/mAUn70LoH0JKthZLwzVgNQ==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/keyring": "^10.4.2", - "@polkadot/types-augment": "9.14.2", - "@polkadot/types-codec": "9.14.2", - "@polkadot/types-create": "9.14.2", - "@polkadot/util": "^10.4.2", - "@polkadot/util-crypto": "^10.4.2", - "rxjs": "^7.8.0" + "@polkadot/keyring": "^12.6.1", + "@polkadot/types-augment": "10.11.1", + "@polkadot/types-codec": "10.11.1", + "@polkadot/types-create": "10.11.1", + "@polkadot/util": "^12.6.1", + "@polkadot/util-crypto": "^12.6.1", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/types-augment": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-9.14.2.tgz", - "integrity": "sha512-WO9d7RJufUeY3iFgt2Wz762kOu1tjEiGBR5TT4AHtpEchVHUeosVTrN9eycC+BhleqYu52CocKz6u3qCT/jKLg==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-10.11.1.tgz", + "integrity": "sha512-Exd5mMCuSOXXz73iWqy8ocScWTrwAPqHz0Kxpz5OWlAu+5usipMuhjoeaZA803FHQntZh9lHUN31fuc50Exhew==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/types": "9.14.2", - "@polkadot/types-codec": "9.14.2", - "@polkadot/util": "^10.4.2" + "@polkadot/types": "10.11.1", + "@polkadot/types-codec": "10.11.1", + "@polkadot/util": "^12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/types-codec": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-9.14.2.tgz", - "integrity": "sha512-AJ4XF7W1no4PENLBRU955V6gDxJw0h++EN3YoDgThozZ0sj3OxyFupKgNBZcZb2V23H8JxQozzIad8k+nJbO1w==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-10.11.1.tgz", + "integrity": "sha512-B9Fu2hq3cRpJpGPcgfZ8Qi1OSX9u82J46adlbIG95ktoA+70eZ83VS3Zvtt9ACsdLVGETCJfDjSO25XptjhZKQ==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/util": "^10.4.2", - "@polkadot/x-bigint": "^10.4.2" + "@polkadot/util": "^12.6.1", + "@polkadot/x-bigint": "^12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/types-create": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-9.14.2.tgz", - "integrity": "sha512-nSnKpBierlmGBQT8r6/SHf6uamBIzk4WmdMsAsR4uJKJF1PtbIqx2W5PY91xWSiMSNMzjkbCppHkwaDAMwLGaw==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-10.11.1.tgz", + "integrity": "sha512-oeaI185F3XeWSz9/fe//qZ0KsQyE6C6c13WuOa+5cX/Yuz7cSAXawrhl58HRaU+fueaE/ijEHLcuK1sdM6e1JQ==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/types-codec": "9.14.2", - "@polkadot/util": "^10.4.2" + "@polkadot/types-codec": "10.11.1", + "@polkadot/util": "^12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/types-known": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-9.14.2.tgz", - "integrity": "sha512-iM8WOCgguzJ3TLMqlm4K1gKQEwWm2zxEKT1HZZ1irs/lAbBk9MquDWDvebryiw3XsLB8xgrp3RTIBn2Q4FjB2A==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-10.11.1.tgz", + "integrity": "sha512-BPHI7EbdRaznZR4RVVrQC5epyxL6caJ5dkluZP6rRwx7VmQK0FTGIwgh3UP724mzQhM8rT77MD3h2ftnq1cteg==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/networks": "^10.4.2", - "@polkadot/types": "9.14.2", - "@polkadot/types-codec": "9.14.2", - "@polkadot/types-create": "9.14.2", - "@polkadot/util": "^10.4.2" + "@polkadot/networks": "^12.6.1", + "@polkadot/types": "10.11.1", + "@polkadot/types-codec": "10.11.1", + "@polkadot/types-create": "10.11.1", + "@polkadot/util": "^12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/types-support": { - "version": "9.14.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-9.14.2.tgz", - "integrity": "sha512-VWCOPgXDK3XtXT7wMLyIWeNDZxUbNcw/8Pn6n6vMogs7o/n4h6WGbGMeTIQhPWyn831/RmkVs5+2DUC+2LlOhw==", + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-10.11.1.tgz", + "integrity": "sha512-eCvWjdpELsHvXiTq201DdbIeOIaEr53zTD7HqC2wR/Z1bkQuw79Z+CyIU4sp79GL1vZ1PxS7vUH9M3FKNaTl1Q==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/util": "^10.4.2" + "@polkadot/util": "^12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/util": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-10.4.2.tgz", - "integrity": "sha512-0r5MGICYiaCdWnx+7Axlpvzisy/bi1wZGXgCSw5+ZTyPTOqvsYRqM2X879yxvMsGfibxzWqNzaiVjToz1jvUaA==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.1.tgz", + "integrity": "sha512-10ra3VfXtK8ZSnWI7zjhvRrhupg3rd4iFC3zCaXmRpOU+AmfIoCFVEmuUuC66gyXiz2/g6k5E6j0lWQCOProSQ==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/x-bigint": "10.4.2", - "@polkadot/x-global": "10.4.2", - "@polkadot/x-textdecoder": "10.4.2", - "@polkadot/x-textencoder": "10.4.2", - "@types/bn.js": "^5.1.1", - "bn.js": "^5.2.1" + "@polkadot/x-bigint": "12.6.1", + "@polkadot/x-global": "12.6.1", + "@polkadot/x-textdecoder": "12.6.1", + "@polkadot/x-textencoder": "12.6.1", + "@types/bn.js": "^5.1.5", + "bn.js": "^5.2.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/util-crypto": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-10.4.2.tgz", - "integrity": "sha512-RxZvF7C4+EF3fzQv8hZOLrYCBq5+wA+2LWv98nECkroChY3C2ZZvyWDqn8+aonNULt4dCVTWDZM0QIY6y4LUAQ==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.1.tgz", + "integrity": "sha512-2ezWFLmdgeDXqB9NAUdgpp3s2rQztNrZLY+y0SJYNOG4ch+PyodTW/qSksnOrVGVdRhZ5OESRE9xvo9LYV5UAw==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@noble/hashes": "1.2.0", - "@noble/secp256k1": "1.7.1", - "@polkadot/networks": "10.4.2", - "@polkadot/util": "10.4.2", - "@polkadot/wasm-crypto": "^6.4.1", - "@polkadot/x-bigint": "10.4.2", - "@polkadot/x-randomvalues": "10.4.2", - "@scure/base": "1.1.1", - "ed2curve": "^0.3.0", - "tweetnacl": "^1.0.3" + "@noble/curves": "^1.2.0", + "@noble/hashes": "^1.3.2", + "@polkadot/networks": "12.6.1", + "@polkadot/util": "12.6.1", + "@polkadot/wasm-crypto": "^7.3.1", + "@polkadot/wasm-util": "^7.3.1", + "@polkadot/x-bigint": "12.6.1", + "@polkadot/x-randomvalues": "12.6.1", + "@scure/base": "^1.1.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { - "@polkadot/util": "10.4.2" + "@polkadot/util": "12.6.1" } }, "node_modules/@polkadot/wasm-bridge": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-6.4.1.tgz", - "integrity": "sha512-QZDvz6dsUlbYsaMV5biZgZWkYH9BC5AfhT0f0/knv8+LrbAoQdP3Asbvddw8vyU9sbpuCHXrd4bDLBwUCRfrBQ==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.3.1.tgz", + "integrity": "sha512-wPtDkGaOQx5BUIYP+kJv5aV3BnCQ+HXr36khGKYrRQAMBrG+ybCNPOTVXDQnSbraPQRSw7fSIJmiQpEmFsIz0w==", "dependencies": { - "@babel/runtime": "^7.20.6" + "@polkadot/wasm-util": "7.3.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { "@polkadot/util": "*", @@ -892,19 +1012,19 @@ } }, "node_modules/@polkadot/wasm-crypto": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-6.4.1.tgz", - "integrity": "sha512-FH+dcDPdhSLJvwL0pMLtn/LIPd62QDPODZRCmDyw+pFjLOMaRBc7raomWUOqyRWJTnqVf/iscc2rLVLNMyt7ag==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.3.1.tgz", + "integrity": "sha512-BSK0YyCN4ohjtwbiHG71fgf+7ufgfLrHxjn7pKsvXhyeiEVuDhbDreNcpUf3eGOJ5tNk75aSbKGF4a3EJGIiNA==", "dependencies": { - "@babel/runtime": "^7.20.6", - "@polkadot/wasm-bridge": "6.4.1", - "@polkadot/wasm-crypto-asmjs": "6.4.1", - "@polkadot/wasm-crypto-init": "6.4.1", - "@polkadot/wasm-crypto-wasm": "6.4.1", - "@polkadot/wasm-util": "6.4.1" + "@polkadot/wasm-bridge": "7.3.1", + "@polkadot/wasm-crypto-asmjs": "7.3.1", + "@polkadot/wasm-crypto-init": "7.3.1", + "@polkadot/wasm-crypto-wasm": "7.3.1", + "@polkadot/wasm-util": "7.3.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { "@polkadot/util": "*", @@ -912,31 +1032,32 @@ } }, "node_modules/@polkadot/wasm-crypto-asmjs": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-6.4.1.tgz", - "integrity": "sha512-UxZTwuBZlnODGIQdCsE2Sn/jU0O2xrNQ/TkhRFELfkZXEXTNu4lw6NpaKq7Iey4L+wKd8h4lT3VPVkMcPBLOvA==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.1.tgz", + "integrity": "sha512-pTUOCIP0nUc4tjzdG1vtEBztKEWde4DBEZm7NaxBLvwNUxsbYhLKYvuhASEyEIz0ZyE4rOBWEmRF4Buic8oO+g==", "dependencies": { - "@babel/runtime": "^7.20.6" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { "@polkadot/util": "*" } }, "node_modules/@polkadot/wasm-crypto-init": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-6.4.1.tgz", - "integrity": "sha512-1ALagSi/nfkyFaH6JDYfy/QbicVbSn99K8PV9rctDUfxc7P06R7CoqbjGQ4OMPX6w1WYVPU7B4jPHGLYBlVuMw==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.1.tgz", + "integrity": "sha512-Fx15ItLcxCe7uJCWZVXhFbsrXqHUKAp9KGYQFKBRK7r1C2va4Y7qnirjwkxoMHQcunusLe2KdbrD+YJuzh4wlA==", "dependencies": { - "@babel/runtime": "^7.20.6", - "@polkadot/wasm-bridge": "6.4.1", - "@polkadot/wasm-crypto-asmjs": "6.4.1", - "@polkadot/wasm-crypto-wasm": "6.4.1" + "@polkadot/wasm-bridge": "7.3.1", + "@polkadot/wasm-crypto-asmjs": "7.3.1", + "@polkadot/wasm-crypto-wasm": "7.3.1", + "@polkadot/wasm-util": "7.3.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { "@polkadot/util": "*", @@ -944,141 +1065,140 @@ } }, "node_modules/@polkadot/wasm-crypto-wasm": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-6.4.1.tgz", - "integrity": "sha512-3VV9ZGzh0ZY3SmkkSw+0TRXxIpiO0nB8lFwlRgcwaCihwrvLfRnH9GI8WE12mKsHVjWTEVR3ogzILJxccAUjDA==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.1.tgz", + "integrity": "sha512-hBMRwrBLCfVsFHSdnwwIxEPshoZdW/dHehYRxMSpUdmqOxtD1gnjocXGE1KZUYGX675+EFuR+Ch6OoTKFJxwTA==", "dependencies": { - "@babel/runtime": "^7.20.6", - "@polkadot/wasm-util": "6.4.1" + "@polkadot/wasm-util": "7.3.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { "@polkadot/util": "*" } }, "node_modules/@polkadot/wasm-util": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-6.4.1.tgz", - "integrity": "sha512-Uwo+WpEsDmFExWC5kTNvsVhvqXMZEKf4gUHXFn4c6Xz4lmieRT5g+1bO1KJ21pl4msuIgdV3Bksfs/oiqMFqlw==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.3.1.tgz", + "integrity": "sha512-0m6ozYwBrJgnGl6QvS37ZiGRu4FFPPEtMYEVssfo1Tz4skHJlByWaHWhRNoNCVFAKiGEBu+rfx5HAQMAhoPkvg==", "dependencies": { - "@babel/runtime": "^7.20.6" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" }, "peerDependencies": { "@polkadot/util": "*" } }, "node_modules/@polkadot/x-bigint": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-10.4.2.tgz", - "integrity": "sha512-awRiox+/XSReLzimAU94fPldowiwnnMUkQJe8AebYhNocAj6SJU00GNoj6j6tAho6yleOwrTJXZaWFBaQVJQNg==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-12.6.1.tgz", + "integrity": "sha512-YlABeVIlgYQZJ4ZpW/+akFGGxw5jMGt4g5vaP7EumlORGneJHzzWJYDmI5v2y7j1zvC9ofOle7z4tRmtN/QDew==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/x-global": "10.4.2" + "@polkadot/x-global": "12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/x-fetch": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-10.4.2.tgz", - "integrity": "sha512-Ubb64yaM4qwhogNP+4mZ3ibRghEg5UuCYRMNaCFoPgNAY8tQXuDKrHzeks3+frlmeH9YRd89o8wXLtWouwZIcw==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-12.6.1.tgz", + "integrity": "sha512-iyBv0ecfCsqGSv26CPJk9vSoKtry/Fn7x549ysA4hlc9KboraMHxOHTpcNZYC/OdgvbFZl40zIXCY0SA1ai8aw==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/x-global": "10.4.2", - "@types/node-fetch": "^2.6.2", - "node-fetch": "^3.3.0" + "@polkadot/x-global": "12.6.1", + "node-fetch": "^3.3.2", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/x-global": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-10.4.2.tgz", - "integrity": "sha512-g6GXHD/ykZvHap3M6wh19dO70Zm43l4jEhlxf5LtTo5/0/UporFCXr2YJYZqfbn9JbQwl1AU+NroYio+vtJdiA==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-12.6.1.tgz", + "integrity": "sha512-w5t19HIdBPuyu7X/AiCyH2DsKqxBF0KpF4Ymolnx8PfcSIgnq9ZOmgs74McPR6FgEmeEkr9uNKujZrsfURi1ug==", "dependencies": { - "@babel/runtime": "^7.20.13" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/x-randomvalues": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-10.4.2.tgz", - "integrity": "sha512-mf1Wbpe7pRZHO0V3V89isPLqZOy5XGX2bCqsfUWHgb1NvV1MMx5TjVjdaYyNlGTiOkAmJKlOHshcfPU2sYWpNg==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.1.tgz", + "integrity": "sha512-1uVKlfYYbgIgGV5v1Dgn960cGovenWm5pmg+aTMeUGXVYiJwRD2zOpLyC1i/tP454iA74j74pmWb8Nkn0tJZUQ==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/x-global": "10.4.2" + "@polkadot/x-global": "12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "12.6.1", + "@polkadot/wasm-util": "*" } }, "node_modules/@polkadot/x-textdecoder": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-10.4.2.tgz", - "integrity": "sha512-d3ADduOKUTU+cliz839+KCFmi23pxTlabH7qh7Vs1GZQvXOELWdqFOqakdiAjtMn68n1KVF4O14Y+OUm7gp/zA==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.1.tgz", + "integrity": "sha512-IasodJeV1f2Nr/VtA207+LXCQEqYcG8y9qB/EQcRsrEP58NbwwxM5Z2obV0lSjJOxRTJ4/OlhUwnLHwcbIp6+g==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/x-global": "10.4.2" + "@polkadot/x-global": "12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/x-textencoder": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-10.4.2.tgz", - "integrity": "sha512-mxcQuA1exnyv74Kasl5vxBq01QwckG088lYjc3KwmND6+pPrW2OWagbxFX5VFoDLDAE+UJtnUHsjdWyOTDhpQA==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.1.tgz", + "integrity": "sha512-sTq/+tXqBhGe01a1rjieSHFh3y935vuRgtahVgVJZnfqh5SmLPgSN5tTPxZWzyx7gHIfotle8laTJbJarv7V1A==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/x-global": "10.4.2" + "@polkadot/x-global": "12.6.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@polkadot/x-ws": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-10.4.2.tgz", - "integrity": "sha512-3gHSTXAWQu1EMcMVTF5QDKHhEHzKxhAArweEyDXE7VsgKUP/ixxw4hVZBrkX122iI5l5mjSiooRSnp/Zl3xqDQ==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-12.6.1.tgz", + "integrity": "sha512-fs9V+XekjJLpVLLwxnqq3llqSZu2T/b9brvld8anvzS/htDLPbi7+c5W3VGJ9Po8fS67IsU3HCt0Gu6F6mGrMA==", "dependencies": { - "@babel/runtime": "^7.20.13", - "@polkadot/x-global": "10.4.2", - "@types/websocket": "^1.0.5", - "websocket": "^1.0.34" + "@polkadot/x-global": "12.6.1", + "tslib": "^2.6.2", + "ws": "^8.14.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } }, "node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz", + "integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==", + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@substrate/connect": { - "version": "0.7.19", - "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.7.19.tgz", - "integrity": "sha512-+DDRadc466gCmDU71sHrYOt1HcI2Cbhm7zdCFjZfFVHXhC/E8tOdrVSglAH2HDEHR0x2SiHRxtxOGC7ak2Zjog==", + "version": "0.7.35", + "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.7.35.tgz", + "integrity": "sha512-Io8vkalbwaye+7yXfG1Nj52tOOoJln2bMlc7Q9Yy3vEWqZEVkgKmcPVzbwV0CWL3QD+KMPDA2Dnw/X7EdwgoLw==", + "hasInstallScript": true, "optional": true, "dependencies": { "@substrate/connect-extension-protocol": "^1.0.1", - "@substrate/smoldot-light": "0.7.9", - "eventemitter3": "^4.0.7" + "smoldot": "2.0.7" } }, "node_modules/@substrate/connect-extension-protocol": { @@ -1087,104 +1207,85 @@ "integrity": "sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg==", "optional": true }, - "node_modules/@substrate/connect/node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "optional": true - }, - "node_modules/@substrate/smoldot-light": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/@substrate/smoldot-light/-/smoldot-light-0.7.9.tgz", - "integrity": "sha512-HP8iP7sFYlpSgjjbo0lqHyU+gu9lL2hbDNce6dWk5/10mFFF9jKIFGfui4zCecUY808o/Go9pan/31kMJoLbug==", - "optional": true, - "dependencies": { - "pako": "^2.0.4", - "ws": "^8.8.1" - } - }, "node_modules/@substrate/ss58-registry": { - "version": "1.41.0", - "resolved": "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.41.0.tgz", - "integrity": "sha512-TLz5VkEaJRNFzf1Oiix9gqknKer3aKbLfjK9XHBFCIhdxlQpI+S6lZGu3wT4DHAGXPakYfXb8+9ZIOtWLcQ/2Q==" + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.44.0.tgz", + "integrity": "sha512-7lQ/7mMCzVNSEfDS4BCqnRnKCFKpcOaPrxMeGTXHX1YQzM/m2BBHjbK2C3dJvjv7GYxMiaTq/HdWQj1xS6ss+A==" }, "node_modules/@types/bn.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", - "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz", + "integrity": "sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==", "dependencies": { "@types/node": "*" } }, "node_modules/@types/node": { - "version": "20.4.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", - "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==" - }, - "node_modules/@types/node-fetch": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", - "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", - "dependencies": { - "@types/node": "*", - "form-data": "^3.0.0" - } - }, - "node_modules/@types/websocket": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.5.tgz", - "integrity": "sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ==", + "version": "20.10.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.3.tgz", + "integrity": "sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg==", "dependencies": { - "@types/node": "*" + "undici-types": "~5.26.4" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/bufferutil": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", - "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "node_modules/cbor-extract": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/cbor-extract/-/cbor-extract-2.1.1.tgz", + "integrity": "sha512-1UX977+L+zOJHsp0mWFG13GLwO6ucKgSmSW6JTl8B9GUvACvHeIVpFqhU92299Z6PfD09aTXDell5p+lp1rUFA==", "hasInstallScript": true, + "optional": true, "dependencies": { - "node-gyp-build": "^4.3.0" + "node-gyp-build-optional-packages": "5.0.3" }, - "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" + "bin": { + "download-cbor-prebuilds": "bin/download-prebuilds.js" }, - "engines": { - "node": ">= 0.8" + "optionalDependencies": { + "@cbor-extract/cbor-extract-darwin-arm64": "2.1.1", + "@cbor-extract/cbor-extract-darwin-x64": "2.1.1", + "@cbor-extract/cbor-extract-linux-arm": "2.1.1", + "@cbor-extract/cbor-extract-linux-arm64": "2.1.1", + "@cbor-extract/cbor-extract-linux-x64": "2.1.1", + "@cbor-extract/cbor-extract-win32-x64": "2.1.1" + } + }, + "node_modules/cbor-x": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/cbor-x/-/cbor-x-1.5.6.tgz", + "integrity": "sha512-+TXdnDNdr8JH5GQRoAhjdT/5s5N+b71s2Nz8DpDRyuWx0uzMj8JTR3AqqMTBO/1HtUBHZpmK1enD2ViXFx0Nug==", + "optionalDependencies": { + "cbor-extract": "^2.1.1" } }, - "node_modules/d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "dependencies": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "node_modules/data-uri-to-buffer": { "version": "4.0.1", @@ -1210,20 +1311,15 @@ } } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ed2curve": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/ed2curve/-/ed2curve-0.3.0.tgz", - "integrity": "sha512-8w2fmmq3hv9rCrcI7g9hms2pMunQr1JINfcjwR9tAyZqhtyaMN991lF/ZfHfr5tzZQ8c7y7aBgZbjfbd0fjFwQ==", - "dependencies": { - "tweetnacl": "1.x.x" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" } }, "node_modules/error-stack-parser": { @@ -1234,39 +1330,6 @@ "stackframe": "^0.3.1" } }, - "node_modules/es5-ext": { - "version": "0.10.62", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", - "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", - "hasInstallScript": true, - "dependencies": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", - "dependencies": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", - "dependencies": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, "node_modules/esbuild": { "version": "0.17.19", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", @@ -1309,19 +1372,6 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" }, - "node_modules/ext": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", - "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", - "dependencies": { - "type": "^2.7.2" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" - }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -1344,19 +1394,6 @@ "node": "^12.20 || >= 14.13" } }, - "node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -1368,6 +1405,11 @@ "node": ">=12.20.0" } }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -1394,44 +1436,59 @@ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { - "mime-db": "1.52.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">= 0.6" + "node": "*" } }, "node_modules/mock-socket": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/mock-socket/-/mock-socket-9.2.1.tgz", - "integrity": "sha512-aw9F9T9G2zpGipLLhSNh6ZpgUyUl4frcVmRN08uE1NWPWg43Wx6+sGPDbQ7E5iFZZDJW5b5bypMeAEHqTbIFag==", + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/mock-socket/-/mock-socket-9.3.1.tgz", + "integrity": "sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw==", "engines": { "node": ">= 8" } @@ -1450,19 +1507,13 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" - }, "node_modules/nock": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/nock/-/nock-13.3.1.tgz", - "integrity": "sha512-vHnopocZuI93p2ccivFyGuUfzjq2fxNyNurp7816mlT5V5HF4SzXu8lvLrVzBbNqzs+ODooZ6OksuSUNM7Njkw==", + "version": "13.4.0", + "resolved": "https://registry.npmjs.org/nock/-/nock-13.4.0.tgz", + "integrity": "sha512-W8NVHjO/LCTNA64yxAPHV/K47LpGYcVzgKd3Q0n6owhwvD0Dgoterc25R4rnZbckJEb6Loxz1f5QMuJpJnbSyQ==", "dependencies": { "debug": "^4.1.0", "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.21", "propagate": "^2.0.0" }, "engines": { @@ -1488,9 +1539,9 @@ } }, "node_modules/node-fetch": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz", - "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -1504,21 +1555,32 @@ "url": "https://opencollective.com/node-fetch" } }, - "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "node_modules/node-gyp-build-optional-packages": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.3.tgz", + "integrity": "sha512-k75jcVzk5wnnc/FMxsf4udAoTEUv2jY3ycfdSd3yWu6Cnd1oee6/CfZJApyscA4FJOmdoixWwiwOyf16RzD5JA==", + "optional": true, "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" + "node-gyp-build-optional-packages": "bin.js", + "node-gyp-build-optional-packages-optional": "optional.js", + "node-gyp-build-optional-packages-test": "build-test.js" } }, - "node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", - "optional": true + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } }, "node_modules/propagate": { "version": "2.0.1", @@ -1528,11 +1590,6 @@ "node": ">= 8" } }, - "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" - }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -1550,6 +1607,15 @@ "tslib": "^2.1.0" } }, + "node_modules/smoldot": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/smoldot/-/smoldot-2.0.7.tgz", + "integrity": "sha512-VAOBqEen6vises36/zgrmAT1GWk2qE3X8AGnO7lmQFdskbKx8EovnwS22rtPAG+Y1Rk23/S22kDJUdPANyPkBA==", + "optional": true, + "dependencies": { + "ws": "^8.8.1" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -1615,9 +1681,9 @@ } }, "node_modules/tslib": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", - "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/tsx": { "version": "3.12.7", @@ -1641,19 +1707,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, - "node_modules/type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" - }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, "node_modules/typescript-logging": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/typescript-logging/-/typescript-logging-1.0.1.tgz", @@ -1662,22 +1715,19 @@ "stacktrace-js": "1.3.1" } }, - "node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } @@ -1690,40 +1740,15 @@ "node": ">= 8" } }, - "node_modules/websocket": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", - "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", - "dependencies": { - "bufferutil": "^4.0.1", - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - "yaeti": "^0.0.6" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/websocket/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/websocket/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "optional": true, + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", "engines": { "node": ">=10.0.0" }, @@ -1739,14 +1764,6 @@ "optional": true } } - }, - "node_modules/yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", - "engines": { - "node": ">=0.10.32" - } } } } diff --git a/package.json b/package.json index a5a9240..99e554c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "stream-bench": "tsx --no-cache demo/src/stream-bench" }, "dependencies": { - "@cord.network/sdk": "^0.8.0-3" + "@cord.network/sdk": "0.9.0-1beta6", + "dotenv": "^16.3.1" }, "devDependencies": { "moment": "^2.29.1", diff --git a/res/address.json b/res/address.json new file mode 100644 index 0000000..0e020ff --- /dev/null +++ b/res/address.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Basic Address Demo", + "description": "Address Demo Schema", + "$metadata": { + "version": "1.0.0", + "discoverable": true + }, + "properties": { + "state": { + "type": "string" + }, + "country": { + "type": "string" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/res/certificate-bm.json b/res/certificate-bm.json new file mode 100644 index 0000000..b83e9dd --- /dev/null +++ b/res/certificate-bm.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Student Certificate Demo:0x92f161334b11d354485140c2d32979ff87abb7cbe87affb6945f6b05524bab8d", + "properties": { + "certificateId": { + "type":"string" + }, + "studentId": { + "type": "string" + }, + "studentName": { + "type": "string" + }, + "issuerName": { + "type": "string" + }, + "credential": { + "type": "string" + }, + "grade": { + "type": "string" + }, + "batch": { + "type": "string" + }, + "issuedOn": { + "type": "string", + "format": "date" + }, + "validUntil": { + "type": "string", + "format": "date" + } + }, + "type": "object" +} diff --git a/res/certificate.json b/res/certificate.json new file mode 100644 index 0000000..cf036b6 --- /dev/null +++ b/res/certificate.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Student Certificate Demo", + "properties": { + "certificateId": { + "type":"string" + }, + "studentId": { + "type": "string" + }, + "studentName": { + "type": "string" + }, + "issuerName": { + "type": "string" + }, + "credential": { + "type": "string" + }, + "grade": { + "type": "string" + }, + "batch": { + "type": "string" + }, + "issuedOn": { + "type": "string", + "format": "date" + }, + "validUntil": { + "type": "string", + "format": "date" + } + }, + "type": "object" +} diff --git a/res/cred.json b/res/cred.json new file mode 100644 index 0000000..61d96d0 --- /dev/null +++ b/res/cred.json @@ -0,0 +1,24 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.dway.in/credentials/3732", + "type": ["VerifiableCredential", "UniversityDegreeCredential"], + "issuer": "did:cord:3yuH8SE1rPjYyzTS8np2Zpka2KXagbkcCV6dNBU75wcvjc1p", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:cord:3yT76V5nBADwojuHcgqnUWm27RpRP7cXEUA6kFo24deFxLev", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science and Arts" + } + }, + "proof": { + "type": "Ed25519Signature2020", + "created": "2021-11-13T18:19:39Z", + "verificationMethod": "did:cord:3yuH8SE1rPjYyzTS8np2Zpka2KXagbkcCV6dNBU75wcvjc1p#0xfffff01dde2773a43c61bb28ab61b72b7656584eb1ea367b3bd8b4be55d63c41", + "proofPurpose": "assertionMethod", + "proofValue": "z58DAdFfa9SkqZMVPxAQpic7ndSayn1PzZs6ZjWp1CktyGesjuTSwRdoWhAfGFCF5bppETSTojQCrfFPP2oumHKtz" + } +} diff --git a/res/entity.json b/res/entity.json new file mode 100644 index 0000000..c1652eb --- /dev/null +++ b/res/entity.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Basic Entity Demo", + "properties": { + "name": { + "type": "string" + }, + "country": { + "type": "string" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/res/institute.json b/res/institute.json new file mode 100644 index 0000000..0cc7907 --- /dev/null +++ b/res/institute.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Institute Accrediation Demo", + "properties": { + "instituteId": { + "type": "string" + }, + "instituteName": { + "type": "string" + }, + "establishmentYear": { + "type": "string", + "format": "date" + }, + "gstnId":{ + "type": "string" + }, + "category": { + "type": "string" + }, + "cgpaGrade":{ + "type":"string" + }, + "issuerName": { + "type": "string" + }, + "issuedOn": { + "type": "string", + "format": "date" + }, + "validUntil": { + "type": "string", + "format": "date" + } + }, + "type": "object" +} + diff --git a/res/nested.json b/res/nested.json new file mode 100644 index 0000000..edd74ff --- /dev/null +++ b/res/nested.json @@ -0,0 +1,19 @@ +{ + "$id": "http://cord.network/draft-01/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nested Demo", + "description": "Nested Schema for Demo", + "$metadata": { + "version": "1.0.0", + "discoverable": true + }, + "properties": { + "Student": { + "$ref": "baseSchema.schema.$id" + }, + "Address": { + "$ref": "addressSchema.schema.$id" + } + }, + "type": "object" + } \ No newline at end of file diff --git a/res/network-rating.json b/res/network-rating.json new file mode 100644 index 0000000..3da4902 --- /dev/null +++ b/res/network-rating.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$metadata": { + "version": "1.0.0", + "slug": "ondc-network-rating-demo-schema", + "discoverable": true + }, + "title": "ONDC Network Rating Schema v1", + "description": "Test Schema", + "properties": { + "entityUid": { "type": "string" }, + "entityId": { "type": "string" }, + "providerUid": { "type": "string" }, + "providerId": { "type": "string" }, + "entityType": { + "type": "string", + "enum": ["Retail", "Logistic"] + }, + "ratingType": { + "type": "string", + "enum": ["Overall", "Delivery"] + }, + "referenceId": { "type": "string" }, + "countOfTxn": { "type": "number" }, + "totalRating": { "type": "number" } + }, + "required": ["entityUid", "entityId", "providerUid", "providerId", "entityType", "ratingType", "countOfTxn", "totalRating"], + "additionalProperties": false, + "type": "object" +} diff --git a/res/npci.json b/res/npci.json new file mode 100644 index 0000000..187d490 --- /dev/null +++ b/res/npci.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Identity Demo", + "properties": { + "type": { + "type": "string" + }, + "verifiedName": { + "type": "string" + }, + "id": { + "type": "integer" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/res/prod-lisitng.json b/res/prod-lisitng.json new file mode 100644 index 0000000..f796065 --- /dev/null +++ b/res/prod-lisitng.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Demo Product Listing", + "properties": { + "store_name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "price": { + "type": "string" + }, + "location": { + "type": "string" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/res/prod-order.json b/res/prod-order.json new file mode 100644 index 0000000..65ea003 --- /dev/null +++ b/res/prod-order.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Demo Product", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "countryOfOrigin": { + "type": "string" + }, + "gtin": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "manufacturer": { + "type": "string" + }, + "model": { + "type": "string" + }, + "sku": { + "type": "string" + }, + "price": { + "type": "string" + }, + "aggregateRating": { + "type": "string" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/res/prod-schema.json b/res/prod-schema.json new file mode 100644 index 0000000..cf860da --- /dev/null +++ b/res/prod-schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Demo Product", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "countryOfOrigin": { + "type": "string" + }, + "gtin": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "manufacturer": { + "type": "string" + }, + "model": { + "type": "string" + }, + "sku": { + "type": "string" + }, + "price": { + "type": "string" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/res/schema-properties.json b/res/schema-properties.json new file mode 100644 index 0000000..c1efe2f --- /dev/null +++ b/res/schema-properties.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Test Demo Schema v3", + "description": "Test Demo Schema", + "$metadata": { + "version": "1.0.0", + "slug": "test-demo-schema", + "discoverable": true + }, + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "country": { + "type": "string" + }, + "address": { + "type": "object", + "properties": { + "street": { "type": "string" }, + "pin": { "type": "integer" }, + "location": { + "type": "object", + "properties": { + "state": { "type": "string" }, + "country": { "type": "string" } + } + } + } + } + } +} diff --git a/res/schema.json b/res/schema.json index 3a8393a..496e6ce 100644 --- a/res/schema.json +++ b/res/schema.json @@ -1,25 +1,39 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Basic Demo", - "description": "Test Demo Schema", "$metadata": { "version": "1.0.0", + "slug": "test-demo-schema", "discoverable": true }, - "required": [ "name" ], + "title": "Test Demo Schema v3", + "description": "Test Demo Schema", "properties": { "name": { "type": "string" - }, - "age": { + }, + "age": { "type": "integer" - }, - "gender": { + }, + "id": { "type": "string" - }, - "credit": { - "type": "integer" - } + }, + "country": { + "type": "string" + }, + "address": { + "type": "object", + "properties": { + "street": { "type": "string" }, + "pin": { "type": "integer" }, + "location": { + "type": "object", + "properties": { + "state": { "type": "string" }, + "country": { "type": "string" } + } + } + } + } }, "type": "object" } diff --git a/res/space.json b/res/space.json new file mode 100644 index 0000000..39ee2c1 --- /dev/null +++ b/res/space.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Basic Space Demo", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/res/student-id.json b/res/student-id.json new file mode 100644 index 0000000..e0b0e58 --- /dev/null +++ b/res/student-id.json @@ -0,0 +1,54 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "name": "Student Identity Demo", + "properties": { + "studentId": { + "type": "string" + }, + "fullName": { + "type": "string" + }, + "gender": { + "type": "string" + }, + "dob":{ + "type": "string" + }, + "batch": { + "type": "string" + }, + "email":{ + "type":"string" + }, + "mobile": { + "type":"number" + }, + "address":{ + "type":"string" + }, + "street":{ + "type":"string" + }, + "landmark":{ + "type":"string" + }, + "district":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "pincode":{ + "type":"number" + }, + "issuerName": { + "type": "string" + }, + "validUntil": { + "type": "string", + "format": "date" + } + }, + "type": "object" +} + diff --git a/src/bench-new.ts b/src/bench-new.ts new file mode 100644 index 0000000..43f68fe --- /dev/null +++ b/src/bench-new.ts @@ -0,0 +1,125 @@ +import * as Cord from '@cord.network/sdk' +import moment from 'moment' +import Keyring from '@polkadot/keyring' +import { Crypto } from '@cord.network/utils' +import type { ICompact, INumber } from '@polkadot/types/types' +import { BN } from '@polkadot/util' + +type V1Weight = INumber + +interface V2Weight { + refTime: ICompact + proofSize: ICompact +} + +export const sleep = (ms: number): Promise => { + return new Promise((resolve) => { + setTimeout(() => resolve(), ms) + }) +} + +export function convertWeight(weight: V1Weight | V2Weight): BN { + if ((weight as V2Weight).refTime) { + // V2 or V1.5 weight + return (weight as V2Weight).refTime.toBn() + } + // V1 weight + return (weight as V1Weight).toBn() +} + +async function main() { + // Make sure that you are running the CORD locally + const networkAddress = 'ws://127.0.0.1:9944' + Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) + await Cord.connect(networkAddress) + const api = Cord.ConfigService.get('api') + // const Alice = Crypto.makeKeypairFromUri('//Alice', 'sr25519') + const txRemark = api.tx.system.remark('Hello World!') + const txCount = await Cord.Chain.getMaxBatchable(txRemark) + let tx_batches: any[][] = [] + const batchSize = 10000 + // Start the timer for creation + console.time('Extrinsic creation') + // Create all batches first + for (let i = 0; i < Math.ceil(txCount / batchSize); i++) { + const start = i * batchSize + const end = Math.min((i + 1) * batchSize, txCount) + + // Log progress for creation + const progress = ((start / txCount) * 100).toFixed(2) + console.log( + `Creation Progress: ${progress}% - Creating transactions from ${ + start + 1 + } to ${end}` + ) + + const batch: any[] = Array.from({ length: end - start }, (_, index) => { + try { + return api.tx.system.remark(`Hello World! ${start + index + 1}`) + } catch (e: any) { + console.log( + `Error on transaction ${start + index + 1}: ${e.errorCode} - ${ + e.message + }` + ) + return null + } + }).filter((tx) => tx !== null) + + tx_batches.push(batch) + } + + // End the timer for creation + console.timeEnd('Extrinsic creation') + + // Start the timer for sending + console.time('Extrinsic sending') + let keyring = new Keyring({ type: 'sr25519' }) + let BatchAuthor = keyring.addFromUri('//Charlie') + // Loop through tx_batches to send each batch + for (let i = 0; i < tx_batches.length; i++) { + const batch = tx_batches[i] + + // Log progress for sending + const progress = ((i / tx_batches.length) * 100).toFixed(2) + console.log(`Sending Progress: ${progress}% - Sending batch ${i + 1}`) + + try { + api.tx.utility.batchAll(batch).signAndSend(BatchAuthor) + } catch (e: any) { + console.log(e.errorCode, '-', e.message) + } + } + + // End the timer for sending + console.timeEnd('Extrinsic sending') + + // let batchAncEndTime = moment() + // var batchAncDuration = moment.duration( + // batchAncEndTime.diff(batchAncStartTime) + // ) + // console.log( + // `\n 🎁 Anchoring a batch of ${ + // tx_batch.length + // } extrinsics took ${batchAncDuration.as('seconds')}s` + // ) + // console.log( + // ` 🙌 Block TPS (batch) - ${+( + // txCount / batchAncDuration.as('seconds') + // ).toFixed(0)} ` + // ) + await sleep(2000) + await api.disconnect() +} + +main() + .then(() => console.log('Bye! 👋 👋 👋 \n')) + .finally(Cord.disconnect) + +process.on('SIGINT', async () => { + console.log('\nBye! 👋 👋 👋 \n') + Cord.disconnect() + process.exit(0) +}) +// async function main() { +// // Make sure that you are runni diff --git a/src/bench-v2.ts b/src/bench-v2.ts new file mode 100644 index 0000000..c58f496 --- /dev/null +++ b/src/bench-v2.ts @@ -0,0 +1,117 @@ +import * as Cord from '@cord.network/sdk' +import Keyring from '@polkadot/keyring' +import moment from 'moment' + +export const sleep = (ms: number): Promise => { + return new Promise((resolve) => { + setTimeout(() => resolve(), ms) + }) +} + +async function createBatch( + start: number, + end: number, + api: any +): Promise { + const batch: any[] = Array.from({ length: end - start }, (_, index) => { + try { + return api.tx.system.remark(`Hello World! ${start + index + 1}`) + } catch (e: any) { + console.log( + `Error on transaction ${start + index + 1}: ${e.errorCode} - ${ + e.message + }` + ) + return null + } + }).filter((tx) => tx !== null) + return batch +} + +async function sendBatch( + batch: any[], + batchAuthor: any, + index: number, + api: any +) { + try { + process.stdout.write(' 🎁 Sending Batch ' + (index + 1) + 's\r') + let nonce = await api.rpc.system.accountNextIndex(batchAuthor.address) + await api.tx.utility + .batchAll(batch) + .signAndSend(batchAuthor, { nonce: nonce.addn(index) }) + } catch (e: any) { + console.log(e.errorCode, '-', e.message) + } +} + +async function main() { + const networkAddress = 'ws://127.0.0.1:9944' + await Cord.connect(networkAddress) + const api = Cord.ConfigService.get('api') + const txRemark = api.tx.system.remark('H!') + // const txCount = await Cord.Chain.getMaxBatchable(txRemark) + const txCount = 60000 + const batchSize = 1000 + + // Start the timer for creation + console.time('Extrinsic creation') + let ancStartTime = moment() + + // const createBatchPromises = [] + const createBatchPromises: Promise[] = [] + for (let i = 0; i < Math.ceil(txCount / batchSize); i++) { + process.stdout.write( + ' 🎁 Anchoring ' + + (i + 1 * batchSize) + + ' extrinsics took ' + + moment.duration(moment().diff(ancStartTime)).as('seconds').toFixed(3) + + 's\r' + ) + const start = i * batchSize + const end = Math.min((i + 1) * batchSize, txCount) + createBatchPromises.push(createBatch(start, end, api)) + } + const tx_batches = await Promise.all(createBatchPromises) + console.timeEnd('Extrinsic creation') + + // Initialize keyring and author + let keyring = new Keyring({ type: 'sr25519' }) + let batchAuthor = keyring.addFromUri('//Charlie') + // Start the timer for sending + console.time('Extrinsic sending') + let batchAncStartTime = moment() + + const sendBatchPromises = tx_batches.map((batch, index) => + sendBatch(batch, batchAuthor, index, api) + ) + await Promise.all(sendBatchPromises) + console.timeEnd('Extrinsic sending') + let batchAncEndTime = moment() + var batchAncDuration = moment.duration( + batchAncEndTime.diff(batchAncStartTime) + ) + console.log( + `\n 🎁 Anchoring a batch of ${txCount} extrinsics took ${batchAncDuration.as( + 'seconds' + )}s` + ) + console.log( + ` 🙌 Block TPS (batch) - ${+( + txCount / batchAncDuration.as('seconds') + ).toFixed(0)} ` + ) + + await sleep(2000) + await api.disconnect() +} + +main() + .then(() => console.log('Bye! 👋 👋 👋 \n')) + .finally(Cord.disconnect) + +process.on('SIGINT', async () => { + console.log('\nBye! 👋 👋 👋 \n') + Cord.disconnect() + process.exit(0) +}) diff --git a/src/bench.ts b/src/bench.ts index 4c5a118..7b296d8 100644 --- a/src/bench.ts +++ b/src/bench.ts @@ -23,12 +23,14 @@ async function main() { console.log(`👦🏻 Bob (${Bob.type}): ${Bob.address}`) let tx_batch: any = [] let startTxPrep = moment() - let txCount = 3000 + const txCount = await Cord.Chain.getMaxBatchable( + api.tx.balances.transfer(Alice.address, 5) + ) console.log(`\n ✨ Benchmark ${txCount} transactions `) console.log( '\nTo see the transactions, Go to https://apps.cord.network -> DEVELOPMENT -> Local Node -> Switch\n' ) - let nonce: any = 0 + // let nonce: any = 0 for (let j = 0; j < txCount; j++) { process.stdout.write( ' 🔖 Extrinsic creation took ' + diff --git a/src/comp.ts b/src/comp.ts new file mode 100644 index 0000000..007436d --- /dev/null +++ b/src/comp.ts @@ -0,0 +1,559 @@ +import * as Cord from '@cord.network/sdk' +import { UUID, Crypto } from '@cord.network/utils' +import { generateKeypairs } from './utils/generateKeypairs' +import { createDid } from './utils/generateDid' +import { createDidName } from './utils/generateDidName' +import { getDidDocFromName } from './utils/queryDidName' +// import { ensureStoredSchema } from './utils/generateSchema' +// import { +// ensureStoredChainSpace, +// addSpaceAuthorization, +// approveSpace, +// } from './utils/generateChainSpace' +// import { createDocument } from './utils/createDocument' +import { createPresentation } from './utils/createPresentation' +import { createStatement } from './utils/createStatement' +import { verifyPresentation } from './utils/verifyPresentation' +import { revokeCredential } from './utils/revokeCredential' +import { randomUUID } from 'crypto' +import { decryptMessage } from './utils/decrypt_message' +import { encryptMessage } from './utils/encrypt_message' +import { generateRequestCredentialMessage } from './utils/request_credential_message' +import { getChainCredits, addAuthority } from './utils/createAuthorities' +import { createAccount } from './utils/createAccount' +import { updateDocument } from './utils/updateDocument' +import { updateStatement } from './utils/updateStatement' + +import { + requestJudgement, + setIdentity, + setRegistrar, + provideJudgement, +} from './utils/createRegistrar' +import { SignCallback } from '@cord.network/types' +// import { Permission } from '@cord.network/types' + +function getChallenge(): string { + return Cord.Utils.UUID.generate() +} + +async function main() { + const networkAddress = 'ws://127.0.0.1:9944' + Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) + await Cord.connect(networkAddress) + + // Step 1: Setup Membership + // Setup transaction author account - CORD Account. + + console.log(`\n❄️ New Network Member`) + const authorityAuthorIdentity = Crypto.makeKeypairFromUri( + '//Alice', + 'sr25519' + ) + // Setup network authority account. + const { account: authorityIdentity } = await createAccount() + console.log( + `🏦 Member (${authorityIdentity.type}): ${authorityIdentity.address}` + ) + await addAuthority(authorityAuthorIdentity, authorityIdentity.address) + await setRegistrar(authorityAuthorIdentity, authorityIdentity.address) + console.log('✅ Network Authority created!') + + // Setup network member account. + const { account: authorIdentity } = await createAccount() + console.log(`🏦 Member (${authorIdentity.type}): ${authorIdentity.address}`) + await addAuthority(authorityAuthorIdentity, authorIdentity.address) + console.log(`🔏 Member permissions updated`) + await setIdentity(authorIdentity) + console.log(`🔏 Member identity info updated`) + await requestJudgement(authorIdentity, authorityIdentity.address) + console.log(`🔏 Member identity judgement requested`) + await provideJudgement(authorityIdentity, authorIdentity.address) + console.log(`🔏 Member identity judgement provided`) + console.log('✅ Network Member added!') + + // Step 2: Setup Identities + console.log(`\n❄️ Demo Identities (KeyRing)`) + + /* Creating the DIDs for the different parties involved in the demo. */ + // Create Verifier DID + const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid( + authorIdentity + ) + const verifierKeys = generateKeypairs(verifierMnemonic) + console.log( + `🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}` + ) + // Create Holder DID + const { mnemonic: holderMnemonic, document: holderDid } = await createDid( + authorIdentity + ) + const holderKeys = generateKeypairs(holderMnemonic) + console.log( + `👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}` + ) + // Create issuer DID + const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid( + authorIdentity + ) + const issuerKeys = generateKeypairs(issuerMnemonic) + console.log( + `🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}` + ) + const conformingDidDocument = Cord.Did.exportToDidDocument( + issuerDid, + 'application/json' + ) + // console.dir(conformingDidDocument, { + // depth: null, + // colors: true, + // }) + // Create Delegate One DID + const { mnemonic: delegateOneMnemonic, document: delegateOneDid } = + await createDid(authorIdentity) + const delegateOneKeys = generateKeypairs(delegateOneMnemonic) + console.log( + `🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${ + delegateOneDid.uri + }` + ) + // Create Delegate Two DID + const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } = + await createDid(authorIdentity) + const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic) + console.log( + `🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${ + delegateTwoDid.uri + }` + ) + // Create Delegate 3 DID + const { mnemonic: delegate3Mnemonic, document: delegate3Did } = + await createDid(authorIdentity) + const delegate3Keys = generateKeypairs(delegate3Mnemonic) + console.log( + `🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${ + delegate3Did.uri + }` + ) + console.log('✅ Identities created!') + + // Step 2: Create a DID name for Issuer + console.log(`\n❄️ DID name Creation `) + const randomDidName = `solar.sailer.${randomUUID().substring(0, 4)}@cord` + + await createDidName( + issuerDid.uri, + authorIdentity, + randomDidName, + async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }) + ) + console.log(`✅ DID name - ${randomDidName} - created!`) + await getDidDocFromName(randomDidName) + + // Step 3: Create a new Chain Space + console.log(`\n❄️ Chain Space Creation `) + const spaceProperties = await Cord.ChainSpace.buildFromProperties( + issuerDid.uri + ) + console.dir(spaceProperties, { + depth: null, + colors: true, + }) + + console.log(`\n❄️ Chain Space Properties `) + const space = await Cord.ChainSpace.dispatchToChain( + spaceProperties, + issuerDid.uri, + authorIdentity, + async ({ data }) => ({ + signature: issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, + }) + ) + console.dir(space, { + depth: null, + colors: true, + }) + console.log('✅ Chain Space created!') + + console.log(`\n❄️ Chain Space Approval `) + await Cord.ChainSpace.sudoApproveChainSpace( + authorityAuthorIdentity, + space.uri, + 100 + ) + console.log(`✅ Chain Space Approved`) + + // Step 4: Add Delelegate Two as Registry Delegate + console.log(`\n❄️ Space Delegate Authorization `) + const permission: Cord.PermissionType = Cord.Permission.ASSERT + const spaceAuthProperties = + await Cord.ChainSpace.buildFromAuthorizationProperties( + space.uri, + delegateTwoDid.uri, + permission, + issuerDid.uri + ) + console.dir(spaceAuthProperties, { + depth: null, + colors: true, + }) + console.log(`\n❄️ Space Delegation To Chain `) + const delegateAuth = await Cord.ChainSpace.dispatchDelegateAuthorization( + spaceAuthProperties, + authorIdentity, + space.authorization, + async ({ data }) => ({ + signature: issuerKeys.capabilityDelegation.sign(data), + keyType: issuerKeys.capabilityDelegation.type, + }) + ) + console.dir(delegateAuth, { + depth: null, + colors: true, + }) + console.log(`✅ Space Authorization - ${delegateAuth} - added!`) + + console.log(`\n❄️ Query From Chain - Chain Space Details `) + const spaceFromChain = await Cord.ChainSpace.fetchFromChain(space.uri) + console.dir(spaceFromChain, { + depth: null, + colors: true, + }) + + console.log(`\n❄️ Query From Chain - Chain Space Authorization Details `) + const spaceAuthFromChain = await Cord.ChainSpace.fetchAuthorizationFromChain( + delegateAuth as Cord.AuthorizationUri + ) + console.dir(spaceAuthFromChain, { + depth: null, + colors: true, + }) + console.log(`✅ Chain Space Functions Completed!`) + + // Step 5: Create a new Schema + console.log(`\n❄️ Schema Creation `) + let newSchemaContent = require('../res/schema.json') + let newSchemaName = newSchemaContent.title + ':' + UUID.generate() + newSchemaContent.title = newSchemaName + + let schemaProperties = Cord.Schema.buildFromProperties( + newSchemaContent, + space.uri, + issuerDid.uri + ) + console.dir(schemaProperties, { + depth: null, + colors: true, + }) + const schemaId = await Cord.Schema.dispatchToChain( + schemaProperties.schema, + issuerDid.uri, + authorIdentity, + space.authorization, + async ({ data }) => ({ + signature: issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, + }) + ) + console.log(`✅ Schema - ${schemaId} - added!`) + + console.log(`\n❄️ Query From Chain - Schema `) + const schemaFromChain = await Cord.Schema.fetchFromChain( + schemaProperties.schema.$id + ) + console.dir(schemaFromChain, { + depth: null, + colors: true, + }) + console.log('✅ Schema Functions Completed!') + + // Step 4: Delegate creates a new Verifiable Document + console.log(`\n❄️ Verifiable Document Creation `) + + const content: Cord.IContent = Cord.Content.buildFromContentProperties( + schemaProperties.schema, + ['VerifiableDocument', 'TestCredential'], + { + name: 'Alice', + age: 29, + id: '123456789987654321', + country: 'India', + address: { + street: 'Gandhinagar 2nd', + pin: 54032, + location: { + state: 'Karnataka', + country: 'India', + }, + }, + }, + holderDid.uri, + delegateTwoDid.uri + ) + console.dir(content, { + depth: null, + colors: true, + }) + + console.log(space.uri) + const chainSpaceUri = space.uri + // Can also me called like this + // const docSignCallback = async ({ data }) => { + // return { + // signature: delegateTwoKeys.assertionMethod.sign(data), + // keyType: delegateTwoKeys.assertionMethod.type, + // keyUri: `${delegateTwoDid.uri}${delegateTwoDid?.assertionMethod![0].id}`, + // } + // } + + // const document = await Cord.Document.buildFromContentProperties({ + // content: content, + // spaceUri: chainSpaceUri, + // signCallback: docSignCallback, + // options: {}, + // }) + + const document = await Cord.Document.buildFromContentProperties({ + content: content, + spaceUri: chainSpaceUri, + signCallback: async ({ data }) => ({ + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + keyUri: `${delegateTwoDid.uri}${delegateTwoDid?.assertionMethod![0].id}`, + }), + options: {}, + }) + console.dir(document, { + depth: null, + colors: true, + }) + + const statementEntry = Cord.Statement.buildFromDocumentProperties( + document, + issuerDid.uri + ) + console.dir(statementEntry, { + depth: null, + colors: true, + }) + + console.log(issuerDid.uri, authorIdentity, space.authorization) + + const statement = await Cord.Statement.dispatchRegisterToChain( + statementEntry.statementDetails, + issuerDid.uri, + authorIdentity, + space.authorization, + async ({ data }) => ({ + signature: issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, + }) + ) + + console.log(`✅ Statement element registered - ${statement}`) + + // Step 5: Delegate updates the Verifiable Document + console.log(`\n❄️ Verifiable Document Update `) + let documentContent = Cord.Document.prepareDocumentForUpdate( + statementEntry.document + ) + + console.dir(documentContent, { + depth: null, + colors: true, + }) + // const contents = documentContent.content.contents as Cord.IContents + documentContent.content.contents.name = 'Alice M' + documentContent.content.contents.age = 32 + documentContent.content.contents.address.pin = 560100 + + const updatedDocumentEntry = await Cord.Document.updateFromDocumentProperties( + { + document: documentContent, + updater: delegateTwoDid.uri, + signCallback: async ({ data }) => ({ + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + keyUri: `${delegateTwoDid.uri}${ + delegateTwoDid?.assertionMethod![0].id + }`, + }), + options: {}, + } + ) + console.dir(updatedDocumentEntry, { + depth: null, + colors: true, + }) + + const updatedStatementEntry = Cord.Statement.buildFromUpdateProperties( + updatedDocumentEntry, + delegateTwoDid.uri + ) + console.dir(updatedStatementEntry, { + depth: null, + colors: true, + }) + + const updatedStatement = await Cord.Statement.dispatchUpdateToChain( + updatedStatementEntry.statementDetails, + delegateTwoDid.uri, + authorIdentity, + delegateAuth as Cord.AuthorizationUri, + async ({ data }) => ({ + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + }) + ) + + console.log(`✅ Statement element registered - ${updatedStatement}`) + + // const stmtUri = Cord.Identifier.elementUriToStatementUri( + // updatedStatemen.elementUri + // ) + // await Cord.Statement.dispatchRevokeToChain( + // updatedStatementEntry, + // delegateTwoDid.uri, + // authorIdentity, + // delegateAuth, + // async ({ data }) => ({ + // signature: delegateTwoKeys.assertionMethod.sign(data), + // keyType: delegateTwoKeys.assertionMethod.type, + // }) + // ) + + console.log(`✅ Statement element registered - ${updatedStatement}`) + + // const updatedDocument = await Cord.Document.updateFromDocumentProperties( + // documentContent, + // async ({ data }) => ({ + // signature: delegateTwoKeys.assertionMethod.sign(data), + // keyType: delegateTwoKeys.assertionMethod.type, + // keyUri: `${delegateTwoDid.uri}${delegateTwoDid?.assertionMethod![0].id}`, + // }) + // options: {}, + // ) + + // const updatedDocument = await updateDocument( + // updateDocumentContent, + // schema, + // async ({ data }) => ({ + // signature: delegateTwoKeys.assertionMethod.sign(data), + // keyType: delegateTwoKeys.assertionMethod.type, + // keyUri: `${delegateTwoDid.uri}${delegateTwoDid?.assertionMethod![0].id}`, + // }) + // ) + // console.dir(updatedDocument, { + // depth: null, + // colors: true, + // }) + // await updateStatement( + // updatedDocument, + // delegateTwoDid.uri, + // delegateAuth['authorization'], + // authorIdentity, + // async ({ data }) => ({ + // signature: delegateTwoKeys.assertionMethod.sign(data), + // keyType: delegateTwoKeys.assertionMethod.type, + // }) + // ) + // console.log(`✅ Statement updated - ${updatedDocument.identifier}`) + + // // Step 6: Create a Presentation + // console.log(`\n❄️ Selective Disclosure Presentation Creation `) + // const challenge = getChallenge() + // const presentation = await createPresentation({ + // document: updatedDocument, + // signCallback: async ({ data }) => ({ + // signature: holderKeys.authentication.sign(data), + // keyType: holderKeys.authentication.type, + // keyUri: `${holderDid.uri}${holderDid.authentication[0].id}`, + // }), + // // Comment the below line to have a full disclosure + // selectedAttributes: ['name', 'id', 'address.pin', 'address.location'], + // challenge: challenge, + // }) + + // console.dir(presentation, { + // depth: null, + // colors: true, + // }) + // console.log('✅ Presentation created!') + + // // Step 7: The verifier checks the presentation. + // console.log(`\n❄️ Presentation Verification - ${presentation.identifier} `) + // const verificationResult = await verifyPresentation(presentation, { + // challenge: challenge, + // trustedIssuerUris: [delegateTwoDid.uri], + // }) + + // if (verificationResult.isValid) { + // console.log('✅ Verification successful! 🎉') + // } else { + // console.log(`🚫 Verification failed! - "${verificationResult.message}" 🚫`) + // } + + // // Uncomment the following section to enable messaging demo + // // + // // console.log(`\n❄️ Messaging `) + // // const schemaId = Cord.Schema.idToChain(schema.$id) + // // console.log(' Generating the message - Sender -> Receiver') + // // const message = await generateRequestCredentialMessage( + // // holderDid.uri, + // // verifierDid.uri, + // // schemaId + // // ) + // // + // // console.log(' Encrypting the message - Sender -> Receiver') + // // const encryptedMessage = await encryptMessage( + // // message, + // // holderDid.uri, + // // verifierDid.uri, + // // holderKeys.keyAgreement + // // ) + // // + // // console.log(' Decrypting the message - Receiver') + // // await decryptMessage(encryptedMessage, verifierKeys.keyAgreement) + + // // Step 8: Revoke a Credential + // console.log(`\n❄️ Revoke credential - ${updatedDocument.identifier}`) + // await revokeCredential( + // delegateTwoDid.uri, + // authorIdentity, + // async ({ data }) => ({ + // signature: delegateTwoKeys.assertionMethod.sign(data), + // keyType: delegateTwoKeys.assertionMethod.type, + // }), + // updatedDocument, + // delegateAuth['authorization'] + // ) + // console.log(`✅ Credential revoked!`) + + // // Step 9: The verifier checks the presentation. + // console.log(`\n❄️ Presentation Verification - ${presentation.identifier} `) + // let reVerificationResult = await verifyPresentation(presentation, { + // challenge: challenge, + // trustedIssuerUris: [issuerDid.uri], + // }) + + // if (reVerificationResult.isValid) { + // console.log('✅ Verification successful! 🎉') + // } else { + // console.log( + // `🚫 Verification failed! - "${reVerificationResult.message}" 🚫` + // ) + // } +} +main() + .then(() => console.log('\nBye! 👋 👋 👋 ')) + .finally(Cord.disconnect) + +process.on('SIGINT', async () => { + console.log('\nBye! 👋 👋 👋 \n') + Cord.disconnect() + process.exit(0) +}) diff --git a/src/create-custom-schema.ts b/src/create-custom-schema.ts deleted file mode 100644 index a0b0c22..0000000 --- a/src/create-custom-schema.ts +++ /dev/null @@ -1,54 +0,0 @@ -import * as Cord from '@cord.network/sdk' -import { Crypto } from '@cord.network/utils' -import { createDid } from './utils/generateDid' -import { generateKeypairs } from './utils/generateKeypairs' -import storedData from './stored.json' -export async function createCustomSchema( - schemaTitle: string, - fieldsAsJsonObject: object -): Promise { - const networkAddress = 'wss://sparknet.cord.network' - Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) - await Cord.connect(networkAddress) - const api = Cord.ConfigService.get('api') - const Alice = Crypto.makeKeypairFromUri('//Sparknet//1//Demo', 'sr25519') - // const { mnemonic: aliceMnemonic, document: aliceDid } = await createDid(Alice) - const aliceKeys = await generateKeypairs(storedData.aliceMnemonic) - // console.log(aliceMnemonic,aliceDid) - const schema = Cord.Schema.fromProperties( - schemaTitle, - fieldsAsJsonObject, - storedData.aliceDidUri - ) - try { - await Cord.Schema.verifyStored(schema) - console.log('Schema already present\n') - console.log('Schema: \n', schema) - Cord.disconnect() - return schema - } catch { - console.log('Schema not present. Creating it now...') - // Authorize the tx. - const encodedSchema = Cord.Schema.toChain(schema) - const tx = api.tx.schema.create(encodedSchema) - const extrinsic = await Cord.Did.authorizeTx( - storedData.aliceDidUri, - tx, - async ({ data }) => ({ - signature: aliceKeys.assertionMethod.sign(data), - keyType: aliceKeys.assertionMethod.type, - }), - Alice.address - ) - // Write to chain then return the Schema. - await Cord.Chain.signAndSubmitTx(extrinsic, Alice) - Cord.disconnect() - console.log('Schema: \n', schema) - return schema - } -} - -createCustomSchema('Test', { - name: { type: 'string' }, - cordAddress: { type: 'string' }, -}) diff --git a/src/demo-messaging.ts b/src/demo-messaging.ts index 8366fbe..2603a88 100644 --- a/src/demo-messaging.ts +++ b/src/demo-messaging.ts @@ -12,7 +12,7 @@ import { } from './utils/generateRegistry' import { createDocument } from './utils/createDocument' import { createPresentation } from './utils/createPresentation' -import { createStream } from './utils/createStream' +import { createStatement } from './utils/createStatement' import { randomUUID } from 'crypto' import { getChainCredits, addAuthority } from './utils/createAuthorities' import { createAccount } from './utils/createAccount' @@ -207,7 +207,7 @@ async function main() { depth: null, colors: true, }) - await createStream( + await createStatement( delegateTwoDid.uri, authorIdentity, async ({ data }) => ({ diff --git a/src/demo-meta.ts b/src/demo-meta.ts index fdf6601..8f4a635 100644 --- a/src/demo-meta.ts +++ b/src/demo-meta.ts @@ -3,7 +3,6 @@ import { UUID, Crypto, SDKErrors } from '@cord.network/utils' async function main() { await Cord.init({ address: 'ws://127.0.0.1:9944' }) - //await Cord.init({ address: 'wss://staging.cord.network' }) // Step 1: Setup Org Identity console.log(`\n❄️ Demo Identities (KeyRing)`) @@ -144,8 +143,8 @@ async function main() { console.log(e.errorCode, '-', e.message) } - // Step 6: Create a new Stream - console.log(`\n❄️ Stream Creation `) + // Step 6: Create a new Statement + console.log(`\n❄️ Statement Creation `) console.log(`🔗 ${newSpace.identifier} `) console.log(`🔗 ${newSchema.identifier} `) @@ -156,61 +155,61 @@ async function main() { country: 'India', credit: 1000, } - let schemaStream = Cord.Content.fromSchemaAndContent( + let schemaStatement = Cord.Content.fromSchemaAndContent( newSchema, content, employeeIdentity.address, holderIdentity.address ) - console.dir(schemaStream, { depth: null, colors: true }) + console.dir(schemaStatement, { depth: null, colors: true }) - let newStreamContent = Cord.ContentStream.fromContent( - schemaStream, + let newStatementContent = Cord.ContentStatement.fromContent( + schemaStatement, employeeIdentity, { space: newSpace.identifier } ) - console.dir(newStreamContent, { depth: null, colors: true }) + console.dir(newStatementContent, { depth: null, colors: true }) - let newStream = Cord.Stream.fromContentStream(newStreamContent) + let newStatement = Cord.Statement.fromContentStatement(newStatementContent) - let streamCreationExtrinsic = await Cord.Stream.create(newStream) - console.dir(newStream, { depth: null, colors: true }) + let statementCreationExtrinsic = await Cord.Statement.create(newStatement) + console.dir(newStatement, { depth: null, colors: true }) try { - await Cord.Chain.signAndSubmitTx(streamCreationExtrinsic, entityIdentity, { + await Cord.Chain.signAndSubmitTx(statementCreationExtrinsic, entityIdentity, { resolveOn: Cord.Chain.IS_IN_BLOCK, rejectOn: Cord.Chain.IS_ERROR, }) - console.log('✅ Stream created!') + console.log('✅ Statement created!') } catch (e: any) { console.log(e.errorCode, '-', e.message) } - // Step 7: Add Stream Metadata - console.log(`\n❄️ Stream Metadata addition `) - console.log(`🔗 ${newStreamContent.identifier}`) + // Step 7: Add Statement Metadata + console.log(`\n❄️ Statement Metadata addition `) + console.log(`🔗 ${newStatementContent.identifier}`) - let streamMeta = Cord.Meta.fromMetaProperties( - newStreamContent.identifier, - JSON.stringify(newStreamContent), + let statementMeta = Cord.Meta.fromMetaProperties( + newStatementContent.identifier, + JSON.stringify(newStatementContent), employeeIdentity ) - let streamMetaCreationExtrinsic = await Cord.Meta.setMetadata(streamMeta) - console.dir(streamMeta, { + let statementMetaCreationExtrinsic = await Cord.Meta.setMetadata(statementMeta) + console.dir(statementMeta, { depth: null, colors: true, }) try { await Cord.Chain.signAndSubmitTx( - streamMetaCreationExtrinsic, + statementMetaCreationExtrinsic, entityIdentity, { resolveOn: Cord.Chain.IS_IN_BLOCK, rejectOn: Cord.Chain.IS_ERROR, } ) - console.log('✅ Stream metadata added!') + console.log('✅ Statement metadata added!') } catch (e: any) { console.log(e.errorCode, '-', e.message) } @@ -234,13 +233,13 @@ async function main() { console.dir(spaceMetaData, { depth: null, colors: true }) } - console.log(`\n❄️ Stream Metadata `) - console.log(`🔗 ${newStreamContent.identifier}`) - const streamMetaData = await Cord.Meta.query(newStreamContent.identifier) - if (!streamMetaData) { + console.log(`\n❄️ Statement Metadata `) + console.log(`🔗 ${newStatementContent.identifier}`) + const statementMetaData = await Cord.Meta.query(newStatementContent.identifier) + if (!statementMetaData) { console.log(`Space metadata not anchored on CORD`) } else { - console.dir(streamMetaData, { depth: null, colors: true }) + console.dir(statementMetaData, { depth: null, colors: true }) } // Step 9: Clear Space metadata diff --git a/src/demo-score-batch.ts b/src/demo-score-batch.ts index 7c20f37..175bbff 100644 --- a/src/demo-score-batch.ts +++ b/src/demo-score-batch.ts @@ -16,13 +16,8 @@ function getRandomFloat(min: number, max: number, decimals: number) { return parseFloat(str) } async function main() { - // localhost - // await Cord.init({ address: 'ws://127.0.0.1:9944' }) - // const wsProvider = new WsProvider('ws://127.0.0.1:9944') - //staging - await Cord.init({ address: "wss://staging.cord.network" }); - const wsProvider = new WsProvider('wss://staging.cord.network') - + await Cord.init({ address: 'ws://127.0.0.1:9944' }) + const wsProvider = new WsProvider('ws://127.0.0.1:9944') const api = await ApiPromise.create({ provider: wsProvider }) // Step 1: Setup Identities @@ -58,7 +53,7 @@ async function main() { console.log( `🏢 Pool Author (${poolTransactionAuthor.signingKeyType}): ${poolTransactionAuthor.address}` ) - let keyring = new Keyring({ type: 'sr25519', ss58Format: 29 }) + let keyring = new Keyring({ type: 'sr25519' }) let batchTransactionAuthor = keyring.addFromUri('//Charlie') console.log( `🏢 Batch Author (${keyring.type}): ${batchTransactionAuthor.address}` @@ -80,7 +75,7 @@ async function main() { collector: collectorIdentity.address, requestor: requestorIdentity.address, scoreType: ScoreType.overall, - score: getRandomFloat(1.5, 4.5, 1), + score: getRandomFloat(1.5, 4.5, 2), } let newOverallPoolJournalEntry = Cord.Score.fromJournalProperties( @@ -104,7 +99,7 @@ async function main() { collector: collectorIdentity.address, requestor: requestorIdentity.address, scoreType: ScoreType.delivery, - score: getRandomFloat(0.5, 3.5, 1), + score: getRandomFloat(0.5, 3.5, 2), } let newDeliveryPoolJournalEntry = Cord.Score.fromJournalProperties( deliveryPoolEntryContent, @@ -153,7 +148,7 @@ async function main() { collector: collectorIdentity.address, requestor: requestorIdentity.address, scoreType: ScoreType.overall, - score: getRandomFloat(1.5, 4.5, 1), + score: getRandomFloat(1.5, 4.5, 2), } let newOverallJournalEntry = Cord.Score.fromJournalProperties( @@ -175,7 +170,7 @@ async function main() { collector: collectorIdentity.address, requestor: requestorIdentity.address, scoreType: ScoreType.delivery, - score: getRandomFloat(0.5, 3.5, 1), + score: getRandomFloat(0.5, 3.5, 2), } let newDeliveryJournalEntry = Cord.Score.fromJournalProperties( deliveryEntryContent, diff --git a/src/demo-score.ts b/src/demo-score.ts index 22df475..0615af5 100644 --- a/src/demo-score.ts +++ b/src/demo-score.ts @@ -1,111 +1,254 @@ -import * as Cord from "@cord.network/sdk"; -import { ScoreType } from "@cord.network/types"; -import { UUID } from "@cord.network/utils"; +import * as Cord from '@cord.network/sdk' +import { UUID, Crypto } from '@cord.network/utils' +import { generateKeypairs } from './utils/generateKeypairs' +import { createDid } from './utils/generateDid' +import { addRegistryAdminDelegate } from './utils/generateRegistry' +import { randomUUID } from 'crypto' +import { addAuthority } from './utils/createAuthorities' +import { createAccount } from './utils/createAccount' +import { RatingEntry, IJournalContent, RatingType } from '@cord.network/types' -function getRandomFloat(min: number, max: number, decimals: number) { - const str = (Math.random() * (max - min) + min).toFixed(decimals) +async function main() { + const networkAddress = 'ws://127.0.0.1:9944' + Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) + await Cord.connect(networkAddress) - return parseFloat(str) -} + const api = Cord.ConfigService.get('api') -async function main() { - // await Cord.init({ address: "ws://127.0.0.1:9944" }); - await Cord.init({ address: "wss://staging.cord.network" }); - - // Step 1: Setup Org Identity - console.log(`\n❄️ Demo Identities (KeyRing)`); - //3x4DHc1rxVAEqKWSx1DAAA8wZxLB4VhiRbMV997niBckUwSi - const sellerIdentity = Cord.Identity.buildFromURI("//Entity", { - signingKeyPairType: "ed25519", - }); + console.log(`\n❄️ New Member\n`) + const authorityAuthorIdentity = Crypto.makeKeypairFromUri( + '//Alice', + 'sr25519' + ) + // Setup author authority account. + const { account: authorIdentity } = await createAccount() + console.log(`🏦 Member (${authorIdentity.type}): ${authorIdentity.address}`) + await addAuthority(authorityAuthorIdentity, authorIdentity.address) + console.log(`🔏 Member permissions updated`) + console.log('✅ Network Member added!') + + // Step 2: Setup Identities + console.log(`\n❄️ Demo Identities (KeyRing)\n`) + const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid( + authorIdentity + ) + const issuerKeys = generateKeypairs(issuerMnemonic) + console.log( + `🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}` + ) + + // Create Delegate One DID + const { mnemonic: delegateOneMnemonic, document: delegateOneDid } = + await createDid(authorIdentity) + + const delegateOneKeys = generateKeypairs(delegateOneMnemonic) + + console.log( + `🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${ + delegateOneDid.uri + }` + ) + + console.log('✅ Identities created!') + + // Seller Entities + console.log(`\n❄️ Demo Seller Entities\n`) + const sellerIdentity1 = Crypto.makeKeypairFromUri('//Entity1', 'sr25519') console.log( - `🏛 Seller Entity (${sellerIdentity.signingKeyType}): ${sellerIdentity.address}` - ); - const deliveryIdentity = Cord.Identity.buildFromURI("//Delivery", { - signingKeyPairType: "ed25519", - }); + `🏛 Seller Entity 1 (${sellerIdentity1.type}): ${sellerIdentity1.address}` + ) + + const sellerIdentity2 = Crypto.makeKeypairFromUri('//Entity2', 'sr25519') console.log( - `🏛 Delivery Entity (${deliveryIdentity.signingKeyType}): ${deliveryIdentity.address}` - ); - const collectorIdentity = Cord.Identity.buildFromURI("//BuyerApp", { - signingKeyPairType: "ed25519", - }); + `🏛 Seller Entity 2 (${sellerIdentity2.type}): ${sellerIdentity2.address}` + ) + + const sellerIdentity3 = Crypto.makeKeypairFromUri('//Entity3', 'sr25519') console.log( - `🧑🏻‍💼 Score Collector (${collectorIdentity.signingKeyType}): ${collectorIdentity.address}` - ); - const requestorIdentity = Cord.Identity.buildFromURI("//SellerApp", { - signingKeyPairType: "ed25519", - }); + `🏛 Seller Entity 3 (${sellerIdentity3.type}): ${sellerIdentity3.address}` + ) + + const sellerIdentity4 = Crypto.makeKeypairFromUri('//Entity4', 'sr25519') console.log( - `👩‍⚕️ Score Requestor (${requestorIdentity.signingKeyType}): ${requestorIdentity.address}` - ); - const transactionAuthor = Cord.Identity.buildFromURI("//Bob", { - signingKeyPairType: "ed25519", - }); + `🏛 Seller Entity 4 (${sellerIdentity4.type}): ${sellerIdentity4.address}` + ) + + console.log(`\n❄️ Demo Collector Entity\n`) + const collectorIdentity = Crypto.makeKeypairFromUri('//BuyerApp', 'sr25519') console.log( - `🏢 Transaction Author (${transactionAuthor.signingKeyType}): ${transactionAuthor.address}` - ); - console.log("✅ Identities created!"); - - // Step 2: Create a jounal entry - console.log(`\n❄️ Journal Entry `); - let journalContent = { - entity: sellerIdentity.address, - uid: UUID.generate().toString(), - tid: UUID.generate().toString(), - collector: collectorIdentity.address, - requestor: requestorIdentity.address, - scoreType: ScoreType.overall, - score: getRandomFloat(2.8, 4.7, 1), - }; - console.dir(journalContent, { depth: null, colors: true }); + `🧑🏻‍💼 Score Collector (${collectorIdentity.type}): ${collectorIdentity.address}` + ) - let newJournalEntry = Cord.Score.fromJournalProperties( - journalContent, - sellerIdentity - ); + console.log('\n✅ Entities created!') - let journalCreationExtrinsic = await Cord.Score.entries(newJournalEntry); - console.log(`\n❄️ Transformed Journal Entry `); - console.dir(newJournalEntry, { depth: null, colors: true }); + console.log(`\n❄️ Registry Creation \n`) + const registryTitle = `Registry v3.${randomUUID().substring(0, 4)}` + const registryDetails: Cord.IContents = { + title: registryTitle, + description: 'Registry for for scoring', + } + + const registryType: Cord.IRegistryType = { + details: registryDetails, + creator: issuerDid.uri, + } + + const txRegistry: Cord.IRegistry = + Cord.Registry.fromRegistryProperties(registryType) + + let registry try { - await Cord.Chain.signAndSubmitTx( - journalCreationExtrinsic, - transactionAuthor, - { - resolveOn: Cord.Chain.IS_IN_BLOCK, - rejectOn: Cord.Chain.IS_ERROR, - } - ); - console.log("✅ Journal Entry added!"); - } catch (e: any) { - console.log(e.errorCode, "-", e.message); + await Cord.Registry.verifyStored(txRegistry) + console.log('Registry already stored. Skipping creation') + } catch { + console.log('Regisrty not present. Creating it now...') + // Authorize the tx. + const tx = api.tx.registry.create(txRegistry.details, null) + const extrinsic = await Cord.Did.authorizeTx( + issuerDid.uri, + tx, + async ({ data }) => ({ + signature: issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, + }), + authorIdentity.address + ) + console.log('\n', txRegistry) + // Write to chain then return the Schema. + await Cord.Chain.signAndSubmitTx(extrinsic, authorIdentity) + registry = txRegistry + } + console.log('\n✅ Registry created!') + + // Step 4: Add Delelegate One as Registry Admin + console.log(`\n❄️ Registry Admin Delegate Authorization \n`) + const registryAuthority = await addRegistryAdminDelegate( + authorIdentity, + issuerDid.uri, + registry['identifier'], + delegateOneDid.uri, + async ({ data }) => ({ + signature: issuerKeys.capabilityDelegation.sign(data), + keyType: issuerKeys.capabilityDelegation.type, + }) + ) + console.log(`\n✅ Registry Authorization - ${registryAuthority} - created!`) + + console.log(`\n❄️ Journal Entries \n`) + + let journalEntryArray: Array = [] + let journalContent_1: IJournalContent = { + collector: collectorIdentity.address, + entity: sellerIdentity1.address, + tid: UUID.generatev4().toString(), + entry_type: RatingEntry.credit, + count: 5, + rating: 12.116, + rating_type: RatingType.overall, + } + journalEntryArray.push(journalContent_1) + + let journalContent_2: IJournalContent = { + collector: collectorIdentity.address, + entity: sellerIdentity2.address, + tid: UUID.generatev4().toString(), + entry_type: RatingEntry.debit, + count: 15, + rating: 60, + rating_type: RatingType.overall, + } + journalEntryArray.push(journalContent_2) + + let journalContent_3: IJournalContent = { + collector: collectorIdentity.address, + entity: sellerIdentity3.address, + tid: UUID.generatev4().toString(), + entry_type: RatingEntry.credit, + count: 46, + rating: 144.8, + rating_type: RatingType.delivery, + } + journalEntryArray.push(journalContent_3) + + let journalContent_4: IJournalContent = { + collector: collectorIdentity.address, + entity: sellerIdentity4.address, + tid: UUID.generatev4().toString(), + entry_type: RatingEntry.debit, + count: 96, + rating: 117, + rating_type: RatingType.delivery, } + journalEntryArray.push(journalContent_4) + + console.dir(journalEntryArray, { depth: null, colors: true }) + console.log('\n✅ Journal Entry Array created!\n') - console.log(`\n❄️ Query Chain Scores `); - const chainScore = await Cord.Score.query( - journalContent.entity, - journalContent.scoreType - ); - if (chainScore) { - console.dir(chainScore, { depth: null, colors: true }); - const chainAvgScore = await Cord.Score.queryAverage( - journalContent.entity, - journalContent.scoreType - ); - console.dir(chainAvgScore, { depth: null, colors: true }); - } else { - console.log(`❌`, `Rating Information Not Found - `, journalContent.entity); + console.log('♺ BAP Transforms the journal entries to required format\n') + let transformedJournalEntryArray: Array = [] + for (let i: number = 0; i < journalEntryArray.length; i++) { + transformedJournalEntryArray.push( + Cord.Score.transformRatingEntry(journalEntryArray[i]) + ) + } + + console.log( + '✍🏻 BAP signs the journal entry array as a packet and sends it to API\n' + ) + const signature = Crypto.sign( + JSON.stringify(transformedJournalEntryArray), + delegateOneKeys.assertionMethod + ) + + console.log('\n👨🏻‍⚖️ API verfies the packet\n') + Crypto.verify( + JSON.stringify(transformedJournalEntryArray), + signature, + delegateOneKeys.assertionMethod.publicKey + ) + console.log('\n✅ Packet verified!\n') + + console.log( + '☎️ API utilizses the verified transformedJournalEntryArray \n to preparing rating input and anchors it to the chain' + ) + + for (let j: number = 0; j < transformedJournalEntryArray.length; j++) { + try { + let outputFromScore = await Cord.Score.fromRatingEntry( + transformedJournalEntryArray[j], + authorIdentity.address + ) + let extrensic = await Cord.Score.toChain( + outputFromScore, + registryAuthority + ) + const authorizedStreamTx = await Cord.Did.authorizeTx( + delegateOneDid.uri, + extrensic, + async ({ data }: any) => ({ + signature: delegateOneKeys.assertionMethod.sign(data), + keyType: delegateOneKeys.assertionMethod.type, + }), + authorIdentity.address + ) + await Cord.Chain.signAndSubmitTx(authorizedStreamTx, authorIdentity) + console.log( + `\n✅ Rating ${j + 1} has been achored to the blockchain\n`, + outputFromScore.identifier + ) + } catch (error) { + console.log(error.message) + } } } main() - .then(() => console.log("\nBye! 👋 👋 👋 ")) - .finally(Cord.disconnect); - -process.on("SIGINT", async () => { - console.log("\nBye! 👋 👋 👋 \n"); - Cord.disconnect(); - process.exit(0); -}); + .then(() => console.log('\nBye! 👋 👋 👋 ')) + .finally(Cord.disconnect) + +process.on('SIGINT', async () => { + console.log('\nBye! 👋 👋 👋 \n') + Cord.disconnect() + process.exit(0) +}) diff --git a/src/demo-sparknet.ts b/src/demo-sparknet.ts index 285cd86..dd942d6 100644 --- a/src/demo-sparknet.ts +++ b/src/demo-sparknet.ts @@ -12,7 +12,7 @@ import { } from './utils/generateRegistry' import { createDocument } from './utils/createDocument' import { createPresentation } from './utils/createPresentation' -import { createStream } from './utils/createStream' +import { createStatement } from './utils/createStatement' import { verifyPresentation } from './utils/verifyPresentation' import { revokeCredential } from './utils/revokeCredential' import { randomUUID } from 'crypto' @@ -202,7 +202,7 @@ async function main() { depth: null, colors: true, }) - await createStream( + await createStatement( delegateTwoDid.uri, authorityAuthorIdentity, async ({ data }) => ({ diff --git a/src/demo-staging.ts b/src/demo-staging.ts new file mode 100644 index 0000000..c83fe82 --- /dev/null +++ b/src/demo-staging.ts @@ -0,0 +1,305 @@ +import * as Cord from '@cord.network/sdk' +import { UUID, Crypto } from '@cord.network/utils' +import { generateKeypairs } from './utils/generateKeypairs' +import { createDid } from './utils/generateDid' +import { createDidName } from './utils/generateDidName' +import { getDidDocFromName } from './utils/queryDidName' +import { ensureStoredSchema } from './utils/generateSchema' +import { + ensureStoredRegistry, + addRegistryAdminDelegate, + addRegistryDelegate, +} from './utils/generateRegistry' +import { createDocument } from './utils/createDocument' +import { createPresentation } from './utils/createPresentation' +import { createStatement } from './utils/createStatement' +import { verifyPresentation } from './utils/verifyPresentation' +import { revokeCredential } from './utils/revokeCredential' +import { randomUUID } from 'crypto' +import { decryptMessage } from './utils/decrypt_message' +import { encryptMessage } from './utils/encrypt_message' +import { generateRequestCredentialMessage } from './utils/request_credential_message' +import { getChainCredits, addAuthority } from './utils/createAuthorities' +import { createAccount } from './utils/createAccount' + +function getChallenge(): string { + return Cord.Utils.UUID.generate() +} + +async function main() { + //const networkAddress = 'ws://127.0.0.1:9944' + const networkAddress = 'wss://staging.cord.network' + Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) + await Cord.connect(networkAddress) + + // Step 1: Setup Authority + // Setup transaction author account - CORD Account. + + console.log(`\n❄️ New Authority`) + const authorityAuthorIdentity = Crypto.makeKeypairFromUri( + '//Alice', + 'sr25519' + ) + console.log("Alice (AuthorIdentity for this run): ", authorityAuthorIdentity.address); + + // Step 2: Setup Identities + console.log(`\n❄️ Demo Identities (KeyRing)`) + + /* Creating the DIDs for the different parties involved in the demo. */ + // Create Verifier DID + const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid( + authorityAuthorIdentity + ) + const verifierKeys = generateKeypairs(verifierMnemonic) + console.log( + `🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}` + ) + // Create Holder DID + const { mnemonic: holderMnemonic, document: holderDid } = await createDid( + authorityAuthorIdentity + ) + const holderKeys = generateKeypairs(holderMnemonic) + console.log( + `👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}` + ) + // Create issuer DID + const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid( + authorityAuthorIdentity + ) + const issuerKeys = generateKeypairs(issuerMnemonic) + console.log( + `🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}` + ) + const conformingDidDocument = Cord.Did.exportToDidDocument( + issuerDid, + 'application/json' + ) + console.dir(conformingDidDocument, { + depth: null, + colors: true, + }) + // Create Delegate One DID + const { mnemonic: delegateOneMnemonic, document: delegateOneDid } = + await createDid(authorityAuthorIdentity) + const delegateOneKeys = generateKeypairs(delegateOneMnemonic) + console.log( + `🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${ + delegateOneDid.uri + }` + ) + // Create Delegate Two DID + const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } = + await createDid(authorityAuthorIdentity) + const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic) + console.log( + `🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${ + delegateTwoDid.uri + }` + ) + // Create Delegate 3 DID + const { mnemonic: delegate3Mnemonic, document: delegate3Did } = + await createDid(authorityAuthorIdentity) + const delegate3Keys = generateKeypairs(delegate3Mnemonic) + console.log( + `🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${ + delegate3Did.uri + }` + ) + console.log('✅ Identities created!') + + // Step 2: Create a DID name for Issuer + console.log(`\n❄️ DID name Creation `) + const randomDidName = `solar.sailer.${randomUUID().substring(0, 4)}@cord` + + await createDidName( + issuerDid.uri, + authorityAuthorIdentity, + randomDidName, + async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }) + ) + console.log(`✅ DID name - ${randomDidName} - created!`) + await getDidDocFromName(randomDidName) + + // Step 2: Create a new Schema + console.log(`\n❄️ Schema Creation `) + const schema = await ensureStoredSchema( + authorityAuthorIdentity, + issuerDid.uri, + async ({ data }) => ({ + signature: issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, + }) + ) + console.dir(schema, { + depth: null, + colors: true, + }) + console.log('✅ Schema created!') + + // Step 3: Create a new Registry + console.log(`\n❄️ Registry Creation `) + const registry = await ensureStoredRegistry( + authorityAuthorIdentity, + issuerDid.uri, + schema['$id'], + async ({ data }) => ({ + signature: issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, + }) + ) + console.dir(registry, { + depth: null, + colors: true, + }) + console.log('✅ Registry created!') + + // Step 4: Add Delelegate One as Registry Admin + console.log(`\n❄️ Registry Admin Delegate Authorization `) + const registryAuthority = await addRegistryAdminDelegate( + authorityAuthorIdentity, + issuerDid.uri, + registry['identifier'], + delegateOneDid.uri, + async ({ data }) => ({ + signature: issuerKeys.capabilityDelegation.sign(data), + keyType: issuerKeys.capabilityDelegation.type, + }) + ) + console.log(`✅ Registry Authorization - ${registryAuthority} - created!`) + + // Step 4: Add Delelegate Two as Registry Delegate + console.log(`\n❄️ Registry Delegate Authorization `) + const registryDelegate = await addRegistryDelegate( + authorityAuthorIdentity, + issuerDid.uri, + registry['identifier'], + delegateTwoDid.uri, + async ({ data }) => ({ + signature: issuerKeys.capabilityDelegation.sign(data), + keyType: issuerKeys.capabilityDelegation.type, + }) + ) + console.log(`✅ Registry Delegation - ${registryDelegate} - created!`) + + // Step 4: Delegate creates a new Verifiable Document + console.log(`\n❄️ Verifiable Document Creation `) + const document = await createDocument( + holderDid.uri, + delegateTwoDid.uri, + schema, + registryDelegate, + registry.identifier, + async ({ data }) => ({ + signature: delegateTwoKeys.authentication.sign(data), + keyType: delegateTwoKeys.authentication.type, + keyUri: `${delegateTwoDid.uri}${delegateTwoDid.authentication[0].id}`, + }) + ) + console.dir(document, { + depth: null, + colors: true, + }) + await createStatement( + delegateTwoDid.uri, + authorityAuthorIdentity, + async ({ data }) => ({ + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + }), + document + ) + console.log('✅ Credential created!') + + // Step 5: Create a Presentation + console.log(`\n❄️ Presentation Creation `) + const challenge = getChallenge() + const presentation = await createPresentation( + document, + async ({ data }) => ({ + signature: holderKeys.authentication.sign(data), + keyType: holderKeys.authentication.type, + keyUri: `${holderDid.uri}${holderDid.authentication[0].id}`, + }), + ['name', 'id'], + challenge + ) + console.dir(presentation, { + depth: null, + colors: true, + }) + console.log('✅ Presentation created!') + + // Step 6: The verifier checks the presentation. + console.log(`\n❄️ Presentation Verification - ${presentation.identifier} `) + const isValid = await verifyPresentation(presentation, { + challenge: challenge, + trustedIssuerUris: [delegateTwoDid.uri], + }) + + if (isValid) { + console.log('✅ Verification successful! 🎉') + } else { + console.log('✅ Verification failed! 🚫') + } + + console.log(`\n❄️ Messaging `) + const schemaId = Cord.Schema.idToChain(schema.$id) + console.log(' Generating the message - Sender -> Receiver') + const message = await generateRequestCredentialMessage( + holderDid.uri, + verifierDid.uri, + schemaId + ) + + console.log(' Encrypting the message - Sender -> Receiver') + const encryptedMessage = await encryptMessage( + message, + holderDid.uri, + verifierDid.uri, + holderKeys.keyAgreement + ) + + console.log(' Decrypting the message - Receiver') + await decryptMessage(encryptedMessage, verifierKeys.keyAgreement) + + // Step 7: Revoke a Credential + console.log(`\n❄️ Revoke credential - ${document.identifier}`) + await revokeCredential( + delegateTwoDid.uri, + authorityAuthorIdentity, + async ({ data }) => ({ + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + }), + document, + false + ) + console.log(`✅ Credential revoked!`) + + // Step 8: The verifier checks the presentation. + console.log( + `\n❄️ Presentation Verification (should fail) - ${presentation.identifier} ` + ) + const isAgainValid = await verifyPresentation(presentation, { + challenge: challenge, + trustedIssuerUris: [issuerDid.uri], + }) + + if (isAgainValid) { + console.log('✅ Verification successful! 🎉') + } else { + console.log('✅ Verification failed! 🚫') + } +} +main() + .then(() => console.log('\nBye! 👋 👋 👋 ')) + .finally(Cord.disconnect) + +process.on('SIGINT', async () => { + console.log('\nBye! 👋 👋 👋 \n') + Cord.disconnect() + process.exit(0) +}) diff --git a/src/demo-vc.ts b/src/demo-vc.ts index b00656a..d5371f5 100644 --- a/src/demo-vc.ts +++ b/src/demo-vc.ts @@ -13,7 +13,7 @@ import { } from './utils/generateRegistry' import { createDocument } from './utils/createDocument' import { createPresentation } from './utils/createPresentation' -import { createStream } from './utils/createStream' +import { createStatement } from './utils/createStatement' import { verifyPresentation } from './utils/verifyPresentation' import { revokeCredential } from './utils/revokeCredential' import { randomUUID } from 'crypto' @@ -33,22 +33,20 @@ async function main() { Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) await Cord.connect(networkAddress) - // Step 1: Setup Authority + // Step 1: Setup Membership // Setup transaction author account - CORD Account. - console.log(`\n❄️ New Authority`) + console.log(`\n❄️ New Network Member`) const authorityAuthorIdentity = Crypto.makeKeypairFromUri( '//Alice', 'sr25519' ) - // Setup author authority account. + // Setup network member account. const { account: authorIdentity } = await createAccount() - console.log(`🏦 Author (${authorIdentity.type}): ${authorIdentity.address}`) + console.log(`🏦 Member (${authorIdentity.type}): ${authorIdentity.address}`) await addAuthority(authorityAuthorIdentity, authorIdentity.address) - console.log(`🔏 Author permissions updated`) - await getChainCredits(authorityAuthorIdentity, authorIdentity.address, 5) - console.log(`💸 Author endowed with credits`) - console.log('✅ Authority created!') + console.log(`🔏 Member permissions updated`) + console.log('✅ Network Member added!') // Step 2: Setup Identities console.log(`\n❄️ Demo Identities (KeyRing)`) @@ -210,7 +208,7 @@ async function main() { depth: null, colors: true, }) - await createStream( + await createStatement( delegateTwoDid.uri, authorIdentity, async ({ data }) => ({ @@ -247,11 +245,11 @@ async function main() { const VCfromPresentation = vcPresentation.verifiableCredential as VerifiableCredential - const streamResult = await VCUtils.verification.verifyStreamProof( + const statementResult = await VCUtils.verification.verifyStatementProof( VCfromPresentation, VCfromPresentation.proof[1] ) - //console.log("\n: VC Proof(1): ", VCfromPresentation.proof[1], streamResult) + //console.log("\n: VC Proof(1): ", VCfromPresentation.proof[1], statementResult) const selfSignatureResult = await VCUtils.verification.verifySelfSignatureProof( @@ -259,38 +257,38 @@ async function main() { vcPresentation.proof[0], vcChallenge ) - //console.log("\n: VP Proof: ", vcPresentation.proof, vcChallenge, selfSignatureResult) + //console.log("\n: VP Proof: ", vcPresentation.proof, vcChallenge, selfSignatureResult) - const digestResult = await VCUtils.verification.verifyCredentialDigestProof( - VCfromPresentation, - VCfromPresentation.proof[2] - ) - //console.log("\n: VC Proof(2): ", VCfromPresentation.proof[2], digestResult) - - const streamSignatureResult = - await VCUtils.verification.verifyStreamSignatureProof( + const digestResult = await VCUtils.verification.verifyCredentialDigestProof( + VCfromPresentation, + VCfromPresentation.proof[2] + ) + //console.log("\n: VC Proof(2): ", VCfromPresentation.proof[2], digestResult) + + const statementSignatureResult = + await VCUtils.verification.verifyStatementSignatureProof( VCfromPresentation, VCfromPresentation.proof[0] ) - //console.log("\n: VC Proof(0): ", VCfromPresentation.proof[0], streamSignatureResult) - + //console.log("\n: VC Proof(0): ", VCfromPresentation.proof[0], statementSignatureResult) + if ( - streamResult && - streamResult['verified'] && + statementResult && + statementResult['verified'] && digestResult && digestResult['verified'] && - streamSignatureResult && - streamSignatureResult['verified'] && + statementSignatureResult && + statementSignatureResult['verified'] && selfSignatureResult && selfSignatureResult['verified'] ) { console.log( '✅', - 'Stream-Signature-Proof', - streamSignatureResult['verified'], - '✧ Stream-Proof', - streamResult['verified'], + 'Statement-Signature-Proof', + statementSignatureResult['verified'], + '✧ Statement-Proof', + statementResult['verified'], '✧ Digest-Proof', digestResult['verified'], '✧ Self-Signature-Proof', @@ -299,10 +297,10 @@ async function main() { } else { console.log( `❌`, - 'Stream-Signature-Proof', - streamSignatureResult['verified'], - '✧ Stream-Proof', - streamResult['verified'], + 'Statement-Signature-Proof', + statementSignatureResult['verified'], + '✧ Statement-Proof', + statementResult['verified'], '✧ Digest-Proof', digestResult['verified'], '✧ Self-Signature-Proof', @@ -324,11 +322,11 @@ async function main() { console.log(`✅ Credential revoked!`) /* Test VC & VP after revoke */ - const streamResult1 = await VCUtils.verification.verifyStreamProof( + const statementResult1 = await VCUtils.verification.verifyStatementProof( VCfromPresentation, VCfromPresentation.proof[1] ) - //console.log("\n: VC Proof(1): ", VCfromPresentation.proof[1], streamResult) + //console.log("\n: VC Proof(1): ", VCfromPresentation.proof[1], statementResult) const selfSignatureResult1 = await VCUtils.verification.verifySelfSignatureProof( @@ -336,38 +334,38 @@ async function main() { vcPresentation.proof[0], vcChallenge ) - //console.log("\n: VP Proof: ", vcPresentation.proof, vcChallenge, selfSignatureResult) + //console.log("\n: VP Proof: ", vcPresentation.proof, vcChallenge, selfSignatureResult) - const digestResult1 = await VCUtils.verification.verifyCredentialDigestProof( - VCfromPresentation, - VCfromPresentation.proof[2] - ) - //console.log("\n: VC Proof(2): ", VCfromPresentation.proof[2], digestResult) - - const streamSignatureResult1 = - await VCUtils.verification.verifyStreamSignatureProof( + const digestResult1 = await VCUtils.verification.verifyCredentialDigestProof( + VCfromPresentation, + VCfromPresentation.proof[2] + ) + //console.log("\n: VC Proof(2): ", VCfromPresentation.proof[2], digestResult) + + const statementSignatureResult1 = + await VCUtils.verification.verifyStatementSignatureProof( VCfromPresentation, VCfromPresentation.proof[0] ) - //console.log("\n: VC Proof(0): ", VCfromPresentation.proof[0], streamSignatureResult) - + //console.log("\n: VC Proof(0): ", VCfromPresentation.proof[0], statementSignatureResult) + if ( - streamResult1 && - streamResult1['verified'] && + statementResult1 && + statementResult1['verified'] && digestResult1 && digestResult1['verified'] && - streamSignatureResult1 && - streamSignatureResult1['verified'] && + statementSignatureResult1 && + statementSignatureResult1['verified'] && selfSignatureResult1 && selfSignatureResult1['verified'] ) { console.log( '✅', - 'Stream-Signature-Proof', - streamSignatureResult1['verified'], - '✧ Stream-Proof', - streamResult1['verified'], + 'Statement-Signature-Proof', + statementSignatureResult1['verified'], + '✧ Statement-Proof', + statementResult1['verified'], '✧ Digest-Proof', digestResult1['verified'], '✧ Self-Signature-Proof', @@ -375,18 +373,17 @@ async function main() { ) } else { console.log( - `❌`, - 'Stream-Signature-Proof', - streamSignatureResult1['verified'], - '✧ Stream-Proof', - streamResult1, + `🚫`, + 'Statement-Signature-Proof', + statementSignatureResult1['verified'], + '✧ Statement-Proof', + statementResult1['verified'], '✧ Digest-Proof', digestResult1['verified'], '✧ Self-Signature-Proof', selfSignatureResult1['verified'] ) } - } main() diff --git a/src/demo.ts b/src/demo.ts index 31a466f..85af07b 100644 --- a/src/demo.ts +++ b/src/demo.ts @@ -6,13 +6,13 @@ import { createDidName } from './utils/generateDidName' import { getDidDocFromName } from './utils/queryDidName' import { ensureStoredSchema } from './utils/generateSchema' import { - ensureStoredRegistry, - addRegistryAdminDelegate, - addRegistryDelegate, -} from './utils/generateRegistry' + ensureStoredChainSpace, + addSpaceAuthorization, + approveSpace, +} from './utils/generateChainSpace' import { createDocument } from './utils/createDocument' import { createPresentation } from './utils/createPresentation' -import { createStream } from './utils/createStream' +import { createStatement } from './utils/createStatement' import { verifyPresentation } from './utils/verifyPresentation' import { revokeCredential } from './utils/revokeCredential' import { randomUUID } from 'crypto' @@ -21,55 +21,62 @@ import { encryptMessage } from './utils/encrypt_message' import { generateRequestCredentialMessage } from './utils/request_credential_message' import { getChainCredits, addAuthority } from './utils/createAuthorities' import { createAccount } from './utils/createAccount' -const { NETWORK_ADDRESS, ANCHOR_URI, DID_NAME } = process.env +import { updateDocument } from './utils/updateDocument' +import { updateStatement } from './utils/updateStatement' + +import { + requestJudgement, + setIdentity, + setRegistrar, + provideJudgement, +} from './utils/createRegistrar' + function getChallenge(): string { return Cord.Utils.UUID.generate() } -const timeoutId = setTimeout(() => { - console.log("\nTime out. Bye! ⏰ ⏰ ⏰ ") - Cord.disconnect() - process.exit(1) -}, 120000) - async function main() { - - const networkAddress = NETWORK_ADDRESS ?? 'wss://sparknet.cord.network' - const didName = DID_NAME ?? `infinite.sentinel` - const anchorUri = ANCHOR_URI ?? '//Sparknet//1//Demo' + const networkAddress = 'ws://127.0.0.1:9944' Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) await Cord.connect(networkAddress) - // Step 1: Setup Authority + // Step 1: Setup Membership // Setup transaction author account - CORD Account. - console.log(`\n❄️ Creating a new Authority`) - const authorityIdentity = Crypto.makeKeypairFromUri( - anchorUri, + console.log(`\n❄️ New Network Member`) + const authorityAuthorIdentity = Crypto.makeKeypairFromUri( + '//Alice', 'sr25519' ) - let authorityAuthorIdentity : Cord.CordKeyringPair - if(anchorUri == '//Alice'){ - const { account: authorIdentity } = await createAccount() - console.log(`🏦 Author for this run(${authorIdentity.type}): ${authorIdentity.address}`) - await addAuthority(authorityIdentity, authorIdentity.address) - console.log(`🔏 Author permissions updated`) - await getChainCredits(authorityIdentity, authorIdentity.address, 5) - console.log(`💸 Author endowed with credits`) - authorityAuthorIdentity= authorIdentity - console.log('✅ Authority created!') - } - else{ - authorityAuthorIdentity = authorityIdentity - console.log("AuthorIdentity for this run: ", authorityAuthorIdentity.address); - } + // Setup network authority account. + const { account: authorityIdentity } = await createAccount() + console.log( + `🏦 Member (${authorityIdentity.type}): ${authorityIdentity.address}` + ) + await addAuthority(authorityAuthorIdentity, authorityIdentity.address) + await setRegistrar(authorityAuthorIdentity, authorityIdentity.address) + console.log('✅ Network Authority created!') + + // Setup network member account. + const { account: authorIdentity } = await createAccount() + console.log(`🏦 Member (${authorIdentity.type}): ${authorIdentity.address}`) + await addAuthority(authorityAuthorIdentity, authorIdentity.address) + console.log(`🔏 Member permissions updated`) + await setIdentity(authorIdentity) + console.log(`🔏 Member identity info updated`) + await requestJudgement(authorIdentity, authorityIdentity.address) + console.log(`🔏 Member identity judgement requested`) + await provideJudgement(authorityIdentity, authorIdentity.address) + console.log(`🔏 Member identity judgement provided`) + console.log('✅ Network Member added!') // Step 2: Setup Identities console.log(`\n❄️ Demo Identities (KeyRing)`) + /* Creating the DIDs for the different parties involved in the demo. */ // Create Verifier DID const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid( - authorityAuthorIdentity + authorIdentity ) const verifierKeys = generateKeypairs(verifierMnemonic) console.log( @@ -77,7 +84,7 @@ async function main() { ) // Create Holder DID const { mnemonic: holderMnemonic, document: holderDid } = await createDid( - authorityAuthorIdentity + authorIdentity ) const holderKeys = generateKeypairs(holderMnemonic) console.log( @@ -85,7 +92,7 @@ async function main() { ) // Create issuer DID const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid( - authorityAuthorIdentity + authorIdentity ) const issuerKeys = generateKeypairs(issuerMnemonic) console.log( @@ -101,7 +108,7 @@ async function main() { }) // Create Delegate One DID const { mnemonic: delegateOneMnemonic, document: delegateOneDid } = - await createDid(authorityAuthorIdentity) + await createDid(authorIdentity) const delegateOneKeys = generateKeypairs(delegateOneMnemonic) console.log( `🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${ @@ -110,7 +117,7 @@ async function main() { ) // Create Delegate Two DID const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } = - await createDid(authorityAuthorIdentity) + await createDid(authorIdentity) const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic) console.log( `🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${ @@ -119,7 +126,7 @@ async function main() { ) // Create Delegate 3 DID const { mnemonic: delegate3Mnemonic, document: delegate3Did } = - await createDid(authorityAuthorIdentity) + await createDid(authorIdentity) const delegate3Keys = generateKeypairs(delegate3Mnemonic) console.log( `🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${ @@ -130,11 +137,11 @@ async function main() { // Step 2: Create a DID name for Issuer console.log(`\n❄️ DID name Creation `) - const randomDidName = `${didName}.${randomUUID().substring(0, 8)}@cord` - + const randomDidName = `solar.sailer.${randomUUID().substring(0, 4)}@cord` + await createDidName( issuerDid.uri, - authorityAuthorIdentity, + authorIdentity, randomDidName, async ({ data }) => ({ signature: issuerKeys.authentication.sign(data), @@ -144,181 +151,229 @@ async function main() { console.log(`✅ DID name - ${randomDidName} - created!`) await getDidDocFromName(randomDidName) - // Step 2: Create a new Schema - console.log(`\n❄️ Schema Creation `) - const schema = await ensureStoredSchema( - authorityAuthorIdentity, - issuerDid.uri, - async ({ data }) => ({ - signature: issuerKeys.assertionMethod.sign(data), - keyType: issuerKeys.assertionMethod.type, - }) + // Step 3: Create a new Chain Space + console.log(`\n❄️ Chain Space Creation `) + const spaceProperties = await Cord.ChainSpace.buildFromProperties( + issuerDid.uri ) - console.dir(schema, { + console.dir(spaceProperties, { depth: null, colors: true, }) - console.log('✅ Schema created!') - // Step 3: Create a new Registry - console.log(`\n❄️ Registry Creation `) - const registry = await ensureStoredRegistry( - authorityAuthorIdentity, + console.log(`\n❄️ Chain Space Properties `) + const space = await Cord.ChainSpace.dispatchToChain( + spaceProperties, issuerDid.uri, - schema['$id'], + authorIdentity, async ({ data }) => ({ signature: issuerKeys.assertionMethod.sign(data), keyType: issuerKeys.assertionMethod.type, }) ) - console.dir(registry, { + console.dir(space, { depth: null, colors: true, }) - console.log('✅ Registry created!') + console.log('✅ Chain Space created!') - // Step 4: Add Delelegate One as Registry Admin - console.log(`\n❄️ Registry Admin Delegate Authorization `) - const registryAuthority = await addRegistryAdminDelegate( + console.log(`\n❄️ Chain Space Approval `) + await Cord.ChainSpace.sudoApproveChainSpace( authorityAuthorIdentity, - issuerDid.uri, - registry['identifier'], - delegateOneDid.uri, + space.uri, + 100 + ) + console.log(`✅ Chain Space Approved`) + + // Step 4: Add Delelegate Two as Registry Delegate + console.log(`\n❄️ Space Delegate Authorization `) + const permission: Cord.PermissionType = Cord.Permission.ASSERT + const spaceAuthProperties = + await Cord.ChainSpace.buildFromAuthorizationProperties( + space.uri, + delegateTwoDid.uri, + permission, + issuerDid.uri + ) + console.dir(spaceAuthProperties, { + depth: null, + colors: true, + }) + console.log(`\n❄️ Space Delegation To Chain `) + const delegateAuth = await Cord.ChainSpace.dispatchDelegateAuthorization( + spaceAuthProperties, + authorIdentity, + space.authorization, async ({ data }) => ({ signature: issuerKeys.capabilityDelegation.sign(data), keyType: issuerKeys.capabilityDelegation.type, }) ) - console.log(`✅ Registry Authorization - ${registryAuthority} - created!`) + console.dir(delegateAuth, { + depth: null, + colors: true, + }) + console.log(`✅ Space Authorization - ${delegateAuth} - added!`) - // Step 4: Add Delelegate Two as Registry Delegate - console.log(`\n❄️ Registry Delegate Authorization `) - const registryDelegate = await addRegistryDelegate( - authorityAuthorIdentity, + // Step 5: Create a new Schema + console.log(`\n❄️ Schema Creation `) + let newSchemaContent = require('../res/schema.json') + let newSchemaName = newSchemaContent.title + ':' + UUID.generate() + newSchemaContent.title = newSchemaName + + let schemaProperties = Cord.Schema.buildFromProperties( + newSchemaContent, + space.uri, + issuerDid.uri + ) + console.dir(schemaProperties, { + depth: null, + colors: true, + }) + + const schemaId = await Cord.Schema.dispatchToChain( + schemaProperties.schema, issuerDid.uri, - registry['identifier'], - delegateTwoDid.uri, + authorIdentity, + space.authorization, async ({ data }) => ({ - signature: issuerKeys.capabilityDelegation.sign(data), - keyType: issuerKeys.capabilityDelegation.type, + signature: issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, }) ) - console.log(`✅ Registry Delegation - ${registryDelegate} - created!`) + + console.log(`✅ Schema - ${schemaId} - added!`) // Step 4: Delegate creates a new Verifiable Document console.log(`\n❄️ Verifiable Document Creation `) + const document = await createDocument( holderDid.uri, delegateTwoDid.uri, - schema, - registryDelegate, - registry.identifier, + schemaProperties.schema, + space.uri, async ({ data }) => ({ - signature: delegateTwoKeys.authentication.sign(data), - keyType: delegateTwoKeys.authentication.type, - keyUri: `${delegateTwoDid.uri}${delegateTwoDid.authentication[0].id}`, + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + keyUri: `${delegateTwoDid.uri}${delegateTwoDid?.assertionMethod![0].id}`, }) ) console.dir(document, { depth: null, colors: true, }) - await createStream( + await createStatement( + document, delegateTwoDid.uri, - authorityAuthorIdentity, + delegateAuth, + authorIdentity, async ({ data }) => ({ signature: delegateTwoKeys.assertionMethod.sign(data), keyType: delegateTwoKeys.assertionMethod.type, - }), - document + }) ) - console.log('✅ Credential created!') + console.log(`✅ Statement registered - ${document.identifier}`) - // Step 5: Create a Presentation - console.log(`\n❄️ Presentation Creation `) - const challenge = getChallenge() - const presentation = await createPresentation( - document, + // Step 5: Delegate updates the Verifiable Document + console.log(`\n❄️ Verifiable Document Update `) + let updateDocumentContent = + Cord.Document.extractDocumentContentforUpdate(document) + + const contents = updateDocumentContent.content.contents as Cord.IContents + contents.name = 'Alice M' + contents.age = 32 + contents.address.pin = 560100 + + const updatedDocument = await updateDocument( + updateDocumentContent, + schemaProperties.schema, async ({ data }) => ({ + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + keyUri: `${delegateTwoDid.uri}${delegateTwoDid?.assertionMethod![0].id}`, + }) + ) + console.dir(updatedDocument, { + depth: null, + colors: true, + }) + await updateStatement( + updatedDocument, + delegateTwoDid.uri, + delegateAuth, + authorIdentity, + async ({ data }) => ({ + signature: delegateTwoKeys.assertionMethod.sign(data), + keyType: delegateTwoKeys.assertionMethod.type, + }) + ) + console.log(`✅ Statement updated - ${updatedDocument.identifier}`) + + // Step 6: Create a Presentation + console.log(`\n❄️ Selective Disclosure Presentation Creation `) + const challenge = getChallenge() + const presentation = await createPresentation({ + document: updatedDocument, + signCallback: async ({ data }) => ({ signature: holderKeys.authentication.sign(data), keyType: holderKeys.authentication.type, keyUri: `${holderDid.uri}${holderDid.authentication[0].id}`, }), - ['name', 'id'], - challenge - ) + // Comment the below line to have a full disclosure + selectedAttributes: ['name', 'id', 'address.pin', 'address.location'], + challenge: challenge, + }) + console.dir(presentation, { depth: null, colors: true, }) console.log('✅ Presentation created!') - // Step 6: The verifier checks the presentation. + // Step 7: The verifier checks the presentation. console.log(`\n❄️ Presentation Verification - ${presentation.identifier} `) - const isValid = await verifyPresentation(presentation, { + const verificationResult = await verifyPresentation(presentation, { challenge: challenge, trustedIssuerUris: [delegateTwoDid.uri], }) - if (isValid) { + if (verificationResult.isValid) { console.log('✅ Verification successful! 🎉') } else { - console.log('✅ Verification failed! 🚫') + console.log(`🚫 Verification failed! - "${verificationResult.message}" 🚫`) } - console.log(`\n❄️ Messaging `) - const schemaId = Cord.Schema.idToChain(schema.$id) - console.log(' Generating the message - Sender -> Receiver') - const message = await generateRequestCredentialMessage( - holderDid.uri, - verifierDid.uri, - schemaId - ) - - console.log(' Encrypting the message - Sender -> Receiver') - const encryptedMessage = await encryptMessage( - message, - holderDid.uri, - verifierDid.uri, - holderKeys.keyAgreement - ) - - console.log(' Decrypting the message - Receiver') - await decryptMessage(encryptedMessage, verifierKeys.keyAgreement) - - // Step 7: Revoke a Credential - console.log(`\n❄️ Revoke credential - ${document.identifier}`) + // Step 8: Revoke a Credential + console.log(`\n❄️ Revoke credential - ${updatedDocument.identifier}`) await revokeCredential( delegateTwoDid.uri, - authorityAuthorIdentity, + authorIdentity, async ({ data }) => ({ signature: delegateTwoKeys.assertionMethod.sign(data), keyType: delegateTwoKeys.assertionMethod.type, }), - document, - false + updatedDocument, + delegateAuth ) console.log(`✅ Credential revoked!`) - // Step 8: The verifier checks the presentation. - console.log( - `\n❄️ Presentation Verification (should fail) - ${presentation.identifier} ` - ) - const isAgainValid = await verifyPresentation(presentation, { + // Step 9: The verifier checks the presentation. + console.log(`\n❄️ Presentation Verification - ${presentation.identifier} `) + let reVerificationResult = await verifyPresentation(presentation, { challenge: challenge, trustedIssuerUris: [issuerDid.uri], }) - if (isAgainValid) { + if (reVerificationResult.isValid) { console.log('✅ Verification successful! 🎉') } else { - console.log('✅ Verification failed! 🚫') + console.log( + `🚫 Verification failed! - "${reVerificationResult.message}" 🚫` + ) } - } - main() - .then(() => {console.log('\nBye! 👋 👋 👋 '),clearTimeout(timeoutId)}) + .then(() => console.log('\nBye! 👋 👋 👋 ')) .finally(Cord.disconnect) process.on('SIGINT', async () => { diff --git a/src/func-test.ts b/src/func-test.ts new file mode 100644 index 0000000..b7caf2b --- /dev/null +++ b/src/func-test.ts @@ -0,0 +1,431 @@ +import * as Cord from '@cord.network/sdk' +// import { UUID, Crypto } from '@cord.network/utils' +import { generateKeypairs } from './utils/generateKeypairs' +import { createDid } from './utils/generateDid' +import { createDidName } from './utils/generateDidName' +import { getDidDocFromName } from './utils/queryDidName' +import { randomUUID } from 'crypto' +import { addNetworkMember } from './utils/createAuthorities' +import { createAccount } from './utils/createAccount' +import 'dotenv/config' + +import { + requestJudgement, + setIdentity, + setRegistrar, + provideJudgement, +} from './utils/createRegistrar' + +function getChallenge(): string { + return Cord.Utils.UUID.generate() +} + +async function main() { + const { NETWORK_ADDRESS, ANCHOR_URI, DID_NAME } = process.env + const networkAddress = NETWORK_ADDRESS + const anchorUri = ANCHOR_URI + const didName = DID_NAME + Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) + await Cord.connect(networkAddress) + + // Step 1: Setup Membership + // Setup transaction author account - CORD Account. + + console.log(`\n❄️ New Network Member`) + const authorityAuthorIdentity = Cord.Utils.Crypto.makeKeypairFromUri( + anchorUri, + 'sr25519' + ) + // Setup network authority account. + const { account: authorityIdentity } = await createAccount() + console.log( + `🏦 Member (${authorityIdentity.type}): ${authorityIdentity.address}` + ) + await addNetworkMember(authorityAuthorIdentity, authorityIdentity.address) + await setRegistrar(authorityAuthorIdentity, authorityIdentity.address) + console.log('✅ Network Authority created!') + + // Setup network member account. + const { account: authorIdentity } = await createAccount() + console.log(`🏦 Member (${authorIdentity.type}): ${authorIdentity.address}`) + await addNetworkMember(authorityAuthorIdentity, authorIdentity.address) + console.log(`🔏 Member permissions updated`) + await setIdentity(authorIdentity) + console.log(`🔏 Member identity info updated`) + await requestJudgement(authorIdentity, authorityIdentity.address) + console.log(`🔏 Member identity judgement requested`) + await provideJudgement(authorityIdentity, authorIdentity.address) + console.log(`🔏 Member identity judgement provided`) + console.log('✅ Network Member added!') + + // Step 2: Setup Identities + console.log(`\n❄️ Demo Identities (KeyRing)`) + + /* Creating the DIDs for the different parties involved in the demo. */ + // Create Verifier DID + const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid( + authorIdentity + ) + const verifierKeys = generateKeypairs(verifierMnemonic) + console.log( + `🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}` + ) + // Create Holder DID + const { mnemonic: holderMnemonic, document: holderDid } = await createDid( + authorIdentity + ) + const holderKeys = generateKeypairs(holderMnemonic) + console.log( + `👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}` + ) + // Create issuer DID + const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid( + authorIdentity + ) + const issuerKeys = generateKeypairs(issuerMnemonic) + console.log( + `🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}` + ) + const conformingDidDocument = Cord.Did.exportToDidDocument( + issuerDid, + 'application/json' + ) + console.dir(conformingDidDocument, { + depth: null, + colors: true, + }) + // Create Delegate One DID + const { mnemonic: delegateOneMnemonic, document: delegateOneDid } = + await createDid(authorIdentity) + const delegateOneKeys = generateKeypairs(delegateOneMnemonic) + console.log( + `🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${ + delegateOneDid.uri + }` + ) + // Create Delegate Two DID + const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } = + await createDid(authorIdentity) + const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic) + console.log( + `🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${ + delegateTwoDid.uri + }` + ) + // Create Delegate 3 DID + const { mnemonic: delegate3Mnemonic, document: delegate3Did } = + await createDid(authorIdentity) + const delegate3Keys = generateKeypairs(delegate3Mnemonic) + console.log( + `🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${ + delegate3Did.uri + }` + ) + console.log('✅ Identities created!') + + // Step 2: Create a DID name for Issuer + console.log(`\n❄️ DID name Creation `) + const randomDidName = `${didName}.${randomUUID().substring(0, 4)}@cord` + + await createDidName( + issuerDid.uri, + authorIdentity, + randomDidName, + async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }) + ) + console.log(`✅ DID name - ${randomDidName} - created!`) + await getDidDocFromName(randomDidName) + + // Step 3: Create a new Chain Space + console.log(`\n❄️ Chain Space Creation `) + const spaceProperties = await Cord.ChainSpace.buildFromProperties( + issuerDid.uri + ) + console.dir(spaceProperties, { + depth: null, + colors: true, + }) + + console.log(`\n❄️ Chain Space Properties `) + const space = await Cord.ChainSpace.dispatchToChain( + spaceProperties, + issuerDid.uri, + authorIdentity, + async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }) + ) + console.dir(space, { + depth: null, + colors: true, + }) + console.log('✅ Chain Space created!') + + console.log(`\n❄️ Chain Space Approval `) + await Cord.ChainSpace.sudoApproveChainSpace( + authorityAuthorIdentity, + space.uri, + 100 + ) + console.log(`✅ Chain Space Approved`) + + // Step 4: Add Delelegate Two as Registry Delegate + console.log(`\n❄️ Space Delegate Authorization `) + const permission: Cord.PermissionType = Cord.Permission.ASSERT + const spaceAuthProperties = + await Cord.ChainSpace.buildFromAuthorizationProperties( + space.uri, + delegateTwoDid.uri, + permission, + issuerDid.uri + ) + console.dir(spaceAuthProperties, { + depth: null, + colors: true, + }) + console.log(`\n❄️ Space Delegation To Chain `) + const delegateAuth = await Cord.ChainSpace.dispatchDelegateAuthorization( + spaceAuthProperties, + authorIdentity, + space.authorization, + async ({ data }) => ({ + signature: issuerKeys.capabilityDelegation.sign(data), + keyType: issuerKeys.capabilityDelegation.type, + }) + ) + console.dir(delegateAuth, { + depth: null, + colors: true, + }) + console.log(`✅ Space Authorization - ${delegateAuth} - added!`) + + console.log(`\n❄️ Query From Chain - Chain Space Details `) + const spaceFromChain = await Cord.ChainSpace.fetchFromChain(space.uri) + console.dir(spaceFromChain, { + depth: null, + colors: true, + }) + + console.log(`\n❄️ Query From Chain - Chain Space Authorization Details `) + const spaceAuthFromChain = await Cord.ChainSpace.fetchAuthorizationFromChain( + delegateAuth as Cord.AuthorizationUri + ) + console.dir(spaceAuthFromChain, { + depth: null, + colors: true, + }) + console.log(`✅ Chain Space Functions Completed!`) + + // Step 5: Create a new Schema + console.log(`\n❄️ Schema Creation `) + let newSchemaContent = require('../res/schema.json') + let newSchemaName = newSchemaContent.title + ':' + Cord.Utils.UUID.generate() + newSchemaContent.title = newSchemaName + + let schemaProperties = Cord.Schema.buildFromProperties( + newSchemaContent, + space.uri, + issuerDid.uri + ) + console.dir(schemaProperties, { + depth: null, + colors: true, + }) + const schemaUri = await Cord.Schema.dispatchToChain( + schemaProperties.schema, + issuerDid.uri, + authorIdentity, + space.authorization, + async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }) + ) + console.log(`✅ Schema - ${schemaUri} - added!`) + + console.log(`\n❄️ Query From Chain - Schema `) + const schemaFromChain = await Cord.Schema.fetchFromChain( + schemaProperties.schema.$id + ) + console.dir(schemaFromChain, { + depth: null, + colors: true, + }) + console.log('✅ Schema Functions Completed!') + + // Step 4: Delegate creates a new Verifiable Document + console.log(`\n❄️ Statement Creation `) + + let newCredContent = require('../res/cred.json') + newCredContent.issuanceDate = new Date().toISOString() + const serializedCred = Cord.Utils.Crypto.encodeObjectAsStr(newCredContent) + const credHash = Cord.Utils.Crypto.hashStr(serializedCred) + + console.dir(newCredContent, { + depth: null, + colors: true, + }) + + const statementEntry = Cord.Statement.buildFromProperties( + credHash, + space.uri, + issuerDid.uri, + schemaUri as Cord.SchemaUri + ) + console.dir(statementEntry, { + depth: null, + colors: true, + }) + + const statement = await Cord.Statement.dispatchRegisterToChain( + statementEntry, + issuerDid.uri, + authorIdentity, + space.authorization, + async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }) + ) + + console.log(`✅ Statement element registered - ${statement}`) + + console.log(`\n❄️ Statement Updation `) + let updateCredContent = newCredContent + updateCredContent.issuanceDate = new Date().toISOString() + updateCredContent.name = 'Bachelor of Science' + const serializedUpCred = + Cord.Utils.Crypto.encodeObjectAsStr(updateCredContent) + const upCredHash = Cord.Utils.Crypto.hashStr(serializedUpCred) + + const updatedStatementEntry = Cord.Statement.buildFromUpdateProperties( + statementEntry.elementUri, + upCredHash, + space.uri, + delegateTwoDid.uri + ) + console.dir(updatedStatementEntry, { + depth: null, + colors: true, + }) + + const updatedStatement = await Cord.Statement.dispatchUpdateToChain( + updatedStatementEntry, + delegateTwoDid.uri, + authorIdentity, + delegateAuth as Cord.AuthorizationUri, + async ({ data }) => ({ + signature: delegateTwoKeys.authentication.sign(data), + keyType: delegateTwoKeys.authentication.type, + }) + ) + console.log(`✅ Statement element registered - ${updatedStatement}`) + + console.log(`\n❄️ Statement verification `) + const verificationResult = await Cord.Statement.verifyAgainstProperties( + statementEntry.elementUri, + credHash, + issuerDid.uri, + space.uri, + schemaUri as Cord.SchemaUri + ) + + if (verificationResult.isValid) { + console.log(`✅ Verification successful! "${statementEntry.elementUri}" 🎉`) + } else { + console.log(`🚫 Verification failed! - "${verificationResult.message}" 🚫`) + } + + const anotherVerificationResult = + await Cord.Statement.verifyAgainstProperties( + updatedStatementEntry.elementUri, + upCredHash, + delegateTwoDid.uri, + space.uri + ) + + if (anotherVerificationResult.isValid) { + console.log( + `\n✅ Verification successful! "${updatedStatementEntry.elementUri}" 🎉` + ) + } else { + console.log( + `\n🚫 Verification failed! - "${verificationResult.message}" 🚫` + ) + } + + console.log(`\n❄️ Revoke Statement - ${updatedStatementEntry.elementUri}`) + await Cord.Statement.dispatchRevokeToChain( + updatedStatementEntry.elementUri, + delegateTwoDid.uri, + authorIdentity, + delegateAuth as Cord.AuthorizationUri, + async ({ data }) => ({ + signature: delegateTwoKeys.authentication.sign(data), + keyType: delegateTwoKeys.authentication.type, + }) + ) + console.log(`✅ Statement revoked!`) + + console.log(`\n❄️ Statement Re-verification `) + const reVerificationResult = await Cord.Statement.verifyAgainstProperties( + updatedStatementEntry.elementUri, + upCredHash, + issuerDid.uri, + space.uri + ) + + if (reVerificationResult.isValid) { + console.log( + `✅ Verification successful! "${updatedStatementEntry.elementUri}" 🎉` + ) + } else { + console.log( + `🚫 Verification failed! - "${reVerificationResult.message}" 🚫` + ) + } + + console.log(`\n❄️ Restore Statement - ${updatedStatementEntry.elementUri}`) + await Cord.Statement.dispatchRestoreToChain( + updatedStatementEntry.elementUri, + delegateTwoDid.uri, + authorIdentity, + delegateAuth as Cord.AuthorizationUri, + async ({ data }) => ({ + signature: delegateTwoKeys.authentication.sign(data), + keyType: delegateTwoKeys.authentication.type, + }) + ) + console.log(`✅ Statement revoked!`) + + console.log(`\n❄️ Statement Re-verification `) + const reReVerificationResult = await Cord.Statement.verifyAgainstProperties( + updatedStatementEntry.elementUri, + upCredHash, + delegateTwoDid.uri, + space.uri + ) + + if (reReVerificationResult.isValid) { + console.log( + `✅ Verification successful! "${updatedStatementEntry.elementUri}" 🎉` + ) + } else { + console.log( + `🚫 Verification failed! - "${reReVerificationResult.message}" 🚫` + ) + } +} +main() + .then(() => console.log('\nBye! 👋 👋 👋 ')) + .finally(Cord.disconnect) + +process.on('SIGINT', async () => { + console.log('\nBye! 👋 👋 👋 \n') + Cord.disconnect() + process.exit(0) +}) diff --git a/src/identifier.ts b/src/identifier.ts index 734981f..0b6148c 100644 --- a/src/identifier.ts +++ b/src/identifier.ts @@ -180,7 +180,7 @@ async function main() { // console.log('base58:', schemaEncodedHash) // console.log( // 'base58 Decode:', - // Cord.StreamUtils.hexToString(schemaEncodedHash), + // Cord.StatementUtils.hexToString(schemaEncodedHash), // schemaEncodedHash // ) // // console.log(encodeDerivedAddress(newSchema.hash, 1031)) diff --git a/src/network-score-test.ts b/src/network-score-test.ts new file mode 100644 index 0000000..9c1ef75 --- /dev/null +++ b/src/network-score-test.ts @@ -0,0 +1,381 @@ +import * as Cord from '@cord.network/sdk' +import { generateKeypairs } from './utils/generateKeypairs' +import { createDid } from './utils/generateDid' +import { createDidName } from './utils/generateDidName' +import { getDidDocFromName } from './utils/queryDidName' +import { addNetworkMember } from './utils/createAuthorities' +import { createAccount } from './utils/createAccount' + +async function main() { + const networkAddress = 'ws://127.0.0.1:9944' + Cord.ConfigService.set({ submitTxResolveOn: Cord.Chain.IS_IN_BLOCK }) + await Cord.connect(networkAddress) + const devAuthorIdentity = Cord.Utils.Crypto.makeKeypairFromUri( + '//Alice', + 'sr25519' + ) + console.log(`\n🌐 Network Score Initial Setup`) + + console.log(`\n🎎 Particpants `) + const { account: networkAuthorIdentity } = await createAccount( + Cord.Utils.Crypto.mnemonicGenerate() + ) + console.log( + `🔐 Network Member (${devAuthorIdentity.type}): ${devAuthorIdentity.address}` + ) + await addNetworkMember(devAuthorIdentity, networkAuthorIdentity.address) + console.log('✅ Network Membership Approved! 🎉\n') + + const { mnemonic: chainSpaceAdminMnemonic, document: chainSpaceAdminDid } = + await createDid(networkAuthorIdentity) + const chainSpaceAdminKeys = generateKeypairs(chainSpaceAdminMnemonic) + console.log( + `🔐 Network Score Admin (${chainSpaceAdminDid.authentication[0].type}): ${chainSpaceAdminDid.uri}` + ) + const { mnemonic: networkProviderMnemonic, document: networkProviderDid } = + await createDid(networkAuthorIdentity) + const networkProviderKeys = generateKeypairs(networkProviderMnemonic) + console.log( + `🔐 Network Participant (Provider) (${networkProviderDid.authentication[0].type}): ${networkProviderDid.uri}` + ) + + const { mnemonic: networkAuthorMnemonic, document: networkAuthorDid } = + await createDid(networkAuthorIdentity) + const networkAuthorKeys = generateKeypairs(networkAuthorMnemonic) + console.log( + `🔐 Network Author (API -> Node) (${networkAuthorDid.authentication[0].type}): ${networkAuthorDid.uri}` + ) + + console.log('✅ Network Members created! 🎉') + + // uncomment to enable DID name creation + // console.log(`\n❄️ Network Participant DID name Creation `) + // const randomDidName = `solar.sailer.${randomUUID().substring(0, 4)}@cord` + + // await createDidName( + // networkParticipantDid.uri, + // networkAuthorIdentity, + // randomDidName, + // async ({ data }) => ({ + // signature: networkParticipantKeys.authentication.sign(data), + // keyType: networkParticipantKeys.authentication.type, + // }) + // ) + // console.log(`✅ Network Participant DID name - ${randomDidName} - created!`) + // await getDidDocFromName(randomDidName) + + console.log(`\n🌐 Network Score Chain Space Creation `) + const spaceProperties = await Cord.ChainSpace.buildFromProperties( + chainSpaceAdminDid.uri + ) + console.dir(spaceProperties, { + depth: null, + colors: true, + }) + + const chainSpace = await Cord.ChainSpace.dispatchToChain( + spaceProperties, + chainSpaceAdminDid.uri, + networkAuthorIdentity, + async ({ data }) => ({ + signature: chainSpaceAdminKeys.authentication.sign(data), + keyType: chainSpaceAdminKeys.authentication.type, + }) + ) + console.log('✅ Chain Space created! 🎉') + + await Cord.ChainSpace.sudoApproveChainSpace( + devAuthorIdentity, + chainSpace.uri, + 1000 + ) + + console.log(`\n🌐 Chain Space Authorization (Author) `) + const permission: Cord.PermissionType = Cord.Permission.ASSERT + const spaceAuthProperties = + await Cord.ChainSpace.buildFromAuthorizationProperties( + chainSpace.uri, + networkAuthorDid.uri, + permission, + chainSpaceAdminDid.uri + ) + console.dir(spaceAuthProperties, { + depth: null, + colors: true, + }) + + const delegateAuth = await Cord.ChainSpace.dispatchDelegateAuthorization( + spaceAuthProperties, + networkAuthorIdentity, + chainSpace.authorization, + async ({ data }) => ({ + signature: chainSpaceAdminKeys.capabilityDelegation.sign(data), + keyType: chainSpaceAdminKeys.capabilityDelegation.type, + }) + ) + console.log(`✅ Chain Space Authorization Approved! 🎉`) + + console.log(`\n🌐 Query From Chain - Chain Space `) + const spaceFromChain = await Cord.ChainSpace.fetchFromChain(chainSpace.uri) + console.dir(spaceFromChain, { + depth: null, + colors: true, + }) + + console.log(`\n🌐 Query From Chain - Chain Space Authorization `) + const spaceAuthFromChain = await Cord.ChainSpace.fetchAuthorizationFromChain( + delegateAuth as Cord.AuthorizationUri + ) + console.dir(spaceAuthFromChain, { + depth: null, + colors: true, + }) + + console.log(`✅ Initial Setup Completed! 🎊`) + + console.log(`\n⏳ Network Rating Transaction Flow`) + + console.log(`\n💠 Write Rating - (Genesis) Credit Entry `) + let ratingContent: Cord.IRatingContent = { + entityUid: Cord.Utils.UUID.generate(), + entityId: 'Gupta Kirana Store', + providerUid: Cord.Utils.UUID.generate(), + providerId: 'GoFrugal', + entityType: Cord.EntityTypeOf.retail, + ratingType: Cord.RatingTypeOf.overall, + countOfTxn: 100, + totalRating: 320, + } + + console.dir(ratingContent, { + depth: null, + colors: true, + }) + + let transformedEntry = await Cord.Score.buildFromContentProperties( + ratingContent, + networkProviderDid.uri, + async ({ data }) => ({ + signature: networkProviderKeys.assertionMethod.sign(data), + keyType: networkProviderKeys.assertionMethod.type, + keyUri: `${networkProviderDid.uri}${ + networkProviderDid.assertionMethod![0].id + }` as Cord.DidResourceUri, + }) + ) + console.log(`\n🌐 Rating Information to API endpoint (/write-ratings) `) + console.dir(transformedEntry, { + depth: null, + colors: true, + }) + + let dispatchEntry = await Cord.Score.buildFromRatingProperties( + transformedEntry, + chainSpace.uri, + networkAuthorDid.uri, + async ({ data }) => ({ + signature: networkAuthorKeys.assertionMethod.sign(data), + keyType: networkAuthorKeys.assertionMethod.type, + keyUri: `${networkAuthorDid.uri}${ + networkAuthorDid.assertionMethod![0].id + }` as Cord.DidResourceUri, + }) + ) + + console.log(`\n🌐 Rating Information to Ledger (API -> Ledger) `) + console.dir(dispatchEntry, { + depth: null, + colors: true, + }) + + let ratingUri = await Cord.Score.dispatchRatingToChain( + dispatchEntry.details, + networkAuthorIdentity, + delegateAuth as Cord.AuthorizationUri, + async ({ data }) => ({ + signature: networkAuthorKeys.authentication.sign(data), + keyType: networkAuthorKeys.authentication.type, + }) + ) + + if (Cord.Identifier.isValidIdentifier(ratingUri)) { + console.log('✅ Rating addition successful! 🎉') + } else { + console.log(`🚫 Ledger Anchoring failed! " 🚫`) + } + + console.log(`\n💠 Revoke Rating - Debit Entry `) + const revokeInput = { + entryUri: ratingUri, + entityUid: transformedEntry.entry.entityUid, + } + console.dir(revokeInput, { + depth: null, + colors: true, + }) + const revokeRatingEntry = await Cord.Score.buildFromRevokeProperties( + ratingUri, + transformedEntry.entry.entityUid, + networkProviderDid.uri, + async ({ data }) => ({ + signature: networkProviderKeys.assertionMethod.sign(data), + keyType: networkProviderKeys.assertionMethod.type, + keyUri: `${networkProviderDid.uri}${ + networkProviderDid.assertionMethod![0].id + }` as Cord.DidResourceUri, + }) + ) + console.log( + `\n🌐 Rating Revoke (Debit) Information to API endpoint (/amend-ratings) ` + ) + console.dir(revokeRatingEntry, { + depth: null, + colors: true, + }) + + const revokeRatingDispatchEntry = + await Cord.Score.buildFromRevokeRatingProperties( + revokeRatingEntry, + chainSpace.uri, + networkAuthorDid.uri, + async ({ data }) => ({ + signature: networkAuthorKeys.assertionMethod.sign(data), + keyType: networkAuthorKeys.assertionMethod.type, + keyUri: `${networkAuthorDid.uri}${ + networkAuthorDid.assertionMethod![0].id + }` as Cord.DidResourceUri, + }) + ) + console.log( + `\n🌐 Rating Revoke (Debit) Information to Ledger (API -> Ledger) ` + ) + console.dir(revokeRatingDispatchEntry, { + depth: null, + colors: true, + }) + + let revokedRatingUri = await Cord.Score.dispatchRevokeRatingToChain( + revokeRatingDispatchEntry.details, + networkAuthorIdentity, + delegateAuth as Cord.AuthorizationUri, + async ({ data }) => ({ + signature: networkAuthorKeys.authentication.sign(data), + keyType: networkAuthorKeys.authentication.type, + }) + ) + + if (Cord.Identifier.isValidIdentifier(revokedRatingUri)) { + console.log('✅ Rating Revoke (Debit) successful! 🎉') + } else { + console.log(`🚫 Debit Anchoring failed! " 🚫`) + } + + console.log(`\n💠 Revised Rating - Credit Entry `) + + let revisedRatingContent: Cord.IRatingContent = { + ...ratingContent, + referenceId: revokedRatingUri, + countOfTxn: 80, + totalRating: 280, + } + + console.dir(revisedRatingContent, { + depth: null, + colors: true, + }) + + let transformedRevisedEntry = await Cord.Score.buildFromContentProperties( + revisedRatingContent, + networkProviderDid.uri, + async ({ data }) => ({ + signature: networkProviderKeys.assertionMethod.sign(data), + keyType: networkProviderKeys.assertionMethod.type, + keyUri: `${networkProviderDid.uri}${ + networkProviderDid.assertionMethod![0].id + }` as Cord.DidResourceUri, + }) + ) + console.log( + `\n🌐 Rating Revised(Credit) Information to API endpoint (/write-ratings) ` + ) + console.dir(transformedRevisedEntry, { + depth: null, + colors: true, + }) + + let dispatchRevisedEntry = await Cord.Score.buildFromRatingProperties( + transformedRevisedEntry, + chainSpace.uri, + networkAuthorDid.uri, + async ({ data }) => ({ + signature: networkAuthorKeys.assertionMethod.sign(data), + keyType: networkAuthorKeys.assertionMethod.type, + keyUri: `${networkAuthorDid.uri}${ + networkAuthorDid.assertionMethod![0].id + }` as Cord.DidResourceUri, + }) + ) + + console.log( + `\n🌐 Rating Revised(Credit) Information to Ledger (API -> Ledger) ` + ) + console.dir(dispatchRevisedEntry, { + depth: null, + colors: true, + }) + + let revisedRatingUri = await Cord.Score.dispatchReviseRatingToChain( + dispatchRevisedEntry.details, + networkAuthorIdentity, + delegateAuth as Cord.AuthorizationUri, + async ({ data }) => ({ + signature: networkAuthorKeys.authentication.sign(data), + keyType: networkAuthorKeys.authentication.type, + }) + ) + + if (Cord.Identifier.isValidIdentifier(revisedRatingUri)) { + console.log('✅ Rating Revision(Credit) successful! 🎉') + } else { + console.log(`🚫 Revision Anchoring failed! " 🚫`) + } + + console.log(`\n🌐 Query From Chain - Rating Entry `) + const ratingEntryFromChain = await Cord.Score.fetchRatingDetailsfromChain( + revisedRatingUri, + 'Asia/Kolkata' + ) + console.dir(ratingEntryFromChain, { + depth: null, + colors: true, + }) + + console.log(`\n🌐 Query From Chain - Aggregate Score `) + const aggregateScoreFromChain = + await Cord.Score.fetchEntityAggregateScorefromChain( + ratingContent.entityUid, + Cord.RatingTypeOf.overall + ) + console.dir(aggregateScoreFromChain, { + depth: null, + colors: true, + }) + + console.log(`\n🌐 Query From Chain - Chain Space Usage `) + const spaceUsageFromChain = await Cord.ChainSpace.fetchFromChain( + chainSpace.uri + ) + console.dir(spaceUsageFromChain, { + depth: null, + colors: true, + }) +} +main() + .then(() => console.log('\nBye! 👋 👋 👋 ')) + .finally(Cord.disconnect) + +process.on('SIGINT', async () => { + console.log('\nBye! 👋 👋 👋 \n') + Cord.disconnect() + process.exit(0) +}) diff --git a/src/start.ts b/src/start.ts deleted file mode 100644 index cc1db00..0000000 --- a/src/start.ts +++ /dev/null @@ -1,274 +0,0 @@ -import * as cord from "@cord.network/api"; -import { UUID } from "@cord.network/utils"; -import * as json from "multiformats/codecs/json"; -import { blake2b256 as hasher } from "@multiformats/blake2/blake2b"; -import { CID } from "multiformats/cid"; -import { hideBin } from "yargs/helpers"; -import yargs from "yargs"; - -const { DEMO_KEY_URI, DEMO_WSS_ADDR, DEMO_LOOP_CNT } = process.env; - -function sleep(ms: number) { - return new Promise((resolve) => { - setTimeout(resolve, ms); - }); -} - -function between(min: number, max: number) { - return Math.floor(Math.random() * (max - min) + min); -} - -async function main() { - let argv = await yargs(hideBin(process.argv)) - .option("loop", { - default: DEMO_LOOP_CNT ? DEMO_LOOP_CNT : 1000, - describe: - "Number of mark.create() transaction to be done by this program (0 for infinite loop)", - type: "number", - }) - .option("key", { - alias: "k", - demandOption: false, - default: DEMO_KEY_URI ? DEMO_KEY_URI : "//Bob", - describe: - "URI to generate the key, so we can sign the transactions using the given key.", - type: "string", - }) - .option("address", { - alias: "a", - default: DEMO_WSS_ADDR ? DEMO_WSS_ADDR : "ws://127.0.0.1:9944", - describe: "address to connect to", - type: "string", - }).argv; - - // let didTxCounter = 1 - await cord.init({ address: argv.address }); - - // Step 1: Setup Org Identity - console.log(`\n🏛 Creating Identities\n`); - //3x4DHc1rxVAEqKWSx1DAAA8wZxLB4VhiRbMV997niBckUwSi - const entityIdentity = cord.Identity.buildFromURI(argv.key, { - signingKeyPairType: "sr25519", - }); - const employeeIdentity = cord.Identity.buildFromURI("//Dave", { - signingKeyPairType: "ed25519", - }); - const holderIdentity = cord.Identity.buildFromURI("//Alice", { - signingKeyPairType: "sr25519", - }); - const verifierIdentity = cord.Identity.buildFromURI("//Charlie", { - signingKeyPairType: "ed25519", - }); - console.log( - `🔑 Entity Controller Address (${entityIdentity.signingKeyType}): ${entityIdentity.address}` - ); - console.log( - `🔑 Employee Address (${employeeIdentity.signingKeyType}): ${employeeIdentity.address}` - ); - console.log( - `🔑 Holder Org Address (${holderIdentity.signingKeyType}): ${holderIdentity.address}` - ); - console.log( - `🔑 Verifier Org Address (${verifierIdentity.signingKeyType}): ${verifierIdentity.address}\n` - ); - console.log("✅ Identities created!"); - // await utils.waitForEnter('\n⏎ Press Enter to continue..') - - // Step 2: Create a new Schema - console.log(`\n\n✉️ Adding a new Schema \n`); - let newSchemaContent = require("../res/schema.json"); - let newSchemaName = newSchemaContent.name + ":" + UUID.generate(); - newSchemaContent.name = newSchemaName; - - let newSchema = cord.Schema.fromSchemaProperties( - newSchemaContent, - employeeIdentity.address - ); - - let bytes = json.encode(newSchema); - let encoded_hash = await hasher.digest(bytes); - const schemaCid = CID.create(1, 0xb220, encoded_hash); - - let schemaCreationExtrinsic = await newSchema.store(schemaCid.toString()); - - console.log(`📧 Schema Details `); - console.dir(newSchema, { depth: null, colors: true }); - console.log(`CID: `, schemaCid.toString()); - console.log("\n⛓ Anchoring Schema to the chain..."); - console.log(`🔑 Creator: ${employeeIdentity.address} `); - console.log(`🔑 Controller: ${entityIdentity.address} `); - - try { - await cord.ChainUtils.signAndSubmitTx( - schemaCreationExtrinsic, - entityIdentity, - { - resolveOn: cord.ChainUtils.IS_IN_BLOCK, - } - ); - console.log("✅ Schema created!"); - } catch (e: any) { - console.log(e.errorCode, "-", e.message); - } - // await utils.waitForEnter('\n⏎ Press Enter to continue..') - - // Step 2: Create a new Stream - console.log(`\n✉️ Adding a new Stream`, "\n"); - let content = { - name: "Alice", - age: 29, - gender: "Female", - country: "India", - credit: 1000, - }; - let schemaStream = cord.Content.fromSchemaAndContent( - newSchema, - content, - employeeIdentity.address - ); - console.log(`📧 Stream Details `); - console.dir(schemaStream, { depth: null, colors: true }); - // await utils.waitForEnter('\n⏎ Press Enter to continue..') - - let newStreamContent = cord.ContentStream.fromStreamContent( - schemaStream, - employeeIdentity - ); - console.log(`\n📧 Hashed Stream `); - console.dir(newStreamContent, { depth: null, colors: true }); - // await utils.waitForEnter('\n⏎ Press Enter to continue..') - - bytes = json.encode(newStreamContent); - encoded_hash = await hasher.digest(bytes); - const streamCid = CID.create(1, 0xb220, encoded_hash); - - let newStream = cord.Stream.fromContentStreamProperties( - newStreamContent, - streamCid.toString() - ); - - let streamCreationExtrinsic = await newStream.store(); - console.log(`\n📧 Stream On-Chain Details`); - console.dir(newStream, { depth: null, colors: true }); - // console.log(`CID: `, streamCid.toString()) - - console.log("\n⛓ Anchoring Stream to the chain..."); - console.log(`🔑 Creator: ${employeeIdentity.address} `); - console.log(`🔑 Controller: ${entityIdentity.address} `); - - try { - await cord.ChainUtils.signAndSubmitTx( - streamCreationExtrinsic, - entityIdentity, - { - resolveOn: cord.ChainUtils.IS_IN_BLOCK, - } - ); - console.log("✅ Stream created!"); - } catch (e: any) { - console.log(e.errorCode, "-", e.message); - } - // await utils.waitForEnter('\n⏎ Press Enter to continue..') - - // Step 3: Create a new Credential and Link to the Stream - console.log(`\n\n✉️ Adding a new Credential Schema \n`); - let credSchema = require("../res/cred-schema.json"); - credSchema.name = credSchema.name + ":" + UUID.generate(); - - let credSchemaStream = cord.Schema.fromSchemaProperties( - credSchema, - employeeIdentity.address - ); - - bytes = json.encode(credSchemaStream); - encoded_hash = await hasher.digest(bytes); - const credSchemaCid = CID.create(1, 0xb220, encoded_hash); - - let credSchemaCreationExtrinsic = await credSchemaStream.store( - credSchemaCid.toString() - ); - console.log("\n⛓ Anchoring Credential Schema to the chain..."); - - try { - await cord.ChainUtils.signAndSubmitTx( - credSchemaCreationExtrinsic, - entityIdentity, - { - resolveOn: cord.ChainUtils.IS_IN_BLOCK, - } - ); - console.log("✅ Schema created!"); - } catch (e: any) { - console.log(e.errorCode, "-", e.message); - } - - for (let i = 0; !Number(argv.loop) || i < Number(argv.loop); i++) { - console.log(`\🏷 Mark `, i); - - sleep(between(3000, 20000)); - - console.log(`\n✉️ Adding a new Credential`, "\n"); - let credStream = { - name: newStreamContent.content.contents.name + UUID.generate(), - country: newStreamContent.content.contents.country, - }; - - let credStreamContent = cord.Content.fromSchemaAndContent( - credSchemaStream, - credStream, - employeeIdentity.address - ); - - // console.log(`📧 Stream Details `) - // console.dir(credStreamContent, { depth: null, colors: true }) - // await utils.waitForEnter('\n⏎ Press Enter to continue..') - - let credContentStream = cord.ContentStream.fromStreamContent( - credStreamContent, - employeeIdentity, - { - holder: holderIdentity.address, - link: newStream.id, - } - ); - console.log(`\n📧 Hashed Stream Details`); - console.dir(credContentStream, { depth: null, colors: true }); - // await utils.waitForEnter('\n⏎ Press Enter to continue..') - - bytes = json.encode(credContentStream); - encoded_hash = await hasher.digest(bytes); - const credStreamCid = CID.create(1, 0xb220, encoded_hash); - - let credStreamTx = cord.Stream.fromContentStreamProperties( - credContentStream, - credStreamCid.toString() - ); - - let credStreamCreationExtrinsic = await credStreamTx.store(); - console.log(`\n📧 Credential On-Chain Details`); - console.dir(credStreamTx, { depth: null, colors: true }); - - try { - await cord.ChainUtils.signAndSubmitTx( - credStreamCreationExtrinsic, - entityIdentity, - { - resolveOn: cord.ChainUtils.IS_IN_BLOCK, - } - ); - console.log("✅ Credential created!"); - } catch (e: any) { - console.log(e.errorCode, "-", e.message); - } - } -} - -main() - .then(() => console.log("\nBye! 👋 👋 👋 ")) - .finally(cord.disconnect); - -process.on("SIGINT", async () => { - console.log("\nBye! 👋 👋 👋 \n"); - cord.disconnect(); - process.exit(0); -}); diff --git a/src/stream-bench.ts b/src/stream-bench.ts index 93e2c0d..73a04b2 100644 --- a/src/stream-bench.ts +++ b/src/stream-bench.ts @@ -37,19 +37,19 @@ async function main() { const X = Crypto.makeKeypairFromUri(`${xUri}`, 'sr25519') - await sleep(Math.random()*6000); + await sleep(Math.random() * 6000) if (xUri != '//Alice' && xUri != '//Bob') { - try { - const authorityAuthorIdentity = Crypto.makeKeypairFromUri( - `//Alice`, - 'sr25519' - ) - await addAuthority(authorityAuthorIdentity, X.address) - console.log(`🔏 permissions updated`) - await getChainCredits(authorityAuthorIdentity, X.address, 15) - console.log(`💸 Authors endowed with credits`) + try { + const authorityAuthorIdentity = Crypto.makeKeypairFromUri( + `//Alice`, + 'sr25519' + ) + await addAuthority(authorityAuthorIdentity, X.address) + console.log(`🔏 permissions updated`) + await getChainCredits(authorityAuthorIdentity, X.address, 15) + console.log(`💸 Authors endowed with credits`) } catch (err) { - console.log('authority addition: ', err); + console.log('authority addition: ', err) } } @@ -100,15 +100,28 @@ async function main() { ) const api = Cord.ConfigService.get('api') - // Step 2: Create a new Stream - console.log(`\n✉️ Adding a new Stream`, '\n') + // Step 2: Create a new Statement + console.log(`\n✉️ Adding a new Statement`, '\n') + let tx_ext_batch: any = [] let tx_batch: any = [] let startTxPrep = moment() - let txCount = 3000 - let newStreamContent: Cord.IContentStream + let txCount = 10 + // let newStatementContent: Cord.IContentStatement console.log(`\n ✨ Benchmark ${txCount} transactions `) + let signCallback: Cord.SignCallback = async ({ data }) => ({ + signature: XKeys.authentication.sign(data), + keyType: XKeys.authentication.type, + keyUri: `${XDid.uri}${XDid.authentication[0].id}`, + }) + + let extSignCallback: Cord.SignExtrinsicCallback = async ({ data }) => ({ + signature: XKeys.assertionMethod.sign(data), + keyType: XKeys.assertionMethod.type, + }) + + const nextNonce = await Cord.Did.getNextNonce(XDid.uri) for (let j = 0; j < txCount; j++) { let content = { name: 'Bob ' + ': ' + UUID.generate(), @@ -117,21 +130,14 @@ async function main() { gender: 'Male', country: 'India', } - - let schemaStream = await Cord.Content.fromSchemaAndContent( + let schemaStatement = await Cord.Content.fromSchemaAndContent( schema, content, YDid.uri, XDid.uri ) - let signCallback: Cord.SignCallback = async ({ data }) => ({ - signature: XKeys.authentication.sign(data), - keyType: XKeys.authentication.type, - keyUri: `${XDid.uri}${XDid.authentication[0].id}`, - }) - const document = await Cord.Document.fromContent({ - content: schemaStream, + content: schemaStatement, authorization: registryDelegate, registry: registry.identifier, signCallback, @@ -142,35 +148,28 @@ async function main() { moment.duration(moment().diff(startTxPrep)).as('seconds').toFixed(3) + 's\r' ) - let extSignCallback: Cord.SignExtrinsicCallback = async ({ data }) => ({ - signature: XKeys.assertionMethod.sign(data), - keyType: XKeys.assertionMethod.type, - }) try { - // Create a stream object - const { streamHash } = Cord.Stream.fromDocument(document) + // Create a statement object + const { statementHash } = Cord.Statement.fromDocument(document) const authorization = Cord.Registry.uriToIdentifier( document.authorization ) const schemaId = Cord.Registry.uriToIdentifier(document.content.schemaId) - // To create a stream without a schema, use the following line instead: + // To create a statement without a schema, use the following line instead: // const schemaId = null // make sure the registry is not linked with a schema for this to work - const streamTx = api.tx.stream.create(streamHash, authorization, schemaId) + const statementTx = api.tx.statement.create(statementHash, authorization, schemaId) - /* TODO: txCounter is a must have requirement in this case, but it works - because DID is freshly created. Otherwise, it should pick the latest - DID's nonce and then use that. */ - - const txStream = await Cord.Did.authorizeTx( + // As we are creating an array of extrinsics, the counter needs to be updated manually. + const txStatement = await Cord.Did.authorizeTx( XDid.uri, - streamTx, + statementTx, extSignCallback, X.address, - { txCounter: j + 1 } + { txCounter: nextNonce.addn(j) } ) - tx_batch.push(txStream) + tx_ext_batch.push(txStatement) } catch (e: any) { console.log(e.errorCode, '-', e.message) console.log('IN ERROR 1') @@ -178,7 +177,7 @@ async function main() { } let ancStartTime = moment() console.log('\n') - for (let i = 0; i < tx_batch.length; i++) { + for (let i = 0; i < tx_ext_batch.length; i++) { process.stdout.write( ' 🎁 Anchoring ' + (i + 1) + @@ -188,7 +187,7 @@ async function main() { ) try { - await Cord.Chain.signAndSubmitTx(tx_batch[i], X, { + await Cord.Chain.signAndSubmitTx(tx_ext_batch[i], X, { resolveOn: Cord.Chain.IS_READY, rejectOn: Cord.Chain.IS_ERROR, }) @@ -203,15 +202,76 @@ async function main() { console.log( `\n 🙌 Block TPS (extrinsic) - ${+( txCount / ancDuration.as('seconds') - ).toFixed(0)} ` + ).toFixed(0)} \n` ) - /* await sleep(3000) + let batchStartTxPrep = moment() + const Alice = Crypto.makeKeypairFromUri('//Alice', 'sr25519') + for (let j = 0; j < txCount; j++) { + let content = { + name: 'Bob ' + ': ' + UUID.generate(), + age: 29, + id: `${YDid.uri}`, + gender: 'Male', + country: 'India', + } + + let schemaStatement = await Cord.Content.fromSchemaAndContent( + schema, + content, + YDid.uri, + XDid.uri + ) + + const document = await Cord.Document.fromContent({ + content: schemaStatement, + authorization: registryDelegate, + registry: registry.identifier, + signCallback, + }) + + process.stdout.write( + ' 🔖 Extrinsic creation took ' + + moment + .duration(moment().diff(batchStartTxPrep)) + .as('seconds') + .toFixed(3) + + 's\r' + ) + try { + // Create a statement object + const { statementHash } = Cord.Statement.fromDocument(document) + const authorization = Cord.Registry.uriToIdentifier( + document.authorization + ) + const schemaId = Cord.Registry.uriToIdentifier(document.content.schemaId) + // To create a statement without a schema, use the following line instead: + // const schemaId = null + // make sure the registry is not linked with a schema for this to work + const statementTx = api.tx.statement.create(statementHash, authorization, schemaId) + tx_batch.push(statementTx) + } catch (e: any) { + console.log(e.errorCode, '-', e.message) + console.log('IN ERROR 1') + } + } + + const authorizedBatch = await Cord.Did.authorizeBatch({ + batchFunction: api.tx.utility.batchAll, + did: XDid.uri, + extrinsics: tx_batch, + sign: extSignCallback, + submitter: Alice.address, + }) let batchAncStartTime = moment() + try { - api.tx.utility.batchAll(tx_batch).signAndSend(Alice) + await Cord.Chain.signAndSubmitTx(authorizedBatch, Alice, { + resolveOn: Cord.Chain.IS_READY, + rejectOn: Cord.Chain.IS_ERROR, + }) } catch (e: any) { console.log(e.errorCode, '-', e.message) } @@ -221,7 +281,7 @@ async function main() { batchAncEndTime.diff(batchAncStartTime) ) console.log( - `\n 🎁 Anchoring a batch of ${ + `\n\n 🎁 Anchoring a batch of ${ tx_batch.length } extrinsics took ${batchAncDuration.as('seconds')}s` ) @@ -230,7 +290,7 @@ async function main() { txCount / batchAncDuration.as('seconds') ).toFixed(0)} ` ) - */ + await sleep(2000) await api.disconnect() } diff --git a/src/utils/createAccount.ts b/src/utils/createAccount.ts index d5abfb9..85acfaf 100644 --- a/src/utils/createAccount.ts +++ b/src/utils/createAccount.ts @@ -1,5 +1,3 @@ -import { mnemonicGenerate } from '@polkadot/util-crypto' - import * as Cord from '@cord.network/sdk' /** @@ -8,13 +6,15 @@ import * as Cord from '@cord.network/sdk' * mnemonic will be generated. * @returns An object with two properties: account and mnemonic. */ -export function createAccount(mnemonic = mnemonicGenerate()): { +export function createAccount( + mnemonic = Cord.Utils.Crypto.mnemonicGenerate() +): { account: Cord.CordKeyringPair mnemonic: string } { const keyring = new Cord.Utils.Keyring({ ss58Format: 29, - type: 'sr25519', + type: 'ed25519', }) return { account: keyring.addFromMnemonic(mnemonic) as Cord.CordKeyringPair, diff --git a/src/utils/createAuthorities.ts b/src/utils/createAuthorities.ts index 5df60ad..56af913 100644 --- a/src/utils/createAuthorities.ts +++ b/src/utils/createAuthorities.ts @@ -54,13 +54,13 @@ export async function getChainCredits( * @param authorAccount - The account that will be used to sign the transaction. * @param authority - The address of the authority to add. */ -export async function addAuthority( +export async function addNetworkMember( authorAccount: Cord.KeyringPair, authority: Cord.CordAddress ) { const api = Cord.ConfigService.get('api') - const callTx = api.tx.extrinsicAuthorship.add([authority]) + const callTx = api.tx.networkMembership.nominate(authority, false) const sudoTx = await api.tx.sudo.sudo(callTx) diff --git a/src/utils/createDocument.ts b/src/utils/createDocument.ts index 205e331..dcf64e8 100644 --- a/src/utils/createDocument.ts +++ b/src/utils/createDocument.ts @@ -13,8 +13,7 @@ export async function createDocument( holder: Cord.DidUri, issuer: Cord.DidUri, schema: Cord.ISchema, - authorization: Cord.AuthorizationId, - registry: Cord.RegistryId, + chainSpace: Cord.SpaceId, signCallback: Cord.SignCallback ): Promise { const content = Cord.Content.fromSchemaAndContent( @@ -23,17 +22,25 @@ export async function createDocument( name: 'Alice', age: 29, id: '123456789987654321', - gender: 'Female', country: 'India', + address: { + street: 'a', + pin: 54032, + location: { + state: 'Karnataka', + country: 'India', + }, + }, }, holder, issuer ) + console.log(content, chainSpace) const document = Cord.Document.fromContent({ content, - authorization, - registry, + chainSpace, signCallback, + options: {}, }) return document } diff --git a/src/utils/createPresentation.ts b/src/utils/createPresentation.ts index 3913208..f96560a 100644 --- a/src/utils/createPresentation.ts +++ b/src/utils/createPresentation.ts @@ -9,17 +9,33 @@ import * as Cord from '@cord.network/sdk' * @param {string} [challenge] - A challenge string that will be signed by the user's private key. * @returns A promise that resolves to a document presentation. */ -export async function createPresentation( - document: Cord.IDocument, - signCallback: Cord.SignCallback, - selectedAttributes?: string[], - challenge?: string -): Promise { +export async function createPresentation({ + document, + signCallback, + selectedAttributes = [], + challenge, +}: Cord.PresentationOptions): Promise { // Create a presentation with only the specified fields revealed, if specified. return Cord.Document.createPresentation({ document, signCallback, selectedAttributes, challenge, - }) + }); } + + +// export async function createPresentation( +// document, +// signCallback: Cord.SignCallback, +// selectedAttributes?: string[], +// challenge?: string +// ): Promise { +// // Create a presentation with only the specified fields revealed, if specified. +// return Cord.Document.createPresentation({ +// document, +// signCallback, +// selectedAttributes, +// challenge, +// }) +// } diff --git a/src/utils/createRegistrar.ts b/src/utils/createRegistrar.ts new file mode 100644 index 0000000..ef9c544 --- /dev/null +++ b/src/utils/createRegistrar.ts @@ -0,0 +1,101 @@ +import * as Cord from '@cord.network/sdk' +import { BN } from '@polkadot/util' +import { setTimeout } from 'timers/promises' + +/** + * It tries to submit a transaction, and if it fails, it waits a bit and tries again + * @param tx - The transaction to submit. + * @param submitter - The account that will be used to sign the transaction. + */ +async function failproofSubmit( + tx: Cord.SubmittableExtrinsic, + submitter: Cord.KeyringPair +) { + try { + await Cord.Chain.signAndSubmitTx(tx, submitter) + } catch { + // Try a second time after a small delay and fetching the right nonce. + const waitingTime = 6_000 // 6 seconds + console.log( + `First submission failed. Waiting ${waitingTime} ms before retrying.` + ) + await setTimeout(waitingTime) + console.log('Retrying...') + // nonce: -1 tells the client to fetch the latest nonce by also checking the tx pool. + const resignedBatchTx = await tx.signAsync(submitter, { nonce: -1 }) + await Cord.Chain.submitSignedTx(resignedBatchTx) + } +} + +export async function setRegistrar( + authority: Cord.KeyringPair, + registrar: Cord.CordAddress +) { + const api = Cord.ConfigService.get('api') + + const callTx = api.tx.identity.addRegistrar(registrar) + const sudoTx = api.tx.sudo.sudo(callTx) + + await Cord.Chain.signAndSubmitTx(sudoTx, authority) +} + +export async function setIdentity(account: Cord.KeyringPair) { + const identityInfo = { + additional: [[null, null]], + display: { + Raw: 'Cord_Demo', + }, + legal: { + Raw: 'CORD Demo Account', + }, + web: { + Raw: 'dhiway.com', + }, + email: { + Raw: 'engineering@dhiway.com', + }, + } + + const api = Cord.ConfigService.get('api') + + const callTx = api.tx.identity.setIdentity(identityInfo) + + await Cord.Chain.signAndSubmitTx(callTx, account) + + // await failproofSubmit(callTx, account) +} + +export async function requestJudgement( + account: Cord.KeyringPair, + registrar: Cord.CordAddress +) { + const api = Cord.ConfigService.get('api') + + // const identityInfos = await api.query.identity.identityOf(account.address); + // const identityHash = identityInfos.unwrap().info.hash.toHex(); + + const callTx = api.tx.identity.requestJudgement(registrar) + + await Cord.Chain.signAndSubmitTx(callTx, account) + + // await failproofSubmit(callTx, account) +} + +export async function provideJudgement( + registrar: Cord.KeyringPair, + account: Cord.CordAddress +) { + const api = Cord.ConfigService.get('api') + + const identityInfos = await api.query.identity.identityOf(account) + const identityHash = identityInfos.unwrap().info.hash.toHex() + + const callTx = api.tx.identity.provideJudgement( + account, + 'Reasonable', + identityHash + ) + await Cord.Chain.signAndSubmitTx(callTx, registrar) + + // await failproofSubmit(callTx, registrar) +} diff --git a/src/utils/createStatement.ts b/src/utils/createStatement.ts new file mode 100644 index 0000000..93e9f11 --- /dev/null +++ b/src/utils/createStatement.ts @@ -0,0 +1,39 @@ +import * as Cord from '@cord.network/sdk' + +/** + * It creates a statement object on the blockchain + * @param issuer - The DID of the issuer of the document + * @param authorAccount - The account that will be used to sign the extrinsic. + * @param signCallback - A callback function that signs the extrinsic. + * @param document - The document to be referenced by the statement + */ +export async function createStatement( + document: Cord.IDocument, + issuer: Cord.DidUri, + authorization: Cord.AuthorizationId, + authorAccount: Cord.CordKeyringPair, + signCallback: Cord.SignExtrinsicCallback +): Promise { + const api = Cord.ConfigService.get('api') + + // Create a statement object + const statementDetails = Cord.Statement.fromDocument(document) + const authorizationId = Cord.Identifier.uriToIdentifier(authorization) + const schemaId = Cord.Identifier.uriToIdentifier(document.content.schemaId) + // To create a statement without a schema, use the following line instead: + // const schemaId = null + // make sure the registry is not linked with a schema for this to work + const statementTx = api.tx.statement.register( + statementDetails.digest, + authorizationId, + schemaId + ) + + const authorizedStatementTx = await Cord.Did.authorizeTx( + issuer, + statementTx, + signCallback, + authorAccount.address + ) + await Cord.Chain.signAndSubmitTx(authorizedStatementTx, authorAccount) +} diff --git a/src/utils/createStream.ts b/src/utils/createStream.ts deleted file mode 100644 index 6dd8fe6..0000000 --- a/src/utils/createStream.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as Cord from '@cord.network/sdk' - -/** - * It creates a stream object on the blockchain - * @param issuer - The DID of the issuer of the document - * @param authorAccount - The account that will be used to sign the extrinsic. - * @param signCallback - A callback function that signs the extrinsic. - * @param document - The document to be referenced by the stream - */ -export async function createStream( - issuer: Cord.DidUri, - authorAccount: Cord.CordKeyringPair, - signCallback: Cord.SignExtrinsicCallback, - document: Cord.IDocument -): Promise { - const api = Cord.ConfigService.get('api') - - // Create a stream object - const { streamHash } = Cord.Stream.fromDocument(document) - const authorization = Cord.Registry.uriToIdentifier(document.authorization) - const schemaId = Cord.Registry.uriToIdentifier(document.content.schemaId) - // To create a stream without a schema, use the following line instead: - // const schemaId = null - // make sure the registry is not linked with a schema for this to work - const streamTx = api.tx.stream.create(streamHash, authorization, schemaId) - - const authorizedStreamTx = await Cord.Did.authorizeTx( - issuer, - streamTx, - signCallback, - authorAccount.address - ) - await Cord.Chain.signAndSubmitTx(authorizedStreamTx, authorAccount) -} diff --git a/src/utils/generateChainSpace.ts b/src/utils/generateChainSpace.ts new file mode 100644 index 0000000..9d1d134 --- /dev/null +++ b/src/utils/generateChainSpace.ts @@ -0,0 +1,119 @@ +import * as Cord from '@cord.network/sdk' + +export async function ensureStoredChainSpace( + authorAccount: Cord.CordKeyringPair, + creator: Cord.DidUri, + signCallback: Cord.SignExtrinsicCallback +): Promise { + const api = Cord.ConfigService.get('api') + + const txSpace: Cord.IChainSpace = await Cord.ChainSpace.createChainSpace( + creator + ) + + const exists = await Cord.ChainSpace.isChainSpaceStored(txSpace.identifier) + if (exists) { + console.log('Space already exists. Skipping creation') + return txSpace + } else { + console.log('Space not present. Creating it now...') + + const tx = api.tx.chainSpace.create(txSpace.digest) + const extrinsic = await Cord.Did.authorizeTx( + creator, + tx, + signCallback, + authorAccount.address + ) + + await Cord.Chain.signAndSubmitTx(extrinsic, authorAccount) + + return txSpace + } +} + +export async function approveSpace( + authority: Cord.KeyringPair, + spaceUri: Cord.IChainSpace['identifier'] +) { + const api = Cord.ConfigService.get('api') + const spaceId = Cord.Identifier.uriToIdentifier(spaceUri) + + const callTx = api.tx.chainSpace.approve(spaceId, 1000) + const sudoTx = api.tx.sudo.sudo(callTx) + + await Cord.Chain.signAndSubmitTx(sudoTx, authority) +} + +export async function addSpaceAuthorization( + authorAccount: Cord.CordKeyringPair, + spaceDelegate: Cord.DidUri, + creator: Cord.DidUri, + spaceUri: Cord.IChainSpace['identifier'], + authUri: Cord.IChainSpace['authorization'], + signCallback: Cord.SignExtrinsicCallback +): Promise { + const api = Cord.ConfigService.get('api') + + const spaceId = Cord.Identifier.uriToIdentifier(spaceUri) + const authId = Cord.Identifier.uriToIdentifier(authUri) + const delegateId = Cord.Did.toChain(spaceDelegate) + + const delegateAuthId = await Cord.ChainSpace.createChainSpaceDelegate( + spaceUri, + spaceDelegate, + creator + ) + const authorizationExists = await Cord.ChainSpace.isAuthorizationStored( + delegateAuthId.authorization + ) + if (authorizationExists) { + console.log('Authorization already stored. Skipping addition') + } else { + console.log('Authorization not present. Creating it now...') + + const tx = api.tx.chainSpace.addDelegate(spaceId, delegateId, authId) + const extrinsic = await Cord.Did.authorizeTx( + creator, + tx, + signCallback, + authorAccount.address + ) + + await Cord.Chain.signAndSubmitTx(extrinsic, authorAccount) + } + return delegateAuthId +} + +// export async function addSpaceAdminAuthorization( +// authorAccount: Cord.CordKeyringPair, +// creator: Cord.DidUri, +// spaceUri: Cord.IChainSpace['spaceId'], +// authUri: Cord.IChainSpace['authorizationId'], +// spaceDelegate: Cord.DidUri, +// signCallback: Cord.SignExtrinsicCallback +// ): Promise { +// const api = Cord.ConfigService.get('api') + +// const spaceId = Cord.Identifier.uriToIdentifier(spaceUri) +// const authId = Cord.Identifier.uriToIdentifier(authUri) +// const delegateId = Cord.Did.toChain(spaceDelegate) + +// try { +// await Cord.ChainSpace.isAuthorization(authId) +// console.log('Authorization already stored. Skipping addition') +// return authId +// } catch { +// console.log('Authorization not present. Creating it now...') +// const tx = api.tx.chainSpace.addAdminDelegate(spaceId, delegateId, authId) +// const extrinsic = await Cord.Did.authorizeTx( +// creator, +// tx, +// signCallback, +// authorAccount.address +// ) +// await Cord.Chain.signAndSubmitTx(extrinsic, authorAccount) + +// return authId +// } +// } diff --git a/src/utils/generateDid.ts b/src/utils/generateDid.ts index 4123e5a..f23517b 100644 --- a/src/utils/generateDid.ts +++ b/src/utils/generateDid.ts @@ -38,6 +38,7 @@ export async function createDid( }, ], }, + submitterAccount.address, async ({ data }) => ({ signature: authentication.sign(data), keyType: authentication.type, @@ -47,7 +48,7 @@ export async function createDid( await Cord.Chain.signAndSubmitTx(didCreationTx, submitterAccount) const didUri = Cord.Did.getDidUriFromKey(authentication) - const encodedDid = await api.call.did.query(Cord.Did.toChain(didUri)) + const encodedDid = await api.call.didApi.query(Cord.Did.toChain(didUri)) const { document } = Cord.Did.linkedInfoFromChain(encodedDid) if (!document) { diff --git a/src/utils/generateDidName.ts b/src/utils/generateDidName.ts index 0c5e40a..69bb65b 100644 --- a/src/utils/generateDidName.ts +++ b/src/utils/generateDidName.ts @@ -16,8 +16,8 @@ export async function createDidName( ): Promise { const api = Cord.ConfigService.get('api') - console.log("Did - ", did, name) - const didNameClaimTx = api.tx.didNames.register(name) + console.log('Did - ', did, name) + const didNameClaimTx = api.tx.didName.register(name) const authorizedDidNameClaimTx = await Cord.Did.authorizeTx( did, didNameClaimTx, diff --git a/src/utils/generateKeypairs.ts b/src/utils/generateKeypairs.ts index a5fd847..e4d9f4e 100644 --- a/src/utils/generateKeypairs.ts +++ b/src/utils/generateKeypairs.ts @@ -5,7 +5,7 @@ import { keyFromPath, mnemonicGenerate, mnemonicToMiniSecret, - sr25519PairFromSeed, + ed25519PairFromSeed, } from '@polkadot/util-crypto' import { createAccount } from './createAccount' @@ -15,9 +15,9 @@ import { createAccount } from './createAccount' * @returns A keypair for encryption. */ function generateKeyAgreement(mnemonic: string) { - const secretKeyPair = sr25519PairFromSeed(mnemonicToMiniSecret(mnemonic)) + const secretKeyPair = ed25519PairFromSeed(mnemonicToMiniSecret(mnemonic)) const { path } = keyExtractPath('//did//keyAgreement//0') - const { secretKey } = keyFromPath(secretKeyPair, path, 'sr25519') + const { secretKey } = keyFromPath(secretKeyPair, path, 'ed25519') return Cord.Utils.Crypto.makeEncryptionKeypairFromSeed(blake2AsU8a(secretKey)) } @@ -31,18 +31,18 @@ export function generateKeypairs(mnemonic = mnemonicGenerate()) { const { account } = createAccount(mnemonic) const authentication = { - ...account.derive('//did//0'), - type: 'sr25519', + ...account.derive('//did//authentication//0'), + type: 'ed25519', } as Cord.CordKeyringPair const assertionMethod = { ...account.derive('//did//assertion//0'), - type: 'sr25519', + type: 'ed25519', } as Cord.CordKeyringPair const capabilityDelegation = { ...account.derive('//did//delegation//0'), - type: 'sr25519', + type: 'ed25519', } as Cord.CordKeyringPair const keyAgreement = generateKeyAgreement(mnemonic) diff --git a/src/utils/generateRegistry.ts b/src/utils/generateRegistry.ts deleted file mode 100644 index 78437e4..0000000 --- a/src/utils/generateRegistry.ts +++ /dev/null @@ -1,156 +0,0 @@ -import * as Cord from '@cord.network/sdk' -import { randomUUID } from 'crypto' - -/** - * It creates a registry if it doesn't exist, and returns it - * @param authorAccount - The account that will be used to sign and submit the extrinsic. - * @param creator - The DID of the creator of the registry. - * @param schemaUri - The URI of the schema to be used for the registry. - * @param signCallback - A callback function that will be called when the transaction needs to be - * signed. - * @returns The registry that was created. - */ -export async function ensureStoredRegistry( - authorAccount: Cord.CordKeyringPair, - creator: Cord.DidUri, - schemaUri: Cord.ISchema['$id'], - signCallback: Cord.SignExtrinsicCallback -): Promise { - const api = Cord.ConfigService.get('api') - - const registryTitle = `Registry v3.${randomUUID().substring(0, 4)}` - const registryDetails: Cord.IContents = { - title: registryTitle, - description: 'Registry for demo', - } - - const registryType: Cord.IRegistryType = { - details: registryDetails, - schema: schemaUri, - creator: creator, - } - - const txRegistry: Cord.IRegistry = - Cord.Registry.fromRegistryProperties(registryType) - - try { - await Cord.Registry.verifyStored(txRegistry) - console.log('Registry already stored. Skipping creation') - return txRegistry - } catch { - console.log('Regisrty not present. Creating it now...') - // Authorize the tx. - const schemaId = Cord.Schema.idToChain(schemaUri) - // To create a registry without a schema, use the following line instead: - // const schemaId = null - const tx = api.tx.registry.create(txRegistry.details, schemaId) - const extrinsic = await Cord.Did.authorizeTx( - creator, - tx, - signCallback, - authorAccount.address - ) - // Write to chain then return the Schema. - await Cord.Chain.signAndSubmitTx(extrinsic, authorAccount) - - return txRegistry - } -} - -/** - * `addRegistryAdminDelegate` adds an admin delegate to a registry - * @param authorAccount - The account that will be used to sign and submit the extrinsic. - * @param creator - The DID of the creator of the registry. - * @param registryUri - The URI of the registry you want to add the admin to. - * @param adminAuthority - The DID of the admin authority to add. - * @param signCallback - A callback function that will be called when the transaction needs to be - * signed. - * @returns The authorization id. - */ -export async function addRegistryAdminDelegate( - authorAccount: Cord.CordKeyringPair, - creator: Cord.DidUri, - registryUri: Cord.IRegistry['identifier'], - adminAuthority: Cord.DidUri, - signCallback: Cord.SignExtrinsicCallback -): Promise { - const api = Cord.ConfigService.get('api') - - const authId = Cord.Registry.getAuthorizationIdentifier( - registryUri, - adminAuthority, - creator - ) - - try { - await Cord.Registry.verifyAuthorization(authId) - console.log('Registry Authorization already stored. Skipping addition') - return authId - } catch { - console.log('Regisrty Authorization not present. Creating it now...') - // Authorize the tx. - const registryId = Cord.Registry.uriToIdentifier(registryUri) - const delegateId = Cord.Did.toChain(adminAuthority) - console.log(registryId, delegateId, authId, creator) - const tx = api.tx.registry.addAdminDelegate(registryId, delegateId) - const extrinsic = await Cord.Did.authorizeTx( - creator, - tx, - signCallback, - authorAccount.address - ) - // Write to chain then return the Schema. - await Cord.Chain.signAndSubmitTx(extrinsic, authorAccount) - - return authId - } -} - -/** - * `addRegistryDelegate` adds a delegate to a registry - * @param authorAccount - The account that will be used to sign and submit the extrinsic. - * @param creator - The DID of the account that will be creating the authorization. - * @param registryUri - The URI of the registry you want to add the delegate to. - * @param registryDelegate - The DID of the delegate to add to the registry. - * @param signCallback - A callback function that will be called when the transaction needs to be - * signed. - * @returns The authorization id - */ -export async function addRegistryDelegate( - authorAccount: Cord.CordKeyringPair, - creator: Cord.DidUri, - registryUri: Cord.IRegistry['identifier'], - registryDelegate: Cord.DidUri, - signCallback: Cord.SignExtrinsicCallback -): Promise { - const api = Cord.ConfigService.get('api') - - const authId = Cord.Registry.getAuthorizationIdentifier( - registryUri, - registryDelegate, - creator - ) - - try { - await Cord.Registry.verifyAuthorization(authId) - console.log('Registry Authorization already stored. Skipping addition') - return authId - } catch { - console.log('Regisrty Authorization not present. Creating it now...') - // Authorize the tx. - const registryId = Cord.Registry.uriToIdentifier(registryUri) - const delegateId = Cord.Did.toChain(registryDelegate) - - const tx = api.tx.registry.addDelegate(registryId, delegateId) - const extrinsic = await Cord.Did.authorizeTx( - creator, - tx, - signCallback, - authorAccount.address - ) - // Write to chain then return the Schema. - await Cord.Chain.signAndSubmitTx(extrinsic, authorAccount) - - return authId - } -} diff --git a/src/utils/generateSchema.ts b/src/utils/generateSchema.ts index a1faefc..f751ccc 100644 --- a/src/utils/generateSchema.ts +++ b/src/utils/generateSchema.ts @@ -15,35 +15,48 @@ export async function ensureStoredSchema( ): Promise { const api = Cord.ConfigService.get('api') + // TODO: Enable required field support within subschemas const schema = Cord.Schema.fromProperties( 'Test Demo Schema v2', { name: { type: 'string', }, - id: { - type: 'string', - }, age: { type: 'integer', }, - gender: { + id: { type: 'string', }, country: { type: 'string', }, + address: { + type: 'object', + properties: { + street: { type: 'string' }, + pin: { type: 'integer' }, + location: { + type: 'object', + properties: { + state: { type: 'string' }, + country: { type: 'string' }, + }, + }, + }, + }, }, + ['name', 'id', 'age'], creator ) - try { - await Cord.Schema.verifyStored(schema) + const exists = await Cord.Schema.isSchemaStored(schema) + if (exists) { console.log('Schema already stored. Skipping creation') return schema - } catch { + } else { console.log('Schema not present. Creating it now...') - // Authorize the tx. + const encodedSchema = Cord.Schema.toChain(schema) const tx = api.tx.schema.create(encodedSchema) const extrinsic = await Cord.Did.authorizeTx( @@ -52,7 +65,7 @@ export async function ensureStoredSchema( signCallback, authorAccount.address ) - // Write to chain then return the Schema. + await Cord.Chain.signAndSubmitTx(extrinsic, authorAccount) return schema diff --git a/src/utils/queryDidName.ts b/src/utils/queryDidName.ts index ccead5e..a366828 100644 --- a/src/utils/queryDidName.ts +++ b/src/utils/queryDidName.ts @@ -12,7 +12,7 @@ export async function getDidDocFromName( console.log(`\n❄️ Resolve DID name ${didName} `) // Query the owner of the provided didName. - const encodedDidNameOwner = await api.call.did.queryByName(didName) + const encodedDidNameOwner = await api.call.didApi.queryByName(didName) const { document: { uri }, diff --git a/src/utils/revokeCredential.ts b/src/utils/revokeCredential.ts index ee582ae..aff05ff 100644 --- a/src/utils/revokeCredential.ts +++ b/src/utils/revokeCredential.ts @@ -1,7 +1,7 @@ import * as Cord from '@cord.network/sdk' /** - * It revokes or remove a stream from CORD + * It revokes or remove a statement from CORD * @param issuer - The DID of the issuer. * @param authorAccount - The account that will be used to sign and submit the extrinsic. * @param signCallback - A callback function that will be called when the transaction needs to be @@ -15,15 +15,13 @@ export async function revokeCredential( authorAccount: Cord.CordKeyringPair, signCallback: Cord.SignExtrinsicCallback, document: Cord.IDocument, - shouldRemove = false + authorization: Cord.AuthorizationId ): Promise { const api = Cord.ConfigService.get('api') - const chainIdentifier = Cord.Stream.idToChain(document.identifier) - const authorization = Cord.Registry.uriToIdentifier(document.authorization) + const chainIdentifier = Cord.Identifier.uriToIdentifier(document.identifier) + const authorizationId = Cord.Identifier.uriToIdentifier(authorization) - const tx = shouldRemove - ? api.tx.stream.remove(chainIdentifier, authorization) - : api.tx.stream.revoke(chainIdentifier, authorization) + const tx = api.tx.statement.revoke(chainIdentifier, authorizationId) const authorizedTx = await Cord.Did.authorizeTx( issuer, diff --git a/src/utils/updateDocument.ts b/src/utils/updateDocument.ts new file mode 100644 index 0000000..0efb1ac --- /dev/null +++ b/src/utils/updateDocument.ts @@ -0,0 +1,16 @@ +import * as Cord from '@cord.network/sdk' + +export async function updateDocument( + updateContent: Cord.IDocumentUpdate, + schema: Cord.ISchema, + signCallback: Cord.SignCallback +): Promise { + const updatedDocument = await Cord.Document.fromUpdatedContent({ + document: updateContent, + schema, + signCallback, + options: {}, + }) + + return updatedDocument +} diff --git a/src/utils/updateStatement.ts b/src/utils/updateStatement.ts new file mode 100644 index 0000000..bc485c6 --- /dev/null +++ b/src/utils/updateStatement.ts @@ -0,0 +1,37 @@ +import * as Cord from '@cord.network/sdk' + +/** + * It creates a statement object on the blockchain + * @param issuer - The DID of the issuer of the document + * @param authorAccount - The account that will be used to sign the extrinsic. + * @param signCallback - A callback function that signs the extrinsic. + * @param document - The document to be referenced by the statement + */ +export async function updateStatement( + document: Cord.IDocument, + issuer: Cord.DidUri, + authorization: Cord.AuthorizationId, + authorAccount: Cord.CordKeyringPair, + signCallback: Cord.SignExtrinsicCallback +): Promise { + const api = Cord.ConfigService.get('api') + + // Create a statement object + const statementDetails = Cord.Statement.fromDocument(document) + const statementId = Cord.Identifier.uriToIdentifier(document.identifier) + const authorizationId = Cord.Identifier.uriToIdentifier(authorization) + + const statementTx = api.tx.statement.update( + statementId, + statementDetails.digest, + authorizationId + ) + + const authorizedStatementTx = await Cord.Did.authorizeTx( + issuer, + statementTx, + signCallback, + authorAccount.address + ) + await Cord.Chain.signAndSubmitTx(authorizedStatementTx, authorAccount) +} diff --git a/src/utils/verifyPresentation.ts b/src/utils/verifyPresentation.ts index eeb33f6..5c9fde8 100644 --- a/src/utils/verifyPresentation.ts +++ b/src/utils/verifyPresentation.ts @@ -1,7 +1,7 @@ import * as Cord from '@cord.network/sdk' /** - * It verifies a presentation by checking the stream on the blockchain and verifying the presentation + * It verifies a presentation by checking the statement on the blockchain and verifying the presentation * with the provided challenge * @param presentation - The presentation to verify. * @param - `presentation` - The presentation to verify. @@ -16,21 +16,21 @@ export async function verifyPresentation( challenge?: string trustedIssuerUris?: Cord.DidUri[] } = {} -): Promise { +): Promise<{ isValid: boolean; message: string }> { try { // Verify the presentation with the provided challenge. - await Cord.Document.verifyPresentation(presentation, { challenge }) + await Cord.Document.verifyPresentation(presentation, { + challenge, + }) - // Verify the credential by checking the stream on the blockchain. - const api = Cord.ConfigService.get('api') - const chainIdentifier = Cord.Stream.idToChain(presentation.identifier) - const streamOnChain = await api.query.stream.streams(chainIdentifier) - const stream = Cord.Stream.fromChain(streamOnChain, chainIdentifier) - if (stream.revoked) { - return false - } - return trustedIssuerUris.includes(stream.issuer) + const { isValid, message } = + await Cord.Document.verifyPresentationDocumentStatus(presentation, { + challenge, + trustedIssuerUris, + }) + + return { isValid, message } } catch { - return false + return { isValid: false, message: 'Verification failed!' } } } diff --git a/yarn.lock b/yarn.lock index f657edb..58aa34b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,128 +2,171 @@ # yarn lockfile v1 -"@babel/runtime@^7.20.13", "@babel/runtime@^7.20.6": - version "7.22.6" - resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz" - integrity sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ== - dependencies: - regenerator-runtime "^0.13.11" - -"@cord.network/augment-api@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/augment-api/-/augment-api-0.8.0-3.tgz" - integrity sha512-Klt4s0ioRv8Lo9eC2zd0xdG5Q7XX9E5p4n373UlRzXQuLPedGlntAv1DeugxyF+UOM7lIKjbPz+56K8Rz8IFTA== - dependencies: - "@cord.network/type-definitions" "0.8.0-3" - -"@cord.network/config@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/config/-/config-0.8.0-3.tgz" - integrity sha512-8mRS74fORcx5V7J2sHuPI3ksMXzWGioLc321qeZlA1Qj3H+FNgfiWyx6iZNZPr1CtnbwfOXAn/xRg8FeaqOqAQ== - dependencies: - "@cord.network/types" "0.8.0-3" - "@cord.network/utils" "0.8.0-3" - "@polkadot/api" "^9.10.2" +"@cbor-extract/cbor-extract-darwin-arm64@2.1.1": + version "2.1.1" + resolved "https://registry.npmjs.org/@cbor-extract/cbor-extract-darwin-arm64/-/cbor-extract-darwin-arm64-2.1.1.tgz" + integrity sha512-blVBy5MXz6m36Vx0DfLd7PChOQKEs8lK2bD1WJn/vVgG4FXZiZmZb2GECHFvVPA5T7OnODd9xZiL3nMCv6QUhA== + +"@cord.network/augment-api@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/augment-api/-/augment-api-0.9.0-1beta6.tgz" + integrity sha512-nxQGsgg/qdv+LIO2ZEa0ySEoz5UGynkEiO6lmHUhDd0AIkwlccs9nEXbYYYNizQod+JRmA0MTTk4VsD5Z8Z/WA== + dependencies: + "@cord.network/type-definitions" "0.9.0-1beta6" + "@polkadot/rpc-augment" "^10.10.1" + "@polkadot/rpc-core" "^10.10.1" + "@polkadot/rpc-provider" "^10.10.1" + glob "^7.1.1" + +"@cord.network/chain-space@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/chain-space/-/chain-space-0.9.0-1beta6.tgz" + integrity sha512-63LNCxwLxbTf1Dr4wKKWhO9RJnZfagjzBeq5AAceks0HGy+t7TdIqt+cbfDPTUNY718u8x7qdM86YDo4HKUHiQ== + dependencies: + "@cord.network/config" "0.9.0-1beta6" + "@cord.network/did" "0.9.0-1beta6" + "@cord.network/identifier" "0.9.0-1beta6" + "@cord.network/network" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + +"@cord.network/config@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/config/-/config-0.9.0-1beta6.tgz" + integrity sha512-MWr71MPoc8ULEZbq9epHaAABHgBl6SsQnAn9h7XH4R3wEfpD3BFXXSn3qxRAfH/dfDTs/QghPsP2nnQb8G3wGQ== + dependencies: + "@cord.network/type-definitions" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" typescript-logging "^1.0.0" -"@cord.network/did@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/did/-/did-0.8.0-3.tgz" - integrity sha512-85+rqLjoGgVQWccUhvmwy4+G30pcKm6qAI++KsnWJcmhT1SIWRawaKR6PduGFKb9pKEkUTvmN7pCxinZiyvX/w== - dependencies: - "@cord.network/augment-api" "0.8.0-3" - "@cord.network/config" "0.8.0-3" - "@cord.network/types" "0.8.0-3" - "@cord.network/utils" "0.8.0-3" - "@polkadot/api" "^9.10.2" - "@polkadot/keyring" "^10.2.1" - "@polkadot/types" "^9.10.2" - "@polkadot/types-codec" "^9.10.2" - "@polkadot/util" "^10.2.1" - "@polkadot/util-crypto" "^10.2.1" - -"@cord.network/messaging@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/messaging/-/messaging-0.8.0-3.tgz" - integrity sha512-379K+tL/4icVA4uuBIu/OOWacMAtjflNLzEdOZV/IWzYrpUqKu+xM64XK8Yu2S10GcCs03CX6NUJF2PYdSEnWQ== - dependencies: - "@cord.network/did" "0.8.0-3" - "@cord.network/modules" "0.8.0-3" - "@cord.network/types" "0.8.0-3" - "@cord.network/utils" "0.8.0-3" - "@polkadot/util" "^10.2.1" - -"@cord.network/modules@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/modules/-/modules-0.8.0-3.tgz" - integrity sha512-zFUylFrIOW6qAX4wZkdILJZCjBwjGPY8t9yMRgl3xzgNKZYzchmDnPO3+UPSb9yDKXRZVab3zvKE7U+DYGvpBw== - dependencies: - "@cord.network/augment-api" "0.8.0-3" - "@cord.network/config" "0.8.0-3" - "@cord.network/did" "0.8.0-3" - "@cord.network/network" "0.8.0-3" - "@cord.network/type-definitions" "0.8.0-3" - "@cord.network/types" "0.8.0-3" - "@cord.network/utils" "0.8.0-3" - "@polkadot/api" "^9.10.2" - "@polkadot/keyring" "^10.0.0" - "@polkadot/types" "^9.10.2" - "@polkadot/util" "^10.2.1" - "@polkadot/util-crypto" "^10.2.1" - -"@cord.network/network@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/network/-/network-0.8.0-3.tgz" - integrity sha512-bEzV2I35Jvfa75VmE9L/Gqt6Db1tJdBuAeqUfu/GvZO4CIT4HnzOsHzdtF1zQGxkasdpc7GTetksf3hvxGWvsA== - dependencies: - "@cord.network/config" "0.8.0-3" - "@cord.network/types" "0.8.0-3" - "@cord.network/utils" "0.8.0-3" - "@polkadot/api" "^9.10.2" - "@polkadot/types" "^9.10.2" - -"@cord.network/sdk@^0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/sdk/-/sdk-0.8.0-3.tgz" - integrity sha512-d/5GauZJhkKeuEKO1Lwc+HUEQlcuXDBTTU4o1KTHVn5Wn+mQ8I/ADq45+hDtYEnVhuCSgCrgeY6eB7TLvGly1g== - dependencies: - "@cord.network/config" "0.8.0-3" - "@cord.network/did" "0.8.0-3" - "@cord.network/messaging" "0.8.0-3" - "@cord.network/modules" "0.8.0-3" - "@cord.network/network" "0.8.0-3" - "@cord.network/types" "0.8.0-3" - "@cord.network/utils" "0.8.0-3" - -"@cord.network/type-definitions@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/type-definitions/-/type-definitions-0.8.0-3.tgz" - integrity sha512-wDXtDDUDGmMscuP4XGwuEn8AvzgXEoOwN1NSjDH7/rD4SpnaRNkJyxvBaJ8OhaXXNXRl1YDkcVmt2cd7DaBuGg== - -"@cord.network/types@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/types/-/types-0.8.0-3.tgz" - integrity sha512-mzFb7m9s7/NZpBvWLtEL0Rr9EjQfRa7OeEQB6okg4A58JSlAaDeu0RpBknRC3PIGXhn9MLKUJ5qWb5uOj/fBmg== - dependencies: - "@polkadot/api" "^9.10.2" - "@polkadot/keyring" "^10.2.1" - "@polkadot/types" "^9.10.2" - "@polkadot/util" "^10.2.1" - "@polkadot/util-crypto" "^10.2.1" - -"@cord.network/utils@0.8.0-3": - version "0.8.0-3" - resolved "https://registry.npmjs.org/@cord.network/utils/-/utils-0.8.0-3.tgz" - integrity sha512-ybS25xIkNHKXHstNOybVbZBeLtdKySynWOJ7NPKTHVanhCcYP14vzqgf4NFE9rBa327lM/R/BLx3K4TmbZyY2A== - dependencies: - "@cord.network/types" "0.8.0-3" - "@polkadot/api" "^9.10.2" - "@polkadot/keyring" "^10.2.1" - "@polkadot/util" "^10.2.1" - "@polkadot/util-crypto" "^10.2.1" +"@cord.network/did@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/did/-/did-0.9.0-1beta6.tgz" + integrity sha512-amzpOyB570dS34OjiCEjVwSs47rXvPFSw9mfnIDC+kfn9r5eDmRK51GTr7bulxl+iNkaqg90VKvPS2Sw6ix51g== + dependencies: + "@cord.network/augment-api" "0.9.0-1beta6" + "@cord.network/config" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + "@digitalbazaar/security-context" "^1.0.0" + "@polkadot/api" "^10.10.1" + "@polkadot/keyring" "^12.5.1" + "@polkadot/types" "^10.10.1" + "@polkadot/types-codec" "^10.10.1" + "@polkadot/util" "^12.5.1" + "@polkadot/util-crypto" "^12.5.1" + +"@cord.network/identifier@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/identifier/-/identifier-0.9.0-1beta6.tgz" + integrity sha512-dhA0VgV2M38PgQm9cmf9UfH+Oij2iClTYreFfQL7oCN8Y10HHcjSW9A16USW7NRSL5l2hEQxvdB7ptvm9sNWhQ== + dependencies: + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + +"@cord.network/network-score@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/network-score/-/network-score-0.9.0-1beta6.tgz" + integrity sha512-/xzNmOwM7/XFHCTQhHCi3CvYJDX7T3yp2FytPf06b118Yc+7ZFSAqrWnt+qwOHxdyMYBfYSSViLKiVIZDdSYXQ== + dependencies: + "@cord.network/config" "0.9.0-1beta6" + "@cord.network/did" "0.9.0-1beta6" + "@cord.network/identifier" "0.9.0-1beta6" + "@cord.network/network" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + +"@cord.network/network@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/network/-/network-0.9.0-1beta6.tgz" + integrity sha512-fddTcho8lkqnWFDtXc9GTn7D0ObDfzJfFNIdngTdVY2qcSNeUzSqYucqxiofozYpsRuXOU/6myOp4ez4o0vRAg== + dependencies: + "@cord.network/config" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + "@polkadot/api" "^10.10.1" + "@polkadot/types" "^10.10.1" + +"@cord.network/schema@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/schema/-/schema-0.9.0-1beta6.tgz" + integrity sha512-FzmrWw0ocV/YzdunIUbOo4Zuw4a6lpn6vy5nh9bf9F2/RKAQKU29WiBpmZ/w0lwxdXXJbDCVys9kJuzYldPHBQ== + dependencies: + "@cord.network/augment-api" "0.9.0-1beta6" + "@cord.network/chain-space" "0.9.0-1beta6" + "@cord.network/config" "0.9.0-1beta6" + "@cord.network/did" "0.9.0-1beta6" + "@cord.network/identifier" "0.9.0-1beta6" + "@cord.network/network" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + +"@cord.network/sdk@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/sdk/-/sdk-0.9.0-1beta6.tgz" + integrity sha512-8mScj6CJCuXA/7QofFsDVY5/xLD+3Bpl0OoVZ2eHUJOnztekMbiqveM3wZ/uMRVm3txsHnDfyq2+AJLUy8ig8A== + dependencies: + "@cord.network/chain-space" "0.9.0-1beta6" + "@cord.network/config" "0.9.0-1beta6" + "@cord.network/did" "0.9.0-1beta6" + "@cord.network/identifier" "0.9.0-1beta6" + "@cord.network/network" "0.9.0-1beta6" + "@cord.network/network-score" "0.9.0-1beta6" + "@cord.network/schema" "0.9.0-1beta6" + "@cord.network/statement" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + +"@cord.network/statement@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/statement/-/statement-0.9.0-1beta6.tgz" + integrity sha512-5XGD2zORZbF+6ZxoOQNvM6e7zkubtl7fGdtNMv8AnrFdj2FaH1HG/9vGt3vtIzkOgCk2cNBueHhZA3QB0LOlrQ== + dependencies: + "@cord.network/config" "0.9.0-1beta6" + "@cord.network/did" "0.9.0-1beta6" + "@cord.network/identifier" "0.9.0-1beta6" + "@cord.network/network" "0.9.0-1beta6" + "@cord.network/types" "0.9.0-1beta6" + "@cord.network/utils" "0.9.0-1beta6" + +"@cord.network/type-definitions@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/type-definitions/-/type-definitions-0.9.0-1beta6.tgz" + integrity sha512-v8PPFYd57ubtVXc30ZC5fyUHq2iPl3nxwH58ySnySuhA7C/7HFR7xx2mGJZpyKmRgSCEaLQB6wlF0RCGuda5zw== + dependencies: + "@polkadot/types" "^10.10.1" + +"@cord.network/types@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/types/-/types-0.9.0-1beta6.tgz" + integrity sha512-N2t7oTILdAUQiT7uZxaGe75GkuK+/sGcx2zISR5eUlbf1gE01cyQuibpLkmO4bjqGUZbWsoLL60NIKV2au5Eig== + dependencies: + "@polkadot/api" "^10.10.1" + "@polkadot/keyring" "^12.5.1" + "@polkadot/types" "^10.10.1" + "@polkadot/util" "^12.5.1" + "@polkadot/util-crypto" "^12.5.1" + +"@cord.network/utils@0.9.0-1beta6": + version "0.9.0-1beta6" + resolved "https://registry.npmjs.org/@cord.network/utils/-/utils-0.9.0-1beta6.tgz" + integrity sha512-Uus4lzaBlemZXoCfSIn6a1g65SGQodvvJsmri7iRrZ79t4dSAtbWk3bf1boPnoaiCz6aAOSPp22W6q9Kjn7j5g== + dependencies: + "@cord.network/types" "0.9.0-1beta6" + "@polkadot/api" "^10.10.1" + "@polkadot/keyring" "^12.5.1" + "@polkadot/util" "^12.5.1" + "@polkadot/util-crypto" "^12.5.1" + cbor-x "^1.5.4" tweetnacl "^1.0.3" uuid "^9.0.0" +"@digitalbazaar/security-context@^1.0.0": + version "1.0.1" + resolved "https://registry.npmjs.org/@digitalbazaar/security-context/-/security-context-1.0.1.tgz" + integrity sha512-0WZa6tPiTZZF8leBtQgYAfXQePFQp2z5ivpCEN/iZguYYZ0TB9qRmWtan5XH6mNFuusHtMcyIzAcReyE6rZPhA== + "@esbuild-kit/cjs-loader@^2.4.2": version "2.4.2" resolved "https://registry.npmjs.org/@esbuild-kit/cjs-loader/-/cjs-loader-2.4.2.tgz" @@ -153,450 +196,434 @@ resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz" integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== -"@noble/hashes@1.2.0": +"@noble/curves@^1.2.0": version "1.2.0" - resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz" - integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== - -"@noble/secp256k1@1.7.1": - version "1.7.1" - resolved "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz" - integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw== - -"@polkadot/api-augment@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-9.14.2.tgz" - integrity sha512-19MmW8AHEcLkdcUIo3LLk0eCQgREWqNSxkUyOeWn7UiNMY1AhDOOwMStUBNCvrIDK6VL6GGc1sY7rkPCLMuKSw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/api-base" "9.14.2" - "@polkadot/rpc-augment" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-augment" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/api-base@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/api-base/-/api-base-9.14.2.tgz" - integrity sha512-ky9fmzG1Tnrjr/SBZ0aBB21l0TFr+CIyQenQczoUyVgiuxVaI/2Bp6R2SFrHhG28P+PW2/RcYhn2oIAR2Z2fZQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/util" "^10.4.2" - rxjs "^7.8.0" - -"@polkadot/api-derive@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-9.14.2.tgz" - integrity sha512-yw9OXucmeggmFqBTMgza0uZwhNjPxS7MaT7lSCUIRKckl1GejdV+qMhL3XFxPFeYzXwzFpdPG11zWf+qJlalqw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/api" "9.14.2" - "@polkadot/api-augment" "9.14.2" - "@polkadot/api-base" "9.14.2" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" - rxjs "^7.8.0" - -"@polkadot/api@^9.10.2", "@polkadot/api@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/api/-/api-9.14.2.tgz" - integrity sha512-R3eYFj2JgY1zRb+OCYQxNlJXCs2FA+AU4uIEiVcXnVLmR3M55tkRNEwYAZmiFxx0pQmegGgPMc33q7TWGdw24A== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/api-augment" "9.14.2" - "@polkadot/api-base" "9.14.2" - "@polkadot/api-derive" "9.14.2" - "@polkadot/keyring" "^10.4.2" - "@polkadot/rpc-augment" "9.14.2" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/rpc-provider" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-augment" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/types-create" "9.14.2" - "@polkadot/types-known" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" - eventemitter3 "^5.0.0" - rxjs "^7.8.0" - -"@polkadot/keyring@^10.0.0", "@polkadot/keyring@^10.2.1", "@polkadot/keyring@^10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/keyring/-/keyring-10.4.2.tgz" - integrity sha512-7iHhJuXaHrRTG6cJDbZE9G+c1ts1dujp0qbO4RfAPmT7YUvphHvAtCKueN9UKPz5+TYDL+rP/jDEaSKU8jl/qQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "10.4.2" - "@polkadot/util-crypto" "10.4.2" - -"@polkadot/networks@^10.4.2", "@polkadot/networks@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/networks/-/networks-10.4.2.tgz" - integrity sha512-FAh/znrEvWBiA/LbcT5GXHsCFUl//y9KqxLghSr/CreAmAergiJNT0MVUezC7Y36nkATgmsr4ylFwIxhVtuuCw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "10.4.2" - "@substrate/ss58-registry" "^1.38.0" - -"@polkadot/rpc-augment@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-9.14.2.tgz" - integrity sha512-mOubRm3qbKZTbP9H01XRrfTk7k5it9WyzaWAg72DJBQBYdgPUUkGSgpPD/Srkk5/5GAQTWVWL1I2UIBKJ4TJjQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/rpc-core@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-9.14.2.tgz" - integrity sha512-krA/mtQ5t9nUQEsEVC1sjkttLuzN6z6gyJxK2IlpMS3S5ncy/R6w4FOpy+Q0H18Dn83JBo0p7ZtY7Y6XkK48Kw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/rpc-augment" "9.14.2" - "@polkadot/rpc-provider" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/util" "^10.4.2" - rxjs "^7.8.0" - -"@polkadot/rpc-provider@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-9.14.2.tgz" - integrity sha512-YTSywjD5PF01V47Ru5tln2LlpUwJiSOdz6rlJXPpMaY53hUp7+xMU01FVAQ1bllSBNisSD1Msv/mYHq84Oai2g== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/keyring" "^10.4.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-support" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" - "@polkadot/x-fetch" "^10.4.2" - "@polkadot/x-global" "^10.4.2" - "@polkadot/x-ws" "^10.4.2" - eventemitter3 "^5.0.0" - mock-socket "^9.2.1" - nock "^13.3.0" + resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/hashes@^1.3.2", "@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + +"@polkadot/api-augment@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-10.11.1.tgz" + integrity sha512-9Sk7fi6wzvxAoxvGJPcMt0hU4WzuIAlBy4Rng6WPiS6Ed0HJLr1dkZaqFFmV5my2pb3tu//1JGYkt+MUVB0Kqw== + dependencies: + "@polkadot/api-base" "10.11.1" + "@polkadot/rpc-augment" "10.11.1" + "@polkadot/types" "10.11.1" + "@polkadot/types-augment" "10.11.1" + "@polkadot/types-codec" "10.11.1" + "@polkadot/util" "^12.6.1" + tslib "^2.6.2" + +"@polkadot/api-base@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/api-base/-/api-base-10.11.1.tgz" + integrity sha512-A645Hj9bGtq0EOEWcwTaGoD40vp8/ih1suwinl5il8Psg+bdDmzodnVH5Jhuwe1dNKOuXuvxZvOmbYUPWyIqyg== + dependencies: + "@polkadot/rpc-core" "10.11.1" + "@polkadot/types" "10.11.1" + "@polkadot/util" "^12.6.1" + rxjs "^7.8.1" + tslib "^2.6.2" + +"@polkadot/api-derive@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-10.11.1.tgz" + integrity sha512-i48okJr0l1IrFTPa9KVkoJnDL2EHKExR6XC0Z7I9+kW9noxYWqo0tIoi5s1bNVD475xWK/rUjT7qHxiDbPaCUQ== + dependencies: + "@polkadot/api" "10.11.1" + "@polkadot/api-augment" "10.11.1" + "@polkadot/api-base" "10.11.1" + "@polkadot/rpc-core" "10.11.1" + "@polkadot/types" "10.11.1" + "@polkadot/types-codec" "10.11.1" + "@polkadot/util" "^12.6.1" + "@polkadot/util-crypto" "^12.6.1" + rxjs "^7.8.1" + tslib "^2.6.2" + +"@polkadot/api@^10.10.1", "@polkadot/api@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/api/-/api-10.11.1.tgz" + integrity sha512-WEgUYvY90AHX9drmsvWQ4DDuqlE7h4x3f28K5eOoJF4dQ5AkWsFogxwJ4TH57POWLfyi8AIn6/f1vsqPtReDhA== + dependencies: + "@polkadot/api-augment" "10.11.1" + "@polkadot/api-base" "10.11.1" + "@polkadot/api-derive" "10.11.1" + "@polkadot/keyring" "^12.6.1" + "@polkadot/rpc-augment" "10.11.1" + "@polkadot/rpc-core" "10.11.1" + "@polkadot/rpc-provider" "10.11.1" + "@polkadot/types" "10.11.1" + "@polkadot/types-augment" "10.11.1" + "@polkadot/types-codec" "10.11.1" + "@polkadot/types-create" "10.11.1" + "@polkadot/types-known" "10.11.1" + "@polkadot/util" "^12.6.1" + "@polkadot/util-crypto" "^12.6.1" + eventemitter3 "^5.0.1" + rxjs "^7.8.1" + tslib "^2.6.2" + +"@polkadot/keyring@^12.5.1", "@polkadot/keyring@^12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.1.tgz" + integrity sha512-cicTctZr5Jy5vgNT2FsNiKoTZnz6zQkgDoIYv79NI+p1Fhwc9C+DN/iMCnk3Cm9vR2gSAd2fSV+Y5iKVDhAmUw== + dependencies: + "@polkadot/util" "12.6.1" + "@polkadot/util-crypto" "12.6.1" + tslib "^2.6.2" + +"@polkadot/networks@^12.6.1", "@polkadot/networks@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/networks/-/networks-12.6.1.tgz" + integrity sha512-pzyirxTYAnsx+6kyLYcUk26e4TLz3cX6p2KhTgAVW77YnpGX5VTKTbYykyXC8fXFd/migeQsLaa2raFN47mwoA== + dependencies: + "@polkadot/util" "12.6.1" + "@substrate/ss58-registry" "^1.44.0" + tslib "^2.6.2" + +"@polkadot/rpc-augment@^10.10.1", "@polkadot/rpc-augment@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-10.11.1.tgz" + integrity sha512-wrtxHnEwqS3b1GuZ3sA1pzLuUjjLnW4FPawOklONRcIuKbGmFuvu7QvEIHmxBV1FAS/fs8gbvp8ImKWUPnT93Q== + dependencies: + "@polkadot/rpc-core" "10.11.1" + "@polkadot/types" "10.11.1" + "@polkadot/types-codec" "10.11.1" + "@polkadot/util" "^12.6.1" + tslib "^2.6.2" + +"@polkadot/rpc-core@^10.10.1", "@polkadot/rpc-core@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-10.11.1.tgz" + integrity sha512-3l4l+zL7MDWzQx3WnaieXXUKsbeA1Miu4wsje5trYJEE+hm+nMW8h7fiFKfYzXBi7ty/wMS+S7BfQPTrDkYHxA== + dependencies: + "@polkadot/rpc-augment" "10.11.1" + "@polkadot/rpc-provider" "10.11.1" + "@polkadot/types" "10.11.1" + "@polkadot/util" "^12.6.1" + rxjs "^7.8.1" + tslib "^2.6.2" + +"@polkadot/rpc-provider@^10.10.1", "@polkadot/rpc-provider@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-10.11.1.tgz" + integrity sha512-86aDUOnaG42si0jSOAgn6Fs3F3rz57x+iNBK1JpM0PLL2XvmPuoMZL5dZwzqSIey3nVdGJqRYfnFquWuyQpnOQ== + dependencies: + "@polkadot/keyring" "^12.6.1" + "@polkadot/types" "10.11.1" + "@polkadot/types-support" "10.11.1" + "@polkadot/util" "^12.6.1" + "@polkadot/util-crypto" "^12.6.1" + "@polkadot/x-fetch" "^12.6.1" + "@polkadot/x-global" "^12.6.1" + "@polkadot/x-ws" "^12.6.1" + eventemitter3 "^5.0.1" + mock-socket "^9.3.1" + nock "^13.3.8" + tslib "^2.6.2" optionalDependencies: - "@substrate/connect" "0.7.19" - -"@polkadot/types-augment@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-9.14.2.tgz" - integrity sha512-WO9d7RJufUeY3iFgt2Wz762kOu1tjEiGBR5TT4AHtpEchVHUeosVTrN9eycC+BhleqYu52CocKz6u3qCT/jKLg== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/types-codec@^9.10.2", "@polkadot/types-codec@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-9.14.2.tgz" - integrity sha512-AJ4XF7W1no4PENLBRU955V6gDxJw0h++EN3YoDgThozZ0sj3OxyFupKgNBZcZb2V23H8JxQozzIad8k+nJbO1w== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "^10.4.2" - "@polkadot/x-bigint" "^10.4.2" - -"@polkadot/types-create@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/types-create/-/types-create-9.14.2.tgz" - integrity sha512-nSnKpBierlmGBQT8r6/SHf6uamBIzk4WmdMsAsR4uJKJF1PtbIqx2W5PY91xWSiMSNMzjkbCppHkwaDAMwLGaw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/types-known@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/types-known/-/types-known-9.14.2.tgz" - integrity sha512-iM8WOCgguzJ3TLMqlm4K1gKQEwWm2zxEKT1HZZ1irs/lAbBk9MquDWDvebryiw3XsLB8xgrp3RTIBn2Q4FjB2A== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/networks" "^10.4.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/types-create" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/types-support@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/types-support/-/types-support-9.14.2.tgz" - integrity sha512-VWCOPgXDK3XtXT7wMLyIWeNDZxUbNcw/8Pn6n6vMogs7o/n4h6WGbGMeTIQhPWyn831/RmkVs5+2DUC+2LlOhw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "^10.4.2" - -"@polkadot/types@^9.10.2", "@polkadot/types@9.14.2": - version "9.14.2" - resolved "https://registry.npmjs.org/@polkadot/types/-/types-9.14.2.tgz" - integrity sha512-hGLddTiJbvowhhUZJ3k+olmmBc1KAjWIQxujIUIYASih8FQ3/YJDKxaofGOzh0VygOKW3jxQBN2VZPofyDP9KQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/keyring" "^10.4.2" - "@polkadot/types-augment" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/types-create" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" - rxjs "^7.8.0" - -"@polkadot/util-crypto@^10.2.1", "@polkadot/util-crypto@^10.4.2", "@polkadot/util-crypto@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-10.4.2.tgz" - integrity sha512-RxZvF7C4+EF3fzQv8hZOLrYCBq5+wA+2LWv98nECkroChY3C2ZZvyWDqn8+aonNULt4dCVTWDZM0QIY6y4LUAQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@noble/hashes" "1.2.0" - "@noble/secp256k1" "1.7.1" - "@polkadot/networks" "10.4.2" - "@polkadot/util" "10.4.2" - "@polkadot/wasm-crypto" "^6.4.1" - "@polkadot/x-bigint" "10.4.2" - "@polkadot/x-randomvalues" "10.4.2" - "@scure/base" "1.1.1" - ed2curve "^0.3.0" - tweetnacl "^1.0.3" - -"@polkadot/util@*", "@polkadot/util@^10.2.1", "@polkadot/util@^10.4.2", "@polkadot/util@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/util/-/util-10.4.2.tgz" - integrity sha512-0r5MGICYiaCdWnx+7Axlpvzisy/bi1wZGXgCSw5+ZTyPTOqvsYRqM2X879yxvMsGfibxzWqNzaiVjToz1jvUaA== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-bigint" "10.4.2" - "@polkadot/x-global" "10.4.2" - "@polkadot/x-textdecoder" "10.4.2" - "@polkadot/x-textencoder" "10.4.2" - "@types/bn.js" "^5.1.1" + "@substrate/connect" "0.7.35" + +"@polkadot/types-augment@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-10.11.1.tgz" + integrity sha512-Exd5mMCuSOXXz73iWqy8ocScWTrwAPqHz0Kxpz5OWlAu+5usipMuhjoeaZA803FHQntZh9lHUN31fuc50Exhew== + dependencies: + "@polkadot/types" "10.11.1" + "@polkadot/types-codec" "10.11.1" + "@polkadot/util" "^12.6.1" + tslib "^2.6.2" + +"@polkadot/types-codec@^10.10.1", "@polkadot/types-codec@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-10.11.1.tgz" + integrity sha512-B9Fu2hq3cRpJpGPcgfZ8Qi1OSX9u82J46adlbIG95ktoA+70eZ83VS3Zvtt9ACsdLVGETCJfDjSO25XptjhZKQ== + dependencies: + "@polkadot/util" "^12.6.1" + "@polkadot/x-bigint" "^12.6.1" + tslib "^2.6.2" + +"@polkadot/types-create@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/types-create/-/types-create-10.11.1.tgz" + integrity sha512-oeaI185F3XeWSz9/fe//qZ0KsQyE6C6c13WuOa+5cX/Yuz7cSAXawrhl58HRaU+fueaE/ijEHLcuK1sdM6e1JQ== + dependencies: + "@polkadot/types-codec" "10.11.1" + "@polkadot/util" "^12.6.1" + tslib "^2.6.2" + +"@polkadot/types-known@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/types-known/-/types-known-10.11.1.tgz" + integrity sha512-BPHI7EbdRaznZR4RVVrQC5epyxL6caJ5dkluZP6rRwx7VmQK0FTGIwgh3UP724mzQhM8rT77MD3h2ftnq1cteg== + dependencies: + "@polkadot/networks" "^12.6.1" + "@polkadot/types" "10.11.1" + "@polkadot/types-codec" "10.11.1" + "@polkadot/types-create" "10.11.1" + "@polkadot/util" "^12.6.1" + tslib "^2.6.2" + +"@polkadot/types-support@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/types-support/-/types-support-10.11.1.tgz" + integrity sha512-eCvWjdpELsHvXiTq201DdbIeOIaEr53zTD7HqC2wR/Z1bkQuw79Z+CyIU4sp79GL1vZ1PxS7vUH9M3FKNaTl1Q== + dependencies: + "@polkadot/util" "^12.6.1" + tslib "^2.6.2" + +"@polkadot/types@^10.10.1", "@polkadot/types@10.11.1": + version "10.11.1" + resolved "https://registry.npmjs.org/@polkadot/types/-/types-10.11.1.tgz" + integrity sha512-4uKnzW2GZqNA5qRZpTPJ7z+G/ARTvXI89etv9xXXVttUdfTaYZsMf4rMuMThOAE/mAUn70LoH0JKthZLwzVgNQ== + dependencies: + "@polkadot/keyring" "^12.6.1" + "@polkadot/types-augment" "10.11.1" + "@polkadot/types-codec" "10.11.1" + "@polkadot/types-create" "10.11.1" + "@polkadot/util" "^12.6.1" + "@polkadot/util-crypto" "^12.6.1" + rxjs "^7.8.1" + tslib "^2.6.2" + +"@polkadot/util-crypto@^12.5.1", "@polkadot/util-crypto@^12.6.1", "@polkadot/util-crypto@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.1.tgz" + integrity sha512-2ezWFLmdgeDXqB9NAUdgpp3s2rQztNrZLY+y0SJYNOG4ch+PyodTW/qSksnOrVGVdRhZ5OESRE9xvo9LYV5UAw== + dependencies: + "@noble/curves" "^1.2.0" + "@noble/hashes" "^1.3.2" + "@polkadot/networks" "12.6.1" + "@polkadot/util" "12.6.1" + "@polkadot/wasm-crypto" "^7.3.1" + "@polkadot/wasm-util" "^7.3.1" + "@polkadot/x-bigint" "12.6.1" + "@polkadot/x-randomvalues" "12.6.1" + "@scure/base" "^1.1.3" + tslib "^2.6.2" + +"@polkadot/util@*", "@polkadot/util@^12.5.1", "@polkadot/util@^12.6.1", "@polkadot/util@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/util/-/util-12.6.1.tgz" + integrity sha512-10ra3VfXtK8ZSnWI7zjhvRrhupg3rd4iFC3zCaXmRpOU+AmfIoCFVEmuUuC66gyXiz2/g6k5E6j0lWQCOProSQ== + dependencies: + "@polkadot/x-bigint" "12.6.1" + "@polkadot/x-global" "12.6.1" + "@polkadot/x-textdecoder" "12.6.1" + "@polkadot/x-textencoder" "12.6.1" + "@types/bn.js" "^5.1.5" bn.js "^5.2.1" - -"@polkadot/wasm-bridge@6.4.1": - version "6.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-6.4.1.tgz" - integrity sha512-QZDvz6dsUlbYsaMV5biZgZWkYH9BC5AfhT0f0/knv8+LrbAoQdP3Asbvddw8vyU9sbpuCHXrd4bDLBwUCRfrBQ== - dependencies: - "@babel/runtime" "^7.20.6" - -"@polkadot/wasm-crypto-asmjs@6.4.1": - version "6.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-6.4.1.tgz" - integrity sha512-UxZTwuBZlnODGIQdCsE2Sn/jU0O2xrNQ/TkhRFELfkZXEXTNu4lw6NpaKq7Iey4L+wKd8h4lT3VPVkMcPBLOvA== - dependencies: - "@babel/runtime" "^7.20.6" - -"@polkadot/wasm-crypto-init@6.4.1": - version "6.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-6.4.1.tgz" - integrity sha512-1ALagSi/nfkyFaH6JDYfy/QbicVbSn99K8PV9rctDUfxc7P06R7CoqbjGQ4OMPX6w1WYVPU7B4jPHGLYBlVuMw== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-bridge" "6.4.1" - "@polkadot/wasm-crypto-asmjs" "6.4.1" - "@polkadot/wasm-crypto-wasm" "6.4.1" - -"@polkadot/wasm-crypto-wasm@6.4.1": - version "6.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-6.4.1.tgz" - integrity sha512-3VV9ZGzh0ZY3SmkkSw+0TRXxIpiO0nB8lFwlRgcwaCihwrvLfRnH9GI8WE12mKsHVjWTEVR3ogzILJxccAUjDA== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-util" "6.4.1" - -"@polkadot/wasm-crypto@^6.4.1": - version "6.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-6.4.1.tgz" - integrity sha512-FH+dcDPdhSLJvwL0pMLtn/LIPd62QDPODZRCmDyw+pFjLOMaRBc7raomWUOqyRWJTnqVf/iscc2rLVLNMyt7ag== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-bridge" "6.4.1" - "@polkadot/wasm-crypto-asmjs" "6.4.1" - "@polkadot/wasm-crypto-init" "6.4.1" - "@polkadot/wasm-crypto-wasm" "6.4.1" - "@polkadot/wasm-util" "6.4.1" - -"@polkadot/wasm-util@6.4.1": - version "6.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-6.4.1.tgz" - integrity sha512-Uwo+WpEsDmFExWC5kTNvsVhvqXMZEKf4gUHXFn4c6Xz4lmieRT5g+1bO1KJ21pl4msuIgdV3Bksfs/oiqMFqlw== - dependencies: - "@babel/runtime" "^7.20.6" - -"@polkadot/x-bigint@^10.4.2", "@polkadot/x-bigint@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-10.4.2.tgz" - integrity sha512-awRiox+/XSReLzimAU94fPldowiwnnMUkQJe8AebYhNocAj6SJU00GNoj6j6tAho6yleOwrTJXZaWFBaQVJQNg== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - -"@polkadot/x-fetch@^10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-10.4.2.tgz" - integrity sha512-Ubb64yaM4qwhogNP+4mZ3ibRghEg5UuCYRMNaCFoPgNAY8tQXuDKrHzeks3+frlmeH9YRd89o8wXLtWouwZIcw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - "@types/node-fetch" "^2.6.2" - node-fetch "^3.3.0" - -"@polkadot/x-global@^10.4.2", "@polkadot/x-global@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/x-global/-/x-global-10.4.2.tgz" - integrity sha512-g6GXHD/ykZvHap3M6wh19dO70Zm43l4jEhlxf5LtTo5/0/UporFCXr2YJYZqfbn9JbQwl1AU+NroYio+vtJdiA== - dependencies: - "@babel/runtime" "^7.20.13" - -"@polkadot/x-randomvalues@*", "@polkadot/x-randomvalues@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-10.4.2.tgz" - integrity sha512-mf1Wbpe7pRZHO0V3V89isPLqZOy5XGX2bCqsfUWHgb1NvV1MMx5TjVjdaYyNlGTiOkAmJKlOHshcfPU2sYWpNg== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - -"@polkadot/x-textdecoder@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-10.4.2.tgz" - integrity sha512-d3ADduOKUTU+cliz839+KCFmi23pxTlabH7qh7Vs1GZQvXOELWdqFOqakdiAjtMn68n1KVF4O14Y+OUm7gp/zA== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - -"@polkadot/x-textencoder@10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-10.4.2.tgz" - integrity sha512-mxcQuA1exnyv74Kasl5vxBq01QwckG088lYjc3KwmND6+pPrW2OWagbxFX5VFoDLDAE+UJtnUHsjdWyOTDhpQA== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - -"@polkadot/x-ws@^10.4.2": - version "10.4.2" - resolved "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-10.4.2.tgz" - integrity sha512-3gHSTXAWQu1EMcMVTF5QDKHhEHzKxhAArweEyDXE7VsgKUP/ixxw4hVZBrkX122iI5l5mjSiooRSnp/Zl3xqDQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - "@types/websocket" "^1.0.5" - websocket "^1.0.34" - -"@scure/base@1.1.1": - version "1.1.1" - resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz" - integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA== + tslib "^2.6.2" + +"@polkadot/wasm-bridge@7.3.1": + version "7.3.1" + resolved "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.3.1.tgz" + integrity sha512-wPtDkGaOQx5BUIYP+kJv5aV3BnCQ+HXr36khGKYrRQAMBrG+ybCNPOTVXDQnSbraPQRSw7fSIJmiQpEmFsIz0w== + dependencies: + "@polkadot/wasm-util" "7.3.1" + tslib "^2.6.2" + +"@polkadot/wasm-crypto-asmjs@7.3.1": + version "7.3.1" + resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.1.tgz" + integrity sha512-pTUOCIP0nUc4tjzdG1vtEBztKEWde4DBEZm7NaxBLvwNUxsbYhLKYvuhASEyEIz0ZyE4rOBWEmRF4Buic8oO+g== + dependencies: + tslib "^2.6.2" + +"@polkadot/wasm-crypto-init@7.3.1": + version "7.3.1" + resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.1.tgz" + integrity sha512-Fx15ItLcxCe7uJCWZVXhFbsrXqHUKAp9KGYQFKBRK7r1C2va4Y7qnirjwkxoMHQcunusLe2KdbrD+YJuzh4wlA== + dependencies: + "@polkadot/wasm-bridge" "7.3.1" + "@polkadot/wasm-crypto-asmjs" "7.3.1" + "@polkadot/wasm-crypto-wasm" "7.3.1" + "@polkadot/wasm-util" "7.3.1" + tslib "^2.6.2" + +"@polkadot/wasm-crypto-wasm@7.3.1": + version "7.3.1" + resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.1.tgz" + integrity sha512-hBMRwrBLCfVsFHSdnwwIxEPshoZdW/dHehYRxMSpUdmqOxtD1gnjocXGE1KZUYGX675+EFuR+Ch6OoTKFJxwTA== + dependencies: + "@polkadot/wasm-util" "7.3.1" + tslib "^2.6.2" + +"@polkadot/wasm-crypto@^7.3.1": + version "7.3.1" + resolved "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.3.1.tgz" + integrity sha512-BSK0YyCN4ohjtwbiHG71fgf+7ufgfLrHxjn7pKsvXhyeiEVuDhbDreNcpUf3eGOJ5tNk75aSbKGF4a3EJGIiNA== + dependencies: + "@polkadot/wasm-bridge" "7.3.1" + "@polkadot/wasm-crypto-asmjs" "7.3.1" + "@polkadot/wasm-crypto-init" "7.3.1" + "@polkadot/wasm-crypto-wasm" "7.3.1" + "@polkadot/wasm-util" "7.3.1" + tslib "^2.6.2" + +"@polkadot/wasm-util@*", "@polkadot/wasm-util@^7.3.1", "@polkadot/wasm-util@7.3.1": + version "7.3.1" + resolved "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.3.1.tgz" + integrity sha512-0m6ozYwBrJgnGl6QvS37ZiGRu4FFPPEtMYEVssfo1Tz4skHJlByWaHWhRNoNCVFAKiGEBu+rfx5HAQMAhoPkvg== + dependencies: + tslib "^2.6.2" + +"@polkadot/x-bigint@^12.6.1", "@polkadot/x-bigint@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-12.6.1.tgz" + integrity sha512-YlABeVIlgYQZJ4ZpW/+akFGGxw5jMGt4g5vaP7EumlORGneJHzzWJYDmI5v2y7j1zvC9ofOle7z4tRmtN/QDew== + dependencies: + "@polkadot/x-global" "12.6.1" + tslib "^2.6.2" + +"@polkadot/x-fetch@^12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-12.6.1.tgz" + integrity sha512-iyBv0ecfCsqGSv26CPJk9vSoKtry/Fn7x549ysA4hlc9KboraMHxOHTpcNZYC/OdgvbFZl40zIXCY0SA1ai8aw== + dependencies: + "@polkadot/x-global" "12.6.1" + node-fetch "^3.3.2" + tslib "^2.6.2" + +"@polkadot/x-global@^12.6.1", "@polkadot/x-global@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/x-global/-/x-global-12.6.1.tgz" + integrity sha512-w5t19HIdBPuyu7X/AiCyH2DsKqxBF0KpF4Ymolnx8PfcSIgnq9ZOmgs74McPR6FgEmeEkr9uNKujZrsfURi1ug== + dependencies: + tslib "^2.6.2" + +"@polkadot/x-randomvalues@*", "@polkadot/x-randomvalues@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.1.tgz" + integrity sha512-1uVKlfYYbgIgGV5v1Dgn960cGovenWm5pmg+aTMeUGXVYiJwRD2zOpLyC1i/tP454iA74j74pmWb8Nkn0tJZUQ== + dependencies: + "@polkadot/x-global" "12.6.1" + tslib "^2.6.2" + +"@polkadot/x-textdecoder@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.1.tgz" + integrity sha512-IasodJeV1f2Nr/VtA207+LXCQEqYcG8y9qB/EQcRsrEP58NbwwxM5Z2obV0lSjJOxRTJ4/OlhUwnLHwcbIp6+g== + dependencies: + "@polkadot/x-global" "12.6.1" + tslib "^2.6.2" + +"@polkadot/x-textencoder@12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.1.tgz" + integrity sha512-sTq/+tXqBhGe01a1rjieSHFh3y935vuRgtahVgVJZnfqh5SmLPgSN5tTPxZWzyx7gHIfotle8laTJbJarv7V1A== + dependencies: + "@polkadot/x-global" "12.6.1" + tslib "^2.6.2" + +"@polkadot/x-ws@^12.6.1": + version "12.6.1" + resolved "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-12.6.1.tgz" + integrity sha512-fs9V+XekjJLpVLLwxnqq3llqSZu2T/b9brvld8anvzS/htDLPbi7+c5W3VGJ9Po8fS67IsU3HCt0Gu6F6mGrMA== + dependencies: + "@polkadot/x-global" "12.6.1" + tslib "^2.6.2" + ws "^8.14.2" + +"@scure/base@^1.1.3": + version "1.1.3" + resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz" + integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== "@substrate/connect-extension-protocol@^1.0.1": version "1.0.1" resolved "https://registry.npmjs.org/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.1.tgz" integrity sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg== -"@substrate/connect@0.7.19": - version "0.7.19" - resolved "https://registry.npmjs.org/@substrate/connect/-/connect-0.7.19.tgz" - integrity sha512-+DDRadc466gCmDU71sHrYOt1HcI2Cbhm7zdCFjZfFVHXhC/E8tOdrVSglAH2HDEHR0x2SiHRxtxOGC7ak2Zjog== +"@substrate/connect@0.7.35": + version "0.7.35" + resolved "https://registry.npmjs.org/@substrate/connect/-/connect-0.7.35.tgz" + integrity sha512-Io8vkalbwaye+7yXfG1Nj52tOOoJln2bMlc7Q9Yy3vEWqZEVkgKmcPVzbwV0CWL3QD+KMPDA2Dnw/X7EdwgoLw== dependencies: "@substrate/connect-extension-protocol" "^1.0.1" - "@substrate/smoldot-light" "0.7.9" - eventemitter3 "^4.0.7" + smoldot "2.0.7" -"@substrate/smoldot-light@0.7.9": - version "0.7.9" - resolved "https://registry.npmjs.org/@substrate/smoldot-light/-/smoldot-light-0.7.9.tgz" - integrity sha512-HP8iP7sFYlpSgjjbo0lqHyU+gu9lL2hbDNce6dWk5/10mFFF9jKIFGfui4zCecUY808o/Go9pan/31kMJoLbug== - dependencies: - pako "^2.0.4" - ws "^8.8.1" - -"@substrate/ss58-registry@^1.38.0": - version "1.41.0" - resolved "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.41.0.tgz" - integrity sha512-TLz5VkEaJRNFzf1Oiix9gqknKer3aKbLfjK9XHBFCIhdxlQpI+S6lZGu3wT4DHAGXPakYfXb8+9ZIOtWLcQ/2Q== - -"@types/bn.js@^5.1.1": - version "5.1.1" - resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz" - integrity sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g== - dependencies: - "@types/node" "*" +"@substrate/ss58-registry@^1.44.0": + version "1.44.0" + resolved "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.44.0.tgz" + integrity sha512-7lQ/7mMCzVNSEfDS4BCqnRnKCFKpcOaPrxMeGTXHX1YQzM/m2BBHjbK2C3dJvjv7GYxMiaTq/HdWQj1xS6ss+A== -"@types/node-fetch@^2.6.2": - version "2.6.4" - resolved "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz" - integrity sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg== +"@types/bn.js@^5.1.5": + version "5.1.5" + resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz" + integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== dependencies: "@types/node" "*" - form-data "^3.0.0" "@types/node@*": - version "20.4.2" - resolved "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz" - integrity sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw== - -"@types/websocket@^1.0.5": - version "1.0.5" - resolved "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.5.tgz" - integrity sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ== + version "20.10.3" + resolved "https://registry.npmjs.org/@types/node/-/node-20.10.3.tgz" + integrity sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg== dependencies: - "@types/node" "*" + undici-types "~5.26.4" -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== bn.js@^5.2.1: version "5.2.1" resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -bufferutil@^4.0.1: - version "4.0.7" - resolved "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz" - integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== +cbor-extract@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/cbor-extract/-/cbor-extract-2.1.1.tgz" + integrity sha512-1UX977+L+zOJHsp0mWFG13GLwO6ucKgSmSW6JTl8B9GUvACvHeIVpFqhU92299Z6PfD09aTXDell5p+lp1rUFA== dependencies: - node-gyp-build "^4.3.0" + node-gyp-build-optional-packages "5.0.3" + optionalDependencies: + "@cbor-extract/cbor-extract-darwin-arm64" "2.1.1" + "@cbor-extract/cbor-extract-darwin-x64" "2.1.1" + "@cbor-extract/cbor-extract-linux-arm" "2.1.1" + "@cbor-extract/cbor-extract-linux-arm64" "2.1.1" + "@cbor-extract/cbor-extract-linux-x64" "2.1.1" + "@cbor-extract/cbor-extract-win32-x64" "2.1.1" + +cbor-x@^1.5.4: + version "1.5.6" + resolved "https://registry.npmjs.org/cbor-x/-/cbor-x-1.5.6.tgz" + integrity sha512-+TXdnDNdr8JH5GQRoAhjdT/5s5N+b71s2Nz8DpDRyuWx0uzMj8JTR3AqqMTBO/1HtUBHZpmK1enD2ViXFx0Nug== + optionalDependencies: + cbor-extract "^2.1.1" -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -d@^1.0.1, d@1: - version "1.0.1" - resolved "https://registry.npmjs.org/d/-/d-1.0.1.tgz" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== data-uri-to-buffer@^4.0.0: version "4.0.1" resolved "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz" integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== -debug@^2.2.0: - version "2.6.9" - resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debug@^4.1.0: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" @@ -604,17 +631,10 @@ debug@^4.1.0: dependencies: ms "2.1.2" -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -ed2curve@^0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/ed2curve/-/ed2curve-0.3.0.tgz" - integrity sha512-8w2fmmq3hv9rCrcI7g9hms2pMunQr1JINfcjwR9tAyZqhtyaMN991lF/ZfHfr5tzZQ8c7y7aBgZbjfbd0fjFwQ== - dependencies: - tweetnacl "1.x.x" +dotenv@^16.3.1: + version "16.3.1" + resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== error-stack-parser@^1.3.6: version "1.3.6" @@ -623,32 +643,6 @@ error-stack-parser@^1.3.6: dependencies: stackframe "^0.3.1" -es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.62" - resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz" - integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.3" - resolved "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - esbuild@~0.17.6: version "0.17.19" resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz" @@ -677,23 +671,11 @@ esbuild@~0.17.6: "@esbuild/win32-ia32" "0.17.19" "@esbuild/win32-x64" "0.17.19" -eventemitter3@^4.0.7: - version "4.0.7" - resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" - integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== - -eventemitter3@^5.0.0: +eventemitter3@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz" integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== -ext@^1.1.2: - version "1.7.0" - resolved "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz" - integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== - dependencies: - type "^2.7.2" - fetch-blob@^3.1.2, fetch-blob@^3.1.4: version "3.2.0" resolved "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz" @@ -702,15 +684,6 @@ fetch-blob@^3.1.2, fetch-blob@^3.1.4: node-domexception "^1.0.0" web-streams-polyfill "^3.0.3" -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - formdata-polyfill@^4.0.10: version "4.0.10" resolved "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz" @@ -718,6 +691,11 @@ formdata-polyfill@^4.0.10: dependencies: fetch-blob "^3.1.2" +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + fsevents@~2.3.2: version "2.3.2" resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" @@ -730,66 +708,65 @@ get-tsconfig@^4.4.0: dependencies: resolve-pkg-maps "^1.0.0" -is-typedarray@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== +glob@^7.1.1: + version "7.2.3" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.12: - version "2.1.35" - resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== +minimatch@^3.1.1: + version "3.1.2" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: - mime-db "1.52.0" + brace-expansion "^1.1.7" -mock-socket@^9.2.1: - version "9.2.1" - resolved "https://registry.npmjs.org/mock-socket/-/mock-socket-9.2.1.tgz" - integrity sha512-aw9F9T9G2zpGipLLhSNh6ZpgUyUl4frcVmRN08uE1NWPWg43Wx6+sGPDbQ7E5iFZZDJW5b5bypMeAEHqTbIFag== +mock-socket@^9.3.1: + version "9.3.1" + resolved "https://registry.npmjs.org/mock-socket/-/mock-socket-9.3.1.tgz" + integrity sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw== moment@^2.29.1: version "2.29.4" resolved "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz" integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== -ms@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - -nock@^13.3.0: - version "13.3.1" - resolved "https://registry.npmjs.org/nock/-/nock-13.3.1.tgz" - integrity sha512-vHnopocZuI93p2ccivFyGuUfzjq2fxNyNurp7816mlT5V5HF4SzXu8lvLrVzBbNqzs+ODooZ6OksuSUNM7Njkw== +nock@^13.3.8: + version "13.4.0" + resolved "https://registry.npmjs.org/nock/-/nock-13.4.0.tgz" + integrity sha512-W8NVHjO/LCTNA64yxAPHV/K47LpGYcVzgKd3Q0n6owhwvD0Dgoterc25R4rnZbckJEb6Loxz1f5QMuJpJnbSyQ== dependencies: debug "^4.1.0" json-stringify-safe "^5.0.1" - lodash "^4.17.21" propagate "^2.0.0" node-domexception@^1.0.0: @@ -797,47 +774,56 @@ node-domexception@^1.0.0: resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== -node-fetch@^3.3.0: - version "3.3.1" - resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz" - integrity sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow== +node-fetch@^3.3.2: + version "3.3.2" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz" + integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== dependencies: data-uri-to-buffer "^4.0.0" fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" -node-gyp-build@^4.3.0: - version "4.6.0" - resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz" - integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ== +node-gyp-build-optional-packages@5.0.3: + version "5.0.3" + resolved "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.3.tgz" + integrity sha512-k75jcVzk5wnnc/FMxsf4udAoTEUv2jY3ycfdSd3yWu6Cnd1oee6/CfZJApyscA4FJOmdoixWwiwOyf16RzD5JA== -pako@^2.0.4: - version "2.1.0" - resolved "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz" - integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== +once@^1.3.0: + version "1.4.0" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== propagate@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz" integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag== -regenerator-runtime@^0.13.11: - version "0.13.11" - resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz" - integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== - resolve-pkg-maps@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz" integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== -rxjs@^7.8.0: +rxjs@^7.8.1: version "7.8.1" resolved "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz" integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== dependencies: tslib "^2.1.0" +smoldot@2.0.7: + version "2.0.7" + resolved "https://registry.npmjs.org/smoldot/-/smoldot-2.0.7.tgz" + integrity sha512-VAOBqEen6vises36/zgrmAT1GWk2qE3X8AGnO7lmQFdskbKx8EovnwS22rtPAG+Y1Rk23/S22kDJUdPANyPkBA== + dependencies: + ws "^8.8.1" + source-map-support@^0.5.21: version "0.5.21" resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz" @@ -890,10 +876,10 @@ stacktrace-js@1.3.1: stack-generator "^1.0.7" stacktrace-gps "^2.4.3" -tslib@^2.1.0: - version "2.6.0" - resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz" - integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== +tslib@^2.1.0, tslib@^2.6.2: + version "2.6.2" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== tsx@^3.4.3: version "3.12.7" @@ -906,28 +892,11 @@ tsx@^3.4.3: optionalDependencies: fsevents "~2.3.2" -tweetnacl@^1.0.3, tweetnacl@1.x.x: +tweetnacl@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz" integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== -type@^1.0.1: - version "1.2.0" - resolved "https://registry.npmjs.org/type/-/type-1.2.0.tgz" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.7.2: - version "2.7.2" - resolved "https://registry.npmjs.org/type/-/type-2.7.2.tgz" - integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== - -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - typescript-logging@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/typescript-logging/-/typescript-logging-1.0.1.tgz" @@ -935,41 +904,27 @@ typescript-logging@^1.0.0: dependencies: stacktrace-js "1.3.1" -utf-8-validate@^5.0.2, utf-8-validate@>=5.0.2: - version "5.0.10" - resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== uuid@^9.0.0: - version "9.0.0" - resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz" - integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== + version "9.0.1" + resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== web-streams-polyfill@^3.0.3: version "3.2.1" resolved "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz" integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== -websocket@^1.0.34: - version "1.0.34" - resolved "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz" - integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== - dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.50" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" - -ws@^8.8.1: - version "8.13.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz" - integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== +wrappy@1: + version "1.0.2" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +ws@^8.14.2, ws@^8.8.1: + version "8.14.2" + resolved "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz" + integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==