250 lines
6.4 KiB
TypeScript
250 lines
6.4 KiB
TypeScript
// API Constants
|
|
export const API_BASE_URL = "http://localhost:3000"; // Update with actual API URL in production
|
|
|
|
// Smart Contract Constants
|
|
export const PERSPECTIVE_CONTRACT_ADDRESS = "0x..." // Replace with actual contract address
|
|
export const PERSPECTIVE_CONTRACT_ABI = [
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "string",
|
|
"name": "issueId",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"internalType": "string",
|
|
"name": "text",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"internalType": "string",
|
|
"name": "metadata",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"name": "submitPerspective",
|
|
"outputs": [],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "insightId",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"internalType": "string",
|
|
"name": "reason",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"internalType": "string",
|
|
"name": "details",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"name": "flagInsight",
|
|
"outputs": [],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "insightId",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"internalType": "bool",
|
|
"name": "approved",
|
|
"type": "bool"
|
|
}
|
|
],
|
|
"name": "moderateInsight",
|
|
"outputs": [],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
}
|
|
] as const
|
|
|
|
// User Trust Contract
|
|
export const USER_TRUST_CONTRACT_ADDRESS = "0x..." // Replace with actual contract address
|
|
export const USER_TRUST_CONTRACT_ABI = [
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "address",
|
|
"name": "user",
|
|
"type": "address"
|
|
}
|
|
],
|
|
"name": "getUserTrustData",
|
|
"outputs": [
|
|
{
|
|
"internalType": "bool",
|
|
"name": "isVerified",
|
|
"type": "bool"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "trustScore",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "dailyLimit",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"stateMutability": "view",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "address",
|
|
"name": "user",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "amount",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "incrementTrustScore",
|
|
"outputs": [],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": true,
|
|
"internalType": "address",
|
|
"name": "user",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "newTrustScore",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "newDailyLimit",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "TrustScoreUpdated",
|
|
"type": "event"
|
|
}
|
|
] as const
|
|
|
|
// Fee contract for unverified users
|
|
export const FEE_CONTRACT_ADDRESS = "0x123456789abcdef123456789abcdef123456789a"; // Replace with the actual contract address
|
|
export const FEE_CONTRACT_ABI = [
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "string",
|
|
"name": "issueId",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"internalType": "string",
|
|
"name": "content",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"internalType": "string",
|
|
"name": "fileUrl",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"internalType": "bool",
|
|
"name": "isVerified",
|
|
"type": "bool"
|
|
}
|
|
],
|
|
"name": "payFeeAndSubmit",
|
|
"outputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "contentId",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"stateMutability": "payable",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "contentId",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "refundFee",
|
|
"outputs": [],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": true,
|
|
"internalType": "address",
|
|
"name": "user",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"indexed": true,
|
|
"internalType": "uint256",
|
|
"name": "contentId",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "fee",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "FeePaid",
|
|
"type": "event"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": true,
|
|
"internalType": "address",
|
|
"name": "user",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"indexed": true,
|
|
"internalType": "uint256",
|
|
"name": "contentId",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "fee",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "FeeRefunded",
|
|
"type": "event"
|
|
}
|
|
];
|