@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.
package/dist/worker.js CHANGED
@@ -1672,29 +1672,19 @@ var init_pimlico_utils = __esm({
1672
1672
  version: "0.7"
1673
1673
  }
1674
1674
  });
1675
- signerToSmartAccount = async (signer) => {
1676
- console.log("[pimlico] creating public client");
1677
- const client = getPublicClient();
1678
- console.log("[pimlico] calling toSafeSmartAccount");
1679
- const account = await toSafeSmartAccount({
1680
- client,
1681
- owners: [signer],
1682
- entryPoint: {
1683
- address: entryPoint07Address,
1684
- version: "0.7"
1685
- },
1686
- version: "1.4.1"
1687
- });
1688
- console.log("[pimlico] safe smart account created");
1689
- return account;
1690
- };
1675
+ signerToSmartAccount = async (signer) => await toSafeSmartAccount({
1676
+ client: getPublicClient(),
1677
+ owners: [signer],
1678
+ entryPoint: {
1679
+ address: entryPoint07Address,
1680
+ version: "0.7"
1681
+ },
1682
+ version: "1.4.1"
1683
+ });
1691
1684
  getSmartAccountClient = async (signer, authToken, portalAddress) => {
1692
- console.log("[pimlico] signerToSmartAccount start");
1693
1685
  const smartAccount = await signerToSmartAccount(signer);
1694
- console.log("[pimlico] creating pimlico client");
1695
1686
  const pimlicoClient = getPimlicoClient(authToken, portalAddress, smartAccount.address);
1696
- console.log("[pimlico] creating smart account client");
1697
- const result = createSmartAccountClient({
1687
+ return createSmartAccountClient({
1698
1688
  account: smartAccount,
1699
1689
  chain: CHAIN,
1700
1690
  paymaster: pimlicoClient,
@@ -1712,8 +1702,6 @@ var init_pimlico_utils = __esm({
1712
1702
  estimateFeesPerGas: async () => (await pimlicoClient.getUserOperationGasPrice()).fast
1713
1703
  }
1714
1704
  });
1715
- console.log("[pimlico] smart account client created");
1716
- return result;
1717
1705
  };
1718
1706
  getNonce = () => hexToBigInt(
1719
1707
  toHex(toBytes(generatePrivateKey()).slice(0, 24), {
@@ -1749,17 +1737,13 @@ var init_smart_agent = __esm({
1749
1737
  MAX_CALL_GAS_LIMIT = 5e5;
1750
1738
  authOptions = { namespace: "proxy", segment: "ACCESS", scheme: "pimlico" };
1751
1739
  async initializeAgentClient(keyMaterial) {
1752
- console.log("[agent] creating account from key");
1753
1740
  const agentAccount = privateKeyToAccount(toHex2(keyMaterial));
1754
- console.log("[agent] getting auth token");
1755
1741
  const authToken = await this.authTokenProvider.getAuthToken(STATIC_CONFIG.PROXY_SERVER_DID, this.authOptions);
1756
- console.log("[agent] getting smart account client");
1757
1742
  const smartAccountClient = await getSmartAccountClient(
1758
1743
  agentAccount,
1759
1744
  authToken,
1760
1745
  this.authTokenProvider.portalAddress
1761
1746
  );
1762
- console.log("[agent] smart account client ready");
1763
1747
  this.smartAccountAgent = smartAccountClient;
1764
1748
  }
1765
1749
  getSmartAccountAgent() {
@@ -1799,19 +1783,17 @@ var init_smart_agent = __esm({
1799
1783
  ]);
1800
1784
  }
1801
1785
  async sendUserOperation(request, customGasLimit) {
1802
- const smartAccountAgent = this.getSmartAccountAgent();
1803
- console.log("[agent] encoding call data");
1804
- const callData = await this.getCallData(request);
1805
- console.log("[agent] generating nonce");
1806
- const nonce = getNonce();
1807
- console.log("[agent] sending user operation");
1808
- const hash = await smartAccountAgent.sendUserOperation({
1809
- callData,
1810
- callGasLimit: BigInt(customGasLimit || this.MAX_CALL_GAS_LIMIT),
1811
- nonce
1812
- });
1813
- console.log("[agent] user operation sent");
1814
- return hash;
1786
+ try {
1787
+ const smartAccountAgent = this.getSmartAccountAgent();
1788
+ const callData = await this.getCallData(request);
1789
+ return await smartAccountAgent.sendUserOperation({
1790
+ callData,
1791
+ callGasLimit: BigInt(customGasLimit || this.MAX_CALL_GAS_LIMIT),
1792
+ nonce: getNonce()
1793
+ });
1794
+ } catch (error) {
1795
+ throw error;
1796
+ }
1815
1797
  }
1816
1798
  async executeUserOperationRequest(request, timeout, customGasLimit) {
1817
1799
  const userOpHash = await this.sendUserOperation(request, customGasLimit);