Skip to content

Commit

Permalink
Use random nonce, align CreateVaultAssetResponse with api
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomer Vilensky committed Mar 29, 2021
1 parent 3d45439 commit e6cb804
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api-token-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ApiTokenProvider implements IAuthProvider {
signJwt(path: string, bodyJson?: any): string {
const token = jwt.sign({
uri: path,
nonce: Date.now(),
nonce: Math.floor(Math.random() * Number.MAX_SAFE_INTEGER),
iat: Math.floor(Date.now() / 1000),
exp: Math.floor(Date.now() / 1000) + 55,
sub: this.apiKey,
Expand Down
5 changes: 3 additions & 2 deletions src/fireblocks-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
VaultAccountsFilter,
RequestOptions,
VaultBalancesFilter,
ValidateAddressResponse
ValidateAddressResponse,
CreateVaultAssetResponse
} from "./types";

export * from "./types";
Expand Down Expand Up @@ -388,7 +389,7 @@ export class FireblocksSDK {
* @param vaultAccountId The vault account ID
* @param assetId The asset to add
*/
public async createVaultAsset(vaultAccountId: string, assetId: string): Promise<AssetResponse> {
public async createVaultAsset(vaultAccountId: string, assetId: string): Promise<CreateVaultAssetResponse> {
return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}`, {});
}

Expand Down
5 changes: 4 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export interface UnfreezeTransactionResponse {

export interface CreateVaultAssetResponse {
id: string;
eosAccountName?: string;
address: string;
legacyAddress: string;
tag: string;
eosAccountName: string;
}

export interface WalletAssetResponse extends AssetResponse {
Expand Down

0 comments on commit e6cb804

Please sign in to comment.