@phala/cloud 0.2.5 → 0.2.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.
@@ -0,0 +1,164 @@
1
+ import { z } from "zod";
2
+ export declare const AppCvmsBatchIsAllowedResponseSchema: z.ZodObject<{
3
+ is_onchain: z.ZodBoolean;
4
+ results: z.ZodDefault<z.ZodArray<z.ZodObject<{
5
+ app_contract_address: z.ZodString;
6
+ compose_hash: z.ZodString;
7
+ device_id: z.ZodString;
8
+ compose_hash_allowed: z.ZodBoolean;
9
+ allow_any_device: z.ZodBoolean;
10
+ device_id_allowed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
11
+ is_allowed: z.ZodBoolean;
12
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ } & {
14
+ cvm_id: z.ZodNumber;
15
+ }, "strip", z.ZodTypeAny, {
16
+ device_id: string;
17
+ compose_hash: string;
18
+ compose_hash_allowed: boolean;
19
+ is_allowed: boolean;
20
+ cvm_id: number;
21
+ app_contract_address: string;
22
+ allow_any_device: boolean;
23
+ error?: string | null | undefined;
24
+ device_id_allowed?: boolean | null | undefined;
25
+ }, {
26
+ device_id: string;
27
+ compose_hash: string;
28
+ compose_hash_allowed: boolean;
29
+ is_allowed: boolean;
30
+ cvm_id: number;
31
+ app_contract_address: string;
32
+ allow_any_device: boolean;
33
+ error?: string | null | undefined;
34
+ device_id_allowed?: boolean | null | undefined;
35
+ }>, "many">>;
36
+ total: z.ZodDefault<z.ZodNumber>;
37
+ allowed_count: z.ZodDefault<z.ZodNumber>;
38
+ denied_count: z.ZodDefault<z.ZodNumber>;
39
+ error_count: z.ZodDefault<z.ZodNumber>;
40
+ skipped_cvm_ids: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ total: number;
43
+ is_onchain: boolean;
44
+ results: {
45
+ device_id: string;
46
+ compose_hash: string;
47
+ compose_hash_allowed: boolean;
48
+ is_allowed: boolean;
49
+ cvm_id: number;
50
+ app_contract_address: string;
51
+ allow_any_device: boolean;
52
+ error?: string | null | undefined;
53
+ device_id_allowed?: boolean | null | undefined;
54
+ }[];
55
+ allowed_count: number;
56
+ denied_count: number;
57
+ error_count: number;
58
+ skipped_cvm_ids: number[];
59
+ }, {
60
+ is_onchain: boolean;
61
+ total?: number | undefined;
62
+ results?: {
63
+ device_id: string;
64
+ compose_hash: string;
65
+ compose_hash_allowed: boolean;
66
+ is_allowed: boolean;
67
+ cvm_id: number;
68
+ app_contract_address: string;
69
+ allow_any_device: boolean;
70
+ error?: string | null | undefined;
71
+ device_id_allowed?: boolean | null | undefined;
72
+ }[] | undefined;
73
+ allowed_count?: number | undefined;
74
+ denied_count?: number | undefined;
75
+ error_count?: number | undefined;
76
+ skipped_cvm_ids?: number[] | undefined;
77
+ }>;
78
+ export type AppCvmsBatchIsAllowedResponse = z.infer<typeof AppCvmsBatchIsAllowedResponseSchema>;
79
+ export declare const CheckAppCvmsIsAllowedRequestSchema: z.ZodObject<{
80
+ appId: z.ZodString;
81
+ }, "strip", z.ZodTypeAny, {
82
+ appId: string;
83
+ }, {
84
+ appId: string;
85
+ }>;
86
+ export type CheckAppCvmsIsAllowedRequest = z.infer<typeof CheckAppCvmsIsAllowedRequestSchema>;
87
+ /**
88
+ * Batch check on-chain deployment allowance for all CVMs under an app.
89
+ *
90
+ * For on-chain KMS apps, queries the blockchain via multicall3 to check
91
+ * compose hash and device allowance for each CVM.
92
+ * For offchain KMS apps, returns is_onchain=false with no results.
93
+ *
94
+ * @param client - The API client
95
+ * @param request - Request parameters
96
+ * @param request.appId - The hex app identifier
97
+ * @returns Batch allowance check results for all CVMs
98
+ */
99
+ declare const checkAppCvmsIsAllowed: {
100
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
101
+ appId: string;
102
+ }): Promise<{
103
+ total: number;
104
+ is_onchain: boolean;
105
+ results: {
106
+ device_id: string;
107
+ compose_hash: string;
108
+ compose_hash_allowed: boolean;
109
+ is_allowed: boolean;
110
+ cvm_id: number;
111
+ app_contract_address: string;
112
+ allow_any_device: boolean;
113
+ error?: string | null | undefined;
114
+ device_id_allowed?: boolean | null | undefined;
115
+ }[];
116
+ allowed_count: number;
117
+ denied_count: number;
118
+ error_count: number;
119
+ skipped_cvm_ids: number[];
120
+ }>;
121
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
122
+ appId: string;
123
+ }, parameters: {
124
+ schema: T;
125
+ }): Promise<z.TypeOf<T>>;
126
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
127
+ appId: string;
128
+ }, parameters: {
129
+ schema: false;
130
+ }): Promise<unknown>;
131
+ }, safeCheckAppCvmsIsAllowed: {
132
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
133
+ appId: string;
134
+ }): Promise<import("../..").SafeResult<{
135
+ total: number;
136
+ is_onchain: boolean;
137
+ results: {
138
+ device_id: string;
139
+ compose_hash: string;
140
+ compose_hash_allowed: boolean;
141
+ is_allowed: boolean;
142
+ cvm_id: number;
143
+ app_contract_address: string;
144
+ allow_any_device: boolean;
145
+ error?: string | null | undefined;
146
+ device_id_allowed?: boolean | null | undefined;
147
+ }[];
148
+ allowed_count: number;
149
+ denied_count: number;
150
+ error_count: number;
151
+ skipped_cvm_ids: number[];
152
+ }>>;
153
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
154
+ appId: string;
155
+ }, parameters: {
156
+ schema: T;
157
+ }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
158
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
159
+ appId: string;
160
+ }, parameters: {
161
+ schema: false;
162
+ }): Promise<import("../..").SafeResult<unknown>>;
163
+ };
164
+ export { checkAppCvmsIsAllowed, safeCheckAppCvmsIsAllowed };
@@ -0,0 +1,109 @@
1
+ import { z } from "zod";
2
+ export declare const CheckAppIsAllowedRequestSchema: z.ZodObject<{
3
+ appId: z.ZodString;
4
+ compose_hash: z.ZodString;
5
+ node_id: z.ZodOptional<z.ZodNumber>;
6
+ device_id: z.ZodOptional<z.ZodString>;
7
+ chain_id: z.ZodOptional<z.ZodNumber>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ compose_hash: string;
10
+ appId: string;
11
+ chain_id?: number | undefined;
12
+ device_id?: string | undefined;
13
+ node_id?: number | undefined;
14
+ }, {
15
+ compose_hash: string;
16
+ appId: string;
17
+ chain_id?: number | undefined;
18
+ device_id?: string | undefined;
19
+ node_id?: number | undefined;
20
+ }>;
21
+ export type CheckAppIsAllowedRequest = z.infer<typeof CheckAppIsAllowedRequestSchema>;
22
+ /**
23
+ * Check if a deployment is allowed by an on-chain DStack App contract.
24
+ *
25
+ * Supports pure contract query (no DB) when all parameters including chain_id are provided.
26
+ *
27
+ * @param client - The API client
28
+ * @param request - Request parameters
29
+ * @param request.appId - App contract address
30
+ * @param request.compose_hash - Compose hash to check
31
+ * @param request.node_id - Node ID (resolves device_id from DB)
32
+ * @param request.device_id - Device ID (hex, direct)
33
+ * @param request.chain_id - Chain ID for RPC URL resolution
34
+ * @returns On-chain allowance check result
35
+ */
36
+ declare const checkAppIsAllowed: {
37
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
38
+ compose_hash: string;
39
+ appId: string;
40
+ chain_id?: number | undefined;
41
+ device_id?: string | undefined;
42
+ node_id?: number | undefined;
43
+ }): Promise<{
44
+ device_id: string;
45
+ compose_hash: string;
46
+ compose_hash_allowed: boolean;
47
+ is_allowed: boolean;
48
+ app_contract_address: string;
49
+ allow_any_device: boolean;
50
+ error?: string | null | undefined;
51
+ device_id_allowed?: boolean | null | undefined;
52
+ cvm_id?: number | undefined;
53
+ }>;
54
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
55
+ compose_hash: string;
56
+ appId: string;
57
+ chain_id?: number | undefined;
58
+ device_id?: string | undefined;
59
+ node_id?: number | undefined;
60
+ }, parameters: {
61
+ schema: T;
62
+ }): Promise<z.TypeOf<T>>;
63
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
64
+ compose_hash: string;
65
+ appId: string;
66
+ chain_id?: number | undefined;
67
+ device_id?: string | undefined;
68
+ node_id?: number | undefined;
69
+ }, parameters: {
70
+ schema: false;
71
+ }): Promise<unknown>;
72
+ }, safeCheckAppIsAllowed: {
73
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
74
+ compose_hash: string;
75
+ appId: string;
76
+ chain_id?: number | undefined;
77
+ device_id?: string | undefined;
78
+ node_id?: number | undefined;
79
+ }): Promise<import("../..").SafeResult<{
80
+ device_id: string;
81
+ compose_hash: string;
82
+ compose_hash_allowed: boolean;
83
+ is_allowed: boolean;
84
+ app_contract_address: string;
85
+ allow_any_device: boolean;
86
+ error?: string | null | undefined;
87
+ device_id_allowed?: boolean | null | undefined;
88
+ cvm_id?: number | undefined;
89
+ }>>;
90
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
91
+ compose_hash: string;
92
+ appId: string;
93
+ chain_id?: number | undefined;
94
+ device_id?: string | undefined;
95
+ node_id?: number | undefined;
96
+ }, parameters: {
97
+ schema: T;
98
+ }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
99
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
100
+ compose_hash: string;
101
+ appId: string;
102
+ chain_id?: number | undefined;
103
+ device_id?: string | undefined;
104
+ node_id?: number | undefined;
105
+ }, parameters: {
106
+ schema: false;
107
+ }): Promise<import("../..").SafeResult<unknown>>;
108
+ };
109
+ export { checkAppIsAllowed, safeCheckAppIsAllowed };
@@ -54,8 +54,8 @@ declare const DeviceAllowlistResponseSchema: z.ZodObject<{
54
54
  }[];
55
55
  is_onchain_kms: boolean;
56
56
  chain_id?: number | null | undefined;
57
- allow_any_device?: boolean | null | undefined;
58
57
  app_contract_address?: string | null | undefined;
58
+ allow_any_device?: boolean | null | undefined;
59
59
  }, {
60
60
  is_onchain_kms: boolean;
61
61
  chain_id?: number | null | undefined;
@@ -66,8 +66,8 @@ declare const DeviceAllowlistResponseSchema: z.ZodObject<{
66
66
  cvm_ids: number[];
67
67
  allowed_onchain: boolean;
68
68
  }[] | undefined;
69
- allow_any_device?: boolean | null | undefined;
70
69
  app_contract_address?: string | null | undefined;
70
+ allow_any_device?: boolean | null | undefined;
71
71
  }>;
72
72
  export type DeviceAllowlistItem = z.infer<typeof DeviceAllowlistItemSchema>;
73
73
  export type DeviceAllowlistResponse = z.infer<typeof DeviceAllowlistResponseSchema>;
@@ -68,6 +68,36 @@ export declare const dstackAppAbi: readonly [{
68
68
  }];
69
69
  readonly stateMutability: "view";
70
70
  readonly type: "function";
71
+ }, {
72
+ readonly inputs: readonly [{
73
+ readonly internalType: "bytes32";
74
+ readonly name: "";
75
+ readonly type: "bytes32";
76
+ }];
77
+ readonly name: "allowedComposeHashes";
78
+ readonly outputs: readonly [{
79
+ readonly internalType: "bool";
80
+ readonly name: "";
81
+ readonly type: "bool";
82
+ }];
83
+ readonly stateMutability: "view";
84
+ readonly type: "function";
85
+ }, {
86
+ readonly inputs: readonly [{
87
+ readonly internalType: "address";
88
+ readonly name: "owner";
89
+ readonly type: "address";
90
+ }];
91
+ readonly name: "OwnableInvalidOwner";
92
+ readonly type: "error";
93
+ }, {
94
+ readonly inputs: readonly [{
95
+ readonly internalType: "address";
96
+ readonly name: "account";
97
+ readonly type: "address";
98
+ }];
99
+ readonly name: "OwnableUnauthorizedAccount";
100
+ readonly type: "error";
71
101
  }, {
72
102
  readonly anonymous: false;
73
103
  readonly inputs: readonly [{
@@ -0,0 +1,43 @@
1
+ import { type Chain, type Address, type PublicClient } from "viem";
2
+ /**
3
+ * Check whether a specific compose hash is allowed by a DstackApp contract.
4
+ *
5
+ * Reads the `allowedComposeHashes(hash)` mapping on-chain.
6
+ *
7
+ * @group Actions
8
+ * @since 0.7.0
9
+ *
10
+ * ## Usage
11
+ *
12
+ * ```typescript
13
+ * import { checkComposeHashAllowed } from '@phala/cloud'
14
+ * import { base } from 'viem/chains'
15
+ *
16
+ * const allowed = await checkComposeHashAllowed({
17
+ * chain: base,
18
+ * appAddress: "0x1234...abcd",
19
+ * composeHash: "0xaabbccdd...",
20
+ * })
21
+ * console.log(allowed) // true or false
22
+ * ```
23
+ */
24
+ export type CheckComposeHashAllowedRequest = {
25
+ chain?: Chain;
26
+ rpcUrl?: string;
27
+ appAddress: Address;
28
+ composeHash: string;
29
+ publicClient?: PublicClient;
30
+ };
31
+ export declare function checkComposeHashAllowed(request: CheckComposeHashAllowedRequest): Promise<boolean>;
32
+ export declare function safeCheckComposeHashAllowed(request: CheckComposeHashAllowedRequest): Promise<{
33
+ success: true;
34
+ data: boolean;
35
+ } | {
36
+ success: false;
37
+ error: {
38
+ isRequestError: true;
39
+ message: string;
40
+ status: number;
41
+ detail: string;
42
+ };
43
+ }>;
@@ -0,0 +1,59 @@
1
+ import { type Chain, type Address, type PublicClient } from "viem";
2
+ /**
3
+ * Check on-chain prerequisites for a CVM update in a single RPC call.
4
+ *
5
+ * Uses `multicall` to batch-check:
6
+ * 1. `allowAnyDevice()` — whether the contract allows any device
7
+ * 2. `allowedDeviceIds(deviceId)` — whether the specific device is registered
8
+ * 3. `allowedComposeHashes(composeHash)` — whether the compose hash is already registered
9
+ *
10
+ * @group Actions
11
+ * @since 0.7.0
12
+ *
13
+ * ## Usage
14
+ *
15
+ * ```typescript
16
+ * import { checkOnChainPrerequisites } from '@phala/cloud'
17
+ * import { base } from 'viem/chains'
18
+ *
19
+ * const prereqs = await checkOnChainPrerequisites({
20
+ * chain: base,
21
+ * appAddress: "0x1234...abcd",
22
+ * deviceId: "0xaabbccdd...",
23
+ * composeHash: "0xeeff0011...",
24
+ * })
25
+ *
26
+ * if (!prereqs.deviceAllowed) {
27
+ * // Need to call addDevice first
28
+ * }
29
+ * if (prereqs.composeHashAllowed) {
30
+ * // Can skip addComposeHash transaction
31
+ * }
32
+ * ```
33
+ */
34
+ export type CheckOnChainPrerequisitesRequest = {
35
+ chain?: Chain;
36
+ rpcUrl?: string;
37
+ appAddress: Address;
38
+ deviceId: string;
39
+ composeHash: string;
40
+ publicClient?: PublicClient;
41
+ };
42
+ export type OnChainPrerequisites = {
43
+ allowAnyDevice: boolean;
44
+ deviceAllowed: boolean;
45
+ composeHashAllowed: boolean;
46
+ };
47
+ export declare function checkOnChainPrerequisites(request: CheckOnChainPrerequisitesRequest): Promise<OnChainPrerequisites>;
48
+ export declare function safeCheckOnChainPrerequisites(request: CheckOnChainPrerequisitesRequest): Promise<{
49
+ success: true;
50
+ data: OnChainPrerequisites;
51
+ } | {
52
+ success: false;
53
+ error: {
54
+ isRequestError: true;
55
+ message: string;
56
+ status: number;
57
+ detail: string;
58
+ };
59
+ }>;
@@ -0,0 +1,145 @@
1
+ import { z } from "zod";
2
+ export declare const IsAllowedResultSchema: z.ZodObject<{
3
+ cvm_id: z.ZodOptional<z.ZodNumber>;
4
+ app_contract_address: z.ZodString;
5
+ compose_hash: z.ZodString;
6
+ device_id: z.ZodString;
7
+ compose_hash_allowed: z.ZodBoolean;
8
+ allow_any_device: z.ZodBoolean;
9
+ device_id_allowed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
10
+ is_allowed: z.ZodBoolean;
11
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ device_id: string;
14
+ compose_hash: string;
15
+ compose_hash_allowed: boolean;
16
+ is_allowed: boolean;
17
+ app_contract_address: string;
18
+ allow_any_device: boolean;
19
+ error?: string | null | undefined;
20
+ device_id_allowed?: boolean | null | undefined;
21
+ cvm_id?: number | undefined;
22
+ }, {
23
+ device_id: string;
24
+ compose_hash: string;
25
+ compose_hash_allowed: boolean;
26
+ is_allowed: boolean;
27
+ app_contract_address: string;
28
+ allow_any_device: boolean;
29
+ error?: string | null | undefined;
30
+ device_id_allowed?: boolean | null | undefined;
31
+ cvm_id?: number | undefined;
32
+ }>;
33
+ export type IsAllowedResult = z.infer<typeof IsAllowedResultSchema>;
34
+ declare const CheckCvmIsAllowedInputSchema: z.ZodObject<{
35
+ cvmId: z.ZodString;
36
+ compose_hash: z.ZodOptional<z.ZodString>;
37
+ node_id: z.ZodOptional<z.ZodNumber>;
38
+ device_id: z.ZodOptional<z.ZodString>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ cvmId: string;
41
+ device_id?: string | undefined;
42
+ compose_hash?: string | undefined;
43
+ node_id?: number | undefined;
44
+ }, {
45
+ cvmId: string;
46
+ device_id?: string | undefined;
47
+ compose_hash?: string | undefined;
48
+ node_id?: number | undefined;
49
+ }>;
50
+ export declare const CheckCvmIsAllowedRequestSchema: z.ZodObject<{
51
+ cvmId: z.ZodString;
52
+ compose_hash: z.ZodOptional<z.ZodString>;
53
+ node_id: z.ZodOptional<z.ZodNumber>;
54
+ device_id: z.ZodOptional<z.ZodString>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ cvmId: string;
57
+ device_id?: string | undefined;
58
+ compose_hash?: string | undefined;
59
+ node_id?: number | undefined;
60
+ }, {
61
+ cvmId: string;
62
+ device_id?: string | undefined;
63
+ compose_hash?: string | undefined;
64
+ node_id?: number | undefined;
65
+ }>;
66
+ export type CheckCvmIsAllowedRequest = z.infer<typeof CheckCvmIsAllowedInputSchema>;
67
+ /**
68
+ * Check if a CVM deployment is allowed by its on-chain DStack App contract.
69
+ *
70
+ * @param client - The API client
71
+ * @param request - Request parameters
72
+ * @param request.cvmId - CVM identifier
73
+ * @param request.compose_hash - Optional compose hash override
74
+ * @param request.node_id - Optional node ID override (resolves device_id)
75
+ * @param request.device_id - Optional device ID override
76
+ * @returns On-chain allowance check result
77
+ */
78
+ declare const checkCvmIsAllowed: {
79
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
80
+ cvmId: string;
81
+ device_id?: string | undefined;
82
+ compose_hash?: string | undefined;
83
+ node_id?: number | undefined;
84
+ }): Promise<{
85
+ device_id: string;
86
+ compose_hash: string;
87
+ compose_hash_allowed: boolean;
88
+ is_allowed: boolean;
89
+ app_contract_address: string;
90
+ allow_any_device: boolean;
91
+ error?: string | null | undefined;
92
+ device_id_allowed?: boolean | null | undefined;
93
+ cvm_id?: number | undefined;
94
+ }>;
95
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
96
+ cvmId: string;
97
+ device_id?: string | undefined;
98
+ compose_hash?: string | undefined;
99
+ node_id?: number | undefined;
100
+ }, parameters: {
101
+ schema: T;
102
+ }): Promise<z.TypeOf<T>>;
103
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
104
+ cvmId: string;
105
+ device_id?: string | undefined;
106
+ compose_hash?: string | undefined;
107
+ node_id?: number | undefined;
108
+ }, parameters: {
109
+ schema: false;
110
+ }): Promise<unknown>;
111
+ }, safeCheckCvmIsAllowed: {
112
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
113
+ cvmId: string;
114
+ device_id?: string | undefined;
115
+ compose_hash?: string | undefined;
116
+ node_id?: number | undefined;
117
+ }): Promise<import("../..").SafeResult<{
118
+ device_id: string;
119
+ compose_hash: string;
120
+ compose_hash_allowed: boolean;
121
+ is_allowed: boolean;
122
+ app_contract_address: string;
123
+ allow_any_device: boolean;
124
+ error?: string | null | undefined;
125
+ device_id_allowed?: boolean | null | undefined;
126
+ cvm_id?: number | undefined;
127
+ }>>;
128
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
129
+ cvmId: string;
130
+ device_id?: string | undefined;
131
+ compose_hash?: string | undefined;
132
+ node_id?: number | undefined;
133
+ }, parameters: {
134
+ schema: T;
135
+ }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
136
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
137
+ cvmId: string;
138
+ device_id?: string | undefined;
139
+ compose_hash?: string | undefined;
140
+ node_id?: number | undefined;
141
+ }, parameters: {
142
+ schema: false;
143
+ }): Promise<import("../..").SafeResult<unknown>>;
144
+ };
145
+ export { checkCvmIsAllowed, safeCheckCvmIsAllowed };
@@ -84,6 +84,25 @@ import { type Client } from "../../client";
84
84
  * - **contract_address**: On-chain KMS contract address (required for ETHEREUM/BASE KMS)
85
85
  * - **deployer_address**: Deployer address for on-chain verification (required for ETHEREUM/BASE KMS)
86
86
  *
87
+ * ## Idempotency
88
+ *
89
+ * This endpoint is idempotent: submitting the same `app_id` + `compose_hash`
90
+ * again returns the existing CVM (safe retry after network timeout). A different
91
+ * `compose_hash` for the same `app_id` throws a `ResourceError` with error code
92
+ * `ERR-03-007` (`CVM_APP_ID_CONFLICT`, HTTP 409).
93
+ *
94
+ * ```typescript
95
+ * import { isAppIdConflictError } from '@phala/cloud'
96
+ *
97
+ * try {
98
+ * const cvm = await commitCvmProvision(client, payload)
99
+ * } catch (error) {
100
+ * if (isAppIdConflictError(error)) {
101
+ * // app_id already used with a different compose_hash
102
+ * }
103
+ * }
104
+ * ```
105
+ *
87
106
  * ## Schema Parameter
88
107
  *
89
108
  * - **Type:** `ZodSchema | false`