UNPKG

@galliun/sofi-sdk

Version:

SDK for interacting with the Galliun SocialFi protocol

191 lines (173 loc) 2.95 kB
/** * Transaction types for the Galliun SoFi Protocol */ /** * Base transaction type with common properties for all transactions * @property digest - Transaction hash * @property timestamp - Unix timestamp of the transaction * @property sender - Address of the transaction sender */ interface TxBase { digest: string; timestamp: number; sender: string; } /** * Union type for all protocol transactions */ export type AnyProtocolTx = | TxCreateProfile | TxUpdateProfile | TxUpdateUsername | TxFollowProfile | TxUnfollowProfile | TxCreateGoal | TxPayGoal | TxClaimGoal | TxCancelGoal | TxCreateTip | TxClaimTip | TxCancelTip; /** * Profile Transactions */ /** * Create a new profile */ export type TxCreateProfile = TxBase & { kind: 'create_profile'; inputs: { username: string; owner: string; display_name: string; bio: string; description: string; profile_picture: string; background_picture: string; }; }; /** * Update an existing profile */ export type TxUpdateProfile = TxBase & { kind: 'update_profile'; inputs: { profile_id: string; display_name: string; bio: string; description: string; profile_picture: string; background_picture: string; }; }; /** * Update a profile's username */ export type TxUpdateUsername = TxBase & { kind: 'update_username'; inputs: { profile_id: string; new_username: string; }; }; /** * Follow a profile */ export type TxFollowProfile = TxBase & { kind: 'follow_profile'; inputs: { profile_id: string; target_profile_id: string; }; }; /** * Unfollow a profile */ export type TxUnfollowProfile = TxBase & { kind: 'unfollow_profile'; inputs: { profile_id: string; target_profile_id: string; }; }; /** * Goal Transactions */ /** * Create a new funding goal */ export type TxCreateGoal = TxBase & { kind: 'create_goal'; inputs: { profile_id: string; coin_type: string; amount: bigint; description: string; over_fund: boolean; media: string[]; expires_at?: bigint; }; }; /** * Make a payment towards a goal */ export type TxPayGoal = TxBase & { kind: 'pay_goal'; inputs: { goal_id: string; coin_id: string; }; }; /** * Claim funds from a completed goal */ export type TxClaimGoal = TxBase & { kind: 'claim_goal'; inputs: { goal_id: string; }; }; /** * Cancel a goal */ export type TxCancelGoal = TxBase & { kind: 'cancel_goal'; inputs: { goal_id: string; }; }; /** * Tip Transactions */ /** * Create a new tip */ export type TxCreateTip = TxBase & { kind: 'create_tip'; inputs: { profile_id: string; recipient: string; sender: string; coin_type: string; amount: bigint; description: string; }; }; /** * Claim funds from a completed tip */ export type TxClaimTip = TxBase & { kind: 'claim_tip'; inputs: { tip_id: string; }; }; /** * Cancel a tip */ export type TxCancelTip = TxBase & { kind: 'cancel_tip'; inputs: { tip_id: string; }; };