are the TypeScript types derived from the structures defined in the smart contract Rust files for NearSocial's social-db:
account.rstype Balance = bigint;
type StorageUsage = number;
interface Account {
storage_balance: Balance;
used_bytes: StorageUsage;
permissions: Map<PermissionKey, Permission>;
node_id: NodeId;
storage_tracker: StorageTracker;
shared_storage?: AccountSharedStorage;
}
interface PartialAccount {
storage_balance: Balance;
used_bytes: StorageUsage;
permissions: Array<[PermissionKey, Permission]>;
node_id: NodeId;
}
interface VAccount {
V0: AccountV0;
Current: Account;
}
node.rsinterface Node {
node_id: NodeId;
block_height: BlockHeight;
children: Map<string, NodeValue>;
}
interface ValueAtHeight {
value: string;
block_height: BlockHeight;
}
enum NodeValue {
Value(ValueAtHeight),
Node(NodeId),
DeletedEntry(BlockHeight)
}
interface PartialNode {
node_id: NodeId;
block_height: BlockHeight;
children: Array<[string, NodeValue]>;
from_index: number;
num_children: number;
}
interface VNode {
Current: Node;
}
permission.rsenum PermissionKey {
AccountId(AccountId),
SignerPublicKey(PublicKey)
}
enum Permission {
Granted(Set<NodeId>)
}
type NodeId = number;
type BlockHeight = bigint;
type PublicKey = string; // Example representation, adjust based on actual public key format used
shared_storage.rsinterface SharedStoragePool {
total_storage_balance: Balance;
available_storage_balance: Balance;
owner_id: AccountId;
recipients: Map<AccountId, Balance>;
}
interface VSharedStoragePool {
V0: SharedStoragePoolV0;
Current: SharedStoragePool;
}
interface AccountSharedStorage {
shared_bytes: StorageUsage;
pool_account_id: AccountId;
}
storage_tracker.rsinterface StorageTracker {
total_used_bytes: StorageUsage;
session_used_bytes: StorageUsage;
session_start_storage_usage: StorageUsage;
}
upgrade.rsinterface UpgradeNotice {
upgrade_status: UpgradeStatus;
new_code_hash: string; // Example format, actual type based on how hashes are stored
}
enum UpgradeStatus {
Scheduled,
Completed
}
utils.rsThese are typically helper functions or utilities and may not have direct data structures to translate. However, utility functions or common constants could be adapted into TypeScript as needed for the project's requirements.