@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
package/dist/compute.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-
|
|
1
|
+
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-oD9uqLtr.cjs';
|
|
2
2
|
import 'viem';
|
|
3
|
-
import './index-
|
|
3
|
+
import './index-5y9NG_Id.cjs';
|
package/dist/compute.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-
|
|
1
|
+
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-BcJuIxc1.js';
|
|
2
2
|
import 'viem';
|
|
3
|
-
import './index-
|
|
3
|
+
import './index-5y9NG_Id.js';
|
package/dist/compute.js
CHANGED
|
@@ -2297,7 +2297,7 @@ function encodeExecuteBatchData(executions) {
|
|
|
2297
2297
|
});
|
|
2298
2298
|
}
|
|
2299
2299
|
async function estimateBatchGas(options) {
|
|
2300
|
-
const { publicClient, account, executions } = options;
|
|
2300
|
+
const { publicClient, account, executions, authorizationList } = options;
|
|
2301
2301
|
const executeBatchData = encodeExecuteBatchData(executions);
|
|
2302
2302
|
const [gasTipCap, block, estimatedGas] = await Promise.all([
|
|
2303
2303
|
publicClient.estimateMaxPriorityFeePerGas(),
|
|
@@ -2305,7 +2305,8 @@ async function estimateBatchGas(options) {
|
|
|
2305
2305
|
publicClient.estimateGas({
|
|
2306
2306
|
account,
|
|
2307
2307
|
to: account,
|
|
2308
|
-
data: executeBatchData
|
|
2308
|
+
data: executeBatchData,
|
|
2309
|
+
authorizationList
|
|
2309
2310
|
})
|
|
2310
2311
|
]);
|
|
2311
2312
|
const baseFee = block.baseFeePerGas ?? 0n;
|
|
@@ -2328,8 +2329,44 @@ async function checkERC7702Delegation(publicClient, account, delegatorAddress) {
|
|
|
2328
2329
|
const expectedCode = `0xef0100${delegatorAddress.slice(2)}`;
|
|
2329
2330
|
return code.toLowerCase() === expectedCode.toLowerCase();
|
|
2330
2331
|
}
|
|
2332
|
+
async function createAuthorizationList(options) {
|
|
2333
|
+
const { walletClient, publicClient, environmentConfig } = options;
|
|
2334
|
+
const account = walletClient.account;
|
|
2335
|
+
if (!account) {
|
|
2336
|
+
throw new Error("Wallet client must have an account");
|
|
2337
|
+
}
|
|
2338
|
+
const isDelegated2 = await checkERC7702Delegation(
|
|
2339
|
+
publicClient,
|
|
2340
|
+
account.address,
|
|
2341
|
+
environmentConfig.erc7702DelegatorAddress
|
|
2342
|
+
);
|
|
2343
|
+
if (isDelegated2) {
|
|
2344
|
+
return void 0;
|
|
2345
|
+
}
|
|
2346
|
+
const transactionNonce = await publicClient.getTransactionCount({
|
|
2347
|
+
address: account.address,
|
|
2348
|
+
blockTag: "pending"
|
|
2349
|
+
});
|
|
2350
|
+
const chainId = await publicClient.getChainId();
|
|
2351
|
+
const authorizationNonce = transactionNonce + 1;
|
|
2352
|
+
const signedAuthorization = await walletClient.signAuthorization({
|
|
2353
|
+
account,
|
|
2354
|
+
contractAddress: environmentConfig.erc7702DelegatorAddress,
|
|
2355
|
+
chainId,
|
|
2356
|
+
nonce: Number(authorizationNonce)
|
|
2357
|
+
});
|
|
2358
|
+
return [signedAuthorization];
|
|
2359
|
+
}
|
|
2331
2360
|
async function executeBatch(options, logger = noopLogger) {
|
|
2332
|
-
const {
|
|
2361
|
+
const {
|
|
2362
|
+
walletClient,
|
|
2363
|
+
publicClient,
|
|
2364
|
+
environmentConfig,
|
|
2365
|
+
executions,
|
|
2366
|
+
pendingMessage,
|
|
2367
|
+
gas,
|
|
2368
|
+
authorizationList: providedAuthList
|
|
2369
|
+
} = options;
|
|
2333
2370
|
const account = walletClient.account;
|
|
2334
2371
|
if (!account) {
|
|
2335
2372
|
throw new Error("Wallet client must have an account");
|
|
@@ -2339,27 +2376,29 @@ async function executeBatch(options, logger = noopLogger) {
|
|
|
2339
2376
|
throw new Error("Wallet client must have a chain");
|
|
2340
2377
|
}
|
|
2341
2378
|
const executeBatchData = encodeExecuteBatchData(executions);
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2379
|
+
let authorizationList = providedAuthList || [];
|
|
2380
|
+
if (authorizationList.length === 0) {
|
|
2381
|
+
const isDelegated2 = await checkERC7702Delegation(
|
|
2382
|
+
publicClient,
|
|
2383
|
+
account.address,
|
|
2384
|
+
environmentConfig.erc7702DelegatorAddress
|
|
2385
|
+
);
|
|
2386
|
+
if (!isDelegated2) {
|
|
2387
|
+
const transactionNonce = await publicClient.getTransactionCount({
|
|
2388
|
+
address: account.address,
|
|
2389
|
+
blockTag: "pending"
|
|
2390
|
+
});
|
|
2391
|
+
const chainId = await publicClient.getChainId();
|
|
2392
|
+
const authorizationNonce = transactionNonce + 1;
|
|
2393
|
+
logger.debug("Using wallet client signing for EIP-7702 authorization");
|
|
2394
|
+
const signedAuthorization = await walletClient.signAuthorization({
|
|
2395
|
+
account,
|
|
2396
|
+
contractAddress: environmentConfig.erc7702DelegatorAddress,
|
|
2397
|
+
chainId,
|
|
2398
|
+
nonce: Number(authorizationNonce)
|
|
2399
|
+
});
|
|
2400
|
+
authorizationList = [signedAuthorization];
|
|
2401
|
+
}
|
|
2363
2402
|
}
|
|
2364
2403
|
if (pendingMessage) {
|
|
2365
2404
|
logger.info(pendingMessage);
|
|
@@ -2374,6 +2413,9 @@ async function executeBatch(options, logger = noopLogger) {
|
|
|
2374
2413
|
if (authorizationList.length > 0) {
|
|
2375
2414
|
txRequest.authorizationList = authorizationList;
|
|
2376
2415
|
}
|
|
2416
|
+
if (gas?.gasLimit) {
|
|
2417
|
+
txRequest.gas = gas.gasLimit;
|
|
2418
|
+
}
|
|
2377
2419
|
if (gas?.maxFeePerGas) {
|
|
2378
2420
|
txRequest.maxFeePerGas = gas.maxFeePerGas;
|
|
2379
2421
|
}
|
|
@@ -4085,7 +4127,8 @@ async function executeDeployBatch(data, context, gas, logger = noopLogger) {
|
|
|
4085
4127
|
environmentConfig: context.environmentConfig,
|
|
4086
4128
|
executions: data.executions,
|
|
4087
4129
|
pendingMessage,
|
|
4088
|
-
gas
|
|
4130
|
+
gas,
|
|
4131
|
+
authorizationList: data.authorizationList
|
|
4089
4132
|
},
|
|
4090
4133
|
logger
|
|
4091
4134
|
);
|
|
@@ -4196,7 +4239,8 @@ async function executeUpgradeBatch(data, context, gas, logger = noopLogger) {
|
|
|
4196
4239
|
environmentConfig: context.environmentConfig,
|
|
4197
4240
|
executions: data.executions,
|
|
4198
4241
|
pendingMessage,
|
|
4199
|
-
gas
|
|
4242
|
+
gas,
|
|
4243
|
+
authorizationList: data.authorizationList
|
|
4200
4244
|
},
|
|
4201
4245
|
logger
|
|
4202
4246
|
);
|
|
@@ -4422,7 +4466,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4422
4466
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4423
4467
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4424
4468
|
function getDefaultClientId() {
|
|
4425
|
-
const version = true ? "0.3.0-dev" : "0.0.0";
|
|
4469
|
+
const version = true ? "0.3.0-dev.0" : "0.0.0";
|
|
4426
4470
|
return `ecloud-sdk/v${version}`;
|
|
4427
4471
|
}
|
|
4428
4472
|
var UserApiClient = class {
|
|
@@ -5365,16 +5409,24 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
5365
5409
|
},
|
|
5366
5410
|
logger
|
|
5367
5411
|
);
|
|
5412
|
+
logger.debug("Checking delegation status...");
|
|
5413
|
+
const authorizationList = await createAuthorizationList({
|
|
5414
|
+
walletClient: batch.walletClient,
|
|
5415
|
+
publicClient: batch.publicClient,
|
|
5416
|
+
environmentConfig: batch.environmentConfig
|
|
5417
|
+
});
|
|
5368
5418
|
logger.debug("Estimating gas...");
|
|
5369
5419
|
const gasEstimate = await estimateBatchGas({
|
|
5370
5420
|
publicClient: batch.publicClient,
|
|
5371
5421
|
account: batch.walletClient.account.address,
|
|
5372
|
-
executions: batch.executions
|
|
5422
|
+
executions: batch.executions,
|
|
5423
|
+
authorizationList
|
|
5373
5424
|
});
|
|
5374
5425
|
const data = {
|
|
5375
5426
|
appId: batch.appId,
|
|
5376
5427
|
salt: batch.salt,
|
|
5377
|
-
executions: batch.executions
|
|
5428
|
+
executions: batch.executions,
|
|
5429
|
+
authorizationList
|
|
5378
5430
|
};
|
|
5379
5431
|
return {
|
|
5380
5432
|
prepared: {
|
|
@@ -5603,16 +5655,24 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
5603
5655
|
},
|
|
5604
5656
|
logger
|
|
5605
5657
|
);
|
|
5658
|
+
logger.debug("Checking delegation status...");
|
|
5659
|
+
const authorizationList = await createAuthorizationList({
|
|
5660
|
+
walletClient: batch.walletClient,
|
|
5661
|
+
publicClient: batch.publicClient,
|
|
5662
|
+
environmentConfig: batch.environmentConfig
|
|
5663
|
+
});
|
|
5606
5664
|
logger.debug("Estimating gas...");
|
|
5607
5665
|
const gasEstimate = await estimateBatchGas({
|
|
5608
5666
|
publicClient: batch.publicClient,
|
|
5609
5667
|
account: batch.walletClient.account.address,
|
|
5610
|
-
executions: batch.executions
|
|
5668
|
+
executions: batch.executions,
|
|
5669
|
+
authorizationList
|
|
5611
5670
|
});
|
|
5612
5671
|
const data = {
|
|
5613
5672
|
appId: batch.appId,
|
|
5614
5673
|
salt: batch.salt,
|
|
5615
|
-
executions: batch.executions
|
|
5674
|
+
executions: batch.executions,
|
|
5675
|
+
authorizationList
|
|
5616
5676
|
};
|
|
5617
5677
|
return {
|
|
5618
5678
|
prepared: {
|
|
@@ -5743,15 +5803,23 @@ async function prepareUpgradeFromVerifiableBuild(options, logger = defaultLogger
|
|
|
5743
5803
|
needsPermissionChange,
|
|
5744
5804
|
imageRef: options.imageRef
|
|
5745
5805
|
});
|
|
5806
|
+
logger.debug("Checking delegation status...");
|
|
5807
|
+
const authorizationList = await createAuthorizationList({
|
|
5808
|
+
walletClient: batch.walletClient,
|
|
5809
|
+
publicClient: batch.publicClient,
|
|
5810
|
+
environmentConfig: batch.environmentConfig
|
|
5811
|
+
});
|
|
5746
5812
|
logger.debug("Estimating gas...");
|
|
5747
5813
|
const gasEstimate = await estimateBatchGas({
|
|
5748
5814
|
publicClient: batch.publicClient,
|
|
5749
5815
|
account: batch.walletClient.account.address,
|
|
5750
|
-
executions: batch.executions
|
|
5816
|
+
executions: batch.executions,
|
|
5817
|
+
authorizationList
|
|
5751
5818
|
});
|
|
5752
5819
|
const data = {
|
|
5753
5820
|
appId: batch.appId,
|
|
5754
|
-
executions: batch.executions
|
|
5821
|
+
executions: batch.executions,
|
|
5822
|
+
authorizationList
|
|
5755
5823
|
};
|
|
5756
5824
|
return {
|
|
5757
5825
|
prepared: {
|
|
@@ -5924,15 +5992,23 @@ async function prepareUpgrade(options, logger = defaultLogger) {
|
|
|
5924
5992
|
needsPermissionChange,
|
|
5925
5993
|
imageRef: finalImageRef
|
|
5926
5994
|
});
|
|
5995
|
+
logger.debug("Checking delegation status...");
|
|
5996
|
+
const authorizationList = await createAuthorizationList({
|
|
5997
|
+
walletClient: batch.walletClient,
|
|
5998
|
+
publicClient: batch.publicClient,
|
|
5999
|
+
environmentConfig: batch.environmentConfig
|
|
6000
|
+
});
|
|
5927
6001
|
logger.debug("Estimating gas...");
|
|
5928
6002
|
const gasEstimate = await estimateBatchGas({
|
|
5929
6003
|
publicClient: batch.publicClient,
|
|
5930
6004
|
account: batch.walletClient.account.address,
|
|
5931
|
-
executions: batch.executions
|
|
6005
|
+
executions: batch.executions,
|
|
6006
|
+
authorizationList
|
|
5932
6007
|
});
|
|
5933
6008
|
const data = {
|
|
5934
6009
|
appId: batch.appId,
|
|
5935
|
-
executions: batch.executions
|
|
6010
|
+
executions: batch.executions,
|
|
6011
|
+
authorizationList
|
|
5936
6012
|
};
|
|
5937
6013
|
return {
|
|
5938
6014
|
prepared: {
|