diff --git a/constant/index.ts b/constant/index.ts index 3fb11691..380d8e6c 100644 --- a/constant/index.ts +++ b/constant/index.ts @@ -18,7 +18,6 @@ export const ISCN_MIN_BALANCE = 0.01; export const ISCN_GAS_FEE = 200000; export const ISCN_GAS_MULTIPLIER = 1.5; -export const UPDATE_ISCN_GAS_FEE = 300000; export const ISCN_REGISTRY_NAME = 'likecoin-chain'; diff --git a/pages/edit/_iscnId.vue b/pages/edit/_iscnId.vue index 964d2afe..1451d891 100644 --- a/pages/edit/_iscnId.vue +++ b/pages/edit/_iscnId.vue @@ -240,7 +240,7 @@ import { namespace } from 'vuex-class' import { OfflineSigner } from '@cosmjs/proto-signing' import { ISCN_PREFIX } from '~/constant' import { logTrackerEvent } from '~/utils/logger' -import { updateISCNRecord } from '~/utils/cosmos/iscn/sign' +import { signISCN } from '~/utils/cosmos/iscn/sign' import { extractIscnIdPrefix } from '~/utils/ui' const walletModule = namespace('wallet') @@ -261,6 +261,7 @@ const walletModule = namespace('wallet') } } else { redirect({ name: 'index' }) + return {} } } catch (err) { error(err as Error) @@ -318,12 +319,10 @@ export default class EditIscnPage extends Vue { get contentFingerprintOptions() { const array = [] if (this.uploadArweaveIdList) { - array.push( - ...this.uploadArweaveIdList.map((id: string) => (id)), - ) + array.push(...this.uploadArweaveIdList.map((id: string) => id)) } if (this.uploadIpfsList.length) { - array.push(...this.uploadIpfsList.map((ipfs) => (ipfs))) + array.push(...this.uploadIpfsList.map((ipfs) => ipfs)) } if (this.customContentFingerprints.length) { array.push(...this.customContentFingerprints) @@ -427,12 +426,9 @@ export default class EditIscnPage extends Vue { this.isSubmitLoading = true try { await this.initIfNecessary() - const result = await updateISCNRecord( - this.signer, - this.address, - this.iscnId, - this.payload, - ) + const result = await signISCN(this.payload, this.signer, this.address, { + iscnId: this.iscnId, + }) if (result) { this.$router.replace( this.localeLocation({ diff --git a/utils/cosmos/iscn/sign.ts b/utils/cosmos/iscn/sign.ts index 6366538d..06571404 100644 --- a/utils/cosmos/iscn/sign.ts +++ b/utils/cosmos/iscn/sign.ts @@ -5,7 +5,7 @@ import network from '@/constant/network'; import { DeliverTxResponse } from '@cosmjs/stargate'; import { BigNumber } from 'bignumber.js'; import { ISCNRegisterPayload } from './iscn.type'; -import { WALLET_TYPE_REPLACER, ISCN_GAS_FEE, DEFAULT_GAS_PRICE, UPDATE_ISCN_GAS_FEE } from '~/constant' +import { WALLET_TYPE_REPLACER, ISCN_GAS_FEE, DEFAULT_GAS_PRICE, ISCN_GAS_MULTIPLIER } from '~/constant' import { getPublisherISCNPayload } from '.'; import { ISCN_PUBLISHERS } from '~/constant/iscn'; @@ -169,7 +169,7 @@ export async function signISCN( ? signingClient.updateISCNRecord(address, iscnId as string, tx, { memo: memo || 'app.like.co', fee: { - gas, + gas: new BigNumber(gas).multipliedBy(ISCN_GAS_MULTIPLIER).toFixed(0), amount: [{ denom: DEFAULT_GAS_PRICE[0].denom, amount: new BigNumber(gas).multipliedBy(DEFAULT_GAS_PRICE[0].amount).toFixed(0), @@ -190,29 +190,3 @@ export async function signISCN( return res as DeliverTxResponse } -export async function updateISCNRecord( - signer: OfflineSigner, - address: string, - iscnId: string, - payload: ISCNSignPayload, -) { - const signingClient = await getSigningClient() - await signingClient.connectWithSigner(network.rpcURL, signer) - const signingPromise = signingClient.updateISCNRecord( - address, - iscnId, - payload, - { - fee: { - gas: UPDATE_ISCN_GAS_FEE.toString(), - amount: [{ - denom: DEFAULT_GAS_PRICE[0].denom, - amount: DEFAULT_GAS_PRICE[0].amount.toString(), - }], - }, - }, - ) - - const res = await signingPromise - return res as DeliverTxResponse -}