Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: temp - approve and reject transfer request #1461

Merged
merged 1 commit into from
Aug 21, 2023
Merged
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
22 changes: 18 additions & 4 deletions src/adapters/mochi-pay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,32 @@ class MochiPay extends Fetcher {
)
}

async approveTransferRequest({ requestCode }: { requestCode: string }) {
// [@anhnh] TODO: hard code appId for now, need a patch
async approveTransferRequest({
requestCode,
appId = "1",
}: {
requestCode: string
appId?: string
}) {
return await this.jsonFetch(
`${MOCHI_PAY_API_BASE_URL}/mochi-wallet/requests/${requestCode}/approved`,
`${MOCHI_PAY_API_BASE_URL}/applications/${appId}/requests/${requestCode}/approved`,
{
method: "POST",
}
)
}

async rejectTransferRequest({ requestCode }: { requestCode: string }) {
// [@anhnh] TODO: hard code appId for now, need a patch
async rejectTransferRequest({
requestCode,
appId = "1",
}: {
requestCode: string
appId?: string
}) {
return await this.jsonFetch(
`${MOCHI_PAY_API_BASE_URL}/mochi-wallet/requests/${requestCode}/rejected`,
`${MOCHI_PAY_API_BASE_URL}/applications/${appId}/requests/${requestCode}/rejected`,
{
method: "POST",
}
Expand Down
25 changes: 8 additions & 17 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,6 @@ export interface ModelOffchainTipBotToken {
updated_at?: string;
}

export interface ModelProductBotCommand {
code?: string;
created_at?: string;
description?: string;
discord_command?: string;
id?: number;
scope?: number;
telegram_command?: string;
updated_at?: string;
}

export interface ModelProductMetadataEmojis {
code?: string;
discord_id?: string;
Expand Down Expand Up @@ -794,7 +783,6 @@ export interface RequestTransferV2Request {
recipients?: string[];
sender?: string;
token?: string;
transfer_type?: "transfer" | "airdrop";
}

export interface RequestUnlinkBinance {
Expand Down Expand Up @@ -1914,6 +1902,10 @@ export interface ResponseNftWatchlistSuggestResponse {

export interface ResponseOffchainTipBotTransferToken {
amount_each?: number;
/**
* SenderID string `json:"sender_id"`
* Recipients string `json:"recipient_id"`
*/
id?: string;
total_amount?: number;
tx_id?: number;
Expand All @@ -1939,10 +1931,6 @@ export interface ResponsePaginationResponse {
total?: number;
}

export interface ResponseProductBotCommand {
data?: ModelProductBotCommand[];
}

export interface ResponseProfileAirdropCampaignResponse {
data?: ModelProfileAirdropCampaign;
}
Expand Down Expand Up @@ -2114,7 +2102,10 @@ export interface ResponseTopUser {

export interface ResponseTransferTokenV2Data {
amount_each?: number;
external_id?: string;
/**
* SenderID string `json:"sender_id"`
* Recipients string `json:"recipient_id"`
*/
id?: string;
total_amount?: number;
tx_id?: number;
Expand Down