Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #78 from klaytn/edwin
Browse files Browse the repository at this point in the history
Update KCT and MultiSig pages
  • Loading branch information
edwin082 authored Jan 18, 2023
2 parents 190e656 + ab54b41 commit 3b8570c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/consts/urlMap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const network = {
testnet: {
rpc: 'https://api.baobab.klaytn.net:8651',
rpc: 'https://public-node-api.klaytnapi.com/v1/baobab',
finder: 'https://baobab.klaytnfinder.io/tx/',
finderToken: 'https://baobab.klaytnfinder.io/token/',
finderNFT: 'https://baobab.klaytnfinder.io/nft/',
Expand Down
2 changes: 1 addition & 1 deletion src/views/Account/AccountKeyMultiSig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const AccountKeyMultiSig = (): ReactElement => {
}

const { newKeyring, newKeyringErrMsg } = useMemo(() => {
if (keyring && newPrivateKeyList) {
if (keyring && numOfNewPrivateKey <= newPrivateKeyList.length) {
try {
return {
newKeyring: caver.wallet.keyring.create(
Expand Down
9 changes: 5 additions & 4 deletions src/views/KCT/KIP17Deploy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement, useState } from 'react'
import { ReactElement, useMemo, useState } from 'react'
import Caver, { Keystore } from 'caver-js'
import _ from 'lodash'

Expand Down Expand Up @@ -28,9 +28,9 @@ enum FunctionEnum {
PUP = 'Pause/Unpause',
}

const caver = new Caver(URLMAP.network['testnet']['rpc'])

const KIP17Deploy = (): ReactElement => {
const caver = useMemo(() => new Caver(URLMAP.network['testnet']['rpc']), [])

const [senderAddress, setSenderAddress] = useState('')
const [senderKeystoreJSON, setSenderKeystoreJSON] = useState<Keystore>()
const [senderKeystorePassword, setSenderKeystorePassword] = useState('')
Expand Down Expand Up @@ -123,7 +123,8 @@ const KIP17Deploy = (): ReactElement => {
name: tokenName,
symbol: tokenSymbol,
},
{ from: senderAddress }
{ from: senderAddress },
caver.wallet
)

setDeployMsg('KIP-17 smart contract is successfully deployed! ')
Expand Down
16 changes: 9 additions & 7 deletions src/views/KCT/KIP37Deploy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement, useState } from 'react'
import { ReactElement, useMemo, useState } from 'react'
import Caver, { Keystore } from 'caver-js'
import _ from 'lodash'

Expand Down Expand Up @@ -27,9 +27,9 @@ enum FunctionEnum {
MINT = 'Mint',
}

const caver = new Caver(URLMAP.network['testnet']['rpc'])

const KIP37Deploy = (): ReactElement => {
const caver = useMemo(() => new Caver(URLMAP.network['testnet']['rpc']), [])

const [senderAddress, setSenderAddress] = useState('')
const [senderKeystoreJSON, setSenderKeystoreJSON] = useState<Keystore>()
const [senderKeystorePassword, setSenderKeystorePassword] = useState('')
Expand Down Expand Up @@ -120,10 +120,9 @@ const KIP37Deploy = (): ReactElement => {

setDeployButtonDisabled(true)
const kip37 = await caver.kct.kip37.deploy(
{
uri: uri,
},
{ from: senderAddress }
{ uri: uri },
{ from: senderAddress },
caver.wallet
)

setDeployMsg('KIP-37 smart contract is successfully deployed! ')
Expand All @@ -147,6 +146,7 @@ const KIP37Deploy = (): ReactElement => {
setCreateButtonDisabled(true)

const deployedContract = new caver.kct.kip37(contractAddress)
deployedContract.setWallet(caver.wallet)
deployedContract.options.from = senderAddress
const currentTokenId = lastTokenId
const created = await deployedContract.create(
Expand Down Expand Up @@ -182,6 +182,7 @@ const KIP37Deploy = (): ReactElement => {
setTransferButtonDisabled(true)

const deployedContract = new caver.kct.kip37(contractAddress)
deployedContract.setWallet(caver.wallet)
deployedContract.options.from = senderAddress
const transferred = await deployedContract.safeTransferFrom(
senderAddress,
Expand Down Expand Up @@ -224,6 +225,7 @@ const KIP37Deploy = (): ReactElement => {
setMintButtonDisabled(true)

const deployedContract = new caver.kct.kip37(contractAddress)
deployedContract.setWallet(caver.wallet)
deployedContract.options.from = senderAddress
const currentTokenId = lastTokenId - 1
const minted = await deployedContract.mint(
Expand Down
9 changes: 5 additions & 4 deletions src/views/KCT/KIP7Deploy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement, useState } from 'react'
import { ReactElement, useMemo, useState } from 'react'
import Caver, { Keystore } from 'caver-js'
import _ from 'lodash'

Expand All @@ -20,9 +20,9 @@ import {
} from 'components'
import FormFile from 'components/FormFile'

const caver = new Caver(URLMAP.network['testnet']['rpc'])

const KIP7Deploy = (): ReactElement => {
const caver = useMemo(() => new Caver(URLMAP.network['testnet']['rpc']), [])

const [senderAddress, setSenderAddress] = useState('')
const [senderKeystoreJSON, setSenderKeystoreJSON] = useState<Keystore>()
const [senderKeystorePassword, setSenderKeystorePassword] = useState('')
Expand Down Expand Up @@ -94,7 +94,8 @@ const KIP7Deploy = (): ReactElement => {
decimals: Number(decimal),
initialSupply: initialSupply,
},
{ from: senderAddress }
{ from: senderAddress },
caver.wallet
)

setDeploySuccess(true)
Expand Down
2 changes: 1 addition & 1 deletion src/views/Web3modal/web3modalNFT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ const Web3modalNFT = (): ReactElement => {
onChange={setTokenIdForMint}
value={tokenIdForMint}
/>
<Label>Toekn URI</Label>
<Label>Token URI</Label>
<SFormInput
placeholder={'Token URI'}
onChange={setTokenURIForMint}
Expand Down

0 comments on commit 3b8570c

Please sign in to comment.