@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/index.js CHANGED
@@ -1839,29 +1839,19 @@ var init_pimlico_utils = __esm({
1839
1839
  version: "0.7"
1840
1840
  }
1841
1841
  });
1842
- signerToSmartAccount = async (signer) => {
1843
- console.log("[pimlico] creating public client");
1844
- const client = getPublicClient();
1845
- console.log("[pimlico] calling toSafeSmartAccount");
1846
- const account = await toSafeSmartAccount({
1847
- client,
1848
- owners: [signer],
1849
- entryPoint: {
1850
- address: entryPoint07Address,
1851
- version: "0.7"
1852
- },
1853
- version: "1.4.1"
1854
- });
1855
- console.log("[pimlico] safe smart account created");
1856
- return account;
1857
- };
1842
+ signerToSmartAccount = async (signer) => await toSafeSmartAccount({
1843
+ client: getPublicClient(),
1844
+ owners: [signer],
1845
+ entryPoint: {
1846
+ address: entryPoint07Address,
1847
+ version: "0.7"
1848
+ },
1849
+ version: "1.4.1"
1850
+ });
1858
1851
  getSmartAccountClient = async (signer, authToken, portalAddress) => {
1859
- console.log("[pimlico] signerToSmartAccount start");
1860
1852
  const smartAccount = await signerToSmartAccount(signer);
1861
- console.log("[pimlico] creating pimlico client");
1862
1853
  const pimlicoClient = getPimlicoClient(authToken, portalAddress, smartAccount.address);
1863
- console.log("[pimlico] creating smart account client");
1864
- const result = createSmartAccountClient({
1854
+ return createSmartAccountClient({
1865
1855
  account: smartAccount,
1866
1856
  chain: CHAIN,
1867
1857
  paymaster: pimlicoClient,
@@ -1879,8 +1869,6 @@ var init_pimlico_utils = __esm({
1879
1869
  estimateFeesPerGas: async () => (await pimlicoClient.getUserOperationGasPrice()).fast
1880
1870
  }
1881
1871
  });
1882
- console.log("[pimlico] smart account client created");
1883
- return result;
1884
1872
  };
1885
1873
  getNonce = () => hexToBigInt(
1886
1874
  toHex(toBytes(generatePrivateKey()).slice(0, 24), {
@@ -1916,17 +1904,13 @@ var init_smart_agent = __esm({
1916
1904
  MAX_CALL_GAS_LIMIT = 5e5;
1917
1905
  authOptions = { namespace: "proxy", segment: "ACCESS", scheme: "pimlico" };
1918
1906
  async initializeAgentClient(keyMaterial) {
1919
- console.log("[agent] creating account from key");
1920
1907
  const agentAccount = privateKeyToAccount(toHex2(keyMaterial));
1921
- console.log("[agent] getting auth token");
1922
1908
  const authToken = await this.authTokenProvider.getAuthToken(STATIC_CONFIG.PROXY_SERVER_DID, this.authOptions);
1923
- console.log("[agent] getting smart account client");
1924
1909
  const smartAccountClient = await getSmartAccountClient(
1925
1910
  agentAccount,
1926
1911
  authToken,
1927
1912
  this.authTokenProvider.portalAddress
1928
1913
  );
1929
- console.log("[agent] smart account client ready");
1930
1914
  this.smartAccountAgent = smartAccountClient;
1931
1915
  }
1932
1916
  getSmartAccountAgent() {
@@ -1966,19 +1950,17 @@ var init_smart_agent = __esm({
1966
1950
  ]);
1967
1951
  }
1968
1952
  async sendUserOperation(request, customGasLimit) {
1969
- const smartAccountAgent = this.getSmartAccountAgent();
1970
- console.log("[agent] encoding call data");
1971
- const callData = await this.getCallData(request);
1972
- console.log("[agent] generating nonce");
1973
- const nonce = getNonce();
1974
- console.log("[agent] sending user operation");
1975
- const hash2 = await smartAccountAgent.sendUserOperation({
1976
- callData,
1977
- callGasLimit: BigInt(customGasLimit || this.MAX_CALL_GAS_LIMIT),
1978
- nonce
1979
- });
1980
- console.log("[agent] user operation sent");
1981
- return hash2;
1953
+ try {
1954
+ const smartAccountAgent = this.getSmartAccountAgent();
1955
+ const callData = await this.getCallData(request);
1956
+ return await smartAccountAgent.sendUserOperation({
1957
+ callData,
1958
+ callGasLimit: BigInt(customGasLimit || this.MAX_CALL_GAS_LIMIT),
1959
+ nonce: getNonce()
1960
+ });
1961
+ } catch (error48) {
1962
+ throw error48;
1963
+ }
1982
1964
  }
1983
1965
  async executeUserOperationRequest(request, timeout, customGasLimit) {
1984
1966
  const userOpHash = await this.sendUserOperation(request, customGasLimit);
@@ -3947,12 +3929,7 @@ import hkdf from "futoin-hkdf";
3947
3929
  import tweetnacl2 from "tweetnacl";
3948
3930
  import { fromUint8Array as fromUint8Array4, toUint8Array as toUint8Array7 } from "js-base64";
3949
3931
  var deriveKeyFromAg2Hash = async (pass, salt) => {
3950
- const key = await getArgon2idHash(pass, salt, void 0, {
3951
- t: 2,
3952
- m: 4096,
3953
- p: 8,
3954
- dkLen: 32
3955
- });
3932
+ const key = await getArgon2idHash(pass, salt);
3956
3933
  return hkdf(Buffer.from(key), tweetnacl2.secretbox.keyLength, {
3957
3934
  info: Buffer.from("encryptionKey")
3958
3935
  });