@layr-labs/ecloud-sdk 0.3.0-dev → 0.3.0-dev.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.
package/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- version=0.3.0-dev
2
- commit=f66f41c4db37c3eb732f093499934884d8132a71
1
+ version=0.3.0-dev.0
2
+ commit=4ffabfbc6a4689a4d7f3c2ff795c48873c5b080d
@@ -1,5 +1,5 @@
1
1
  import { Address, WalletClient } from 'viem';
2
- import { as as SubscriptionOpts, an as SubscribeResponse, ar as ProductSubscriptionResponse, aq as CancelResponse } from './index-C0w92tCs.cjs';
2
+ import { as as SubscriptionOpts, an as SubscribeResponse, ar as ProductSubscriptionResponse, aq as CancelResponse } from './index-5y9NG_Id.cjs';
3
3
 
4
4
  /**
5
5
  * Main Billing namespace entry point
package/dist/billing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Address, WalletClient } from 'viem';
2
- import { as as SubscriptionOpts, an as SubscribeResponse, ar as ProductSubscriptionResponse, aq as CancelResponse } from './index-C0w92tCs.js';
2
+ import { as as SubscriptionOpts, an as SubscribeResponse, ar as ProductSubscriptionResponse, aq as CancelResponse } from './index-5y9NG_Id.js';
3
3
 
4
4
  /**
5
5
  * Main Billing namespace entry point
package/dist/browser.cjs CHANGED
@@ -676,7 +676,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
676
676
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
677
677
  var CanUpdateAppProfilePermission = "0x036fef61";
678
678
  function getDefaultClientId() {
679
- const version = true ? "0.3.0-dev" : "0.0.0";
679
+ const version = true ? "0.3.0-dev.0" : "0.0.0";
680
680
  return `ecloud-sdk/v${version}`;
681
681
  }
682
682
  var UserApiClient = class {
@@ -2648,7 +2648,7 @@ function encodeExecuteBatchData(executions) {
2648
2648
  });
2649
2649
  }
2650
2650
  async function estimateBatchGas(options) {
2651
- const { publicClient, account, executions } = options;
2651
+ const { publicClient, account, executions, authorizationList } = options;
2652
2652
  const executeBatchData = encodeExecuteBatchData(executions);
2653
2653
  const [gasTipCap, block, estimatedGas] = await Promise.all([
2654
2654
  publicClient.estimateMaxPriorityFeePerGas(),
@@ -2656,7 +2656,8 @@ async function estimateBatchGas(options) {
2656
2656
  publicClient.estimateGas({
2657
2657
  account,
2658
2658
  to: account,
2659
- data: executeBatchData
2659
+ data: executeBatchData,
2660
+ authorizationList
2660
2661
  })
2661
2662
  ]);
2662
2663
  const baseFee = block.baseFeePerGas ?? 0n;
@@ -2680,7 +2681,15 @@ async function checkERC7702Delegation(publicClient, account, delegatorAddress) {
2680
2681
  return code.toLowerCase() === expectedCode.toLowerCase();
2681
2682
  }
2682
2683
  async function executeBatch(options, logger = noopLogger) {
2683
- const { walletClient, publicClient, environmentConfig, executions, pendingMessage, gas } = options;
2684
+ const {
2685
+ walletClient,
2686
+ publicClient,
2687
+ environmentConfig,
2688
+ executions,
2689
+ pendingMessage,
2690
+ gas,
2691
+ authorizationList: providedAuthList
2692
+ } = options;
2684
2693
  const account = walletClient.account;
2685
2694
  if (!account) {
2686
2695
  throw new Error("Wallet client must have an account");
@@ -2690,27 +2699,29 @@ async function executeBatch(options, logger = noopLogger) {
2690
2699
  throw new Error("Wallet client must have a chain");
2691
2700
  }
2692
2701
  const executeBatchData = encodeExecuteBatchData(executions);
2693
- const isDelegated2 = await checkERC7702Delegation(
2694
- publicClient,
2695
- account.address,
2696
- environmentConfig.erc7702DelegatorAddress
2697
- );
2698
- let authorizationList = [];
2699
- if (!isDelegated2) {
2700
- const transactionNonce = await publicClient.getTransactionCount({
2701
- address: account.address,
2702
- blockTag: "pending"
2703
- });
2704
- const chainId = await publicClient.getChainId();
2705
- const authorizationNonce = transactionNonce + 1;
2706
- logger.debug("Using wallet client signing for EIP-7702 authorization");
2707
- const signedAuthorization = await walletClient.signAuthorization({
2708
- account: account.address,
2709
- contractAddress: environmentConfig.erc7702DelegatorAddress,
2710
- chainId,
2711
- nonce: Number(authorizationNonce)
2712
- });
2713
- authorizationList = [signedAuthorization];
2702
+ let authorizationList = providedAuthList || [];
2703
+ if (authorizationList.length === 0) {
2704
+ const isDelegated2 = await checkERC7702Delegation(
2705
+ publicClient,
2706
+ account.address,
2707
+ environmentConfig.erc7702DelegatorAddress
2708
+ );
2709
+ if (!isDelegated2) {
2710
+ const transactionNonce = await publicClient.getTransactionCount({
2711
+ address: account.address,
2712
+ blockTag: "pending"
2713
+ });
2714
+ const chainId = await publicClient.getChainId();
2715
+ const authorizationNonce = transactionNonce + 1;
2716
+ logger.debug("Using wallet client signing for EIP-7702 authorization");
2717
+ const signedAuthorization = await walletClient.signAuthorization({
2718
+ account,
2719
+ contractAddress: environmentConfig.erc7702DelegatorAddress,
2720
+ chainId,
2721
+ nonce: Number(authorizationNonce)
2722
+ });
2723
+ authorizationList = [signedAuthorization];
2724
+ }
2714
2725
  }
2715
2726
  if (pendingMessage) {
2716
2727
  logger.info(pendingMessage);
@@ -2725,6 +2736,9 @@ async function executeBatch(options, logger = noopLogger) {
2725
2736
  if (authorizationList.length > 0) {
2726
2737
  txRequest.authorizationList = authorizationList;
2727
2738
  }
2739
+ if (gas?.gasLimit) {
2740
+ txRequest.gas = gas.gasLimit;
2741
+ }
2728
2742
  if (gas?.maxFeePerGas) {
2729
2743
  txRequest.maxFeePerGas = gas.maxFeePerGas;
2730
2744
  }
@@ -4442,7 +4456,8 @@ async function executeDeployBatch(data, context, gas, logger = noopLogger) {
4442
4456
  environmentConfig: context.environmentConfig,
4443
4457
  executions: data.executions,
4444
4458
  pendingMessage,
4445
- gas
4459
+ gas,
4460
+ authorizationList: data.authorizationList
4446
4461
  },
4447
4462
  logger
4448
4463
  );
@@ -4721,7 +4736,8 @@ async function executeUpgradeBatch(data, context, gas, logger = noopLogger) {
4721
4736
  environmentConfig: context.environmentConfig,
4722
4737
  executions: data.executions,
4723
4738
  pendingMessage,
4724
- gas
4739
+ gas,
4740
+ authorizationList: data.authorizationList
4725
4741
  },
4726
4742
  logger
4727
4743
  );