@layr-labs/ecloud-sdk 1.0.0-dev.6 → 1.0.0-dev.8

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
@@ -425,7 +425,74 @@ var PushPermissionError = class extends Error {
425
425
  import Handlebars from "handlebars";
426
426
 
427
427
  // src/client/common/templates/Dockerfile.layered.tmpl
428
- var Dockerfile_layered_default = '{{#if includeTLS}}\n# Get Caddy from official image\nFROM caddy:2.10.2-alpine AS caddy\n{{/if}}\n\nFROM {{baseImage}}\n\n{{#if originalUser}}\n# Switch to root to perform setup (base image has non-root USER: {{originalUser}})\nUSER root\n{{/if}}\n\n# Copy core TEE components\nCOPY compute-source-env.sh /usr/local/bin/\nCOPY kms-client /usr/local/bin/\nCOPY kms-signing-public-key.pem /usr/local/bin/\n\n{{#if includeTLS}}\n# Copy Caddy from official image\nCOPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy\n\n# Copy TLS components\nCOPY tls-keygen /usr/local/bin/\nCOPY Caddyfile /etc/caddy/\n{{/if}}\n\n{{#if originalUser}}\n# Make binaries executable (755 for executables, 644 for keys)\nRUN chmod 755 /usr/local/bin/compute-source-env.sh \\\n && chmod 755 /usr/local/bin/kms-client{{#if includeTLS}} \\\n && chmod 755 /usr/local/bin/tls-keygen \\\n && chmod 755 /usr/local/bin/caddy{{/if}} \\\n && chmod 644 /usr/local/bin/kms-signing-public-key.pem\n\n# Store original user - entrypoint will drop privileges to this user after TEE setup\nENV __ECLOUD_ORIGINAL_USER={{originalUser}}\n{{else}}\n# Make binaries executable (preserve existing permissions, just add execute)\nRUN chmod +x /usr/local/bin/compute-source-env.sh \\\n && chmod +x /usr/local/bin/kms-client{{#if includeTLS}} \\\n && chmod +x /usr/local/bin/tls-keygen{{/if}}\n{{/if}}\n\n{{#if logRedirect}}\n\nLABEL tee.launch_policy.log_redirect={{logRedirect}}\n{{/if}}\n{{#if resourceUsageAllow}}\n\nLABEL tee.launch_policy.monitoring_memory_allow={{resourceUsageAllow}}\n{{/if}}\n\nLABEL eigenx_cli_version={{ecloudCLIVersion}}\nLABEL eigenx_vm_image=eigen\n\n{{#if includeTLS}}\n# Expose both HTTP and HTTPS ports for Caddy\nEXPOSE 80 443\n{{/if}}\n\nENTRYPOINT ["/usr/local/bin/compute-source-env.sh"]\nCMD {{{originalCmd}}}\n';
428
+ var Dockerfile_layered_default = `{{#if includeTLS}}
429
+ # Get Caddy from official image
430
+ FROM caddy:2.10.2-alpine AS caddy
431
+ {{/if}}
432
+
433
+ FROM {{baseImage}}
434
+
435
+ {{#if originalUser}}
436
+ # Switch to root to perform setup (base image has non-root USER: {{originalUser}})
437
+ USER root
438
+ {{/if}}
439
+
440
+ # Copy core TEE components
441
+ # CA bundle for kms-client / tls-keygen to validate HTTPS calls to
442
+ # eigencloud.xyz endpoints. Bundled at a non-standard path and consumed
443
+ # only via SSL_CERT_FILE in compute-source-env.sh, so the user's
444
+ # /etc/ssl/ is never touched.
445
+ COPY --from=alpine:3.20.10 /etc/ssl/certs/ca-certificates.crt /usr/local/share/eigenx-ca-certs.crt
446
+ COPY compute-source-env.sh /usr/local/bin/
447
+ COPY kms-client /usr/local/bin/
448
+ COPY kms-signing-public-key.pem /usr/local/bin/
449
+
450
+ {{#if includeTLS}}
451
+ # Copy Caddy from official image
452
+ COPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy
453
+
454
+ # Copy TLS components
455
+ COPY tls-keygen /usr/local/bin/
456
+ COPY Caddyfile /etc/caddy/
457
+ {{/if}}
458
+
459
+ {{#if originalUser}}
460
+ # Make binaries executable (755 for executables, 644 for keys)
461
+ RUN chmod 755 /usr/local/bin/compute-source-env.sh \\
462
+ && chmod 755 /usr/local/bin/kms-client{{#if includeTLS}} \\
463
+ && chmod 755 /usr/local/bin/tls-keygen \\
464
+ && chmod 755 /usr/local/bin/caddy{{/if}} \\
465
+ && chmod 644 /usr/local/bin/kms-signing-public-key.pem
466
+
467
+ # Store original user - entrypoint will drop privileges to this user after TEE setup
468
+ ENV __ECLOUD_ORIGINAL_USER={{originalUser}}
469
+ {{else}}
470
+ # Make binaries executable (preserve existing permissions, just add execute)
471
+ RUN chmod +x /usr/local/bin/compute-source-env.sh \\
472
+ && chmod +x /usr/local/bin/kms-client{{#if includeTLS}} \\
473
+ && chmod +x /usr/local/bin/tls-keygen{{/if}}
474
+ {{/if}}
475
+
476
+ {{#if logRedirect}}
477
+
478
+ LABEL tee.launch_policy.log_redirect={{logRedirect}}
479
+ {{/if}}
480
+ {{#if resourceUsageAllow}}
481
+
482
+ LABEL tee.launch_policy.monitoring_memory_allow={{resourceUsageAllow}}
483
+ {{/if}}
484
+
485
+ LABEL eigenx_cli_version={{ecloudCLIVersion}}
486
+ LABEL eigenx_vm_image=eigen
487
+
488
+ {{#if includeTLS}}
489
+ # Expose both HTTP and HTTPS ports for Caddy
490
+ EXPOSE 80 443
491
+ {{/if}}
492
+
493
+ ENTRYPOINT ["/usr/local/bin/compute-source-env.sh"]
494
+ CMD {{{originalCmd}}}
495
+ `;
429
496
 
430
497
  // src/client/common/templates/dockerfileTemplate.ts
431
498
  function processDockerfileTemplate(data) {
@@ -442,7 +509,7 @@ echo "compute-source-env.sh: Running setup script..."
442
509
 
443
510
  # Fetch and source environment variables from KMS
444
511
  echo "Fetching secrets from KMS..."
445
- if /usr/local/bin/kms-client \\
512
+ if SSL_CERT_FILE=/usr/local/share/eigenx-ca-certs.crt /usr/local/bin/kms-client \\
446
513
  --kms-server-url "{{kmsServerURL}}" \\
447
514
  --kms-signing-key-file /usr/local/bin/kms-signing-public-key.pem \\
448
515
  --userapi-url "{{userAPIURL}}" \\
@@ -500,7 +567,8 @@ setup_tls() {
500
567
 
501
568
  echo "compute-source-env.sh: Obtaining TLS certificate using $challenge challenge..."
502
569
  # Pass the API URL for certificate persistence
503
- if ! MNEMONIC="$mnemonic" DOMAIN="$domain" API_URL="{{userAPIURL}}" /usr/local/bin/tls-keygen \\
570
+ if ! SSL_CERT_FILE=/usr/local/share/eigenx-ca-certs.crt \\
571
+ MNEMONIC="$mnemonic" DOMAIN="$domain" API_URL="{{userAPIURL}}" /usr/local/bin/tls-keygen \\
504
572
  -challenge "$challenge" \\
505
573
  $staging_flag; then
506
574
  echo "compute-source-env.sh: ERROR - Failed to obtain TLS certificate"
@@ -892,16 +960,7 @@ async function extractDigestFromSinglePlatform(manifest, imageRef) {
892
960
  architecture: inspectData[0].Architecture
893
961
  } : null;
894
962
  if (!config) {
895
- if (manifest.config?.digest) {
896
- const digest = hexStringToBytes32(manifest.config.digest);
897
- const registry = extractRegistryName(imageRef);
898
- return {
899
- digest,
900
- registry,
901
- platform: DOCKER_PLATFORM
902
- };
903
- }
904
- throw new Error(`Could not determine platform for ${imageRef}`);
963
+ throw createPlatformErrorMessage(imageRef, ["unknown (could not determine architecture)"]);
905
964
  }
906
965
  const platform2 = `${config.os}/${config.architecture}`;
907
966
  if (platform2 === DOCKER_PLATFORM) {
@@ -973,14 +1032,11 @@ Image: ${imageRef}
973
1032
  Found platform(s): ${platforms.join(", ")}
974
1033
  Required platform: ${DOCKER_PLATFORM}
975
1034
 
976
- To fix this issue:
977
- 1. Manual fix:
978
- a. Rebuild your image with the correct platform:
979
- docker build --platform ${DOCKER_PLATFORM} -t ${imageRef} .
980
- b. Push the rebuilt image to your remote registry:
981
- docker push ${imageRef}
982
-
983
- 2. Or use the SDK to build with the correct platform automatically.`;
1035
+ To fix, either:
1036
+ 1. Rebuild the image for ${DOCKER_PLATFORM} and push it:
1037
+ docker buildx build --platform ${DOCKER_PLATFORM} -t ${imageRef} --push .
1038
+ 2. Or use a verifiable build (--verifiable --repo <repo> --commit <sha>), which
1039
+ builds server-side and needs no local Docker.`;
984
1040
  return new Error(errorMsg);
985
1041
  }
986
1042
 
@@ -1085,6 +1141,8 @@ async function prepareRelease(options, logger) {
1085
1141
  logger.info(`Waiting ${REGISTRY_PROPAGATION_WAIT_SECONDS} seconds for registry propagation...`);
1086
1142
  await new Promise((resolve2) => setTimeout(resolve2, REGISTRY_PROPAGATION_WAIT_SECONDS * 1e3));
1087
1143
  } else {
1144
+ logger.info("Verifying image platform (linux/amd64)...");
1145
+ await getImageDigestAndName(imageRef);
1088
1146
  logger.info("Checking if image needs layering...");
1089
1147
  finalImageRef = await layerRemoteImageIfNeeded(
1090
1148
  {
@@ -1243,6 +1301,13 @@ function extractRegistryNameNoDocker(imageRef) {
1243
1301
  import { encodeFunctionData, encodeAbiParameters, decodeErrorResult } from "viem";
1244
1302
 
1245
1303
  // src/client/common/types/index.ts
1304
+ var EMPTY_CONTAINER_POLICY = {
1305
+ args: [],
1306
+ cmdOverride: [],
1307
+ env: [],
1308
+ envOverride: [],
1309
+ restartPolicy: ""
1310
+ };
1246
1311
  var noopLogger = {
1247
1312
  debug: () => {
1248
1313
  },
@@ -2483,49 +2548,1594 @@ async function executeBatch(options, logger = noopLogger) {
2483
2548
  } else {
2484
2549
  revertReason = callError.message || "Unknown reason";
2485
2550
  }
2486
- }
2487
- throw new Error(`Transaction reverted: ${hash}. Reason: ${revertReason}`);
2551
+ }
2552
+ throw new Error(`Transaction reverted: ${hash}. Reason: ${revertReason}`);
2553
+ }
2554
+ return hash;
2555
+ }
2556
+
2557
+ // src/client/common/contract/caller.ts
2558
+ import { encodeFunctionData as encodeFunctionData2, decodeErrorResult as decodeErrorResult2, bytesToHex } from "viem";
2559
+
2560
+ // src/client/common/utils/helpers.ts
2561
+ import { extractChain, createPublicClient, createWalletClient, http, fallback } from "viem";
2562
+ import { sepolia as sepolia2 } from "viem/chains";
2563
+ import { privateKeyToAccount } from "viem/accounts";
2564
+ function getChainFromID(chainID, fallback2 = sepolia2) {
2565
+ const id = Number(chainID);
2566
+ return extractChain({ chains: SUPPORTED_CHAINS, id }) || fallback2;
2567
+ }
2568
+ function createClients(options) {
2569
+ const { privateKey, rpcUrl, chainId } = options;
2570
+ const privateKeyHex = addHexPrefix(privateKey);
2571
+ const account = privateKeyToAccount(privateKeyHex);
2572
+ const chain = getChainFromID(chainId);
2573
+ const transport = typeof rpcUrl === "string" ? http(rpcUrl) : fallback(rpcUrl.map((url) => http(url)));
2574
+ const publicClient = createPublicClient({
2575
+ chain,
2576
+ transport
2577
+ });
2578
+ const walletClient = createWalletClient({
2579
+ account,
2580
+ chain,
2581
+ transport
2582
+ });
2583
+ return { walletClient, publicClient };
2584
+ }
2585
+ function addHexPrefix(value) {
2586
+ return value.startsWith("0x") ? value : `0x${value}`;
2587
+ }
2588
+ function stripHexPrefix(value) {
2589
+ return value.startsWith("0x") ? value.slice(2) : value;
2590
+ }
2591
+
2592
+ // src/client/common/abis/AppController.json
2593
+ var AppController_default = [
2594
+ {
2595
+ type: "constructor",
2596
+ inputs: [
2597
+ {
2598
+ name: "_version",
2599
+ type: "string",
2600
+ internalType: "string"
2601
+ },
2602
+ {
2603
+ name: "_permissionController",
2604
+ type: "address",
2605
+ internalType: "contractIPermissionController"
2606
+ },
2607
+ {
2608
+ name: "_releaseManager",
2609
+ type: "address",
2610
+ internalType: "contractIReleaseManager"
2611
+ },
2612
+ {
2613
+ name: "_computeAVSRegistrar",
2614
+ type: "address",
2615
+ internalType: "contractIComputeAVSRegistrar"
2616
+ },
2617
+ {
2618
+ name: "_computeOperator",
2619
+ type: "address",
2620
+ internalType: "contractIComputeOperator"
2621
+ },
2622
+ {
2623
+ name: "_appBeacon",
2624
+ type: "address",
2625
+ internalType: "contractIBeacon"
2626
+ }
2627
+ ],
2628
+ stateMutability: "nonpayable"
2629
+ },
2630
+ {
2631
+ type: "function",
2632
+ name: "API_PERMISSION_TYPEHASH",
2633
+ inputs: [],
2634
+ outputs: [
2635
+ {
2636
+ name: "",
2637
+ type: "bytes32",
2638
+ internalType: "bytes32"
2639
+ }
2640
+ ],
2641
+ stateMutability: "view"
2642
+ },
2643
+ {
2644
+ type: "function",
2645
+ name: "appBeacon",
2646
+ inputs: [],
2647
+ outputs: [
2648
+ {
2649
+ name: "",
2650
+ type: "address",
2651
+ internalType: "contractIBeacon"
2652
+ }
2653
+ ],
2654
+ stateMutability: "view"
2655
+ },
2656
+ {
2657
+ type: "function",
2658
+ name: "calculateApiPermissionDigestHash",
2659
+ inputs: [
2660
+ {
2661
+ name: "permission",
2662
+ type: "bytes4",
2663
+ internalType: "bytes4"
2664
+ },
2665
+ {
2666
+ name: "expiry",
2667
+ type: "uint256",
2668
+ internalType: "uint256"
2669
+ }
2670
+ ],
2671
+ outputs: [
2672
+ {
2673
+ name: "",
2674
+ type: "bytes32",
2675
+ internalType: "bytes32"
2676
+ }
2677
+ ],
2678
+ stateMutability: "view"
2679
+ },
2680
+ {
2681
+ type: "function",
2682
+ name: "calculateAppId",
2683
+ inputs: [
2684
+ {
2685
+ name: "deployer",
2686
+ type: "address",
2687
+ internalType: "address"
2688
+ },
2689
+ {
2690
+ name: "salt",
2691
+ type: "bytes32",
2692
+ internalType: "bytes32"
2693
+ }
2694
+ ],
2695
+ outputs: [
2696
+ {
2697
+ name: "",
2698
+ type: "address",
2699
+ internalType: "contractIApp"
2700
+ }
2701
+ ],
2702
+ stateMutability: "view"
2703
+ },
2704
+ {
2705
+ type: "function",
2706
+ name: "computeAVSRegistrar",
2707
+ inputs: [],
2708
+ outputs: [
2709
+ {
2710
+ name: "",
2711
+ type: "address",
2712
+ internalType: "contractIComputeAVSRegistrar"
2713
+ }
2714
+ ],
2715
+ stateMutability: "view"
2716
+ },
2717
+ {
2718
+ type: "function",
2719
+ name: "computeOperator",
2720
+ inputs: [],
2721
+ outputs: [
2722
+ {
2723
+ name: "",
2724
+ type: "address",
2725
+ internalType: "contractIComputeOperator"
2726
+ }
2727
+ ],
2728
+ stateMutability: "view"
2729
+ },
2730
+ {
2731
+ type: "function",
2732
+ name: "confirmUpgrade",
2733
+ inputs: [
2734
+ {
2735
+ name: "app",
2736
+ type: "address",
2737
+ internalType: "contractIApp"
2738
+ }
2739
+ ],
2740
+ outputs: [],
2741
+ stateMutability: "nonpayable"
2742
+ },
2743
+ {
2744
+ type: "function",
2745
+ name: "createApp",
2746
+ inputs: [
2747
+ {
2748
+ name: "salt",
2749
+ type: "bytes32",
2750
+ internalType: "bytes32"
2751
+ },
2752
+ {
2753
+ name: "release",
2754
+ type: "tuple",
2755
+ internalType: "structIAppController.Release",
2756
+ components: [
2757
+ {
2758
+ name: "rmsRelease",
2759
+ type: "tuple",
2760
+ internalType: "structIReleaseManagerTypes.Release",
2761
+ components: [
2762
+ {
2763
+ name: "artifacts",
2764
+ type: "tuple[]",
2765
+ internalType: "structIReleaseManagerTypes.Artifact[]",
2766
+ components: [
2767
+ {
2768
+ name: "digest",
2769
+ type: "bytes32",
2770
+ internalType: "bytes32"
2771
+ },
2772
+ {
2773
+ name: "registry",
2774
+ type: "string",
2775
+ internalType: "string"
2776
+ }
2777
+ ]
2778
+ },
2779
+ {
2780
+ name: "upgradeByTime",
2781
+ type: "uint32",
2782
+ internalType: "uint32"
2783
+ }
2784
+ ]
2785
+ },
2786
+ {
2787
+ name: "publicEnv",
2788
+ type: "bytes",
2789
+ internalType: "bytes"
2790
+ },
2791
+ {
2792
+ name: "encryptedEnv",
2793
+ type: "bytes",
2794
+ internalType: "bytes"
2795
+ },
2796
+ {
2797
+ name: "containerPolicy",
2798
+ type: "tuple",
2799
+ internalType: "structIAppController.ContainerPolicy",
2800
+ components: [
2801
+ {
2802
+ name: "args",
2803
+ type: "string[]",
2804
+ internalType: "string[]"
2805
+ },
2806
+ {
2807
+ name: "cmdOverride",
2808
+ type: "string[]",
2809
+ internalType: "string[]"
2810
+ },
2811
+ {
2812
+ name: "env",
2813
+ type: "tuple[]",
2814
+ internalType: "structIAppController.EnvVar[]",
2815
+ components: [
2816
+ {
2817
+ name: "key",
2818
+ type: "string",
2819
+ internalType: "string"
2820
+ },
2821
+ {
2822
+ name: "value",
2823
+ type: "string",
2824
+ internalType: "string"
2825
+ }
2826
+ ]
2827
+ },
2828
+ {
2829
+ name: "envOverride",
2830
+ type: "tuple[]",
2831
+ internalType: "structIAppController.EnvVar[]",
2832
+ components: [
2833
+ {
2834
+ name: "key",
2835
+ type: "string",
2836
+ internalType: "string"
2837
+ },
2838
+ {
2839
+ name: "value",
2840
+ type: "string",
2841
+ internalType: "string"
2842
+ }
2843
+ ]
2844
+ },
2845
+ {
2846
+ name: "restartPolicy",
2847
+ type: "string",
2848
+ internalType: "string"
2849
+ }
2850
+ ]
2851
+ }
2852
+ ]
2853
+ }
2854
+ ],
2855
+ outputs: [
2856
+ {
2857
+ name: "app",
2858
+ type: "address",
2859
+ internalType: "contractIApp"
2860
+ }
2861
+ ],
2862
+ stateMutability: "nonpayable"
2863
+ },
2864
+ {
2865
+ type: "function",
2866
+ name: "createAppWithIsolatedBilling",
2867
+ inputs: [
2868
+ {
2869
+ name: "salt",
2870
+ type: "bytes32",
2871
+ internalType: "bytes32"
2872
+ },
2873
+ {
2874
+ name: "release",
2875
+ type: "tuple",
2876
+ internalType: "structIAppController.Release",
2877
+ components: [
2878
+ {
2879
+ name: "rmsRelease",
2880
+ type: "tuple",
2881
+ internalType: "structIReleaseManagerTypes.Release",
2882
+ components: [
2883
+ {
2884
+ name: "artifacts",
2885
+ type: "tuple[]",
2886
+ internalType: "structIReleaseManagerTypes.Artifact[]",
2887
+ components: [
2888
+ {
2889
+ name: "digest",
2890
+ type: "bytes32",
2891
+ internalType: "bytes32"
2892
+ },
2893
+ {
2894
+ name: "registry",
2895
+ type: "string",
2896
+ internalType: "string"
2897
+ }
2898
+ ]
2899
+ },
2900
+ {
2901
+ name: "upgradeByTime",
2902
+ type: "uint32",
2903
+ internalType: "uint32"
2904
+ }
2905
+ ]
2906
+ },
2907
+ {
2908
+ name: "publicEnv",
2909
+ type: "bytes",
2910
+ internalType: "bytes"
2911
+ },
2912
+ {
2913
+ name: "encryptedEnv",
2914
+ type: "bytes",
2915
+ internalType: "bytes"
2916
+ },
2917
+ {
2918
+ name: "containerPolicy",
2919
+ type: "tuple",
2920
+ internalType: "structIAppController.ContainerPolicy",
2921
+ components: [
2922
+ {
2923
+ name: "args",
2924
+ type: "string[]",
2925
+ internalType: "string[]"
2926
+ },
2927
+ {
2928
+ name: "cmdOverride",
2929
+ type: "string[]",
2930
+ internalType: "string[]"
2931
+ },
2932
+ {
2933
+ name: "env",
2934
+ type: "tuple[]",
2935
+ internalType: "structIAppController.EnvVar[]",
2936
+ components: [
2937
+ {
2938
+ name: "key",
2939
+ type: "string",
2940
+ internalType: "string"
2941
+ },
2942
+ {
2943
+ name: "value",
2944
+ type: "string",
2945
+ internalType: "string"
2946
+ }
2947
+ ]
2948
+ },
2949
+ {
2950
+ name: "envOverride",
2951
+ type: "tuple[]",
2952
+ internalType: "structIAppController.EnvVar[]",
2953
+ components: [
2954
+ {
2955
+ name: "key",
2956
+ type: "string",
2957
+ internalType: "string"
2958
+ },
2959
+ {
2960
+ name: "value",
2961
+ type: "string",
2962
+ internalType: "string"
2963
+ }
2964
+ ]
2965
+ },
2966
+ {
2967
+ name: "restartPolicy",
2968
+ type: "string",
2969
+ internalType: "string"
2970
+ }
2971
+ ]
2972
+ }
2973
+ ]
2974
+ }
2975
+ ],
2976
+ outputs: [
2977
+ {
2978
+ name: "app",
2979
+ type: "address",
2980
+ internalType: "contractIApp"
2981
+ }
2982
+ ],
2983
+ stateMutability: "nonpayable"
2984
+ },
2985
+ {
2986
+ type: "function",
2987
+ name: "createEmptyApp",
2988
+ inputs: [
2989
+ {
2990
+ name: "salt",
2991
+ type: "bytes32",
2992
+ internalType: "bytes32"
2993
+ }
2994
+ ],
2995
+ outputs: [
2996
+ {
2997
+ name: "app",
2998
+ type: "address",
2999
+ internalType: "contractIApp"
3000
+ }
3001
+ ],
3002
+ stateMutability: "nonpayable"
3003
+ },
3004
+ {
3005
+ type: "function",
3006
+ name: "createEmptyAppWithIsolatedBilling",
3007
+ inputs: [
3008
+ {
3009
+ name: "salt",
3010
+ type: "bytes32",
3011
+ internalType: "bytes32"
3012
+ }
3013
+ ],
3014
+ outputs: [
3015
+ {
3016
+ name: "app",
3017
+ type: "address",
3018
+ internalType: "contractIApp"
3019
+ }
3020
+ ],
3021
+ stateMutability: "nonpayable"
3022
+ },
3023
+ {
3024
+ type: "function",
3025
+ name: "domainSeparator",
3026
+ inputs: [],
3027
+ outputs: [
3028
+ {
3029
+ name: "",
3030
+ type: "bytes32",
3031
+ internalType: "bytes32"
3032
+ }
3033
+ ],
3034
+ stateMutability: "view"
3035
+ },
3036
+ {
3037
+ type: "function",
3038
+ name: "getActiveAppCount",
3039
+ inputs: [
3040
+ {
3041
+ name: "user",
3042
+ type: "address",
3043
+ internalType: "address"
3044
+ }
3045
+ ],
3046
+ outputs: [
3047
+ {
3048
+ name: "",
3049
+ type: "uint32",
3050
+ internalType: "uint32"
3051
+ }
3052
+ ],
3053
+ stateMutability: "view"
3054
+ },
3055
+ {
3056
+ type: "function",
3057
+ name: "getAppCreator",
3058
+ inputs: [
3059
+ {
3060
+ name: "app",
3061
+ type: "address",
3062
+ internalType: "contractIApp"
3063
+ }
3064
+ ],
3065
+ outputs: [
3066
+ {
3067
+ name: "",
3068
+ type: "address",
3069
+ internalType: "address"
3070
+ }
3071
+ ],
3072
+ stateMutability: "view"
3073
+ },
3074
+ {
3075
+ type: "function",
3076
+ name: "getAppLatestReleaseBlockNumber",
3077
+ inputs: [
3078
+ {
3079
+ name: "app",
3080
+ type: "address",
3081
+ internalType: "contractIApp"
3082
+ }
3083
+ ],
3084
+ outputs: [
3085
+ {
3086
+ name: "",
3087
+ type: "uint32",
3088
+ internalType: "uint32"
3089
+ }
3090
+ ],
3091
+ stateMutability: "view"
3092
+ },
3093
+ {
3094
+ type: "function",
3095
+ name: "getAppOperatorSetId",
3096
+ inputs: [
3097
+ {
3098
+ name: "app",
3099
+ type: "address",
3100
+ internalType: "contractIApp"
3101
+ }
3102
+ ],
3103
+ outputs: [
3104
+ {
3105
+ name: "",
3106
+ type: "uint32",
3107
+ internalType: "uint32"
3108
+ }
3109
+ ],
3110
+ stateMutability: "view"
3111
+ },
3112
+ {
3113
+ type: "function",
3114
+ name: "getAppPendingReleaseBlockNumber",
3115
+ inputs: [
3116
+ {
3117
+ name: "app",
3118
+ type: "address",
3119
+ internalType: "contractIApp"
3120
+ }
3121
+ ],
3122
+ outputs: [
3123
+ {
3124
+ name: "",
3125
+ type: "uint32",
3126
+ internalType: "uint32"
3127
+ }
3128
+ ],
3129
+ stateMutability: "view"
3130
+ },
3131
+ {
3132
+ type: "function",
3133
+ name: "getAppStatus",
3134
+ inputs: [
3135
+ {
3136
+ name: "app",
3137
+ type: "address",
3138
+ internalType: "contractIApp"
3139
+ }
3140
+ ],
3141
+ outputs: [
3142
+ {
3143
+ name: "",
3144
+ type: "uint8",
3145
+ internalType: "enumIAppController.AppStatus"
3146
+ }
3147
+ ],
3148
+ stateMutability: "view"
3149
+ },
3150
+ {
3151
+ type: "function",
3152
+ name: "getApps",
3153
+ inputs: [
3154
+ {
3155
+ name: "offset",
3156
+ type: "uint256",
3157
+ internalType: "uint256"
3158
+ },
3159
+ {
3160
+ name: "limit",
3161
+ type: "uint256",
3162
+ internalType: "uint256"
3163
+ }
3164
+ ],
3165
+ outputs: [
3166
+ {
3167
+ name: "apps",
3168
+ type: "address[]",
3169
+ internalType: "contractIApp[]"
3170
+ },
3171
+ {
3172
+ name: "appConfigsMem",
3173
+ type: "tuple[]",
3174
+ internalType: "structIAppController.AppConfig[]",
3175
+ components: [
3176
+ {
3177
+ name: "creator",
3178
+ type: "address",
3179
+ internalType: "address"
3180
+ },
3181
+ {
3182
+ name: "operatorSetId",
3183
+ type: "uint32",
3184
+ internalType: "uint32"
3185
+ },
3186
+ {
3187
+ name: "latestReleaseBlockNumber",
3188
+ type: "uint32",
3189
+ internalType: "uint32"
3190
+ },
3191
+ {
3192
+ name: "pendingReleaseBlockNumber",
3193
+ type: "uint32",
3194
+ internalType: "uint32"
3195
+ },
3196
+ {
3197
+ name: "status",
3198
+ type: "uint8",
3199
+ internalType: "enumIAppController.AppStatus"
3200
+ }
3201
+ ]
3202
+ }
3203
+ ],
3204
+ stateMutability: "view"
3205
+ },
3206
+ {
3207
+ type: "function",
3208
+ name: "getAppsByBillingAccount",
3209
+ inputs: [
3210
+ {
3211
+ name: "account",
3212
+ type: "address",
3213
+ internalType: "address"
3214
+ },
3215
+ {
3216
+ name: "offset",
3217
+ type: "uint256",
3218
+ internalType: "uint256"
3219
+ },
3220
+ {
3221
+ name: "limit",
3222
+ type: "uint256",
3223
+ internalType: "uint256"
3224
+ }
3225
+ ],
3226
+ outputs: [
3227
+ {
3228
+ name: "apps",
3229
+ type: "address[]",
3230
+ internalType: "contractIApp[]"
3231
+ },
3232
+ {
3233
+ name: "appConfigsMem",
3234
+ type: "tuple[]",
3235
+ internalType: "structIAppController.AppConfig[]",
3236
+ components: [
3237
+ {
3238
+ name: "creator",
3239
+ type: "address",
3240
+ internalType: "address"
3241
+ },
3242
+ {
3243
+ name: "operatorSetId",
3244
+ type: "uint32",
3245
+ internalType: "uint32"
3246
+ },
3247
+ {
3248
+ name: "latestReleaseBlockNumber",
3249
+ type: "uint32",
3250
+ internalType: "uint32"
3251
+ },
3252
+ {
3253
+ name: "pendingReleaseBlockNumber",
3254
+ type: "uint32",
3255
+ internalType: "uint32"
3256
+ },
3257
+ {
3258
+ name: "status",
3259
+ type: "uint8",
3260
+ internalType: "enumIAppController.AppStatus"
3261
+ }
3262
+ ]
3263
+ }
3264
+ ],
3265
+ stateMutability: "view"
3266
+ },
3267
+ {
3268
+ type: "function",
3269
+ name: "getAppsByCreator",
3270
+ inputs: [
3271
+ {
3272
+ name: "creator",
3273
+ type: "address",
3274
+ internalType: "address"
3275
+ },
3276
+ {
3277
+ name: "offset",
3278
+ type: "uint256",
3279
+ internalType: "uint256"
3280
+ },
3281
+ {
3282
+ name: "limit",
3283
+ type: "uint256",
3284
+ internalType: "uint256"
3285
+ }
3286
+ ],
3287
+ outputs: [
3288
+ {
3289
+ name: "apps",
3290
+ type: "address[]",
3291
+ internalType: "contractIApp[]"
3292
+ },
3293
+ {
3294
+ name: "appConfigsMem",
3295
+ type: "tuple[]",
3296
+ internalType: "structIAppController.AppConfig[]",
3297
+ components: [
3298
+ {
3299
+ name: "creator",
3300
+ type: "address",
3301
+ internalType: "address"
3302
+ },
3303
+ {
3304
+ name: "operatorSetId",
3305
+ type: "uint32",
3306
+ internalType: "uint32"
3307
+ },
3308
+ {
3309
+ name: "latestReleaseBlockNumber",
3310
+ type: "uint32",
3311
+ internalType: "uint32"
3312
+ },
3313
+ {
3314
+ name: "pendingReleaseBlockNumber",
3315
+ type: "uint32",
3316
+ internalType: "uint32"
3317
+ },
3318
+ {
3319
+ name: "status",
3320
+ type: "uint8",
3321
+ internalType: "enumIAppController.AppStatus"
3322
+ }
3323
+ ]
3324
+ }
3325
+ ],
3326
+ stateMutability: "view"
3327
+ },
3328
+ {
3329
+ type: "function",
3330
+ name: "getAppsByDeveloper",
3331
+ inputs: [
3332
+ {
3333
+ name: "developer",
3334
+ type: "address",
3335
+ internalType: "address"
3336
+ },
3337
+ {
3338
+ name: "offset",
3339
+ type: "uint256",
3340
+ internalType: "uint256"
3341
+ },
3342
+ {
3343
+ name: "limit",
3344
+ type: "uint256",
3345
+ internalType: "uint256"
3346
+ }
3347
+ ],
3348
+ outputs: [
3349
+ {
3350
+ name: "apps",
3351
+ type: "address[]",
3352
+ internalType: "contractIApp[]"
3353
+ },
3354
+ {
3355
+ name: "appConfigsMem",
3356
+ type: "tuple[]",
3357
+ internalType: "structIAppController.AppConfig[]",
3358
+ components: [
3359
+ {
3360
+ name: "creator",
3361
+ type: "address",
3362
+ internalType: "address"
3363
+ },
3364
+ {
3365
+ name: "operatorSetId",
3366
+ type: "uint32",
3367
+ internalType: "uint32"
3368
+ },
3369
+ {
3370
+ name: "latestReleaseBlockNumber",
3371
+ type: "uint32",
3372
+ internalType: "uint32"
3373
+ },
3374
+ {
3375
+ name: "pendingReleaseBlockNumber",
3376
+ type: "uint32",
3377
+ internalType: "uint32"
3378
+ },
3379
+ {
3380
+ name: "status",
3381
+ type: "uint8",
3382
+ internalType: "enumIAppController.AppStatus"
3383
+ }
3384
+ ]
3385
+ }
3386
+ ],
3387
+ stateMutability: "view"
3388
+ },
3389
+ {
3390
+ type: "function",
3391
+ name: "getBillingAccount",
3392
+ inputs: [
3393
+ {
3394
+ name: "app",
3395
+ type: "address",
3396
+ internalType: "contractIApp"
3397
+ }
3398
+ ],
3399
+ outputs: [
3400
+ {
3401
+ name: "",
3402
+ type: "address",
3403
+ internalType: "address"
3404
+ }
3405
+ ],
3406
+ stateMutability: "view"
3407
+ },
3408
+ {
3409
+ type: "function",
3410
+ name: "getBillingType",
3411
+ inputs: [
3412
+ {
3413
+ name: "app",
3414
+ type: "address",
3415
+ internalType: "contractIApp"
3416
+ }
3417
+ ],
3418
+ outputs: [
3419
+ {
3420
+ name: "",
3421
+ type: "uint8",
3422
+ internalType: "enumIAppController.BillingType"
3423
+ }
3424
+ ],
3425
+ stateMutability: "view"
3426
+ },
3427
+ {
3428
+ type: "function",
3429
+ name: "getMaxActiveAppsPerUser",
3430
+ inputs: [
3431
+ {
3432
+ name: "user",
3433
+ type: "address",
3434
+ internalType: "address"
3435
+ }
3436
+ ],
3437
+ outputs: [
3438
+ {
3439
+ name: "",
3440
+ type: "uint32",
3441
+ internalType: "uint32"
3442
+ }
3443
+ ],
3444
+ stateMutability: "view"
3445
+ },
3446
+ {
3447
+ type: "function",
3448
+ name: "globalActiveAppCount",
3449
+ inputs: [],
3450
+ outputs: [
3451
+ {
3452
+ name: "",
3453
+ type: "uint32",
3454
+ internalType: "uint32"
3455
+ }
3456
+ ],
3457
+ stateMutability: "view"
3458
+ },
3459
+ {
3460
+ type: "function",
3461
+ name: "initialize",
3462
+ inputs: [
3463
+ {
3464
+ name: "admin",
3465
+ type: "address",
3466
+ internalType: "address"
3467
+ }
3468
+ ],
3469
+ outputs: [],
3470
+ stateMutability: "nonpayable"
3471
+ },
3472
+ {
3473
+ type: "function",
3474
+ name: "maxGlobalActiveApps",
3475
+ inputs: [],
3476
+ outputs: [
3477
+ {
3478
+ name: "",
3479
+ type: "uint32",
3480
+ internalType: "uint32"
3481
+ }
3482
+ ],
3483
+ stateMutability: "view"
3484
+ },
3485
+ {
3486
+ type: "function",
3487
+ name: "permissionController",
3488
+ inputs: [],
3489
+ outputs: [
3490
+ {
3491
+ name: "",
3492
+ type: "address",
3493
+ internalType: "contractIPermissionController"
3494
+ }
3495
+ ],
3496
+ stateMutability: "view"
3497
+ },
3498
+ {
3499
+ type: "function",
3500
+ name: "releaseManager",
3501
+ inputs: [],
3502
+ outputs: [
3503
+ {
3504
+ name: "",
3505
+ type: "address",
3506
+ internalType: "contractIReleaseManager"
3507
+ }
3508
+ ],
3509
+ stateMutability: "view"
3510
+ },
3511
+ {
3512
+ type: "function",
3513
+ name: "setMaxActiveAppsPerUser",
3514
+ inputs: [
3515
+ {
3516
+ name: "user",
3517
+ type: "address",
3518
+ internalType: "address"
3519
+ },
3520
+ {
3521
+ name: "limit",
3522
+ type: "uint32",
3523
+ internalType: "uint32"
3524
+ }
3525
+ ],
3526
+ outputs: [],
3527
+ stateMutability: "nonpayable"
3528
+ },
3529
+ {
3530
+ type: "function",
3531
+ name: "setMaxGlobalActiveApps",
3532
+ inputs: [
3533
+ {
3534
+ name: "limit",
3535
+ type: "uint32",
3536
+ internalType: "uint32"
3537
+ }
3538
+ ],
3539
+ outputs: [],
3540
+ stateMutability: "nonpayable"
3541
+ },
3542
+ {
3543
+ type: "function",
3544
+ name: "startApp",
3545
+ inputs: [
3546
+ {
3547
+ name: "app",
3548
+ type: "address",
3549
+ internalType: "contractIApp"
3550
+ }
3551
+ ],
3552
+ outputs: [],
3553
+ stateMutability: "nonpayable"
3554
+ },
3555
+ {
3556
+ type: "function",
3557
+ name: "stopApp",
3558
+ inputs: [
3559
+ {
3560
+ name: "app",
3561
+ type: "address",
3562
+ internalType: "contractIApp"
3563
+ }
3564
+ ],
3565
+ outputs: [],
3566
+ stateMutability: "nonpayable"
3567
+ },
3568
+ {
3569
+ type: "function",
3570
+ name: "suspend",
3571
+ inputs: [
3572
+ {
3573
+ name: "account",
3574
+ type: "address",
3575
+ internalType: "address"
3576
+ },
3577
+ {
3578
+ name: "apps",
3579
+ type: "address[]",
3580
+ internalType: "contractIApp[]"
3581
+ }
3582
+ ],
3583
+ outputs: [],
3584
+ stateMutability: "nonpayable"
3585
+ },
3586
+ {
3587
+ type: "function",
3588
+ name: "terminateApp",
3589
+ inputs: [
3590
+ {
3591
+ name: "app",
3592
+ type: "address",
3593
+ internalType: "contractIApp"
3594
+ }
3595
+ ],
3596
+ outputs: [],
3597
+ stateMutability: "nonpayable"
3598
+ },
3599
+ {
3600
+ type: "function",
3601
+ name: "terminateAppByAdmin",
3602
+ inputs: [
3603
+ {
3604
+ name: "app",
3605
+ type: "address",
3606
+ internalType: "contractIApp"
3607
+ }
3608
+ ],
3609
+ outputs: [],
3610
+ stateMutability: "nonpayable"
3611
+ },
3612
+ {
3613
+ type: "function",
3614
+ name: "updateAppMetadataURI",
3615
+ inputs: [
3616
+ {
3617
+ name: "app",
3618
+ type: "address",
3619
+ internalType: "contractIApp"
3620
+ },
3621
+ {
3622
+ name: "metadataURI",
3623
+ type: "string",
3624
+ internalType: "string"
3625
+ }
3626
+ ],
3627
+ outputs: [],
3628
+ stateMutability: "nonpayable"
3629
+ },
3630
+ {
3631
+ type: "function",
3632
+ name: "upgradeApp",
3633
+ inputs: [
3634
+ {
3635
+ name: "app",
3636
+ type: "address",
3637
+ internalType: "contractIApp"
3638
+ },
3639
+ {
3640
+ name: "release",
3641
+ type: "tuple",
3642
+ internalType: "structIAppController.Release",
3643
+ components: [
3644
+ {
3645
+ name: "rmsRelease",
3646
+ type: "tuple",
3647
+ internalType: "structIReleaseManagerTypes.Release",
3648
+ components: [
3649
+ {
3650
+ name: "artifacts",
3651
+ type: "tuple[]",
3652
+ internalType: "structIReleaseManagerTypes.Artifact[]",
3653
+ components: [
3654
+ {
3655
+ name: "digest",
3656
+ type: "bytes32",
3657
+ internalType: "bytes32"
3658
+ },
3659
+ {
3660
+ name: "registry",
3661
+ type: "string",
3662
+ internalType: "string"
3663
+ }
3664
+ ]
3665
+ },
3666
+ {
3667
+ name: "upgradeByTime",
3668
+ type: "uint32",
3669
+ internalType: "uint32"
3670
+ }
3671
+ ]
3672
+ },
3673
+ {
3674
+ name: "publicEnv",
3675
+ type: "bytes",
3676
+ internalType: "bytes"
3677
+ },
3678
+ {
3679
+ name: "encryptedEnv",
3680
+ type: "bytes",
3681
+ internalType: "bytes"
3682
+ },
3683
+ {
3684
+ name: "containerPolicy",
3685
+ type: "tuple",
3686
+ internalType: "structIAppController.ContainerPolicy",
3687
+ components: [
3688
+ {
3689
+ name: "args",
3690
+ type: "string[]",
3691
+ internalType: "string[]"
3692
+ },
3693
+ {
3694
+ name: "cmdOverride",
3695
+ type: "string[]",
3696
+ internalType: "string[]"
3697
+ },
3698
+ {
3699
+ name: "env",
3700
+ type: "tuple[]",
3701
+ internalType: "structIAppController.EnvVar[]",
3702
+ components: [
3703
+ {
3704
+ name: "key",
3705
+ type: "string",
3706
+ internalType: "string"
3707
+ },
3708
+ {
3709
+ name: "value",
3710
+ type: "string",
3711
+ internalType: "string"
3712
+ }
3713
+ ]
3714
+ },
3715
+ {
3716
+ name: "envOverride",
3717
+ type: "tuple[]",
3718
+ internalType: "structIAppController.EnvVar[]",
3719
+ components: [
3720
+ {
3721
+ name: "key",
3722
+ type: "string",
3723
+ internalType: "string"
3724
+ },
3725
+ {
3726
+ name: "value",
3727
+ type: "string",
3728
+ internalType: "string"
3729
+ }
3730
+ ]
3731
+ },
3732
+ {
3733
+ name: "restartPolicy",
3734
+ type: "string",
3735
+ internalType: "string"
3736
+ }
3737
+ ]
3738
+ }
3739
+ ]
3740
+ }
3741
+ ],
3742
+ outputs: [
3743
+ {
3744
+ name: "",
3745
+ type: "uint256",
3746
+ internalType: "uint256"
3747
+ }
3748
+ ],
3749
+ stateMutability: "nonpayable"
3750
+ },
3751
+ {
3752
+ type: "function",
3753
+ name: "version",
3754
+ inputs: [],
3755
+ outputs: [
3756
+ {
3757
+ name: "",
3758
+ type: "string",
3759
+ internalType: "string"
3760
+ }
3761
+ ],
3762
+ stateMutability: "view"
3763
+ },
3764
+ {
3765
+ type: "event",
3766
+ name: "AppCreated",
3767
+ inputs: [
3768
+ {
3769
+ name: "creator",
3770
+ type: "address",
3771
+ indexed: true,
3772
+ internalType: "address"
3773
+ },
3774
+ {
3775
+ name: "app",
3776
+ type: "address",
3777
+ indexed: true,
3778
+ internalType: "contractIApp"
3779
+ },
3780
+ {
3781
+ name: "operatorSetId",
3782
+ type: "uint32",
3783
+ indexed: false,
3784
+ internalType: "uint32"
3785
+ }
3786
+ ],
3787
+ anonymous: false
3788
+ },
3789
+ {
3790
+ type: "event",
3791
+ name: "AppMetadataURIUpdated",
3792
+ inputs: [
3793
+ {
3794
+ name: "app",
3795
+ type: "address",
3796
+ indexed: true,
3797
+ internalType: "contractIApp"
3798
+ },
3799
+ {
3800
+ name: "metadataURI",
3801
+ type: "string",
3802
+ indexed: false,
3803
+ internalType: "string"
3804
+ }
3805
+ ],
3806
+ anonymous: false
3807
+ },
3808
+ {
3809
+ type: "event",
3810
+ name: "AppStarted",
3811
+ inputs: [
3812
+ {
3813
+ name: "app",
3814
+ type: "address",
3815
+ indexed: true,
3816
+ internalType: "contractIApp"
3817
+ }
3818
+ ],
3819
+ anonymous: false
3820
+ },
3821
+ {
3822
+ type: "event",
3823
+ name: "AppStopped",
3824
+ inputs: [
3825
+ {
3826
+ name: "app",
3827
+ type: "address",
3828
+ indexed: true,
3829
+ internalType: "contractIApp"
3830
+ }
3831
+ ],
3832
+ anonymous: false
3833
+ },
3834
+ {
3835
+ type: "event",
3836
+ name: "AppSuspended",
3837
+ inputs: [
3838
+ {
3839
+ name: "app",
3840
+ type: "address",
3841
+ indexed: true,
3842
+ internalType: "contractIApp"
3843
+ }
3844
+ ],
3845
+ anonymous: false
3846
+ },
3847
+ {
3848
+ type: "event",
3849
+ name: "AppTerminated",
3850
+ inputs: [
3851
+ {
3852
+ name: "app",
3853
+ type: "address",
3854
+ indexed: true,
3855
+ internalType: "contractIApp"
3856
+ }
3857
+ ],
3858
+ anonymous: false
3859
+ },
3860
+ {
3861
+ type: "event",
3862
+ name: "AppTerminatedByAdmin",
3863
+ inputs: [
3864
+ {
3865
+ name: "app",
3866
+ type: "address",
3867
+ indexed: true,
3868
+ internalType: "contractIApp"
3869
+ }
3870
+ ],
3871
+ anonymous: false
3872
+ },
3873
+ {
3874
+ type: "event",
3875
+ name: "AppUpgraded",
3876
+ inputs: [
3877
+ {
3878
+ name: "app",
3879
+ type: "address",
3880
+ indexed: true,
3881
+ internalType: "contractIApp"
3882
+ },
3883
+ {
3884
+ name: "rmsReleaseId",
3885
+ type: "uint256",
3886
+ indexed: false,
3887
+ internalType: "uint256"
3888
+ },
3889
+ {
3890
+ name: "release",
3891
+ type: "tuple",
3892
+ indexed: false,
3893
+ internalType: "structIAppController.Release",
3894
+ components: [
3895
+ {
3896
+ name: "rmsRelease",
3897
+ type: "tuple",
3898
+ internalType: "structIReleaseManagerTypes.Release",
3899
+ components: [
3900
+ {
3901
+ name: "artifacts",
3902
+ type: "tuple[]",
3903
+ internalType: "structIReleaseManagerTypes.Artifact[]",
3904
+ components: [
3905
+ {
3906
+ name: "digest",
3907
+ type: "bytes32",
3908
+ internalType: "bytes32"
3909
+ },
3910
+ {
3911
+ name: "registry",
3912
+ type: "string",
3913
+ internalType: "string"
3914
+ }
3915
+ ]
3916
+ },
3917
+ {
3918
+ name: "upgradeByTime",
3919
+ type: "uint32",
3920
+ internalType: "uint32"
3921
+ }
3922
+ ]
3923
+ },
3924
+ {
3925
+ name: "publicEnv",
3926
+ type: "bytes",
3927
+ internalType: "bytes"
3928
+ },
3929
+ {
3930
+ name: "encryptedEnv",
3931
+ type: "bytes",
3932
+ internalType: "bytes"
3933
+ },
3934
+ {
3935
+ name: "containerPolicy",
3936
+ type: "tuple",
3937
+ internalType: "structIAppController.ContainerPolicy",
3938
+ components: [
3939
+ {
3940
+ name: "args",
3941
+ type: "string[]",
3942
+ internalType: "string[]"
3943
+ },
3944
+ {
3945
+ name: "cmdOverride",
3946
+ type: "string[]",
3947
+ internalType: "string[]"
3948
+ },
3949
+ {
3950
+ name: "env",
3951
+ type: "tuple[]",
3952
+ internalType: "structIAppController.EnvVar[]",
3953
+ components: [
3954
+ {
3955
+ name: "key",
3956
+ type: "string",
3957
+ internalType: "string"
3958
+ },
3959
+ {
3960
+ name: "value",
3961
+ type: "string",
3962
+ internalType: "string"
3963
+ }
3964
+ ]
3965
+ },
3966
+ {
3967
+ name: "envOverride",
3968
+ type: "tuple[]",
3969
+ internalType: "structIAppController.EnvVar[]",
3970
+ components: [
3971
+ {
3972
+ name: "key",
3973
+ type: "string",
3974
+ internalType: "string"
3975
+ },
3976
+ {
3977
+ name: "value",
3978
+ type: "string",
3979
+ internalType: "string"
3980
+ }
3981
+ ]
3982
+ },
3983
+ {
3984
+ name: "restartPolicy",
3985
+ type: "string",
3986
+ internalType: "string"
3987
+ }
3988
+ ]
3989
+ }
3990
+ ]
3991
+ }
3992
+ ],
3993
+ anonymous: false
3994
+ },
3995
+ {
3996
+ type: "event",
3997
+ name: "GlobalMaxActiveAppsSet",
3998
+ inputs: [
3999
+ {
4000
+ name: "limit",
4001
+ type: "uint32",
4002
+ indexed: false,
4003
+ internalType: "uint32"
4004
+ }
4005
+ ],
4006
+ anonymous: false
4007
+ },
4008
+ {
4009
+ type: "event",
4010
+ name: "Initialized",
4011
+ inputs: [
4012
+ {
4013
+ name: "version",
4014
+ type: "uint8",
4015
+ indexed: false,
4016
+ internalType: "uint8"
4017
+ }
4018
+ ],
4019
+ anonymous: false
4020
+ },
4021
+ {
4022
+ type: "event",
4023
+ name: "MaxActiveAppsSet",
4024
+ inputs: [
4025
+ {
4026
+ name: "user",
4027
+ type: "address",
4028
+ indexed: true,
4029
+ internalType: "address"
4030
+ },
4031
+ {
4032
+ name: "limit",
4033
+ type: "uint32",
4034
+ indexed: false,
4035
+ internalType: "uint32"
4036
+ }
4037
+ ],
4038
+ anonymous: false
4039
+ },
4040
+ {
4041
+ type: "event",
4042
+ name: "UpgradeConfirmed",
4043
+ inputs: [
4044
+ {
4045
+ name: "app",
4046
+ type: "address",
4047
+ indexed: true,
4048
+ internalType: "contractIApp"
4049
+ },
4050
+ {
4051
+ name: "pendingReleaseBlockNumber",
4052
+ type: "uint32",
4053
+ indexed: false,
4054
+ internalType: "uint32"
4055
+ }
4056
+ ],
4057
+ anonymous: false
4058
+ },
4059
+ {
4060
+ type: "error",
4061
+ name: "AccountHasActiveApps",
4062
+ inputs: []
4063
+ },
4064
+ {
4065
+ type: "error",
4066
+ name: "AppAlreadyExists",
4067
+ inputs: []
4068
+ },
4069
+ {
4070
+ type: "error",
4071
+ name: "AppDoesNotExist",
4072
+ inputs: []
4073
+ },
4074
+ {
4075
+ type: "error",
4076
+ name: "GlobalMaxActiveAppsExceeded",
4077
+ inputs: []
4078
+ },
4079
+ {
4080
+ type: "error",
4081
+ name: "InvalidAppStatus",
4082
+ inputs: []
4083
+ },
4084
+ {
4085
+ type: "error",
4086
+ name: "InvalidPermissions",
4087
+ inputs: []
4088
+ },
4089
+ {
4090
+ type: "error",
4091
+ name: "InvalidReleaseMetadataURI",
4092
+ inputs: []
4093
+ },
4094
+ {
4095
+ type: "error",
4096
+ name: "InvalidShortString",
4097
+ inputs: []
4098
+ },
4099
+ {
4100
+ type: "error",
4101
+ name: "InvalidSignature",
4102
+ inputs: []
4103
+ },
4104
+ {
4105
+ type: "error",
4106
+ name: "MaxActiveAppsExceeded",
4107
+ inputs: []
4108
+ },
4109
+ {
4110
+ type: "error",
4111
+ name: "MoreThanOneArtifact",
4112
+ inputs: []
4113
+ },
4114
+ {
4115
+ type: "error",
4116
+ name: "NoPendingUpgrade",
4117
+ inputs: []
4118
+ },
4119
+ {
4120
+ type: "error",
4121
+ name: "SignatureExpired",
4122
+ inputs: []
4123
+ },
4124
+ {
4125
+ type: "error",
4126
+ name: "StringTooLong",
4127
+ inputs: [
4128
+ {
4129
+ name: "str",
4130
+ type: "string",
4131
+ internalType: "string"
4132
+ }
4133
+ ]
2488
4134
  }
2489
- return hash;
2490
- }
2491
-
2492
- // src/client/common/contract/caller.ts
2493
- import { encodeFunctionData as encodeFunctionData2, decodeErrorResult as decodeErrorResult2, bytesToHex } from "viem";
2494
-
2495
- // src/client/common/utils/helpers.ts
2496
- import { extractChain, createPublicClient, createWalletClient, http, fallback } from "viem";
2497
- import { sepolia as sepolia2 } from "viem/chains";
2498
- import { privateKeyToAccount } from "viem/accounts";
2499
- function getChainFromID(chainID, fallback2 = sepolia2) {
2500
- const id = Number(chainID);
2501
- return extractChain({ chains: SUPPORTED_CHAINS, id }) || fallback2;
2502
- }
2503
- function createClients(options) {
2504
- const { privateKey, rpcUrl, chainId } = options;
2505
- const privateKeyHex = addHexPrefix(privateKey);
2506
- const account = privateKeyToAccount(privateKeyHex);
2507
- const chain = getChainFromID(chainId);
2508
- const transport = typeof rpcUrl === "string" ? http(rpcUrl) : fallback(rpcUrl.map((url) => http(url)));
2509
- const publicClient = createPublicClient({
2510
- chain,
2511
- transport
2512
- });
2513
- const walletClient = createWalletClient({
2514
- account,
2515
- chain,
2516
- transport
2517
- });
2518
- return { walletClient, publicClient };
2519
- }
2520
- function addHexPrefix(value) {
2521
- return value.startsWith("0x") ? value : `0x${value}`;
2522
- }
2523
- function stripHexPrefix(value) {
2524
- return value.startsWith("0x") ? value.slice(2) : value;
2525
- }
4135
+ ];
2526
4136
 
2527
- // src/client/common/abis/AppController.json
2528
- var AppController_default = [
4137
+ // src/client/common/abis/AppController.v1_4.json
4138
+ var AppController_v1_4_default = [
2529
4139
  {
2530
4140
  type: "constructor",
2531
4141
  inputs: [
@@ -4209,6 +5819,38 @@ var PermissionController_default = [
4209
5819
  ];
4210
5820
 
4211
5821
  // src/client/common/contract/caller.ts
5822
+ function appControllerAbiFor(environmentConfig) {
5823
+ return environmentConfig.releaseAbiVersion === "v1.4" ? AppController_v1_4_default : AppController_default;
5824
+ }
5825
+ function supportsContainerPolicy(environmentConfig) {
5826
+ return environmentConfig.releaseAbiVersion !== "v1.4";
5827
+ }
5828
+ function containerPolicyForViem(policy = EMPTY_CONTAINER_POLICY) {
5829
+ return {
5830
+ args: policy.args,
5831
+ cmdOverride: policy.cmdOverride,
5832
+ env: policy.env.map((e) => ({ key: e.key, value: e.value })),
5833
+ envOverride: policy.envOverride.map((e) => ({ key: e.key, value: e.value })),
5834
+ restartPolicy: policy.restartPolicy
5835
+ };
5836
+ }
5837
+ function releaseForViem(release, environmentConfig) {
5838
+ const base = {
5839
+ rmsRelease: {
5840
+ artifacts: release.rmsRelease.artifacts.map((artifact) => ({
5841
+ digest: `0x${bytesToHex(artifact.digest).slice(2).padStart(64, "0")}`,
5842
+ registry: artifact.registry
5843
+ })),
5844
+ upgradeByTime: release.rmsRelease.upgradeByTime
5845
+ },
5846
+ publicEnv: bytesToHex(release.publicEnv),
5847
+ encryptedEnv: bytesToHex(release.encryptedEnv)
5848
+ };
5849
+ if (!supportsContainerPolicy(environmentConfig)) {
5850
+ return base;
5851
+ }
5852
+ return { ...base, containerPolicy: containerPolicyForViem(release.containerPolicy) };
5853
+ }
4212
5854
  function formatETH(wei) {
4213
5855
  const eth = Number(wei) / 1e18;
4214
5856
  const costStr = eth.toFixed(6);
@@ -4246,7 +5888,7 @@ async function calculateAppID(options) {
4246
5888
  const saltHex = `0x${paddedSaltHex}`;
4247
5889
  const appID = await publicClient.readContract({
4248
5890
  address: environmentConfig.appControllerAddress,
4249
- abi: AppController_default,
5891
+ abi: appControllerAbiFor(environmentConfig),
4250
5892
  functionName: "calculateAppId",
4251
5893
  args: [ownerAddress, saltHex]
4252
5894
  });
@@ -4270,22 +5912,12 @@ async function prepareDeployBatch(options, logger = noopLogger) {
4270
5912
  const saltHexString = bytesToHex(salt).slice(2);
4271
5913
  const paddedSaltHex = saltHexString.padStart(64, "0");
4272
5914
  const saltHex = `0x${paddedSaltHex}`;
4273
- const releaseForViem = {
4274
- rmsRelease: {
4275
- artifacts: release.rmsRelease.artifacts.map((artifact) => ({
4276
- digest: `0x${bytesToHex(artifact.digest).slice(2).padStart(64, "0")}`,
4277
- registry: artifact.registry
4278
- })),
4279
- upgradeByTime: release.rmsRelease.upgradeByTime
4280
- },
4281
- publicEnv: bytesToHex(release.publicEnv),
4282
- encryptedEnv: bytesToHex(release.encryptedEnv)
4283
- };
5915
+ const release_ = releaseForViem(release, environmentConfig);
4284
5916
  const functionName = options.billTo === "app" ? "createAppWithIsolatedBilling" : "createApp";
4285
5917
  const createData = encodeFunctionData2({
4286
- abi: AppController_default,
5918
+ abi: appControllerAbiFor(environmentConfig),
4287
5919
  functionName,
4288
- args: [saltHex, releaseForViem]
5920
+ args: [saltHex, release_]
4289
5921
  });
4290
5922
  const acceptAdminData = encodeFunctionData2({
4291
5923
  abi: PermissionController_default,
@@ -4373,21 +6005,11 @@ async function prepareUpgradeBatch(options) {
4373
6005
  publicLogs,
4374
6006
  needsPermissionChange
4375
6007
  } = options;
4376
- const releaseForViem = {
4377
- rmsRelease: {
4378
- artifacts: release.rmsRelease.artifacts.map((artifact) => ({
4379
- digest: `0x${bytesToHex(artifact.digest).slice(2).padStart(64, "0")}`,
4380
- registry: artifact.registry
4381
- })),
4382
- upgradeByTime: release.rmsRelease.upgradeByTime
4383
- },
4384
- publicEnv: bytesToHex(release.publicEnv),
4385
- encryptedEnv: bytesToHex(release.encryptedEnv)
4386
- };
6008
+ const release_ = releaseForViem(release, environmentConfig);
4387
6009
  const upgradeData = encodeFunctionData2({
4388
- abi: AppController_default,
6010
+ abi: appControllerAbiFor(environmentConfig),
4389
6011
  functionName: "upgradeApp",
4390
- args: [appID, releaseForViem]
6012
+ args: [appID, release_]
4391
6013
  });
4392
6014
  const executions = [
4393
6015
  {
@@ -4521,7 +6143,7 @@ ${pendingMessage}`);
4521
6143
  if (callError.data) {
4522
6144
  try {
4523
6145
  const decoded = decodeErrorResult2({
4524
- abi: AppController_default,
6146
+ abi: appControllerAbiFor(environmentConfig),
4525
6147
  data: callError.data
4526
6148
  });
4527
6149
  const formattedError = formatAppControllerError(decoded);
@@ -4574,7 +6196,7 @@ function formatAppControllerError(decoded) {
4574
6196
  async function getActiveAppCount(publicClient, environmentConfig, user) {
4575
6197
  const count = await publicClient.readContract({
4576
6198
  address: environmentConfig.appControllerAddress,
4577
- abi: AppController_default,
6199
+ abi: appControllerAbiFor(environmentConfig),
4578
6200
  functionName: "getActiveAppCount",
4579
6201
  args: [user]
4580
6202
  });
@@ -4583,7 +6205,7 @@ async function getActiveAppCount(publicClient, environmentConfig, user) {
4583
6205
  async function getMaxActiveAppsPerUser(publicClient, environmentConfig, user) {
4584
6206
  const quota = await publicClient.readContract({
4585
6207
  address: environmentConfig.appControllerAddress,
4586
- abi: AppController_default,
6208
+ abi: appControllerAbiFor(environmentConfig),
4587
6209
  functionName: "getMaxActiveAppsPerUser",
4588
6210
  args: [user]
4589
6211
  });
@@ -4592,7 +6214,7 @@ async function getMaxActiveAppsPerUser(publicClient, environmentConfig, user) {
4592
6214
  async function getAppsByDeveloper(publicClient, environmentConfig, developer, offset, limit) {
4593
6215
  const result = await publicClient.readContract({
4594
6216
  address: environmentConfig.appControllerAddress,
4595
- abi: AppController_default,
6217
+ abi: appControllerAbiFor(environmentConfig),
4596
6218
  functionName: "getAppsByDeveloper",
4597
6219
  args: [developer, offset, limit]
4598
6220
  });
@@ -4604,7 +6226,7 @@ async function getAppsByDeveloper(publicClient, environmentConfig, developer, of
4604
6226
  async function getBillingType(publicClient, environmentConfig, app) {
4605
6227
  const result = await publicClient.readContract({
4606
6228
  address: environmentConfig.appControllerAddress,
4607
- abi: AppController_default,
6229
+ abi: appControllerAbiFor(environmentConfig),
4608
6230
  functionName: "getBillingType",
4609
6231
  args: [app]
4610
6232
  });
@@ -4613,7 +6235,7 @@ async function getBillingType(publicClient, environmentConfig, app) {
4613
6235
  async function getAppsByBillingAccount(publicClient, environmentConfig, account, offset, limit) {
4614
6236
  const result = await publicClient.readContract({
4615
6237
  address: environmentConfig.appControllerAddress,
4616
- abi: AppController_default,
6238
+ abi: appControllerAbiFor(environmentConfig),
4617
6239
  functionName: "getAppsByBillingAccount",
4618
6240
  args: [account, offset, limit]
4619
6241
  });
@@ -4647,7 +6269,7 @@ async function getAppLatestReleaseBlockNumbers(publicClient, environmentConfig,
4647
6269
  appIDs.map(
4648
6270
  (appID) => publicClient.readContract({
4649
6271
  address: environmentConfig.appControllerAddress,
4650
- abi: AppController_default,
6272
+ abi: appControllerAbiFor(environmentConfig),
4651
6273
  functionName: "getAppLatestReleaseBlockNumber",
4652
6274
  args: [appID]
4653
6275
  }).catch(() => null)
@@ -4726,6 +6348,35 @@ async function undelegate(options, logger = noopLogger) {
4726
6348
  return hash;
4727
6349
  }
4728
6350
 
6351
+ // src/client/common/gas/insufficientGas.ts
6352
+ import { formatEther } from "viem";
6353
+ var InsufficientGasError = class extends Error {
6354
+ constructor(args) {
6355
+ const requiredEth = formatEther(args.requiredWei);
6356
+ const availableEth = formatEther(args.availableWei);
6357
+ super(
6358
+ `Insufficient ETH for gas: wallet ${args.address} has ${availableEth} ETH but this transaction needs ~${requiredEth} ETH.
6359
+ Compute credits do not pay on-chain gas \u2014 fund the wallet with ETH and retry.`
6360
+ );
6361
+ this.name = "InsufficientGasError";
6362
+ this.address = args.address;
6363
+ this.requiredWei = args.requiredWei;
6364
+ this.availableWei = args.availableWei;
6365
+ this.requiredEth = requiredEth;
6366
+ this.availableEth = availableEth;
6367
+ }
6368
+ };
6369
+ async function assertSufficientGas(args) {
6370
+ const availableWei = await args.publicClient.getBalance({ address: args.address });
6371
+ if (availableWei < args.gasEstimate.maxCostWei) {
6372
+ throw new InsufficientGasError({
6373
+ address: args.address,
6374
+ requiredWei: args.gasEstimate.maxCostWei,
6375
+ availableWei
6376
+ });
6377
+ }
6378
+ }
6379
+
4729
6380
  // src/client/common/utils/userapi.ts
4730
6381
  import axios2 from "axios";
4731
6382
 
@@ -4789,6 +6440,7 @@ import axios from "axios";
4789
6440
  var MAX_RETRIES = 5;
4790
6441
  var INITIAL_BACKOFF_MS = 1e3;
4791
6442
  var MAX_BACKOFF_MS = 3e4;
6443
+ var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
4792
6444
  function sleep(ms) {
4793
6445
  return new Promise((resolve2) => setTimeout(resolve2, ms));
4794
6446
  }
@@ -4808,7 +6460,7 @@ async function requestWithRetry(config) {
4808
6460
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
4809
6461
  const res = await axios({ ...config, validateStatus: () => true });
4810
6462
  lastResponse = res;
4811
- if (res.status !== 429) {
6463
+ if (!RETRYABLE_STATUSES.has(res.status)) {
4812
6464
  return res;
4813
6465
  }
4814
6466
  if (attempt < MAX_RETRIES) {
@@ -4837,7 +6489,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4837
6489
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4838
6490
  var CanUpdateAppProfilePermission = "0x036fef61";
4839
6491
  function getDefaultClientId() {
4840
- const version = true ? "1.0.0-dev.6" : "0.0.0";
6492
+ const version = true ? "1.0.0-dev.8" : "0.0.0";
4841
6493
  return `ecloud-sdk/v${version}`;
4842
6494
  }
4843
6495
  var UserApiClient = class {
@@ -5175,8 +6827,36 @@ function transformAppRelease(raw) {
5175
6827
 
5176
6828
  // src/client/common/contract/watcher.ts
5177
6829
  var WATCH_POLL_INTERVAL_SECONDS = 5;
6830
+ var WATCH_HEARTBEAT_INTERVAL_SECONDS = 30;
6831
+ var WATCH_DEFAULT_TIMEOUT_SECONDS = 10 * 60;
5178
6832
  var APP_STATUS_RUNNING = "Running";
5179
6833
  var APP_STATUS_FAILED = "Failed";
6834
+ var WatchTimeoutError = class extends Error {
6835
+ constructor(args) {
6836
+ super(
6837
+ args.message ?? `Timed out after ${args.elapsedSeconds}s waiting for app ${args.appId} (last status: ${args.lastStatus ?? "unknown"})`
6838
+ );
6839
+ this.name = "WatchTimeoutError";
6840
+ this.appId = args.appId;
6841
+ this.elapsedSeconds = args.elapsedSeconds;
6842
+ this.lastStatus = args.lastStatus;
6843
+ this.timeoutSeconds = args.timeoutSeconds;
6844
+ }
6845
+ };
6846
+ function resolveWatchTimeoutSeconds(explicit) {
6847
+ if (typeof explicit === "number" && Number.isFinite(explicit) && explicit > 0) {
6848
+ return Math.floor(explicit);
6849
+ }
6850
+ const raw = process.env.ECLOUD_WATCH_TIMEOUT_SECONDS;
6851
+ if (raw === void 0 || raw === "") {
6852
+ return WATCH_DEFAULT_TIMEOUT_SECONDS;
6853
+ }
6854
+ const parsed = Number(raw);
6855
+ if (!Number.isFinite(parsed) || parsed <= 0) {
6856
+ return WATCH_DEFAULT_TIMEOUT_SECONDS;
6857
+ }
6858
+ return Math.floor(parsed);
6859
+ }
5180
6860
  async function watchUntilRunning(options, logger) {
5181
6861
  const { walletClient, publicClient, environmentConfig, appId } = options;
5182
6862
  const userApiClient = new UserApiClient(environmentConfig, walletClient, publicClient);
@@ -5207,8 +6887,20 @@ async function watchUntilRunning(options, logger) {
5207
6887
  return false;
5208
6888
  };
5209
6889
  const startTime = Date.now();
6890
+ const timeoutSeconds = resolveWatchTimeoutSeconds(options.timeoutSeconds);
5210
6891
  let lastLoggedStatus;
6892
+ let lastHeartbeatAt = startTime;
5211
6893
  while (true) {
6894
+ const elapsedMs = Date.now() - startTime;
6895
+ const elapsed = Math.round(elapsedMs / 1e3);
6896
+ if (elapsed >= timeoutSeconds) {
6897
+ throw new WatchTimeoutError({
6898
+ appId,
6899
+ elapsedSeconds: elapsed,
6900
+ lastStatus: lastLoggedStatus,
6901
+ timeoutSeconds
6902
+ });
6903
+ }
5212
6904
  try {
5213
6905
  const info = await userApiClient.getInfos([appId], 1);
5214
6906
  if (info.length === 0) {
@@ -5218,16 +6910,22 @@ async function watchUntilRunning(options, logger) {
5218
6910
  const appInfo = info[0];
5219
6911
  const currentStatus = appInfo.status;
5220
6912
  const currentIP = appInfo.ip || "";
5221
- const elapsed = Math.round((Date.now() - startTime) / 1e3);
5222
6913
  if (currentStatus !== lastLoggedStatus) {
5223
6914
  logger.info(`Status: ${currentStatus} (${elapsed}s)`);
5224
6915
  lastLoggedStatus = currentStatus;
6916
+ lastHeartbeatAt = Date.now();
6917
+ } else if (Date.now() - lastHeartbeatAt >= WATCH_HEARTBEAT_INTERVAL_SECONDS * 1e3) {
6918
+ logger.info(`Status: ${currentStatus} (${elapsed}s)`);
6919
+ lastHeartbeatAt = Date.now();
5225
6920
  }
5226
6921
  if (stopCondition(currentStatus, currentIP)) {
5227
6922
  return currentIP || void 0;
5228
6923
  }
5229
6924
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5230
6925
  } catch (error) {
6926
+ if (error instanceof WatchTimeoutError) {
6927
+ throw error;
6928
+ }
5231
6929
  logger.warn(`Failed to fetch app info: ${error.message}`);
5232
6930
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5233
6931
  }
@@ -5236,6 +6934,7 @@ async function watchUntilRunning(options, logger) {
5236
6934
  var APP_STATUS_STOPPED = "Stopped";
5237
6935
  async function watchUntilUpgradeComplete(options, logger) {
5238
6936
  const { walletClient, publicClient, environmentConfig, appId } = options;
6937
+ const timeoutSeconds = resolveWatchTimeoutSeconds(options.timeoutSeconds);
5239
6938
  const userApiClient = new UserApiClient(environmentConfig, walletClient, publicClient);
5240
6939
  let initialStatus;
5241
6940
  let initialIP;
@@ -5273,7 +6972,20 @@ async function watchUntilUpgradeComplete(options, logger) {
5273
6972
  }
5274
6973
  return false;
5275
6974
  };
6975
+ const startTime = Date.now();
6976
+ const deadline = startTime + timeoutSeconds * 1e3;
6977
+ let lastLoggedStatus;
6978
+ let lastObservedStatus;
5276
6979
  while (true) {
6980
+ if (Date.now() >= deadline) {
6981
+ const elapsedSeconds = Math.round((Date.now() - startTime) / 1e3);
6982
+ throw new WatchTimeoutError({
6983
+ appId,
6984
+ lastStatus: lastObservedStatus,
6985
+ elapsedSeconds,
6986
+ timeoutSeconds
6987
+ });
6988
+ }
5277
6989
  try {
5278
6990
  const info = await userApiClient.getInfos([appId], 1);
5279
6991
  if (info.length === 0) {
@@ -5283,11 +6995,23 @@ async function watchUntilUpgradeComplete(options, logger) {
5283
6995
  const appInfo = info[0];
5284
6996
  const currentStatus = appInfo.status;
5285
6997
  const currentIP = appInfo.ip || "";
6998
+ lastObservedStatus = currentStatus;
6999
+ const elapsed = Math.round((Date.now() - startTime) / 1e3);
7000
+ if (currentStatus !== lastLoggedStatus) {
7001
+ logger.info(`Status: ${currentStatus} (${elapsed}s)`);
7002
+ lastLoggedStatus = currentStatus;
7003
+ }
5286
7004
  if (stopCondition(currentStatus, currentIP)) {
5287
7005
  return;
5288
7006
  }
5289
7007
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5290
7008
  } catch (error) {
7009
+ if (error instanceof WatchTimeoutError) {
7010
+ throw error;
7011
+ }
7012
+ if (typeof error?.message === "string" && error.message.includes("Failed")) {
7013
+ throw error;
7014
+ }
5291
7015
  logger.warn(`Failed to fetch app info: ${error.message}`);
5292
7016
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5293
7017
  }
@@ -5621,6 +7345,8 @@ var ENVIRONMENTS = {
5621
7345
  name: "sepolia",
5622
7346
  build: "dev",
5623
7347
  appControllerAddress: "0xa86DC1C47cb2518327fB4f9A1627F51966c83B92",
7348
+ releaseAbiVersion: "v1.5",
7349
+ // AppController upgraded to v1.5.x (containerPolicy)
5624
7350
  permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
5625
7351
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5626
7352
  kmsServerURL: "http://10.128.0.57:8080",
@@ -5634,6 +7360,8 @@ var ENVIRONMENTS = {
5634
7360
  name: "sepolia",
5635
7361
  build: "prod",
5636
7362
  appControllerAddress: "0x0dd810a6ffba6a9820a10d97b659f07d8d23d4E2",
7363
+ releaseAbiVersion: "v1.4",
7364
+ // prod still on AppController v1.4.0 (3-field Release)
5637
7365
  permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
5638
7366
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5639
7367
  kmsServerURL: "http://10.128.15.203:8080",
@@ -5648,6 +7376,8 @@ var ENVIRONMENTS = {
5648
7376
  name: "mainnet-alpha",
5649
7377
  build: "prod",
5650
7378
  appControllerAddress: "0xc38d35Fc995e75342A21CBd6D770305b142Fbe67",
7379
+ releaseAbiVersion: "v1.4",
7380
+ // prod still on AppController v1.4.0 (3-field Release)
5651
7381
  permissionControllerAddress: ChainAddresses[MAINNET_CHAIN_ID].PermissionController,
5652
7382
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5653
7383
  kmsServerURL: "http://10.128.0.2:8080",
@@ -6502,6 +8232,11 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
6502
8232
  executions: batch.executions,
6503
8233
  authorizationList
6504
8234
  });
8235
+ await assertSufficientGas({
8236
+ publicClient: batch.publicClient,
8237
+ address: batch.walletClient.account.address,
8238
+ gasEstimate
8239
+ });
6505
8240
  const data = {
6506
8241
  appId: batch.appId,
6507
8242
  salt: batch.salt,
@@ -6760,6 +8495,11 @@ async function prepareDeploy(options, logger = defaultLogger) {
6760
8495
  executions: batch.executions,
6761
8496
  authorizationList
6762
8497
  });
8498
+ await assertSufficientGas({
8499
+ publicClient: batch.publicClient,
8500
+ address: batch.walletClient.account.address,
8501
+ gasEstimate
8502
+ });
6763
8503
  const data = {
6764
8504
  appId: batch.appId,
6765
8505
  salt: batch.salt,
@@ -6796,7 +8536,7 @@ async function executeDeploy(options) {
6796
8536
  }
6797
8537
  );
6798
8538
  }
6799
- async function watchDeployment(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry) {
8539
+ async function watchDeployment(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry, opts) {
6800
8540
  return withSDKTelemetry(
6801
8541
  {
6802
8542
  functionName: "watchDeployment",
@@ -6812,7 +8552,8 @@ async function watchDeployment(appId, walletClient, publicClient, environmentCon
6812
8552
  walletClient,
6813
8553
  publicClient,
6814
8554
  environmentConfig,
6815
- appId
8555
+ appId,
8556
+ timeoutSeconds: opts?.timeoutSeconds
6816
8557
  },
6817
8558
  logger
6818
8559
  );
@@ -6908,6 +8649,11 @@ async function prepareUpgradeFromVerifiableBuild(options, logger = defaultLogger
6908
8649
  executions: batch.executions,
6909
8650
  authorizationList
6910
8651
  });
8652
+ await assertSufficientGas({
8653
+ publicClient: batch.publicClient,
8654
+ address: batch.walletClient.account.address,
8655
+ gasEstimate
8656
+ });
6911
8657
  const data = {
6912
8658
  appId: batch.appId,
6913
8659
  executions: batch.executions,
@@ -7097,6 +8843,11 @@ async function prepareUpgrade(options, logger = defaultLogger) {
7097
8843
  executions: batch.executions,
7098
8844
  authorizationList
7099
8845
  });
8846
+ await assertSufficientGas({
8847
+ publicClient: batch.publicClient,
8848
+ address: batch.walletClient.account.address,
8849
+ gasEstimate
8850
+ });
7100
8851
  const data = {
7101
8852
  appId: batch.appId,
7102
8853
  executions: batch.executions,
@@ -7131,7 +8882,7 @@ async function executeUpgrade(options) {
7131
8882
  }
7132
8883
  );
7133
8884
  }
7134
- async function watchUpgrade(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry) {
8885
+ async function watchUpgrade(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry, opts) {
7135
8886
  return withSDKTelemetry(
7136
8887
  {
7137
8888
  functionName: "watchUpgrade",
@@ -7147,7 +8898,8 @@ async function watchUpgrade(appId, walletClient, publicClient, environmentConfig
7147
8898
  walletClient,
7148
8899
  publicClient,
7149
8900
  environmentConfig,
7150
- appId
8901
+ appId,
8902
+ timeoutSeconds: opts?.timeoutSeconds
7151
8903
  },
7152
8904
  logger
7153
8905
  );
@@ -7839,7 +9591,7 @@ function createAppModule(ctx) {
7839
9591
  }
7840
9592
  const account = walletClient.account;
7841
9593
  const environment = getEnvironmentConfig(ctx.environment);
7842
- const logger = getLogger(ctx.verbose);
9594
+ const logger = ctx.logger ?? getLogger(ctx.verbose);
7843
9595
  return {
7844
9596
  async create(opts) {
7845
9597
  return createApp(opts, logger);
@@ -7951,14 +9703,15 @@ function createAppModule(ctx) {
7951
9703
  imageRef: result.imageRef
7952
9704
  };
7953
9705
  },
7954
- async watchDeployment(appId) {
9706
+ async watchDeployment(appId, opts) {
7955
9707
  return watchDeployment(
7956
9708
  appId,
7957
9709
  walletClient,
7958
9710
  publicClient,
7959
9711
  environment,
7960
9712
  logger,
7961
- skipTelemetry
9713
+ skipTelemetry,
9714
+ opts
7962
9715
  );
7963
9716
  },
7964
9717
  // Granular upgrade control
@@ -8016,8 +9769,16 @@ function createAppModule(ctx) {
8016
9769
  imageRef: result.imageRef
8017
9770
  };
8018
9771
  },
8019
- async watchUpgrade(appId) {
8020
- return watchUpgrade(appId, walletClient, publicClient, environment, logger, skipTelemetry);
9772
+ async watchUpgrade(appId, opts) {
9773
+ return watchUpgrade(
9774
+ appId,
9775
+ walletClient,
9776
+ publicClient,
9777
+ environment,
9778
+ logger,
9779
+ skipTelemetry,
9780
+ opts
9781
+ );
8021
9782
  },
8022
9783
  // Profile management
8023
9784
  async setProfile(appId, profile) {
@@ -9527,8 +11288,10 @@ export {
9527
11288
  BuildError,
9528
11289
  BuildFailedError,
9529
11290
  ConflictError,
11291
+ EMPTY_CONTAINER_POLICY,
9530
11292
  ERC20_default as ERC20ABI,
9531
11293
  ForbiddenError,
11294
+ InsufficientGasError,
9532
11295
  JwtProvider,
9533
11296
  NoopClient,
9534
11297
  NotFoundError,
@@ -9538,9 +11301,12 @@ export {
9538
11301
  TimeoutError,
9539
11302
  USDCCredits_default as USDCCreditsABI,
9540
11303
  UserApiClient,
11304
+ WATCH_DEFAULT_TIMEOUT_SECONDS,
11305
+ WatchTimeoutError,
9541
11306
  addHexPrefix,
9542
11307
  addMetric,
9543
11308
  addMetricWithDimensions,
11309
+ assertSufficientGas,
9544
11310
  assertValidFilePath,
9545
11311
  assertValidImageReference,
9546
11312
  assertValidPrivateKey,