finish withdraw and transfer

This commit is contained in:
liangping 2021-08-25 15:45:40 +08:00
parent 0a449889b5
commit 927ffcbfe5
10 changed files with 1392 additions and 57 deletions

View File

@ -15,7 +15,12 @@
"@cosmjs/amino": "^0.25.6",
"@cosmjs/crypto": "^0.25.6",
"@cosmjs/encoding": "^0.25.6",
"@cosmjs/launchpad": "^0.25.6",
"@cosmjs/ledger-amino": "^0.25.6",
"@cosmjs/math": "^0.25.6",
"@cosmjs/proto-signing": "^0.25.6",
"@cosmjs/stargate": "^0.25.6",
"@cosmostation/cosmosjs": "^0.10.6",
"@intlify/vue-i18n-loader": "^2.1.2",
"@ledgerhq/hw-app-cosmos": "^6.3.0",
"@ledgerhq/hw-transport-web-ble": "^6.3.0",
@ -73,7 +78,6 @@
"vuex": "3.6.0"
},
"devDependencies": {
"@cosmjs/launchpad": "^0.25.6",
"@vue/cli-plugin-babel": "~4.5.9",
"@vue/cli-plugin-eslint": "~4.5.9",
"@vue/cli-plugin-router": "~4.5.9",

View File

@ -84,6 +84,7 @@ export default {
} else if (txhash.test(key)) {
this.$router.push({ name: 'transaction', params: { chain: c.chain_name, hash: key } })
} else if (addr.test(key)) {
this.$router.push({ name: 'chain-account', params: { chain: c.chain_name, address: key } })
// console.log('address', key)
}
}

View File

@ -5,14 +5,24 @@ import { sha256 } from '@cosmjs/crypto'
// ledger
import TransportWebBLE from '@ledgerhq/hw-transport-web-ble'
import TransportWebUSB from '@ledgerhq/hw-transport-webusb'
import { SigningStargateClient } from '@cosmjs/stargate'
// import Cosmos from '@ledgerhq/hw-app-cosmos'
import CosmosApp from 'ledger-cosmos-js'
import { LedgerSigner } from '@cosmjs/ledger-amino'
import {
makeAuthInfoBytes, makeSignBytes, Registry,
} from '@cosmjs/proto-signing'
import { encodeSecp256k1Signature } from '@cosmjs/amino'
import { Uint53 } from '@cosmjs/math'
import { TxRaw } from '@cosmjs/stargate/build/codec/cosmos/tx/v1beta1/tx'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import relativeTime from 'dayjs/plugin/relativeTime'
import localeData from 'dayjs/plugin/localeData'
const COSMOS_PATH = [44, 118, 0, 0, 0]
dayjs.extend(localeData)
dayjs.extend(duration)
dayjs.extend(relativeTime)
@ -21,7 +31,87 @@ export async function connectLedger(transport = 'usb') {
const trans = await transport === 'usb' ? TransportWebUSB.create() : TransportWebBLE.create()
return new CosmosApp(trans)
}
const COSMOS_PATH = [44, 118, 0, 0, 0]
/* eslint-enable */
function unharden(hdPath) {
return hdPath.map(n => (n.isHardened() ? n.toNumber() - 2 ** 31 : n.toNumber()))
}
function makeSignDoc(bodyBytes, authInfoBytes, chainId, accountNumber) {
return {
bodyBytes,
authInfoBytes,
chainId,
accountNumber: Uint53.fromString(String(accountNumber)),
}
}
export async function signDirect(signer, signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
// const accountFromSigner = (await this.signer.getAccounts()).find(account => account.address === signerAddress)
// if (!accountFromSigner) {
// throw new Error("Failed to retrieve account from signer");
// }
const accountFromSigner = await signer.getAddressAndPubKey(COSMOS_PATH, 'cosmos')
if (!accountFromSigner) {
throw new Error('Failed to retrieve account from signer')
}
const { pubkey } = accountFromSigner
console.log('accout:', accountFromSigner, pubkey)
const txBodyEncodeObject = {
typeUrl: '/cosmos.tx.v1beta1.TxBody',
value: {
messages,
memo,
},
}
const txBodyBytes = new Registry().encode(txBodyEncodeObject)
const gasLimit = Uint53.fromString(String(fee.gas))
console.log('account from signer: ', txBodyBytes, gasLimit)
const authInfoBytes = makeAuthInfoBytes([pubkey], fee.amount, gasLimit, sequence)
console.log('authinfo: ', authInfoBytes, chainId, accountNumber)
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber)
console.log('signdoc: ', signDoc, signer)
// const { signature, signed } = await signer.signDirect(signerAddress, signDoc)
const signBytes = makeSignBytes(signDoc)
const hashedMessage = sha256(signBytes)
const signature = await signer.sign(unharden(COSMOS_PATH), hashedMessage)
const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)])
const stdSignature = encodeSecp256k1Signature(pubkey, signatureBytes)
console.log('custom sign:', txBodyBytes, authInfoBytes, signDoc)
return TxRaw.fromPartial({
bodyBytes: txBodyBytes,
authInfoBytes,
signatures: [fromBase64(stdSignature)],
})
}
export async function sign(device, chainId, signerAddress, messages, fee, memo, signerData) {
let transport
let signer
switch (device) {
case 'ledgerBle':
transport = await TransportWebBLE.create()
signer = new LedgerSigner(transport)
break
case 'ledgerUSB':
transport = await TransportWebUSB.create()
signer = new LedgerSigner(transport)
break
case 'keplr':
default:
if (!window.getOfflineSigner || !window.keplr) {
throw new Error('Please install keplr extension')
}
await window.keplr.enable(chainId)
signer = window.getOfflineSignerOnlyAmino(chainId)
}
// Ensure the address has some tokens to spend
const client = await SigningStargateClient.offline(signer)
return client.signAmino(signerAddress, messages, fee, memo, signerData)
// return signDirect(signer, signerAddress, messages, fee, memo, signerData)
}
export async function getLedgerAddress(transport = 'blu') {
const trans = transport === 'usb' ? await TransportWebUSB.create() : await TransportWebBLE.create()
@ -51,6 +141,11 @@ export function toDuration(value) {
return dayjs.duration(value).humanize()
}
// unit(y M d h m s ms)
export function timeIn(time, amount, unit = 's') {
return dayjs().isAfter(dayjs(time).add(amount, unit))
}
export function toDay(time, format = 'long') {
if (format === 'long') {
return dayjs(time).format('YYYY-MM-DD HH:mm')

View File

@ -1,6 +1,9 @@
import fetch from 'node-fetch'
// import axios from 'axios'
import store from '@/store'
import compareVersions from 'compare-versions'
import { TxRaw } from '@cosmjs/stargate/build/codec/cosmos/tx/v1beta1/tx'
import { toBase64 } from '@cosmjs/encoding'
import {
Proposal, ProposalTally, Proposer, StakingPool, Votes, Deposit,
Validator, StakingParameters, Block, ValidatorDistribution, StakingDelegation, WrapStdTx,
@ -40,8 +43,8 @@ const chainAPI = class ChainFetch {
return true
}
async getLatestBlock() {
return this.get('/blocks/latest').then(data => Block.create(data))
async getLatestBlock(config = null) {
return this.get('/blocks/latest', config).then(data => Block.create(data))
}
async getBlockByHeight(height) {
@ -183,9 +186,11 @@ const chainAPI = class ChainFetch {
})
}
async get(url) {
this.getSelectedConfig()
const ret = await fetch(this.config.api + url).then(response => response.json())
async get(url, config = null) {
if (!config) {
this.getSelectedConfig()
}
const ret = await fetch((config ? config.api : this.config.api) + url).then(response => response.json())
return ret
}
@ -194,8 +199,8 @@ const chainAPI = class ChainFetch {
return ret
}
async getAuthAccount(address) {
return this.get('/auth/accounts/'.concat(address)).then(data => commonProcess(data))
async getAuthAccount(address, config = null) {
return this.get('/auth/accounts/'.concat(address), config).then(data => commonProcess(data))
}
async getBankAccountBalance(address) {
@ -245,6 +250,36 @@ const chainAPI = class ChainFetch {
static async fetchTokenQuote(symbol) {
return ChainFetch.fetchCoinMarketCap(`/quote/${symbol}`)
}
async broadcastTx(bodyBytes, config = null) {
const txString = toBase64(TxRaw.encode(bodyBytes).finish())
const txRaw = {
tx_bytes: txString,
mode: 'BROADCAST_MODE_SYNC',
}
return this.post('/cosmos/tx/v1beta1/txs', txRaw, config)
}
async post(url = '', data = {}, config = null) {
if (!config) {
this.getSelectedConfig()
}
// Default options are marked with *
const response = await fetch((config ? config.api : this.config.api) + url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
// mode: 'cors', // no-cors, *cors, same-origin
// credentials: 'same-origin', // redirect: 'follow', // manual, *follow, error
// referrerPolicy: 'origin', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
headers: {
'Content-Type': 'text/plain',
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br',
},
body: JSON.stringify(data), // body data type must match "Content-Type" header
})
// const response = axios.post((config ? config.api : this.config.api) + url, data)
return response.json() // parses JSON response into native JavaScript objects
}
}
export default chainAPI

View File

@ -0,0 +1,32 @@
import {
makeAuthInfoBytes, makeSignDoc, Registry,
// makeSignBytes,
} from '@cosmjs/proto-signing'
export default class Client {
async signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
// const accountFromSigner = (await this.signer.getAccounts()).find(account => account.address === signerAddress)
// if (!accountFromSigner) {
// throw new Error('Failed to retrieve account from signer')
// }
const pubkey = ''
const txBodyEncodeObject = {
typeUrl: '/cosmos.tx.v1beta1.TxBody',
value: {
messages,
memo,
},
}
const txBodyBytes = new Registry().encode(txBodyEncodeObject)
const gasLimit = 1
const authInfoBytes = makeAuthInfoBytes([pubkey], fee.amount, gasLimit, sequence)
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber)
const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc)
return tx_4.TxRaw.fromPartial({
bodyBytes: signed.bodyBytes,
authInfoBytes: signed.authInfoBytes,
signatures: [encoding_1.fromBase64(signature.signature)],
})
}
}

View File

@ -0,0 +1,456 @@
<template>
<div>
<b-modal
id="transfer-window"
centered
size="md"
title="Transfer Tokens"
hide-header-close
scrollable
@hidden="resetModal"
@ok="handleOk"
@show="loadBalance"
>
<validation-observer ref="simpleRules">
<b-form>
<b-row>
<b-col v-if="account">
<b-form-group
label="Sender"
label-for="Account"
>
<b-input-group class="mb-25">
<b-input-group-prepend is-text>
<b-avatar
:src="account.logo"
size="18"
variant="light-primary"
rounded
/>
</b-input-group-prepend>
<b-form-input
:value="account.addr"
readonly
/>
</b-input-group>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Recipient"
label-for="Recipient"
>
<validation-provider
#default="{ errors }"
rules="required"
name="recipient"
>
<b-input-group class="mb-25">
<b-form-input
id="Recipient"
v-model="recipient"
:state="errors.length > 0 ? false:null"
/>
<!-- <b-input-group-append is-text>
<b-avatar
src="BookIcon"
size="18"
variant="light-primary"
rounded
/>
</b-input-group-append> -->
</b-input-group>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Available Token"
label-for="Token"
>
<validation-provider
#default="{ errors }"
rules="required"
name="Token"
>
<b-form-select
v-model="token"
>
<b-form-select-option
v-for="item in balance"
:key="item.denom"
:value="item.denom"
>
{{ format(item) }}
</b-form-select-option>
</b-form-select>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Amount"
label-for="Amount"
>
<validation-provider
v-slot="{ errors }"
rules="required|regex:^([0-9\.]+)$"
name="amount"
>
<b-input-group class="mb-25">
<b-form-input
id="Amount"
v-model="amount"
:state="errors.length > 0 ? false:null"
placeholder="Input a number"
type="number"
/>
<b-input-group-append is-text>
MAX
</b-input-group-append>
</b-input-group>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Fee"
label-for="Fee"
>
<validation-provider
v-slot="{ errors }"
rules="required"
name="fee"
>
<b-input-group>
<b-input-group-prepend>
<b-form-input v-model="fee" />
<b-form-select
v-model="feeDenom"
>
<b-form-select-option
v-for="item in feeDenoms"
:key="item.denom"
:value="item.denom"
>
{{ item.denom }}
</b-form-select-option>
</b-form-select>
</b-input-group-prepend></b-input-group>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Memo"
label-for="Memo"
>
<validation-provider
v-slot="{ errors }"
name="memo"
>
<b-form-input
id="Memo"
v-model="memo"
max="2"
/>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Wallet"
label-for="wallet"
>
<validation-provider
v-slot="{ errors }"
rules="required"
name="wallet"
>
<b-form-radio-group
v-model="wallet"
stacked
class="demo-inline-spacing"
>
<b-form-radio
v-model="wallet"
name="wallet"
value="keplr"
class="mb-1 mt-1"
>
Keplr
</b-form-radio>
<!-- <b-form-radio
v-model="wallet"
name="wallet"
value="ledgerUSB"
class="mb-1 mt-1"
disabled
>
Ledger (USB)
</b-form-radio>
<b-form-radio
v-model="wallet"
name="wallet"
value="ledgerBle"
class="mb-1 mt-1"
disabled
>
Ledger (Bluetooth)
</b-form-radio> -->
</b-form-radio-group>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
</b-form>
</validation-observer>
{{ error }}
</b-modal>
</div>
</template>
<script>
import { ValidationProvider, ValidationObserver } from 'vee-validate'
import {
BModal, BRow, BCol, BInputGroup, BInputGroupAppend, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption,
BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend,
} from 'bootstrap-vue'
import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
formatToken, getLocalAccounts, getLocalChains, sign, timeIn,
} from '@/libs/data'
import chainAPI from '@/libs/fetch'
import { Cosmos } from '@cosmostation/cosmosjs'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
export default {
name: 'TransforDialogue',
components: {
BModal,
BRow,
BCol,
BForm,
BInputGroup,
BInputGroupAppend,
BInputGroupPrepend,
BFormInput,
BAvatar,
BFormGroup,
BFormSelect,
BFormSelectOption,
BFormRadioGroup,
BFormRadio,
ValidationProvider,
ValidationObserver,
// eslint-disable-next-line vue/no-unused-components
ToastificationContent,
},
props: {
address: {
type: String,
default: '',
},
},
data() {
return {
chainId: '',
selectedChain: '',
balance: [],
token: '',
amount: null,
memo: '',
recipient: null,
fee: 800,
feeDenom: '',
wallet: 'keplr',
error: null,
sequence: 1,
accountNumber: 0,
required,
password,
email,
min,
integer,
url,
alpha,
between,
digits,
length,
alphaDash,
}
},
computed: {
feeDenoms() {
return this.balance.filter(item => !item.denom.startsWith('ibc'))
},
account() {
// if (accounts && accounts[this.name]) {
// const config = accounts[this.name]
// const addr = config.address.find(x => x.addr === this.address)
// if (addr) return addr
// }
return this.computeAccount()
},
},
created() {
// console.log('address: ', this.address)
},
methods: {
computeAccount() {
const accounts = getLocalAccounts()
const chains = getLocalChains()
const values = Object.values(accounts)
for (let i = 0; i < values.length; i += 1) {
const addr = values[i].address.find(x => x.addr === this.address)
if (addr) {
this.selectedChain = chains[addr.chain]
return addr
}
}
return null
},
loadBalance() {
if (this.address) {
chainAPI.getBankBalance(this.selectedChain.api, this.address).then(res => {
if (res && res.length > 0) {
this.balance = res
this.token = this.balance[0].denom
this.feeDenom = this.balance[0].denom
}
})
this.$http.getLatestBlock(this.selectedChain).then(ret => {
this.chainId = ret.block.header.chain_id
const notSynced = timeIn(ret.block.header.time, 10, 'm')
if (notSynced) {
this.error = 'Client is not synced or blockchain is halted'
} else {
this.error = null
}
})
this.$http.getAuthAccount(this.address, this.selectedChain).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
})
}
},
handleOk(bvModalEvt) {
// console.log('send')
// Prevent modal from closing
bvModalEvt.preventDefault()
// Trigger submit handler
// this.handleSubmit()
this.send().then(ret => {
// console.log(ret)
this.error = ret
})
},
resetModal() {
this.feeDenom = ''
this.error = null
},
format(v) {
return formatToken(v)
},
async sendCosmos() {
const cosmos = new Cosmos(this.selectedChain.api, this.chainId)
cosmos.getAccounts()
},
async send() {
const txMsgs = [
{
typeUrl: '/cosmos.bank.v1beta1.MsgSend',
value: {
fromAddress: this.address,
toAddress: this.recipient,
amount: [
{
amount: String((Number(this.amount) * 1000000).toFixed()),
denom: this.token,
},
],
},
},
]
const txFee = {
amount: [
{
amount: this.fee,
denom: this.feeDenom,
},
],
gas: '200000',
}
const signerData = {
accountNumber: this.accountNumber,
sequence: this.sequence,
chainId: this.chainId,
}
console.log('tx:', txMsgs)
sign(
this.wallet,
this.chainId,
this.address,
txMsgs,
txFee,
this.memo,
signerData,
).then((bodyBytes, s) => {
console.log('signed: ', bodyBytes, s)
this.$http.broadcastTx(bodyBytes, this.selectedChain).then(res => {
console.log(res)
this.$bvModal.hide('transfer-window')
this.$toast({
component: ToastificationContent,
props: {
title: 'Transaction sent!',
icon: 'EditIcon',
variant: 'success',
},
})
}).catch(e => {
this.error = e
})
}).catch(e => {
this.error = e
})
// Send tokens
// return client.sendTokens(this.address, this.recipient, sendCoins, this.memo)
return ''
},
},
}
</script>

View File

@ -0,0 +1,358 @@
<template>
<div>
<b-modal
id="withdraw-window"
centered
size="md"
title="Withdraw Rewards"
hide-header-close
scrollable
@hidden="resetModal"
@ok="handleOk"
@show="loadBalance"
>
<validation-observer ref="simpleRules">
<b-form>
<b-row>
<b-col v-if="account">
<b-form-group
label="Sender"
label-for="Account"
>
<b-input-group class="mb-25">
<b-input-group-prepend is-text>
<b-avatar
:src="account.logo"
size="18"
variant="light-primary"
rounded
/>
</b-input-group-prepend>
<b-form-input
:value="account.addr"
readonly
/>
</b-input-group>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Fee"
label-for="Fee"
>
<validation-provider
v-slot="{ errors }"
rules="required"
name="fee"
>
<b-input-group>
<b-input-group-prepend>
<b-form-input v-model="fee" />
<b-form-select
v-model="feeDenom"
>
<b-form-select-option
v-for="item in feeDenoms"
:key="item.denom"
:value="item.denom"
>
{{ item.denom }}
</b-form-select-option>
</b-form-select>
</b-input-group-prepend></b-input-group>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Memo"
label-for="Memo"
>
<validation-provider
v-slot="{ errors }"
name="memo"
>
<b-form-input
id="Memo"
v-model="memo"
max="2"
/>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-group
label="Wallet"
label-for="wallet"
>
<validation-provider
v-slot="{ errors }"
rules="required"
name="wallet"
>
<b-form-radio-group
v-model="wallet"
stacked
class="demo-inline-spacing"
>
<b-form-radio
v-model="wallet"
name="wallet"
value="keplr"
class="mb-1 mt-1"
>
Keplr
</b-form-radio>
<!-- <b-form-radio
v-model="wallet"
name="wallet"
value="ledgerUSB"
class="mb-1 mt-1"
disabled
>
Ledger (USB)
</b-form-radio>
<b-form-radio
v-model="wallet"
name="wallet"
value="ledgerBle"
class="mb-1 mt-1"
disabled
>
Ledger (Bluetooth)
</b-form-radio> -->
</b-form-radio-group>
<small class="text-danger">{{ errors[0] }}</small>
</validation-provider>
</b-form-group>
</b-col>
</b-row>
</b-form>
</validation-observer>
{{ error }}
</b-modal>
</div>
</template>
<script>
import { ValidationProvider, ValidationObserver } from 'vee-validate'
import {
BModal, BRow, BCol, BInputGroup, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption,
BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend,
} from 'bootstrap-vue'
import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
formatToken, getLocalAccounts, getLocalChains, sign, timeIn,
} from '@/libs/data'
import chainAPI from '@/libs/fetch'
export default {
name: 'TransforDialogue',
components: {
BModal,
BRow,
BCol,
BForm,
BInputGroup,
BInputGroupPrepend,
BFormInput,
BAvatar,
BFormGroup,
BFormSelect,
BFormSelectOption,
BFormRadioGroup,
BFormRadio,
ValidationProvider,
ValidationObserver,
},
props: {
address: {
type: String,
default: '',
},
},
data() {
return {
chainId: '',
selectedChain: '',
balance: [],
delegations: [],
memo: '',
fee: 800,
feeDenom: '',
wallet: 'keplr',
error: null,
sequence: 1,
accountNumber: 0,
required,
password,
email,
min,
integer,
url,
alpha,
between,
digits,
length,
alphaDash,
}
},
computed: {
feeDenoms() {
return this.balance.filter(item => !item.denom.startsWith('ibc'))
},
account() {
// if (accounts && accounts[this.name]) {
// const config = accounts[this.name]
// const addr = config.address.find(x => x.addr === this.address)
// if (addr) return addr
// }
return this.computeAccount()
},
},
created() {
// console.log('address: ', this.address)
},
methods: {
computeAccount() {
const accounts = getLocalAccounts()
const chains = getLocalChains()
const values = Object.values(accounts)
for (let i = 0; i < values.length; i += 1) {
const addr = values[i].address.find(x => x.addr === this.address)
if (addr) {
this.selectedChain = chains[addr.chain]
return addr
}
}
return null
},
loadBalance() {
if (this.address) {
chainAPI.getBankBalance(this.selectedChain.api, this.address).then(res => {
if (res && res.length > 0) {
this.balance = res
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
if (token) this.feeDenom = token.denom
}
})
this.$http.getLatestBlock(this.selectedChain).then(ret => {
this.chainId = ret.block.header.chain_id
const notSynced = timeIn(ret.block.header.time, 10, 'm')
if (notSynced) {
this.error = 'Client is not synced or blockchain is halted'
} else {
this.error = null
}
})
this.$http.getAuthAccount(this.address, this.selectedChain).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
})
}
this.$http.getStakingDelegations(this.address).then(res => {
this.delegations = res.delegation_responses
})
},
handleOk(bvModalEvt) {
// console.log('send')
// Prevent modal from closing
bvModalEvt.preventDefault()
// Trigger submit handler
// this.handleSubmit()
this.sendTx().then(ret => {
// console.log(ret)
this.error = ret
})
},
resetModal() {
this.feeDenom = ''
this.error = null
},
format(v) {
return formatToken(v)
},
async sendTx() {
const txMsgs = []
this.delegations.forEach(i => {
console.log(i.delegation.validator_address)
txMsgs.push({
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
value: {
delegatorAddress: this.address,
validatorAddress: i.delegation.validator_address,
},
})
})
if (txMsgs.length === 0) {
this.error = 'No delegation found'
return ''
}
if (!this.accountNumber) {
this.error = 'Account number should not be empty!'
return ''
}
const txFee = {
amount: [
{
amount: this.fee,
denom: this.feeDenom,
},
],
gas: '200000',
}
const signerData = {
accountNumber: this.accountNumber,
sequence: this.sequence,
chainId: this.chainId,
}
console.log('tx:', txMsgs, txFee, signerData)
sign(
this.wallet,
this.chainId,
this.address,
txMsgs,
txFee,
this.memo,
signerData,
).then((bodyBytes, s) => {
console.log('signed: ', bodyBytes, s)
this.$http.broadcastTx(bodyBytes, this.selectedChain).then(res => {
console.log(res)
}).catch(e => {
this.error = e
})
}).catch(e => {
this.error = e
})
// Send tokens
// return client.sendTokens(this.address, this.recipient, sendCoins, this.memo)
return ''
},
},
}
</script>

View File

@ -38,6 +38,7 @@
<b-card-header class="pt-0 pl-0 pr-0">
<b-card-title>Assets</b-card-title>
<b-button
v-b-modal.transfer-window
variant="primary"
size="sm"
>
@ -103,6 +104,7 @@
<b-card-header class="pt-0 pl-0 pr-0">
<b-card-title>Delegation</b-card-title>
<b-button
v-b-modal.withdraw-window
variant="primary"
size="sm"
>
@ -169,7 +171,7 @@
v-for="p, index in account.value.vesting_periods"
:key="index"
>
<td>{{ p.length }} - {{ formatLength(p.length) }} </td><td>{{ formatToken(p.amount) }}</td>
<td><small>{{ p.length }} <br>{{ formatLength(p.length) }}</small> </td><td>{{ formatToken(p.amount) }}</td>
</b-tr>
</b-table-simple>
</b-td>
@ -210,12 +212,16 @@
placement="bottom"
>
<vue-qr :text="address" />
</b-popover></div>
</b-popover>
<operation-transfer-component :address="address" />
<operation-withdraw-component :address="address" />
</div>
</template>
<script>
import {
BCard, BAvatar, BPopover, BTable, BRow, BCol, BTableSimple, BTr, BTd, BTbody, BCardHeader, BCardTitle, BButton, BCardBody,
BCard, BAvatar, BPopover, BTable, BRow, BCol, BTableSimple, BTr, BTd, BTbody, BCardHeader, BCardTitle, BButton, BCardBody, VBModal,
} from 'bootstrap-vue'
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
@ -228,6 +234,8 @@ import {
import { $themeColors } from '@themeConfig'
import ObjectFieldComponent from './ObjectFieldComponent.vue'
import ChartjsComponentDoughnutChart from './ChartjsComponentDoughnutChart.vue'
import OperationTransferComponent from './OperationTransferComponent.vue'
import OperationWithdrawComponent from './OperationWithdrawComponent.vue'
export default {
components: {
@ -251,8 +259,11 @@ export default {
ToastificationContent,
ObjectFieldComponent,
ChartjsComponentDoughnutChart,
OperationTransferComponent,
OperationWithdrawComponent,
},
directives: {
'b-modal': VBModal,
Ripple,
},
data() {

View File

@ -2,13 +2,12 @@
<div class="text-center">
<b-tabs
v-for="item,index in accounts"
:key="index"
pills
active-nav-item-class="font-weight-bolder"
>
<b-tab
v-for="item,index in accounts"
:key="index"
>
<b-tab>
<template #title>
<feather-icon icon="UserIcon" />
<span>{{ item.name }}</span>
@ -48,6 +47,8 @@
</template>
<b-dropdown-item
v-if="balances[acc.addr]"
v-b-modal.transfer-window
@click="transfer(acc.addr)"
>
<feather-icon icon="SendIcon" /> Transfer
</b-dropdown-item>
@ -116,14 +117,14 @@
class="addzone"
>
<feather-icon icon="PlusIcon" />
Import Accounts
Connect Wallet
</b-card>
<!-- modal add accout -->
<b-modal
id="add-account"
centered
size="lg"
title="Add Account"
title="Connect Wallet"
hide-footer
hide-header-close
cancel-disabled
@ -131,7 +132,9 @@
>
<user-account-import-address />
</b-modal>
<operation-transfer-component
:address.sync="selectedAddress"
/>
</div>
</template>
@ -146,6 +149,7 @@ import {
formatTokenAmount, formatTokenDenom, getLocalAccounts, getLocalChains,
} from '@/libs/data'
import UserAccountImportAddress from './UserAccountImportAddress.vue'
import OperationTransferComponent from './OperationTransferComponent.vue'
// import { SigningCosmosClient } from '@cosmjs/launchpad'
export default {
@ -163,6 +167,7 @@ export default {
BDropdownItem,
UserAccountImportAddress,
FeatherIcon,
OperationTransferComponent,
},
directives: {
'b-modal': VBModal,
@ -170,6 +175,9 @@ export default {
},
data() {
return {
selectedAddress: '',
selectedName: '',
transferWindow: false,
accounts: [],
balances: {},
ibcDenom: {},
@ -177,41 +185,48 @@ export default {
}
},
created() {
this.accounts = getLocalAccounts()
const chains = getLocalChains()
if (this.accounts) {
Object.keys(this.accounts).forEach(acc => {
this.accounts[acc].address.forEach(add => {
chainAPI.getBankBalance(chains[add.chain].api, add.addr).then(res => {
if (res && res.length > 0) {
this.$set(this.balances, add.addr, res)
res.forEach(token => {
let symbol
if (token.denom.startsWith('ibc')) {
chainAPI.getIBCDenomTraceText(chains[add.chain].api, token.denom).then(denom => {
this.$set(this.ibcDenom, token.denom, denom)
symbol = formatTokenDenom(denom)
})
} else {
symbol = formatTokenDenom(token.denom)
}
if (symbol) {
if (!this.quotes[symbol]) {
chainAPI.fetchTokenQuote(symbol).then(quote => {
this.$set(this.quotes, symbol, quote)
})
}
}
})
}
})
})
})
}
this.init()
},
methods: {
init() {
this.accounts = getLocalAccounts()
const chains = getLocalChains()
if (this.accounts) {
Object.keys(this.accounts).forEach(acc => {
this.accounts[acc].address.forEach(add => {
chainAPI.getBankBalance(chains[add.chain].api, add.addr).then(res => {
if (res && res.length > 0) {
this.$set(this.balances, add.addr, res)
res.forEach(token => {
let symbol
if (token.denom.startsWith('ibc')) {
chainAPI.getIBCDenomTraceText(chains[add.chain].api, token.denom).then(denom => {
this.$set(this.ibcDenom, token.denom, denom)
symbol = formatTokenDenom(denom)
})
} else {
symbol = formatTokenDenom(token.denom)
}
if (symbol) {
if (!this.quotes[symbol]) {
chainAPI.fetchTokenQuote(symbol).then(quote => {
this.$set(this.quotes, symbol, quote)
})
}
}
})
}
})
})
})
}
},
transfer(addr) {
this.selectedAddress = addr
console.log(this.selectedAddress)
},
completeAdd() {
this.$set(this, 'accounts', getLocalAccounts())
this.init()
this.$bvModal.hide('add-account')
},
formatDenom(v) {

340
yarn.lock
View File

@ -922,6 +922,16 @@
resolved "https://registry.npmjs.org/@casl/vue/-/vue-1.1.1.tgz"
integrity sha512-lJnPGJ2sdid22IGNPegWsMH0136WSMKZqqZb2YjLWL/vsRvw+wuLZE+yaR7enEfETmH5KZE55WAfXpyZgy99hQ==
"@confio/ics23@^0.6.3":
version "0.6.5"
resolved "https://registry.yarnpkg.com/@confio/ics23/-/ics23-0.6.5.tgz#9c21a61089d4c3c2429875a69d6d9cd8c87512aa"
integrity sha512-1GdPMsaP/l8JSF4P4HWFLBhdcxHcJT8lS0nknBYNSZ1XrJOsJKUy6EkOwd9Pa1qJkXzY2gyNv7MdHR+AIwSTAg==
dependencies:
js-sha512 "^0.8.0"
protobufjs "^6.8.8"
ripemd160 "^2.0.2"
sha.js "^2.4.11"
"@cosmjs/amino@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.25.6.tgz#cdf9632253bfab7b1d2ef967124953d7bf16351f"
@ -957,6 +967,14 @@
bech32 "^1.1.4"
readonly-date "^1.0.0"
"@cosmjs/json-rpc@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.25.6.tgz#4f888630e84ee114b164758ec5b48f134068656c"
integrity sha512-Mn9og3/IEzC6jWoYXs0ONqFJc8HxVjXzrZPLgaRRdMZEUBvctxdhynau1wbE4LdkYQHbu4aiRu1q1jMYGFAj4A==
dependencies:
"@cosmjs/stream" "^0.25.6"
xstream "^11.14.0"
"@cosmjs/launchpad@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/launchpad/-/launchpad-0.25.6.tgz#c75f5d21be57af55fcb892f929520fa97f2d5bcc"
@ -970,6 +988,16 @@
axios "^0.21.1"
fast-deep-equal "^3.1.3"
"@cosmjs/ledger-amino@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/ledger-amino/-/ledger-amino-0.25.6.tgz#8ff29c3563b53d8ecfd3a1bcc48512b6ffdd61e9"
integrity sha512-TaoFte6S1yMFGCfPVNHrrR5/Hz67v4+9/rdKelgNc6k7FYekwzO4dX3tJRUY7XfjaNlW8ojkCWppic1QUe+P2A==
dependencies:
"@cosmjs/amino" "^0.25.6"
"@cosmjs/utils" "^0.25.6"
ledger-cosmos-js "^2.1.8"
semver "^7.3.2"
"@cosmjs/math@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.25.6.tgz#25c7b106aaded889a5b80784693caa9e654b0c28"
@ -986,11 +1014,75 @@
long "^4.0.0"
protobufjs "~6.10.2"
"@cosmjs/socket@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.25.6.tgz#7876bc24e1f16315fbb9e97bd63dea65ba90647d"
integrity sha512-hu+pW3Fy0IuhstXgxnZ2Iq0RUnGYoTWfqrxbTsgXBJge4MpEQs2YwGXgJZPMJXedBQivG0tU3r/Wvam0EWuRkQ==
dependencies:
"@cosmjs/stream" "^0.25.6"
isomorphic-ws "^4.0.1"
ws "^7"
xstream "^11.14.0"
"@cosmjs/stargate@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.25.6.tgz#ed7428aafd8fe1c12dc4b86f7967deb88117f61a"
integrity sha512-+LM1sK6vGuotJF9fBCBlaDL/yJhfzCV6KbsaWt3teHAKZhKYOd/9mKGiB4H9bfg4h3r+e+FZGiNkH/mdXkcgEw==
dependencies:
"@confio/ics23" "^0.6.3"
"@cosmjs/amino" "^0.25.6"
"@cosmjs/encoding" "^0.25.6"
"@cosmjs/math" "^0.25.6"
"@cosmjs/proto-signing" "^0.25.6"
"@cosmjs/stream" "^0.25.6"
"@cosmjs/tendermint-rpc" "^0.25.6"
"@cosmjs/utils" "^0.25.6"
long "^4.0.0"
protobufjs "~6.10.2"
"@cosmjs/stream@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.25.6.tgz#1bf7536ed919be3fd7fbffa477c98ef5a93eac70"
integrity sha512-2mXIzf+WaFd+GSrRaJJETVXeZoC5sosuKChFERxSY8zXQ/f3OaG9J6m+quHpPbU3nAIEtnF1jgBVqJiD+NKwGQ==
dependencies:
xstream "^11.14.0"
"@cosmjs/tendermint-rpc@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.25.6.tgz#8198a08b0d0e1d6580618f3f22db83366329c9c3"
integrity sha512-wsvxTI7DReWJu+SVlXLblzh5NJppnh1mljuaTHodMf7HBxrXdbcCcBAO8oMbMgEqOASEY5G+z51wktxhrn9RtA==
dependencies:
"@cosmjs/crypto" "^0.25.6"
"@cosmjs/encoding" "^0.25.6"
"@cosmjs/json-rpc" "^0.25.6"
"@cosmjs/math" "^0.25.6"
"@cosmjs/socket" "^0.25.6"
"@cosmjs/stream" "^0.25.6"
axios "^0.21.1"
readonly-date "^1.0.0"
xstream "^11.14.0"
"@cosmjs/utils@^0.25.6":
version "0.25.6"
resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.25.6.tgz#934d9a967180baa66163847616a74358732227ca"
integrity sha512-ofOYiuxVKNo238vCPPlaDzqPXy2AQ/5/nashBo5rvPZJkxt9LciGfUEQWPCOb1BIJDNx2Dzu0z4XCf/dwzl0Dg==
"@cosmostation/cosmosjs@^0.10.6":
version "0.10.6"
resolved "https://registry.yarnpkg.com/@cosmostation/cosmosjs/-/cosmosjs-0.10.6.tgz#d0b0d2379259638f1cf979f739183464f888d12c"
integrity sha512-PLDi3HFYtNZ/H9dGG07GpVpcuwKLD8LI/TvqMO8f9RHnY50BtDPAsv4BrPGBEEIEp+PdVE2Sd43vzrr4NlUi0A==
dependencies:
bech32 "^1.1.3"
bip32 "^2.0.5"
bip39 "^2.5.0"
bitcoinjs-lib "^4.0.2"
google-protobuf "^3.14.0"
lodash "^4.17.21"
node-fetch "^2.6.1"
protobufjs "^6.10.2"
request "^2.88.2"
secp256k1 "^3.8.0"
"@hapi/address@2.x.x":
version "2.1.4"
resolved "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz"
@ -1487,11 +1579,21 @@
resolved "https://registry.npmjs.org/@types/node/-/node-16.3.3.tgz"
integrity sha512-8h7k1YgQKxKXWckzFCMfsIwn0Y61UK6tlD6y2lOb3hTOIMlK3t9/QwHOhc81TwU+RMf0As5fj7NPjroERCnejQ==
"@types/node@10.12.18":
version "10.12.18"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67"
integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==
"@types/node@11.11.6":
version "11.11.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a"
integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==
"@types/node@>=13.7.0":
version "16.6.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.2.tgz#331b7b9f8621c638284787c5559423822fdffc50"
integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA==
"@types/node@^13.7.0":
version "13.13.52"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.52.tgz#03c13be70b9031baaed79481c0c0cfb0045e53f7"
@ -2482,6 +2584,13 @@ balanced-match@^1.0.0:
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
base-x@^3.0.2:
version "3.0.8"
resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d"
integrity sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==
dependencies:
safe-buffer "^5.0.1"
base64-js@^1.0.2, base64-js@^1.3.0, base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
@ -2512,7 +2621,7 @@ bcrypt-pbkdf@^1.0.0:
dependencies:
tweetnacl "^0.14.3"
bech32@^1.1.4:
bech32@^1.1.2, bech32@^1.1.3, bech32@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9"
integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==
@ -2595,7 +2704,7 @@ binary-extensions@^2.0.0:
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz"
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
bindings@^1.5.0:
bindings@^1.3.0, bindings@^1.5.0:
version "1.5.0"
resolved "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz"
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
@ -2607,6 +2716,42 @@ bip32-path@^0.4.2:
resolved "https://registry.yarnpkg.com/bip32-path/-/bip32-path-0.4.2.tgz#5db0416ad6822712f077836e2557b8697c0c7c99"
integrity sha1-XbBBataCJxLwd4NuJVe4aXwMfJk=
bip32@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/bip32/-/bip32-1.0.4.tgz#188ad57a45fb1342c9aabe969d0612c704a987b4"
integrity sha512-8T21eLWylZETolyqCPgia+MNp+kY37zFr7PTFDTPObHeNi9JlfG4qGIh8WzerIJidtwoK+NsWq2I5i66YfHoIw==
dependencies:
bs58check "^2.1.1"
create-hash "^1.2.0"
create-hmac "^1.1.7"
tiny-secp256k1 "^1.0.0"
typeforce "^1.11.5"
wif "^2.0.6"
bip32@^2.0.5:
version "2.0.6"
resolved "https://registry.yarnpkg.com/bip32/-/bip32-2.0.6.tgz#6a81d9f98c4cd57d05150c60d8f9e75121635134"
integrity sha512-HpV5OMLLGTjSVblmrtYRfFFKuQB+GArM0+XP8HGWfJ5vxYBqo+DesvJwOdC2WJ3bCkZShGf0QIfoIpeomVzVdA==
dependencies:
"@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"
bip39@^2.5.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.6.0.tgz#9e3a720b42ec8b3fbe4038f1e445317b6a99321c"
integrity sha512-RrnQRG2EgEoqO24ea+Q/fftuPUZLmrEM3qNhhGsA3PbaXaCW791LTzPuVyx/VprXQcTbPJ3K3UeTna8ZnVl2sg==
dependencies:
create-hash "^1.1.0"
pbkdf2 "^3.0.9"
randombytes "^2.0.1"
safe-buffer "^5.0.1"
unorm "^1.3.3"
bip39@^3.0.2:
version "3.0.4"
resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.0.4.tgz#5b11fed966840b5e1b8539f0f54ab6392969b2a0"
@ -2617,6 +2762,39 @@ bip39@^3.0.2:
pbkdf2 "^3.0.9"
randombytes "^2.0.1"
bip66@^1.1.0, bip66@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/bip66/-/bip66-1.1.5.tgz#01fa8748785ca70955d5011217d1b3139969ca22"
integrity sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=
dependencies:
safe-buffer "^5.0.1"
bitcoin-ops@^1.3.0, bitcoin-ops@^1.4.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz#e45de620398e22fd4ca6023de43974ff42240278"
integrity sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow==
bitcoinjs-lib@^4.0.2:
version "4.0.5"
resolved "https://registry.yarnpkg.com/bitcoinjs-lib/-/bitcoinjs-lib-4.0.5.tgz#2cce3469b950fade9f0442755ebb26bf9de519a1"
integrity sha512-gYs7K2hiY4Xb96J8AIF+Rx+hqbwjVlp5Zt6L6AnHOdzfe/2tODdmDxsEytnaxVCdhOUg0JnsGpl+KowBpGLxtA==
dependencies:
bech32 "^1.1.2"
bip32 "^1.0.4"
bip66 "^1.1.0"
bitcoin-ops "^1.4.0"
bs58check "^2.0.0"
create-hash "^1.1.0"
create-hmac "^1.1.3"
merkle-lib "^2.0.10"
pushdata-bitcoin "^1.0.1"
randombytes "^2.0.1"
safe-buffer "^5.1.1"
tiny-secp256k1 "^1.0.0"
typeforce "^1.11.3"
varuint-bitcoin "^1.0.4"
wif "^2.0.1"
bl@^1.0.0:
version "1.2.3"
resolved "https://registry.nlark.com/bl/download/bl-1.2.3.tgz"
@ -2748,7 +2926,7 @@ brorand@^1.0.1, brorand@^1.1.0:
resolved "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
browserify-aes@^1.0.0, browserify-aes@^1.0.4:
browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.0.6:
version "1.2.0"
resolved "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz"
integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==
@ -2820,6 +2998,22 @@ browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.16.6:
escalade "^3.1.1"
node-releases "^1.1.71"
bs58@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a"
integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo=
dependencies:
base-x "^3.0.2"
bs58check@<3.0.0, bs58check@^2.0.0, bs58check@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc"
integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==
dependencies:
bs58 "^4.0.0"
create-hash "^1.1.0"
safe-buffer "^5.1.2"
buffer-alloc-unsafe@^1.1.0:
version "1.1.0"
resolved "https://registry.npm.taobao.org/buffer-alloc-unsafe/download/buffer-alloc-unsafe-1.1.0.tgz"
@ -3660,7 +3854,7 @@ create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0:
ripemd160 "^2.0.1"
sha.js "^2.4.0"
create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
create-hmac@^1.1.0, create-hmac@^1.1.3, create-hmac@^1.1.4, create-hmac@^1.1.7:
version "1.1.7"
resolved "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz"
integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==
@ -4351,6 +4545,15 @@ download@^7.1.0:
p-event "^2.1.0"
pify "^3.0.0"
drbg.js@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b"
integrity sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=
dependencies:
browserify-aes "^1.0.6"
create-hash "^1.1.2"
create-hmac "^1.1.4"
duplexer3@^0.1.4:
version "0.1.4"
resolved "https://registry.npm.taobao.org/duplexer3/download/duplexer3-0.1.4.tgz"
@ -4406,7 +4609,7 @@ electron-to-chromium@^1.3.723:
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.779.tgz"
integrity sha512-nreave0y/1Qhmo8XtO6C/LpawNyC6U26+q7d814/e+tIqUK073pM+4xW7WUXyqCRa5K4wdxHmNMBAi8ap9nEew==
elliptic@^6.5.3:
elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.3:
version "6.5.4"
resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz"
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
@ -5536,6 +5739,13 @@ globals@^12.1.0:
dependencies:
type-fest "^0.8.1"
globalthis@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.2.tgz#2a235d34f4d8036219f7e34929b5de9e18166b8b"
integrity sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==
dependencies:
define-properties "^1.1.3"
globby@^11.0.3:
version "11.0.4"
resolved "https://registry.nlark.com/globby/download/globby-11.0.4.tgz?cache=0&sync_timestamp=1623850192942&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglobby%2Fdownload%2Fglobby-11.0.4.tgz"
@ -5592,6 +5802,11 @@ good-listener@^1.2.2:
dependencies:
delegate "^3.1.2"
google-protobuf@^3.14.0:
version "3.17.3"
resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.17.3.tgz#f87595073545a77946c8f0b67c302c5f7646d700"
integrity sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg==
got@11.8.2:
version "11.8.2"
resolved "https://registry.nlark.com/got/download/got-11.8.2.tgz"
@ -6695,6 +6910,11 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
isomorphic-ws@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc"
integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
@ -6730,6 +6950,11 @@ js-sha3@^0.8.0:
resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840"
integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==
js-sha512@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/js-sha512/-/js-sha512-0.8.0.tgz#dd22db8d02756faccf19f218e3ed61ec8249f7d4"
integrity sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
@ -6950,7 +7175,7 @@ leaflet@1.6.0:
resolved "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz"
integrity sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ==
ledger-cosmos-js@2.1.8:
ledger-cosmos-js@2.1.8, ledger-cosmos-js@^2.1.8:
version "2.1.8"
resolved "https://registry.yarnpkg.com/ledger-cosmos-js/-/ledger-cosmos-js-2.1.8.tgz#b409ecd1e77f630e6fb212a9f602fe5c6e8f054b"
integrity sha512-Gl7SWMq+3R9OTkF1hLlg5+1geGOmcHX9OdS+INDsGNxSiKRWlsWCvQipGoDnRIQ6CPo2i/Ze58Dw0Mt/l3UYyA==
@ -7342,6 +7567,11 @@ merge2@^1.2.3, merge2@^1.3.0:
resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
merkle-lib@^2.0.10:
version "2.0.10"
resolved "https://registry.yarnpkg.com/merkle-lib/-/merkle-lib-2.0.10.tgz#82b8dbae75e27a7785388b73f9d7725d0f6f3326"
integrity sha1-grjbrnXieneFOItz+ddyXQ9vMyY=
methods@~1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz"
@ -7573,6 +7803,11 @@ nan@^2.12.1:
resolved "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz"
integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==
nan@^2.13.2, nan@^2.14.0:
version "2.15.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee"
integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==
nanomatch@^1.2.9:
version "1.2.13"
resolved "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz"
@ -8902,6 +9137,25 @@ proto-list@~1.2.1:
resolved "https://registry.npm.taobao.org/proto-list/download/proto-list-1.2.4.tgz"
integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=
protobufjs@^6.10.2, protobufjs@^6.8.8:
version "6.11.2"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b"
integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==
dependencies:
"@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"
protobufjs@~6.10.2:
version "6.10.2"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.10.2.tgz#b9cb6bd8ec8f87514592ba3fdfd28e93f33a469b"
@ -9003,6 +9257,13 @@ pupa@^2.1.1:
dependencies:
escape-goat "^2.0.0"
pushdata-bitcoin@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz#15931d3cd967ade52206f523aa7331aef7d43af7"
integrity sha1-FZMdPNlnreUiBvUjqnMxrvfUOvc=
dependencies:
bitcoin-ops "^1.3.0"
q@^1.1.2:
version "1.5.1"
resolved "https://registry.npmjs.org/q/-/q-1.5.1.tgz"
@ -9601,6 +9862,20 @@ schema-utils@^3.0.0:
ajv "^6.12.5"
ajv-keywords "^3.5.2"
secp256k1@^3.8.0:
version "3.8.0"
resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.8.0.tgz#28f59f4b01dbee9575f56a47034b7d2e3b3b352d"
integrity sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw==
dependencies:
bindings "^1.5.0"
bip66 "^1.1.5"
bn.js "^4.11.8"
create-hash "^1.2.0"
drbg.js "^1.0.1"
elliptic "^6.5.2"
nan "^2.14.0"
safe-buffer "^5.1.2"
seek-bzip@^1.0.5:
version "1.0.6"
resolved "https://registry.npm.taobao.org/seek-bzip/download/seek-bzip-1.0.6.tgz"
@ -10422,6 +10697,11 @@ swiper@6.5.1:
dom7 "^3.0.0"
ssr-window "^3.0.0"
symbol-observable@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a"
integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==
table@^5.2.3:
version "5.4.6"
resolved "https://registry.npmjs.org/table/-/table-5.4.6.tgz"
@ -10581,6 +10861,17 @@ tiny-emitter@^2.0.0:
resolved "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz"
integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==
tiny-secp256k1@^1.0.0, tiny-secp256k1@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz#7e224d2bee8ab8283f284e40e6b4acb74ffe047c"
integrity sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA==
dependencies:
bindings "^1.3.0"
bn.js "^4.11.8"
create-hmac "^1.1.7"
elliptic "^6.4.0"
nan "^2.13.2"
tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz"
@ -10771,6 +11062,11 @@ typedarray@^0.0.6:
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typeforce@^1.11.3, typeforce@^1.11.5:
version "1.18.0"
resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc"
integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==
uglify-js@3.4.x:
version "3.4.10"
resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.10.tgz"
@ -10871,6 +11167,11 @@ universalify@^2.0.0:
resolved "https://registry.npm.taobao.org/universalify/download/universalify-2.0.0.tgz?cache=0&sync_timestamp=1603180004159&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funiversalify%2Fdownload%2Funiversalify-2.0.0.tgz"
integrity sha1-daSYTv7cSwiXXFrrc/Uw0C3yVxc=
unorm@^1.3.3:
version "1.6.0"
resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.6.0.tgz#029b289661fba714f1a9af439eb51d9b16c205af"
integrity sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==
unpipe@1.0.0, unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz"
@ -11050,6 +11351,13 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"
varuint-bitcoin@^1.0.4:
version "1.1.2"
resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz#e76c138249d06138b480d4c5b40ef53693e24e92"
integrity sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw==
dependencies:
safe-buffer "^5.1.1"
vary@~1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
@ -11576,6 +11884,13 @@ widest-line@^3.1.0:
dependencies:
string-width "^4.0.0"
wif@^2.0.1, wif@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/wif/-/wif-2.0.6.tgz#08d3f52056c66679299726fade0d432ae74b4704"
integrity sha1-CNP1IFbGZnkplyb63g1DKudLRwQ=
dependencies:
bs58check "<3.0.0"
with-open-file@^0.1.6:
version "0.1.7"
resolved "https://registry.npm.taobao.org/with-open-file/download/with-open-file-0.1.7.tgz"
@ -11653,11 +11968,24 @@ ws@^6.0.0, ws@^6.2.1:
dependencies:
async-limiter "~1.0.0"
ws@^7:
version "7.5.3"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74"
integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==
xdg-basedir@^4.0.0:
version "4.0.0"
resolved "https://registry.npm.taobao.org/xdg-basedir/download/xdg-basedir-4.0.0.tgz?cache=0&sync_timestamp=1617611838739&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxdg-basedir%2Fdownload%2Fxdg-basedir-4.0.0.tgz"
integrity sha1-S8jZmEQDaWIl74OhVzy7y0552xM=
xstream@^11.14.0:
version "11.14.0"
resolved "https://registry.yarnpkg.com/xstream/-/xstream-11.14.0.tgz#2c071d26b18310523b6877e86b4e54df068a9ae5"
integrity sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw==
dependencies:
globalthis "^1.0.1"
symbol-observable "^2.0.3"
xtend@^4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz"