Skip to content

Commit 15a0905

Browse files
authored
feat: compliance v2 endpoint (#331)
1 parent 1e2842f commit 15a0905

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

v4-client-js/src/clients/modules/utility.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import type { ComplianceResponse, HeightResponse, TimeResponse } from '../types';
1+
import type {
2+
ComplianceResponse,
3+
ComplianceV2Response,
4+
HeightResponse,
5+
TimeResponse,
6+
} from '../types';
27
import RestClient from './rest';
38

49
export default class UtilityClient extends RestClient {
@@ -29,4 +34,14 @@ export default class UtilityClient extends RestClient {
2934
const uri = '/v4/screen';
3035
return this.get(uri, { address });
3136
}
37+
38+
/**
39+
* @description Screen an address to see if it is restricted
40+
* @param {string} address evm or dydx address
41+
* @returns {ComplianceResponse} whether the specified address is restricted
42+
*/
43+
async complianceScreen(address: string): Promise<ComplianceV2Response> {
44+
const uri = `/v4/compliance/screen/${address}`;
45+
return this.get(uri);
46+
}
3247
}

v4-client-js/src/clients/types.ts

+24
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@ export interface HeightResponse {
105105

106106
export interface ComplianceResponse {
107107
restricted: boolean;
108+
reason?: string;
109+
}
110+
111+
export enum ComplianceReason {
112+
MANUAL = 'MANUAL',
113+
US_GEO = 'US_GEO',
114+
CA_GEO = 'CA_GEO',
115+
GB_GEO = 'GB_GEO',
116+
SANCTIONED_GEO = 'SANCTIONED_GEO',
117+
COMPLIANCE_PROVIDER = 'COMPLIANCE_PROVIDER',
118+
}
119+
120+
export enum ComplianceStatus {
121+
COMPLIANT = 'COMPLIANT',
122+
FIRST_STRIKE_CLOSE_ONLY = 'FIRST_STRIKE_CLOSE_ONLY',
123+
FIRST_STRIKE = 'FIRST_STRIKE',
124+
CLOSE_ONLY = 'CLOSE_ONLY',
125+
BLOCKED = 'BLOCKED',
126+
}
127+
128+
export interface ComplianceV2Response {
129+
status: ComplianceStatus;
130+
reason?: ComplianceReason;
131+
updatedAt?: string;
108132
}
109133

110134
// ------------ Squid ------------ //

0 commit comments

Comments
 (0)