Skip to content

Commit

Permalink
Support setting AML user ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomer Vilensky committed Jun 15, 2020
1 parent 8160335 commit fae99f5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
45 changes: 45 additions & 0 deletions src/fireblocks-sdk.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { ApiClient } from "./api-client";
import { ApiTokenProvider } from "./api-token-provider";
import { IAuthProvider } from "./iauth-provider";
Expand Down Expand Up @@ -439,4 +440,48 @@ export class FireblocksSDK {
public async deleteExternalWalletAsset(walletId: string, assetId: string): Promise<WalletAssetResponse> {
return await this.apiClient.issueDeleteRequest(`/v1/external_wallets/${walletId}/${assetId}`);
}

/**
* Sets a user ID to pass as reference when performing AML screening
* @param vaultAccountId The vault account ID
* @param userId The user ID to set
*/
public async setAmlUserIdForVaultAccount(vaultAccountId: string, userId: string): Promise<OperationSuccessResponse> {
return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/set_aml_user_id`, { userId });
}

/**
* Sets a user ID to pass as reference when performing AML screening
* @param walletId The ID of the internal wallet
* @param userId The user ID to set
*/
public async setAmlUserIdForInternalWallet(walletId: string, userId: string): Promise<OperationSuccessResponse> {
return await this.apiClient.issuePostRequest(`/v1/internal_wallets/${walletId}/set_aml_user_id`, { userId });
}

/**
* Sets a user ID to pass as reference when performing AML screening
* @param walletId The ID of the external wallet
* @param userId The user ID to set
*/
public async setAmlUserIdForExternalWallet(walletId: string, userId: string): Promise<OperationSuccessResponse> {
return await this.apiClient.issuePostRequest(`/v1/external_wallets/${walletId}/set_aml_user_id`, { userId });
}

/**
* Sets a user ID to pass as reference when performing AML screening
* @param vaultAccountId The vault account ID
* @param assetId The ID of the asset
* @param address The address
* @param tag The XRP tag, or EOS memo
* @param userId The user ID to set
*/
public async setAmlUserIdForAddress(vaultAccountId: string, assetId: string, address: string, tag?: string, userId?: string): Promise<OperationSuccessResponse> {
let addressId = address;
if (tag && tag.length > 0) {
addressId = `${address}:${tag}`;
}

return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}/set_aml_user_id`, { userId });
}
}
7 changes: 5 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export interface VaultAccountResponse {
name: string;
hiddenOnUI: boolean;
assets: AssetResponse[];
amlUserId?: string;
}

export interface AssetResponse {
Expand Down Expand Up @@ -38,6 +39,7 @@ export interface WalletContainerResponse {
id: string;
name: string;
assets: WalletAssetResponse[];
amlUserId?: string;
}

export interface CreateTransactionResponse {
Expand Down Expand Up @@ -67,6 +69,7 @@ export interface DepositAddressResponse {
tag?: string;
description?: string;
type: string;
amlUserId?: string;
}
export interface GenerateAddressResponse {
address: string;
Expand All @@ -79,13 +82,13 @@ export interface TransactionArguments {
destination?: DestinationTransferPeerPath;
amount: number | string;
operation?: TransactionOperation;
waitForStatus?: boolean;
fee?: number;
gasPrice?: number;
note: string;
cpuStaking?: number;
networkStaking?: number;
autoStaking?: boolean;
amlUserId?: string;
}

export interface ExchangeResponse {
Expand Down Expand Up @@ -199,7 +202,7 @@ export enum TransactionStatus {
*/
CONFIRMED = "CONFIRMED",
COMPLETED = "COMPLETED",
PENDING_AML_CHECKUP = "PENDING_AML_CHECKUP",
PENDING_AML_SCREENING = "PENDING_AML_SCREENING",
PARTIALLY_COMPLETED = "PARTIALLY_COMPLETED",
CANCELLING = "CANCELLING",
CANCELLED = "CANCELLED",
Expand Down

0 comments on commit fae99f5

Please sign in to comment.