Skip to content

Commit

Permalink
Add proper response types for screening endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
rade-fireblocks committed Dec 11, 2023
1 parent c44c77f commit 57b7752
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 22 deletions.
18 changes: 10 additions & 8 deletions src/fireblocks-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ import {
SmartTransfersTicketTermPayload,
SmartTransfersTicketTermFundPayload,
ScreeningPolicyConfiguration,
TravelRulePolicy,
TravelRuleRulesConfiguration,
SmartTransfersTicketTermResponse,
SmartTransfersUserGroupsResponse,
UsersGroup,
Expand All @@ -118,7 +116,11 @@ import {
ContractAbiResponseDto,
DeployedContractResponseDto,
LeanDeployedContractResponseDto,
ParameterWithValueList, ScreeningTenantConfiguration, ScreeningType,
ParameterWithValueList,
ScreeningTenantConfiguration,
ScreeningType,
ScreeningConfigurationsResponse,
ScreeningPolicyRuleResponse, ScreeningProviderConfigurationResponse,
} from "./types";
import { AxiosProxyConfig, AxiosResponse } from "axios";
import { PIIEncryption } from "./pii-client";
Expand Down Expand Up @@ -1870,7 +1872,7 @@ export class FireblocksSDK {
* Get PostScreening Policies for compliance
* @param screeningType The type of screening (e.g., 'travel_rule', 'aml')
*/
private async getPostScreeningPolicy(screeningType: ScreeningType): Promise<any> {
private async getPostScreeningPolicy(screeningType: ScreeningType): Promise<ScreeningProviderConfigurationResponse> {
const endpoint = `/v1/screening/${screeningType}/post_screening_policy`;
return await this.apiClient.issueGetRequest(endpoint);
}
Expand All @@ -1879,7 +1881,7 @@ export class FireblocksSDK {
* Get Screening Policies for compliance
* @param screeningType The type of screening (e.g., 'travel_rule', 'aml')
*/
private async getScreeningPolicy(screeningType: ScreeningType): Promise<any> {
private async getScreeningPolicy(screeningType: ScreeningType): Promise<ScreeningPolicyRuleResponse> {
const endpoint = `/v1/screening/${screeningType}/screening_policy`;
return await this.apiClient.issueGetRequest(endpoint);
}
Expand All @@ -1888,7 +1890,7 @@ export class FireblocksSDK {
* Get Screening Configuration for compliance
* @param screeningType The type of screening (e.g., 'travel_rule', 'aml')
*/
private async getScreeningConfiguration(screeningType: ScreeningType): Promise<any> {
private async getScreeningConfiguration(screeningType: ScreeningType): Promise<ScreeningConfigurationsResponse> {
const endpoint = `/v1/screening/${screeningType}/policy_configuration`;
return await this.apiClient.issueGetRequest(endpoint);
}
Expand All @@ -1898,13 +1900,13 @@ export class FireblocksSDK {
* @param screeningType The type of screening (e.g., 'travel_rule', 'aml')
* @param screeningPolicyConfiguration The configuration to update
*/
private async updatePolicyConfiguration(screeningType: ScreeningType, screeningPolicyConfiguration: any): Promise<any> {
private async updatePolicyConfiguration(screeningType: ScreeningType, screeningPolicyConfiguration: ScreeningPolicyConfiguration): Promise<ScreeningConfigurationsResponse> {
const endpoint = `/v1/screening/${screeningType}/policy_configuration`;
return await this.apiClient.issuePutRequest(endpoint, screeningPolicyConfiguration);
}

/**
* Update Bypass Screening Configuration for AML/KYT compliance
* Update Bypass Screening Tenant Configuration for AML/KYT compliance
* @param screeningTenantConfiguration
*/
public async updateTenantScreeningConfiguration(screeningTenantConfiguration: ScreeningTenantConfiguration): Promise<ScreeningTenantConfiguration> {
Expand Down
51 changes: 37 additions & 14 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,13 @@ export interface ScreeningTenantConfiguration {
disableUnfreeze: boolean;
}

export enum TravelRuleAction {
export enum ScreeningAction {
screen = "SCREEN",
pass = "PASS",
freeze = "FREEZE"
}

export interface TravelRulePolicyRule {
export interface ScreeningPolicyRuleResponse {
sourceType?: string;
sourceSubType?: string;
destType?: string;
Expand All @@ -537,7 +537,16 @@ export interface TravelRulePolicyRule {
amountUSD?: number;
networkProtocol?: string;
operation?: string;
action: TravelRuleAction;
action: ScreeningAction;
}

export interface ScreeningProviderConfigurationResponse {
direction?: TransactionDirection;
status?: TransactionStatusDirection;
amountUSD?: number;
amount?: number;
asset?: string;
action: ScreeningVerdict;
}

export enum PolicyApprovalStatus {
Expand All @@ -550,7 +559,7 @@ export enum TransactionDirection {
outbound = "OUTBOUND"
}

export enum FbTravelRuleTransactionStatus {
export enum TransactionStatusDirection {
completed = "COMPLETED",
pending = "PENDING",
rejected = "REJECTED",
Expand All @@ -559,7 +568,7 @@ export enum FbTravelRuleTransactionStatus {
blockingTimeExpired = "BLOCKING_TIME_EXPIRED",
}

export enum TravelRuleVerdict {
export enum ScreeningVerdict {
accept = "ACCEPT",
reject = "REJECT",
alert = "ALERT",
Expand All @@ -568,24 +577,38 @@ export enum TravelRuleVerdict {
cancel = "CANCEL"
}

export interface TravelRuleRulesConfiguration {
direction?: TransactionDirection;
status?: FbTravelRuleTransactionStatus;
amountUSD?: number;
amount?: number;
asset?: string;
action: TravelRuleVerdict;
export interface ScreeningConfigurationsResponse {
bypassScreeningDuringServiceOutages: boolean;
inboundTransactionDelay: number;
outboundTransactionDelay: number;
}

export interface TravelRulePolicy {
export interface ScreeningPolicyResponse {
tenantId?: string;
policy: TravelRulePolicyRule[];
policy: ScreeningPolicyRuleResponse;
policyStatus?: PolicyApprovalStatus;
isDefault: boolean;
createDate?: Date;
lastUpdate: Date;
}

export interface ScreeningPolicyRuleResponse {
sourceType?: string;
sourceSubType?: string;
destType?: string;
destSubType?: string;
destAddress?: string;
sourceId?: string;
destId?: string;
asset?: string;
baseAsset?: string;
amount?: number;
amountUSD?: number;
networkProtocol?: string;
operation?: string;
action: ScreeningAction;
}

export type ScreeningType = "travel_rule" | "aml";

export enum Web3ConnectionFeeLevel {
Expand Down

0 comments on commit 57b7752

Please sign in to comment.