File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,14 @@ const requestBodySchema = Type.Object({
52
52
53
53
requestBodySchema . examples = [
54
54
{
55
- walletTye : "aws_kms" ,
55
+ walletType : "aws_kms" ,
56
56
awsKMS : {
57
57
keyId : "12345678-1234-1234-1234-123456789012" ,
58
58
arn : "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" ,
59
59
} ,
60
60
} ,
61
61
{
62
- walletTye : "gcp_kms" ,
62
+ walletType : "gcp_kms" ,
63
63
gcpKMS : {
64
64
keyId : "12345678-1234-1234-1234-123456789012" ,
65
65
versionId : "1" ,
@@ -152,7 +152,7 @@ export async function addWallet(fastify: FastifyInstance) {
152
152
gcpKmsKeyVersionId,
153
153
gcpKmsResourcePath,
154
154
} ) ;
155
- } else if ( WalletConfigType . ppk ) {
155
+ } else if ( walletType === WalletConfigType . ppk ) {
156
156
if ( ! privateKey ) {
157
157
throw new Error ( "privateKey is not defined!" ) ;
158
158
}
Original file line number Diff line number Diff line change @@ -22,6 +22,18 @@ export const createWalletDetails = async ({
22
22
} : CreateWalletDetailsParams ) => {
23
23
const prisma = getPrismaWithPostgresTx ( pgtx ) ;
24
24
25
+ const wallet = await prisma . walletDetails . findUnique ( {
26
+ where : {
27
+ address : walletDetails . address . toLowerCase ( ) ,
28
+ } ,
29
+ } ) ;
30
+
31
+ if ( ! wallet ) {
32
+ throw new Error (
33
+ `Wallet with address ${ walletDetails . address } has already been added!` ,
34
+ ) ;
35
+ }
36
+
25
37
return prisma . walletDetails . create ( {
26
38
data : {
27
39
...walletDetails ,
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export const getWalletDetails = async ({
35
35
// TODO: Change this!
36
36
const walletDetails = await prisma . walletDetails . findUnique ( {
37
37
where : {
38
- address,
38
+ address : address . toLowerCase ( ) ,
39
39
} ,
40
40
} ) ;
41
41
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export const getWalletNonce = async ({
31
31
if ( ! walletNonce ) {
32
32
const walletDetails = await prisma . walletDetails . findUnique ( {
33
33
where : {
34
- address,
34
+ address : address . toLowerCase ( ) ,
35
35
} ,
36
36
} ) ;
37
37
You can’t perform that action at this time.
0 commit comments