Skip to content

Commit

Permalink
switch import in account dto
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptroger committed Oct 11, 2024
1 parent 9f33368 commit b9dd569
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
32 changes: 21 additions & 11 deletions apps/vault/src/vault/__test__/e2e/account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Config, load } from '../../../main.config'
import { REQUEST_HEADER_CLIENT_ID } from '../../../main.constant'
import { TestPrismaService } from '../../../shared/module/persistence/service/test-prisma.service'
import { getTestRawAesKeyring } from '../../../shared/testing/encryption.testing'
import { Client } from '../../../shared/type/domain.type'
import { Client, Origin } from '../../../shared/type/domain.type'
import { AppService } from '../../core/service/app.service'

const PRIVATE_KEY = '0x7cfef3303797cbc7515d9ce22ffe849c701b0f2812f999b0847229c47951fca5'
Expand Down Expand Up @@ -210,7 +210,8 @@ describe('Accounts', () => {
keyId,
derivationPath: "m/44'/60'/0'/0/1",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
}
]
})
Expand Down Expand Up @@ -258,21 +259,24 @@ describe('Accounts', () => {
keyId,
derivationPath: "m/44'/60'/0'/0/1",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
},
{
id: expect.any(String),
keyId,
derivationPath: "m/44'/60'/0'/0/2",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
},
{
id: expect.any(String),
keyId,
derivationPath: "m/44'/60'/0'/0/3",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
}
])
})
Expand Down Expand Up @@ -305,14 +309,16 @@ describe('Accounts', () => {
keyId,
derivationPath: "m/44'/60'/0'/0/4",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
},
{
id: expect.any(String),
keyId,
derivationPath: "m/44'/60'/0'/0/5",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
}
])
})
Expand Down Expand Up @@ -346,14 +352,16 @@ describe('Accounts', () => {
keyId,
derivationPath: "m/44'/60'/0'/0/4",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
},
{
id: expect.any(String),
keyId,
derivationPath: "m/44'/60'/0'/0/5",
address: expect.any(String),
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.GENERATED
}
])
})
Expand All @@ -374,7 +382,8 @@ describe('Accounts', () => {
expect(body).toEqual({
id: 'eip155:eoa:0x2c4895215973cbbd778c32c456c074b99daf8bf1',
address: '0x2c4895215973CbBd778C32c456C074b99daF8Bf1',
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.IMPORTED
})
expect(status).toEqual(HttpStatus.CREATED)
})
Expand Down Expand Up @@ -402,7 +411,8 @@ describe('Accounts', () => {
expect(body).toEqual({
id: 'eip155:eoa:0x2c4895215973cbbd778c32c456c074b99daf8bf1',
address: '0x2c4895215973CbBd778C32c456C074b99daF8Bf1',
publicKey: expect.any(String)
publicKey: expect.any(String),
origin: Origin.IMPORTED
})
expect(status).toEqual(HttpStatus.CREATED)
})
Expand Down
6 changes: 4 additions & 2 deletions apps/vault/src/vault/__test__/e2e/wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ describe('Generate', () => {
derivationPath: "m/44'/60'/0'/0/0",
address: expect.any(String),
publicKey: expect.any(String),
id: expect.any(String)
id: expect.any(String),
origin: Origin.GENERATED
})
})

Expand Down Expand Up @@ -277,7 +278,8 @@ describe('Generate', () => {
publicKey: expect.any(String),
keyId: 'my-imported-rootKey',
derivationPath: `m/44'/60'/0'/0/0`,
id: resourceId(body.account.address)
id: resourceId(body.account.address),
origin: Origin.GENERATED
},
keyId: 'my-imported-rootKey'
})
Expand Down
2 changes: 1 addition & 1 deletion apps/vault/src/vault/http/rest/dto/account.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PublicAccount } from '@narval/armory-sdk'
import { PublicAccount } from 'apps/vault/src/shared/type/domain.type'
import { createZodDto } from 'nestjs-zod'

export class AccountDto extends createZodDto(PublicAccount) {}

0 comments on commit b9dd569

Please sign in to comment.