generated from calimero-network/core-app-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from calimero-network/feat--add-logic-fundamentals
- Loading branch information
Showing
14 changed files
with
1,237 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,67 @@ | ||
import { ApiResponse } from '@calimero-is-near/calimero-p2p-sdk'; | ||
|
||
export interface GetCountResponse { | ||
count: number; | ||
export interface Message { | ||
id: String; | ||
proposal_id: String; | ||
author: String; | ||
text: String; | ||
created_at: String; | ||
} | ||
|
||
export interface IncreaseCountRequest { | ||
count: number; | ||
export interface GetProposalMessagesRequest { | ||
// proposalId: String; | ||
proposal_id: String; | ||
} | ||
|
||
export interface IncreaseCountResponse {} | ||
export interface GetProposalMessagesResponse { | ||
messages: Message[]; | ||
} | ||
|
||
export interface SendProposalMessageRequest { | ||
// proposalId: String; | ||
proposal_id: String; | ||
message: Message; | ||
} | ||
|
||
export interface SendProposalMessageResponse { | ||
result: boolean; | ||
} | ||
|
||
export interface CreateProposalRequest { | ||
receiver: String; | ||
} | ||
|
||
export interface CreateProposalResponse { | ||
proposal_id: String; | ||
} | ||
|
||
export interface ResetCounterResponse {} | ||
export interface ApproveProposalRequest { | ||
proposal_id: string; | ||
} | ||
|
||
export interface ApproveProposalResponse { | ||
success: boolean; | ||
} | ||
|
||
export enum ClientMethod { | ||
GET_COUNT = 'get_count', | ||
INCREASE_COUNT = 'increase_count', | ||
RESET = 'reset', | ||
GET_PROPOSAL_MESSAGES = 'get_proposal_messages', | ||
SEND_PROPOSAL_MESSAGE = 'send_proposal_messages', | ||
CREATE_PROPOSAL_MESSAGES = 'create_new_proposal', | ||
APPROVE_PROPOSAL_MESSAGE = 'approve_proposal', | ||
} | ||
|
||
export interface ClientApi { | ||
getCount(): ApiResponse<GetCountResponse>; | ||
increaseCount( | ||
params: IncreaseCountRequest, | ||
): ApiResponse<IncreaseCountResponse>; | ||
reset(): ApiResponse<ResetCounterResponse>; | ||
//Cali Storage | ||
getProposalMessages( | ||
proposalsRequest: GetProposalMessagesRequest, | ||
): ApiResponse<GetProposalMessagesResponse>; | ||
sendProposalMessage( | ||
sendMessageRequest: SendProposalMessageRequest, | ||
): ApiResponse<SendProposalMessageResponse>; | ||
createProposal( | ||
request: CreateProposalRequest, | ||
): ApiResponse<CreateProposalResponse>; | ||
approveProposal( | ||
request: ApproveProposalRequest, | ||
): ApiResponse<ApproveProposalResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { ApiResponse } from '@calimero-is-near/calimero-p2p-sdk'; | ||
import { GetProposalsRequest } from './dataSource/ContractApiDataSource'; | ||
|
||
export interface ContextDetails {} | ||
|
||
export interface Members { | ||
publicKey: String; | ||
} | ||
|
||
export interface ProposalAction { | ||
scope: string; | ||
params: { | ||
amount: number; | ||
receiver_id: string; | ||
}; | ||
} | ||
|
||
export interface ContractProposal { | ||
id: string; | ||
author_id: string; | ||
actions: ProposalAction[]; | ||
} | ||
|
||
// | ||
export interface CalimeroProposalMetadata {} | ||
|
||
export interface ContextDetails {} | ||
|
||
export interface Members { | ||
publicKey: String; | ||
} | ||
|
||
export interface Message { | ||
publicKey: String; | ||
} | ||
|
||
export interface ApprovalsCount { | ||
proposal_id: string; | ||
num_approvals: number; | ||
} | ||
|
||
export interface ContractApi { | ||
//Contract | ||
getContractProposals( | ||
request: GetProposalsRequest, | ||
): ApiResponse<ContractProposal[]>; | ||
getNumOfProposals(): ApiResponse<number>; | ||
getProposalApprovals(proposalId: String): ApiResponse<ApprovalsCount>; | ||
getContextDetails(contextId: String): ApiResponse<ContextDetails>; | ||
getContextMembers(): ApiResponse<Members[]>; | ||
getContextMembersCount(): ApiResponse<number>; | ||
} | ||
|
||
// async removeProposal(proposalId: String): ApiResponse<boolean> { | ||
// return await this.client.delete<boolean>( | ||
// `${this.endpoint}/admin-api/contexts/${this.contextId}/proposals/${proposalId}`, | ||
// ); | ||
// } | ||
|
||
// async getProposalMessage( | ||
// proposalId: String, | ||
// messageId: String, | ||
// ): ApiResponse<Message> { | ||
// return await this.client.get<Message>( | ||
// `${this.endpoint}/admin-api/contexts/${this.contextId}/proposals/${proposalId}/messages/${messageId}`, | ||
// ); | ||
// } | ||
|
||
// async getProposalMessages(proposalId: String): ApiResponse<Message[]> { | ||
// return await this.client.get<Message[]>( | ||
// `${this.endpoint}/admin-api/contexts/${this.contextId}/proposals/${proposalId}/messages`, | ||
// ); | ||
// } | ||
// async approveProposal(proposalId: String): ApiResponse<boolean> { | ||
// return await this.client.post<boolean>( | ||
// `${this.endpoint}/admin-api/contexts/${this.contextId}/proposals/${proposalId}/vote`, | ||
// ); | ||
// } |
Oops, something went wrong.