@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/compute.cjs CHANGED
@@ -167,7 +167,7 @@ __export(compute_exports, {
167
167
  module.exports = __toCommonJS(compute_exports);
168
168
 
169
169
  // src/client/modules/compute/app/index.ts
170
- var import_viem6 = require("viem");
170
+ var import_viem7 = require("viem");
171
171
 
172
172
  // src/client/common/docker/build.ts
173
173
  var child_process = __toESM(require("child_process"), 1);
@@ -456,7 +456,74 @@ var PushPermissionError = class extends Error {
456
456
  var import_handlebars = __toESM(require("handlebars"), 1);
457
457
 
458
458
  // src/client/common/templates/Dockerfile.layered.tmpl
459
- 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';
459
+ var Dockerfile_layered_default = `{{#if includeTLS}}
460
+ # Get Caddy from official image
461
+ FROM caddy:2.10.2-alpine AS caddy
462
+ {{/if}}
463
+
464
+ FROM {{baseImage}}
465
+
466
+ {{#if originalUser}}
467
+ # Switch to root to perform setup (base image has non-root USER: {{originalUser}})
468
+ USER root
469
+ {{/if}}
470
+
471
+ # Copy core TEE components
472
+ # CA bundle for kms-client / tls-keygen to validate HTTPS calls to
473
+ # eigencloud.xyz endpoints. Bundled at a non-standard path and consumed
474
+ # only via SSL_CERT_FILE in compute-source-env.sh, so the user's
475
+ # /etc/ssl/ is never touched.
476
+ COPY --from=alpine:3.20.10 /etc/ssl/certs/ca-certificates.crt /usr/local/share/eigenx-ca-certs.crt
477
+ COPY compute-source-env.sh /usr/local/bin/
478
+ COPY kms-client /usr/local/bin/
479
+ COPY kms-signing-public-key.pem /usr/local/bin/
480
+
481
+ {{#if includeTLS}}
482
+ # Copy Caddy from official image
483
+ COPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy
484
+
485
+ # Copy TLS components
486
+ COPY tls-keygen /usr/local/bin/
487
+ COPY Caddyfile /etc/caddy/
488
+ {{/if}}
489
+
490
+ {{#if originalUser}}
491
+ # Make binaries executable (755 for executables, 644 for keys)
492
+ RUN chmod 755 /usr/local/bin/compute-source-env.sh \\
493
+ && chmod 755 /usr/local/bin/kms-client{{#if includeTLS}} \\
494
+ && chmod 755 /usr/local/bin/tls-keygen \\
495
+ && chmod 755 /usr/local/bin/caddy{{/if}} \\
496
+ && chmod 644 /usr/local/bin/kms-signing-public-key.pem
497
+
498
+ # Store original user - entrypoint will drop privileges to this user after TEE setup
499
+ ENV __ECLOUD_ORIGINAL_USER={{originalUser}}
500
+ {{else}}
501
+ # Make binaries executable (preserve existing permissions, just add execute)
502
+ RUN chmod +x /usr/local/bin/compute-source-env.sh \\
503
+ && chmod +x /usr/local/bin/kms-client{{#if includeTLS}} \\
504
+ && chmod +x /usr/local/bin/tls-keygen{{/if}}
505
+ {{/if}}
506
+
507
+ {{#if logRedirect}}
508
+
509
+ LABEL tee.launch_policy.log_redirect={{logRedirect}}
510
+ {{/if}}
511
+ {{#if resourceUsageAllow}}
512
+
513
+ LABEL tee.launch_policy.monitoring_memory_allow={{resourceUsageAllow}}
514
+ {{/if}}
515
+
516
+ LABEL eigenx_cli_version={{ecloudCLIVersion}}
517
+ LABEL eigenx_vm_image=eigen
518
+
519
+ {{#if includeTLS}}
520
+ # Expose both HTTP and HTTPS ports for Caddy
521
+ EXPOSE 80 443
522
+ {{/if}}
523
+
524
+ ENTRYPOINT ["/usr/local/bin/compute-source-env.sh"]
525
+ CMD {{{originalCmd}}}
526
+ `;
460
527
 
461
528
  // src/client/common/templates/dockerfileTemplate.ts
462
529
  function processDockerfileTemplate(data) {
@@ -473,7 +540,7 @@ echo "compute-source-env.sh: Running setup script..."
473
540
 
474
541
  # Fetch and source environment variables from KMS
475
542
  echo "Fetching secrets from KMS..."
476
- if /usr/local/bin/kms-client \\
543
+ if SSL_CERT_FILE=/usr/local/share/eigenx-ca-certs.crt /usr/local/bin/kms-client \\
477
544
  --kms-server-url "{{kmsServerURL}}" \\
478
545
  --kms-signing-key-file /usr/local/bin/kms-signing-public-key.pem \\
479
546
  --userapi-url "{{userAPIURL}}" \\
@@ -531,7 +598,8 @@ setup_tls() {
531
598
 
532
599
  echo "compute-source-env.sh: Obtaining TLS certificate using $challenge challenge..."
533
600
  # Pass the API URL for certificate persistence
534
- if ! MNEMONIC="$mnemonic" DOMAIN="$domain" API_URL="{{userAPIURL}}" /usr/local/bin/tls-keygen \\
601
+ if ! SSL_CERT_FILE=/usr/local/share/eigenx-ca-certs.crt \\
602
+ MNEMONIC="$mnemonic" DOMAIN="$domain" API_URL="{{userAPIURL}}" /usr/local/bin/tls-keygen \\
535
603
  -challenge "$challenge" \\
536
604
  $staging_flag; then
537
605
  echo "compute-source-env.sh: ERROR - Failed to obtain TLS certificate"
@@ -924,16 +992,7 @@ async function extractDigestFromSinglePlatform(manifest, imageRef) {
924
992
  architecture: inspectData[0].Architecture
925
993
  } : null;
926
994
  if (!config) {
927
- if (manifest.config?.digest) {
928
- const digest = hexStringToBytes32(manifest.config.digest);
929
- const registry = extractRegistryName(imageRef);
930
- return {
931
- digest,
932
- registry,
933
- platform: DOCKER_PLATFORM
934
- };
935
- }
936
- throw new Error(`Could not determine platform for ${imageRef}`);
995
+ throw createPlatformErrorMessage(imageRef, ["unknown (could not determine architecture)"]);
937
996
  }
938
997
  const platform2 = `${config.os}/${config.architecture}`;
939
998
  if (platform2 === DOCKER_PLATFORM) {
@@ -1005,14 +1064,11 @@ Image: ${imageRef}
1005
1064
  Found platform(s): ${platforms.join(", ")}
1006
1065
  Required platform: ${DOCKER_PLATFORM}
1007
1066
 
1008
- To fix this issue:
1009
- 1. Manual fix:
1010
- a. Rebuild your image with the correct platform:
1011
- docker build --platform ${DOCKER_PLATFORM} -t ${imageRef} .
1012
- b. Push the rebuilt image to your remote registry:
1013
- docker push ${imageRef}
1014
-
1015
- 2. Or use the SDK to build with the correct platform automatically.`;
1067
+ To fix, either:
1068
+ 1. Rebuild the image for ${DOCKER_PLATFORM} and push it:
1069
+ docker buildx build --platform ${DOCKER_PLATFORM} -t ${imageRef} --push .
1070
+ 2. Or use a verifiable build (--verifiable --repo <repo> --commit <sha>), which
1071
+ builds server-side and needs no local Docker.`;
1016
1072
  return new Error(errorMsg);
1017
1073
  }
1018
1074
 
@@ -1117,6 +1173,8 @@ async function prepareRelease(options, logger) {
1117
1173
  logger.info(`Waiting ${REGISTRY_PROPAGATION_WAIT_SECONDS} seconds for registry propagation...`);
1118
1174
  await new Promise((resolve2) => setTimeout(resolve2, REGISTRY_PROPAGATION_WAIT_SECONDS * 1e3));
1119
1175
  } else {
1176
+ logger.info("Verifying image platform (linux/amd64)...");
1177
+ await getImageDigestAndName(imageRef);
1120
1178
  logger.info("Checking if image needs layering...");
1121
1179
  finalImageRef = await layerRemoteImageIfNeeded(
1122
1180
  {
@@ -1275,6 +1333,13 @@ function extractRegistryNameNoDocker(imageRef) {
1275
1333
  var import_viem = require("viem");
1276
1334
 
1277
1335
  // src/client/common/types/index.ts
1336
+ var EMPTY_CONTAINER_POLICY = {
1337
+ args: [],
1338
+ cmdOverride: [],
1339
+ env: [],
1340
+ envOverride: [],
1341
+ restartPolicy: ""
1342
+ };
1278
1343
  var noopLogger = {
1279
1344
  debug: () => {
1280
1345
  },
@@ -2515,32 +2580,1577 @@ async function executeBatch(options, logger = noopLogger) {
2515
2580
  } else {
2516
2581
  revertReason = callError.message || "Unknown reason";
2517
2582
  }
2518
- }
2519
- throw new Error(`Transaction reverted: ${hash}. Reason: ${revertReason}`);
2583
+ }
2584
+ throw new Error(`Transaction reverted: ${hash}. Reason: ${revertReason}`);
2585
+ }
2586
+ return hash;
2587
+ }
2588
+
2589
+ // src/client/common/contract/caller.ts
2590
+ var import_viem3 = require("viem");
2591
+
2592
+ // src/client/common/utils/helpers.ts
2593
+ var import_viem2 = require("viem");
2594
+ var import_chains2 = require("viem/chains");
2595
+ var import_accounts = require("viem/accounts");
2596
+ function getChainFromID(chainID, fallback2 = import_chains2.sepolia) {
2597
+ const id = Number(chainID);
2598
+ return (0, import_viem2.extractChain)({ chains: SUPPORTED_CHAINS, id }) || fallback2;
2599
+ }
2600
+ function addHexPrefix(value) {
2601
+ return value.startsWith("0x") ? value : `0x${value}`;
2602
+ }
2603
+ function stripHexPrefix(value) {
2604
+ return value.startsWith("0x") ? value.slice(2) : value;
2605
+ }
2606
+
2607
+ // src/client/common/abis/AppController.json
2608
+ var AppController_default = [
2609
+ {
2610
+ type: "constructor",
2611
+ inputs: [
2612
+ {
2613
+ name: "_version",
2614
+ type: "string",
2615
+ internalType: "string"
2616
+ },
2617
+ {
2618
+ name: "_permissionController",
2619
+ type: "address",
2620
+ internalType: "contractIPermissionController"
2621
+ },
2622
+ {
2623
+ name: "_releaseManager",
2624
+ type: "address",
2625
+ internalType: "contractIReleaseManager"
2626
+ },
2627
+ {
2628
+ name: "_computeAVSRegistrar",
2629
+ type: "address",
2630
+ internalType: "contractIComputeAVSRegistrar"
2631
+ },
2632
+ {
2633
+ name: "_computeOperator",
2634
+ type: "address",
2635
+ internalType: "contractIComputeOperator"
2636
+ },
2637
+ {
2638
+ name: "_appBeacon",
2639
+ type: "address",
2640
+ internalType: "contractIBeacon"
2641
+ }
2642
+ ],
2643
+ stateMutability: "nonpayable"
2644
+ },
2645
+ {
2646
+ type: "function",
2647
+ name: "API_PERMISSION_TYPEHASH",
2648
+ inputs: [],
2649
+ outputs: [
2650
+ {
2651
+ name: "",
2652
+ type: "bytes32",
2653
+ internalType: "bytes32"
2654
+ }
2655
+ ],
2656
+ stateMutability: "view"
2657
+ },
2658
+ {
2659
+ type: "function",
2660
+ name: "appBeacon",
2661
+ inputs: [],
2662
+ outputs: [
2663
+ {
2664
+ name: "",
2665
+ type: "address",
2666
+ internalType: "contractIBeacon"
2667
+ }
2668
+ ],
2669
+ stateMutability: "view"
2670
+ },
2671
+ {
2672
+ type: "function",
2673
+ name: "calculateApiPermissionDigestHash",
2674
+ inputs: [
2675
+ {
2676
+ name: "permission",
2677
+ type: "bytes4",
2678
+ internalType: "bytes4"
2679
+ },
2680
+ {
2681
+ name: "expiry",
2682
+ type: "uint256",
2683
+ internalType: "uint256"
2684
+ }
2685
+ ],
2686
+ outputs: [
2687
+ {
2688
+ name: "",
2689
+ type: "bytes32",
2690
+ internalType: "bytes32"
2691
+ }
2692
+ ],
2693
+ stateMutability: "view"
2694
+ },
2695
+ {
2696
+ type: "function",
2697
+ name: "calculateAppId",
2698
+ inputs: [
2699
+ {
2700
+ name: "deployer",
2701
+ type: "address",
2702
+ internalType: "address"
2703
+ },
2704
+ {
2705
+ name: "salt",
2706
+ type: "bytes32",
2707
+ internalType: "bytes32"
2708
+ }
2709
+ ],
2710
+ outputs: [
2711
+ {
2712
+ name: "",
2713
+ type: "address",
2714
+ internalType: "contractIApp"
2715
+ }
2716
+ ],
2717
+ stateMutability: "view"
2718
+ },
2719
+ {
2720
+ type: "function",
2721
+ name: "computeAVSRegistrar",
2722
+ inputs: [],
2723
+ outputs: [
2724
+ {
2725
+ name: "",
2726
+ type: "address",
2727
+ internalType: "contractIComputeAVSRegistrar"
2728
+ }
2729
+ ],
2730
+ stateMutability: "view"
2731
+ },
2732
+ {
2733
+ type: "function",
2734
+ name: "computeOperator",
2735
+ inputs: [],
2736
+ outputs: [
2737
+ {
2738
+ name: "",
2739
+ type: "address",
2740
+ internalType: "contractIComputeOperator"
2741
+ }
2742
+ ],
2743
+ stateMutability: "view"
2744
+ },
2745
+ {
2746
+ type: "function",
2747
+ name: "confirmUpgrade",
2748
+ inputs: [
2749
+ {
2750
+ name: "app",
2751
+ type: "address",
2752
+ internalType: "contractIApp"
2753
+ }
2754
+ ],
2755
+ outputs: [],
2756
+ stateMutability: "nonpayable"
2757
+ },
2758
+ {
2759
+ type: "function",
2760
+ name: "createApp",
2761
+ inputs: [
2762
+ {
2763
+ name: "salt",
2764
+ type: "bytes32",
2765
+ internalType: "bytes32"
2766
+ },
2767
+ {
2768
+ name: "release",
2769
+ type: "tuple",
2770
+ internalType: "structIAppController.Release",
2771
+ components: [
2772
+ {
2773
+ name: "rmsRelease",
2774
+ type: "tuple",
2775
+ internalType: "structIReleaseManagerTypes.Release",
2776
+ components: [
2777
+ {
2778
+ name: "artifacts",
2779
+ type: "tuple[]",
2780
+ internalType: "structIReleaseManagerTypes.Artifact[]",
2781
+ components: [
2782
+ {
2783
+ name: "digest",
2784
+ type: "bytes32",
2785
+ internalType: "bytes32"
2786
+ },
2787
+ {
2788
+ name: "registry",
2789
+ type: "string",
2790
+ internalType: "string"
2791
+ }
2792
+ ]
2793
+ },
2794
+ {
2795
+ name: "upgradeByTime",
2796
+ type: "uint32",
2797
+ internalType: "uint32"
2798
+ }
2799
+ ]
2800
+ },
2801
+ {
2802
+ name: "publicEnv",
2803
+ type: "bytes",
2804
+ internalType: "bytes"
2805
+ },
2806
+ {
2807
+ name: "encryptedEnv",
2808
+ type: "bytes",
2809
+ internalType: "bytes"
2810
+ },
2811
+ {
2812
+ name: "containerPolicy",
2813
+ type: "tuple",
2814
+ internalType: "structIAppController.ContainerPolicy",
2815
+ components: [
2816
+ {
2817
+ name: "args",
2818
+ type: "string[]",
2819
+ internalType: "string[]"
2820
+ },
2821
+ {
2822
+ name: "cmdOverride",
2823
+ type: "string[]",
2824
+ internalType: "string[]"
2825
+ },
2826
+ {
2827
+ name: "env",
2828
+ type: "tuple[]",
2829
+ internalType: "structIAppController.EnvVar[]",
2830
+ components: [
2831
+ {
2832
+ name: "key",
2833
+ type: "string",
2834
+ internalType: "string"
2835
+ },
2836
+ {
2837
+ name: "value",
2838
+ type: "string",
2839
+ internalType: "string"
2840
+ }
2841
+ ]
2842
+ },
2843
+ {
2844
+ name: "envOverride",
2845
+ type: "tuple[]",
2846
+ internalType: "structIAppController.EnvVar[]",
2847
+ components: [
2848
+ {
2849
+ name: "key",
2850
+ type: "string",
2851
+ internalType: "string"
2852
+ },
2853
+ {
2854
+ name: "value",
2855
+ type: "string",
2856
+ internalType: "string"
2857
+ }
2858
+ ]
2859
+ },
2860
+ {
2861
+ name: "restartPolicy",
2862
+ type: "string",
2863
+ internalType: "string"
2864
+ }
2865
+ ]
2866
+ }
2867
+ ]
2868
+ }
2869
+ ],
2870
+ outputs: [
2871
+ {
2872
+ name: "app",
2873
+ type: "address",
2874
+ internalType: "contractIApp"
2875
+ }
2876
+ ],
2877
+ stateMutability: "nonpayable"
2878
+ },
2879
+ {
2880
+ type: "function",
2881
+ name: "createAppWithIsolatedBilling",
2882
+ inputs: [
2883
+ {
2884
+ name: "salt",
2885
+ type: "bytes32",
2886
+ internalType: "bytes32"
2887
+ },
2888
+ {
2889
+ name: "release",
2890
+ type: "tuple",
2891
+ internalType: "structIAppController.Release",
2892
+ components: [
2893
+ {
2894
+ name: "rmsRelease",
2895
+ type: "tuple",
2896
+ internalType: "structIReleaseManagerTypes.Release",
2897
+ components: [
2898
+ {
2899
+ name: "artifacts",
2900
+ type: "tuple[]",
2901
+ internalType: "structIReleaseManagerTypes.Artifact[]",
2902
+ components: [
2903
+ {
2904
+ name: "digest",
2905
+ type: "bytes32",
2906
+ internalType: "bytes32"
2907
+ },
2908
+ {
2909
+ name: "registry",
2910
+ type: "string",
2911
+ internalType: "string"
2912
+ }
2913
+ ]
2914
+ },
2915
+ {
2916
+ name: "upgradeByTime",
2917
+ type: "uint32",
2918
+ internalType: "uint32"
2919
+ }
2920
+ ]
2921
+ },
2922
+ {
2923
+ name: "publicEnv",
2924
+ type: "bytes",
2925
+ internalType: "bytes"
2926
+ },
2927
+ {
2928
+ name: "encryptedEnv",
2929
+ type: "bytes",
2930
+ internalType: "bytes"
2931
+ },
2932
+ {
2933
+ name: "containerPolicy",
2934
+ type: "tuple",
2935
+ internalType: "structIAppController.ContainerPolicy",
2936
+ components: [
2937
+ {
2938
+ name: "args",
2939
+ type: "string[]",
2940
+ internalType: "string[]"
2941
+ },
2942
+ {
2943
+ name: "cmdOverride",
2944
+ type: "string[]",
2945
+ internalType: "string[]"
2946
+ },
2947
+ {
2948
+ name: "env",
2949
+ type: "tuple[]",
2950
+ internalType: "structIAppController.EnvVar[]",
2951
+ components: [
2952
+ {
2953
+ name: "key",
2954
+ type: "string",
2955
+ internalType: "string"
2956
+ },
2957
+ {
2958
+ name: "value",
2959
+ type: "string",
2960
+ internalType: "string"
2961
+ }
2962
+ ]
2963
+ },
2964
+ {
2965
+ name: "envOverride",
2966
+ type: "tuple[]",
2967
+ internalType: "structIAppController.EnvVar[]",
2968
+ components: [
2969
+ {
2970
+ name: "key",
2971
+ type: "string",
2972
+ internalType: "string"
2973
+ },
2974
+ {
2975
+ name: "value",
2976
+ type: "string",
2977
+ internalType: "string"
2978
+ }
2979
+ ]
2980
+ },
2981
+ {
2982
+ name: "restartPolicy",
2983
+ type: "string",
2984
+ internalType: "string"
2985
+ }
2986
+ ]
2987
+ }
2988
+ ]
2989
+ }
2990
+ ],
2991
+ outputs: [
2992
+ {
2993
+ name: "app",
2994
+ type: "address",
2995
+ internalType: "contractIApp"
2996
+ }
2997
+ ],
2998
+ stateMutability: "nonpayable"
2999
+ },
3000
+ {
3001
+ type: "function",
3002
+ name: "createEmptyApp",
3003
+ inputs: [
3004
+ {
3005
+ name: "salt",
3006
+ type: "bytes32",
3007
+ internalType: "bytes32"
3008
+ }
3009
+ ],
3010
+ outputs: [
3011
+ {
3012
+ name: "app",
3013
+ type: "address",
3014
+ internalType: "contractIApp"
3015
+ }
3016
+ ],
3017
+ stateMutability: "nonpayable"
3018
+ },
3019
+ {
3020
+ type: "function",
3021
+ name: "createEmptyAppWithIsolatedBilling",
3022
+ inputs: [
3023
+ {
3024
+ name: "salt",
3025
+ type: "bytes32",
3026
+ internalType: "bytes32"
3027
+ }
3028
+ ],
3029
+ outputs: [
3030
+ {
3031
+ name: "app",
3032
+ type: "address",
3033
+ internalType: "contractIApp"
3034
+ }
3035
+ ],
3036
+ stateMutability: "nonpayable"
3037
+ },
3038
+ {
3039
+ type: "function",
3040
+ name: "domainSeparator",
3041
+ inputs: [],
3042
+ outputs: [
3043
+ {
3044
+ name: "",
3045
+ type: "bytes32",
3046
+ internalType: "bytes32"
3047
+ }
3048
+ ],
3049
+ stateMutability: "view"
3050
+ },
3051
+ {
3052
+ type: "function",
3053
+ name: "getActiveAppCount",
3054
+ inputs: [
3055
+ {
3056
+ name: "user",
3057
+ type: "address",
3058
+ internalType: "address"
3059
+ }
3060
+ ],
3061
+ outputs: [
3062
+ {
3063
+ name: "",
3064
+ type: "uint32",
3065
+ internalType: "uint32"
3066
+ }
3067
+ ],
3068
+ stateMutability: "view"
3069
+ },
3070
+ {
3071
+ type: "function",
3072
+ name: "getAppCreator",
3073
+ inputs: [
3074
+ {
3075
+ name: "app",
3076
+ type: "address",
3077
+ internalType: "contractIApp"
3078
+ }
3079
+ ],
3080
+ outputs: [
3081
+ {
3082
+ name: "",
3083
+ type: "address",
3084
+ internalType: "address"
3085
+ }
3086
+ ],
3087
+ stateMutability: "view"
3088
+ },
3089
+ {
3090
+ type: "function",
3091
+ name: "getAppLatestReleaseBlockNumber",
3092
+ inputs: [
3093
+ {
3094
+ name: "app",
3095
+ type: "address",
3096
+ internalType: "contractIApp"
3097
+ }
3098
+ ],
3099
+ outputs: [
3100
+ {
3101
+ name: "",
3102
+ type: "uint32",
3103
+ internalType: "uint32"
3104
+ }
3105
+ ],
3106
+ stateMutability: "view"
3107
+ },
3108
+ {
3109
+ type: "function",
3110
+ name: "getAppOperatorSetId",
3111
+ inputs: [
3112
+ {
3113
+ name: "app",
3114
+ type: "address",
3115
+ internalType: "contractIApp"
3116
+ }
3117
+ ],
3118
+ outputs: [
3119
+ {
3120
+ name: "",
3121
+ type: "uint32",
3122
+ internalType: "uint32"
3123
+ }
3124
+ ],
3125
+ stateMutability: "view"
3126
+ },
3127
+ {
3128
+ type: "function",
3129
+ name: "getAppPendingReleaseBlockNumber",
3130
+ inputs: [
3131
+ {
3132
+ name: "app",
3133
+ type: "address",
3134
+ internalType: "contractIApp"
3135
+ }
3136
+ ],
3137
+ outputs: [
3138
+ {
3139
+ name: "",
3140
+ type: "uint32",
3141
+ internalType: "uint32"
3142
+ }
3143
+ ],
3144
+ stateMutability: "view"
3145
+ },
3146
+ {
3147
+ type: "function",
3148
+ name: "getAppStatus",
3149
+ inputs: [
3150
+ {
3151
+ name: "app",
3152
+ type: "address",
3153
+ internalType: "contractIApp"
3154
+ }
3155
+ ],
3156
+ outputs: [
3157
+ {
3158
+ name: "",
3159
+ type: "uint8",
3160
+ internalType: "enumIAppController.AppStatus"
3161
+ }
3162
+ ],
3163
+ stateMutability: "view"
3164
+ },
3165
+ {
3166
+ type: "function",
3167
+ name: "getApps",
3168
+ inputs: [
3169
+ {
3170
+ name: "offset",
3171
+ type: "uint256",
3172
+ internalType: "uint256"
3173
+ },
3174
+ {
3175
+ name: "limit",
3176
+ type: "uint256",
3177
+ internalType: "uint256"
3178
+ }
3179
+ ],
3180
+ outputs: [
3181
+ {
3182
+ name: "apps",
3183
+ type: "address[]",
3184
+ internalType: "contractIApp[]"
3185
+ },
3186
+ {
3187
+ name: "appConfigsMem",
3188
+ type: "tuple[]",
3189
+ internalType: "structIAppController.AppConfig[]",
3190
+ components: [
3191
+ {
3192
+ name: "creator",
3193
+ type: "address",
3194
+ internalType: "address"
3195
+ },
3196
+ {
3197
+ name: "operatorSetId",
3198
+ type: "uint32",
3199
+ internalType: "uint32"
3200
+ },
3201
+ {
3202
+ name: "latestReleaseBlockNumber",
3203
+ type: "uint32",
3204
+ internalType: "uint32"
3205
+ },
3206
+ {
3207
+ name: "pendingReleaseBlockNumber",
3208
+ type: "uint32",
3209
+ internalType: "uint32"
3210
+ },
3211
+ {
3212
+ name: "status",
3213
+ type: "uint8",
3214
+ internalType: "enumIAppController.AppStatus"
3215
+ }
3216
+ ]
3217
+ }
3218
+ ],
3219
+ stateMutability: "view"
3220
+ },
3221
+ {
3222
+ type: "function",
3223
+ name: "getAppsByBillingAccount",
3224
+ inputs: [
3225
+ {
3226
+ name: "account",
3227
+ type: "address",
3228
+ internalType: "address"
3229
+ },
3230
+ {
3231
+ name: "offset",
3232
+ type: "uint256",
3233
+ internalType: "uint256"
3234
+ },
3235
+ {
3236
+ name: "limit",
3237
+ type: "uint256",
3238
+ internalType: "uint256"
3239
+ }
3240
+ ],
3241
+ outputs: [
3242
+ {
3243
+ name: "apps",
3244
+ type: "address[]",
3245
+ internalType: "contractIApp[]"
3246
+ },
3247
+ {
3248
+ name: "appConfigsMem",
3249
+ type: "tuple[]",
3250
+ internalType: "structIAppController.AppConfig[]",
3251
+ components: [
3252
+ {
3253
+ name: "creator",
3254
+ type: "address",
3255
+ internalType: "address"
3256
+ },
3257
+ {
3258
+ name: "operatorSetId",
3259
+ type: "uint32",
3260
+ internalType: "uint32"
3261
+ },
3262
+ {
3263
+ name: "latestReleaseBlockNumber",
3264
+ type: "uint32",
3265
+ internalType: "uint32"
3266
+ },
3267
+ {
3268
+ name: "pendingReleaseBlockNumber",
3269
+ type: "uint32",
3270
+ internalType: "uint32"
3271
+ },
3272
+ {
3273
+ name: "status",
3274
+ type: "uint8",
3275
+ internalType: "enumIAppController.AppStatus"
3276
+ }
3277
+ ]
3278
+ }
3279
+ ],
3280
+ stateMutability: "view"
3281
+ },
3282
+ {
3283
+ type: "function",
3284
+ name: "getAppsByCreator",
3285
+ inputs: [
3286
+ {
3287
+ name: "creator",
3288
+ type: "address",
3289
+ internalType: "address"
3290
+ },
3291
+ {
3292
+ name: "offset",
3293
+ type: "uint256",
3294
+ internalType: "uint256"
3295
+ },
3296
+ {
3297
+ name: "limit",
3298
+ type: "uint256",
3299
+ internalType: "uint256"
3300
+ }
3301
+ ],
3302
+ outputs: [
3303
+ {
3304
+ name: "apps",
3305
+ type: "address[]",
3306
+ internalType: "contractIApp[]"
3307
+ },
3308
+ {
3309
+ name: "appConfigsMem",
3310
+ type: "tuple[]",
3311
+ internalType: "structIAppController.AppConfig[]",
3312
+ components: [
3313
+ {
3314
+ name: "creator",
3315
+ type: "address",
3316
+ internalType: "address"
3317
+ },
3318
+ {
3319
+ name: "operatorSetId",
3320
+ type: "uint32",
3321
+ internalType: "uint32"
3322
+ },
3323
+ {
3324
+ name: "latestReleaseBlockNumber",
3325
+ type: "uint32",
3326
+ internalType: "uint32"
3327
+ },
3328
+ {
3329
+ name: "pendingReleaseBlockNumber",
3330
+ type: "uint32",
3331
+ internalType: "uint32"
3332
+ },
3333
+ {
3334
+ name: "status",
3335
+ type: "uint8",
3336
+ internalType: "enumIAppController.AppStatus"
3337
+ }
3338
+ ]
3339
+ }
3340
+ ],
3341
+ stateMutability: "view"
3342
+ },
3343
+ {
3344
+ type: "function",
3345
+ name: "getAppsByDeveloper",
3346
+ inputs: [
3347
+ {
3348
+ name: "developer",
3349
+ type: "address",
3350
+ internalType: "address"
3351
+ },
3352
+ {
3353
+ name: "offset",
3354
+ type: "uint256",
3355
+ internalType: "uint256"
3356
+ },
3357
+ {
3358
+ name: "limit",
3359
+ type: "uint256",
3360
+ internalType: "uint256"
3361
+ }
3362
+ ],
3363
+ outputs: [
3364
+ {
3365
+ name: "apps",
3366
+ type: "address[]",
3367
+ internalType: "contractIApp[]"
3368
+ },
3369
+ {
3370
+ name: "appConfigsMem",
3371
+ type: "tuple[]",
3372
+ internalType: "structIAppController.AppConfig[]",
3373
+ components: [
3374
+ {
3375
+ name: "creator",
3376
+ type: "address",
3377
+ internalType: "address"
3378
+ },
3379
+ {
3380
+ name: "operatorSetId",
3381
+ type: "uint32",
3382
+ internalType: "uint32"
3383
+ },
3384
+ {
3385
+ name: "latestReleaseBlockNumber",
3386
+ type: "uint32",
3387
+ internalType: "uint32"
3388
+ },
3389
+ {
3390
+ name: "pendingReleaseBlockNumber",
3391
+ type: "uint32",
3392
+ internalType: "uint32"
3393
+ },
3394
+ {
3395
+ name: "status",
3396
+ type: "uint8",
3397
+ internalType: "enumIAppController.AppStatus"
3398
+ }
3399
+ ]
3400
+ }
3401
+ ],
3402
+ stateMutability: "view"
3403
+ },
3404
+ {
3405
+ type: "function",
3406
+ name: "getBillingAccount",
3407
+ inputs: [
3408
+ {
3409
+ name: "app",
3410
+ type: "address",
3411
+ internalType: "contractIApp"
3412
+ }
3413
+ ],
3414
+ outputs: [
3415
+ {
3416
+ name: "",
3417
+ type: "address",
3418
+ internalType: "address"
3419
+ }
3420
+ ],
3421
+ stateMutability: "view"
3422
+ },
3423
+ {
3424
+ type: "function",
3425
+ name: "getBillingType",
3426
+ inputs: [
3427
+ {
3428
+ name: "app",
3429
+ type: "address",
3430
+ internalType: "contractIApp"
3431
+ }
3432
+ ],
3433
+ outputs: [
3434
+ {
3435
+ name: "",
3436
+ type: "uint8",
3437
+ internalType: "enumIAppController.BillingType"
3438
+ }
3439
+ ],
3440
+ stateMutability: "view"
3441
+ },
3442
+ {
3443
+ type: "function",
3444
+ name: "getMaxActiveAppsPerUser",
3445
+ inputs: [
3446
+ {
3447
+ name: "user",
3448
+ type: "address",
3449
+ internalType: "address"
3450
+ }
3451
+ ],
3452
+ outputs: [
3453
+ {
3454
+ name: "",
3455
+ type: "uint32",
3456
+ internalType: "uint32"
3457
+ }
3458
+ ],
3459
+ stateMutability: "view"
3460
+ },
3461
+ {
3462
+ type: "function",
3463
+ name: "globalActiveAppCount",
3464
+ inputs: [],
3465
+ outputs: [
3466
+ {
3467
+ name: "",
3468
+ type: "uint32",
3469
+ internalType: "uint32"
3470
+ }
3471
+ ],
3472
+ stateMutability: "view"
3473
+ },
3474
+ {
3475
+ type: "function",
3476
+ name: "initialize",
3477
+ inputs: [
3478
+ {
3479
+ name: "admin",
3480
+ type: "address",
3481
+ internalType: "address"
3482
+ }
3483
+ ],
3484
+ outputs: [],
3485
+ stateMutability: "nonpayable"
3486
+ },
3487
+ {
3488
+ type: "function",
3489
+ name: "maxGlobalActiveApps",
3490
+ inputs: [],
3491
+ outputs: [
3492
+ {
3493
+ name: "",
3494
+ type: "uint32",
3495
+ internalType: "uint32"
3496
+ }
3497
+ ],
3498
+ stateMutability: "view"
3499
+ },
3500
+ {
3501
+ type: "function",
3502
+ name: "permissionController",
3503
+ inputs: [],
3504
+ outputs: [
3505
+ {
3506
+ name: "",
3507
+ type: "address",
3508
+ internalType: "contractIPermissionController"
3509
+ }
3510
+ ],
3511
+ stateMutability: "view"
3512
+ },
3513
+ {
3514
+ type: "function",
3515
+ name: "releaseManager",
3516
+ inputs: [],
3517
+ outputs: [
3518
+ {
3519
+ name: "",
3520
+ type: "address",
3521
+ internalType: "contractIReleaseManager"
3522
+ }
3523
+ ],
3524
+ stateMutability: "view"
3525
+ },
3526
+ {
3527
+ type: "function",
3528
+ name: "setMaxActiveAppsPerUser",
3529
+ inputs: [
3530
+ {
3531
+ name: "user",
3532
+ type: "address",
3533
+ internalType: "address"
3534
+ },
3535
+ {
3536
+ name: "limit",
3537
+ type: "uint32",
3538
+ internalType: "uint32"
3539
+ }
3540
+ ],
3541
+ outputs: [],
3542
+ stateMutability: "nonpayable"
3543
+ },
3544
+ {
3545
+ type: "function",
3546
+ name: "setMaxGlobalActiveApps",
3547
+ inputs: [
3548
+ {
3549
+ name: "limit",
3550
+ type: "uint32",
3551
+ internalType: "uint32"
3552
+ }
3553
+ ],
3554
+ outputs: [],
3555
+ stateMutability: "nonpayable"
3556
+ },
3557
+ {
3558
+ type: "function",
3559
+ name: "startApp",
3560
+ inputs: [
3561
+ {
3562
+ name: "app",
3563
+ type: "address",
3564
+ internalType: "contractIApp"
3565
+ }
3566
+ ],
3567
+ outputs: [],
3568
+ stateMutability: "nonpayable"
3569
+ },
3570
+ {
3571
+ type: "function",
3572
+ name: "stopApp",
3573
+ inputs: [
3574
+ {
3575
+ name: "app",
3576
+ type: "address",
3577
+ internalType: "contractIApp"
3578
+ }
3579
+ ],
3580
+ outputs: [],
3581
+ stateMutability: "nonpayable"
3582
+ },
3583
+ {
3584
+ type: "function",
3585
+ name: "suspend",
3586
+ inputs: [
3587
+ {
3588
+ name: "account",
3589
+ type: "address",
3590
+ internalType: "address"
3591
+ },
3592
+ {
3593
+ name: "apps",
3594
+ type: "address[]",
3595
+ internalType: "contractIApp[]"
3596
+ }
3597
+ ],
3598
+ outputs: [],
3599
+ stateMutability: "nonpayable"
3600
+ },
3601
+ {
3602
+ type: "function",
3603
+ name: "terminateApp",
3604
+ inputs: [
3605
+ {
3606
+ name: "app",
3607
+ type: "address",
3608
+ internalType: "contractIApp"
3609
+ }
3610
+ ],
3611
+ outputs: [],
3612
+ stateMutability: "nonpayable"
3613
+ },
3614
+ {
3615
+ type: "function",
3616
+ name: "terminateAppByAdmin",
3617
+ inputs: [
3618
+ {
3619
+ name: "app",
3620
+ type: "address",
3621
+ internalType: "contractIApp"
3622
+ }
3623
+ ],
3624
+ outputs: [],
3625
+ stateMutability: "nonpayable"
3626
+ },
3627
+ {
3628
+ type: "function",
3629
+ name: "updateAppMetadataURI",
3630
+ inputs: [
3631
+ {
3632
+ name: "app",
3633
+ type: "address",
3634
+ internalType: "contractIApp"
3635
+ },
3636
+ {
3637
+ name: "metadataURI",
3638
+ type: "string",
3639
+ internalType: "string"
3640
+ }
3641
+ ],
3642
+ outputs: [],
3643
+ stateMutability: "nonpayable"
3644
+ },
3645
+ {
3646
+ type: "function",
3647
+ name: "upgradeApp",
3648
+ inputs: [
3649
+ {
3650
+ name: "app",
3651
+ type: "address",
3652
+ internalType: "contractIApp"
3653
+ },
3654
+ {
3655
+ name: "release",
3656
+ type: "tuple",
3657
+ internalType: "structIAppController.Release",
3658
+ components: [
3659
+ {
3660
+ name: "rmsRelease",
3661
+ type: "tuple",
3662
+ internalType: "structIReleaseManagerTypes.Release",
3663
+ components: [
3664
+ {
3665
+ name: "artifacts",
3666
+ type: "tuple[]",
3667
+ internalType: "structIReleaseManagerTypes.Artifact[]",
3668
+ components: [
3669
+ {
3670
+ name: "digest",
3671
+ type: "bytes32",
3672
+ internalType: "bytes32"
3673
+ },
3674
+ {
3675
+ name: "registry",
3676
+ type: "string",
3677
+ internalType: "string"
3678
+ }
3679
+ ]
3680
+ },
3681
+ {
3682
+ name: "upgradeByTime",
3683
+ type: "uint32",
3684
+ internalType: "uint32"
3685
+ }
3686
+ ]
3687
+ },
3688
+ {
3689
+ name: "publicEnv",
3690
+ type: "bytes",
3691
+ internalType: "bytes"
3692
+ },
3693
+ {
3694
+ name: "encryptedEnv",
3695
+ type: "bytes",
3696
+ internalType: "bytes"
3697
+ },
3698
+ {
3699
+ name: "containerPolicy",
3700
+ type: "tuple",
3701
+ internalType: "structIAppController.ContainerPolicy",
3702
+ components: [
3703
+ {
3704
+ name: "args",
3705
+ type: "string[]",
3706
+ internalType: "string[]"
3707
+ },
3708
+ {
3709
+ name: "cmdOverride",
3710
+ type: "string[]",
3711
+ internalType: "string[]"
3712
+ },
3713
+ {
3714
+ name: "env",
3715
+ type: "tuple[]",
3716
+ internalType: "structIAppController.EnvVar[]",
3717
+ components: [
3718
+ {
3719
+ name: "key",
3720
+ type: "string",
3721
+ internalType: "string"
3722
+ },
3723
+ {
3724
+ name: "value",
3725
+ type: "string",
3726
+ internalType: "string"
3727
+ }
3728
+ ]
3729
+ },
3730
+ {
3731
+ name: "envOverride",
3732
+ type: "tuple[]",
3733
+ internalType: "structIAppController.EnvVar[]",
3734
+ components: [
3735
+ {
3736
+ name: "key",
3737
+ type: "string",
3738
+ internalType: "string"
3739
+ },
3740
+ {
3741
+ name: "value",
3742
+ type: "string",
3743
+ internalType: "string"
3744
+ }
3745
+ ]
3746
+ },
3747
+ {
3748
+ name: "restartPolicy",
3749
+ type: "string",
3750
+ internalType: "string"
3751
+ }
3752
+ ]
3753
+ }
3754
+ ]
3755
+ }
3756
+ ],
3757
+ outputs: [
3758
+ {
3759
+ name: "",
3760
+ type: "uint256",
3761
+ internalType: "uint256"
3762
+ }
3763
+ ],
3764
+ stateMutability: "nonpayable"
3765
+ },
3766
+ {
3767
+ type: "function",
3768
+ name: "version",
3769
+ inputs: [],
3770
+ outputs: [
3771
+ {
3772
+ name: "",
3773
+ type: "string",
3774
+ internalType: "string"
3775
+ }
3776
+ ],
3777
+ stateMutability: "view"
3778
+ },
3779
+ {
3780
+ type: "event",
3781
+ name: "AppCreated",
3782
+ inputs: [
3783
+ {
3784
+ name: "creator",
3785
+ type: "address",
3786
+ indexed: true,
3787
+ internalType: "address"
3788
+ },
3789
+ {
3790
+ name: "app",
3791
+ type: "address",
3792
+ indexed: true,
3793
+ internalType: "contractIApp"
3794
+ },
3795
+ {
3796
+ name: "operatorSetId",
3797
+ type: "uint32",
3798
+ indexed: false,
3799
+ internalType: "uint32"
3800
+ }
3801
+ ],
3802
+ anonymous: false
3803
+ },
3804
+ {
3805
+ type: "event",
3806
+ name: "AppMetadataURIUpdated",
3807
+ inputs: [
3808
+ {
3809
+ name: "app",
3810
+ type: "address",
3811
+ indexed: true,
3812
+ internalType: "contractIApp"
3813
+ },
3814
+ {
3815
+ name: "metadataURI",
3816
+ type: "string",
3817
+ indexed: false,
3818
+ internalType: "string"
3819
+ }
3820
+ ],
3821
+ anonymous: false
3822
+ },
3823
+ {
3824
+ type: "event",
3825
+ name: "AppStarted",
3826
+ inputs: [
3827
+ {
3828
+ name: "app",
3829
+ type: "address",
3830
+ indexed: true,
3831
+ internalType: "contractIApp"
3832
+ }
3833
+ ],
3834
+ anonymous: false
3835
+ },
3836
+ {
3837
+ type: "event",
3838
+ name: "AppStopped",
3839
+ inputs: [
3840
+ {
3841
+ name: "app",
3842
+ type: "address",
3843
+ indexed: true,
3844
+ internalType: "contractIApp"
3845
+ }
3846
+ ],
3847
+ anonymous: false
3848
+ },
3849
+ {
3850
+ type: "event",
3851
+ name: "AppSuspended",
3852
+ inputs: [
3853
+ {
3854
+ name: "app",
3855
+ type: "address",
3856
+ indexed: true,
3857
+ internalType: "contractIApp"
3858
+ }
3859
+ ],
3860
+ anonymous: false
3861
+ },
3862
+ {
3863
+ type: "event",
3864
+ name: "AppTerminated",
3865
+ inputs: [
3866
+ {
3867
+ name: "app",
3868
+ type: "address",
3869
+ indexed: true,
3870
+ internalType: "contractIApp"
3871
+ }
3872
+ ],
3873
+ anonymous: false
3874
+ },
3875
+ {
3876
+ type: "event",
3877
+ name: "AppTerminatedByAdmin",
3878
+ inputs: [
3879
+ {
3880
+ name: "app",
3881
+ type: "address",
3882
+ indexed: true,
3883
+ internalType: "contractIApp"
3884
+ }
3885
+ ],
3886
+ anonymous: false
3887
+ },
3888
+ {
3889
+ type: "event",
3890
+ name: "AppUpgraded",
3891
+ inputs: [
3892
+ {
3893
+ name: "app",
3894
+ type: "address",
3895
+ indexed: true,
3896
+ internalType: "contractIApp"
3897
+ },
3898
+ {
3899
+ name: "rmsReleaseId",
3900
+ type: "uint256",
3901
+ indexed: false,
3902
+ internalType: "uint256"
3903
+ },
3904
+ {
3905
+ name: "release",
3906
+ type: "tuple",
3907
+ indexed: false,
3908
+ internalType: "structIAppController.Release",
3909
+ components: [
3910
+ {
3911
+ name: "rmsRelease",
3912
+ type: "tuple",
3913
+ internalType: "structIReleaseManagerTypes.Release",
3914
+ components: [
3915
+ {
3916
+ name: "artifacts",
3917
+ type: "tuple[]",
3918
+ internalType: "structIReleaseManagerTypes.Artifact[]",
3919
+ components: [
3920
+ {
3921
+ name: "digest",
3922
+ type: "bytes32",
3923
+ internalType: "bytes32"
3924
+ },
3925
+ {
3926
+ name: "registry",
3927
+ type: "string",
3928
+ internalType: "string"
3929
+ }
3930
+ ]
3931
+ },
3932
+ {
3933
+ name: "upgradeByTime",
3934
+ type: "uint32",
3935
+ internalType: "uint32"
3936
+ }
3937
+ ]
3938
+ },
3939
+ {
3940
+ name: "publicEnv",
3941
+ type: "bytes",
3942
+ internalType: "bytes"
3943
+ },
3944
+ {
3945
+ name: "encryptedEnv",
3946
+ type: "bytes",
3947
+ internalType: "bytes"
3948
+ },
3949
+ {
3950
+ name: "containerPolicy",
3951
+ type: "tuple",
3952
+ internalType: "structIAppController.ContainerPolicy",
3953
+ components: [
3954
+ {
3955
+ name: "args",
3956
+ type: "string[]",
3957
+ internalType: "string[]"
3958
+ },
3959
+ {
3960
+ name: "cmdOverride",
3961
+ type: "string[]",
3962
+ internalType: "string[]"
3963
+ },
3964
+ {
3965
+ name: "env",
3966
+ type: "tuple[]",
3967
+ internalType: "structIAppController.EnvVar[]",
3968
+ components: [
3969
+ {
3970
+ name: "key",
3971
+ type: "string",
3972
+ internalType: "string"
3973
+ },
3974
+ {
3975
+ name: "value",
3976
+ type: "string",
3977
+ internalType: "string"
3978
+ }
3979
+ ]
3980
+ },
3981
+ {
3982
+ name: "envOverride",
3983
+ type: "tuple[]",
3984
+ internalType: "structIAppController.EnvVar[]",
3985
+ components: [
3986
+ {
3987
+ name: "key",
3988
+ type: "string",
3989
+ internalType: "string"
3990
+ },
3991
+ {
3992
+ name: "value",
3993
+ type: "string",
3994
+ internalType: "string"
3995
+ }
3996
+ ]
3997
+ },
3998
+ {
3999
+ name: "restartPolicy",
4000
+ type: "string",
4001
+ internalType: "string"
4002
+ }
4003
+ ]
4004
+ }
4005
+ ]
4006
+ }
4007
+ ],
4008
+ anonymous: false
4009
+ },
4010
+ {
4011
+ type: "event",
4012
+ name: "GlobalMaxActiveAppsSet",
4013
+ inputs: [
4014
+ {
4015
+ name: "limit",
4016
+ type: "uint32",
4017
+ indexed: false,
4018
+ internalType: "uint32"
4019
+ }
4020
+ ],
4021
+ anonymous: false
4022
+ },
4023
+ {
4024
+ type: "event",
4025
+ name: "Initialized",
4026
+ inputs: [
4027
+ {
4028
+ name: "version",
4029
+ type: "uint8",
4030
+ indexed: false,
4031
+ internalType: "uint8"
4032
+ }
4033
+ ],
4034
+ anonymous: false
4035
+ },
4036
+ {
4037
+ type: "event",
4038
+ name: "MaxActiveAppsSet",
4039
+ inputs: [
4040
+ {
4041
+ name: "user",
4042
+ type: "address",
4043
+ indexed: true,
4044
+ internalType: "address"
4045
+ },
4046
+ {
4047
+ name: "limit",
4048
+ type: "uint32",
4049
+ indexed: false,
4050
+ internalType: "uint32"
4051
+ }
4052
+ ],
4053
+ anonymous: false
4054
+ },
4055
+ {
4056
+ type: "event",
4057
+ name: "UpgradeConfirmed",
4058
+ inputs: [
4059
+ {
4060
+ name: "app",
4061
+ type: "address",
4062
+ indexed: true,
4063
+ internalType: "contractIApp"
4064
+ },
4065
+ {
4066
+ name: "pendingReleaseBlockNumber",
4067
+ type: "uint32",
4068
+ indexed: false,
4069
+ internalType: "uint32"
4070
+ }
4071
+ ],
4072
+ anonymous: false
4073
+ },
4074
+ {
4075
+ type: "error",
4076
+ name: "AccountHasActiveApps",
4077
+ inputs: []
4078
+ },
4079
+ {
4080
+ type: "error",
4081
+ name: "AppAlreadyExists",
4082
+ inputs: []
4083
+ },
4084
+ {
4085
+ type: "error",
4086
+ name: "AppDoesNotExist",
4087
+ inputs: []
4088
+ },
4089
+ {
4090
+ type: "error",
4091
+ name: "GlobalMaxActiveAppsExceeded",
4092
+ inputs: []
4093
+ },
4094
+ {
4095
+ type: "error",
4096
+ name: "InvalidAppStatus",
4097
+ inputs: []
4098
+ },
4099
+ {
4100
+ type: "error",
4101
+ name: "InvalidPermissions",
4102
+ inputs: []
4103
+ },
4104
+ {
4105
+ type: "error",
4106
+ name: "InvalidReleaseMetadataURI",
4107
+ inputs: []
4108
+ },
4109
+ {
4110
+ type: "error",
4111
+ name: "InvalidShortString",
4112
+ inputs: []
4113
+ },
4114
+ {
4115
+ type: "error",
4116
+ name: "InvalidSignature",
4117
+ inputs: []
4118
+ },
4119
+ {
4120
+ type: "error",
4121
+ name: "MaxActiveAppsExceeded",
4122
+ inputs: []
4123
+ },
4124
+ {
4125
+ type: "error",
4126
+ name: "MoreThanOneArtifact",
4127
+ inputs: []
4128
+ },
4129
+ {
4130
+ type: "error",
4131
+ name: "NoPendingUpgrade",
4132
+ inputs: []
4133
+ },
4134
+ {
4135
+ type: "error",
4136
+ name: "SignatureExpired",
4137
+ inputs: []
4138
+ },
4139
+ {
4140
+ type: "error",
4141
+ name: "StringTooLong",
4142
+ inputs: [
4143
+ {
4144
+ name: "str",
4145
+ type: "string",
4146
+ internalType: "string"
4147
+ }
4148
+ ]
2520
4149
  }
2521
- return hash;
2522
- }
2523
-
2524
- // src/client/common/contract/caller.ts
2525
- var import_viem3 = require("viem");
2526
-
2527
- // src/client/common/utils/helpers.ts
2528
- var import_viem2 = require("viem");
2529
- var import_chains2 = require("viem/chains");
2530
- var import_accounts = require("viem/accounts");
2531
- function getChainFromID(chainID, fallback2 = import_chains2.sepolia) {
2532
- const id = Number(chainID);
2533
- return (0, import_viem2.extractChain)({ chains: SUPPORTED_CHAINS, id }) || fallback2;
2534
- }
2535
- function addHexPrefix(value) {
2536
- return value.startsWith("0x") ? value : `0x${value}`;
2537
- }
2538
- function stripHexPrefix(value) {
2539
- return value.startsWith("0x") ? value.slice(2) : value;
2540
- }
4150
+ ];
2541
4151
 
2542
- // src/client/common/abis/AppController.json
2543
- var AppController_default = [
4152
+ // src/client/common/abis/AppController.v1_4.json
4153
+ var AppController_v1_4_default = [
2544
4154
  {
2545
4155
  type: "constructor",
2546
4156
  inputs: [
@@ -4224,6 +5834,38 @@ var PermissionController_default = [
4224
5834
  ];
4225
5835
 
4226
5836
  // src/client/common/contract/caller.ts
5837
+ function appControllerAbiFor(environmentConfig) {
5838
+ return environmentConfig.releaseAbiVersion === "v1.4" ? AppController_v1_4_default : AppController_default;
5839
+ }
5840
+ function supportsContainerPolicy(environmentConfig) {
5841
+ return environmentConfig.releaseAbiVersion !== "v1.4";
5842
+ }
5843
+ function containerPolicyForViem(policy = EMPTY_CONTAINER_POLICY) {
5844
+ return {
5845
+ args: policy.args,
5846
+ cmdOverride: policy.cmdOverride,
5847
+ env: policy.env.map((e) => ({ key: e.key, value: e.value })),
5848
+ envOverride: policy.envOverride.map((e) => ({ key: e.key, value: e.value })),
5849
+ restartPolicy: policy.restartPolicy
5850
+ };
5851
+ }
5852
+ function releaseForViem(release, environmentConfig) {
5853
+ const base = {
5854
+ rmsRelease: {
5855
+ artifacts: release.rmsRelease.artifacts.map((artifact) => ({
5856
+ digest: `0x${(0, import_viem3.bytesToHex)(artifact.digest).slice(2).padStart(64, "0")}`,
5857
+ registry: artifact.registry
5858
+ })),
5859
+ upgradeByTime: release.rmsRelease.upgradeByTime
5860
+ },
5861
+ publicEnv: (0, import_viem3.bytesToHex)(release.publicEnv),
5862
+ encryptedEnv: (0, import_viem3.bytesToHex)(release.encryptedEnv)
5863
+ };
5864
+ if (!supportsContainerPolicy(environmentConfig)) {
5865
+ return base;
5866
+ }
5867
+ return { ...base, containerPolicy: containerPolicyForViem(release.containerPolicy) };
5868
+ }
4227
5869
  function formatETH(wei) {
4228
5870
  const eth = Number(wei) / 1e18;
4229
5871
  const costStr = eth.toFixed(6);
@@ -4240,7 +5882,7 @@ async function calculateAppID(options) {
4240
5882
  const saltHex = `0x${paddedSaltHex}`;
4241
5883
  const appID = await publicClient.readContract({
4242
5884
  address: environmentConfig.appControllerAddress,
4243
- abi: AppController_default,
5885
+ abi: appControllerAbiFor(environmentConfig),
4244
5886
  functionName: "calculateAppId",
4245
5887
  args: [ownerAddress, saltHex]
4246
5888
  });
@@ -4264,22 +5906,12 @@ async function prepareDeployBatch(options, logger = noopLogger) {
4264
5906
  const saltHexString = (0, import_viem3.bytesToHex)(salt).slice(2);
4265
5907
  const paddedSaltHex = saltHexString.padStart(64, "0");
4266
5908
  const saltHex = `0x${paddedSaltHex}`;
4267
- const releaseForViem = {
4268
- rmsRelease: {
4269
- artifacts: release.rmsRelease.artifacts.map((artifact) => ({
4270
- digest: `0x${(0, import_viem3.bytesToHex)(artifact.digest).slice(2).padStart(64, "0")}`,
4271
- registry: artifact.registry
4272
- })),
4273
- upgradeByTime: release.rmsRelease.upgradeByTime
4274
- },
4275
- publicEnv: (0, import_viem3.bytesToHex)(release.publicEnv),
4276
- encryptedEnv: (0, import_viem3.bytesToHex)(release.encryptedEnv)
4277
- };
5909
+ const release_ = releaseForViem(release, environmentConfig);
4278
5910
  const functionName = options.billTo === "app" ? "createAppWithIsolatedBilling" : "createApp";
4279
5911
  const createData = (0, import_viem3.encodeFunctionData)({
4280
- abi: AppController_default,
5912
+ abi: appControllerAbiFor(environmentConfig),
4281
5913
  functionName,
4282
- args: [saltHex, releaseForViem]
5914
+ args: [saltHex, release_]
4283
5915
  });
4284
5916
  const acceptAdminData = (0, import_viem3.encodeFunctionData)({
4285
5917
  abi: PermissionController_default,
@@ -4367,21 +5999,11 @@ async function prepareUpgradeBatch(options) {
4367
5999
  publicLogs,
4368
6000
  needsPermissionChange
4369
6001
  } = options;
4370
- const releaseForViem = {
4371
- rmsRelease: {
4372
- artifacts: release.rmsRelease.artifacts.map((artifact) => ({
4373
- digest: `0x${(0, import_viem3.bytesToHex)(artifact.digest).slice(2).padStart(64, "0")}`,
4374
- registry: artifact.registry
4375
- })),
4376
- upgradeByTime: release.rmsRelease.upgradeByTime
4377
- },
4378
- publicEnv: (0, import_viem3.bytesToHex)(release.publicEnv),
4379
- encryptedEnv: (0, import_viem3.bytesToHex)(release.encryptedEnv)
4380
- };
6002
+ const release_ = releaseForViem(release, environmentConfig);
4381
6003
  const upgradeData = (0, import_viem3.encodeFunctionData)({
4382
- abi: AppController_default,
6004
+ abi: appControllerAbiFor(environmentConfig),
4383
6005
  functionName: "upgradeApp",
4384
- args: [appID, releaseForViem]
6006
+ args: [appID, release_]
4385
6007
  });
4386
6008
  const executions = [
4387
6009
  {
@@ -4515,7 +6137,7 @@ ${pendingMessage}`);
4515
6137
  if (callError.data) {
4516
6138
  try {
4517
6139
  const decoded = (0, import_viem3.decodeErrorResult)({
4518
- abi: AppController_default,
6140
+ abi: appControllerAbiFor(environmentConfig),
4519
6141
  data: callError.data
4520
6142
  });
4521
6143
  const formattedError = formatAppControllerError(decoded);
@@ -4568,7 +6190,7 @@ function formatAppControllerError(decoded) {
4568
6190
  async function getActiveAppCount(publicClient, environmentConfig, user) {
4569
6191
  const count = await publicClient.readContract({
4570
6192
  address: environmentConfig.appControllerAddress,
4571
- abi: AppController_default,
6193
+ abi: appControllerAbiFor(environmentConfig),
4572
6194
  functionName: "getActiveAppCount",
4573
6195
  args: [user]
4574
6196
  });
@@ -4577,7 +6199,7 @@ async function getActiveAppCount(publicClient, environmentConfig, user) {
4577
6199
  async function getMaxActiveAppsPerUser(publicClient, environmentConfig, user) {
4578
6200
  const quota = await publicClient.readContract({
4579
6201
  address: environmentConfig.appControllerAddress,
4580
- abi: AppController_default,
6202
+ abi: appControllerAbiFor(environmentConfig),
4581
6203
  functionName: "getMaxActiveAppsPerUser",
4582
6204
  args: [user]
4583
6205
  });
@@ -4586,7 +6208,7 @@ async function getMaxActiveAppsPerUser(publicClient, environmentConfig, user) {
4586
6208
  async function getBillingType(publicClient, environmentConfig, app) {
4587
6209
  const result = await publicClient.readContract({
4588
6210
  address: environmentConfig.appControllerAddress,
4589
- abi: AppController_default,
6211
+ abi: appControllerAbiFor(environmentConfig),
4590
6212
  functionName: "getBillingType",
4591
6213
  args: [app]
4592
6214
  });
@@ -4595,7 +6217,7 @@ async function getBillingType(publicClient, environmentConfig, app) {
4595
6217
  async function getAppsByBillingAccount(publicClient, environmentConfig, account, offset, limit) {
4596
6218
  const result = await publicClient.readContract({
4597
6219
  address: environmentConfig.appControllerAddress,
4598
- abi: AppController_default,
6220
+ abi: appControllerAbiFor(environmentConfig),
4599
6221
  functionName: "getAppsByBillingAccount",
4600
6222
  args: [account, offset, limit]
4601
6223
  });
@@ -4649,12 +6271,41 @@ async function undelegate(options, logger = noopLogger) {
4649
6271
  return hash;
4650
6272
  }
4651
6273
 
6274
+ // src/client/common/gas/insufficientGas.ts
6275
+ var import_viem4 = require("viem");
6276
+ var InsufficientGasError = class extends Error {
6277
+ constructor(args) {
6278
+ const requiredEth = (0, import_viem4.formatEther)(args.requiredWei);
6279
+ const availableEth = (0, import_viem4.formatEther)(args.availableWei);
6280
+ super(
6281
+ `Insufficient ETH for gas: wallet ${args.address} has ${availableEth} ETH but this transaction needs ~${requiredEth} ETH.
6282
+ Compute credits do not pay on-chain gas \u2014 fund the wallet with ETH and retry.`
6283
+ );
6284
+ this.name = "InsufficientGasError";
6285
+ this.address = args.address;
6286
+ this.requiredWei = args.requiredWei;
6287
+ this.availableWei = args.availableWei;
6288
+ this.requiredEth = requiredEth;
6289
+ this.availableEth = availableEth;
6290
+ }
6291
+ };
6292
+ async function assertSufficientGas(args) {
6293
+ const availableWei = await args.publicClient.getBalance({ address: args.address });
6294
+ if (availableWei < args.gasEstimate.maxCostWei) {
6295
+ throw new InsufficientGasError({
6296
+ address: args.address,
6297
+ requiredWei: args.gasEstimate.maxCostWei,
6298
+ availableWei
6299
+ });
6300
+ }
6301
+ }
6302
+
4652
6303
  // src/client/common/utils/userapi.ts
4653
6304
  var import_axios2 = __toESM(require("axios"), 1);
4654
6305
 
4655
6306
  // src/client/common/utils/auth.ts
4656
- var import_viem4 = require("viem");
4657
- var APP_CONTROLLER_ABI = (0, import_viem4.parseAbi)([
6307
+ var import_viem5 = require("viem");
6308
+ var APP_CONTROLLER_ABI = (0, import_viem5.parseAbi)([
4658
6309
  "function calculateApiPermissionDigestHash(bytes4 permission, uint256 expiry) view returns (bytes32)"
4659
6310
  ]);
4660
6311
  async function calculatePermissionSignature(options) {
@@ -4681,6 +6332,7 @@ var import_axios = __toESM(require("axios"), 1);
4681
6332
  var MAX_RETRIES = 5;
4682
6333
  var INITIAL_BACKOFF_MS = 1e3;
4683
6334
  var MAX_BACKOFF_MS = 3e4;
6335
+ var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
4684
6336
  function sleep(ms) {
4685
6337
  return new Promise((resolve2) => setTimeout(resolve2, ms));
4686
6338
  }
@@ -4700,7 +6352,7 @@ async function requestWithRetry(config) {
4700
6352
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
4701
6353
  const res = await (0, import_axios.default)({ ...config, validateStatus: () => true });
4702
6354
  lastResponse = res;
4703
- if (res.status !== 429) {
6355
+ if (!RETRYABLE_STATUSES.has(res.status)) {
4704
6356
  return res;
4705
6357
  }
4706
6358
  if (attempt < MAX_RETRIES) {
@@ -4729,7 +6381,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4729
6381
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4730
6382
  var CanUpdateAppProfilePermission = "0x036fef61";
4731
6383
  function getDefaultClientId() {
4732
- const version = true ? "1.0.0-dev.6" : "0.0.0";
6384
+ const version = true ? "1.0.0-dev.8" : "0.0.0";
4733
6385
  return `ecloud-sdk/v${version}`;
4734
6386
  }
4735
6387
  var UserApiClient = class {
@@ -5067,8 +6719,36 @@ function transformAppRelease(raw) {
5067
6719
 
5068
6720
  // src/client/common/contract/watcher.ts
5069
6721
  var WATCH_POLL_INTERVAL_SECONDS = 5;
6722
+ var WATCH_HEARTBEAT_INTERVAL_SECONDS = 30;
6723
+ var WATCH_DEFAULT_TIMEOUT_SECONDS = 10 * 60;
5070
6724
  var APP_STATUS_RUNNING = "Running";
5071
6725
  var APP_STATUS_FAILED = "Failed";
6726
+ var WatchTimeoutError = class extends Error {
6727
+ constructor(args) {
6728
+ super(
6729
+ args.message ?? `Timed out after ${args.elapsedSeconds}s waiting for app ${args.appId} (last status: ${args.lastStatus ?? "unknown"})`
6730
+ );
6731
+ this.name = "WatchTimeoutError";
6732
+ this.appId = args.appId;
6733
+ this.elapsedSeconds = args.elapsedSeconds;
6734
+ this.lastStatus = args.lastStatus;
6735
+ this.timeoutSeconds = args.timeoutSeconds;
6736
+ }
6737
+ };
6738
+ function resolveWatchTimeoutSeconds(explicit) {
6739
+ if (typeof explicit === "number" && Number.isFinite(explicit) && explicit > 0) {
6740
+ return Math.floor(explicit);
6741
+ }
6742
+ const raw = process.env.ECLOUD_WATCH_TIMEOUT_SECONDS;
6743
+ if (raw === void 0 || raw === "") {
6744
+ return WATCH_DEFAULT_TIMEOUT_SECONDS;
6745
+ }
6746
+ const parsed = Number(raw);
6747
+ if (!Number.isFinite(parsed) || parsed <= 0) {
6748
+ return WATCH_DEFAULT_TIMEOUT_SECONDS;
6749
+ }
6750
+ return Math.floor(parsed);
6751
+ }
5072
6752
  async function watchUntilRunning(options, logger) {
5073
6753
  const { walletClient, publicClient, environmentConfig, appId } = options;
5074
6754
  const userApiClient = new UserApiClient(environmentConfig, walletClient, publicClient);
@@ -5099,8 +6779,20 @@ async function watchUntilRunning(options, logger) {
5099
6779
  return false;
5100
6780
  };
5101
6781
  const startTime = Date.now();
6782
+ const timeoutSeconds = resolveWatchTimeoutSeconds(options.timeoutSeconds);
5102
6783
  let lastLoggedStatus;
6784
+ let lastHeartbeatAt = startTime;
5103
6785
  while (true) {
6786
+ const elapsedMs = Date.now() - startTime;
6787
+ const elapsed = Math.round(elapsedMs / 1e3);
6788
+ if (elapsed >= timeoutSeconds) {
6789
+ throw new WatchTimeoutError({
6790
+ appId,
6791
+ elapsedSeconds: elapsed,
6792
+ lastStatus: lastLoggedStatus,
6793
+ timeoutSeconds
6794
+ });
6795
+ }
5104
6796
  try {
5105
6797
  const info = await userApiClient.getInfos([appId], 1);
5106
6798
  if (info.length === 0) {
@@ -5110,16 +6802,22 @@ async function watchUntilRunning(options, logger) {
5110
6802
  const appInfo = info[0];
5111
6803
  const currentStatus = appInfo.status;
5112
6804
  const currentIP = appInfo.ip || "";
5113
- const elapsed = Math.round((Date.now() - startTime) / 1e3);
5114
6805
  if (currentStatus !== lastLoggedStatus) {
5115
6806
  logger.info(`Status: ${currentStatus} (${elapsed}s)`);
5116
6807
  lastLoggedStatus = currentStatus;
6808
+ lastHeartbeatAt = Date.now();
6809
+ } else if (Date.now() - lastHeartbeatAt >= WATCH_HEARTBEAT_INTERVAL_SECONDS * 1e3) {
6810
+ logger.info(`Status: ${currentStatus} (${elapsed}s)`);
6811
+ lastHeartbeatAt = Date.now();
5117
6812
  }
5118
6813
  if (stopCondition(currentStatus, currentIP)) {
5119
6814
  return currentIP || void 0;
5120
6815
  }
5121
6816
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5122
6817
  } catch (error) {
6818
+ if (error instanceof WatchTimeoutError) {
6819
+ throw error;
6820
+ }
5123
6821
  logger.warn(`Failed to fetch app info: ${error.message}`);
5124
6822
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5125
6823
  }
@@ -5128,6 +6826,7 @@ async function watchUntilRunning(options, logger) {
5128
6826
  var APP_STATUS_STOPPED = "Stopped";
5129
6827
  async function watchUntilUpgradeComplete(options, logger) {
5130
6828
  const { walletClient, publicClient, environmentConfig, appId } = options;
6829
+ const timeoutSeconds = resolveWatchTimeoutSeconds(options.timeoutSeconds);
5131
6830
  const userApiClient = new UserApiClient(environmentConfig, walletClient, publicClient);
5132
6831
  let initialStatus;
5133
6832
  let initialIP;
@@ -5165,7 +6864,20 @@ async function watchUntilUpgradeComplete(options, logger) {
5165
6864
  }
5166
6865
  return false;
5167
6866
  };
6867
+ const startTime = Date.now();
6868
+ const deadline = startTime + timeoutSeconds * 1e3;
6869
+ let lastLoggedStatus;
6870
+ let lastObservedStatus;
5168
6871
  while (true) {
6872
+ if (Date.now() >= deadline) {
6873
+ const elapsedSeconds = Math.round((Date.now() - startTime) / 1e3);
6874
+ throw new WatchTimeoutError({
6875
+ appId,
6876
+ lastStatus: lastObservedStatus,
6877
+ elapsedSeconds,
6878
+ timeoutSeconds
6879
+ });
6880
+ }
5169
6881
  try {
5170
6882
  const info = await userApiClient.getInfos([appId], 1);
5171
6883
  if (info.length === 0) {
@@ -5175,11 +6887,23 @@ async function watchUntilUpgradeComplete(options, logger) {
5175
6887
  const appInfo = info[0];
5176
6888
  const currentStatus = appInfo.status;
5177
6889
  const currentIP = appInfo.ip || "";
6890
+ lastObservedStatus = currentStatus;
6891
+ const elapsed = Math.round((Date.now() - startTime) / 1e3);
6892
+ if (currentStatus !== lastLoggedStatus) {
6893
+ logger.info(`Status: ${currentStatus} (${elapsed}s)`);
6894
+ lastLoggedStatus = currentStatus;
6895
+ }
5178
6896
  if (stopCondition(currentStatus, currentIP)) {
5179
6897
  return;
5180
6898
  }
5181
6899
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5182
6900
  } catch (error) {
6901
+ if (error instanceof WatchTimeoutError) {
6902
+ throw error;
6903
+ }
6904
+ if (typeof error?.message === "string" && error.message.includes("Failed")) {
6905
+ throw error;
6906
+ }
5183
6907
  logger.warn(`Failed to fetch app info: ${error.message}`);
5184
6908
  await sleep2(WATCH_POLL_INTERVAL_SECONDS * 1e3);
5185
6909
  }
@@ -5191,7 +6915,7 @@ function sleep2(ms) {
5191
6915
 
5192
6916
  // src/client/common/utils/validation.ts
5193
6917
  var import_fs = __toESM(require("fs"), 1);
5194
- var import_viem5 = require("viem");
6918
+ var import_viem6 = require("viem");
5195
6919
  function validateAppName(name) {
5196
6920
  if (!name) {
5197
6921
  throw new Error("App name cannot be empty");
@@ -5239,7 +6963,7 @@ function validateAppID(appID) {
5239
6963
  throw new Error("App ID is required");
5240
6964
  }
5241
6965
  const normalized = typeof appID === "string" ? addHexPrefix(appID) : appID;
5242
- if ((0, import_viem5.isAddress)(normalized)) {
6966
+ if ((0, import_viem6.isAddress)(normalized)) {
5243
6967
  return normalized;
5244
6968
  }
5245
6969
  throw new Error(`Invalid app ID: '${appID}' is not a valid address`);
@@ -5293,6 +7017,8 @@ var ENVIRONMENTS = {
5293
7017
  name: "sepolia",
5294
7018
  build: "dev",
5295
7019
  appControllerAddress: "0xa86DC1C47cb2518327fB4f9A1627F51966c83B92",
7020
+ releaseAbiVersion: "v1.5",
7021
+ // AppController upgraded to v1.5.x (containerPolicy)
5296
7022
  permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
5297
7023
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5298
7024
  kmsServerURL: "http://10.128.0.57:8080",
@@ -5306,6 +7032,8 @@ var ENVIRONMENTS = {
5306
7032
  name: "sepolia",
5307
7033
  build: "prod",
5308
7034
  appControllerAddress: "0x0dd810a6ffba6a9820a10d97b659f07d8d23d4E2",
7035
+ releaseAbiVersion: "v1.4",
7036
+ // prod still on AppController v1.4.0 (3-field Release)
5309
7037
  permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
5310
7038
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5311
7039
  kmsServerURL: "http://10.128.15.203:8080",
@@ -5320,6 +7048,8 @@ var ENVIRONMENTS = {
5320
7048
  name: "mainnet-alpha",
5321
7049
  build: "prod",
5322
7050
  appControllerAddress: "0xc38d35Fc995e75342A21CBd6D770305b142Fbe67",
7051
+ releaseAbiVersion: "v1.4",
7052
+ // prod still on AppController v1.4.0 (3-field Release)
5323
7053
  permissionControllerAddress: ChainAddresses[MAINNET_CHAIN_ID].PermissionController,
5324
7054
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5325
7055
  kmsServerURL: "http://10.128.0.2:8080",
@@ -5720,6 +7450,11 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
5720
7450
  executions: batch.executions,
5721
7451
  authorizationList
5722
7452
  });
7453
+ await assertSufficientGas({
7454
+ publicClient: batch.publicClient,
7455
+ address: batch.walletClient.account.address,
7456
+ gasEstimate
7457
+ });
5723
7458
  const data = {
5724
7459
  appId: batch.appId,
5725
7460
  salt: batch.salt,
@@ -5978,6 +7713,11 @@ async function prepareDeploy(options, logger = defaultLogger) {
5978
7713
  executions: batch.executions,
5979
7714
  authorizationList
5980
7715
  });
7716
+ await assertSufficientGas({
7717
+ publicClient: batch.publicClient,
7718
+ address: batch.walletClient.account.address,
7719
+ gasEstimate
7720
+ });
5981
7721
  const data = {
5982
7722
  appId: batch.appId,
5983
7723
  salt: batch.salt,
@@ -6014,7 +7754,7 @@ async function executeDeploy(options) {
6014
7754
  }
6015
7755
  );
6016
7756
  }
6017
- async function watchDeployment(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry) {
7757
+ async function watchDeployment(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry, opts) {
6018
7758
  return withSDKTelemetry(
6019
7759
  {
6020
7760
  functionName: "watchDeployment",
@@ -6030,7 +7770,8 @@ async function watchDeployment(appId, walletClient, publicClient, environmentCon
6030
7770
  walletClient,
6031
7771
  publicClient,
6032
7772
  environmentConfig,
6033
- appId
7773
+ appId,
7774
+ timeoutSeconds: opts?.timeoutSeconds
6034
7775
  },
6035
7776
  logger
6036
7777
  );
@@ -6126,6 +7867,11 @@ async function prepareUpgradeFromVerifiableBuild(options, logger = defaultLogger
6126
7867
  executions: batch.executions,
6127
7868
  authorizationList
6128
7869
  });
7870
+ await assertSufficientGas({
7871
+ publicClient: batch.publicClient,
7872
+ address: batch.walletClient.account.address,
7873
+ gasEstimate
7874
+ });
6129
7875
  const data = {
6130
7876
  appId: batch.appId,
6131
7877
  executions: batch.executions,
@@ -6315,6 +8061,11 @@ async function prepareUpgrade(options, logger = defaultLogger) {
6315
8061
  executions: batch.executions,
6316
8062
  authorizationList
6317
8063
  });
8064
+ await assertSufficientGas({
8065
+ publicClient: batch.publicClient,
8066
+ address: batch.walletClient.account.address,
8067
+ gasEstimate
8068
+ });
6318
8069
  const data = {
6319
8070
  appId: batch.appId,
6320
8071
  executions: batch.executions,
@@ -6349,7 +8100,7 @@ async function executeUpgrade(options) {
6349
8100
  }
6350
8101
  );
6351
8102
  }
6352
- async function watchUpgrade(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry) {
8103
+ async function watchUpgrade(appId, walletClient, publicClient, environmentConfig, logger = defaultLogger, skipTelemetry, opts) {
6353
8104
  return withSDKTelemetry(
6354
8105
  {
6355
8106
  functionName: "watchUpgrade",
@@ -6365,7 +8116,8 @@ async function watchUpgrade(appId, walletClient, publicClient, environmentConfig
6365
8116
  walletClient,
6366
8117
  publicClient,
6367
8118
  environmentConfig,
6368
- appId
8119
+ appId,
8120
+ timeoutSeconds: opts?.timeoutSeconds
6369
8121
  },
6370
8122
  logger
6371
8123
  );
@@ -7023,27 +8775,27 @@ async function logs(options, walletClient, publicClient, environmentConfig, logg
7023
8775
  }
7024
8776
 
7025
8777
  // src/client/modules/compute/app/index.ts
7026
- var CONTROLLER_ABI = (0, import_viem6.parseAbi)([
8778
+ var CONTROLLER_ABI = (0, import_viem7.parseAbi)([
7027
8779
  "function startApp(address appId)",
7028
8780
  "function stopApp(address appId)",
7029
8781
  "function terminateApp(address appId)"
7030
8782
  ]);
7031
8783
  function encodeStartAppData(appId) {
7032
- return (0, import_viem6.encodeFunctionData)({
8784
+ return (0, import_viem7.encodeFunctionData)({
7033
8785
  abi: CONTROLLER_ABI,
7034
8786
  functionName: "startApp",
7035
8787
  args: [appId]
7036
8788
  });
7037
8789
  }
7038
8790
  function encodeStopAppData(appId) {
7039
- return (0, import_viem6.encodeFunctionData)({
8791
+ return (0, import_viem7.encodeFunctionData)({
7040
8792
  abi: CONTROLLER_ABI,
7041
8793
  functionName: "stopApp",
7042
8794
  args: [appId]
7043
8795
  });
7044
8796
  }
7045
8797
  function encodeTerminateAppData(appId) {
7046
- return (0, import_viem6.encodeFunctionData)({
8798
+ return (0, import_viem7.encodeFunctionData)({
7047
8799
  abi: CONTROLLER_ABI,
7048
8800
  functionName: "terminateApp",
7049
8801
  args: [appId]
@@ -7057,7 +8809,7 @@ function createAppModule(ctx) {
7057
8809
  }
7058
8810
  const account = walletClient.account;
7059
8811
  const environment = getEnvironmentConfig(ctx.environment);
7060
- const logger = getLogger(ctx.verbose);
8812
+ const logger = ctx.logger ?? getLogger(ctx.verbose);
7061
8813
  return {
7062
8814
  async create(opts) {
7063
8815
  return createApp(opts, logger);
@@ -7169,14 +8921,15 @@ function createAppModule(ctx) {
7169
8921
  imageRef: result.imageRef
7170
8922
  };
7171
8923
  },
7172
- async watchDeployment(appId) {
8924
+ async watchDeployment(appId, opts) {
7173
8925
  return watchDeployment(
7174
8926
  appId,
7175
8927
  walletClient,
7176
8928
  publicClient,
7177
8929
  environment,
7178
8930
  logger,
7179
- skipTelemetry
8931
+ skipTelemetry,
8932
+ opts
7180
8933
  );
7181
8934
  },
7182
8935
  // Granular upgrade control
@@ -7234,8 +8987,16 @@ function createAppModule(ctx) {
7234
8987
  imageRef: result.imageRef
7235
8988
  };
7236
8989
  },
7237
- async watchUpgrade(appId) {
7238
- return watchUpgrade(appId, walletClient, publicClient, environment, logger, skipTelemetry);
8990
+ async watchUpgrade(appId, opts) {
8991
+ return watchUpgrade(
8992
+ appId,
8993
+ walletClient,
8994
+ publicClient,
8995
+ environment,
8996
+ logger,
8997
+ skipTelemetry,
8998
+ opts
8999
+ );
7239
9000
  },
7240
9001
  // Profile management
7241
9002
  async setProfile(appId, profile) {
@@ -7286,7 +9047,7 @@ function createAppModule(ctx) {
7286
9047
  },
7287
9048
  async () => {
7288
9049
  const pendingMessage = `Starting app ${appId}...`;
7289
- const data = (0, import_viem6.encodeFunctionData)({
9050
+ const data = (0, import_viem7.encodeFunctionData)({
7290
9051
  abi: CONTROLLER_ABI,
7291
9052
  functionName: "startApp",
7292
9053
  args: [appId]
@@ -7318,7 +9079,7 @@ function createAppModule(ctx) {
7318
9079
  },
7319
9080
  async () => {
7320
9081
  const pendingMessage = `Stopping app ${appId}...`;
7321
- const data = (0, import_viem6.encodeFunctionData)({
9082
+ const data = (0, import_viem7.encodeFunctionData)({
7322
9083
  abi: CONTROLLER_ABI,
7323
9084
  functionName: "stopApp",
7324
9085
  args: [appId]
@@ -7350,7 +9111,7 @@ function createAppModule(ctx) {
7350
9111
  },
7351
9112
  async () => {
7352
9113
  const pendingMessage = `Terminating app ${appId}...`;
7353
- const data = (0, import_viem6.encodeFunctionData)({
9114
+ const data = (0, import_viem7.encodeFunctionData)({
7354
9115
  abi: CONTROLLER_ABI,
7355
9116
  functionName: "terminateApp",
7356
9117
  args: [appId]