Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions mock-sdk/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
export interface SoroSaveClientConfig {
contractId: string;
rpcUrl: string;
networkPassphrase: string;
}

export class SoroSaveClient {
constructor(config: SoroSaveClientConfig);
joinGroup(groupId: string): Promise<any>;
getGroup(groupId: string): Promise<any>;
contribute(...args: any[]): Promise<any>;
createGroup(...args: any[]): Promise<any>;
[key: string]: any;
}

export function shortenAddress(address: string, chars?: number): string;

export interface SavingsGroup {
id: string | number;
name: string;
admin?: string;
token?: string;
members: string[];
contributionAmount: number | bigint;
cycleLength: number;
maxMembers: number;
totalMembers?: number;
currentMembers?: number;
totalRounds: number;
currentRound: number;
status: GroupStatus;
createdAt?: number;
[key: string]: any;
}

export function formatAmount(amount: any): string;
export function parseAmount(amount: any): bigint;
export function getStatusLabel(status: any): string;
export enum GroupStatus {
Active = "ACTIVE",
Completed = "COMPLETED",
Cancelled = "CANCELLED",
Forming = "FORMING"
}
31 changes: 31 additions & 0 deletions mock-sdk/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class SoroSaveClient {
constructor(config) {
this.config = config;
}
}

function shortenAddress(address) {
if (!address) return "";
return address.slice(0, 4) + "..." + address.slice(-4);
}

module.exports = {
SoroSaveClient,
shortenAddress
};

function formatAmount(amount) {
return String(amount);
}

const GroupStatus = {
Active: "ACTIVE",
Completed: "COMPLETED",
Cancelled: "CANCELLED",
Forming: "FORMING"
};

module.exports.formatAmount = formatAmount;
module.exports.parseAmount = formatAmount;
module.exports.getStatusLabel = function(status) { return status; };
module.exports.GroupStatus = GroupStatus;
6 changes: 6 additions & 0 deletions mock-sdk/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@sorosave/sdk",
"version": "1.0.0",
"main": "index.js",
"types": "index.d.ts"
}
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
Loading