@mojito-inc/core-service
Advanced tools
Comparing version 1.0.8-beta.7 to 1.0.8-beta.8
@@ -19,2 +19,6 @@ export interface RedeemClaimableCodeParam { | ||
} | ||
export interface RedeemEarnableCodeParam { | ||
code: string; | ||
destAddr: string; | ||
} | ||
export {}; |
import { Response } from '../data'; | ||
import { GetClaimInvoiceDetailData, RedeemClaimableCodeData, RedeemEarnableItemData } from './ClaimTokenData'; | ||
import { GetClaimInvoiceDetailData, RedeemClaimableCodeData, RedeemEarnableCodeData, RedeemEarnableItemData } from './ClaimTokenData'; | ||
import { QueryOptions, MutationOptions } from '../domain'; | ||
import { GetClaimInvoiceDetailParam, RedeemClaimableCodeParam, RedeemEarnableItemParam } from './ClaimParam'; | ||
import { GetClaimInvoiceDetailParam, RedeemClaimableCodeParam, RedeemEarnableCodeParam, RedeemEarnableItemParam } from './ClaimParam'; | ||
export interface ClaimService { | ||
@@ -19,2 +19,14 @@ /** | ||
/** | ||
* Returns the redeem claim code | ||
* | ||
* @remarks | ||
* This method is part of redeem claim code | ||
* | ||
* @param param - redeem claim code {@link RedeemEarnableCodeParam} | ||
* @param options - graphql fetch query options {@link QueryOptions} | ||
* @returns {@link RedeemEarnableCodeData} claim code status (success) | ||
* | ||
*/ | ||
redeemEarnableCode: (param: RedeemEarnableCodeParam, options?: QueryOptions) => Promise<Response<RedeemEarnableCodeData>>; | ||
/** | ||
* Returns the status of Redeem Initiated | ||
@@ -21,0 +33,0 @@ * |
@@ -12,2 +12,8 @@ export interface RedeemClaimableCodeData { | ||
} | ||
export interface RedeemEarnableCodeData { | ||
redeemEarnableCode: { | ||
redeemInitiated: boolean; | ||
invoiceID: string; | ||
}; | ||
} | ||
interface MetaData { | ||
@@ -14,0 +20,0 @@ name: string; |
export declare const redeemClaimableCodeQueries: import("@apollo/client").DocumentNode; | ||
export declare const redeemEarnableItemQuery: import("@apollo/client").DocumentNode; | ||
export declare const redeemEarnableCodeQuery: import("@apollo/client").DocumentNode; | ||
export declare const getInvoiceDetailsQuery: import("@apollo/client").DocumentNode; |
@@ -16,2 +16,10 @@ import { gql } from '@apollo/client'; | ||
`; | ||
const redeemEarnableCodeQuery = gql ` | ||
mutation redeemEarnableCode($code: String!, $destAddr: String) { | ||
redeemEarnableCode(code: $code, destAddr: $destAddr) { | ||
redeemInitiated | ||
invoiceID | ||
} | ||
} | ||
`; | ||
const getInvoiceDetailsQuery = gql ` | ||
@@ -52,2 +60,2 @@ query getInvoiceDetails($invoiceID: UUID1!) { | ||
export { getInvoiceDetailsQuery, redeemClaimableCodeQueries, redeemEarnableItemQuery }; | ||
export { getInvoiceDetailsQuery, redeemClaimableCodeQueries, redeemEarnableCodeQuery, redeemEarnableItemQuery }; |
import { __awaiter } from '../_virtual/_tslib.js'; | ||
import { useCallback, useMemo } from 'react'; | ||
import { useApolloClient } from '@apollo/client'; | ||
import { redeemClaimableCodeQueries, redeemEarnableItemQuery, getInvoiceDetailsQuery } from './Queries.js'; | ||
import { redeemClaimableCodeQueries, redeemEarnableCodeQuery, redeemEarnableItemQuery, getInvoiceDetailsQuery } from './Queries.js'; | ||
@@ -25,2 +25,10 @@ /** | ||
}), [client]); | ||
const redeemEarnableCode = useCallback((param, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield client.mutate(Object.assign(Object.assign({}, options), { mutation: redeemEarnableCodeQuery, variables: { | ||
code: param.code, | ||
destAddr: param.destAddr, | ||
} })); | ||
const responseData = response.data; | ||
return { data: responseData }; | ||
}), [client]); | ||
const redeemEarnableItem = useCallback((param, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -43,6 +51,6 @@ const response = yield client.mutate(Object.assign(Object.assign({}, options), { mutation: redeemEarnableItemQuery, variables: { | ||
return useMemo(() => { | ||
return { redeemClaimableCode, redeemEarnableItem, getInvoiceDetails }; | ||
}, [redeemClaimableCode, redeemEarnableItem, getInvoiceDetails]); | ||
return { redeemClaimableCode, redeemEarnableItem, redeemEarnableCode, getInvoiceDetails }; | ||
}, [redeemClaimableCode, redeemEarnableItem, redeemEarnableCode, getInvoiceDetails]); | ||
}; | ||
export { useClaims as default }; |
{ | ||
"name": "@mojito-inc/core-service", | ||
"version": "1.0.8-beta.7", | ||
"version": "1.0.8-beta.8", | ||
"description": "Mojito Core API service for auction, payment, token", | ||
@@ -5,0 +5,0 @@ "main": "./index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
394692
10504
2621