add certik and update securite

This commit is contained in:
liangping 2021-09-17 18:22:18 +08:00
parent ef730e4eaa
commit e85701f58c
5 changed files with 48 additions and 8 deletions

View File

@ -16,6 +16,7 @@
"secret": "Secret Network",
"desmos": "Desmos",
"juno": "Juno Hera",
"certik": "Certik",
"staking": "Staking",
"governance": "Governance",

View File

@ -47,7 +47,7 @@ export default class Proposal {
versionFixed(ver) {
if (compareVersions(ver, '0.40') >= 0) {
// do nothing
} else if (compareVersions(ver, '0.37') >= 0) {
} else if (compareVersions(ver, '0.30') >= 0) {
switch (this.element.proposal_status) {
case 'Passed':
this.status = 3
@ -62,5 +62,8 @@ export default class Proposal {
this.status = 1
}
}
if (String(this.status).indexOf('PASSED') > -1) {
this.status = 3
}
}
}

View File

@ -163,10 +163,19 @@ const chainAPI = class ChainFetch {
}
async getGovernanceProposer(pid) {
if (this.config.chain_name === 'certik') {
return this.get(`/shentu/gov/v1alpha1/${pid}/proposer`).then(data => new Proposer().init(commonProcess(data)))
}
return this.get(`/gov/proposals/${pid}/proposer`).then(data => new Proposer().init(commonProcess(data)))
}
async getGovernanceDeposits(pid) {
if (this.config.chain_name === 'certik') {
return this.get(`/shentu/gov/v1alpha1/proposals/${pid}/deposits`).then(data => {
const result = commonProcess(data)
return Array.isArray(result) ? result.reverse().map(d => new Deposit().init(d)) : result
})
}
return this.get(`/gov/proposals/${pid}/deposits`).then(data => {
const result = commonProcess(data)
return Array.isArray(result) ? result.reverse().map(d => new Deposit().init(d)) : result
@ -180,18 +189,27 @@ const chainAPI = class ChainFetch {
pagination: {},
}))
}
if (this.config.chain_name === 'certik') {
return this.get(`/shentu/gov/v1alpha1/proposals/${pid}/votes?pagination.key=${encodeURIComponent(next)}&pagination.limit=${limit}`)
}
return this.get(`/cosmos/gov/v1beta1/proposals/${pid}/votes?pagination.key=${encodeURIComponent(next)}&pagination.limit=${limit}`)
}
async getGovernanceList() {
return Promise.all([this.get('/gov/proposals'), this.get('/staking/pool')]).then(data => {
const pool = new StakingPool().init(commonProcess(data[1]))
let proposals = commonProcess(data[0])
if (Array.isArray(proposals.proposals)) {
proposals = proposals.proposals
}
const ret = []
commonProcess(data[0]).forEach(e => {
const g = new Proposal().init(e, pool.bondedToken)
g.versionFixed(this.config.sdk_version)
ret.push(g)
})
if (proposals) {
proposals.forEach(e => {
const g = new Proposal().init(e, pool.bondedToken)
g.versionFixed(this.config.sdk_version)
ret.push(g)
})
}
return ret
})
}
@ -210,7 +228,10 @@ const chainAPI = class ChainFetch {
}
async getAuthAccount(address, config = null) {
return this.get('/auth/accounts/'.concat(address), config).then(data => commonProcess(data))
return this.get('/auth/accounts/'.concat(address), config).then(data => {
const result = commonProcess(data)
return result.value ? result : { value: result }
})
}
async getBankAccountBalance(address) {
@ -245,6 +266,13 @@ const chainAPI = class ChainFetch {
const h = hash.substring(hash.indexOf('/'))
return this.get('/ibc/applications/transfer/v1beta1/denom_traces/'.concat(h), config).then(data => commonProcess(data))
}
async getIBCChannels(key = null, config = null) {
if (key) {
return this.get('/ibc/core/channel/v1beta1/channels?pagination.key='.concat(key), config).then(data => commonProcess(data))
}
return this.get('/ibc/core/channel/v1beta1/channels', config).then(data => commonProcess(data))
}
// /cosmos/staking/v1beta1/delegations/{delegator_addr}
static async getBankBalance(baseurl, address) {

View File

@ -0,0 +1,8 @@
{
"chain_name": "certik",
"api":"https://azuredragon.noopsbycertik.com",
"sdk_version": "0.42.6",
"addr_prefix": "certik",
"logo": "https://dl.airtable.com/.attachments/78bc9a7352de8ecd09e167d406d68582/2dcea633/dED92akm_400x400.jpg"
}

View File

@ -1,6 +1,6 @@
{
"chain_name": "secret",
"api": "https://figment-secret.api.ping.pub",
"api": "https://beta-api.scrt.network",
"sdk_version": "0.33.8",
"addr_prefix": "secret",
"logo": "https://dl.airtable.com/.attachments/b95ce1905e5327924ffdcb6d57c55b66/7e2ad353/logo.png"