Skip to content

Commit 1b87760

Browse files
committed
change names
1 parent 082b54a commit 1b87760

File tree

5 files changed

+27
-32
lines changed

5 files changed

+27
-32
lines changed

src/server/routes/backend-wallet/create.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import { AddressSchema } from "../../schemas/address";
88
import { standardResponseSchema } from "../../schemas/sharedApiSchemas";
99
import {
1010
CreateAwsKmsWalletError,
11-
createAndStoreAwsKmsWallet,
11+
createAwsKmsWalletDetails,
1212
} from "../../utils/wallets/createAwsKmsWallet";
1313
import {
1414
CreateGcpKmsWalletError,
15-
createAndStoreGcpKmsWallet,
15+
createGcpKmsWalletDetails,
1616
} from "../../utils/wallets/createGcpKmsWallet";
1717
import { createAndStoreLocalWallet } from "../../utils/wallets/createLocalWallet";
1818
import {
19-
createAndStoreSmartAwsWallet,
20-
createAndStoreSmartGcpWallet,
21-
createAndStoreSmartLocalWallet,
19+
createSmartAwsWalletDetails,
20+
createSmartGcpWalletDetails,
21+
createSmartLocalWalletDetails,
2222
} from "../../utils/wallets/createSmartWallet";
2323

2424
const requestBodySchema = Type.Object({
@@ -81,7 +81,7 @@ export const createBackendWallet = async (fastify: FastifyInstance) => {
8181
break;
8282
case WalletType.awsKms:
8383
try {
84-
walletAddress = await createAndStoreAwsKmsWallet({ label });
84+
walletAddress = await createAwsKmsWalletDetails({ label });
8585
} catch (e) {
8686
if (e instanceof CreateAwsKmsWalletError) {
8787
throw createCustomError(
@@ -95,7 +95,7 @@ export const createBackendWallet = async (fastify: FastifyInstance) => {
9595
break;
9696
case WalletType.gcpKms:
9797
try {
98-
walletAddress = await createAndStoreGcpKmsWallet({ label });
98+
walletAddress = await createGcpKmsWalletDetails({ label });
9999
} catch (e) {
100100
if (e instanceof CreateGcpKmsWalletError) {
101101
throw createCustomError(
@@ -109,7 +109,7 @@ export const createBackendWallet = async (fastify: FastifyInstance) => {
109109
break;
110110
case WalletType.smartAwsKms:
111111
try {
112-
const smartAwsWallet = await createAndStoreSmartAwsWallet({
112+
const smartAwsWallet = await createSmartAwsWalletDetails({
113113
label,
114114
});
115115

@@ -127,7 +127,7 @@ export const createBackendWallet = async (fastify: FastifyInstance) => {
127127
break;
128128
case WalletType.smartGcpKms:
129129
try {
130-
const smartGcpWallet = await createAndStoreSmartGcpWallet({
130+
const smartGcpWallet = await createSmartGcpWalletDetails({
131131
label,
132132
});
133133
walletAddress = smartGcpWallet.address;
@@ -144,7 +144,7 @@ export const createBackendWallet = async (fastify: FastifyInstance) => {
144144
break;
145145
case WalletType.smartLocal:
146146
walletAddress = (
147-
await createAndStoreSmartLocalWallet({
147+
await createSmartLocalWalletDetails({
148148
label,
149149
})
150150
).address;

src/server/utils/wallets/createAwsKmsWallet.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export class CreateAwsKmsWalletError extends Error {}
1818
* If any required parameter cannot be resolved from either the configuration or the overrides, an error is thrown.
1919
* Credentials (awsAccessKeyId and awsSecretAccessKey) are explicitly stored separately from the global configuration
2020
*/
21-
export const createAndStoreAwsKmsWallet = async ({
21+
export const createAwsKmsWalletDetails = async ({
2222
label,
2323
...overrides
2424
}: CreateAwsKmsWalletParams): Promise<string> => {
25-
const { awsKmsArn, params } = await createAwsKmsWallet(overrides);
25+
const { awsKmsArn, params } = await createAwsKmsKey(overrides);
2626

2727
return importAwsKmsWallet({
2828
awsKmsArn,
@@ -39,9 +39,7 @@ export const createAndStoreAwsKmsWallet = async ({
3939
* All optional parameters are overrides for the configuration in the database
4040
* If any required parameter cannot be resolved from either the configuration or the overrides, an error is thrown.
4141
*/
42-
export const createAwsKmsWallet = async (
43-
params: Partial<AwsKmsWalletParams>,
44-
) => {
42+
export const createAwsKmsKey = async (params: Partial<AwsKmsWalletParams>) => {
4543
let kmsWalletParams: AwsKmsWalletParams;
4644
try {
4745
kmsWalletParams = await fetchAwsKmsWalletParams(params);

src/server/utils/wallets/createGcpKmsWallet.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ export class CreateGcpKmsWalletError extends Error {}
2222
* If any required parameter cannot be resolved from either the configuration or the overrides, an error is thrown.
2323
* Credentials (gcpApplicationCredentialEmail and gcpApplicationCredentialPrivateKey) are stored separately from the global configuration
2424
*/
25-
export const createAndStoreGcpKmsWallet = async ({
25+
export const createGcpKmsWalletDetails = async ({
2626
label,
2727
...overrides
2828
}: CreateGcpKmsWalletParams): Promise<string> => {
2929
const { walletAddress, resourcePath, params } =
30-
await createGcpKmsWallet(overrides);
30+
await createGcpKmsKey(overrides);
3131

3232
await createWalletDetails({
3333
type: WalletType.gcpKms,
@@ -48,7 +48,7 @@ export const createAndStoreGcpKmsWallet = async ({
4848
* All optional parameters are overrides for the configuration in the database
4949
* If any required parameter cannot be resolved from either the configuration or the overrides, an error is thrown.
5050
*/
51-
export const createGcpKmsWallet = async (
51+
export const createGcpKmsKey = async (
5252
partialParams: Partial<GcpKmsWalletParams>,
5353
) => {
5454
let params: GcpKmsWalletParams;

src/server/utils/wallets/createSmartWallet.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ import { WalletType } from "../../../schema/wallet";
55
import { thirdwebClient } from "../../../utils/sdk";
66
import { splitAwsKmsArn } from "./awsKmsArn";
77
import {
8-
createAwsKmsWallet,
8+
createAwsKmsKey,
99
type CreateAwsKmsWalletParams,
1010
} from "./createAwsKmsWallet";
1111
import {
12-
createGcpKmsWallet,
12+
createGcpKmsKey,
1313
type CreateGcpKmsWalletParams,
1414
} from "./createGcpKmsWallet";
1515
import { createLocalWallet } from "./createLocalWallet";
1616
import { getAwsKmsAccount } from "./getAwsKmsAccount";
1717
import { getGcpKmsAccount } from "./getGcpKmsAccount";
1818

19-
const createSmartWallet = async ({
19+
const getSmartWalletAddresses = async ({
2020
adminAccount,
2121
accountFactoryAddress,
2222
}: {
@@ -44,12 +44,12 @@ export type CreateSmartAwsWalletParams = CreateAwsKmsWalletParams & {
4444
accountFactoryAddress?: Address;
4545
};
4646

47-
export const createAndStoreSmartAwsWallet = async ({
47+
export const createSmartAwsWalletDetails = async ({
4848
label,
4949
accountFactoryAddress,
5050
...awsKmsWalletParams
5151
}: CreateSmartAwsWalletParams) => {
52-
const awsKmsWallet = await createAwsKmsWallet(awsKmsWalletParams);
52+
const awsKmsWallet = await createAwsKmsKey(awsKmsWalletParams);
5353

5454
const { keyId } = splitAwsKmsArn(awsKmsWallet.awsKmsArn);
5555

@@ -65,7 +65,7 @@ export const createAndStoreSmartAwsWallet = async ({
6565
},
6666
});
6767

68-
const smartAccountAddress = await createSmartWallet({
68+
const smartAccountAddress = await getSmartWalletAddresses({
6969
adminAccount,
7070
accountFactoryAddress,
7171
});
@@ -88,12 +88,12 @@ export type CreateSmartGcpWalletParams = CreateGcpKmsWalletParams & {
8888
accountFactoryAddress?: Address;
8989
};
9090

91-
export const createAndStoreSmartGcpWallet = async ({
91+
export const createSmartGcpWalletDetails = async ({
9292
label,
9393
accountFactoryAddress,
9494
...gcpKmsWalletParams
9595
}: CreateSmartGcpWalletParams) => {
96-
const gcpKmsWallet = await createGcpKmsWallet(gcpKmsWalletParams);
96+
const gcpKmsWallet = await createGcpKmsKey(gcpKmsWalletParams);
9797

9898
const adminAccount = await getGcpKmsAccount({
9999
client: thirdwebClient,
@@ -106,7 +106,7 @@ export const createAndStoreSmartGcpWallet = async ({
106106
},
107107
});
108108

109-
const smartAccountAddress = await createSmartWallet({
109+
const smartAccountAddress = await getSmartWalletAddresses({
110110
adminAccount,
111111
accountFactoryAddress,
112112
});
@@ -130,13 +130,13 @@ export type CreateSmartLocalWalletParams = {
130130
accountFactoryAddress?: Address;
131131
};
132132

133-
export const createAndStoreSmartLocalWallet = async ({
133+
export const createSmartLocalWalletDetails = async ({
134134
label,
135135
accountFactoryAddress,
136136
}: CreateSmartLocalWalletParams) => {
137137
const { account, encryptedJson } = await createLocalWallet();
138138

139-
const smartAccountAddress = await createSmartWallet({
139+
const smartAccountAddress = await getSmartWalletAddresses({
140140
adminAccount: account,
141141
accountFactoryAddress,
142142
});

src/server/utils/wallets/legacyLocalCrypto.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ export async function toEncryptedJson({
5656
const computedMac = keccak256(concatArray).substring(2);
5757

5858
const address = privateKeyToAddress(ensureHexPrefix(privateKey));
59-
console.log(address);
60-
6159
const keystore: EncryptedKeystore = {
6260
address: address.slice(2),
6361
crypto: {
@@ -90,7 +88,6 @@ export async function decryptJsonWallet({
9088
privateKey: string;
9189
address: string;
9290
}> {
93-
console.log(encryptedJson);
9491
const keystore: EncryptedKeystore = JSON.parse(encryptedJson);
9592

9693
const salt = keystore.crypto.kdfparams.salt;

0 commit comments

Comments
 (0)