diff --git a/src/consts/urlMap.ts b/src/consts/urlMap.ts index 747248d..640fcc1 100644 --- a/src/consts/urlMap.ts +++ b/src/consts/urlMap.ts @@ -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/', diff --git a/src/views/Account/AccountKeyMultiSig.tsx b/src/views/Account/AccountKeyMultiSig.tsx index d0d423f..e6ef1cc 100644 --- a/src/views/Account/AccountKeyMultiSig.tsx +++ b/src/views/Account/AccountKeyMultiSig.tsx @@ -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( diff --git a/src/views/KCT/KIP17Deploy.tsx b/src/views/KCT/KIP17Deploy.tsx index 6ded415..689dc20 100644 --- a/src/views/KCT/KIP17Deploy.tsx +++ b/src/views/KCT/KIP17Deploy.tsx @@ -1,4 +1,4 @@ -import { ReactElement, useState } from 'react' +import { ReactElement, useMemo, useState } from 'react' import Caver, { Keystore } from 'caver-js' import _ from 'lodash' @@ -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() const [senderKeystorePassword, setSenderKeystorePassword] = useState('') @@ -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! ') diff --git a/src/views/KCT/KIP37Deploy.tsx b/src/views/KCT/KIP37Deploy.tsx index 65350f7..1556b41 100644 --- a/src/views/KCT/KIP37Deploy.tsx +++ b/src/views/KCT/KIP37Deploy.tsx @@ -1,4 +1,4 @@ -import { ReactElement, useState } from 'react' +import { ReactElement, useMemo, useState } from 'react' import Caver, { Keystore } from 'caver-js' import _ from 'lodash' @@ -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() const [senderKeystorePassword, setSenderKeystorePassword] = useState('') @@ -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! ') @@ -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( @@ -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, @@ -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( diff --git a/src/views/KCT/KIP7Deploy.tsx b/src/views/KCT/KIP7Deploy.tsx index 1511452..f132193 100644 --- a/src/views/KCT/KIP7Deploy.tsx +++ b/src/views/KCT/KIP7Deploy.tsx @@ -1,4 +1,4 @@ -import { ReactElement, useState } from 'react' +import { ReactElement, useMemo, useState } from 'react' import Caver, { Keystore } from 'caver-js' import _ from 'lodash' @@ -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() const [senderKeystorePassword, setSenderKeystorePassword] = useState('') @@ -94,7 +94,8 @@ const KIP7Deploy = (): ReactElement => { decimals: Number(decimal), initialSupply: initialSupply, }, - { from: senderAddress } + { from: senderAddress }, + caver.wallet ) setDeploySuccess(true) diff --git a/src/views/Web3modal/web3modalNFT.tsx b/src/views/Web3modal/web3modalNFT.tsx index 1487e44..b4c3301 100644 --- a/src/views/Web3modal/web3modalNFT.tsx +++ b/src/views/Web3modal/web3modalNFT.tsx @@ -365,7 +365,7 @@ const Web3modalNFT = (): ReactElement => { onChange={setTokenIdForMint} value={tokenIdForMint} /> - +