@actalink/commonlib 0.0.40-dev → 0.0.40

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.cjs CHANGED
@@ -362,7 +362,7 @@ var bscUSDT = token({
362
362
  symbol: "USDT",
363
363
  logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
364
364
  });
365
- var bscTokens = [bscUSDT];
365
+ var bscTokens = [bscUSDT, bscUSDC];
366
366
  var ethereumETH = nativeETH(import_chains3.mainnet.id);
367
367
  var ethereumWETH = token({
368
368
  chainId: import_chains3.mainnet.id,
@@ -849,6 +849,48 @@ var ActaAccount = class {
849
849
  };
850
850
  });
851
851
  }
852
+ createAccountHelperBatch() {
853
+ return __async(this, null, function* () {
854
+ const account = yield this.createAccount();
855
+ const entryPoint = (0, import_constants.getEntryPoint)("0.7");
856
+ const paymasterClient = (0, import_account_abstraction.createPaymasterClient)({
857
+ transport: (0, import_viem3.http)(`https://api.acta.link/paymaster/v1/rpc`)
858
+ });
859
+ const pimlicoClient = (0, import_pimlico.createPimlicoClient)({
860
+ chain: getChainById(this.chainId),
861
+ transport: (0, import_viem3.http)(`${proxyUrl}/rpc?chainId=${this.chainId}`),
862
+ entryPoint
863
+ });
864
+ const accountClient = (0, import_permissionless.createSmartAccountClient)({
865
+ account,
866
+ chain: getChainById(this.chainId),
867
+ paymaster: paymasterClient,
868
+ bundlerTransport: (0, import_viem3.http)(`${proxyUrl}/rpc?chainId=${this.chainId}`),
869
+ userOperation: {
870
+ estimateFeesPerGas: () => __async(this, null, function* () {
871
+ return (yield pimlicoClient.getUserOperationGasPrice()).fast;
872
+ })
873
+ }
874
+ });
875
+ const kernelAccountClient = (0, import_sdk.createKernelAccountClient)({
876
+ account,
877
+ chain: getChainById(this.chainId),
878
+ paymaster: paymasterClient,
879
+ bundlerTransport: (0, import_viem3.http)(`${proxyUrl}/rpc?chainId=${this.chainId}`),
880
+ userOperation: {
881
+ estimateFeesPerGas: () => __async(this, null, function* () {
882
+ return (yield pimlicoClient.getUserOperationGasPrice()).fast;
883
+ })
884
+ }
885
+ });
886
+ return {
887
+ paymasterClient,
888
+ pimlicoClient,
889
+ accountClient,
890
+ kernelAccountClient
891
+ };
892
+ });
893
+ }
852
894
  estimateSinglePaymentGas(parameters) {
853
895
  return __async(this, null, function* () {
854
896
  const {
@@ -941,7 +983,7 @@ var ActaAccount = class {
941
983
  throw new Error("Receivers not found for batch payment");
942
984
  }
943
985
  const account = yield this.createAccount();
944
- const { accountClient, pimlicoClient } = yield this.createAccountHelpers();
986
+ const { accountClient, pimlicoClient } = yield this.createAccountHelperBatch();
945
987
  const fromAddress = signerAddress;
946
988
  const smartAccountAddress = account.address;
947
989
  const token2 = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
@@ -972,18 +1014,42 @@ var ActaAccount = class {
972
1014
  }
973
1015
  ]
974
1016
  });
975
- const quotes = yield pimlicoClient.getTokenQuotes({
976
- tokens: [token2.address],
977
- chain: getChainById(chainId)
1017
+ const data = {
1018
+ jsonrpc: "2.0",
1019
+ id: 1,
1020
+ method: "pm_getTokenQuotes",
1021
+ params: [
1022
+ {
1023
+ tokens: [token2.address]
1024
+ },
1025
+ import_account_abstraction.entryPoint07Address,
1026
+ (0, import_viem3.toHex)(chainId)
1027
+ ]
1028
+ };
1029
+ const res = yield fetch("https://api.acta.link/paymaster/v1/rpc", {
1030
+ method: "POST",
1031
+ headers: {
1032
+ "Content-Type": "application/json"
1033
+ },
1034
+ body: JSON.stringify(data)
1035
+ }).then((response) => {
1036
+ if (!response.ok) {
1037
+ throw new Error("HTTP error " + response.status);
1038
+ }
1039
+ return response.json();
978
1040
  });
979
1041
  const userOperationMaxCost = (0, import_permissionless.getRequiredPrefund)({
980
1042
  userOperation,
981
1043
  entryPointVersion: "0.7"
982
1044
  });
983
- const postOpGas = quotes[0].postOpGas;
984
- const exchangeRate = quotes[0].exchangeRate;
985
- const exchangeRateNativeToUsd = quotes[0].exchangeRateNativeToUsd;
986
- const paymaster = quotes[0].paymaster;
1045
+ const quotes = res.result;
1046
+ if (!quotes.paymaster) {
1047
+ throw new Error("Error fetching quotes");
1048
+ }
1049
+ const postOpGas = (0, import_viem3.hexToBigInt)(quotes.postOpGas);
1050
+ const exchangeRate = (0, import_viem3.hexToBigInt)(quotes.exchangeRate);
1051
+ const exchangeRateNativeToUsd = (0, import_viem3.hexToBigInt)(quotes.exchangeRateNativeToUsd);
1052
+ const paymaster = quotes.paymaster;
987
1053
  const maxCostInWei = userOperationMaxCost + postOpGas * userOperation.maxFeePerGas;
988
1054
  const costInToken = maxCostInWei * exchangeRate / BigInt(1e18);
989
1055
  const costInUsd = maxCostInWei * exchangeRateNativeToUsd / BigInt(1e18);
@@ -1139,7 +1205,7 @@ var ActaAccount = class {
1139
1205
  feebps
1140
1206
  });
1141
1207
  const account = yield this.createAccount();
1142
- const { accountClient } = yield this.createAccountHelpers();
1208
+ const { accountClient } = yield this.createAccountHelperBatch();
1143
1209
  const fromAddress = signerAddress;
1144
1210
  const smartAccountAddress = account.address;
1145
1211
  const amountToTransfer = feeInclusive ? totalAmount : feeExclusiveAmountInToken;
@@ -1239,7 +1305,7 @@ var ActaAccount = class {
1239
1305
  signer: this.signer
1240
1306
  }
1241
1307
  );
1242
- const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1308
+ const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1243
1309
  const emptyAccount = (0, import_sdk.addressToEmptyAccount)(sessionKeyAddress);
1244
1310
  const emptySessionKeySigner = yield (0, import_signers.toECDSASigner)({ signer: emptyAccount });
1245
1311
  const {
@@ -1367,7 +1433,7 @@ var ActaAccount = class {
1367
1433
  signer: this.signer
1368
1434
  }
1369
1435
  );
1370
- const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1436
+ const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1371
1437
  const emptyAccount = (0, import_sdk.addressToEmptyAccount)(sessionKeyAddress);
1372
1438
  const emptySessionKeySigner = yield (0, import_signers.toECDSASigner)({ signer: emptyAccount });
1373
1439
  const {
@@ -1473,7 +1539,7 @@ var ActaAccount = class {
1473
1539
  const viemClient = new ViemClient(this.chainId, this.signer);
1474
1540
  const account = yield this.createAccount();
1475
1541
  const { kernelAccountClient, accountClient } = yield this.createAccountHelpers();
1476
- const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1542
+ const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1477
1543
  const emptyAccount = (0, import_sdk.addressToEmptyAccount)(sessionKeyAddress);
1478
1544
  const emptySessionKeySigner = yield (0, import_signers.toECDSASigner)({ signer: emptyAccount });
1479
1545
  const callPolicy = (0, import_policies.toCallPolicy)({
@@ -2153,8 +2219,8 @@ var ActaDeposit = class {
2153
2219
 
2154
2220
  // src/billing.ts
2155
2221
  var import_viem6 = require("viem");
2156
- var billingServiceUrl = "https://api.fhoton.xyz/pay/api/v1/";
2157
- var billingServiceTestUrl = "https://api.fhoton.xyz/pay/test/api/v1/";
2222
+ var billingServiceUrl = "https://api.acta.link/pay/api/v1/";
2223
+ var billingServiceTestUrl = "https://api.acta.link/pay/test/api/v1/";
2158
2224
  var returnEnvUrl2 = (chainId) => {
2159
2225
  const mainnetChain = mainnetChains.find((c) => c.id === chainId);
2160
2226
  const testnetChain = testnetChains.find((c) => c.id === chainId);
@@ -2394,8 +2460,8 @@ var ActaBilling = class {
2394
2460
 
2395
2461
  // src/batch.ts
2396
2462
  var import_viem7 = require("viem");
2397
- var batchServiceUrl = "https://api.fhoton.xyz/bexo/api/v1/";
2398
- var batchServiceTestUrl = "https://api.fhoton.xyz/bexo/test/api/v1/";
2463
+ var batchServiceUrl = "https://api.acta.link/bexo/api/v1/";
2464
+ var batchServiceTestUrl = "https://api.acta.link/bexo/test/api/v1/";
2399
2465
  var returnEnvUrl3 = (chainId) => {
2400
2466
  const mainnetChain = mainnetChains.find((c) => c.id === chainId);
2401
2467
  const testnetChain = testnetChains.find((c) => c.id === chainId);
@@ -2863,10 +2929,10 @@ var import_account_abstraction2 = require("viem/account-abstraction");
2863
2929
  var import_policies2 = require("@zerodev/permissions/policies");
2864
2930
  var import_semver = require("semver");
2865
2931
  var ECDSA_SIGNER_CONTRACT = "0x6A6F069E2a08c2468e7724Ab3250CdBFBA14D4FF";
2866
- var billingServiceUrl2 = "https://api.fhoton.xyz/pay/v1/";
2932
+ var billingServiceUrl2 = "https://api.acta.link/pay/v1/";
2867
2933
  var depositServiceUrl2 = "https://api.acta.link/bexo/v1/";
2868
- var transactionServiceUrl2 = "https://api.fhoton.xyz/transaction/v1/";
2869
- var billingServiceTestUrl2 = "https://api.fhoton.xyz/pay/test/v1/";
2934
+ var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
2935
+ var billingServiceTestUrl2 = "https://api.acta.link/pay/test/v1/";
2870
2936
  var toSignerId = (signer) => {
2871
2937
  return (0, import_viem8.encodeAbiParameters)(
2872
2938
  [{ name: "signerData", type: "bytes" }],