Skip to content

Commit 7bfdadb

Browse files
authored
added storeID parameter to account request types (#219)
1 parent ca0f5fb commit 7bfdadb

File tree

5 files changed

+33
-6
lines changed

5 files changed

+33
-6
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 6.0.2 (2022-01-03)
6+
7+
### 🛠 Bug fixes
8+
9+
- Added missing `storeID` parameter to account request types
10+
11+
## 6.0.1 (2021-12-20)
12+
13+
### 🛠 Bug fixes
14+
15+
- Typo on auto generated documentation
16+
517
## 6.0.0 (2021-12-20)
618

719
### 🆕 Features

examples/sign-verify/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const start = async () => {
1919
const account = await client.importAccount({ privateKey })
2020

2121
const message = convertToHex('my data to sign')
22-
const signature = await client.signMessage(account.address, message)
22+
const signature = await client.signMessage(account.address, { message })
2323

2424
await client.verifyMessage({
2525
address: account.address,

src/client/OrchestrateClient.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ describe('OrchestrateClient', () => {
10941094
it('should sign a message successfully', async () => {
10951095
mockHTTPClient.post.mockResolvedValueOnce(signature)
10961096

1097-
const response = await client.signMessage(address, message, authToken, headers)
1097+
const response = await client.signMessage(address, { message }, authToken, headers)
10981098

10991099
expect(mockHTTPClient.post).toHaveBeenCalledWith(
11001100
`/accounts/${address}/sign-message`,
@@ -1109,7 +1109,7 @@ describe('OrchestrateClient', () => {
11091109
const err = new Error('MyError')
11101110
mockHTTPClient.post.mockRejectedValueOnce(err)
11111111
try {
1112-
await client.signMessage(address, 'my data to sign')
1112+
await client.signMessage(address, { message: 'my data to sign' })
11131113
fail('expected failed request')
11141114
} catch (e) {
11151115
expect(e).toEqual(err)

src/client/OrchestrateClient.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,18 @@ export class OrchestrateClient {
444444
* Signs a message using a registered Ethereum account
445445
*
446446
* @param address account's Ethereum address
447-
* @param data payload to sign
447+
* @param request sign message request
448448
* @param authToken Bearer token. Required when multi-tenancy is enabled
449449
* @param headers HTTP request headers.
450450
*/
451-
public async signMessage(address: string, message: string, authToken?: string, headers?: IHeaders): Promise<string> {
451+
public async signMessage(
452+
address: string,
453+
request: types.ISignMessageRequest,
454+
authToken?: string,
455+
headers?: IHeaders
456+
): Promise<string> {
452457
try {
453-
return await this.client.post(`/accounts/${address}/sign-message`, { message }, authToken, headers)
458+
return await this.client.post(`/accounts/${address}/sign-message`, request, authToken, headers)
454459
} catch (e) {
455460
throw e
456461
}

src/client/types/IAccount.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface IAccount {
88
tenantID: string
99
active: boolean
1010
attributes?: object
11+
storeID?: string
1112
createdAt: Date
1213
updatedAt: Date
1314
}
@@ -16,10 +17,12 @@ export interface ICreateAccountRequest {
1617
alias?: string
1718
chain?: string
1819
attributes?: object
20+
storeID?: string
1921
}
2022

2123
export interface IImportAccountRequest extends ICreateAccountRequest {
2224
privateKey: string
25+
storeID?: string
2326
}
2427

2528
export interface ISearchAccountsRequest extends ParsedQs {
@@ -29,6 +32,12 @@ export interface ISearchAccountsRequest extends ParsedQs {
2932
export interface IUpdateAccountRequest {
3033
alias: string
3134
attributes: object
35+
storeID?: string
36+
}
37+
38+
export interface ISignMessageRequest {
39+
message: string
40+
storeID?: string
3241
}
3342

3443
export interface ISignTypedDataRequest {
@@ -47,6 +56,7 @@ export interface ISignTypedDataRequest {
4756
}
4857
message: object
4958
messageType: string
59+
storeID?: string
5060
}
5161

5262
export interface IVerifyTypedDataSignatureRequest {

0 commit comments

Comments
 (0)