diff --git a/CHANGELOG.md b/CHANGELOG.md index 960facf6a..797b83efe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Changelog This change log is managed by `scripts/cmds/update-versions` but may be manually updated. -ethers/v5.0.8 (2020-07-31 01:21) +ethers/v5.0.8 (2020-08-04 20:30) -------------------------------- - Abstract fetchJson for data. ([e2d6f28](https://github.com/ethers-io/ethers.js/commit/e2d6f281d5a2bd749bc72549a4e55f2c752a7bd8), [2c49a52](https://github.com/ethers-io/ethers.js/commit/2c49a52a41a30ae844376561de95f0c851d19f73)) diff --git a/package-lock.json b/package-lock.json index 21b303ff2..0c3009342 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,19 +13,19 @@ } }, "@babel/core": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.5.tgz", - "integrity": "sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.1.tgz", + "integrity": "sha512-XqF7F6FWQdKGGWAzGELL+aCO1p+lRY5Tj5/tbT3St1G8NaH70jhhDIKknIZaDans0OQBG5wRAldROLHSt44BgQ==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.10.5", - "@babel/helper-module-transforms": "^7.10.5", + "@babel/generator": "^7.11.0", + "@babel/helper-module-transforms": "^7.11.0", "@babel/helpers": "^7.10.4", - "@babel/parser": "^7.10.5", + "@babel/parser": "^7.11.1", "@babel/template": "^7.10.4", - "@babel/traverse": "^7.10.5", - "@babel/types": "^7.10.5", + "@babel/traverse": "^7.11.0", + "@babel/types": "^7.11.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.1", @@ -37,15 +37,15 @@ }, "dependencies": { "@babel/parser": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz", - "integrity": "sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.1.tgz", + "integrity": "sha512-u9QMIRdKVF7hfEkb3nu2LgZDIzCQPv+yHD9Eg6ruoJLjkrQ9fFz4IBSlF/9XwoNri9+2F1IY+dYuOfZrXq8t3w==", "dev": true }, "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -77,20 +77,20 @@ } }, "@babel/generator": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.5.tgz", - "integrity": "sha512-3vXxr3FEW7E7lJZiWQ3bM4+v/Vyr9C+hpolQ8BGFr9Y8Ri2tFLWTixmwKBafDujO1WVah4fhZBeU1bieKdghig==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.0.tgz", + "integrity": "sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ==", "dev": true, "requires": { - "@babel/types": "^7.10.5", + "@babel/types": "^7.11.0", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -118,9 +118,9 @@ }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -140,9 +140,9 @@ }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -153,18 +153,18 @@ } }, "@babel/helper-member-expression-to-functions": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.5.tgz", - "integrity": "sha512-HiqJpYD5+WopCXIAbQDG0zye5XYVvcO9w/DHp5GsaGkRUaamLj2bEtu6i8rnGGprAhHM3qidCMgp71HF4endhA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz", + "integrity": "sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q==", "dev": true, "requires": { - "@babel/types": "^7.10.5" + "@babel/types": "^7.11.0" }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -184,9 +184,9 @@ }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -197,24 +197,24 @@ } }, "@babel/helper-module-transforms": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.10.5.tgz", - "integrity": "sha512-4P+CWMJ6/j1W915ITJaUkadLObmCRRSC234uctJfn/vHrsLNxsR8dwlcXv9ZhJWzl77awf+mWXSZEKt5t0OnlA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz", + "integrity": "sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.10.4", "@babel/helper-replace-supers": "^7.10.4", "@babel/helper-simple-access": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.10.4", + "@babel/helper-split-export-declaration": "^7.11.0", "@babel/template": "^7.10.4", - "@babel/types": "^7.10.5", + "@babel/types": "^7.11.0", "lodash": "^4.17.19" }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -234,9 +234,9 @@ }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -259,9 +259,9 @@ }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -282,9 +282,9 @@ }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -295,18 +295,18 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz", - "integrity": "sha512-pySBTeoUff56fL5CBU2hWm9TesA4r/rOkI9DyJLvvgz09MB9YtfIYe3iBriVaYNaPe+Alua0vBIOVOLs2buWhg==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", + "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", "dev": true, "requires": { - "@babel/types": "^7.10.4" + "@babel/types": "^7.11.0" }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -334,9 +334,9 @@ }, "dependencies": { "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -374,15 +374,15 @@ }, "dependencies": { "@babel/parser": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz", - "integrity": "sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.1.tgz", + "integrity": "sha512-u9QMIRdKVF7hfEkb3nu2LgZDIzCQPv+yHD9Eg6ruoJLjkrQ9fFz4IBSlF/9XwoNri9+2F1IY+dYuOfZrXq8t3w==", "dev": true }, "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -393,32 +393,32 @@ } }, "@babel/traverse": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.5.tgz", - "integrity": "sha512-yc/fyv2gUjPqzTz0WHeRJH2pv7jA9kA7mBX2tXl/x5iOE81uaVPuGPtaYk7wmkx4b67mQ7NqI8rmT2pF47KYKQ==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.0.tgz", + "integrity": "sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.10.5", + "@babel/generator": "^7.11.0", "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.10.4", - "@babel/parser": "^7.10.5", - "@babel/types": "^7.10.5", + "@babel/helper-split-export-declaration": "^7.11.0", + "@babel/parser": "^7.11.0", + "@babel/types": "^7.11.0", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.19" }, "dependencies": { "@babel/parser": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz", - "integrity": "sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.1.tgz", + "integrity": "sha512-u9QMIRdKVF7hfEkb3nu2LgZDIzCQPv+yHD9Eg6ruoJLjkrQ9fFz4IBSlF/9XwoNri9+2F1IY+dYuOfZrXq8t3w==", "dev": true }, "@babel/types": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", - "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", @@ -654,19 +654,19 @@ "dev": true }, "@ledgerhq/devices": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@ledgerhq/devices/-/devices-5.19.1.tgz", - "integrity": "sha512-i7PU0fsOkV5JDuD+57AliJ0FIBPgSSKbH8MbTOpYRhyAWfC7e7Em0SVl2B2JbzxjJ6/ltTq2+7zjLewu/ie5AA==", + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/@ledgerhq/devices/-/devices-5.21.0.tgz", + "integrity": "sha512-65XZgD2ykK7AJkcJuNEP8WD43HDkudA7NfB34U1T6pmPC6AgWoRYDNpJ23XQ8eiAImETlxv7FaDGUXSEpIQMGQ==", "requires": { - "@ledgerhq/errors": "^5.19.1", - "@ledgerhq/logs": "^5.19.1", + "@ledgerhq/errors": "^5.21.0", + "@ledgerhq/logs": "^5.21.0", "rxjs": "^6.6.0" } }, "@ledgerhq/errors": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@ledgerhq/errors/-/errors-5.19.1.tgz", - "integrity": "sha512-9v4ishxc2doiR06E/87uJdT7LjnSpnWPftDaBXBm/6KEgjPGtGBCcRW3fkmQTWNE115e6TG9JYRiVRPuqs6GHg==" + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/@ledgerhq/errors/-/errors-5.21.0.tgz", + "integrity": "sha512-sGfXoaVGfzrhnexu2TEdgL2FAjM7PUeobWdDBx3DJKE+ARje1y+i5+qg7gyvQL+9k4FV7mW2xMOcnUI3T2Zw0Q==" }, "@ledgerhq/hw-app-eth": { "version": "5.3.0", @@ -688,9 +688,9 @@ }, "dependencies": { "events": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", - "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==" } } }, @@ -710,31 +710,31 @@ } }, "@ledgerhq/hw-transport-node-hid-noevents": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid-noevents/-/hw-transport-node-hid-noevents-5.19.1.tgz", - "integrity": "sha512-/d8xXlGFPOWLowflkHGlJr/x1fM5uBfo5puFOlzchcUH8u3HclW0E9LmpKoLPQOvlePw8AwduYeZnDQi51h+mQ==", + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid-noevents/-/hw-transport-node-hid-noevents-5.21.0.tgz", + "integrity": "sha512-bo+4DLP5c7FO/No1ad0xddnukeFHAg5aoOWUFsiVHHo/EXugrngOc09Nqp6XMqR3dloqMhiW5Q9J5Joq4mDxgA==", "requires": { - "@ledgerhq/devices": "^5.19.1", - "@ledgerhq/errors": "^5.19.1", - "@ledgerhq/hw-transport": "^5.19.1", - "@ledgerhq/logs": "^5.19.1", + "@ledgerhq/devices": "^5.21.0", + "@ledgerhq/errors": "^5.21.0", + "@ledgerhq/hw-transport": "^5.21.0", + "@ledgerhq/logs": "^5.21.0", "node-hid": "^1.3.0" }, "dependencies": { "@ledgerhq/hw-transport": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-5.19.1.tgz", - "integrity": "sha512-Ec2I6jI1jrxkqaCdyEXVwra/3gOnzwWhv3eJTIqzT1wKrUNeG6B27cau0ETiLdgOtbRQ8fltonCo8Od3MC2h+Q==", + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-5.21.0.tgz", + "integrity": "sha512-emVoy+ZEA19z+g6CsDcliVRRYDn4RzdH+zW9F37Z22uoMWslx2VNa+KdcKijmS3V3mkSLjle1cjwprPh61G8hQ==", "requires": { - "@ledgerhq/devices": "^5.19.1", - "@ledgerhq/errors": "^5.19.1", - "events": "^3.1.0" + "@ledgerhq/devices": "^5.21.0", + "@ledgerhq/errors": "^5.21.0", + "events": "^3.2.0" } }, "events": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", - "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==" } } }, @@ -750,9 +750,9 @@ } }, "@ledgerhq/logs": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.19.1.tgz", - "integrity": "sha512-nz33IoR3dG3DtJ46AyfLfpdMjGMkwmi21H49wcqVfNAteEe74fzO4cw9fcGMb4ENspYYtmB4LWTSp4gVPRglcg==" + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.21.0.tgz", + "integrity": "sha512-eyPXrKfQ+HSLcITB5MdSWhXlImE2qKWTLT2u6l+a9wiCZl5yimSqn0uC5evxaP0McKOW0wSntgfj+gOoKv+Paw==" }, "@lerna/add": { "version": "3.21.0", @@ -1847,20 +1847,20 @@ } }, "@octokit/endpoint": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.4.tgz", - "integrity": "sha512-ZJHIsvsClEE+6LaZXskDvWIqD3Ao7+2gc66pRG5Ov4MQtMvCU9wGu1TItw9aGNmRuU9x3Fei1yb+uqGaQnm0nw==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz", + "integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==", "dev": true, "requires": { "@octokit/types": "^5.0.0", - "is-plain-object": "^3.0.0", + "is-plain-object": "^4.0.0", "universal-user-agent": "^6.0.0" }, "dependencies": { "is-plain-object": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", - "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz", + "integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==", "dev": true }, "universal-user-agent": { @@ -1925,16 +1925,16 @@ } }, "@octokit/request": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.6.tgz", - "integrity": "sha512-9r8Sn4CvqFI9LDLHl9P17EZHwj3ehwQnTpTE+LEneb0VBBqSiI/VS4rWIBfBhDrDs/aIGEGZRSB0QWAck8u+2g==", + "version": "5.4.7", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz", + "integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==", "dev": true, "requires": { "@octokit/endpoint": "^6.0.1", "@octokit/request-error": "^2.0.0", "@octokit/types": "^5.0.0", "deprecation": "^2.0.0", - "is-plain-object": "^3.0.0", + "is-plain-object": "^4.0.0", "node-fetch": "^2.3.0", "once": "^1.4.0", "universal-user-agent": "^6.0.0" @@ -1952,9 +1952,9 @@ } }, "is-plain-object": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", - "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz", + "integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==", "dev": true }, "universal-user-agent": { @@ -2012,9 +2012,9 @@ } }, "@octokit/types": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.1.0.tgz", - "integrity": "sha512-OFxUBgrEllAbdEmWp/wNmKIu5EuumKHG4sgy56vjZ8lXPgMhF05c76hmulfOdFHHYRpPj49ygOZJ8wgVsPecuA==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.2.1.tgz", + "integrity": "sha512-PugtgEw8u++zAyBpDpSkR8K1OsT2l8QWp3ECL6bZHFoq9PfHDoKeGFWSuX2Z+Ghy93k1fkKf8tsmqNBv+8dEfQ==", "dev": true, "requires": { "@types/node": ">= 8" @@ -2067,9 +2067,9 @@ "dev": true }, "@types/node": { - "version": "12.12.50", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.50.tgz", - "integrity": "sha512-5ImO01Fb8YsEOYpV+aeyGYztcYcjGsBvN4D7G5r1ef2cuQOpymjWNQi5V0rKHE6PC2ru3HkoUr/Br2/8GUA84w==", + "version": "12.12.53", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.53.tgz", + "integrity": "sha512-51MYTDTyCziHb70wtGNFRwB4l+5JNvdqzFSkbDvpbftEgVUBEE+T5f7pROhWMp/fxp07oNIEQZd5bbfAH22ohQ==", "dev": true }, "@types/normalize-package-data": { @@ -2169,9 +2169,9 @@ } }, "acorn": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz", - "integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==" + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", + "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==" }, "acorn-node": { "version": "1.8.2", @@ -2930,15 +2930,15 @@ } }, "browserify-sign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.0.tgz", - "integrity": "sha512-hEZC1KEeYuoHRqhGhTy6gWrpJA3ZDjFWv0DE61643ZnOXAKJb3u7yWcrU0mMc9SwAqK1n7myPGndkp0dFG7NFA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", "requires": { "bn.js": "^5.1.1", "browserify-rsa": "^4.0.1", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.2", + "elliptic": "^6.5.3", "inherits": "^2.0.4", "parse-asn1": "^5.1.5", "readable-stream": "^3.6.0", @@ -3885,12 +3885,12 @@ } }, "create-ecdh": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", - "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", "requires": { "bn.js": "^4.1.0", - "elliptic": "^6.0.0" + "elliptic": "^6.5.3" }, "dependencies": { "bn.js": { @@ -4577,9 +4577,9 @@ "dev": true }, "envinfo": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.5.1.tgz", - "integrity": "sha512-hQBkDf2iO4Nv0CNHpCuSBeaSrveU6nThVxFGTrq/eDlV716UQk09zChaJae4mZRsos1x4YLY2TaH3LHUae3ZmQ==", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.7.2.tgz", + "integrity": "sha512-k3Eh5bKuQnZjm49/L7H4cHzs2FlL5QjbTB3JrPxoTI8aJG7hVMe4uKyJxSYH4ahseby2waUwk5OaKX/nAsaYgg==", "dev": true }, "err-code": { @@ -5951,12 +5951,12 @@ "dev": true }, "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", "dev": true, "requires": { - "ajv": "^6.5.5", + "ajv": "^6.12.3", "har-schema": "^2.0.0" } }, @@ -6715,9 +6715,9 @@ } }, "is-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", - "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", + "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", "dev": true, "requires": { "has-symbols": "^1.0.1" @@ -7702,9 +7702,9 @@ "dev": true }, "macos-release": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.4.0.tgz", - "integrity": "sha512-ko6deozZYiAkqa/0gmcsz+p4jSy3gY7/ZsCEokPaYd8k+6/aXGkiTgr61+Owup7Sf+xjqW8u2ElhoM9SEcEfuA==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.4.1.tgz", + "integrity": "sha512-H/QHeBIN1fIGJX517pvK8IEK53yQOW7YcEI55oYtgjDdoCQQz7eJS94qt5kNrscReEyuD/JcdFCm2XBEcGOITg==", "dev": true }, "magic-string": { @@ -7853,9 +7853,9 @@ "dev": true }, "parse-json": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", - "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.1.tgz", + "integrity": "sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -8460,12 +8460,12 @@ "dev": true }, "module-deps": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.2.tgz", - "integrity": "sha512-a9y6yDv5u5I4A+IPHTnqFxcaKr4p50/zxTjcQJaX2ws9tN/W6J6YXnEKhqRyPhl494dkcxx951onSKVezmI+3w==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.3.tgz", + "integrity": "sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==", "requires": { "JSONStream": "^1.0.3", - "browser-resolve": "^1.7.0", + "browser-resolve": "^2.0.0", "cached-path-relative": "^1.0.2", "concat-stream": "~1.6.0", "defined": "^1.0.0", @@ -8481,6 +8481,14 @@ "xtend": "^4.0.0" }, "dependencies": { + "browser-resolve": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", + "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", + "requires": { + "resolve": "^1.17.0" + } + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -10263,9 +10271,9 @@ } }, "rxjs": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.0.tgz", - "integrity": "sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz", + "integrity": "sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg==", "requires": { "tslib": "^1.9.0" } @@ -11756,9 +11764,9 @@ } }, "uglify-js": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.0.tgz", - "integrity": "sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.1.tgz", + "integrity": "sha512-RjxApKkrPJB6kjJxQS3iZlf///REXWYxYJxO/MpmlQzVkDWVI3PSnCBWezMecmTU/TRkNxrl8bmsfFQCp+LO+Q==", "dev": true }, "uid-number": { diff --git a/packages/hardware-wallets/dist/hardware-wallets.esm.js b/packages/hardware-wallets/dist/hardware-wallets.esm.js index 374e06c69..d693e7685 100644 --- a/packages/hardware-wallets/dist/hardware-wallets.esm.js +++ b/packages/hardware-wallets/dist/hardware-wallets.esm.js @@ -3391,6 +3391,7 @@ function EventEmitter() { EventEmitter.init.call(this); } var events = EventEmitter; +var once_1 = once; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; @@ -3782,6 +3783,36 @@ function unwrapListeners(arr) { return ret; } +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); +} +events.once = once_1; + /** */ diff --git a/packages/hardware-wallets/dist/hardware-wallets.esm.min.js b/packages/hardware-wallets/dist/hardware-wallets.esm.min.js index bdb11eb09..f9ad9a0f0 100644 --- a/packages/hardware-wallets/dist/hardware-wallets.esm.min.js +++ b/packages/hardware-wallets/dist/hardware-wallets.esm.min.js @@ -1 +1 @@ -let e={};const t=window;null==t._ethers?console.log("WARNING: @ethersproject/hardware-wallet requires ethers loaded first"):e=t._ethers;var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function a(){s=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}function h(e){var t;s||a();for(var r=e.length,o=r%3,i="",h=[],f=0,c=r-o;fc?c:f+16383));return 1===o?(t=e[r-1],i+=n[t>>2],i+=n[t<<4&63],i+="=="):2===o&&(t=(e[r-2]<<8)+e[r-1],i+=n[t>>10],i+=n[t>>4&63],i+=n[t<<2&63],i+="="),h.push(i),h.join("")}function f(e,t,r,n,o){var i,s,a=8*o-n-1,u=(1<>1,f=-7,c=r?o-1:0,l=r?-1:1,p=e[t+c];for(c+=l,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+e[t+c],c+=l,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=256*s+e[t+c],c+=l,f-=8);if(0===i)i=1-h;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=h}return(p?-1:1)*s*Math.pow(2,i-n)}function c(e,t,r,n,o,i){var s,a,u,h=8*i-o-1,f=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(t*u-1)*Math.pow(2,o),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;e[r+p]=255&a,p+=d,a/=256,o-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,h-=8);e[r+p-d]|=128*g}var l={}.toString,p=Array.isArray||function(e){return"[object Array]"==l.call(e)};v.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT;d();function d(){return v.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(e,t){if(d()=d())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d().toString(16)+" bytes");return 0|e}function T(e){return!(null==e||!e._isBuffer)}function A(e,t){if(T(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return X(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return X(e).length;t=(""+t).toLowerCase(),n=!0}}function R(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return F(this,t,r);case"utf8":case"utf-8":return M(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return D(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function I(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function S(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=v.from(t,n)),T(t))return 0===t.length?-1:b(e,t,r,n,o);if("number"==typeof t)return t&=255,v.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,o){var i,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var f=-1;for(i=r;ia&&(r=a-u),i=r;i>=0;i--){for(var c=!0,l=0;lo&&(n=o):n=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function D(e,t,r){return 0===t&&r===e.length?h(e):h(e.slice(t,r))}function M(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o239?4:h>223?3:h>191?2:1;if(o+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&h)<<6|63&i)>127&&(f=u);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(u=(15&h)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},v.prototype.compare=function(e,t,r,n,o){if(!T(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),h=e.slice(t,r),f=0;fo)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return P(this,e,t,r);case"utf8":case"utf-8":return C(this,e,t,r);case"ascii":return O(this,e,t,r);case"latin1":case"binary":return N(this,e,t,r);case"base64":return U(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function x(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;on)&&(r=n);for(var o="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,r,n,o,i){if(!T(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function G(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o>>8*(n?o:1-o)}function q(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o>>8*(n?o:3-o)&255}function H(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function K(e,t,r,n,o){return o||H(e,0,r,4),c(e,t,r,n,23,4),r+4}function W(e,t,r,n,o){return o||H(e,0,r,8),c(e,t,r,n,52,8),r+8}v.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)n+=this[e+--t]*o;return n},v.prototype.readUInt8=function(e,t){return t||Y(e,1,this.length),this[e]},v.prototype.readUInt16LE=function(e,t){return t||Y(e,2,this.length),this[e]|this[e+1]<<8},v.prototype.readUInt16BE=function(e,t){return t||Y(e,2,this.length),this[e]<<8|this[e+1]},v.prototype.readUInt32LE=function(e,t){return t||Y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},v.prototype.readUInt32BE=function(e,t){return t||Y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},v.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Y(e,t,this.length);for(var n=this[e],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*t)),n},v.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Y(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},v.prototype.readInt8=function(e,t){return t||Y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},v.prototype.readInt16LE=function(e,t){t||Y(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt16BE=function(e,t){t||Y(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt32LE=function(e,t){return t||Y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},v.prototype.readInt32BE=function(e,t){return t||Y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},v.prototype.readFloatLE=function(e,t){return t||Y(e,4,this.length),f(this,e,!0,23,4)},v.prototype.readFloatBE=function(e,t){return t||Y(e,4,this.length),f(this,e,!1,23,4)},v.prototype.readDoubleLE=function(e,t){return t||Y(e,8,this.length),f(this,e,!0,52,8)},v.prototype.readDoubleBE=function(e,t){return t||Y(e,8,this.length),f(this,e,!1,52,8)},v.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+r},v.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,1,255,0),v.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},v.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},v.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},v.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):q(this,e,t,!0),t+4},v.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},v.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);j(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+r},v.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);j(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},v.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,1,127,-128),v.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},v.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},v.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},v.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,2147483647,-2147483648),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):q(this,e,t,!0),t+4},v.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},v.prototype.writeFloatLE=function(e,t,r){return K(this,e,t,!0,r)},v.prototype.writeFloatBE=function(e,t,r){return K(this,e,t,!1,r)},v.prototype.writeDoubleLE=function(e,t,r){return W(this,e,t,!0,r)},v.prototype.writeDoubleBE=function(e,t,r){return W(this,e,t,!1,r)},v.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else if(i<1e3||!v.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Q(e){return function(e){var t,r,n,u,h,f;s||a();var c=e.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");h="="===e[c-2]?2:"="===e[c-1]?1:0,f=new i(3*c/4-h),n=h>0?c-4:c;var l=0;for(t=0,r=0;t>16&255,f[l++]=u>>8&255,f[l++]=255&u;return 2===h?(u=o[e.charCodeAt(t)]<<2|o[e.charCodeAt(t+1)]>>4,f[l++]=255&u):1===h&&(u=o[e.charCodeAt(t)]<<10|o[e.charCodeAt(t+1)]<<4|o[e.charCodeAt(t+2)]>>2,f[l++]=u>>8&255,f[l++]=255&u),f}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function J(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function $(e){let t=[];return e.split("/").forEach(e=>{let r=parseInt(e,10);isNaN(r)||(e.length>1&&"'"===e[e.length-1]&&(r+=2147483648),t.push(r))}),t}function ee(e,t){return Promise.resolve().then(()=>function e(r,n,o){return r>=n.length?o:t(n[r],r).then((function(t){return o.push(t),e(r+1,n,o)}))}(0,e,[]))}var te={},re={},ne=function(e,t){re[e]=t},oe=function(e){var t=function(t,r){Object.assign(this,r),this.name=e,this.message=t||e,this.stack=(new Error).stack};return t.prototype=new Error,te[e]=t,t};oe("AccountNameRequired"),oe("AccountNotSupported"),oe("AmountRequired"),oe("BluetoothRequired"),oe("BtcUnmatchedApp"),oe("CantOpenDevice"),oe("CashAddrNotSupported"),oe("CurrencyNotSupported"),oe("DeviceAppVerifyNotSupported"),oe("DeviceGenuineSocketEarlyClose"),oe("DeviceNotGenuine"),oe("DeviceOnDashboardExpected"),oe("DeviceOnDashboardUnexpected"),oe("DeviceInOSUExpected"),oe("DeviceHalted"),oe("DeviceNameInvalid"),oe("DeviceSocketFail"),oe("DeviceSocketNoBulkStatus"),oe("DisconnectedDevice"),oe("DisconnectedDeviceDuringOperation"),oe("EnpointConfig");var ie=oe("EthAppPleaseEnableContractData");oe("FeeEstimationFailed"),oe("FirmwareNotRecognized"),oe("HardResetFail"),oe("InvalidXRPTag"),oe("InvalidAddress"),oe("InvalidAddressBecauseDestinationIsAlsoSource"),oe("LatestMCUInstalledError"),oe("UnknownMCU"),oe("LedgerAPIError"),oe("LedgerAPIErrorWithMessage"),oe("LedgerAPINotAvailable"),oe("ManagerAppAlreadyInstalled"),oe("ManagerAppRelyOnBTC"),oe("ManagerAppDepInstallRequired"),oe("ManagerAppDepUninstallRequired"),oe("ManagerDeviceLocked"),oe("ManagerFirmwareNotEnoughSpace"),oe("ManagerNotEnoughSpace"),oe("ManagerUninstallBTCDep"),oe("NetworkDown"),oe("NoAddressesFound"),oe("NotEnoughBalance"),oe("NotEnoughBalanceToDelegate"),oe("NotEnoughBalanceInParentAccount"),oe("NotEnoughSpendableBalance"),oe("NotEnoughBalanceBecauseDestinationNotCreated"),oe("NoAccessToCamera"),oe("NotEnoughGas"),oe("NotSupportedLegacyAddress"),oe("GasLessThanEstimate"),oe("PasswordsDontMatch"),oe("PasswordIncorrect"),oe("RecommendSubAccountsToEmpty"),oe("RecommendUndelegation"),oe("TimeoutTagged"),oe("UnexpectedBootloader"),oe("MCUNotGenuineToDashboard"),oe("RecipientRequired"),oe("UnavailableTezosOriginatedAccountReceive"),oe("UnavailableTezosOriginatedAccountSend"),oe("UpdateFetchFileFail"),oe("UpdateIncorrectHash"),oe("UpdateIncorrectSig"),oe("UpdateYourApp"),oe("UserRefusedDeviceNameChange"),oe("UserRefusedAddress"),oe("UserRefusedFirmwareUpdate"),oe("UserRefusedAllowManager"),oe("UserRefusedOnDevice"),oe("TransportOpenUserCancelled"),oe("TransportInterfaceNotAvailable"),oe("TransportRaceCondition"),oe("TransportWebUSBGestureRequired"),oe("DeviceShouldStayInApp"),oe("WebsocketConnectionError"),oe("WebsocketConnectionFailed"),oe("WrongDeviceForAccount"),oe("WrongAppForCurrency"),oe("ETHAddressNonEIP"),oe("CantScanQRCode"),oe("FeeNotLoaded"),oe("FeeRequired"),oe("FeeTooHigh"),oe("SyncError"),oe("PairingFailed"),oe("GenuineCheckFailed"),oe("LedgerAPI4xx"),oe("LedgerAPI5xx"),oe("FirmwareOrAppUpdateRequired"),oe("NoDBPathGiven"),oe("DBWrongPassword"),oe("DBNotReset");function se(e,t){this.name="TransportError",this.message=e,this.stack=(new Error).stack,this.id=t}se.prototype=new Error,ne("TransportError",(function(e){return new se(e.message,e.id)}));var ae={PIN_REMAINING_ATTEMPTS:25536,INCORRECT_LENGTH:26368,MISSING_CRITICAL_PARAMETER:26624,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,SECURITY_STATUS_NOT_SATISFIED:27010,CONDITIONS_OF_USE_NOT_SATISFIED:27013,INCORRECT_DATA:27264,NOT_ENOUGH_MEMORY_SPACE:27268,REFERENCED_DATA_NOT_FOUND:27272,FILE_ALREADY_EXISTS:27273,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,CLA_NOT_SUPPORTED:28160,TECHNICAL_PROBLEM:28416,OK:36864,MEMORY_PROBLEM:37440,NO_EF_SELECTED:37888,INVALID_OFFSET:37890,FILE_NOT_FOUND:37892,INCONSISTENT_FILE:37896,ALGORITHM_NOT_SUPPORTED:38020,INVALID_KCV:38021,CODE_NOT_INITIALIZED:38914,ACCESS_CONDITION_NOT_FULFILLED:38916,CONTRADICTION_SECRET_CODE_STATUS:38920,CONTRADICTION_INVALIDATION:38928,CODE_BLOCKED:38976,MAX_VALUE_REACHED:38992,GP_AUTH_FAILED:25344,LICENSING:28482,HALTED:28586};function ue(e){this.name="TransportStatusError";var t=Object.keys(ae).find((function(t){return ae[t]===e}))||"UNKNOWN_ERROR",r=function(e){switch(e){case 26368:return"Incorrect length";case 26624:return"Missing critical parameter";case 27010:return"Security not satisfied (dongle locked or have invalid access rights)";case 27013:return"Condition of use not satisfied (denied by the user?)";case 27264:return"Invalid data received";case 27392:return"Invalid parameter received"}if(28416<=e&&e<=28671)return"Internal error, please report"}(e)||t,n=e.toString(16);this.message="Ledger device: "+r+" (0x"+n+")",this.stack=(new Error).stack,this.statusCode=e,this.statusText=t}ue.prototype=new Error,ne("TransportStatusError",(function(e){return new ue(e.statusCode)}));class he{constructor(e,t="w0w"){this.transport=void 0,this.transport=e,e.decorateAppAPIMethods(this,["getAddress","provideERC20TokenInformation","signTransaction","signPersonalMessage","getAppConfiguration"],t)}getAddress(e,t,r){let n=$(e),o=v.alloc(1+4*n.length);return o[0]=n.length,n.forEach((e,t)=>{o.writeUInt32BE(e,1+4*t)}),this.transport.send(224,2,t?1:0,r?1:0,o).then(e=>{let t={},n=e[0],o=e[1+n];return t.publicKey=e.slice(1,1+n).toString("hex"),t.address="0x"+e.slice(1+n+1,1+n+1+o).toString("ascii"),r&&(t.chainCode=e.slice(1+n+1+o,1+n+1+o+32).toString("hex")),t})}provideERC20TokenInformation({data:e}){return this.transport.send(224,10,0,0,e).then(()=>!0,e=>{if(e&&27904===e.statusCode)return!1;throw e})}signTransaction(e,t){let r,n=$(e),o=0,i=v.from(t,"hex"),s=[];for(;o!==i.length;){let e=0===o?149-4*n.length:150,t=o+e>i.length?i.length-o:e,r=v.alloc(0===o?1+4*n.length+t:t);0===o?(r[0]=n.length,n.forEach((e,t)=>{r.writeUInt32BE(e,1+4*t)}),i.copy(r,1+4*n.length,o,o+t)):i.copy(r,0,o,o+t),s.push(r),o+=t}return ee(s,(e,t)=>this.transport.send(224,4,0===t?0:128,0,e).then(e=>{r=e})).then(()=>({v:r.slice(0,1).toString("hex"),r:r.slice(1,33).toString("hex"),s:r.slice(33,65).toString("hex")}),e=>{throw(e=>e&&27264===e.statusCode?new ie("Please enable Contract data on the Ethereum app Settings"):e)(e)})}getAppConfiguration(){return this.transport.send(224,6,0,0).then(e=>{let t={};return t.arbitraryDataEnabled=1&e[0],t.version=e[1]+"."+e[2]+"."+e[3],t})}signPersonalMessage(e,t){let r,n=$(e),o=0,i=v.from(t,"hex"),s=[];for(;o!==i.length;){let e=0===o?149-4*n.length-4:150,t=o+e>i.length?i.length-o:e,r=v.alloc(0===o?1+4*n.length+4+t:t);0===o?(r[0]=n.length,n.forEach((e,t)=>{r.writeUInt32BE(e,1+4*t)}),r.writeUInt32BE(i.length,1+4*n.length),i.copy(r,1+4*n.length+4,o,o+t)):i.copy(r,0,o,o+t),s.push(r),o+=t}return ee(s,(e,t)=>this.transport.send(224,8,0===t?0:128,0,e).then(e=>{r=e})).then(()=>({v:r[0],r:r.slice(1,33).toString("hex"),s:r.slice(33,65).toString("hex")}))}}var fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var ce=ce||{},le=ce;ce.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd",ce.MessageTypes={U2F_REGISTER_REQUEST:"u2f_register_request",U2F_SIGN_REQUEST:"u2f_sign_request",U2F_REGISTER_RESPONSE:"u2f_register_response",U2F_SIGN_RESPONSE:"u2f_sign_response"},ce.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},ce.Request,ce.Response,ce.Error,ce.SignRequest,ce.SignResponse,ce.RegisterRequest,ce.RegisterResponse,ce.disconnect=function(){ce.port_&&ce.port_.port_&&(ce.port_.port_.disconnect(),ce.port_=null)},ce.getMessagePort=function(e){if("undefined"!=typeof chrome&&chrome.runtime){var t={type:ce.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]};chrome.runtime.sendMessage(ce.EXTENSION_ID,t,(function(){chrome.runtime.lastError?ce.getIframePort_(e):ce.getChromeRuntimePort_(e)}))}else ce.getIframePort_(e)},ce.getChromeRuntimePort_=function(e){var t=chrome.runtime.connect(ce.EXTENSION_ID,{includeTlsChannelId:!0});setTimeout((function(){e(null,new ce.WrappedChromeRuntimePort_(t))}),0)},ce.WrappedChromeRuntimePort_=function(e){this.port_=e},ce.WrappedChromeRuntimePort_.prototype.postMessage=function(e){this.port_.postMessage(e)},ce.WrappedChromeRuntimePort_.prototype.addEventListener=function(e,t){var r=e.toLowerCase();"message"==r||"onmessage"==r?this.port_.onMessage.addListener((function(e){t({data:e})})):console.error("WrappedChromeRuntimePort only supports onMessage")},ce.getIframePort_=function(e){var t="chrome-extension://"+ce.EXTENSION_ID,r=document.createElement("iframe");r.src=t+"/u2f-comms.html",r.setAttribute("style","display:none"),document.body.appendChild(r);var n=!1,o=new MessageChannel,i=function(t){"ready"==t.data?(o.port1.removeEventListener("message",i),n||(n=!0,e(null,o.port1))):console.error('First event on iframe port was not "ready"')};o.port1.addEventListener("message",i),o.port1.start(),r.addEventListener("load",(function(){r.contentWindow.postMessage("init",t,[o.port2])})),setTimeout((function(){n||(n=!0,e(new Error("IFrame extension not supported")))}),200)},ce.EXTENSION_TIMEOUT_SEC=30,ce.port_=null,ce.waitingForPort_=[],ce.reqCounter_=0,ce.callbackMap_={},ce.getPortSingleton_=function(e){ce.port_?e(null,ce.port_):(0==ce.waitingForPort_.length&&ce.getMessagePort((function(e,t){for(e||(ce.port_=t,ce.port_.addEventListener("message",ce.responseHandler_));ce.waitingForPort_.length;)ce.waitingForPort_.shift()(e,t)})),ce.waitingForPort_.push(e))},ce.responseHandler_=function(e){var t=e.data,r=t.requestId;if(r&&ce.callbackMap_[r]){var n=ce.callbackMap_[r];delete ce.callbackMap_[r],n(null,t.responseData)}else console.error("Unknown or missing requestId in response.")},ce.isSupported=function(e){ce.getPortSingleton_((function(t,r){e(!t)}))},ce.sign=function(e,t,r){ce.getPortSingleton_((function(n,o){if(n)return t(n);var i=++ce.reqCounter_;ce.callbackMap_[i]=t;var s={type:ce.MessageTypes.U2F_SIGN_REQUEST,signRequests:e,timeoutSeconds:void 0!==r?r:ce.EXTENSION_TIMEOUT_SEC,requestId:i};o.postMessage(s)}))},ce.register=function(e,t,r,n){ce.getPortSingleton_((function(o,i){if(o)return r(o);var s=++ce.reqCounter_;ce.callbackMap_[s]=r;var a={type:ce.MessageTypes.U2F_REGISTER_REQUEST,signRequests:t,registerRequests:e,timeoutSeconds:void 0!==n?n:ce.EXTENSION_TIMEOUT_SEC,requestId:s};i.postMessage(a)}))};var pe=we,de="undefined"!=typeof navigator&&!!navigator.userAgent,ge=de&&navigator.userAgent.match(/Safari\//)&&!navigator.userAgent.match(/Chrome\//),ve=de&&navigator.userAgent.match(/Edge\/1[2345]/),ye=null;function Ee(e){return ye||(ye=new e((function(e,t){function r(){e({u2f:null,native:!0})}return de?ge?r():(void 0!==window.u2f&&"function"==typeof window.u2f.sign&&e({u2f:window.u2f,native:!0}),ve||"http:"===location.protocol||"undefined"==typeof MessageChannel?r():void le.isSupported((function(t){t?e({u2f:le,native:!1}):r()}))):r()}))),ye}function we(e){return{isSupported:Te.bind(e),ensureSupport:Re.bind(e),register:Ie.bind(e),sign:Se.bind(e),ErrorCodes:we.ErrorCodes,ErrorNames:we.ErrorNames}}function me(e,t){var r=null!=t?t.errorCode:1,n=we.ErrorNames[""+r],o=new Error(e);return o.metaData={type:n,code:r},o}function _e(e,t){var r={};return r.promise=new e((function(e,n){r.resolve=e,r.reject=n,t.then(e,n)})),r.promise.cancel=function(t,n){Ee(e).then((function(e){n&&!e.native&&e.u2f.disconnect(),r.reject(me(t,{errorCode:-1}))}))},r}function Te(){return Ee(this).then((function(e){return!!e.u2f}))}function Ae(e){if(!e.u2f){if("http:"===location.protocol)throw new Error("U2F isn't supported over http, only https");throw new Error("U2F not supported")}}function Re(){return Ee(this).then(Ae)}function Ie(e,t,r){var n=this;return Array.isArray(e)||(e=[e]),"number"==typeof t&&void 0===r&&(r=t,t=null),t||(t=[]),_e(n,Ee(n).then((function(o){Ae(o);var i=o.native,s=o.u2f;return new n((function(n,o){if(i){var a=e[0].appId;s.register(a,e,t,(function(e){e.errorCode?o(me("Registration failed",e)):(delete e.errorCode,n(e))}),r)}else s.register(e,t,(function(e,t){e?o(e):t.errorCode?o(me("Registration failed",t)):n(t)}),r)}))}))).promise}function Se(e,t){var r=this;return Array.isArray(e)||(e=[e]),_e(r,Ee(r).then((function(n){Ae(n);var o=n.native,i=n.u2f;return new r((function(r,n){if(o){var s=e[0].appId,a=e[0].challenge;i.sign(s,a,e,(function(e){e.errorCode?n(me("Sign failed",e)):(delete e.errorCode,r(e))}),t)}else i.sign(e,(function(e,t){e?n(e):t.errorCode?n(me("Sign failed",t)):r(t)}),t)}))}))).promise}function be(e){we[e]=function(){if(!fe.Promise)throw new Error("The platform doesn't natively support promises");var t=[].slice.call(arguments);return we(fe.Promise)[e].apply(null,t)}}we.ErrorCodes={CANCELLED:-1,OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},we.ErrorNames={"-1":"CANCELLED",0:"OK",1:"OTHER_ERROR",2:"BAD_REQUEST",3:"CONFIGURATION_UNSUPPORTED",4:"DEVICE_INELIGIBLE",5:"TIMEOUT"},be("isSupported"),be("ensureSupport"),be("register"),be("sign");var Pe,Ce=pe,Oe=Ce.isSupported,Ne=Ce.sign,Ue="object"==typeof Reflect?Reflect:null,Le=Ue&&"function"==typeof Ue.apply?Ue.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};Pe=Ue&&"function"==typeof Ue.ownKeys?Ue.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var De=Number.isNaN||function(e){return e!=e};function Me(){Me.init.call(this)}var xe=Me;Me.EventEmitter=Me,Me.prototype._events=void 0,Me.prototype._eventsCount=0,Me.prototype._maxListeners=void 0;var Be=10;function Fe(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function ke(e){return void 0===e._maxListeners?Me.defaultMaxListeners:e._maxListeners}function Ye(e,t,r,n){var o,i,s,a;if(Fe(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]),void 0===s)s=i[t]=r,++e._eventsCount;else if("function"==typeof s?s=i[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=ke(e))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function je(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ge(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=je.bind(n);return o.listener=r,n.wrapFn=o,o}function qe(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var a=o[e];if(void 0===a)return!1;if("function"==typeof a)Le(a,this,t);else{var u=a.length,h=Ke(a,u);for(r=0;r=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},Me.prototype.listeners=function(e){return qe(this,e,!0)},Me.prototype.rawListeners=function(e){return qe(this,e,!1)},Me.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):He.call(e,t)},Me.prototype.listenerCount=He,Me.prototype.eventNames=function(){return this._eventsCount>0?Pe(this._events):[]};class We{constructor(){this.exchangeTimeout=3e4,this._events=new xe,this.send=async(e,t,r,n,o=v.alloc(0),i=[ae.OK])=>{if(o.length>=256)throw new se("data.length exceed 256 bytes limit. Got: "+o.length,"DataLengthTooBig");const s=await this.exchange(v.concat([v.from([e,t,r,n]),v.from([o.length]),o])),a=s.readUInt16BE(s.length-2);if(!i.some(e=>e===a))throw new ue(a);return s},this.exchangeBusyPromise=void 0,this.exchangeAtomicImpl=async e=>{if(this.exchangeBusyPromise)throw new se("Transport race condition","RaceCondition");let t;const r=new Promise(e=>{t=e});this.exchangeBusyPromise=r;try{return await e()}finally{t&&t(),this.exchangeBusyPromise=null}},this._appAPIlock=null}exchange(e){throw new Error("exchange not implemented")}setScrambleKey(e){}close(){return Promise.resolve()}on(e,t){this._events.on(e,t)}off(e,t){this._events.removeListener(e,t)}emit(e,...t){this._events.emit(e,...t)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(e){this.exchangeTimeout=e}static create(e=3e3,t){return new Promise((r,n)=>{let o=!1;const i=this.listen({next:t=>{o=!0,i&&i.unsubscribe(),s&&clearTimeout(s),this.open(t.descriptor,e).then(r,n)},error:e=>{s&&clearTimeout(s),n(e)},complete:()=>{s&&clearTimeout(s),o||n(new se(this.ErrorMessage_NoDeviceFound,"NoDeviceFound"))}}),s=t?setTimeout(()=>{i.unsubscribe(),n(new se(this.ErrorMessage_ListenTimeout,"ListenTimeout"))},t):null})}decorateAppAPIMethods(e,t,r){for(let n of t)e[n]=this.decorateAppAPIMethod(n,e[n],e,r)}decorateAppAPIMethod(e,t,r,n){return async(...o)=>{const{_appAPIlock:i}=this;if(i)return Promise.reject(new se("Ledger Device is busy (lock "+i+")","TransportLocked"));try{return this._appAPIlock=e,this.setScrambleKey(n),await t.apply(r,o)}finally{this._appAPIlock=null}}}}We.isSupported=void 0,We.list=void 0,We.listen=void 0,We.open=void 0,We.ErrorMessage_ListenTimeout="No Ledger device found (timeout)",We.ErrorMessage_NoDeviceFound="No Ledger device found";let ze=0;const Ve=[],Xe=(e,t,r)=>{const n={type:e,id:String(++ze),date:new Date};t&&(n.message=t),r&&(n.data=r),function(e){for(let t=0;t(Ve.push(e),()=>{const t=Ve.indexOf(e);-1!==t&&(Ve[t]=Ve[Ve.length-1],Ve.pop())});"undefined"!=typeof window&&(window.__ledgerLogsListen=Qe);const Ze=e=>e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function Je(e,t,r,n){const o=function(e,t){const r=v.alloc(e.length);for(let n=0;n "+e.toString("hex")),Ne(s,t/1e3).then(e=>{const{signatureData:t}=e;if("string"==typeof t){const e=v.from((r=t).replace(/-/g,"+").replace(/_/g,"/")+"==".substring(0,3*r.length%4),"base64");let o;return o=n?e.slice(5):e,Xe("apdu","<= "+o.toString("hex")),o}throw e;var r})}let $e=[];class et extends We{static async open(e,t=5e3){return new et}constructor(){super(),this.scrambleKey=void 0,this.unwrap=!0,$e.push(this)}async exchange(e){try{return await Je(e,this.exchangeTimeout,this.scrambleKey,this.unwrap)}catch(e){throw"object"==typeof e.metaData?(5===e.metaData.code&&($e.forEach(e=>e.emit("disconnect")),$e=[]),function(e,t,r){const n=new se(t,r);return n.originalError=e,n}(e,"Failed to sign with Ledger device: U2F "+e.metaData.type,"U2F_"+e.metaData.code)):e}}setScrambleKey(e){this.scrambleKey=v.from(e,"ascii")}setUnwrap(e){this.unwrap=e}close(){return Promise.resolve()}}et.isSupported=Oe,et.list=()=>Oe().then(e=>e?[null]:[]),et.listen=e=>{let t=!1;return Oe().then(r=>{t||(r?(e.next({type:"add",descriptor:null}),e.complete()):e.error(new se("U2F browser support is needed for Ledger. Please use Chrome, Opera or Firefox with a U2F extension. Also make sure you're on an HTTPS connection","U2FNotSupported")))}),{unsubscribe:()=>{t=!0}}};const tt={u2f:et,default:et};var rt=window&&window.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const nt=new e.utils.Logger("hardware-wallets/5.0.2");function ot(e){return new Promise(t=>{setTimeout(t,e)})}class it extends e.Signer{constructor(t,r,n){super(),null==n&&(n="m/44'/60'/0'/0/0"),null==r&&(r="default"),e.utils.defineReadOnly(this,"path",n),e.utils.defineReadOnly(this,"type",r),e.utils.defineReadOnly(this,"provider",t||null);const o=tt[r];o||nt.throwArgumentError("unknown or unsupported type","type",r),e.utils.defineReadOnly(this,"_eth",o.create().then(e=>{const t=new he(e);return t.getAppConfiguration().then(e=>t,e=>Promise.reject(e))},e=>Promise.reject(e)))}_retry(e,t){return new Promise((r,n)=>rt(this,void 0,void 0,(function*(){t&&t>0&&setTimeout(()=>{n(new Error("timeout"))},t);const o=yield this._eth;for(let t=0;t<50;t++){try{const t=yield e(o);return r(t)}catch(e){if("TransportLocked"!==e.id)return n(e)}yield ot(100)}return n(new Error("timeout"))})))}getAddress(){return rt(this,void 0,void 0,(function*(){const t=yield this._retry(e=>e.getAddress(this.path));return e.utils.getAddress(t.address)}))}signMessage(t){return rt(this,void 0,void 0,(function*(){"string"==typeof t&&(t=e.utils.toUtf8Bytes(t));const r=e.utils.hexlify(t).substring(2),n=yield this._retry(e=>e.signPersonalMessage(this.path,r));return n.r="0x"+n.r,n.s="0x"+n.s,e.utils.joinSignature(n)}))}signTransaction(t){return rt(this,void 0,void 0,(function*(){const r=t=yield e.utils.resolveProperties(t),n=e.utils.serializeTransaction(r).substring(2),o=yield this._retry(e=>e.signTransaction(this.path,n));return e.utils.serializeTransaction(r,{v:o.v,r:"0x"+o.r,s:"0x"+o.s})}))}connect(e){return new it(e,this.type,this.path)}}export{it as LedgerSigner}; +let e={};const t=window;null==t._ethers?console.log("WARNING: @ethersproject/hardware-wallet requires ethers loaded first"):e=t._ethers;var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function a(){s=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}function h(e){var t;s||a();for(var r=e.length,o=r%3,i="",h=[],f=0,c=r-o;fc?c:f+16383));return 1===o?(t=e[r-1],i+=n[t>>2],i+=n[t<<4&63],i+="=="):2===o&&(t=(e[r-2]<<8)+e[r-1],i+=n[t>>10],i+=n[t>>4&63],i+=n[t<<2&63],i+="="),h.push(i),h.join("")}function f(e,t,r,n,o){var i,s,a=8*o-n-1,u=(1<>1,f=-7,c=r?o-1:0,l=r?-1:1,p=e[t+c];for(c+=l,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+e[t+c],c+=l,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=256*s+e[t+c],c+=l,f-=8);if(0===i)i=1-h;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=h}return(p?-1:1)*s*Math.pow(2,i-n)}function c(e,t,r,n,o,i){var s,a,u,h=8*i-o-1,f=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(t*u-1)*Math.pow(2,o),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;e[r+p]=255&a,p+=d,a/=256,o-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,h-=8);e[r+p-d]|=128*g}var l={}.toString,p=Array.isArray||function(e){return"[object Array]"==l.call(e)};v.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT;d();function d(){return v.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(e,t){if(d()=d())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d().toString(16)+" bytes");return 0|e}function T(e){return!(null==e||!e._isBuffer)}function A(e,t){if(T(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return X(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return X(e).length;t=(""+t).toLowerCase(),n=!0}}function R(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return F(this,t,r);case"utf8":case"utf-8":return M(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return D(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function I(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function S(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=v.from(t,n)),T(t))return 0===t.length?-1:b(e,t,r,n,o);if("number"==typeof t)return t&=255,v.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,o){var i,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var f=-1;for(i=r;ia&&(r=a-u),i=r;i>=0;i--){for(var c=!0,l=0;lo&&(n=o):n=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function D(e,t,r){return 0===t&&r===e.length?h(e):h(e.slice(t,r))}function M(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o239?4:h>223?3:h>191?2:1;if(o+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&h)<<6|63&i)>127&&(f=u);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(u=(15&h)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},v.prototype.compare=function(e,t,r,n,o){if(!T(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),h=e.slice(t,r),f=0;fo)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return P(this,e,t,r);case"utf8":case"utf-8":return C(this,e,t,r);case"ascii":return O(this,e,t,r);case"latin1":case"binary":return N(this,e,t,r);case"base64":return U(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function x(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;on)&&(r=n);for(var o="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,r,n,o,i){if(!T(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function G(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o>>8*(n?o:1-o)}function q(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o>>8*(n?o:3-o)&255}function H(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function K(e,t,r,n,o){return o||H(e,0,r,4),c(e,t,r,n,23,4),r+4}function W(e,t,r,n,o){return o||H(e,0,r,8),c(e,t,r,n,52,8),r+8}v.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)n+=this[e+--t]*o;return n},v.prototype.readUInt8=function(e,t){return t||Y(e,1,this.length),this[e]},v.prototype.readUInt16LE=function(e,t){return t||Y(e,2,this.length),this[e]|this[e+1]<<8},v.prototype.readUInt16BE=function(e,t){return t||Y(e,2,this.length),this[e]<<8|this[e+1]},v.prototype.readUInt32LE=function(e,t){return t||Y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},v.prototype.readUInt32BE=function(e,t){return t||Y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},v.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Y(e,t,this.length);for(var n=this[e],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*t)),n},v.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Y(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},v.prototype.readInt8=function(e,t){return t||Y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},v.prototype.readInt16LE=function(e,t){t||Y(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt16BE=function(e,t){t||Y(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt32LE=function(e,t){return t||Y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},v.prototype.readInt32BE=function(e,t){return t||Y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},v.prototype.readFloatLE=function(e,t){return t||Y(e,4,this.length),f(this,e,!0,23,4)},v.prototype.readFloatBE=function(e,t){return t||Y(e,4,this.length),f(this,e,!1,23,4)},v.prototype.readDoubleLE=function(e,t){return t||Y(e,8,this.length),f(this,e,!0,52,8)},v.prototype.readDoubleBE=function(e,t){return t||Y(e,8,this.length),f(this,e,!1,52,8)},v.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+r},v.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,1,255,0),v.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},v.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},v.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},v.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):q(this,e,t,!0),t+4},v.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},v.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);j(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+r},v.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);j(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},v.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,1,127,-128),v.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},v.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},v.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},v.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,2147483647,-2147483648),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):q(this,e,t,!0),t+4},v.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},v.prototype.writeFloatLE=function(e,t,r){return K(this,e,t,!0,r)},v.prototype.writeFloatBE=function(e,t,r){return K(this,e,t,!1,r)},v.prototype.writeDoubleLE=function(e,t,r){return W(this,e,t,!0,r)},v.prototype.writeDoubleBE=function(e,t,r){return W(this,e,t,!1,r)},v.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else if(i<1e3||!v.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Q(e){return function(e){var t,r,n,u,h,f;s||a();var c=e.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");h="="===e[c-2]?2:"="===e[c-1]?1:0,f=new i(3*c/4-h),n=h>0?c-4:c;var l=0;for(t=0,r=0;t>16&255,f[l++]=u>>8&255,f[l++]=255&u;return 2===h?(u=o[e.charCodeAt(t)]<<2|o[e.charCodeAt(t+1)]>>4,f[l++]=255&u):1===h&&(u=o[e.charCodeAt(t)]<<10|o[e.charCodeAt(t+1)]<<4|o[e.charCodeAt(t+2)]>>2,f[l++]=u>>8&255,f[l++]=255&u),f}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function J(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function $(e){let t=[];return e.split("/").forEach(e=>{let r=parseInt(e,10);isNaN(r)||(e.length>1&&"'"===e[e.length-1]&&(r+=2147483648),t.push(r))}),t}function ee(e,t){return Promise.resolve().then(()=>function e(r,n,o){return r>=n.length?o:t(n[r],r).then((function(t){return o.push(t),e(r+1,n,o)}))}(0,e,[]))}var te={},re={},ne=function(e,t){re[e]=t},oe=function(e){var t=function(t,r){Object.assign(this,r),this.name=e,this.message=t||e,this.stack=(new Error).stack};return t.prototype=new Error,te[e]=t,t};oe("AccountNameRequired"),oe("AccountNotSupported"),oe("AmountRequired"),oe("BluetoothRequired"),oe("BtcUnmatchedApp"),oe("CantOpenDevice"),oe("CashAddrNotSupported"),oe("CurrencyNotSupported"),oe("DeviceAppVerifyNotSupported"),oe("DeviceGenuineSocketEarlyClose"),oe("DeviceNotGenuine"),oe("DeviceOnDashboardExpected"),oe("DeviceOnDashboardUnexpected"),oe("DeviceInOSUExpected"),oe("DeviceHalted"),oe("DeviceNameInvalid"),oe("DeviceSocketFail"),oe("DeviceSocketNoBulkStatus"),oe("DisconnectedDevice"),oe("DisconnectedDeviceDuringOperation"),oe("EnpointConfig");var ie=oe("EthAppPleaseEnableContractData");oe("FeeEstimationFailed"),oe("FirmwareNotRecognized"),oe("HardResetFail"),oe("InvalidXRPTag"),oe("InvalidAddress"),oe("InvalidAddressBecauseDestinationIsAlsoSource"),oe("LatestMCUInstalledError"),oe("UnknownMCU"),oe("LedgerAPIError"),oe("LedgerAPIErrorWithMessage"),oe("LedgerAPINotAvailable"),oe("ManagerAppAlreadyInstalled"),oe("ManagerAppRelyOnBTC"),oe("ManagerAppDepInstallRequired"),oe("ManagerAppDepUninstallRequired"),oe("ManagerDeviceLocked"),oe("ManagerFirmwareNotEnoughSpace"),oe("ManagerNotEnoughSpace"),oe("ManagerUninstallBTCDep"),oe("NetworkDown"),oe("NoAddressesFound"),oe("NotEnoughBalance"),oe("NotEnoughBalanceToDelegate"),oe("NotEnoughBalanceInParentAccount"),oe("NotEnoughSpendableBalance"),oe("NotEnoughBalanceBecauseDestinationNotCreated"),oe("NoAccessToCamera"),oe("NotEnoughGas"),oe("NotSupportedLegacyAddress"),oe("GasLessThanEstimate"),oe("PasswordsDontMatch"),oe("PasswordIncorrect"),oe("RecommendSubAccountsToEmpty"),oe("RecommendUndelegation"),oe("TimeoutTagged"),oe("UnexpectedBootloader"),oe("MCUNotGenuineToDashboard"),oe("RecipientRequired"),oe("UnavailableTezosOriginatedAccountReceive"),oe("UnavailableTezosOriginatedAccountSend"),oe("UpdateFetchFileFail"),oe("UpdateIncorrectHash"),oe("UpdateIncorrectSig"),oe("UpdateYourApp"),oe("UserRefusedDeviceNameChange"),oe("UserRefusedAddress"),oe("UserRefusedFirmwareUpdate"),oe("UserRefusedAllowManager"),oe("UserRefusedOnDevice"),oe("TransportOpenUserCancelled"),oe("TransportInterfaceNotAvailable"),oe("TransportRaceCondition"),oe("TransportWebUSBGestureRequired"),oe("DeviceShouldStayInApp"),oe("WebsocketConnectionError"),oe("WebsocketConnectionFailed"),oe("WrongDeviceForAccount"),oe("WrongAppForCurrency"),oe("ETHAddressNonEIP"),oe("CantScanQRCode"),oe("FeeNotLoaded"),oe("FeeRequired"),oe("FeeTooHigh"),oe("SyncError"),oe("PairingFailed"),oe("GenuineCheckFailed"),oe("LedgerAPI4xx"),oe("LedgerAPI5xx"),oe("FirmwareOrAppUpdateRequired"),oe("NoDBPathGiven"),oe("DBWrongPassword"),oe("DBNotReset");function se(e,t){this.name="TransportError",this.message=e,this.stack=(new Error).stack,this.id=t}se.prototype=new Error,ne("TransportError",(function(e){return new se(e.message,e.id)}));var ae={PIN_REMAINING_ATTEMPTS:25536,INCORRECT_LENGTH:26368,MISSING_CRITICAL_PARAMETER:26624,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,SECURITY_STATUS_NOT_SATISFIED:27010,CONDITIONS_OF_USE_NOT_SATISFIED:27013,INCORRECT_DATA:27264,NOT_ENOUGH_MEMORY_SPACE:27268,REFERENCED_DATA_NOT_FOUND:27272,FILE_ALREADY_EXISTS:27273,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,CLA_NOT_SUPPORTED:28160,TECHNICAL_PROBLEM:28416,OK:36864,MEMORY_PROBLEM:37440,NO_EF_SELECTED:37888,INVALID_OFFSET:37890,FILE_NOT_FOUND:37892,INCONSISTENT_FILE:37896,ALGORITHM_NOT_SUPPORTED:38020,INVALID_KCV:38021,CODE_NOT_INITIALIZED:38914,ACCESS_CONDITION_NOT_FULFILLED:38916,CONTRADICTION_SECRET_CODE_STATUS:38920,CONTRADICTION_INVALIDATION:38928,CODE_BLOCKED:38976,MAX_VALUE_REACHED:38992,GP_AUTH_FAILED:25344,LICENSING:28482,HALTED:28586};function ue(e){this.name="TransportStatusError";var t=Object.keys(ae).find((function(t){return ae[t]===e}))||"UNKNOWN_ERROR",r=function(e){switch(e){case 26368:return"Incorrect length";case 26624:return"Missing critical parameter";case 27010:return"Security not satisfied (dongle locked or have invalid access rights)";case 27013:return"Condition of use not satisfied (denied by the user?)";case 27264:return"Invalid data received";case 27392:return"Invalid parameter received"}if(28416<=e&&e<=28671)return"Internal error, please report"}(e)||t,n=e.toString(16);this.message="Ledger device: "+r+" (0x"+n+")",this.stack=(new Error).stack,this.statusCode=e,this.statusText=t}ue.prototype=new Error,ne("TransportStatusError",(function(e){return new ue(e.statusCode)}));class he{constructor(e,t="w0w"){this.transport=void 0,this.transport=e,e.decorateAppAPIMethods(this,["getAddress","provideERC20TokenInformation","signTransaction","signPersonalMessage","getAppConfiguration"],t)}getAddress(e,t,r){let n=$(e),o=v.alloc(1+4*n.length);return o[0]=n.length,n.forEach((e,t)=>{o.writeUInt32BE(e,1+4*t)}),this.transport.send(224,2,t?1:0,r?1:0,o).then(e=>{let t={},n=e[0],o=e[1+n];return t.publicKey=e.slice(1,1+n).toString("hex"),t.address="0x"+e.slice(1+n+1,1+n+1+o).toString("ascii"),r&&(t.chainCode=e.slice(1+n+1+o,1+n+1+o+32).toString("hex")),t})}provideERC20TokenInformation({data:e}){return this.transport.send(224,10,0,0,e).then(()=>!0,e=>{if(e&&27904===e.statusCode)return!1;throw e})}signTransaction(e,t){let r,n=$(e),o=0,i=v.from(t,"hex"),s=[];for(;o!==i.length;){let e=0===o?149-4*n.length:150,t=o+e>i.length?i.length-o:e,r=v.alloc(0===o?1+4*n.length+t:t);0===o?(r[0]=n.length,n.forEach((e,t)=>{r.writeUInt32BE(e,1+4*t)}),i.copy(r,1+4*n.length,o,o+t)):i.copy(r,0,o,o+t),s.push(r),o+=t}return ee(s,(e,t)=>this.transport.send(224,4,0===t?0:128,0,e).then(e=>{r=e})).then(()=>({v:r.slice(0,1).toString("hex"),r:r.slice(1,33).toString("hex"),s:r.slice(33,65).toString("hex")}),e=>{throw(e=>e&&27264===e.statusCode?new ie("Please enable Contract data on the Ethereum app Settings"):e)(e)})}getAppConfiguration(){return this.transport.send(224,6,0,0).then(e=>{let t={};return t.arbitraryDataEnabled=1&e[0],t.version=e[1]+"."+e[2]+"."+e[3],t})}signPersonalMessage(e,t){let r,n=$(e),o=0,i=v.from(t,"hex"),s=[];for(;o!==i.length;){let e=0===o?149-4*n.length-4:150,t=o+e>i.length?i.length-o:e,r=v.alloc(0===o?1+4*n.length+4+t:t);0===o?(r[0]=n.length,n.forEach((e,t)=>{r.writeUInt32BE(e,1+4*t)}),r.writeUInt32BE(i.length,1+4*n.length),i.copy(r,1+4*n.length+4,o,o+t)):i.copy(r,0,o,o+t),s.push(r),o+=t}return ee(s,(e,t)=>this.transport.send(224,8,0===t?0:128,0,e).then(e=>{r=e})).then(()=>({v:r[0],r:r.slice(1,33).toString("hex"),s:r.slice(33,65).toString("hex")}))}}var fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var ce=ce||{},le=ce;ce.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd",ce.MessageTypes={U2F_REGISTER_REQUEST:"u2f_register_request",U2F_SIGN_REQUEST:"u2f_sign_request",U2F_REGISTER_RESPONSE:"u2f_register_response",U2F_SIGN_RESPONSE:"u2f_sign_response"},ce.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},ce.Request,ce.Response,ce.Error,ce.SignRequest,ce.SignResponse,ce.RegisterRequest,ce.RegisterResponse,ce.disconnect=function(){ce.port_&&ce.port_.port_&&(ce.port_.port_.disconnect(),ce.port_=null)},ce.getMessagePort=function(e){if("undefined"!=typeof chrome&&chrome.runtime){var t={type:ce.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]};chrome.runtime.sendMessage(ce.EXTENSION_ID,t,(function(){chrome.runtime.lastError?ce.getIframePort_(e):ce.getChromeRuntimePort_(e)}))}else ce.getIframePort_(e)},ce.getChromeRuntimePort_=function(e){var t=chrome.runtime.connect(ce.EXTENSION_ID,{includeTlsChannelId:!0});setTimeout((function(){e(null,new ce.WrappedChromeRuntimePort_(t))}),0)},ce.WrappedChromeRuntimePort_=function(e){this.port_=e},ce.WrappedChromeRuntimePort_.prototype.postMessage=function(e){this.port_.postMessage(e)},ce.WrappedChromeRuntimePort_.prototype.addEventListener=function(e,t){var r=e.toLowerCase();"message"==r||"onmessage"==r?this.port_.onMessage.addListener((function(e){t({data:e})})):console.error("WrappedChromeRuntimePort only supports onMessage")},ce.getIframePort_=function(e){var t="chrome-extension://"+ce.EXTENSION_ID,r=document.createElement("iframe");r.src=t+"/u2f-comms.html",r.setAttribute("style","display:none"),document.body.appendChild(r);var n=!1,o=new MessageChannel,i=function(t){"ready"==t.data?(o.port1.removeEventListener("message",i),n||(n=!0,e(null,o.port1))):console.error('First event on iframe port was not "ready"')};o.port1.addEventListener("message",i),o.port1.start(),r.addEventListener("load",(function(){r.contentWindow.postMessage("init",t,[o.port2])})),setTimeout((function(){n||(n=!0,e(new Error("IFrame extension not supported")))}),200)},ce.EXTENSION_TIMEOUT_SEC=30,ce.port_=null,ce.waitingForPort_=[],ce.reqCounter_=0,ce.callbackMap_={},ce.getPortSingleton_=function(e){ce.port_?e(null,ce.port_):(0==ce.waitingForPort_.length&&ce.getMessagePort((function(e,t){for(e||(ce.port_=t,ce.port_.addEventListener("message",ce.responseHandler_));ce.waitingForPort_.length;)ce.waitingForPort_.shift()(e,t)})),ce.waitingForPort_.push(e))},ce.responseHandler_=function(e){var t=e.data,r=t.requestId;if(r&&ce.callbackMap_[r]){var n=ce.callbackMap_[r];delete ce.callbackMap_[r],n(null,t.responseData)}else console.error("Unknown or missing requestId in response.")},ce.isSupported=function(e){ce.getPortSingleton_((function(t,r){e(!t)}))},ce.sign=function(e,t,r){ce.getPortSingleton_((function(n,o){if(n)return t(n);var i=++ce.reqCounter_;ce.callbackMap_[i]=t;var s={type:ce.MessageTypes.U2F_SIGN_REQUEST,signRequests:e,timeoutSeconds:void 0!==r?r:ce.EXTENSION_TIMEOUT_SEC,requestId:i};o.postMessage(s)}))},ce.register=function(e,t,r,n){ce.getPortSingleton_((function(o,i){if(o)return r(o);var s=++ce.reqCounter_;ce.callbackMap_[s]=r;var a={type:ce.MessageTypes.U2F_REGISTER_REQUEST,signRequests:t,registerRequests:e,timeoutSeconds:void 0!==n?n:ce.EXTENSION_TIMEOUT_SEC,requestId:s};i.postMessage(a)}))};var pe=we,de="undefined"!=typeof navigator&&!!navigator.userAgent,ge=de&&navigator.userAgent.match(/Safari\//)&&!navigator.userAgent.match(/Chrome\//),ve=de&&navigator.userAgent.match(/Edge\/1[2345]/),ye=null;function Ee(e){return ye||(ye=new e((function(e,t){function r(){e({u2f:null,native:!0})}return de?ge?r():(void 0!==window.u2f&&"function"==typeof window.u2f.sign&&e({u2f:window.u2f,native:!0}),ve||"http:"===location.protocol||"undefined"==typeof MessageChannel?r():void le.isSupported((function(t){t?e({u2f:le,native:!1}):r()}))):r()}))),ye}function we(e){return{isSupported:Te.bind(e),ensureSupport:Re.bind(e),register:Ie.bind(e),sign:Se.bind(e),ErrorCodes:we.ErrorCodes,ErrorNames:we.ErrorNames}}function me(e,t){var r=null!=t?t.errorCode:1,n=we.ErrorNames[""+r],o=new Error(e);return o.metaData={type:n,code:r},o}function _e(e,t){var r={};return r.promise=new e((function(e,n){r.resolve=e,r.reject=n,t.then(e,n)})),r.promise.cancel=function(t,n){Ee(e).then((function(e){n&&!e.native&&e.u2f.disconnect(),r.reject(me(t,{errorCode:-1}))}))},r}function Te(){return Ee(this).then((function(e){return!!e.u2f}))}function Ae(e){if(!e.u2f){if("http:"===location.protocol)throw new Error("U2F isn't supported over http, only https");throw new Error("U2F not supported")}}function Re(){return Ee(this).then(Ae)}function Ie(e,t,r){var n=this;return Array.isArray(e)||(e=[e]),"number"==typeof t&&void 0===r&&(r=t,t=null),t||(t=[]),_e(n,Ee(n).then((function(o){Ae(o);var i=o.native,s=o.u2f;return new n((function(n,o){if(i){var a=e[0].appId;s.register(a,e,t,(function(e){e.errorCode?o(me("Registration failed",e)):(delete e.errorCode,n(e))}),r)}else s.register(e,t,(function(e,t){e?o(e):t.errorCode?o(me("Registration failed",t)):n(t)}),r)}))}))).promise}function Se(e,t){var r=this;return Array.isArray(e)||(e=[e]),_e(r,Ee(r).then((function(n){Ae(n);var o=n.native,i=n.u2f;return new r((function(r,n){if(o){var s=e[0].appId,a=e[0].challenge;i.sign(s,a,e,(function(e){e.errorCode?n(me("Sign failed",e)):(delete e.errorCode,r(e))}),t)}else i.sign(e,(function(e,t){e?n(e):t.errorCode?n(me("Sign failed",t)):r(t)}),t)}))}))).promise}function be(e){we[e]=function(){if(!fe.Promise)throw new Error("The platform doesn't natively support promises");var t=[].slice.call(arguments);return we(fe.Promise)[e].apply(null,t)}}we.ErrorCodes={CANCELLED:-1,OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},we.ErrorNames={"-1":"CANCELLED",0:"OK",1:"OTHER_ERROR",2:"BAD_REQUEST",3:"CONFIGURATION_UNSUPPORTED",4:"DEVICE_INELIGIBLE",5:"TIMEOUT"},be("isSupported"),be("ensureSupport"),be("register"),be("sign");var Pe,Ce=pe,Oe=Ce.isSupported,Ne=Ce.sign,Ue="object"==typeof Reflect?Reflect:null,Le=Ue&&"function"==typeof Ue.apply?Ue.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};Pe=Ue&&"function"==typeof Ue.ownKeys?Ue.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var De=Number.isNaN||function(e){return e!=e};function Me(){Me.init.call(this)}var xe=Me,Be=function(e,t){return new Promise((function(r,n){function o(){void 0!==i&&e.removeListener("error",i),r([].slice.call(arguments))}var i;"error"!==t&&(i=function(r){e.removeListener(t,o),n(r)},e.once("error",i)),e.once(t,o)}))};Me.EventEmitter=Me,Me.prototype._events=void 0,Me.prototype._eventsCount=0,Me.prototype._maxListeners=void 0;var Fe=10;function ke(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Ye(e){return void 0===e._maxListeners?Me.defaultMaxListeners:e._maxListeners}function je(e,t,r,n){var o,i,s,a;if(ke(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]),void 0===s)s=i[t]=r,++e._eventsCount;else if("function"==typeof s?s=i[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=Ye(e))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function Ge(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function qe(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=Ge.bind(n);return o.listener=r,n.wrapFn=o,o}function He(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var a=o[e];if(void 0===a)return!1;if("function"==typeof a)Le(a,this,t);else{var u=a.length,h=We(a,u);for(r=0;r=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},Me.prototype.listeners=function(e){return He(this,e,!0)},Me.prototype.rawListeners=function(e){return He(this,e,!1)},Me.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Ke.call(e,t)},Me.prototype.listenerCount=Ke,Me.prototype.eventNames=function(){return this._eventsCount>0?Pe(this._events):[]},xe.once=Be;class ze{constructor(){this.exchangeTimeout=3e4,this._events=new xe,this.send=async(e,t,r,n,o=v.alloc(0),i=[ae.OK])=>{if(o.length>=256)throw new se("data.length exceed 256 bytes limit. Got: "+o.length,"DataLengthTooBig");const s=await this.exchange(v.concat([v.from([e,t,r,n]),v.from([o.length]),o])),a=s.readUInt16BE(s.length-2);if(!i.some(e=>e===a))throw new ue(a);return s},this.exchangeBusyPromise=void 0,this.exchangeAtomicImpl=async e=>{if(this.exchangeBusyPromise)throw new se("Transport race condition","RaceCondition");let t;const r=new Promise(e=>{t=e});this.exchangeBusyPromise=r;try{return await e()}finally{t&&t(),this.exchangeBusyPromise=null}},this._appAPIlock=null}exchange(e){throw new Error("exchange not implemented")}setScrambleKey(e){}close(){return Promise.resolve()}on(e,t){this._events.on(e,t)}off(e,t){this._events.removeListener(e,t)}emit(e,...t){this._events.emit(e,...t)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(e){this.exchangeTimeout=e}static create(e=3e3,t){return new Promise((r,n)=>{let o=!1;const i=this.listen({next:t=>{o=!0,i&&i.unsubscribe(),s&&clearTimeout(s),this.open(t.descriptor,e).then(r,n)},error:e=>{s&&clearTimeout(s),n(e)},complete:()=>{s&&clearTimeout(s),o||n(new se(this.ErrorMessage_NoDeviceFound,"NoDeviceFound"))}}),s=t?setTimeout(()=>{i.unsubscribe(),n(new se(this.ErrorMessage_ListenTimeout,"ListenTimeout"))},t):null})}decorateAppAPIMethods(e,t,r){for(let n of t)e[n]=this.decorateAppAPIMethod(n,e[n],e,r)}decorateAppAPIMethod(e,t,r,n){return async(...o)=>{const{_appAPIlock:i}=this;if(i)return Promise.reject(new se("Ledger Device is busy (lock "+i+")","TransportLocked"));try{return this._appAPIlock=e,this.setScrambleKey(n),await t.apply(r,o)}finally{this._appAPIlock=null}}}}ze.isSupported=void 0,ze.list=void 0,ze.listen=void 0,ze.open=void 0,ze.ErrorMessage_ListenTimeout="No Ledger device found (timeout)",ze.ErrorMessage_NoDeviceFound="No Ledger device found";let Ve=0;const Xe=[],Qe=(e,t,r)=>{const n={type:e,id:String(++Ve),date:new Date};t&&(n.message=t),r&&(n.data=r),function(e){for(let t=0;t(Xe.push(e),()=>{const t=Xe.indexOf(e);-1!==t&&(Xe[t]=Xe[Xe.length-1],Xe.pop())});"undefined"!=typeof window&&(window.__ledgerLogsListen=Ze);const Je=e=>e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function $e(e,t,r,n){const o=function(e,t){const r=v.alloc(e.length);for(let n=0;n "+e.toString("hex")),Ne(s,t/1e3).then(e=>{const{signatureData:t}=e;if("string"==typeof t){const e=v.from((r=t).replace(/-/g,"+").replace(/_/g,"/")+"==".substring(0,3*r.length%4),"base64");let o;return o=n?e.slice(5):e,Qe("apdu","<= "+o.toString("hex")),o}throw e;var r})}let et=[];class tt extends ze{static async open(e,t=5e3){return new tt}constructor(){super(),this.scrambleKey=void 0,this.unwrap=!0,et.push(this)}async exchange(e){try{return await $e(e,this.exchangeTimeout,this.scrambleKey,this.unwrap)}catch(e){throw"object"==typeof e.metaData?(5===e.metaData.code&&(et.forEach(e=>e.emit("disconnect")),et=[]),function(e,t,r){const n=new se(t,r);return n.originalError=e,n}(e,"Failed to sign with Ledger device: U2F "+e.metaData.type,"U2F_"+e.metaData.code)):e}}setScrambleKey(e){this.scrambleKey=v.from(e,"ascii")}setUnwrap(e){this.unwrap=e}close(){return Promise.resolve()}}tt.isSupported=Oe,tt.list=()=>Oe().then(e=>e?[null]:[]),tt.listen=e=>{let t=!1;return Oe().then(r=>{t||(r?(e.next({type:"add",descriptor:null}),e.complete()):e.error(new se("U2F browser support is needed for Ledger. Please use Chrome, Opera or Firefox with a U2F extension. Also make sure you're on an HTTPS connection","U2FNotSupported")))}),{unsubscribe:()=>{t=!0}}};const rt={u2f:tt,default:tt};var nt=window&&window.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const ot=new e.utils.Logger("hardware-wallets/5.0.2");function it(e){return new Promise(t=>{setTimeout(t,e)})}class st extends e.Signer{constructor(t,r,n){super(),null==n&&(n="m/44'/60'/0'/0/0"),null==r&&(r="default"),e.utils.defineReadOnly(this,"path",n),e.utils.defineReadOnly(this,"type",r),e.utils.defineReadOnly(this,"provider",t||null);const o=rt[r];o||ot.throwArgumentError("unknown or unsupported type","type",r),e.utils.defineReadOnly(this,"_eth",o.create().then(e=>{const t=new he(e);return t.getAppConfiguration().then(e=>t,e=>Promise.reject(e))},e=>Promise.reject(e)))}_retry(e,t){return new Promise((r,n)=>nt(this,void 0,void 0,(function*(){t&&t>0&&setTimeout(()=>{n(new Error("timeout"))},t);const o=yield this._eth;for(let t=0;t<50;t++){try{const t=yield e(o);return r(t)}catch(e){if("TransportLocked"!==e.id)return n(e)}yield it(100)}return n(new Error("timeout"))})))}getAddress(){return nt(this,void 0,void 0,(function*(){const t=yield this._retry(e=>e.getAddress(this.path));return e.utils.getAddress(t.address)}))}signMessage(t){return nt(this,void 0,void 0,(function*(){"string"==typeof t&&(t=e.utils.toUtf8Bytes(t));const r=e.utils.hexlify(t).substring(2),n=yield this._retry(e=>e.signPersonalMessage(this.path,r));return n.r="0x"+n.r,n.s="0x"+n.s,e.utils.joinSignature(n)}))}signTransaction(t){return nt(this,void 0,void 0,(function*(){const r=t=yield e.utils.resolveProperties(t),n=e.utils.serializeTransaction(r).substring(2),o=yield this._retry(e=>e.signTransaction(this.path,n));return e.utils.serializeTransaction(r,{v:o.v,r:"0x"+o.r,s:"0x"+o.s})}))}connect(e){return new st(e,this.type,this.path)}}export{st as LedgerSigner}; diff --git a/packages/hardware-wallets/package.json b/packages/hardware-wallets/package.json index 6adc8c147..e88b772ee 100644 --- a/packages/hardware-wallets/package.json +++ b/packages/hardware-wallets/package.json @@ -45,7 +45,7 @@ "scripts": { "test": "exit 1" }, - "tarballHash": "0xbeaaf63a8456e0d4bba30e7362a5354886bfdaf6b6da77d387f4eaa198fcb491", + "tarballHash": "0x1d97bb6267b4f2071bb1f21b7ba0d1a73327fa56bbb516cd3e12511378038ebf", "types": "./lib/index.d.ts", "version": "5.0.2" }