Skip to content

Commit

Permalink
feat(auth1): add getKeyPermissions method
Browse files Browse the repository at this point in the history
  • Loading branch information
vansergen committed Nov 28, 2019
1 parent 0a2047d commit e59877e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/auth1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ export type DepositAddress = {
address: string;
};

export type KeyPermission = { read: boolean; write: boolean };

export type KeyPermissions = {
account: KeyPermission;
history: KeyPermission;
orders: KeyPermission;
positions: KeyPermission;
funding: KeyPermission;
wallets: KeyPermission;
withdraw: KeyPermission;
};

export type AuthenticatedClient1Options = PublicClient1Params & {
key: string;
secret: string;
Expand Down Expand Up @@ -99,6 +111,14 @@ export class AuthenticatedClient1 extends PublicClient1 {
return this.post({ body, uri: "/v1/deposit/new" });
}

/**
* Returns the permissions of the key being used to generate this request.
*/
getKeyPermissions(): Promise<KeyPermissions> {
const uri = "/v1/key_info";
return this.post({ body: { request: uri }, uri });
}

get nonce(): string {
return Date.now().toString();
}
Expand Down

0 comments on commit e59877e

Please sign in to comment.