From 9af7e4e995790eb7b4ce5eab21988ef98cd455ec Mon Sep 17 00:00:00 2001 From: Alessandro Candeago <54709706+alecande11@users.noreply.github.com> Date: Mon, 31 Jul 2023 11:11:24 -0700 Subject: [PATCH] Connect to station using the window object (#473) --- package-lock.json | 260 +++++++++++++++++++++++++++++++++++++++++----- package.json | 4 +- src/txs/Tx.tsx | 2 +- 3 files changed, 238 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0664ebb72..7ec267561 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@terra-money/terra-utils": "^1.0.9", "@terra-money/terra.js": "^3.1.9", "@terra-money/terra.proto": "^2.0.0", - "@terra-money/wallet-kit": "^1.0.4", + "@terra-money/wallet-kit": "^1.0.5", "@tippyjs/react": "^4.2.6", "axios": "^0.27.2", "bech32": "^2.0.0", @@ -2102,6 +2102,69 @@ "node": ">=0.1.95" } }, + "node_modules/@cosmjs/amino": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.31.0.tgz", + "integrity": "sha512-xJ5CCEK7H79FTpOuEmlpSzVI+ZeYESTVvO3wHDgbnceIyAne3C68SvyaKqLUR4uJB0Z4q4+DZHbqW6itUiv4lA==", + "dependencies": { + "@cosmjs/crypto": "^0.31.0", + "@cosmjs/encoding": "^0.31.0", + "@cosmjs/math": "^0.31.0", + "@cosmjs/utils": "^0.31.0" + } + }, + "node_modules/@cosmjs/crypto": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.31.0.tgz", + "integrity": "sha512-UaqCe6Tgh0pe1QlZ66E13t6FlIF86QrnBXXq+EN7Xe1Rouza3fJ1ojGlPleJZkBoq3tAyYVIOOqdZIxtVj/sIQ==", + "dependencies": { + "@cosmjs/encoding": "^0.31.0", + "@cosmjs/math": "^0.31.0", + "@cosmjs/utils": "^0.31.0", + "@noble/hashes": "^1", + "bn.js": "^5.2.0", + "elliptic": "^6.5.4", + "libsodium-wrappers-sumo": "^0.7.11" + } + }, + "node_modules/@cosmjs/crypto/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@cosmjs/encoding": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.31.0.tgz", + "integrity": "sha512-NYGQDRxT7MIRSlcbAezwxK0FqnaSPKCH7O32cmfpHNWorFxhy9lwmBoCvoe59Kd0HmArI4h+NGzLEfX3OLnA4Q==", + "dependencies": { + "base64-js": "^1.3.0", + "bech32": "^1.1.4", + "readonly-date": "^1.0.0" + } + }, + "node_modules/@cosmjs/encoding/node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, + "node_modules/@cosmjs/math": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.31.0.tgz", + "integrity": "sha512-Sb/8Ry/+gKJaYiV6X8q45kxXC9FoV98XCY1WXtu0JQwOi61VCG2VXsURQnVvZ/EhR/CuT/swOlNKrqEs3da0fw==", + "dependencies": { + "bn.js": "^5.2.0" + } + }, + "node_modules/@cosmjs/math/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@cosmjs/utils": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.31.0.tgz", + "integrity": "sha512-nNcycZWUYLNJlrIXgpcgVRqdl6BXjF4YlXdxobQWpW9Tikk61bEGeAFhDYtC0PwHlokCNw0KxWiHGJL4nL7Q5A==" + }, "node_modules/@csstools/convert-colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz", @@ -3558,6 +3621,17 @@ } } }, + "node_modules/@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -4235,12 +4309,28 @@ "@terra-money/terra.js": "^3" } }, + "node_modules/@terra-money/station-connector": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/station-connector/-/station-connector-1.0.5.tgz", + "integrity": "sha512-90QOXzHj0+p7a9Zs+ehE2UbeEFgCyn+DtjwDRF7LGreC4se7mP3fEurziP0wsIxynF3Q4RD5oawN1Bzj7E5s8w==", + "dependencies": { + "@cosmjs/amino": "^0.31.0", + "bech32": "^2.0.0" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@terra-money/feather.js": "^1.0.4" + } + }, "node_modules/@terra-money/station-wallet": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@terra-money/station-wallet/-/station-wallet-1.0.4.tgz", - "integrity": "sha512-faJDWox3iauL2Spb09OyH0awyGikwQfGU+55mKDNgkxe1CzGrsbILsLah3IoGoALRGGPnXNFVUW5r0mNVcTUOQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/station-wallet/-/station-wallet-1.0.5.tgz", + "integrity": "sha512-9md/LOxDl6wUFdlF5FG7AglD30J3JMyLX1I5kePYA7CO7nE1QW2PH7eyfftAIXKWDhs7O0/6qtxFzku3P5Yk/g==", "dependencies": { - "@terra-money/wallet-interface": "^1.0.4" + "@terra-money/station-connector": "^1.0.5", + "@terra-money/wallet-interface": "^1.0.5" }, "engines": { "node": ">=16" @@ -4314,9 +4404,9 @@ } }, "node_modules/@terra-money/wallet-interface": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@terra-money/wallet-interface/-/wallet-interface-1.0.4.tgz", - "integrity": "sha512-xlWFGt0qHCUwQXLxS2XjE7p5xWskq68XfmJ+3Rh5XR7tJpj/GII2397PwHkK2HfP/FDb39xCu704txjz26F7Eg==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/wallet-interface/-/wallet-interface-1.0.5.tgz", + "integrity": "sha512-IukHmHcSsFYRJJS8U08dB+Oi8lahmAWEPf+E3qBb6uzT91sPN4QCM835LGNvH1XsMXds/RmggD0TxGPwbVl55Q==", "engines": { "node": ">=16" }, @@ -4325,12 +4415,12 @@ } }, "node_modules/@terra-money/wallet-kit": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@terra-money/wallet-kit/-/wallet-kit-1.0.4.tgz", - "integrity": "sha512-mM+j658QNG85Pn4fCHf+kebL/MT+ne3O3KnOGAlHyD7F+9h/+yrckeCkYj0o2FyHPLl68PMrnyKHlsb9E9nEHA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/wallet-kit/-/wallet-kit-1.0.5.tgz", + "integrity": "sha512-K/4Vv1Y6NT2G3gTIim1XiQxiqSriavLYSxSPt5QvYXqD3x9kEPuizJHxETTyxCSWWG4hs8Caj/Uq+EA4ajuOUw==", "dependencies": { - "@terra-money/station-wallet": "^1.0.4", - "@terra-money/wallet-interface": "^1.0.4", + "@terra-money/station-wallet": "^1.0.5", + "@terra-money/wallet-interface": "^1.0.5", "axios": "^1.4.0" }, "engines": { @@ -16138,6 +16228,19 @@ "node": ">= 0.8.0" } }, + "node_modules/libsodium-sumo": { + "version": "0.7.11", + "resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.11.tgz", + "integrity": "sha512-bY+7ph7xpk51Ez2GbE10lXAQ5sJma6NghcIDaSPbM/G9elfrjLa0COHl/7P6Wb/JizQzl5UQontOOP1z0VwbLA==" + }, + "node_modules/libsodium-wrappers-sumo": { + "version": "0.7.11", + "resolved": "https://registry.npmjs.org/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.11.tgz", + "integrity": "sha512-DGypHOmJbB1nZn89KIfGOAkDgfv5N6SBGC3Qvmy/On0P0WD1JQvNRS/e3UL3aFF+xC0m+MYz5M+MnRnK2HMrKQ==", + "dependencies": { + "libsodium-sumo": "^0.7.11" + } + }, "node_modules/lilconfig": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.5.tgz", @@ -20874,6 +20977,11 @@ "node": ">=8.10.0" } }, + "node_modules/readonly-date": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz", + "integrity": "sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==" + }, "node_modules/recharts": { "version": "2.1.16", "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.1.16.tgz", @@ -28740,6 +28848,75 @@ "minimist": "^1.2.0" } }, + "@cosmjs/amino": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.31.0.tgz", + "integrity": "sha512-xJ5CCEK7H79FTpOuEmlpSzVI+ZeYESTVvO3wHDgbnceIyAne3C68SvyaKqLUR4uJB0Z4q4+DZHbqW6itUiv4lA==", + "requires": { + "@cosmjs/crypto": "^0.31.0", + "@cosmjs/encoding": "^0.31.0", + "@cosmjs/math": "^0.31.0", + "@cosmjs/utils": "^0.31.0" + } + }, + "@cosmjs/crypto": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.31.0.tgz", + "integrity": "sha512-UaqCe6Tgh0pe1QlZ66E13t6FlIF86QrnBXXq+EN7Xe1Rouza3fJ1ojGlPleJZkBoq3tAyYVIOOqdZIxtVj/sIQ==", + "requires": { + "@cosmjs/encoding": "^0.31.0", + "@cosmjs/math": "^0.31.0", + "@cosmjs/utils": "^0.31.0", + "@noble/hashes": "^1", + "bn.js": "^5.2.0", + "elliptic": "^6.5.4", + "libsodium-wrappers-sumo": "^0.7.11" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@cosmjs/encoding": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.31.0.tgz", + "integrity": "sha512-NYGQDRxT7MIRSlcbAezwxK0FqnaSPKCH7O32cmfpHNWorFxhy9lwmBoCvoe59Kd0HmArI4h+NGzLEfX3OLnA4Q==", + "requires": { + "base64-js": "^1.3.0", + "bech32": "^1.1.4", + "readonly-date": "^1.0.0" + }, + "dependencies": { + "bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + } + } + }, + "@cosmjs/math": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.31.0.tgz", + "integrity": "sha512-Sb/8Ry/+gKJaYiV6X8q45kxXC9FoV98XCY1WXtu0JQwOi61VCG2VXsURQnVvZ/EhR/CuT/swOlNKrqEs3da0fw==", + "requires": { + "bn.js": "^5.2.0" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@cosmjs/utils": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.31.0.tgz", + "integrity": "sha512-nNcycZWUYLNJlrIXgpcgVRqdl6BXjF4YlXdxobQWpW9Tikk61bEGeAFhDYtC0PwHlokCNw0KxWiHGJL4nL7Q5A==" + }, "@csstools/convert-colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz", @@ -29829,6 +30006,11 @@ "integrity": "sha512-HnRXrxgHJYJcT8ZDdDCQIlqk0s0skOKD7eWs9mJgBUu70hyW4iA6Kiv3yspJR474RFH8hysKR65VVSzUSzkuwA==", "requires": {} }, + "@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -30347,12 +30529,22 @@ "@terra-money/log-finder": "^1.1.6" } }, + "@terra-money/station-connector": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/station-connector/-/station-connector-1.0.5.tgz", + "integrity": "sha512-90QOXzHj0+p7a9Zs+ehE2UbeEFgCyn+DtjwDRF7LGreC4se7mP3fEurziP0wsIxynF3Q4RD5oawN1Bzj7E5s8w==", + "requires": { + "@cosmjs/amino": "^0.31.0", + "bech32": "^2.0.0" + } + }, "@terra-money/station-wallet": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@terra-money/station-wallet/-/station-wallet-1.0.4.tgz", - "integrity": "sha512-faJDWox3iauL2Spb09OyH0awyGikwQfGU+55mKDNgkxe1CzGrsbILsLah3IoGoALRGGPnXNFVUW5r0mNVcTUOQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/station-wallet/-/station-wallet-1.0.5.tgz", + "integrity": "sha512-9md/LOxDl6wUFdlF5FG7AglD30J3JMyLX1I5kePYA7CO7nE1QW2PH7eyfftAIXKWDhs7O0/6qtxFzku3P5Yk/g==", "requires": { - "@terra-money/wallet-interface": "^1.0.4" + "@terra-money/station-connector": "^1.0.5", + "@terra-money/wallet-interface": "^1.0.5" } }, "@terra-money/terra-utils": { @@ -30416,18 +30608,18 @@ } }, "@terra-money/wallet-interface": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@terra-money/wallet-interface/-/wallet-interface-1.0.4.tgz", - "integrity": "sha512-xlWFGt0qHCUwQXLxS2XjE7p5xWskq68XfmJ+3Rh5XR7tJpj/GII2397PwHkK2HfP/FDb39xCu704txjz26F7Eg==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/wallet-interface/-/wallet-interface-1.0.5.tgz", + "integrity": "sha512-IukHmHcSsFYRJJS8U08dB+Oi8lahmAWEPf+E3qBb6uzT91sPN4QCM835LGNvH1XsMXds/RmggD0TxGPwbVl55Q==", "requires": {} }, "@terra-money/wallet-kit": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@terra-money/wallet-kit/-/wallet-kit-1.0.4.tgz", - "integrity": "sha512-mM+j658QNG85Pn4fCHf+kebL/MT+ne3O3KnOGAlHyD7F+9h/+yrckeCkYj0o2FyHPLl68PMrnyKHlsb9E9nEHA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@terra-money/wallet-kit/-/wallet-kit-1.0.5.tgz", + "integrity": "sha512-K/4Vv1Y6NT2G3gTIim1XiQxiqSriavLYSxSPt5QvYXqD3x9kEPuizJHxETTyxCSWWG4hs8Caj/Uq+EA4ajuOUw==", "requires": { - "@terra-money/station-wallet": "^1.0.4", - "@terra-money/wallet-interface": "^1.0.4", + "@terra-money/station-wallet": "^1.0.5", + "@terra-money/wallet-interface": "^1.0.5", "axios": "^1.4.0" }, "dependencies": { @@ -39770,6 +39962,19 @@ "type-check": "~0.4.0" } }, + "libsodium-sumo": { + "version": "0.7.11", + "resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.11.tgz", + "integrity": "sha512-bY+7ph7xpk51Ez2GbE10lXAQ5sJma6NghcIDaSPbM/G9elfrjLa0COHl/7P6Wb/JizQzl5UQontOOP1z0VwbLA==" + }, + "libsodium-wrappers-sumo": { + "version": "0.7.11", + "resolved": "https://registry.npmjs.org/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.11.tgz", + "integrity": "sha512-DGypHOmJbB1nZn89KIfGOAkDgfv5N6SBGC3Qvmy/On0P0WD1JQvNRS/e3UL3aFF+xC0m+MYz5M+MnRnK2HMrKQ==", + "requires": { + "libsodium-sumo": "^0.7.11" + } + }, "lilconfig": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.5.tgz", @@ -43533,6 +43738,11 @@ "picomatch": "^2.2.1" } }, + "readonly-date": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz", + "integrity": "sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==" + }, "recharts": { "version": "2.1.16", "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.1.16.tgz", diff --git a/package.json b/package.json index e4e3c4378..d8ec140f9 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "hompage": "https://station.terra.money", "author": "Terra (https://terra.money)", "repository": "github:terra-money/station", - "version": "7.3.0", + "version": "7.3.1", "license": "MIT", "scripts": { "start": "react-scripts start", @@ -31,7 +31,7 @@ "@terra-money/terra-utils": "^1.0.9", "@terra-money/terra.js": "^3.1.9", "@terra-money/terra.proto": "^2.0.0", - "@terra-money/wallet-kit": "^1.0.4", + "@terra-money/wallet-kit": "^1.0.5", "@tippyjs/react": "^4.2.6", "axios": "^0.27.2", "bech32": "^2.0.0", diff --git a/src/txs/Tx.tsx b/src/txs/Tx.tsx index 07dc5c389..61e6af39e 100644 --- a/src/txs/Tx.tsx +++ b/src/txs/Tx.tsx @@ -276,7 +276,7 @@ function Tx(props: Props) { const { txhash } = await auth.post({ ...tx, fee }, password) !hideLoader && setLatestTx({ txhash, ...latestTxBase }) } else { - const { result } = await post({ ...tx, fee }) + const result = await post({ ...tx, fee }) if (!result) throw new Error("Tx failed") !hideLoader && setLatestTx({ txhash: result.txhash, ...latestTxBase }) }