diff --git a/both/i18n/en-us.i18n.yml b/both/i18n/en-us.i18n.yml index c2d85d265..ebefe2919 100644 --- a/both/i18n/en-us.i18n.yml +++ b/both/i18n/en-us.i18n.yml @@ -77,6 +77,7 @@ chainStatus: outOfValidators: 'out of {$totalValidators} validators' onlineVotingPower: 'Online Voting Power' fromTotalStakes: '{$percent} from {$totalStakes} {$denomPlural}' + totalAccounts: 'Cosmos Accounts (Total)' analytics: blockTimeHistory: 'Block Time History' averageBlockTime: 'Average Block Time' diff --git a/client/main.js b/client/main.js index 528dd4e48..4e522555d 100644 --- a/client/main.js +++ b/client/main.js @@ -7,6 +7,7 @@ import App from '/imports/ui/App.jsx'; import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom' // import ReactDOM from 'react-dom'; +import { getCosmosAccountsNumber } from '../imports/ui/home/CosmosAccounts' import { Meteor } from 'meteor/meteor'; import { render } from 'react-dom'; @@ -31,4 +32,5 @@ Meteor.startup(() => { // , document.getElementById('app') // ); // }); + setTimeout(getCosmosAccountsNumber, 60000); }); diff --git a/imports/api/chain/server/methods.js b/imports/api/chain/server/methods.js index 0910d72f0..b00a65537 100644 --- a/imports/api/chain/server/methods.js +++ b/imports/api/chain/server/methods.js @@ -235,4 +235,28 @@ Meteor.methods({ this.unblock(); Chain.find().sort({created:-1}).limit(1); }, + 'chain.shouldUpdateCosmosAccountsNumber': function () { + this.unblock(); + let date = new Date(); + let chain = Chain.find().fetch(); + let lastUpdated = chain?.lastUpdated ? new Date(chain?.lastUpdated) : new Date(); + let timeDifference = moment(date).diff(moment(lastUpdated), 'hours'); + let shouldUpdate = timeDifference >= 24 ? true : false; + return shouldUpdate; + }, + 'chain.getCosmosAccountsNumber': function (totalNumberOfAccountsIndex) { + this.unblock(); + let date = new Date(); + let dateUTC = date.toUTCString(); + let totalNumberOfCosmosAccounts = { + total: totalNumberOfAccountsIndex, + lastUpdated: dateUTC + } + try { + Chain.upsert({ chainId: Meteor.settings.public.chainId }, { $set: { "totalNumberOfCosmosAccounts": totalNumberOfCosmosAccounts } }); + } + catch (e) { + console.log(e); + } + }, }) diff --git a/imports/ui/home/ChainStatus.jsx b/imports/ui/home/ChainStatus.jsx index 15ebc321b..a43b6e8bf 100644 --- a/imports/ui/home/ChainStatus.jsx +++ b/imports/ui/home/ChainStatus.jsx @@ -34,7 +34,8 @@ export default class ChainStatus extends React.Component { numValidators: this.props.status.validators, totalNumValidators: this.props.status.totalValidators, bondedTokens: this.props.states.bondedTokens, - totalSupply: this.props.states.totalSupply + totalSupply: this.props.states.totalSupply, + totalNumberOfCosmosAccounts: this.props.status.totalNumberOfCosmosAccounts }) switch (this.state.avgBlockTimeType){ @@ -153,16 +154,13 @@ export default class ChainStatus extends React.Component { if (this.props.statusExist && this.props.status.prevotes){ return( - + - chainStatus.latestHeight - - {this.state.blockHeight} - {this.state.blockTime} - + chainStatus.totalAccounts + {this.state.totalNumberOfCosmosAccounts?.total ?? 0}{this.state.totalNumberOfCosmosAccounts?.lastUpdated ?? new Date().toUTCString()} - + @@ -181,13 +179,22 @@ export default class ChainStatus extends React.Component { - + chainStatus.activeValidators {this.state.numValidators}chainStatus.outOfValidators - + + + chainStatus.latestHeight + + {this.state.blockHeight} + {this.state.blockTime} + + + + diff --git a/imports/ui/home/CosmosAccounts.js b/imports/ui/home/CosmosAccounts.js new file mode 100644 index 000000000..ea7e7ef94 --- /dev/null +++ b/imports/ui/home/CosmosAccounts.js @@ -0,0 +1,208 @@ +/* eslint-disable camelcase */ +import { Meteor } from 'meteor/meteor'; +import 'babel-polyfill'; +import { getNewWalletFromSeed } from "@lunie/cosmos-keys" +import { SigningStargateClient, assertIsBroadcastTxSuccess } from "@cosmjs/stargate" +import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; + +export const DEFAULT_GAS_PRICE = parseFloat(Meteor.settings.public.ledger.gasPrice) || 0.025; +export const DEFAULT_MEMO = 'Sent via Big Dipper' +const RPC = Meteor?.settings?.public?.remote?.rpc +const COINTYPE = Meteor?.settings?.public?.ledger?.coinType +const seed = Meteor?.settings?.private?.seed; +const options = { prefix: 'cosmos' }; +const bech32prefix = 'cosmos'; + +getFromAddress = () => { + let hdpath = `m/44'/${COINTYPE}'/0'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } +} + +getToAddress = (accountIndex) => { + let hdpath = `m/44'/${COINTYPE}'/${accountIndex}'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } +} + +async function fetchCosmosAccountsNumber(accountIndex){ + let sendFromAddress = this.getFromAddress(); + let sendToAddress = this.getToAddress(accountIndex); + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + const amount = [{ amount: "1", denom: "uatom" }] + const fee = { + amount: [{ amount: "100", denom: "uatom" }], + gas: "100000", + } + const sendMsg = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: sendFromAddress.cosmosAddress, + toAddress: sendToAddress.cosmosAddress, + amount: [...amount], + }, + }; + try { + let signMessage = await client.signAndBroadcast(sendFromAddress.cosmosAddress, [sendMsg], fee, DEFAULT_MEMO); + assertIsBroadcastTxSuccess(signMessage); + } + catch (e) { + console.log(e) + } + try { + const accountNumber = await client.getSequence(sendToAddress.cosmosAddress); + const latestAccountNumber = accountNumber.accountNumber || 0; + try{ + Meteor.call('chain.getCosmosAccountsNumber', latestAccountNumber) + } + catch(e){ + console.log("chain.getCosmosAccountsNumber error " + e) + } + return latestAccountNumber + } + catch (e) { + console.log(e) + } +} + +export function getCosmosAccountsNumber() { + Meteor.call('chain.shouldUpdateCosmosAccountsNumber', async (error, result) => { + if (error) { + console.log("chain.shouldUpdateCosmosAccountsNumber error ", error); + } + else { + let accountIndex; + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + for (let c = 1; c < 100; c++) { + let accIndex = this.getToAddress(c); + try { + // eslint-disable-next-line no-await-in-loop + await client.getSequence(accIndex.cosmosAddress) + } + catch (e) { + accountIndex = c + break; + } + + } + return fetchCosmosAccountsNumber(accountIndex) + } + }) +} + +Meteor.methods({ + 'cosmosAccounts.getToAddress': function (accountIndex) { + this.unblock(); + let hdpath = `m/44'/${COINTYPE}'/${accountIndex}'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } + }, + 'cosmosAccounts.getFromAddress': function () { + this.unblock(); + let hdpath = `m/44'/${COINTYPE}'/0'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } + }, + 'cosmosAccounts.fetchCosmosAccountsNumber': async function (accountIndex) { + this.unblock(); + let sendFromAddress, sendToAddress; + Meteor.call('cosmosAccounts.getFromAddress', (error, result) => { + if (error) { + console.log("cosmosAccounts.getFromAddress error ", error); + } + else if(result){ + sendFromAddress = result; + } + }) + Meteor.call('cosmosAccounts.getToAddress', accountIndex, (error, result) => { + if (error) { + console.log("cosmosAccounts.getToAddress error ", error); + } + else if (result) { + sendToAddress = result; + } + }) + + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + const amount = [{ amount: "1", denom: "uatom" }] + const fee = { + amount: [{ amount: "100", denom: "uatom" }], + gas: "100000", + } + const sendMsg = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: sendFromAddress.cosmosAddress, + toAddress: sendToAddress.cosmosAddress, + amount: [...amount], + }, + }; + + try { + let signMessage = await client.signAndBroadcast(sendFromAddress.cosmosAddress, [sendMsg], fee, DEFAULT_MEMO); + assertIsBroadcastTxSuccess(signMessage); + } + catch (e) { + console.log(e) + } + try { + const accountNumber = await client.getSequence(sendToAddress.cosmosAddress); + const latestAccountNumber = accountNumber.accountNumber || 0; + try { + Meteor.call('chain.getCosmosAccountsNumber', latestAccountNumber) + } + catch (e) { + console.log("chain.getCosmosAccountsNumber error " + e) + } + return latestAccountNumber + } + catch (e) { + console.log(e) + } + }, + + 'cosmosAccounts.getTotal': function () { + this.unblock(); + Meteor.call('chain.shouldUpdateCosmosAccountsNumber', async (error, result) => { + if (error) { + console.log("chain.shouldUpdateCosmosAccountsNumber error ", error); + } + else { + let accountIndex; + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + for (let c = 1; c < 100; c++) { + let accIndex; + // eslint-disable-next-line no-loop-func + Meteor.call('cosmosAccounts.getToAddress', c, async (error, result) => { + if (error) { + console.log("cosmosAccounts.getToAddress error ", error); + } + else if (result) { + accIndex = result; + try { + // eslint-disable-next-line no-await-in-loop + await client.getSequence(accIndex.cosmosAddress) + } + catch (e) { + accountIndex = c + // break; + } + } + }) + } + try { + Meteor.call('cosmosAccounts.fetchCosmosAccountsNumber', latestAccountNumber) + } + catch (e) { + console.log("cosmosAccounts.fetchCosmosAccountsNumber error ", error); + + } + } + }) + }, + +}) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 81fa8afcd..d1cae69c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -173,6 +173,146 @@ "to-fast-properties": "^2.0.0" } }, + "@confio/ics23": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@confio/ics23/-/ics23-0.6.5.tgz", + "integrity": "sha512-1GdPMsaP/l8JSF4P4HWFLBhdcxHcJT8lS0nknBYNSZ1XrJOsJKUy6EkOwd9Pa1qJkXzY2gyNv7MdHR+AIwSTAg==", + "requires": { + "js-sha512": "^0.8.0", + "protobufjs": "^6.8.8", + "ripemd160": "^2.0.2", + "sha.js": "^2.4.11" + } + }, + "@cosmjs/amino": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.25.5.tgz", + "integrity": "sha512-q9tU2b9hJ3S/KxYCLSyiZCfkaidbSPBr2sJ5HPLxz48y5O4k9sYM7bPa0zioeePaIBnby3AOgyjucVxlbzUlYg==", + "requires": { + "@cosmjs/crypto": "^0.25.5", + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/utils": "^0.25.5" + } + }, + "@cosmjs/crypto": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.25.5.tgz", + "integrity": "sha512-i0Nfbk4JXAwyKNGPFu0o1xV6IJUbYmmveySytbU/yweybcZppxoczjSQ1sGrUaLVLvgfcpfwZte3jKqDR67+dg==", + "requires": { + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/utils": "^0.25.5", + "bip39": "^3.0.2", + "bn.js": "^4.11.8", + "elliptic": "^6.5.3", + "js-sha3": "^0.8.0", + "libsodium-wrappers": "^0.7.6", + "ripemd160": "^2.0.2", + "sha.js": "^2.4.11" + } + }, + "@cosmjs/encoding": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.25.5.tgz", + "integrity": "sha512-QT7MaPBiMeCaMJ6VZZKeOqDQlAxMEzTFjBFhbkdyx5DVRc4dPOVO4HbTggmIN5/eizIv4/CNJSVTR//tO53J0A==", + "requires": { + "base64-js": "^1.3.0", + "bech32": "^1.1.4", + "readonly-date": "^1.0.0" + } + }, + "@cosmjs/json-rpc": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.25.5.tgz", + "integrity": "sha512-WFDallAolxBqB8V/mYxU0riF/OBoc6Fc2DDsZhds5xOZxeN9sTX0qWhu1UiFyURw4Z9D+SjB9QngqSDBTMTdjw==", + "requires": { + "@cosmjs/stream": "^0.25.5", + "xstream": "^11.14.0" + } + }, + "@cosmjs/math": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.25.5.tgz", + "integrity": "sha512-LWovT1uTHlr+VEce27/14Wrgc4INJYOYk1+ncyvbZertixNFH6OMnc9Xkk0DIV4RYmW+/fvB9kCXVnNtQGSuHg==", + "requires": { + "bn.js": "^4.11.8" + } + }, + "@cosmjs/proto-signing": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.25.5.tgz", + "integrity": "sha512-YWVp+dGHt7v6ZKjOs8CI9xkpOV49eweHbYMv/vCVYF4cEh0kWwy2WzbWIkUH9zwwUqCxigVOTBYUCfbsjEbfug==", + "requires": { + "@cosmjs/amino": "^0.25.5", + "long": "^4.0.0", + "protobufjs": "~6.10.2" + } + }, + "@cosmjs/socket": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.25.5.tgz", + "integrity": "sha512-wcJVbD4xlF4+5hMum4tOmAy5ppX+E9qrB9Pvt3T7BK+6T5uobxiBQCLEiDwHP3n42RBj+xQWJrScPf5IEWmZKg==", + "requires": { + "@cosmjs/stream": "^0.25.5", + "isomorphic-ws": "^4.0.1", + "ws": "^7", + "xstream": "^11.14.0" + }, + "dependencies": { + "ws": { + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", + "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==" + } + } + }, + "@cosmjs/stargate": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.25.5.tgz", + "integrity": "sha512-cOZ+fOC16YT7W2vjBnnk9oJfuIlB02KdK6dn6aigMd4mx+7DS2jvNslpQrfKmtrwB9AVsgc6tklBkYwG5qAuKQ==", + "requires": { + "@confio/ics23": "^0.6.3", + "@cosmjs/amino": "^0.25.5", + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/proto-signing": "^0.25.5", + "@cosmjs/stream": "^0.25.5", + "@cosmjs/tendermint-rpc": "^0.25.5", + "@cosmjs/utils": "^0.25.5", + "long": "^4.0.0", + "protobufjs": "~6.10.2" + } + }, + "@cosmjs/stream": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.25.5.tgz", + "integrity": "sha512-a+0sDNKZTxw9p4j5tl7SI0siMTii7AQot1+5vkH5BkQoAv3C3D8jagPouUz3RUFuh13qftPxPLiHzDFLNSjTnQ==", + "requires": { + "xstream": "^11.14.0" + } + }, + "@cosmjs/tendermint-rpc": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.25.5.tgz", + "integrity": "sha512-WlUCFVdhbwA3IDA1C858S8WOtLseZLXKTdj5fz1sTKSBmtrig4l1ZMKHHlZRprvmjSpkpbjgSQU+RjjvBd75BA==", + "requires": { + "@cosmjs/crypto": "^0.25.5", + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/json-rpc": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/socket": "^0.25.5", + "@cosmjs/stream": "^0.25.5", + "axios": "^0.21.1", + "readonly-date": "^1.0.0", + "xstream": "^11.14.0" + } + }, + "@cosmjs/utils": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.25.5.tgz", + "integrity": "sha512-U4YdgJadFgXWblthgyXqP28Yw5rsw2IX/cOES0pa6fiB81hoYl2LXqXiuKp2yVPoAgk8JpkFh3i5KchcD9muJg==" + }, "@emotion/is-prop-valid": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.7.3.tgz", @@ -264,6 +404,25 @@ "resolved": "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.50.0.tgz", "integrity": "sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA==" }, + "@lunie/cosmos-keys": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@lunie/cosmos-keys/-/cosmos-keys-0.3.2.tgz", + "integrity": "sha512-QXEA0xY+hb5IeUIduQKzIqlqbl1zd2phKc/KVQnrAGH8QdepvdI0M6w0rXMq1wqJNN+m/MuwIf+UAT5q1eRj0A==", + "requires": { + "bcrypto": "^5.1.0", + "bech32": "^1.1.3", + "bip32": "^2.0.4", + "bip39": "^3.0.2", + "crypto-js": "^4.0.0" + }, + "dependencies": { + "crypto-js": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.0.0.tgz", + "integrity": "sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg==" + } + } + }, "@meteorjs/eslint-config-meteor": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@meteorjs/eslint-config-meteor/-/eslint-config-meteor-1.0.5.tgz", @@ -294,6 +453,60 @@ } } }, + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", + "requires": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" + }, "@types/d3": { "version": "4.13.12", "resolved": "https://registry.npmjs.org/@types/d3/-/d3-4.13.12.tgz", @@ -538,6 +751,11 @@ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.163.tgz", "integrity": "sha512-BeZM/FZaV53emqyHxn9L39Oz6XbHMBRLA1b1quROku48J/1kYYxPmVOJ/qSQheb81on4BI7H6QDo6bkUuRaDNQ==" }, + "@types/long": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", + "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" + }, "@types/meteor-universe-i18n": { "version": "1.14.5", "resolved": "https://registry.npmjs.org/@types/meteor-universe-i18n/-/meteor-universe-i18n-1.14.5.tgz", @@ -1328,11 +1546,33 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base-x": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz", + "integrity": "sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "base16": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/base16/-/base16-1.0.0.tgz", "integrity": "sha1-4pf2DX7BAUp6lxo568ipjAtoHnA=" }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bcrypto": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/bcrypto/-/bcrypto-5.4.0.tgz", + "integrity": "sha512-KDX2CR29o6ZoqpQndcCxFZAtYA1jDMnXU3jmCfzP44g++Cu7AHHtZN/JbrN/MXAg9SLvtQ8XISG+eVD9zH1+Jg==", + "requires": { + "bufio": "~1.0.7", + "loady": "~0.0.5" + } + }, "bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", @@ -1351,6 +1591,45 @@ "file-uri-to-path": "1.0.0" } }, + "bip32": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/bip32/-/bip32-2.0.6.tgz", + "integrity": "sha512-HpV5OMLLGTjSVblmrtYRfFFKuQB+GArM0+XP8HGWfJ5vxYBqo+DesvJwOdC2WJ3bCkZShGf0QIfoIpeomVzVdA==", + "requires": { + "@types/node": "10.12.18", + "bs58check": "^2.1.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "tiny-secp256k1": "^1.1.3", + "typeforce": "^1.11.5", + "wif": "^2.0.6" + }, + "dependencies": { + "@types/node": { + "version": "10.12.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", + "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==" + } + } + }, + "bip39": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.4.tgz", + "integrity": "sha512-YZKQlb752TrUWqHWj7XAwCSjYEgGAk+/Aas3V7NyjQeZYsztO8JnQUaCWhcnL4T+jL8nvB8typ2jRPzTlgugNw==", + "requires": { + "@types/node": "11.11.6", + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1" + }, + "dependencies": { + "@types/node": { + "version": "11.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", + "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" + } + } + }, "bip66": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", @@ -1407,11 +1686,34 @@ "safe-buffer": "^5.0.1" } }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, + "bufio": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/bufio/-/bufio-1.0.7.tgz", + "integrity": "sha512-bd1dDQhiC+bEbEfg56IdBv7faWa6OipMs/AFFFvtFnB3wAYjlwQpQRZ0pm6ZkgtfL0pILRXhKxOiQj6UzoMR7A==" + }, "call-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", @@ -3373,6 +3675,14 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, + "globalthis": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.2.tgz", + "integrity": "sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==", + "requires": { + "define-properties": "^1.1.3" + } + }, "graceful-fs": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", @@ -3763,6 +4073,11 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, + "isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" + }, "jquery": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", @@ -3773,6 +4088,16 @@ "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "js-sha512": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", + "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3962,6 +4287,19 @@ "type-check": "~0.3.2" } }, + "libsodium": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz", + "integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A==" + }, + "libsodium-wrappers": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz", + "integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==", + "requires": { + "libsodium": "^0.7.0" + } + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -3974,6 +4312,11 @@ "strip-bom": "^3.0.0" } }, + "loady": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/loady/-/loady-0.0.5.tgz", + "integrity": "sha512-uxKD2HIj042/HBx77NBcmEPsD+hxCgAtjEWlYNScuUjIsh/62Uyu39GOR68TBR68v+jqDL9zfftCWoUo4y03sQ==" + }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -3999,6 +4342,11 @@ "resolved": "https://registry.npmjs.org/lodash.flow/-/lodash.flow-3.5.0.tgz", "integrity": "sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o=" }, + "long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -5273,6 +5621,18 @@ "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true }, + "pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -5670,6 +6030,33 @@ "react-is": "^16.8.1" } }, + "protobufjs": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", + "integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.1", + "@types/node": "^13.7.0", + "long": "^4.0.0" + }, + "dependencies": { + "@types/node": { + "version": "13.13.52", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.52.tgz", + "integrity": "sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==" + } + } + }, "pump": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", @@ -5700,6 +6087,14 @@ "resolved": "https://registry.npmjs.org/pure-color/-/pure-color-1.3.0.tgz", "integrity": "sha1-H+Bk+wrIUfDeYTIKi/eWg2Qi8z4=" }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, "react": { "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", @@ -5962,6 +6357,11 @@ "util-deprecate": "^1.0.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==" + }, "regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", @@ -6774,6 +7174,11 @@ "has-flag": "^3.0.0" } }, + "symbol-observable": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz", + "integrity": "sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==" + }, "table": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/table/-/table-5.4.1.tgz", @@ -6916,6 +7321,18 @@ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.0.6.tgz", "integrity": "sha512-FOyLWWVjG+aC0UqG76V53yAWdXfH8bO6FNmyZOuUrzDzK8DI3/JRY25UD7+g49JWM1LXwymsKERB+DzI0dTEQA==" }, + "tiny-secp256k1": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz", + "integrity": "sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA==", + "requires": { + "bindings": "^1.3.0", + "bn.js": "^4.11.8", + "create-hmac": "^1.1.7", + "elliptic": "^6.4.0", + "nan": "^2.13.2" + } + }, "tiny-warning": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", @@ -6990,6 +7407,11 @@ "resolved": "https://registry.npmjs.org/typed-styles/-/typed-styles-0.0.7.tgz", "integrity": "sha512-pzP0PWoZUhsECYjABgCGQlRGL1n7tOHsgwYv3oIiEpJwGhFTuty/YNeduxQYzXXa3Ge5BdT6sHYIQYpl4uJ+5Q==" }, + "typeforce": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/typeforce/-/typeforce-1.18.0.tgz", + "integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==" + }, "typescript": { "version": "3.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", @@ -7195,6 +7617,14 @@ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, + "wif": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/wif/-/wif-2.0.6.tgz", + "integrity": "sha1-CNP1IFbGZnkplyb63g1DKudLRwQ=", + "requires": { + "bs58check": "<3.0.0" + } + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -7240,6 +7670,15 @@ "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" }, + "xstream": { + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/xstream/-/xstream-11.14.0.tgz", + "integrity": "sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw==", + "requires": { + "globalthis": "^1.0.1", + "symbol-observable": "^2.0.3" + } + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 66660a810..a9e5ad3d4 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,11 @@ }, "dependencies": { "@babel/runtime": "^7.13.17", + "@cosmjs/proto-signing": "^0.25.5", + "@cosmjs/stargate": "^0.25.5", "@ledgerhq/hw-transport-web-ble": "^5.50.0", "@ledgerhq/hw-transport-webusb": "^5.53.0", + "@lunie/cosmos-keys": "^0.3.2", "@types/meteor-universe-i18n": "^1.14.5", "axios": "^0.21.1", "babel-polyfill": "^6.26.0",