132 lines
2.7 KiB
TypeScript
132 lines
2.7 KiB
TypeScript
export type User = {
|
|
id: number;
|
|
inventoryItems: IInventoryItem[];
|
|
};
|
|
|
|
export interface TimeDuration {
|
|
hours: number;
|
|
minutes: number;
|
|
seconds: number;
|
|
}
|
|
|
|
export interface IResourceWell {
|
|
id: number;
|
|
resourceType: string;
|
|
supply: number;
|
|
}
|
|
|
|
export interface IStake {
|
|
id: number;
|
|
resourceType: string;
|
|
stakingSourceId: number;
|
|
startTime: string;
|
|
inventoryItemId: number;
|
|
stakeAmount: number;
|
|
durationInMins: number;
|
|
unclaimed: boolean;
|
|
claimable: boolean | undefined
|
|
remainingTime: number | undefined
|
|
}
|
|
|
|
export interface IStakingSource {
|
|
id: number;
|
|
name: string;
|
|
description: string;
|
|
resourceWells: IResourceWell[];
|
|
activeStakes: IStake[];
|
|
}
|
|
|
|
export interface IInventoryItem {
|
|
id: number;
|
|
storeItem: IStoreItem;
|
|
currentTierIndex: number;
|
|
}
|
|
|
|
export interface IStoreItem {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
price: number;
|
|
completionTimeInMins: number;
|
|
claimAmount: number;
|
|
upgrades: {
|
|
tier: number;
|
|
price: number;
|
|
claimBoost: number;
|
|
}[];
|
|
isOwned: boolean;
|
|
}
|
|
|
|
export interface IResourceAccount {
|
|
id: number;
|
|
resourceType: string;
|
|
balance: number;
|
|
}
|
|
|
|
export interface IBankAccount {
|
|
id: number;
|
|
primaryBalance: number;
|
|
resourceAccounts: IResourceAccount[];
|
|
}
|
|
|
|
export interface IGameConfig {
|
|
resources: string[];
|
|
[key: string]: any;
|
|
store: IStoreItem[];
|
|
}
|
|
|
|
export interface IConversionPair {
|
|
resourceType: string;
|
|
resourceAmount: number;
|
|
moneyAmount: number
|
|
}
|
|
|
|
// Phantom
|
|
export interface PhantomProvider {
|
|
publicKey: PublicKey | null;
|
|
isConnected: boolean | null;
|
|
signAndSendTransaction: (
|
|
transaction: Transaction,
|
|
opts?: SendOptions
|
|
) => Promise<{ signature: string; publicKey: PublicKey }>;
|
|
signTransaction: (transaction: Transaction) => Promise<Transaction>;
|
|
signAllTransactions: (transactions: Transaction[]) => Promise<Transaction[]>;
|
|
signMessage: (
|
|
message: Uint8Array | string,
|
|
display?: DisplayEncoding
|
|
) => Promise<any>;
|
|
connect: (opts?: Partial<ConnectOpts>) => Promise<{ publicKey: PublicKey }>;
|
|
disconnect: () => Promise<void>;
|
|
on: (event: PhantomEvent, handler: (args: any) => void) => void;
|
|
request: (method: PhantomRequestMethod, params: any) => Promise<unknown>;
|
|
}
|
|
|
|
type DisplayEncoding = "utf8" | "hex";
|
|
|
|
interface ConnectOpts {
|
|
onlyIfTrusted: boolean;
|
|
}
|
|
|
|
type PhantomEvent = "connect" | "disconnect" | "accountChanged";
|
|
|
|
type PhantomRequestMethod =
|
|
| "connect"
|
|
| "disconnect"
|
|
| "signAndSendTransaction"
|
|
| "signTransaction"
|
|
| "signAllTransactions"
|
|
| "signMessage";
|
|
|
|
|
|
// Generic stuff
|
|
|
|
export interface IOption {
|
|
value: string,
|
|
label: string
|
|
}
|
|
|
|
export interface ISelectDropdownProps {
|
|
options: IOption[];
|
|
onChange?: (value: string) => void;
|
|
}
|