@fileverse/api 0.0.19 → 0.0.21

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.
@@ -1438,29 +1438,19 @@ var init_pimlico_utils = __esm({
1438
1438
  version: "0.7"
1439
1439
  }
1440
1440
  });
1441
- signerToSmartAccount = async (signer) => {
1442
- console.log("[pimlico] creating public client");
1443
- const client = getPublicClient();
1444
- console.log("[pimlico] calling toSafeSmartAccount");
1445
- const account = await toSafeSmartAccount({
1446
- client,
1447
- owners: [signer],
1448
- entryPoint: {
1449
- address: entryPoint07Address,
1450
- version: "0.7"
1451
- },
1452
- version: "1.4.1"
1453
- });
1454
- console.log("[pimlico] safe smart account created");
1455
- return account;
1456
- };
1441
+ signerToSmartAccount = async (signer) => await toSafeSmartAccount({
1442
+ client: getPublicClient(),
1443
+ owners: [signer],
1444
+ entryPoint: {
1445
+ address: entryPoint07Address,
1446
+ version: "0.7"
1447
+ },
1448
+ version: "1.4.1"
1449
+ });
1457
1450
  getSmartAccountClient = async (signer, authToken, portalAddress) => {
1458
- console.log("[pimlico] signerToSmartAccount start");
1459
1451
  const smartAccount = await signerToSmartAccount(signer);
1460
- console.log("[pimlico] creating pimlico client");
1461
1452
  const pimlicoClient = getPimlicoClient(authToken, portalAddress, smartAccount.address);
1462
- console.log("[pimlico] creating smart account client");
1463
- const result = createSmartAccountClient({
1453
+ return createSmartAccountClient({
1464
1454
  account: smartAccount,
1465
1455
  chain: CHAIN,
1466
1456
  paymaster: pimlicoClient,
@@ -1478,8 +1468,6 @@ var init_pimlico_utils = __esm({
1478
1468
  estimateFeesPerGas: async () => (await pimlicoClient.getUserOperationGasPrice()).fast
1479
1469
  }
1480
1470
  });
1481
- console.log("[pimlico] smart account client created");
1482
- return result;
1483
1471
  };
1484
1472
  getNonce = () => hexToBigInt(
1485
1473
  toHex(toBytes(generatePrivateKey()).slice(0, 24), {
@@ -1523,17 +1511,13 @@ var init_smart_agent = __esm({
1523
1511
  MAX_CALL_GAS_LIMIT = 5e5;
1524
1512
  authOptions = { namespace: "proxy", segment: "ACCESS", scheme: "pimlico" };
1525
1513
  async initializeAgentClient(keyMaterial) {
1526
- console.log("[agent] creating account from key");
1527
1514
  const agentAccount = privateKeyToAccount(toHex2(keyMaterial));
1528
- console.log("[agent] getting auth token");
1529
1515
  const authToken = await this.authTokenProvider.getAuthToken(STATIC_CONFIG.PROXY_SERVER_DID, this.authOptions);
1530
- console.log("[agent] getting smart account client");
1531
1516
  const smartAccountClient = await getSmartAccountClient(
1532
1517
  agentAccount,
1533
1518
  authToken,
1534
1519
  this.authTokenProvider.portalAddress
1535
1520
  );
1536
- console.log("[agent] smart account client ready");
1537
1521
  this.smartAccountAgent = smartAccountClient;
1538
1522
  }
1539
1523
  getSmartAccountAgent() {
@@ -1573,19 +1557,17 @@ var init_smart_agent = __esm({
1573
1557
  ]);
1574
1558
  }
1575
1559
  async sendUserOperation(request, customGasLimit) {
1576
- const smartAccountAgent = this.getSmartAccountAgent();
1577
- console.log("[agent] encoding call data");
1578
- const callData = await this.getCallData(request);
1579
- console.log("[agent] generating nonce");
1580
- const nonce = getNonce();
1581
- console.log("[agent] sending user operation");
1582
- const hash2 = await smartAccountAgent.sendUserOperation({
1583
- callData,
1584
- callGasLimit: BigInt(customGasLimit || this.MAX_CALL_GAS_LIMIT),
1585
- nonce
1586
- });
1587
- console.log("[agent] user operation sent");
1588
- return hash2;
1560
+ try {
1561
+ const smartAccountAgent = this.getSmartAccountAgent();
1562
+ const callData = await this.getCallData(request);
1563
+ return await smartAccountAgent.sendUserOperation({
1564
+ callData,
1565
+ callGasLimit: BigInt(customGasLimit || this.MAX_CALL_GAS_LIMIT),
1566
+ nonce: getNonce()
1567
+ });
1568
+ } catch (error48) {
1569
+ throw error48;
1570
+ }
1589
1571
  }
1590
1572
  async executeUserOperationRequest(request, timeout, customGasLimit) {
1591
1573
  const userOpHash = await this.sendUserOperation(request, customGasLimit);
@@ -3831,12 +3813,7 @@ import hkdf from "futoin-hkdf";
3831
3813
  import tweetnacl2 from "tweetnacl";
3832
3814
  import { fromUint8Array as fromUint8Array4, toUint8Array as toUint8Array5 } from "js-base64";
3833
3815
  var deriveKeyFromAg2Hash = async (pass, salt) => {
3834
- const key = await getArgon2idHash(pass, salt, void 0, {
3835
- t: 2,
3836
- m: 4096,
3837
- p: 8,
3838
- dkLen: 32
3839
- });
3816
+ const key = await getArgon2idHash(pass, salt);
3840
3817
  return hkdf(Buffer.from(key), tweetnacl2.secretbox.keyLength, {
3841
3818
  info: Buffer.from("encryptionKey")
3842
3819
  });