调整链相关配置
This commit is contained in:
parent
7e721d4dec
commit
ef4ce2bb71
27
src/chain/Chain.ts
Normal file
27
src/chain/Chain.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import Web3 from 'web3'
|
||||
import { AppModule } from '@/store/modules/app'
|
||||
import { ERC20ABI } from '@/configs/contracts'
|
||||
|
||||
export class Chain {
|
||||
private web3: Web3
|
||||
|
||||
constructor(provider: any) {
|
||||
this.web3 = new Web3(provider)
|
||||
}
|
||||
|
||||
public async initInstance({ abi, address, account }: {abi: any, address: string, account: string}) {
|
||||
return new this.web3.eth.Contract(
|
||||
abi,
|
||||
address,
|
||||
{ from: account }
|
||||
)
|
||||
}
|
||||
|
||||
public async getCoinInstance(address: string) {
|
||||
return this.initInstance({
|
||||
abi: ERC20ABI,
|
||||
address,
|
||||
account: AppModule.accountId
|
||||
})
|
||||
}
|
||||
}
|
@ -4,15 +4,35 @@ import { getNonce } from '@/api/User'
|
||||
import { AppModule } from '@/store/modules/app'
|
||||
import { UserModule } from '@/store/modules/user'
|
||||
import { Message } from 'element-ui'
|
||||
import { Chain } from '@/chain/Chain'
|
||||
import { AVAILABLE_CHAINS, IChainData } from '@/configs/config_chain'
|
||||
import { AllChains } from '@/configs/allchain'
|
||||
|
||||
@singleton
|
||||
export default class ChainManager {
|
||||
bc: Blockchain
|
||||
instanceMap: Map<string, any>
|
||||
public chainMap: Map<number, IChainData> = new Map()
|
||||
private _availableChains: Map<number, IChainData> = new Map()
|
||||
|
||||
constructor() {
|
||||
this.bc = new Blockchain()
|
||||
this.instanceMap = new Map()
|
||||
for (const data of AllChains) {
|
||||
this.chainMap.set(data.id, data)
|
||||
}
|
||||
// EventBus.$on(NEED_NONCE, this.checkNance.bind(this))
|
||||
}
|
||||
|
||||
get availableChains() {
|
||||
if (this._availableChains.size === 0) {
|
||||
for (const id of AVAILABLE_CHAINS) {
|
||||
this._availableChains.set(id, this.chainMap.get(id)!)
|
||||
}
|
||||
}
|
||||
return this._availableChains
|
||||
}
|
||||
|
||||
public async init() {
|
||||
if (this.bc.isWalletConnect) {
|
||||
try {
|
||||
@ -96,4 +116,20 @@ export default class ChainManager {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
public async getInstance(address: string, chainId: number) {
|
||||
// 由于不同网络上的contract的address不会相同, 所以可以直接以address作为key来缓存
|
||||
if (!this.instanceMap.has(address)) {
|
||||
const chain = new Chain(this.chainMap.get(chainId)!.rpc)
|
||||
const coinInstance = await chain.getCoinInstance(address)
|
||||
this.instanceMap.set(address, coinInstance)
|
||||
}
|
||||
return this.instanceMap.get(address)
|
||||
}
|
||||
|
||||
public async getBalance(address: string, chainId: number) {
|
||||
const coinInstance = await this.getInstance(address, chainId)
|
||||
const banlace = await coinInstance.methods.balanceOf(AppModule.accountId).call()
|
||||
console.log('balance: ', banlace)
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,14 @@ import { singleton } from '@/decorators/singleton.decorator'
|
||||
import WalletConnectProvider from '@walletconnect/web3-provider'
|
||||
import { AppModule } from '@/store/modules/app'
|
||||
import Web3 from 'web3'
|
||||
import { ERC20ABI, MALL_ADDRESS } from '@/configs/config_chain'
|
||||
import { AVAILABLE_CHAINS, IChainData, MALL_ADDRESS } from '@/configs/config_chain'
|
||||
import { EventBus, NEED_CHANGE_CHAIN, NEED_LOGIN, NEED_NONCE, SHOW_CHAIN_MODAL } from '@/utils/event-bus'
|
||||
import { UserModule } from '@/store/modules/user'
|
||||
import { chains, IChainData } from '@/configs/chains'
|
||||
import { isMobile } from '@/utils/resize'
|
||||
import { hasMetamask } from '@/utils/chain.util'
|
||||
import { AllChains } from '@/configs/allchain'
|
||||
import { MessageBox } from 'element-ui'
|
||||
import { ERC20ABI } from '@/configs/contracts'
|
||||
|
||||
const EIP721_DOMAIN_DATA = [
|
||||
{ name: 'name', type: 'string' },
|
||||
@ -33,12 +33,14 @@ export class Blockchain {
|
||||
public rpc: any = {}
|
||||
|
||||
constructor() {
|
||||
const chainDatas = chains()
|
||||
for (const data of chainDatas) {
|
||||
this.chainMap.set(data.id, data)
|
||||
}
|
||||
const allChainMap: Map<number, IChainData> = new Map()
|
||||
for (const d of AllChains) {
|
||||
this.rpc[parseInt(d.id)] = d.rpc
|
||||
const id = d.id
|
||||
this.rpc[id] = d.rpc
|
||||
allChainMap.set(id, d)
|
||||
}
|
||||
for (const id of AVAILABLE_CHAINS) {
|
||||
this.chainMap.set(id, allChainMap.get(id)!)
|
||||
}
|
||||
this.loadCachedProvider()
|
||||
this.coinInstanceMap = new Map()
|
||||
@ -48,7 +50,7 @@ export class Blockchain {
|
||||
|
||||
loadJson(url: string) {
|
||||
return fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(response => response.json())
|
||||
}
|
||||
|
||||
get isWalletConnect() {
|
||||
@ -91,7 +93,7 @@ export class Blockchain {
|
||||
AppModule.updateAccount(accounts[0])
|
||||
}
|
||||
if (!this.currentChain) this.currentChain = chainId
|
||||
this.saveProvider()
|
||||
this.saveProvider()
|
||||
AppModule.updateChainID(chainId)
|
||||
AppModule.updateWalletStatus(true)
|
||||
console.log('current login chain: ', chainId)
|
||||
@ -202,7 +204,7 @@ export class Blockchain {
|
||||
return provider
|
||||
}
|
||||
|
||||
private async initInstance(abi: any, address: string, account: string) {
|
||||
private async initInstance({ abi, address, account }: {abi: any, address: string, account: string}) {
|
||||
return new this.web3.eth.Contract(
|
||||
abi,
|
||||
address,
|
||||
@ -214,7 +216,7 @@ export class Blockchain {
|
||||
if (this.coinInstanceMap.has(address)) {
|
||||
return this.coinInstanceMap.get(address)
|
||||
} else {
|
||||
const coinInstance = await this.initInstance(ERC20ABI, address, AppModule.accountId)
|
||||
const coinInstance = await this.initInstance({ abi: ERC20ABI, address, account: AppModule.accountId })
|
||||
this.coinInstanceMap.set(address, coinInstance)
|
||||
return coinInstance
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import { EventBus, NEED_CHANGE_CHAIN, SHOW_CHAIN_MODAL } from '@/utils/event-bus'
|
||||
import { chains } from '@/configs/chains'
|
||||
import ChainManager from '@/chain/ChainManager'
|
||||
|
||||
@Component({
|
||||
name: 'ChainModal',
|
||||
@ -52,7 +52,7 @@ export default class ChainModal extends Vue {
|
||||
]
|
||||
|
||||
get chainDatas() {
|
||||
return chains()
|
||||
return new ChainManager().availableChains.values()
|
||||
}
|
||||
|
||||
get currentDatas() {
|
||||
|
@ -13,12 +13,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-bar-net">
|
||||
<div class="tab-item"
|
||||
v-for="n in nets"
|
||||
@click='changeNet(n)'
|
||||
:class="{'active': currentNet===n}"
|
||||
<div class="tab-item"
|
||||
v-for="n in nets"
|
||||
@click='changeNet(n.id)'
|
||||
:key="n.id"
|
||||
:class="{'active': currentNet===n.id}"
|
||||
>
|
||||
<span>{{n}}</span>
|
||||
<span>{{n.name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wallet">
|
||||
@ -42,6 +43,7 @@ import GameCoinCard from '@/components/market/wallet/GameCoinCard.vue'
|
||||
import { AppModule } from '@/store/modules/app'
|
||||
import VueClipboard from 'vue-clipboard2'
|
||||
import PlaceholderPanel from '@/components/market/wallet/PlaceholderPanel.vue'
|
||||
import ChainManager from '@/chain/ChainManager'
|
||||
|
||||
@Component({
|
||||
name: 'WalletPanel',
|
||||
@ -53,8 +55,12 @@ import PlaceholderPanel from '@/components/market/wallet/PlaceholderPanel.vue'
|
||||
}
|
||||
})
|
||||
export default class WalletPanel extends Vue {
|
||||
private currentNet = 'kcc'
|
||||
private nets = ['kcc', 'bsc']
|
||||
private currentNet = this.nets[0].id
|
||||
|
||||
get nets() {
|
||||
return [...new ChainManager().availableChains.values()]
|
||||
}
|
||||
|
||||
private coinList: ICoinData[] = [
|
||||
{
|
||||
name: 'CEBG Coin',
|
||||
@ -117,8 +123,8 @@ export default class WalletPanel extends Vue {
|
||||
})
|
||||
}
|
||||
|
||||
changeNet(net: string) {
|
||||
this.currentNet = net;
|
||||
changeNet(net: number) {
|
||||
this.currentNet = net
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -3,7 +3,7 @@ export const AllChains = [
|
||||
name: 'Ethereum Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.ankr.com/eth',
|
||||
id: '1',
|
||||
id: 1,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://etherscan.io'
|
||||
},
|
||||
@ -11,7 +11,7 @@ export const AllChains = [
|
||||
name: 'Ethereum Ropsten Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161',
|
||||
id: '3',
|
||||
id: 3,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://ropsten.etherscan.io'
|
||||
},
|
||||
@ -19,7 +19,7 @@ export const AllChains = [
|
||||
name: 'Ethereum Rinkeby Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://rinkey.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161',
|
||||
id: '4',
|
||||
id: 4,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://rinkey.etherscan.io'
|
||||
},
|
||||
@ -27,7 +27,7 @@ export const AllChains = [
|
||||
name: 'Ethereum Goerli Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161',
|
||||
id: '5',
|
||||
id: 5,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://goerli.etherscan.io'
|
||||
},
|
||||
@ -35,7 +35,7 @@ export const AllChains = [
|
||||
name: 'Ethereum Kovan Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161',
|
||||
id: '6',
|
||||
id: 6,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://kovan.etherscan.io'
|
||||
},
|
||||
@ -43,7 +43,7 @@ export const AllChains = [
|
||||
name: 'Ubiq Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.octano.dev/',
|
||||
id: '8',
|
||||
id: 8,
|
||||
symbol: 'UBQ',
|
||||
explorerurl: 'https://ubiqscan.io/'
|
||||
},
|
||||
@ -51,7 +51,7 @@ export const AllChains = [
|
||||
name: 'Elastos ETH Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://api.elastos.io/eth',
|
||||
id: '20',
|
||||
id: 20,
|
||||
symbol: 'ELA',
|
||||
explorerurl: 'https://explorer.elaeth.io/'
|
||||
},
|
||||
@ -59,7 +59,7 @@ export const AllChains = [
|
||||
name: 'Cronos Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://evm-cronos.crypto.org',
|
||||
id: '25',
|
||||
id: 25,
|
||||
symbol: 'CRO',
|
||||
explorerurl: 'https://cronos.crypto.org/explorer/'
|
||||
},
|
||||
@ -67,7 +67,7 @@ export const AllChains = [
|
||||
name: 'Telos EVM Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://mainnet.telos.net/evm',
|
||||
id: '40',
|
||||
id: 40,
|
||||
symbol: 'TLOS',
|
||||
explorerurl: 'https://telos.net/'
|
||||
},
|
||||
@ -75,7 +75,8 @@ export const AllChains = [
|
||||
name: 'Binance Smart Chain Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.ankr.com/bsc',
|
||||
id: '56',
|
||||
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJod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41LTEuNSwxLjVzLTEuNS0wLjctMS41LTEuNQoJCUMxNy4yLDE1LjIsMTcuOSwxNC41LDE4LjcsMTQuNXoiLz4KPC9nPgo8L3N2Zz4K',
|
||||
id: 56,
|
||||
symbol: 'BNB',
|
||||
explorerurl: 'https://bscscan.com'
|
||||
},
|
||||
@ -83,7 +84,7 @@ export const AllChains = [
|
||||
name: 'OKExChain Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://exchainrpc.okex.org',
|
||||
id: '66',
|
||||
id: 66,
|
||||
symbol: 'OKT',
|
||||
explorerurl: 'https://www.oklink.com/okexchain'
|
||||
},
|
||||
@ -91,7 +92,7 @@ export const AllChains = [
|
||||
name: 'Hoo Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://http-mainnet.hoosmartchain.com',
|
||||
id: '70',
|
||||
id: 70,
|
||||
symbol: 'HOO',
|
||||
explorerurl: 'https://hooscan.com'
|
||||
},
|
||||
@ -99,7 +100,8 @@ export const AllChains = [
|
||||
name: 'Binance Smart Chain Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
|
||||
id: '97',
|
||||
id: 97,
|
||||
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgc3R5bGU9ImVu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
|
||||
@ -107,7 +109,7 @@ export const AllChains = [
|
||||
name: 'xDai Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.xdaichain.com/',
|
||||
id: '100',
|
||||
id: 100,
|
||||
symbol: 'XDAI',
|
||||
explorerurl: 'https://blockscout.com/xdai/mainnet/'
|
||||
},
|
||||
@ -115,7 +117,7 @@ export const AllChains = [
|
||||
name: 'Fuse Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.fuse.io',
|
||||
id: '122',
|
||||
id: 122,
|
||||
symbol: 'FUSE',
|
||||
explorerurl: 'https://explorer.fuse.io/'
|
||||
},
|
||||
@ -123,7 +125,7 @@ export const AllChains = [
|
||||
name: 'HECO Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://http-mainnet-node.huobichain.com/',
|
||||
id: '128',
|
||||
id: 128,
|
||||
symbol: 'HT',
|
||||
explorerurl: 'https://hecoinfo.com/'
|
||||
},
|
||||
@ -131,7 +133,7 @@ export const AllChains = [
|
||||
name: 'Matic Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://polygon-rpc.com',
|
||||
id: '137',
|
||||
id: 137,
|
||||
symbol: 'MATIC',
|
||||
explorerurl: 'https://explorer.matic.network/'
|
||||
},
|
||||
@ -139,7 +141,7 @@ export const AllChains = [
|
||||
name: 'Fantom Opera Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.ftm.tools/',
|
||||
id: '250',
|
||||
id: 250,
|
||||
symbol: 'FTM',
|
||||
explorerurl: 'https://ftmscan.com'
|
||||
},
|
||||
@ -147,7 +149,7 @@ export const AllChains = [
|
||||
name: 'HECO Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://http-testnet.hecochain.com',
|
||||
id: '256',
|
||||
id: 256,
|
||||
symbol: 'HT',
|
||||
explorerurl: 'https://testnet.hecoinfo.com/'
|
||||
},
|
||||
@ -155,15 +157,17 @@ export const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bC02LjItNi40VjIyYzAsMC44LTAuNywxLjUtMS41LDEuNWMtMC44LDAtMS41LTAuNy0xLjUtMS41VjEwYzAtMC44LDAuNy0xLjUsMS41LTEuNQoJCWMwLjgsMCwxLjUsMC43LDEuNSwxLjV2My44bDYuMi02LjRjMC42LTAuNiwxLjUtMC42LDIuMSwwYzAsMCwwLDAsMCwwbDQuMyw0LjRjMC42LDAuNiwwLjYsMS42LDAsMi4yYy0wLjYsMC42LTEuNSwwLjYtMiwwCgkJYzAsMCwwLDAsMCwwbC0zLjMtMy40TDEzLjUsMTZ6IE0xOC43LDE0LjVjMC44LDAsMS41LDAuNywxLjUsMS41cy0wLjcsMS41LTEuNSwxLjVzLTEuNS0wLjctMS41LTEuNQoJCUMxNy4yLDE1LjIsMTcuOSwxNC41LDE4LjcsMTQuNXoiLz4KPC9nPgo8L3N2Zz4K',
|
||||
symbol: 'KCS',
|
||||
explorerurl: 'https://scan.kcc.network'
|
||||
},
|
||||
{
|
||||
name: 'KCC Testnet RPC',
|
||||
type: 'Testnet',
|
||||
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzIgMzI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojMDA5M0REO30KCS5zdDF7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojRkZGRkZGO30KPC9zdHlsZT4KPGc+Cgk8Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIvPgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTEzLjUsMTZsNS4yLDUuM0wyMiwxOGMwLjYtMC42LDEuNS0wLjYsMiwwYzAsMCwwLDAsMCwwYzAuNiwwLjYsMC42LDEuNiwwLDIuMmwtNC4zLDQuNAoJCWMtMC42LDAuNi0xLjUsMC42LTIuMSwwYzAsMCwwLDAsMCwwbC02LjItNi40VjIyYzAsMC44LTAuNywxLjUtMS41LDEuNWMtMC44LDAtMS41LTAuNy0xLjUtMS41VjEwYzAtMC44LDAuNy0xLjUsMS41LTEuNQoJCWMwLjgsMCwxLjUsMC43LDEuNSwxLjV2My44bDYuMi02LjRjMC42LTAuNiwxLjUtMC42LDIuMSwwYzAsMCwwLDAsMCwwbDQuMyw0LjRjMC42LDAuNiwwLjYsMS42LDAsMi4yYy0wLjYsMC42LTEuNSwwLjYtMiwwCgkJYzAsMCwwLDAsMCwwbC0zLjMtMy40TDEzLjUsMTZ6IE0xOC43LDE0LjVjMC44LDAsMS41LDAuNywxLjUsMS41cy0wLjcsMS41LTEuNSwxLjVzLTEuNS0wLjctMS41LTEuNQoJCUMxNy4yLDE1LjIsMTcuOSwxNC41LDE4LjcsMTQuNXoiLz4KPC9nPgo8L3N2Zz4K',
|
||||
rpc: 'https://rpc-testnet.kcc.network',
|
||||
id: '322',
|
||||
id: 322,
|
||||
symbol: 'tKCS',
|
||||
explorerurl: 'https://scan-testnet.kcc.network'
|
||||
},
|
||||
@ -171,7 +175,7 @@ export const AllChains = [
|
||||
name: 'Moonriver Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.moonriver.moonbeam.network',
|
||||
id: '1285',
|
||||
id: 1285,
|
||||
symbol: 'MOVR',
|
||||
explorerurl: 'https://blockscout.moonriver.moonbeam.network/'
|
||||
},
|
||||
@ -179,7 +183,7 @@ export const AllChains = [
|
||||
name: 'Fantom Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://rpc.testnet.fantom.network/',
|
||||
id: '4002',
|
||||
id: 4002,
|
||||
symbol: 'FTM',
|
||||
explorerurl: 'https://testnet.ftmscan.com'
|
||||
},
|
||||
@ -187,7 +191,7 @@ export const AllChains = [
|
||||
name: 'IoTeX Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://babel-api.mainnet.iotex.io',
|
||||
id: '4689',
|
||||
id: 4689,
|
||||
symbol: 'IOTEX',
|
||||
explorerurl: 'https://iotexscan.io/'
|
||||
},
|
||||
@ -195,7 +199,7 @@ export const AllChains = [
|
||||
name: 'Nahmii Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://l2.nahmii.io/',
|
||||
id: '5551',
|
||||
id: 5551,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://explorer.nahmii.io/'
|
||||
},
|
||||
@ -203,7 +207,7 @@ export const AllChains = [
|
||||
name: 'Nahmii Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://l2.testnet.nahmii.io/',
|
||||
id: '5553',
|
||||
id: 5553,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://explorer.testnet.nahmii.io/'
|
||||
},
|
||||
@ -211,7 +215,7 @@ export const AllChains = [
|
||||
name: 'Arbitrum Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.ankr.com/arbitrum',
|
||||
id: '42161',
|
||||
id: 42161,
|
||||
symbol: 'ETH',
|
||||
explorerurl: 'https://arbiscan.io/'
|
||||
},
|
||||
@ -219,7 +223,7 @@ export const AllChains = [
|
||||
name: 'Celo Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.ankr.com/celo',
|
||||
id: '42220',
|
||||
id: 42220,
|
||||
symbol: 'CELO',
|
||||
explorerurl: 'https://celoscan.com'
|
||||
},
|
||||
@ -227,7 +231,7 @@ export const AllChains = [
|
||||
name: 'Avalanche C Chain Local RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://localhost:9650/ext/bc/C/rpc',
|
||||
id: '43112',
|
||||
id: 43112,
|
||||
symbol: 'AVAX',
|
||||
explorerurl: 'https://snowtrace.io'
|
||||
},
|
||||
@ -235,7 +239,7 @@ export const AllChains = [
|
||||
name: 'Avalanche FUJI Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://api.avax-test.network/ext/bc/C/rpc',
|
||||
id: '43113',
|
||||
id: 43113,
|
||||
symbol: 'AVAX',
|
||||
explorerurl: 'https://testnet.explorer.avax.network/'
|
||||
},
|
||||
@ -243,7 +247,7 @@ export const AllChains = [
|
||||
name: 'Avalanche C Chain Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.ankr.com/avalanche',
|
||||
id: '43114',
|
||||
id: 43114,
|
||||
symbol: 'AVAX',
|
||||
explorerurl: 'https://snowtrace.io'
|
||||
},
|
||||
@ -251,7 +255,7 @@ export const AllChains = [
|
||||
name: 'Matic Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://rpc-mumbai.maticvigil.com',
|
||||
id: '80001',
|
||||
id: 80001,
|
||||
symbol: 'MATIC',
|
||||
explorerurl: 'https://mumbai.polygonscan.com/'
|
||||
},
|
||||
@ -259,7 +263,7 @@ export const AllChains = [
|
||||
name: 'Harmony Mainnet RPC',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://api.harmony.one/',
|
||||
id: '1666600000',
|
||||
id: 1666600000,
|
||||
symbol: 'ONE',
|
||||
explorerurl: 'https://explorer.harmony.one'
|
||||
},
|
||||
@ -267,7 +271,7 @@ export const AllChains = [
|
||||
name: 'Harmony Testnet RPC',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://api.s0.b.hmny.io/',
|
||||
id: '1666700000',
|
||||
id: 1666700000,
|
||||
symbol: 'ONE',
|
||||
explorerurl: 'https://explorer.harmony.one'
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
const env = process.env.NODE_ENV || 'development'
|
||||
export interface IChainData{
|
||||
id: number
|
||||
name: string
|
||||
logo: string
|
||||
rpc: string
|
||||
explorerurl: string
|
||||
symbol: string
|
||||
decimals: number
|
||||
type: string
|
||||
}
|
||||
export const chainMap: Map<string, IChainData[]> = new Map([
|
||||
['development', [
|
||||
{
|
||||
type: 'development',
|
||||
id: 322,
|
||||
name: 'KCC-TESTNET',
|
||||
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzIgMzI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojMDA5M0REO30KCS5zdDF7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojRkZGRkZGO30KPC9zdHlsZT4KPGc+Cgk8Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIvPgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTEzLjUsMTZsNS4yLDUuM0wyMiwxOGMwLjYtMC42LDEuNS0wLjYsMiwwYzAsMCwwLDAsMCwwYzAuNiwwLjYsMC42LDEuNiwwLDIuMmwtNC4zLDQuNAoJCWMtMC42LDAuNi0xLjUsMC42LTIuMSwwYzAsMCwwLDAsMCwwbC02LjItNi40VjIyYzAsMC44LTAuNywxLjUtMS41LDEuNWMtMC44LDAtMS41LTAuNy0xLjUtMS41VjEwYzAtMC44LDAuNy0xLjUsMS41LTEuNQoJCWMwLjgsMCwxLjUsMC43LDEuNSwxLjV2My44bDYuMi02LjRjMC42LTAuNiwxLjUtMC42LDIuMSwwYzAsMCwwLDAsMCwwbDQuMyw0LjRjMC42LDAuNiwwLjYsMS42LDAsMi4yYy0wLjYsMC42LTEuNSwwLjYtMiwwCgkJYzAsMCwwLDAsMCwwbC0zLjMtMy40TDEzLjUsMTZ6IE0xOC43LDE0LjVjMC44LDAsMS41LDAuNywxLjUsMS41cy0wLjcsMS41LTEuNSwxLjVzLTEuNS0wLjctMS41LTEuNQoJCUMxNy4yLDE1LjIsMTcuOSwxNC41LDE4LjcsMTQuNXoiLz4KPC9nPgo8L3N2Zz4K',
|
||||
rpc: 'https://rpc-testnet.kcc.network',
|
||||
explorerurl: 'https://scan-testnet.kcc.network',
|
||||
symbol: 'KCS',
|
||||
decimals: 18
|
||||
},
|
||||
{
|
||||
type: 'development',
|
||||
id: 97,
|
||||
name: 'BSC Testnet',
|
||||
logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAwIiBoZWlnaHQ9IjI1MDAiIHZpZXdCb3g9IjAgMCAyMDAwIDIwMDAiPjxnIGZpbGw9IiNmM2JhMmYiPjxwYXRoIGQ9Ik02MTEuNTkgODQwLjQybDM4OC40LTM4OC4zOSAzODguNiAzODguNTkgMjI2LTIyNkw5OTkuOTkgMCAzODUuNiA2MTQuNDJsMjI1Ljk5IDIyNk0uMDA2IDk5OS45NjlsMjI2LjAwNy0yMjYuMDA3IDIyNS45OTIgMjI1Ljk5M0wyMjYgMTIyNS45NnpNNjExLjU5IDExNTkuNThsMzg4LjQgMzg4LjM5IDM4OC41OS0zODguNTggMjI2LjEyIDIyNS44OC0uMTEuMTJMOTk5Ljk5IDIwMDBsLTYxNC40MS02MTQuNC0uMzItLjMyIDIyNi4zMy0yMjUuN00xNTQ4LjAxMyAxMDAwLjA5M2wyMjYuMDA3LTIyNi4wMDYgMjI1Ljk5MiAyMjUuOTkyLTIyNi4wMDYgMjI2LjAwN3oiLz48cGF0aCBkPSJNMTIyOS4yMiA5OTkuODhoLjFMOTk5Ljk5IDc3MC41NSA4MzAuNTEgOTQwLjAzaC0uMDFsLTE5LjQ3IDE5LjQ4LTQwLjE2IDQwLjE3LS4zMi4zMS4zMi4zMyAyMjkuMTIgMjI5LjEzIDIyOS4zMy0yMjkuMzMuMTEtLjEzLS4yMS0uMTEiLz48L2c+PC9zdmc+',
|
||||
rpc: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
|
||||
explorerurl: 'https://testnet.bscscan.com/',
|
||||
symbol: 'BNB',
|
||||
decimals: 18
|
||||
}
|
||||
]],
|
||||
['production', [
|
||||
{
|
||||
type: 'production',
|
||||
id: 321,
|
||||
name: 'KCC-MAINNET',
|
||||
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgM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TDEzLjUsMTZ6IE0xOC43LDE0LjVjMC44LDAsMS41LDAuNywxLjUsMS41cy0wLjcsMS41LTEuNSwxLjVzLTEuNS0wLjctMS41LTEuNQoJCUMxNy4yLDE1LjIsMTcuOSwxNC41LDE4LjcsMTQuNXoiLz4KPC9nPgo8L3N2Zz4K',
|
||||
rpc: 'https://rpc-mainnet.kcc.network',
|
||||
explorerurl: 'https://explorer.kcc.io',
|
||||
symbol: 'KCS',
|
||||
decimals: 18
|
||||
},
|
||||
{
|
||||
type: 'production',
|
||||
id: 32,
|
||||
name: 'BSC',
|
||||
logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAwIiBoZWlnaHQ9IjI1MDAiIHZpZXdCb3g9IjAgMCAyMDAwIDIwMDAiPjxnIGZpbGw9IiNmM2JhMmYiPjxwYXRoIGQ9Ik02MTEuNTkgODQwLjQybDM4OC40LTM4OC4zOSAzODguNiAzODguNTkgMjI2LTIyNkw5OTkuOTkgMCAzODUuNiA2MTQuNDJsMjI1Ljk5IDIyNk0uMDA2IDk5OS45NjlsMjI2LjAwNy0yMjYuMDA3IDIyNS45OTIgMjI1Ljk5M0wyMjYgMTIyNS45NnpNNjExLjU5IDExNTkuNThsMzg4LjQgMzg4LjM5IDM4OC41OS0zODguNTggMjI2LjEyIDIyNS44OC0uMTEuMTJMOTk5Ljk5IDIwMDBsLTYxNC40MS02MTQuNC0uMzItLjMyIDIyNi4zMy0yMjUuN00xNTQ4LjAxMyAxMDAwLjA5M2wyMjYuMDA3LTIyNi4wMDYgMjI1Ljk5MiAyMjUuOTkyLTIyNi4wMDYgMjI2LjAwN3oiLz48cGF0aCBkPSJNMTIyOS4yMiA5OTkuODhoLjFMOTk5Ljk5IDc3MC41NSA4MzAuNTEgOTQwLjAzaC0uMDFsLTE5LjQ3IDE5LjQ4LTQwLjE2IDQwLjE3LS4zMi4zMS4zMi4zMyAyMjkuMTIgMjI5LjEzIDIyOS4zMy0yMjkuMzMuMTEtLjEzLS4yMS0uMTEiLz48L2c+PC9zdmc+',
|
||||
rpc: 'https://bsc-dataseed.binance.org',
|
||||
explorerurl: 'https://www.bscscan.com',
|
||||
symbol: 'BNB',
|
||||
decimals: 18
|
||||
}
|
||||
]]
|
||||
])
|
||||
|
||||
export const chains: () => IChainData[] = () => chainMap.get(env) || []
|
@ -1,290 +1,15 @@
|
||||
export const ERC20ABI = [
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'name_',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'symbol_',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'constructor'
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'owner',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: 'uint256',
|
||||
name: 'value',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'Approval',
|
||||
type: 'event'
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'from',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'to',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: 'uint256',
|
||||
name: 'value',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'Transfer',
|
||||
type: 'event'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'name',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'string',
|
||||
name: '',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'symbol',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'string',
|
||||
name: '',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'decimals',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint8',
|
||||
name: '',
|
||||
type: 'uint8'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'totalSupply',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: '',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'account',
|
||||
type: 'address'
|
||||
}
|
||||
],
|
||||
name: 'balanceOf',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: '',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'recipient',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'amount',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'transfer',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'owner',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
}
|
||||
],
|
||||
name: 'allowance',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: '',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'amount',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'approve',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'sender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'recipient',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'amount',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'transferFrom',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'addedValue',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'increaseAllowance',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'subtractedValue',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'decreaseAllowance',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
}
|
||||
]
|
||||
export interface IChainData{
|
||||
id: number
|
||||
name: string
|
||||
logo?: string
|
||||
rpc: string
|
||||
explorerurl?: string
|
||||
symbol: string
|
||||
decimals?: number
|
||||
type: string
|
||||
}
|
||||
const env = process.env.NODE_ENV || 'development'
|
||||
|
||||
export const AVAILABLE_CHAINS = env === 'development' ? [322, 97] : [321, 32]
|
||||
|
||||
export const MALL_ADDRESS = '0xF278ff771F9E24968083B0bA54Cb42eb4B23C2d7'
|
||||
|
288
src/configs/contracts.ts
Normal file
288
src/configs/contracts.ts
Normal file
@ -0,0 +1,288 @@
|
||||
export const ERC20ABI = [
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'name_',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'symbol_',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'constructor'
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'owner',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: 'uint256',
|
||||
name: 'value',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'Approval',
|
||||
type: 'event'
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'from',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'to',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: 'uint256',
|
||||
name: 'value',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'Transfer',
|
||||
type: 'event'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'name',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'string',
|
||||
name: '',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'symbol',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'string',
|
||||
name: '',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'decimals',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint8',
|
||||
name: '',
|
||||
type: 'uint8'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'totalSupply',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: '',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'account',
|
||||
type: 'address'
|
||||
}
|
||||
],
|
||||
name: 'balanceOf',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: '',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'recipient',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'amount',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'transfer',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'owner',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
}
|
||||
],
|
||||
name: 'allowance',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: '',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'amount',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'approve',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'sender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'recipient',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'amount',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'transferFrom',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'addedValue',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'increaseAllowance',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'spender',
|
||||
type: 'address'
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'subtractedValue',
|
||||
type: 'uint256'
|
||||
}
|
||||
],
|
||||
name: 'decreaseAllowance',
|
||||
outputs: [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool'
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user