Compare commits
3 Commits
4274ffe2b6
...
48f3b72e81
| Author | SHA1 | Date | |
|---|---|---|---|
| 48f3b72e81 | |||
| ad8fb39db2 | |||
| 75d1bf3a72 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -13,7 +13,7 @@ import { games } from "@/data/games";
|
||||||
import { WAGER_PRIZE_MULT } from "@/shared/constants";
|
import { WAGER_PRIZE_MULT } from "@/shared/constants";
|
||||||
import { EXPLORER_ADDRESS_TEMPLATE } from "@/data/shared";
|
import { EXPLORER_ADDRESS_TEMPLATE } from "@/data/shared";
|
||||||
|
|
||||||
const ENABLE_REFERRAL_SYSTEM = false; // Toggle for referral system visibility
|
const ENABLE_REFERRAL_SYSTEM = true; // Toggle for referral system visibility
|
||||||
|
|
||||||
interface GameHistory {
|
interface GameHistory {
|
||||||
ended_time: string;
|
ended_time: string;
|
||||||
|
|
@ -206,9 +206,21 @@ export default function PrivyButton() {
|
||||||
wallets.forEach((wallet) => {
|
wallets.forEach((wallet) => {
|
||||||
if (wallet.type === "solana") {
|
if (wallet.type === "solana") {
|
||||||
setSolWallet(wallet.address);
|
setSolWallet(wallet.address);
|
||||||
|
updateActiveWallet(wallet.address);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateActiveWallet = async (walletAddress: string) => {
|
||||||
|
if(walletAddress.length < 10){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const updateUrl = `${API_URL}update_active_wallet.php?id=${user?.id}&wallet=${walletAddress}`;
|
||||||
|
const response = await fetch(updateUrl);
|
||||||
|
const data = await response.text();
|
||||||
|
console.log(`Updated active wallet to ${walletAddress}, response: ${data}`);
|
||||||
|
}
|
||||||
|
|
||||||
const fetchSolBalance = async () => {
|
const fetchSolBalance = async () => {
|
||||||
updateSolWallet();
|
updateSolWallet();
|
||||||
|
|
||||||
|
|
@ -719,10 +731,10 @@ export default function PrivyButton() {
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<p className="text-gray-400 text-sm">Your Referral ID:</p>
|
<p className="text-gray-400 text-sm">Your Referral ID:</p>
|
||||||
<p className="font-mono text-sm">{user?.id?.slice(0, 8)}</p>
|
<p className="font-mono text-sm">{refId}</p>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigator.clipboard.writeText(user?.id || '');
|
navigator.clipboard.writeText(refId.toString());
|
||||||
toast.success('Referral ID copied!');
|
toast.success('Referral ID copied!');
|
||||||
}}
|
}}
|
||||||
className="text-gray-400 hover:text-white transition p-1"
|
className="text-gray-400 hover:text-white transition p-1"
|
||||||
|
|
@ -734,7 +746,7 @@ export default function PrivyButton() {
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const referralLink = `${window.location.origin}?ref=${user?.id}`;
|
const referralLink = `${window.location.origin}?ref=${refId}`;
|
||||||
navigator.clipboard.writeText(referralLink);
|
navigator.clipboard.writeText(referralLink);
|
||||||
toast.success('Referral link copied!');
|
toast.success('Referral link copied!');
|
||||||
}}
|
}}
|
||||||
|
|
@ -748,10 +760,10 @@ export default function PrivyButton() {
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<div>
|
{/* <div>
|
||||||
<p className="text-gray-400 text-xs">Referral Earnings</p>
|
<p className="text-gray-400 text-xs">Referral Earnings</p>
|
||||||
<p className="text-lg font-semibold">{referralStats.earnings.toFixed(2)} SOL</p>
|
<p className="text-lg font-semibold">{referralStats.earnings.toFixed(2)} SOL</p>
|
||||||
</div>
|
</div> */}
|
||||||
<div>
|
<div>
|
||||||
<p className="text-gray-400 text-xs">Total Referrals</p>
|
<p className="text-gray-400 text-xs">Total Referrals</p>
|
||||||
<p className="text-lg font-semibold">{referralStats.count}</p>
|
<p className="text-lg font-semibold">{referralStats.count}</p>
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,16 @@ export type Bets = {
|
||||||
"writable": true,
|
"writable": true,
|
||||||
"signer": true
|
"signer": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "ownerReferrer",
|
||||||
|
"writable": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "joinerReferrer",
|
||||||
|
"writable": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "systemProgram",
|
"name": "systemProgram",
|
||||||
"address": "11111111111111111111111111111111"
|
"address": "11111111111111111111111111111111"
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,16 @@
|
||||||
"writable": true,
|
"writable": true,
|
||||||
"signer": true
|
"signer": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "owner_referrer",
|
||||||
|
"writable": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "joiner_referrer",
|
||||||
|
"writable": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "system_program",
|
"name": "system_program",
|
||||||
"address": "11111111111111111111111111111111"
|
"address": "11111111111111111111111111111111"
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,9 @@ export async function closeBet(wallets: ConnectedSolanaWallet, uid:string, betI
|
||||||
betVault: chosenBet,
|
betVault: chosenBet,
|
||||||
betsList: bet_list_pda,
|
betsList: bet_list_pda,
|
||||||
winner: winner,
|
winner: winner,
|
||||||
feeWallet: FEE_COLLECTOR_PUBKEY
|
feeWallet: FEE_COLLECTOR_PUBKEY,
|
||||||
|
ownerReferrer: FEE_COLLECTOR_PUBKEY,
|
||||||
|
joinerReferrer: FEE_COLLECTOR_PUBKEY
|
||||||
})
|
})
|
||||||
.transaction();
|
.transaction();
|
||||||
tx.feePayer = new PublicKey(wallets.address);
|
tx.feePayer = new PublicKey(wallets.address);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user