feat:

This commit is contained in:
john 2024-07-18 18:49:30 +08:00
parent 4a230d7791
commit 29a6ea86c1
4 changed files with 39 additions and 22 deletions

View File

@ -1,5 +1,11 @@
###
# @LastEditors: John
# @Date: 2024-07-02 11:31:07
# @LastEditTime: 2024-07-18 17:35:13
# @Author: John
###
VITE_BASE_URL=/ VITE_BASE_URL=/
VITE_BASE_API_URL=/dev VITE_BASE_API_URL=/api
VITE_PARTICIPATE_CHAIN_ID=56 VITE_PARTICIPATE_CHAIN_ID=56
VITE_PURCHASED_CONTRACT_ADDRESS= VITE_PURCHASED_CONTRACT_ADDRESS=
VITE_NETWORK_USDT_ADDRESS= VITE_NETWORK_USDT_ADDRESS=

View File

@ -1,13 +1,13 @@
### ###
# @LastEditors: John # @LastEditors: John
# @Date: 2024-06-24 18:38:45 # @Date: 2024-06-24 18:38:45
# @LastEditTime: 2024-07-10 15:24:55 # @LastEditTime: 2024-07-18 18:43:53
# @Author: John # @Author: John
### ###
VITE_BASE_URL=http://wwwtest.exgo.pro VITE_BASE_URL=http://wwwtest.exgo.pro
VITE_BASE_API_URL=http://wwwtest.exgo.pro VITE_BASE_API_URL=http://wwwtest.exgo.pro
VITE_PARTICIPATE_CHAIN_ID=97 VITE_PARTICIPATE_CHAIN_ID=97
VITE_PURCHASED_CONTRACT_ADDRESS=0xcA03e32ab7731cD721239A7AD24f3d185e4d63CD VITE_PURCHASED_CONTRACT_ADDRESS=0xdccBd0FbFd51dA16AEDc8b1985f3eFDA3F380944
VITE_RECEIVE_RAMB_CONTRACT_ADDRESS=0x944fBF12c9b77BFfFA223CE1568F28820d319c2F VITE_RECEIVE_RAMB_CONTRACT_ADDRESS=0x944fBF12c9b77BFfFA223CE1568F28820d319c2F
VITE_NETWORK_USDT_ADDRESS=0x6d528B0a62f8cDdf4B3F6961D70F4f4a18a92A0D VITE_NETWORK_USDT_ADDRESS=0x6d528B0a62f8cDdf4B3F6961D70F4f4a18a92A0D
VITE_CHECK_TRANSACTION_DETAILS_URL=https://testnet.bscscan.com/ VITE_CHECK_TRANSACTION_DETAILS_URL=https://testnet.bscscan.com/

View File

@ -15,6 +15,11 @@
"internalType": "uint256", "internalType": "uint256",
"name": "paymentType", "name": "paymentType",
"type": "uint256" "type": "uint256"
},
{
"internalType": "string",
"name": "NFTURI",
"type": "string"
} }
], ],
"name": "buyHMNFT", "name": "buyHMNFT",
@ -32,7 +37,7 @@
"inputs": [ "inputs": [
{ {
"internalType": "address", "internalType": "address",
"name": "hongMoAddr", "name": "EquityNFTAddr",
"type": "address" "type": "address"
}, },
{ {
@ -168,6 +173,11 @@
"internalType": "address", "internalType": "address",
"name": "addr", "name": "addr",
"type": "address" "type": "address"
},
{
"internalType": "string",
"name": "NFTURI",
"type": "string"
} }
], ],
"name": "rewardNFT", "name": "rewardNFT",
@ -321,6 +331,19 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "EquityNFT",
"outputs": [
{
"internalType": "contract RedDevilEquityNFT",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
@ -340,19 +363,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "hongMoNFT",
"outputs": [
{
"internalType": "contract HongMoNFT",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "owner", "name": "owner",

View File

@ -1,7 +1,7 @@
/* /*
* @LastEditors: John * @LastEditors: John
* @Date: 2024-06-19 15:48:57 * @Date: 2024-06-19 15:48:57
* @LastEditTime: 2024-07-03 10:44:58 * @LastEditTime: 2024-07-18 18:33:04
* @Author: John * @Author: John
*/ */
import { config } from "@/components/WalletProvider"; import { config } from "@/components/WalletProvider";
@ -167,14 +167,15 @@ export async function payByContract(
if (approvedU < amount) { if (approvedU < amount) {
await authorizedU(amount); await authorizedU(amount);
} }
const NFTURI =
console.log("参数:", amount, orderID, payInduction); "https://gateway.pinata.cloud/ipfs/QmWxBbFG3WJXVTDqrFUPhMuLmeHqKNBBkzSuvQyyk7ftfi/CodeConqueror-Bnb.json";
console.log("参数:", amount, orderID, payInduction, NFTURI);
estimateGas(config, { estimateGas(config, {
to: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS, to: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS,
data: encodeFunctionData({ data: encodeFunctionData({
abi: RedDevilsAbi, abi: RedDevilsAbi,
functionName: "buyHMNFT", functionName: "buyHMNFT",
args: [amount, orderID, payInduction], args: [amount, orderID, payInduction, NFTURI],
}), }),
}) })
.then((gas) => { .then((gas) => {
@ -184,7 +185,7 @@ export async function payByContract(
abi: RedDevilsAbi, abi: RedDevilsAbi,
address: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS, address: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS,
functionName: "buyHMNFT", functionName: "buyHMNFT",
args: [amount, orderID, payInduction], args: [amount, orderID, payInduction, NFTURI],
gas: gasPrice, gas: gasPrice,
}) })
.then((receipt) => { .then((receipt) => {