@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 +2 -2
- package/dist/billing.d.cts +1 -1
- package/dist/billing.d.ts +1 -1
- package/dist/browser.cjs +43 -27
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +43 -27
- package/dist/browser.js.map +1 -1
- package/dist/{compute-CdZxISln.d.ts → compute-BcJuIxc1.d.ts} +1 -1
- package/dist/{compute-Dstl0CA0.d.cts → compute-oD9uqLtr.d.cts} +1 -1
- package/dist/compute.cjs +111 -35
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.d.cts +2 -2
- package/dist/compute.d.ts +2 -2
- package/dist/compute.js +111 -35
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-Dk0zwgms.d.cts → helpers-BNGcO-VX.d.cts} +5 -2
- package/dist/{helpers-4w0Iojmm.d.ts → helpers-Cp8qGRTb.d.ts} +5 -2
- package/dist/{index-C0w92tCs.d.cts → index-5y9NG_Id.d.cts} +5 -1
- package/dist/{index-C0w92tCs.d.ts → index-5y9NG_Id.d.ts} +5 -1
- package/dist/index.cjs +111 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +111 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, WalletClient, PublicClient, Hex } from 'viem';
|
|
2
|
-
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-
|
|
2
|
+
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-5y9NG_Id.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create command
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, WalletClient, PublicClient, Hex } from 'viem';
|
|
2
|
-
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-
|
|
2
|
+
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-5y9NG_Id.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create command
|
package/dist/compute.cjs
CHANGED
|
@@ -2336,7 +2336,7 @@ function encodeExecuteBatchData(executions) {
|
|
|
2336
2336
|
});
|
|
2337
2337
|
}
|
|
2338
2338
|
async function estimateBatchGas(options) {
|
|
2339
|
-
const { publicClient, account, executions } = options;
|
|
2339
|
+
const { publicClient, account, executions, authorizationList } = options;
|
|
2340
2340
|
const executeBatchData = encodeExecuteBatchData(executions);
|
|
2341
2341
|
const [gasTipCap, block, estimatedGas] = await Promise.all([
|
|
2342
2342
|
publicClient.estimateMaxPriorityFeePerGas(),
|
|
@@ -2344,7 +2344,8 @@ async function estimateBatchGas(options) {
|
|
|
2344
2344
|
publicClient.estimateGas({
|
|
2345
2345
|
account,
|
|
2346
2346
|
to: account,
|
|
2347
|
-
data: executeBatchData
|
|
2347
|
+
data: executeBatchData,
|
|
2348
|
+
authorizationList
|
|
2348
2349
|
})
|
|
2349
2350
|
]);
|
|
2350
2351
|
const baseFee = block.baseFeePerGas ?? 0n;
|
|
@@ -2367,8 +2368,44 @@ async function checkERC7702Delegation(publicClient, account, delegatorAddress) {
|
|
|
2367
2368
|
const expectedCode = `0xef0100${delegatorAddress.slice(2)}`;
|
|
2368
2369
|
return code.toLowerCase() === expectedCode.toLowerCase();
|
|
2369
2370
|
}
|
|
2371
|
+
async function createAuthorizationList(options) {
|
|
2372
|
+
const { walletClient, publicClient, environmentConfig } = options;
|
|
2373
|
+
const account = walletClient.account;
|
|
2374
|
+
if (!account) {
|
|
2375
|
+
throw new Error("Wallet client must have an account");
|
|
2376
|
+
}
|
|
2377
|
+
const isDelegated2 = await checkERC7702Delegation(
|
|
2378
|
+
publicClient,
|
|
2379
|
+
account.address,
|
|
2380
|
+
environmentConfig.erc7702DelegatorAddress
|
|
2381
|
+
);
|
|
2382
|
+
if (isDelegated2) {
|
|
2383
|
+
return void 0;
|
|
2384
|
+
}
|
|
2385
|
+
const transactionNonce = await publicClient.getTransactionCount({
|
|
2386
|
+
address: account.address,
|
|
2387
|
+
blockTag: "pending"
|
|
2388
|
+
});
|
|
2389
|
+
const chainId = await publicClient.getChainId();
|
|
2390
|
+
const authorizationNonce = transactionNonce + 1;
|
|
2391
|
+
const signedAuthorization = await walletClient.signAuthorization({
|
|
2392
|
+
account,
|
|
2393
|
+
contractAddress: environmentConfig.erc7702DelegatorAddress,
|
|
2394
|
+
chainId,
|
|
2395
|
+
nonce: Number(authorizationNonce)
|
|
2396
|
+
});
|
|
2397
|
+
return [signedAuthorization];
|
|
2398
|
+
}
|
|
2370
2399
|
async function executeBatch(options, logger = noopLogger) {
|
|
2371
|
-
const {
|
|
2400
|
+
const {
|
|
2401
|
+
walletClient,
|
|
2402
|
+
publicClient,
|
|
2403
|
+
environmentConfig,
|
|
2404
|
+
executions,
|
|
2405
|
+
pendingMessage,
|
|
2406
|
+
gas,
|
|
2407
|
+
authorizationList: providedAuthList
|
|
2408
|
+
} = options;
|
|
2372
2409
|
const account = walletClient.account;
|
|
2373
2410
|
if (!account) {
|
|
2374
2411
|
throw new Error("Wallet client must have an account");
|
|
@@ -2378,27 +2415,29 @@ async function executeBatch(options, logger = noopLogger) {
|
|
|
2378
2415
|
throw new Error("Wallet client must have a chain");
|
|
2379
2416
|
}
|
|
2380
2417
|
const executeBatchData = encodeExecuteBatchData(executions);
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2418
|
+
let authorizationList = providedAuthList || [];
|
|
2419
|
+
if (authorizationList.length === 0) {
|
|
2420
|
+
const isDelegated2 = await checkERC7702Delegation(
|
|
2421
|
+
publicClient,
|
|
2422
|
+
account.address,
|
|
2423
|
+
environmentConfig.erc7702DelegatorAddress
|
|
2424
|
+
);
|
|
2425
|
+
if (!isDelegated2) {
|
|
2426
|
+
const transactionNonce = await publicClient.getTransactionCount({
|
|
2427
|
+
address: account.address,
|
|
2428
|
+
blockTag: "pending"
|
|
2429
|
+
});
|
|
2430
|
+
const chainId = await publicClient.getChainId();
|
|
2431
|
+
const authorizationNonce = transactionNonce + 1;
|
|
2432
|
+
logger.debug("Using wallet client signing for EIP-7702 authorization");
|
|
2433
|
+
const signedAuthorization = await walletClient.signAuthorization({
|
|
2434
|
+
account,
|
|
2435
|
+
contractAddress: environmentConfig.erc7702DelegatorAddress,
|
|
2436
|
+
chainId,
|
|
2437
|
+
nonce: Number(authorizationNonce)
|
|
2438
|
+
});
|
|
2439
|
+
authorizationList = [signedAuthorization];
|
|
2440
|
+
}
|
|
2402
2441
|
}
|
|
2403
2442
|
if (pendingMessage) {
|
|
2404
2443
|
logger.info(pendingMessage);
|
|
@@ -2413,6 +2452,9 @@ async function executeBatch(options, logger = noopLogger) {
|
|
|
2413
2452
|
if (authorizationList.length > 0) {
|
|
2414
2453
|
txRequest.authorizationList = authorizationList;
|
|
2415
2454
|
}
|
|
2455
|
+
if (gas?.gasLimit) {
|
|
2456
|
+
txRequest.gas = gas.gasLimit;
|
|
2457
|
+
}
|
|
2416
2458
|
if (gas?.maxFeePerGas) {
|
|
2417
2459
|
txRequest.maxFeePerGas = gas.maxFeePerGas;
|
|
2418
2460
|
}
|
|
@@ -4124,7 +4166,8 @@ async function executeDeployBatch(data, context, gas, logger = noopLogger) {
|
|
|
4124
4166
|
environmentConfig: context.environmentConfig,
|
|
4125
4167
|
executions: data.executions,
|
|
4126
4168
|
pendingMessage,
|
|
4127
|
-
gas
|
|
4169
|
+
gas,
|
|
4170
|
+
authorizationList: data.authorizationList
|
|
4128
4171
|
},
|
|
4129
4172
|
logger
|
|
4130
4173
|
);
|
|
@@ -4235,7 +4278,8 @@ async function executeUpgradeBatch(data, context, gas, logger = noopLogger) {
|
|
|
4235
4278
|
environmentConfig: context.environmentConfig,
|
|
4236
4279
|
executions: data.executions,
|
|
4237
4280
|
pendingMessage,
|
|
4238
|
-
gas
|
|
4281
|
+
gas,
|
|
4282
|
+
authorizationList: data.authorizationList
|
|
4239
4283
|
},
|
|
4240
4284
|
logger
|
|
4241
4285
|
);
|
|
@@ -4461,7 +4505,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4461
4505
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4462
4506
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4463
4507
|
function getDefaultClientId() {
|
|
4464
|
-
const version = true ? "0.3.0-dev" : "0.0.0";
|
|
4508
|
+
const version = true ? "0.3.0-dev.0" : "0.0.0";
|
|
4465
4509
|
return `ecloud-sdk/v${version}`;
|
|
4466
4510
|
}
|
|
4467
4511
|
var UserApiClient = class {
|
|
@@ -5404,16 +5448,24 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
5404
5448
|
},
|
|
5405
5449
|
logger
|
|
5406
5450
|
);
|
|
5451
|
+
logger.debug("Checking delegation status...");
|
|
5452
|
+
const authorizationList = await createAuthorizationList({
|
|
5453
|
+
walletClient: batch.walletClient,
|
|
5454
|
+
publicClient: batch.publicClient,
|
|
5455
|
+
environmentConfig: batch.environmentConfig
|
|
5456
|
+
});
|
|
5407
5457
|
logger.debug("Estimating gas...");
|
|
5408
5458
|
const gasEstimate = await estimateBatchGas({
|
|
5409
5459
|
publicClient: batch.publicClient,
|
|
5410
5460
|
account: batch.walletClient.account.address,
|
|
5411
|
-
executions: batch.executions
|
|
5461
|
+
executions: batch.executions,
|
|
5462
|
+
authorizationList
|
|
5412
5463
|
});
|
|
5413
5464
|
const data = {
|
|
5414
5465
|
appId: batch.appId,
|
|
5415
5466
|
salt: batch.salt,
|
|
5416
|
-
executions: batch.executions
|
|
5467
|
+
executions: batch.executions,
|
|
5468
|
+
authorizationList
|
|
5417
5469
|
};
|
|
5418
5470
|
return {
|
|
5419
5471
|
prepared: {
|
|
@@ -5642,16 +5694,24 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
5642
5694
|
},
|
|
5643
5695
|
logger
|
|
5644
5696
|
);
|
|
5697
|
+
logger.debug("Checking delegation status...");
|
|
5698
|
+
const authorizationList = await createAuthorizationList({
|
|
5699
|
+
walletClient: batch.walletClient,
|
|
5700
|
+
publicClient: batch.publicClient,
|
|
5701
|
+
environmentConfig: batch.environmentConfig
|
|
5702
|
+
});
|
|
5645
5703
|
logger.debug("Estimating gas...");
|
|
5646
5704
|
const gasEstimate = await estimateBatchGas({
|
|
5647
5705
|
publicClient: batch.publicClient,
|
|
5648
5706
|
account: batch.walletClient.account.address,
|
|
5649
|
-
executions: batch.executions
|
|
5707
|
+
executions: batch.executions,
|
|
5708
|
+
authorizationList
|
|
5650
5709
|
});
|
|
5651
5710
|
const data = {
|
|
5652
5711
|
appId: batch.appId,
|
|
5653
5712
|
salt: batch.salt,
|
|
5654
|
-
executions: batch.executions
|
|
5713
|
+
executions: batch.executions,
|
|
5714
|
+
authorizationList
|
|
5655
5715
|
};
|
|
5656
5716
|
return {
|
|
5657
5717
|
prepared: {
|
|
@@ -5782,15 +5842,23 @@ async function prepareUpgradeFromVerifiableBuild(options, logger = defaultLogger
|
|
|
5782
5842
|
needsPermissionChange,
|
|
5783
5843
|
imageRef: options.imageRef
|
|
5784
5844
|
});
|
|
5845
|
+
logger.debug("Checking delegation status...");
|
|
5846
|
+
const authorizationList = await createAuthorizationList({
|
|
5847
|
+
walletClient: batch.walletClient,
|
|
5848
|
+
publicClient: batch.publicClient,
|
|
5849
|
+
environmentConfig: batch.environmentConfig
|
|
5850
|
+
});
|
|
5785
5851
|
logger.debug("Estimating gas...");
|
|
5786
5852
|
const gasEstimate = await estimateBatchGas({
|
|
5787
5853
|
publicClient: batch.publicClient,
|
|
5788
5854
|
account: batch.walletClient.account.address,
|
|
5789
|
-
executions: batch.executions
|
|
5855
|
+
executions: batch.executions,
|
|
5856
|
+
authorizationList
|
|
5790
5857
|
});
|
|
5791
5858
|
const data = {
|
|
5792
5859
|
appId: batch.appId,
|
|
5793
|
-
executions: batch.executions
|
|
5860
|
+
executions: batch.executions,
|
|
5861
|
+
authorizationList
|
|
5794
5862
|
};
|
|
5795
5863
|
return {
|
|
5796
5864
|
prepared: {
|
|
@@ -5963,15 +6031,23 @@ async function prepareUpgrade(options, logger = defaultLogger) {
|
|
|
5963
6031
|
needsPermissionChange,
|
|
5964
6032
|
imageRef: finalImageRef
|
|
5965
6033
|
});
|
|
6034
|
+
logger.debug("Checking delegation status...");
|
|
6035
|
+
const authorizationList = await createAuthorizationList({
|
|
6036
|
+
walletClient: batch.walletClient,
|
|
6037
|
+
publicClient: batch.publicClient,
|
|
6038
|
+
environmentConfig: batch.environmentConfig
|
|
6039
|
+
});
|
|
5966
6040
|
logger.debug("Estimating gas...");
|
|
5967
6041
|
const gasEstimate = await estimateBatchGas({
|
|
5968
6042
|
publicClient: batch.publicClient,
|
|
5969
6043
|
account: batch.walletClient.account.address,
|
|
5970
|
-
executions: batch.executions
|
|
6044
|
+
executions: batch.executions,
|
|
6045
|
+
authorizationList
|
|
5971
6046
|
});
|
|
5972
6047
|
const data = {
|
|
5973
6048
|
appId: batch.appId,
|
|
5974
|
-
executions: batch.executions
|
|
6049
|
+
executions: batch.executions,
|
|
6050
|
+
authorizationList
|
|
5975
6051
|
};
|
|
5976
6052
|
return {
|
|
5977
6053
|
prepared: {
|