@divvi/referral-sdk
Version:
SDK for managing referrals in the Divvi ecosystem
42 lines • 1.86 kB
TypeScript
import { Address, Hex } from './types';
/**
* Generates the referral tag for the Divvi referral system.
*
* @param params - The parameters for generating the referral tag.
* @param params.user - The user address that consented to the transaction. This is cryptographically verified on the backend to ensure accurate referral attribution.
* @param params.consumer - The consumer address.
* @param params.providers - An array of provider addresses. Defaults to an empty array.
* @returns The referral tag as a hex string.
*/
export declare function getReferralTag({ user, consumer, providers, }: {
user: Address;
consumer: Address;
providers?: readonly Address[];
}): string;
/**
* Posts an attribution event to the tracking API
*
* @param params - The parameters for the attribution event
* @param params.txHash - The transaction hash (for transaction-based referrals)
* @param params.message - The signed message (for signed message-based referrals, can be string or Hex)
* @param params.signature - The signature of the message (for signed message-based referrals)
* @param params.chainId - The chain ID
* @param params.baseUrl - The base URL for the API endpoint (optional)
* @returns A promise that resolves to the response from the API
* @throws {Error} Client error (4xx) - When the request fails due to client-side issues
* @throws {Error} Server error (5xx) - When the request fails due to server-side issues, client should retry the request
*/
export declare function submitReferral(params: {
txHash: Address;
chainId: number;
baseUrl?: string;
divviApiKey?: string;
} | {
message: string | Hex;
signature: Hex;
chainId: number;
baseUrl?: string;
divviApiKey?: string;
}): Promise<Response>;
export { Address, Hex, InvalidAddressError } from './types';
//# sourceMappingURL=index.d.ts.map