Skip to content

Commit

Permalink
🔀 Merge #430 into deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Dec 29, 2023
2 parents 0a1e2ed + 18ad21c commit ea49d28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 40 deletions.
1 change: 0 additions & 1 deletion constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
18 changes: 7 additions & 11 deletions pages/edit/_iscnId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -261,6 +261,7 @@ const walletModule = namespace('wallet')
}
} else {
redirect({ name: 'index' })
return {}
}
} catch (err) {
error(err as Error)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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({
Expand Down
30 changes: 2 additions & 28 deletions utils/cosmos/iscn/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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),
Expand All @@ -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
}

0 comments on commit ea49d28

Please sign in to comment.