@mojito-inc/core-service
Advanced tools
Comparing version 1.0.8-beta.15 to 1.0.8-beta.16
@@ -23,2 +23,11 @@ export interface RedeemClaimableCodeParam { | ||
} | ||
export interface GetContractDetailsParam { | ||
orgId: string; | ||
networkId: string; | ||
contractType: string; | ||
} | ||
export interface CompleteOnchainClaimParam { | ||
invoiceId: string; | ||
txHash: string; | ||
} | ||
export {}; |
import { Response } from '../data'; | ||
import { GetClaimInvoiceDetailData, RedeemClaimableCodeData, RedeemEarnableCodeData, RedeemEarnableItemData } from './ClaimTokenData'; | ||
import { GetClaimInvoiceDetailData, RedeemClaimableCodeData, RedeemEarnableCodeData, RedeemEarnableItemData, GetContractDetailsData, CompleteOnchainClaimData } from './ClaimTokenData'; | ||
import { QueryOptions, MutationOptions } from '../domain'; | ||
import { GetClaimInvoiceDetailParam, RedeemClaimableCodeParam, RedeemEarnableCodeParam, RedeemEarnableItemParam } from './ClaimParam'; | ||
import { GetClaimInvoiceDetailParam, RedeemClaimableCodeParam, RedeemEarnableCodeParam, RedeemEarnableItemParam, GetContractDetailsParam, CompleteOnchainClaimParam } from './ClaimParam'; | ||
export interface ClaimService { | ||
@@ -54,2 +54,26 @@ /** | ||
getInvoiceDetails: (param: GetClaimInvoiceDetailParam, options?: QueryOptions) => Promise<Response<GetClaimInvoiceDetailData>>; | ||
/** | ||
* Returns contract details | ||
* | ||
* @remarks | ||
* This method is part of getting contract detail | ||
* | ||
* @param param - contract param {@link GetContractDetailsParam} | ||
* @param options - graphql fetch query options {@link QueryOptions} | ||
* @returns {@link GetContractDetailsData} contract details | ||
* | ||
*/ | ||
getContractDetails: (param: GetContractDetailsParam, options?: QueryOptions) => Promise<Response<GetContractDetailsData>>; | ||
/** | ||
* Returns the boolean | ||
* | ||
* @remarks | ||
* This method is part of complete onchain claim | ||
* | ||
* @param param - complete onchain claim {@link CompleteOnchainClaimParam} | ||
* @param options - graphql fetch query options {@link QueryOptions} | ||
* @returns {@link CompleteOnchainClaimData} complete onchain claim status | ||
* | ||
*/ | ||
completeOnchainClaim: (param: CompleteOnchainClaimParam, options?: MutationOptions) => Promise<Response<CompleteOnchainClaimData>>; | ||
} |
@@ -54,2 +54,15 @@ export interface RedeemClaimableCodeData { | ||
} | ||
export interface GetContractDetailsData { | ||
getContractDetails: { | ||
id: string; | ||
networkID: string; | ||
contractName: string; | ||
contractAddress: string; | ||
version: string; | ||
contractABIFileURL: string; | ||
}; | ||
} | ||
export interface CompleteOnchainClaimData { | ||
completeOnchainClaim: boolean; | ||
} | ||
export {}; |
@@ -5,1 +5,3 @@ export declare const redeemClaimableCodeQueries: import("@apollo/client").DocumentNode; | ||
export declare const getInvoiceDetailsQuery: import("@apollo/client").DocumentNode; | ||
export declare const getContractDetailsQuery: import("@apollo/client").DocumentNode; | ||
export declare const CompleteOnchainClaimQuery: import("@apollo/client").DocumentNode; |
@@ -58,3 +58,20 @@ import { gql } from '@apollo/client'; | ||
`; | ||
const getContractDetailsQuery = gql ` | ||
query getContractDetails($orgId: UUID1!, $networkId: UUID1!, $contractType: ContractDetailType!) { | ||
getContractDetails(orgId: $orgId, networkId: $networkId, contractType: $contractType) { | ||
id | ||
networkID | ||
contractName | ||
contractAddress | ||
version | ||
contractABIFileURL | ||
} | ||
} | ||
`; | ||
const CompleteOnchainClaimQuery = gql ` | ||
mutation completeOnchainClaim($invoiceId: String!, $txHash: String) { | ||
completeOnchainClaim(invoiceId: $invoiceId, txHash: $txHash) | ||
} | ||
`; | ||
export { getInvoiceDetailsQuery, redeemClaimableCodeQueries, redeemEarnableCodeQuery, redeemEarnableItemQuery }; | ||
export { CompleteOnchainClaimQuery, getContractDetailsQuery, getInvoiceDetailsQuery, redeemClaimableCodeQueries, redeemEarnableCodeQuery, redeemEarnableItemQuery }; |
import { __awaiter } from '../_virtual/_tslib.js'; | ||
import { useCallback, useMemo } from 'react'; | ||
import { useApolloClient } from '@apollo/client'; | ||
import { redeemClaimableCodeQueries, redeemEarnableCodeQuery, redeemEarnableItemQuery, getInvoiceDetailsQuery } from './Queries.js'; | ||
import { redeemClaimableCodeQueries, redeemEarnableCodeQuery, redeemEarnableItemQuery, getInvoiceDetailsQuery, getContractDetailsQuery, CompleteOnchainClaimQuery } from './Queries.js'; | ||
@@ -49,7 +49,24 @@ /** | ||
}), [client]); | ||
const getContractDetails = useCallback((param, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield client.query(Object.assign(Object.assign({}, options), { query: getContractDetailsQuery, variables: { | ||
orgId: param.orgId, | ||
networkId: param.networkId, | ||
contractType: param.contractType, | ||
} })); | ||
const responseData = response.data; | ||
return { data: responseData }; | ||
}), [client]); | ||
const completeOnchainClaim = useCallback((param, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield client.mutate(Object.assign(Object.assign({}, options), { mutation: CompleteOnchainClaimQuery, variables: { | ||
invoiceId: param.invoiceId, | ||
txHash: param.txHash, | ||
} })); | ||
const responseData = response.data; | ||
return { data: responseData }; | ||
}), [client]); | ||
return useMemo(() => { | ||
return { redeemClaimableCode, redeemEarnableItem, redeemEarnableCode, getInvoiceDetails }; | ||
}, [redeemClaimableCode, redeemEarnableItem, redeemEarnableCode, getInvoiceDetails]); | ||
return { redeemClaimableCode, redeemEarnableItem, redeemEarnableCode, getInvoiceDetails, getContractDetails, completeOnchainClaim }; | ||
}, [redeemClaimableCode, redeemEarnableItem, redeemEarnableCode, getInvoiceDetails, getContractDetails, completeOnchainClaim]); | ||
}; | ||
export { useClaims as default }; |
{ | ||
"name": "@mojito-inc/core-service", | ||
"version": "1.0.8-beta.15", | ||
"version": "1.0.8-beta.16", | ||
"description": "Mojito Core API service for auction, payment, token", | ||
@@ -5,0 +5,0 @@ "main": "./index.cjs", |
export declare const getSignatureMessageQueries: import("@apollo/client").DocumentNode; | ||
export declare const loginWithSignatureQueries: import("@apollo/client").DocumentNode; | ||
export declare const signUpWithSignatureQueries: import("@apollo/client").DocumentNode; |
@@ -23,4 +23,2 @@ import { gql } from '@apollo/client'; | ||
$orgId: UUID1! | ||
$name: String | ||
$email: String | ||
) { | ||
@@ -33,4 +31,2 @@ loginWithSignature( | ||
chainID: $chainId | ||
name: $name | ||
email: $email | ||
} | ||
@@ -45,3 +41,32 @@ orgID: $orgId | ||
`; | ||
const signUpWithSignatureQueries = gql ` | ||
mutation SignUpWithSignature( | ||
$challenge: String! | ||
$signature: String! | ||
$signer: String! | ||
$chainId: Int! | ||
$orgId: UUID1! | ||
$firstName: String! | ||
$lastName: String! | ||
$email: String! | ||
) { | ||
signUpWithSignature( | ||
request: { | ||
challenge: $challenge | ||
signature: $signature | ||
signer: $signer | ||
chainID: $chainId | ||
firstName: $firstName | ||
lastName: $lastName | ||
email: $email | ||
} | ||
orgID: $orgId | ||
) { | ||
token | ||
tokenType | ||
jwtRefreshToken | ||
} | ||
} | ||
`; | ||
export { getSignatureMessageQueries, loginWithSignatureQueries }; | ||
export { getSignatureMessageQueries, loginWithSignatureQueries, signUpWithSignatureQueries }; |
@@ -11,1 +11,8 @@ export interface LoginWithSignatureData { | ||
} | ||
export interface SignUpWithSignatureData { | ||
signUpWithSignature?: { | ||
token?: string; | ||
tokenType?: string; | ||
jwtRefreshToken?: string; | ||
}; | ||
} |
@@ -12,4 +12,12 @@ export interface GetSignatureParam { | ||
signer: string; | ||
name?: string; | ||
email?: string; | ||
} | ||
export interface SignUpWithSignatureParam { | ||
chainId: number; | ||
challenge: string; | ||
orgId: string; | ||
signature: string; | ||
signer: string; | ||
firstName: string; | ||
lastName: string; | ||
email: string; | ||
} |
import { QueryOptions, MutationOptions } from '../domain'; | ||
import { Response } from '../data'; | ||
import { GetSignatureData, LoginWithSignatureData } from './SignatureData'; | ||
import { GetSignatureParam, LoginWithSignatureParam } from './SignatureParam'; | ||
import { GetSignatureData, LoginWithSignatureData, SignUpWithSignatureData } from './SignatureData'; | ||
import { GetSignatureParam, LoginWithSignatureParam, SignUpWithSignatureParam } from './SignatureParam'; | ||
export interface SignatureService { | ||
@@ -30,2 +30,14 @@ /** | ||
loginWithSignature: (param: LoginWithSignatureParam, options?: MutationOptions) => Promise<Response<LoginWithSignatureData>>; | ||
/** | ||
* Returns the signUp with signature | ||
* | ||
* @remarks | ||
* This method is part of the web3 signUp signature message & signer | ||
* | ||
* @param param - SignUp with Signature Param {@link SignUpWithSignatureParam} | ||
* @param options - graphql fetch query options {@link QueryOptions} | ||
* @returns {@link SignUpWithSignatureData} signUp with signature data | ||
* | ||
*/ | ||
signUpWithSignature: (param: SignUpWithSignatureParam, options?: MutationOptions) => Promise<Response<SignUpWithSignatureData>>; | ||
} |
import { __awaiter } from '../_virtual/_tslib.js'; | ||
import { useCallback, useMemo } from 'react'; | ||
import { useApolloClient } from '@apollo/client'; | ||
import { getSignatureMessageQueries, loginWithSignatureQueries } from './Queries.js'; | ||
import { getSignatureMessageQueries, loginWithSignatureQueries, signUpWithSignatureQueries } from './Queries.js'; | ||
@@ -25,7 +25,12 @@ /** | ||
}), [client]); | ||
const signUpWithSignature = useCallback((param, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield client.mutate(Object.assign(Object.assign({}, options), { mutation: signUpWithSignatureQueries, variables: param })); | ||
const responseData = response.data; | ||
return { data: responseData }; | ||
}), [client]); | ||
return useMemo(() => { | ||
return { getSignatureMessage, loginWithSignature }; | ||
}, [getSignatureMessage, loginWithSignature]); | ||
return { getSignatureMessage, loginWithSignature, signUpWithSignature }; | ||
}, [getSignatureMessage, loginWithSignature, signUpWithSignature]); | ||
}; | ||
export { useSignature as default }; |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
426152
11453
2780