Skip to content

Commit

Permalink
✨ add bridge ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Web3HackerWorld committed Dec 11, 2023
1 parent 2b5b31d commit 172b9d3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

<h2 align="center">
<a href="https://github.com/antfu/vitesse">Vitesse</a> for Nuxt 3
Super NFT Bridge
</h2><br>

<p align="center">
Expand Down
37 changes: 34 additions & 3 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { polygonMumbai } from 'viem/chains'
import { createPublicClient, createWalletClient, custom, decodeAbiParameters, formatEther, http, keccak256, parseAbiItem, publicActions, toHex } from 'viem'

Check failure on line 3 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

'createPublicClient' is defined but never used

Check failure on line 3 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

'decodeAbiParameters' is defined but never used

Check failure on line 3 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

'formatEther' is defined but never used

Check failure on line 3 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

'http' is defined but never used

Check failure on line 3 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

'keccak256' is defined but never used

Check failure on line 3 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

'parseAbiItem' is defined but never used

Check failure on line 3 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

'toHex' is defined but never used
import MockNFT from '@/contracts/abis/MockNFT.json'
import NFTBridge from '@/contracts/abis/NFTBridge.json'
const contractAddress = $ref('0x70C8552868a7a10c62470456E1f1a48189307b74')
const tokenId = $ref('3042')
Expand Down Expand Up @@ -63,15 +64,45 @@ async function getNFTData() {
isLoading = false
}
async function doBridge () {
console.log(`====> doBridge`)
const contractNFTBridgeAddress = '0xEC452eC33325BB55Ab60a2DE65eA87006146E8ba'
async function doBridge() {
if (isLoading)
return
isLoading = true
let params = {
address: contractAddress,
abi: MockNFT,
functionName: 'approve',
args: [
contractNFTBridgeAddress,
tokenId,
],
}
let hash = await client.writeContract(params)
await client.waitForTransactionReceipt({ hash })
params = {
address: contractNFTBridgeAddress,
abi: NFTBridge,
functionName: 'bridgeNFT',
args: [
14767482510784806043, // fuji chain selector

Check failure on line 90 in pages/index.vue

View workflow job for this annotation

GitHub Actions / lint

This number literal will lose precision at runtime
'0x99c736B08e12C59afE4F355cbAC0A93814B4F1cA', // receiver on fuji
contractAddress,
tokenId,
],
}
hash = await client.writeContract(params)
await client.waitForTransactionReceipt({ hash })
isLoading = false
}
</script>

<template>
<div mx-auto max-w-2xl>
<h2 mb-10 text-3xl>
NFT Bridge
Super NFT Bridge
</h2>
<div space-y-5>
<UFormGroup label="contractAddress" name="contractAddress">
Expand Down

0 comments on commit 172b9d3

Please sign in to comment.