File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,14 +52,14 @@ const requestBodySchema = Type.Object({
5252
5353requestBodySchema . examples = [
5454 {
55- walletTye : "aws_kms" ,
55+ walletType : "aws_kms" ,
5656 awsKMS : {
5757 keyId : "12345678-1234-1234-1234-123456789012" ,
5858 arn : "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" ,
5959 } ,
6060 } ,
6161 {
62- walletTye : "gcp_kms" ,
62+ walletType : "gcp_kms" ,
6363 gcpKMS : {
6464 keyId : "12345678-1234-1234-1234-123456789012" ,
6565 versionId : "1" ,
@@ -152,7 +152,7 @@ export async function addWallet(fastify: FastifyInstance) {
152152 gcpKmsKeyVersionId,
153153 gcpKmsResourcePath,
154154 } ) ;
155- } else if ( WalletConfigType . ppk ) {
155+ } else if ( walletType === WalletConfigType . ppk ) {
156156 if ( ! privateKey ) {
157157 throw new Error ( "privateKey is not defined!" ) ;
158158 }
Original file line number Diff line number Diff line change @@ -22,6 +22,18 @@ export const createWalletDetails = async ({
2222} : CreateWalletDetailsParams ) => {
2323 const prisma = getPrismaWithPostgresTx ( pgtx ) ;
2424
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+
2537 return prisma . walletDetails . create ( {
2638 data : {
2739 ...walletDetails ,
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export const getWalletDetails = async ({
3535 // TODO: Change this!
3636 const walletDetails = await prisma . walletDetails . findUnique ( {
3737 where : {
38- address,
38+ address : address . toLowerCase ( ) ,
3939 } ,
4040 } ) ;
4141
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export const getWalletNonce = async ({
3131 if ( ! walletNonce ) {
3232 const walletDetails = await prisma . walletDetails . findUnique ( {
3333 where : {
34- address,
34+ address : address . toLowerCase ( ) ,
3535 } ,
3636 } ) ;
3737
You can’t perform that action at this time.
0 commit comments