Easily validate webhooks received from Curra against the blockchain data from Tatum.
The purpose of the SDK extension is to enable Curra users to validate webhooks received from Curra against the blockchain, eliminating the need to solely trust Curra's data.
Depending on the volume of your validations, a Tatum API Key may be necessary since the free API calls might be insufficient. It is recommended to create a Tatum account here and purchase a plan.
Example:
// initialize Curra SDK
const apiKey = "curra-api-key"
const tatumSdk = await TatumSDK.init({
// specify webhooks network
network: Network.ETHEREUM,
configureExtensions: [
{
type: CurraWebhookValidator,
config: { apiKey },
},
],
apiKey: {
v4: 'YOUR_API_KEY'
}
});
// abort on error
await tatumSdk
.extension(CurraWebhookValidator)
.validateBodyOrAbort(request.body);
// return error
const error = tatumSdk
.extension(CurraWebhookValidator)
.validateBody(request.body);
// don't forget to destroy the instance
await tatumSdk.destroy();