Skip to content

Commit

Permalink
Merge pull request #267 from fireblocks/ncw-device-setup
Browse files Browse the repository at this point in the history
NCW: wallet & device setup status EPs
  • Loading branch information
yuval-fireblocks authored Mar 24, 2024
2 parents cb2a19b + ba7c023 commit ede50aa
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ncw-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,15 @@ export class NcwApiClient implements NcwSdk {
`${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}/assets/${assetId}/balance`,
{});
}

public async getWalletSetupStatus(walletId: string): Promise<NCW.WalletSetupStatusResponse> {
return await this.apiClient.issueGetRequest(
`${this.NCW_BASE_PATH}/${walletId}/setup_status`);
}

public async getDeviceSetupStatus(walletId: string, deviceId: string): Promise<NCW.DeviceKeySetupResponse> {
return await this.apiClient.issueGetRequest(
`${this.NCW_BASE_PATH}/${walletId}/devices/${deviceId}/setup_status`);

}
}
17 changes: 17 additions & 0 deletions src/ncw-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,21 @@ export interface NcwSdk {
* @return {*} {Promise<AssetResponse>}
*/
refreshWalletAssetBalance(walletId: string, accountId: number, assetId: string): Promise<AssetResponse>;

/**
* get NCW wallet setup status
*
* @param {string} walletId
* @return {*} {Promise<NCW.WalletSetupStatusResponse>}
*/
getWalletSetupStatus(walletId: string): Promise<NCW.WalletSetupStatusResponse>;

/**
* get NCW device setup status
*
* @param {string} walletId
* @param {string} deviceId
* @return {*} {Promise<NCW.DeviceKeySetupResponse>}
*/
getDeviceSetupStatus(walletId: string, deviceId: string): Promise<NCW.DeviceKeySetupResponse>;
}
24 changes: 24 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2164,6 +2164,30 @@ export namespace NCW {
deviceId: string;
enabled: boolean;
}

export enum SetupStatus {
COMPLETE = "COMPLETE",
INCOMPLETE = "INCOMPLETE",
}

export class KeySetup {
status: SetupStatus;
algorithmName: string;
confirmed: boolean;
backedUp: boolean;
}

export class DeviceKeySetupResponse {
status: SetupStatus;
deviceId: string;
setupStatus: Array<KeySetup>;
}

export class WalletSetupStatusResponse {
status: SetupStatus;
deviceSetupStatus: Array<DeviceKeySetupResponse>;
}

}

export namespace TAP {
Expand Down

0 comments on commit ede50aa

Please sign in to comment.