For builders who don't settle for ordinary. Build your reputation, earn $BONK, and connect with fellow innovators.
-
In your
gradle.properties
file, add the following environment variables:SUPABASE_KEY
SUPABASE_URL
SUPABASE_AUTH_TOKEN
-
Build and run the project using your preferred method (e.g., Android Studio, CLI, etc.).
This function handles the creation of a BONK token transfer transaction on Solana.
// Setup type definitions for built-in Supabase Runtime APIs
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { createTransferInstruction, getAssociatedTokenAddress, createAssociatedTokenAccountInstruction } from "@solana/spl-token";
console.info('server started');
const BONK_MINT = new PublicKey("DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263");
const BONK_DECIMALS = 10 ** 5;
const connection = new Connection("your-solana-rpc");
Deno.serve(async (req)=>{
const { from, to, amount } = await req.json();
if (!from || !to || !amount) {
return new Response(JSON.stringify({
error: "Missing sender, recipient, or amount"
}), {
status: 400,
headers: {
"Content-Type": "application/json"
}
});
}
try {
const senderPub = new PublicKey(from);
const recipientPub = new PublicKey(to);
const senderATA = await getAssociatedTokenAddress(BONK_MINT, senderPub);
const recipientATA = await getAssociatedTokenAddress(BONK_MINT, recipientPub);
const instructions = [];
const recipientAccountInfo = await connection.getAccountInfo(recipientATA);
if (!recipientAccountInfo) {
instructions.push(createAssociatedTokenAccountInstruction(senderPub, recipientATA, recipientPub, BONK_MINT));
}
instructions.push(createTransferInstruction(senderATA, recipientATA, senderPub, amount * BONK_DECIMALS));
const { blockhash } = await connection.getLatestBlockhash();
const tx = new Transaction().add(...instructions);
tx.feePayer = senderPub;
tx.recentBlockhash = blockhash;
const serializedTx = tx.serialize({
requireAllSignatures: false
});
const base64Tx = serializedTx.toString("base64");
return new Response(JSON.stringify({
tx: base64Tx
}), {
headers: {
"Content-Type": "application/json",
"Connection": "keep-alive"
}
});
} catch (err) {
console.error("Transaction creation failed:", err);
return new Response(JSON.stringify({
error: "Internal error",
details: err.message
}), {
status: 500,
headers: {
"Content-Type": "application/json"
}
});
}
});
create table public.posts (
id bigint generated by default as identity not null,
created_at timestamp with time zone not null default now(),
updated_at timestamp with time zone not null default now(),
user_id uuid not null default auth.uid (),
description text not null default ''::text,
image text null default ''::text,
boosts bigint not null default '0'::bigint,
bonk_earned double precision not null default '0'::double precision,
constraint posts_pkey primary key (id, user_id),
constraint posts_user_id_fkey foreign KEY (user_id) references users (id)
) TABLESPACE pg_default;
create table public.boosts (
id bigint generated by default as identity not null,
created_at timestamp with time zone not null default now(),
updated_at timestamp with time zone not null default now(),
bonks double precision not null,
post_id bigint null,
to_user text null default ''::text,
from_user text null default ''::text,
constraint boosts_pkey primary key (id)
) TABLESPACE pg_default;
create table public.users (
created_at timestamp with time zone not null default now(),
updated_at timestamp with time zone null default now(),
username text not null default ''::text,
full_name text not null default ''::text,
avatar_url text null default ''::text,
email text not null default ''::text,
wallet_address text null default ''::text,
id uuid not null default auth.uid (),
constraint users_pkey primary key (id),
constraint users_id_key unique (id),
constraint users_username_key unique (username),
constraint users_username_key1 unique (username)
) TABLESPACE pg_default;