@ambisafe/tabla-client
Version:
Ambisafe Tabla client library
110 lines (107 loc) • 3.47 kB
TypeScript
declare const PersonalKYCTypes: readonly ["PERSONAL:EMPTY", "PERSONAL:BASIC_KYC", "PERSONAL:ACCREDITED_INVESTOR"];
declare const CorporateKYCTypes: readonly ["CORPORATE:EMPTY", "CORPORATE:BASIC_KYC"];
type Alpha2 = string;
type UUIDv4 = string;
type Hex = string;
type Keccak256 = Hex;
type ETHAddress = Hex;
type TimestampInSec = number;
type PersonalKYCType = typeof PersonalKYCTypes[number];
type CorporateKYCType = typeof CorporateKYCTypes[number];
/**
* @description KYC data used to get signed calldata for specific address from Tabla
*/
interface KYCDataDTO {
kycType: PersonalKYCType | CorporateKYCType;
/**
* @description Address in Ethereum-based format
*/
walletAddress: ETHAddress;
/**
* @description Alpha-2 country code
*/
country: Alpha2;
city: string;
postcode: string;
/**
* @description Residence address in such format: ${Street}, ${Building}, ${Apartment}
*/
residenceAddress: string;
/**
* @description Optional
*/
region?: string;
}
/**
* @description Personal KYC data used to get signed calldata for specific address from Tabla
*/
interface PersonalKYCDataDTO extends KYCDataDTO {
kycType: PersonalKYCType;
firstName: string;
lastName: string;
/**
* @description It's required to be in such format: {YYYY}-{MM}-{DD}
*/
birthDate: string;
}
/**
* @description Corporate KYC data used to get signed calldata for specific address from Tabla
*/
interface CorporateKYCDataDTO extends KYCDataDTO {
kycType: CorporateKYCType;
companyName: string;
/**
* @description It's required to be in such format: {YYYY}-{MM}-{DD}
*/
dateOfIncorporation: string;
}
/**
* @description Unified type for body to send KYC data to Tabla
*/
interface RequestKYCDataDTO extends Omit<Omit<PersonalKYCDataDTO, 'lastName'> & Partial<Pick<PersonalKYCDataDTO, 'lastName'>>, 'kycType'> {
kycType: PersonalKYCType | CorporateKYCType;
}
/**
* @description Response data from Tabla
*/
interface RequestKYCCalldataResponseDTO {
/**
* @description ETH address of a TX where you have to send the TX
*/
to: ETHAddress;
/**
* @description Signed calldata that you have to send from your whitelisted ETH address
*/
data: Hex;
}
/**
* @description Content of a JWT payload segment
*/
interface JWTPayload {
/**
* @description ID in UUIDv4 format of specific platform on Tabla
*/
platformPublicId: UUIDv4;
/**
* @description KYCData hashed in hex format using keccak256
*/
hashedData: Keccak256;
/**
* @description Timestamp in seconds
*/
exp: TimestampInSec;
}
interface ITablaClient {
userWhitelist(kycData: PersonalKYCDataDTO | CorporateKYCDataDTO): Promise<RequestKYCCalldataResponseDTO>;
}
declare class TablaClient implements ITablaClient {
private readonly url;
private readonly platformPublicId;
private readonly jwtSecret;
constructor(url: string, platformPublicId: string, jwtSecret: string);
/**
* @param kycData User KYC data that will passed on Tabla
*/
userWhitelist(kycData: PersonalKYCDataDTO | CorporateKYCDataDTO): Promise<RequestKYCCalldataResponseDTO>;
}
export { CorporateKYCDataDTO, CorporateKYCType, CorporateKYCTypes, ITablaClient, JWTPayload, KYCDataDTO, PersonalKYCDataDTO, PersonalKYCType, PersonalKYCTypes, RequestKYCCalldataResponseDTO, RequestKYCDataDTO, TablaClient };