From b87e23df19168be693e220106a4426beccde9f2f Mon Sep 17 00:00:00 2001 From: stanleyyuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:01:58 +0800 Subject: [PATCH] fix: replace hardcode class hash --- packages/starknet-snap/src/createAccount.ts | 2 -- packages/starknet-snap/src/utils/starknetUtils.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/starknet-snap/src/createAccount.ts b/packages/starknet-snap/src/createAccount.ts index 18f4e1ea..b69ffff6 100644 --- a/packages/starknet-snap/src/createAccount.ts +++ b/packages/starknet-snap/src/createAccount.ts @@ -38,9 +38,7 @@ export async function createAccount(params: ApiParams, silentMode = false) { addressIndex: addressIndexInUsed, derivationPath, } = await getKeysFromAddressIndex(keyDeriver, network.chainId, state, addressIndex); - const { address: contractAddress, callData: contractCallData } = getAccContractAddressAndCallData(publicKey); - logger.log( `createAccount:\ncontractAddress = ${contractAddress}\npublicKey = ${publicKey}\naddressIndex = ${addressIndexInUsed}`, ); diff --git a/packages/starknet-snap/src/utils/starknetUtils.ts b/packages/starknet-snap/src/utils/starknetUtils.ts index 071d9ca0..43944463 100644 --- a/packages/starknet-snap/src/utils/starknetUtils.ts +++ b/packages/starknet-snap/src/utils/starknetUtils.ts @@ -151,7 +151,7 @@ export const deployAccount = async ( const provider = getProvider(network); const account = new Account(provider, contractAddress, privateKey, '1'); const deployAccountPayload = { - classHash: '0x1a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003', + classHash: ACCOUNT_CLASS_HASH_V1, contractAddress: contractAddress, constructorCalldata: contractCallData, addressSalt, @@ -169,7 +169,7 @@ export const estimateAccountDeployFee = async ( const provider = getProvider(network); const account = new Account(provider, contractAddress, privateKey, '1'); const deployAccountPayload = { - classHash: '0x1a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003', + classHash: ACCOUNT_CLASS_HASH_V1, contractAddress: contractAddress, constructorCalldata: contractCallData, addressSalt,