Welcome to Caas React SDK 👋
Caas Web SDK
lets you integrate crypto onRamp, offRamp, KYC module provided by mudrex. Let's get started!
Install
Simply go to the command line and run this command.
npm i caas_sdk_web
Add the folllowing scrip tag in you index.html file
<script src="https://hv-camera-web-sg.s3-ap-southeast-1.amazonaws.com/hyperverge-web-sdk@6.1.2/src/sdk.min.js"></script>
Usage
React Native Design System uses a centralized theme to provide consistency across all the components.
Step 1. Implement Signature API in backend that will create a signature for SDK.
Step 2. Implement the Init Function which needs to be passed to SDK.
const init = async () => {
let myHeaders = new Headers();
myHeaders.append("X-USER-ID", "04bc7ef7-6cdf-4b1a-a4cc-93ed058a9a7c");
myHeaders.append("X-CLIENT-ID", "18e963ea-39fd-4a1b-b1e6-decbfe791d31");
myHeaders.append("X-AUTH-TOKEN", "clientId");
let requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow",
};
let result = await fetch("https://staging.mudrex.com/api/v1/user/create_client_user_secret", requestOptions)
.then((response) => response.text())
.then((result) => {
return result;
})
.catch((error) => {});
let res = JSON.parse(result);
return {
signature: res?.secret,
timestamp: res?.timestamp,
userId: res?.user_id,
clientId: res?.client_id,
hv_token: res?.hv_token,
};
};
Step 3. Initialise the SDK
import { Caas } from "caas_sdk_web";
function App() {
return (
<div className="App">
<Caas
init={init}
onSuccess={() => {
console.log("Success");
}}
sdkConfiguration={{ steps: ["kyc"], kycEnabled: true }}
onKYCSuccessCallback={() => {}}
offRampSuccessCallback={() => {}}
/>
</div>
);
}