@chipi-stack/backend 14.8.0 → 14.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import CryptoES from 'crypto-es';
2
2
  import { hash, CallData, cairo, ec, shortString, RpcProvider, Account } from 'starknet';
3
- import { formatAmount, SKU_CONTRACTS, CARRIER_IDS, SERVICE_TYPES, API_ENDPOINTS, WALLET_RPC_ENDPOINTS, WALLET_CLASS_HASHES } from '@chipi-stack/shared';
3
+ import { formatAmount, SKU_CONTRACTS, CARRIER_IDS, SERVICE_TYPES, API_ENDPOINTS, WALLET_RPC_ENDPOINTS, getWalletTypeFromClassHash, WALLET_CLASS_HASHES } from '@chipi-stack/shared';
4
4
  import { Chain, STARKNET_CONTRACTS } from '@chipi-stack/types';
5
5
 
6
6
  var __defProp = Object.defineProperty;
@@ -438,7 +438,15 @@ var executePaymasterTransaction = async ({
438
438
  usePasskey ? "encryptKey is required when using passkey. The passkey authentication should have provided the encryptKey." : "encryptKey is required for transaction execution"
439
439
  );
440
440
  }
441
- const walletType = wallet.walletType ?? "READY";
441
+ let walletType = wallet.walletType ?? "READY";
442
+ if (!wallet.walletType) {
443
+ try {
444
+ const resolveProvider = new RpcProvider({ nodeUrl: WALLET_RPC_ENDPOINTS.CHIPI });
445
+ const onChainClassHash = await resolveProvider.getClassHashAt(wallet.publicKey, "latest");
446
+ walletType = getWalletTypeFromClassHash(onChainClassHash) ?? "READY";
447
+ } catch {
448
+ }
449
+ }
442
450
  if (walletType === "SHHH") {
443
451
  const { executeShhhSponsoredRaw: executeShhhSponsoredRaw2 } = await Promise.resolve().then(() => (init_execute_paymaster_raw(), execute_paymaster_raw_exports));
444
452
  const shhhSignerKind = (wallet.signerKind ?? "STARK") || "STARK";