@layerzerolabs/dw-model 0.2.67 → 0.2.69
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/372UIOTW.js +107 -0
- package/dist/372UIOTW.js.map +1 -0
- package/dist/{2XSWEWFA.cjs → FOB7D4D6.cjs} +15 -83
- package/dist/FOB7D4D6.cjs.map +1 -0
- package/dist/{MHBV7XHL.js → G43GXBX5.js} +2 -4
- package/dist/G43GXBX5.js.map +1 -0
- package/dist/GLPJHNSD.js +25 -0
- package/dist/GLPJHNSD.js.map +1 -0
- package/dist/{NJ2LWIGZ.cjs → HCK5GXNH.cjs} +2 -4
- package/dist/HCK5GXNH.cjs.map +1 -0
- package/dist/MR335VWI.cjs +29 -0
- package/dist/MR335VWI.cjs.map +1 -0
- package/dist/deploy/artifact.cjs +10 -10
- package/dist/deploy/artifact.d.ts +0 -6
- package/dist/deploy/artifact.d.ts.map +1 -1
- package/dist/deploy/artifact.js +1 -1
- package/dist/deploy/factoryInterfaces.cjs +8 -9
- package/dist/deploy/factoryInterfaces.d.ts +14 -168
- package/dist/deploy/factoryInterfaces.d.ts.map +1 -1
- package/dist/deploy/factoryInterfaces.js +2 -3
- package/dist/deploy/index.cjs +48 -80
- package/dist/deploy/index.js +3 -3
- package/dist/deploy/workflow.cjs +4 -37
- package/dist/deploy/workflow.d.ts +2 -283
- package/dist/deploy/workflow.d.ts.map +1 -1
- package/dist/deploy/workflow.js +1 -2
- package/dist/index.cjs +48 -80
- package/dist/index.js +3 -3
- package/dist/role-management/generator.d.ts +1 -1
- package/dist/role-management/schemata.d.ts +20 -20
- package/dist/role-management/schemata.d.ts.map +1 -1
- package/package.json +12 -9
- package/.turbo/turbo-build.log +0 -143
- package/.turbo/turbo-lint.log +0 -8
- package/.turbo/turbo-test.log +0 -16
- package/dist/2XSWEWFA.cjs.map +0 -1
- package/dist/DRX4MXDW.js +0 -87
- package/dist/DRX4MXDW.js.map +0 -1
- package/dist/FVBHJFVE.cjs +0 -99
- package/dist/FVBHJFVE.cjs.map +0 -1
- package/dist/KK5K3STO.js +0 -175
- package/dist/KK5K3STO.js.map +0 -1
- package/dist/MHBV7XHL.js.map +0 -1
- package/dist/NJ2LWIGZ.cjs.map +0 -1
- package/src/deploy/artifact.ts +0 -99
- package/src/deploy/factoryInterfaces.ts +0 -203
- package/src/deploy/index.ts +0 -5
- package/src/deploy/resourceBuilder.ts +0 -79
- package/src/deploy/resources.md +0 -84
- package/src/deploy/resources.ts +0 -205
- package/src/deploy/workflow.ts +0 -140
- package/src/index.ts +0 -4
- package/src/role-management/generator.ts +0 -17
- package/src/role-management/index.ts +0 -3
- package/src/role-management/schemata.ts +0 -180
- package/src/role-management/types.ts +0 -5
- package/src/upgrade/index.ts +0 -1
- package/src/upgrade/types.ts +0 -159
- package/src/wire/index.ts +0 -1
- package/src/wire/schemata.ts +0 -63
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -8
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
import { normalizedHexSchema, transactionSchema } from '@layerzerolabs/common-chain-model';
|
|
4
|
-
import { gatedTransactionSchema } from '@layerzerolabs/gated-transaction';
|
|
5
|
-
import { functionSchema } from '@layerzerolabs/zod-utils';
|
|
6
|
-
|
|
7
|
-
export const generateCreateSetRoleTransactionsSchema = <
|
|
8
|
-
const T extends readonly [string, ...string[]],
|
|
9
|
-
>(
|
|
10
|
-
roles: T,
|
|
11
|
-
) =>
|
|
12
|
-
functionSchema({
|
|
13
|
-
input: z.tuple([
|
|
14
|
-
z.object({
|
|
15
|
-
role: z.enum(roles),
|
|
16
|
-
accountAddress: normalizedHexSchema,
|
|
17
|
-
shouldGrant: z.boolean(),
|
|
18
|
-
}),
|
|
19
|
-
]),
|
|
20
|
-
output: z.promise(
|
|
21
|
-
gatedTransactionSchema({
|
|
22
|
-
name: z.string(),
|
|
23
|
-
transactionSchema: transactionSchema,
|
|
24
|
-
}).array(),
|
|
25
|
-
),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export const generateHasRoleSchema = <const T extends readonly [string, ...string[]]>(roles: T) =>
|
|
29
|
-
functionSchema({
|
|
30
|
-
input: z.tuple([
|
|
31
|
-
z.object({
|
|
32
|
-
role: z.enum(roles),
|
|
33
|
-
accountAddress: normalizedHexSchema,
|
|
34
|
-
}),
|
|
35
|
-
]),
|
|
36
|
-
output: z.promise(z.boolean()),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export const generateGetRoleMembersSchema = <const T extends readonly [string, ...string[]]>(
|
|
40
|
-
roles: T,
|
|
41
|
-
) =>
|
|
42
|
-
functionSchema({
|
|
43
|
-
input: z.tuple([
|
|
44
|
-
z.object({
|
|
45
|
-
role: z.enum(roles),
|
|
46
|
-
}),
|
|
47
|
-
]),
|
|
48
|
-
output: z.promise(z.array(normalizedHexSchema)),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const generateRoleManagementSchemas = <const T extends readonly [string, ...string[]]>(
|
|
52
|
-
roles: T,
|
|
53
|
-
) => ({
|
|
54
|
-
createSetRoleTransactions: generateCreateSetRoleTransactionsSchema(roles),
|
|
55
|
-
hasRole: generateHasRoleSchema(roles),
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const generateEnumerableRoleManagementSchemas = <
|
|
59
|
-
const T extends readonly [string, ...string[]],
|
|
60
|
-
>(
|
|
61
|
-
roles: T,
|
|
62
|
-
) => ({
|
|
63
|
-
...generateRoleManagementSchemas(roles),
|
|
64
|
-
getRoleMembers: generateGetRoleMembersSchema(roles),
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
export const createSetRoleTransactionsWithSpecializedInputSchema = functionSchema({
|
|
68
|
-
input: z.tuple([
|
|
69
|
-
z.object({
|
|
70
|
-
address: normalizedHexSchema,
|
|
71
|
-
}),
|
|
72
|
-
z.object({
|
|
73
|
-
role: z.string(),
|
|
74
|
-
accountAddress: normalizedHexSchema,
|
|
75
|
-
shouldGrant: z.boolean(),
|
|
76
|
-
}),
|
|
77
|
-
]),
|
|
78
|
-
output: z.promise(
|
|
79
|
-
gatedTransactionSchema({
|
|
80
|
-
name: z.string(),
|
|
81
|
-
transactionSchema: transactionSchema,
|
|
82
|
-
}).array(),
|
|
83
|
-
),
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
export const hasRoleWithSpecializedInputSchema = functionSchema({
|
|
87
|
-
input: z.tuple([
|
|
88
|
-
z.object({
|
|
89
|
-
address: normalizedHexSchema,
|
|
90
|
-
}),
|
|
91
|
-
z.object({
|
|
92
|
-
role: z.string(),
|
|
93
|
-
accountAddress: normalizedHexSchema,
|
|
94
|
-
}),
|
|
95
|
-
]),
|
|
96
|
-
output: z.promise(z.boolean()),
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
export const getRoleMembersWithSpecializedInputSchema = functionSchema({
|
|
100
|
-
input: z.tuple([
|
|
101
|
-
z.object({
|
|
102
|
-
address: normalizedHexSchema,
|
|
103
|
-
}),
|
|
104
|
-
z.object({
|
|
105
|
-
role: z.string(),
|
|
106
|
-
}),
|
|
107
|
-
]),
|
|
108
|
-
output: z.promise(z.array(normalizedHexSchema)),
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
export type CreateSetRoleTransactionsWithSpecializedInput = z.infer<
|
|
112
|
-
typeof createSetRoleTransactionsWithSpecializedInputSchema
|
|
113
|
-
>;
|
|
114
|
-
export type HasRoleWithSpecializedInput = z.infer<typeof hasRoleWithSpecializedInputSchema>;
|
|
115
|
-
export type GetRoleMembersWithSpecializedInput = z.infer<
|
|
116
|
-
typeof getRoleMembersWithSpecializedInputSchema
|
|
117
|
-
>;
|
|
118
|
-
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
// Admin 2-step transfer schemas
|
|
121
|
-
// ---------------------------------------------------------------------------
|
|
122
|
-
|
|
123
|
-
const admin2StepTransactionOutputSchema = z.promise(
|
|
124
|
-
gatedTransactionSchema({
|
|
125
|
-
name: z.string(),
|
|
126
|
-
transactionSchema: transactionSchema,
|
|
127
|
-
}).array(),
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
export const getPendingAdminSchema = functionSchema({
|
|
131
|
-
input: z.tuple([]),
|
|
132
|
-
output: z.promise(normalizedHexSchema),
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
export const createBeginAdminTransferTransactionsSchema = functionSchema({
|
|
136
|
-
input: z.tuple([z.object({ newAdmin: normalizedHexSchema })]),
|
|
137
|
-
output: admin2StepTransactionOutputSchema,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
export const createAcceptAdminTransferTransactionsSchema = functionSchema({
|
|
141
|
-
input: z.tuple([z.object({ newAdmin: normalizedHexSchema })]),
|
|
142
|
-
output: admin2StepTransactionOutputSchema,
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export const generateAdmin2StepSchemas = () => ({
|
|
146
|
-
getPendingAdmin: getPendingAdminSchema,
|
|
147
|
-
createBeginAdminTransferTransactions: createBeginAdminTransferTransactionsSchema,
|
|
148
|
-
createAcceptAdminTransferTransactions: createAcceptAdminTransferTransactionsSchema,
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export const getPendingAdminWithSpecializedInputSchema = functionSchema({
|
|
152
|
-
input: z.tuple([z.object({ address: normalizedHexSchema })]),
|
|
153
|
-
output: z.promise(normalizedHexSchema),
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
export const createBeginAdminTransferTransactionsWithSpecializedInputSchema = functionSchema({
|
|
157
|
-
input: z.tuple([
|
|
158
|
-
z.object({ address: normalizedHexSchema }),
|
|
159
|
-
z.object({ newAdmin: normalizedHexSchema }),
|
|
160
|
-
]),
|
|
161
|
-
output: admin2StepTransactionOutputSchema,
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
export const createAcceptAdminTransferTransactionsWithSpecializedInputSchema = functionSchema({
|
|
165
|
-
input: z.tuple([
|
|
166
|
-
z.object({ address: normalizedHexSchema }),
|
|
167
|
-
z.object({ newAdmin: normalizedHexSchema }),
|
|
168
|
-
]),
|
|
169
|
-
output: admin2StepTransactionOutputSchema,
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
export type GetPendingAdminWithSpecializedInput = z.infer<
|
|
173
|
-
typeof getPendingAdminWithSpecializedInputSchema
|
|
174
|
-
>;
|
|
175
|
-
export type CreateBeginAdminTransferTransactionsWithSpecializedInput = z.infer<
|
|
176
|
-
typeof createBeginAdminTransferTransactionsWithSpecializedInputSchema
|
|
177
|
-
>;
|
|
178
|
-
export type CreateAcceptAdminTransferTransactionsWithSpecializedInput = z.infer<
|
|
179
|
-
typeof createAcceptAdminTransferTransactionsWithSpecializedInputSchema
|
|
180
|
-
>;
|
package/src/upgrade/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
package/src/upgrade/types.ts
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
|
|
3
|
-
import { decimalStringSchema, hexSchema } from '@layerzerolabs/common-chain-model';
|
|
4
|
-
import { assertUnreachable, NonRetryableError } from '@layerzerolabs/common-error-utils';
|
|
5
|
-
import type { Identity } from '@layerzerolabs/typescript-utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* `InitializeDataResult` schema.
|
|
9
|
-
*/
|
|
10
|
-
export const initializeDataResultSchema = z.object({
|
|
11
|
-
/** Encoded initialization data (e.g., encodeFunctionData for initialize(...)) */
|
|
12
|
-
data: hexSchema,
|
|
13
|
-
/** Optional gas limit override for the initialization transaction */
|
|
14
|
-
gasLimit: decimalStringSchema.optional(),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export interface InitializeDataResult
|
|
18
|
-
extends Identity<z.infer<typeof initializeDataResultSchema>> {}
|
|
19
|
-
|
|
20
|
-
export enum UpgradeType {
|
|
21
|
-
// This doesn't necessarily prevent the contract from being upgraded
|
|
22
|
-
NOT_UPGRADEABLE = 'NOT_UPGRADEABLE',
|
|
23
|
-
// Deploy a separate 'proxy' contract that will route calls to a swappable implementation
|
|
24
|
-
PROXY = 'PROXY',
|
|
25
|
-
// This doesn't necessarily allow the contract to be upgraded
|
|
26
|
-
CODE_UPGRADE = 'CODE_UPGRADE',
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export enum EvmProxyType {
|
|
30
|
-
// TUP v5 https://docs.openzeppelin.com/contracts/5.x/api/proxy#transparentupgradeableproxy
|
|
31
|
-
TRANSPARENT_UPGRADEABLE_V5 = 'TRANSPARENT_UPGRADEABLE_V5',
|
|
32
|
-
// UUPS v5 https://docs.openzeppelin.com/contracts/5.x/api/proxy#uupsupgradeable
|
|
33
|
-
UNIVERSAL_UPGRADEABLE_V5 = 'UNIVERSAL_UPGRADEABLE_V5',
|
|
34
|
-
// OTUP v4 https://github.com/wighawag/hardhat-deploy/blob/v0.12.1/solc_0.8/proxy/OptimizedTransparentUpgradeableProxy.sol
|
|
35
|
-
OPTIMIZED_TRANSPARENT_UPGRADEABLE_V4 = 'OPTIMIZED_TRANSPARENT_UPGRADEABLE_V4',
|
|
36
|
-
// TUP v4 https://docs.openzeppelin.com/contracts/4.x/api/proxy#TransparentUpgradeableProxy
|
|
37
|
-
TRANSPARENT_UPGRADEABLE_V4 = 'TRANSPARENT_UPGRADEABLE_V4',
|
|
38
|
-
// UUPS v4 https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable
|
|
39
|
-
UNIVERSAL_UPGRADEABLE_V4 = 'UNIVERSAL_UPGRADEABLE_V4',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** UUPS-based proxy types (no separate `ProxyAdmin`). */
|
|
43
|
-
export const UUPS_PROXY_TYPES: ReadonlySet<EvmProxyType> = new Set([
|
|
44
|
-
EvmProxyType.UNIVERSAL_UPGRADEABLE_V4,
|
|
45
|
-
EvmProxyType.UNIVERSAL_UPGRADEABLE_V5,
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
|
-
/** TUP-based proxy types (have a `ProxyAdmin` with `getOwner`/`setOwner`). */
|
|
49
|
-
export const TUP_PROXY_TYPES: ReadonlySet<EvmProxyType> = new Set([
|
|
50
|
-
EvmProxyType.TRANSPARENT_UPGRADEABLE_V4,
|
|
51
|
-
EvmProxyType.TRANSPARENT_UPGRADEABLE_V5,
|
|
52
|
-
EvmProxyType.OPTIMIZED_TRANSPARENT_UPGRADEABLE_V4,
|
|
53
|
-
]);
|
|
54
|
-
|
|
55
|
-
/** Proxy types that deploy a separate `ProxyAdmin` contract (v4 variants only). */
|
|
56
|
-
export const SEPARATE_PROXY_ADMIN_TYPES: ReadonlySet<EvmProxyType> = new Set([
|
|
57
|
-
EvmProxyType.TRANSPARENT_UPGRADEABLE_V4,
|
|
58
|
-
EvmProxyType.OPTIMIZED_TRANSPARENT_UPGRADEABLE_V4,
|
|
59
|
-
]);
|
|
60
|
-
|
|
61
|
-
/** Whether the proxy type is UUPS (Universal Upgradeable Proxy Standard). */
|
|
62
|
-
export const isUupsProxy = (proxyType: EvmProxyType): boolean => UUPS_PROXY_TYPES.has(proxyType);
|
|
63
|
-
|
|
64
|
-
/** Whether the proxy type is TUP (Transparent Upgradeable Proxy). */
|
|
65
|
-
export const isTupProxy = (proxyType: EvmProxyType): boolean => TUP_PROXY_TYPES.has(proxyType);
|
|
66
|
-
|
|
67
|
-
/** Whether the proxy type requires a separate `ProxyAdmin` deployment (v4 variants). */
|
|
68
|
-
export const requiresSeparateProxyAdminDeploy = (proxyType: EvmProxyType): boolean =>
|
|
69
|
-
SEPARATE_PROXY_ADMIN_TYPES.has(proxyType);
|
|
70
|
-
|
|
71
|
-
export const ProxyType = {
|
|
72
|
-
...EvmProxyType,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type ProxyType = (typeof ProxyType)[keyof typeof ProxyType];
|
|
76
|
-
|
|
77
|
-
export const upgradeTypeSchema = z.enum(UpgradeType);
|
|
78
|
-
|
|
79
|
-
export const proxyTypeSchema = z.enum(ProxyType);
|
|
80
|
-
export const proxyConfigSchema = z.object({
|
|
81
|
-
upgradeType: z.literal(UpgradeType.PROXY),
|
|
82
|
-
proxyType: proxyTypeSchema,
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
export type ProxyUpgradeableConfig = z.infer<typeof proxyConfigSchema>;
|
|
86
|
-
|
|
87
|
-
export const notUpgradeableConfigSchema = z.object({
|
|
88
|
-
upgradeType: z.literal(UpgradeType.NOT_UPGRADEABLE),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
export type NotUpgradeableConfig = z.infer<typeof notUpgradeableConfigSchema>;
|
|
92
|
-
|
|
93
|
-
export const codeUpgradeableConfigSchema = z.object({
|
|
94
|
-
upgradeType: z.literal(UpgradeType.CODE_UPGRADE),
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
export type CodeUpgradeableConfig = z.infer<typeof codeUpgradeableConfigSchema>;
|
|
98
|
-
|
|
99
|
-
export const upgradeableConfigSchema = z.discriminatedUnion('upgradeType', [
|
|
100
|
-
proxyConfigSchema,
|
|
101
|
-
notUpgradeableConfigSchema,
|
|
102
|
-
codeUpgradeableConfigSchema,
|
|
103
|
-
]);
|
|
104
|
-
|
|
105
|
-
export type UpgradeableConfig = z.infer<typeof upgradeableConfigSchema>;
|
|
106
|
-
|
|
107
|
-
/** @deprecated use assertUpgradability, ensure your config is nonoptional */
|
|
108
|
-
export const weakAssertUpgradability = <AllowedUpgradeConfigs extends UpgradeableConfig[]>(
|
|
109
|
-
allowedUpgradeConfigs: AllowedUpgradeConfigs,
|
|
110
|
-
upgradeableConfig?: UpgradeableConfig,
|
|
111
|
-
): asserts upgradeableConfig is AllowedUpgradeConfigs[number] => {
|
|
112
|
-
if (!upgradeableConfig) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
-
allowedUpgradeConfigs.some((allowedConfig) => {
|
|
118
|
-
if (allowedConfig.upgradeType !== upgradeableConfig.upgradeType) {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (allowedConfig.upgradeType === UpgradeType.NOT_UPGRADEABLE) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (allowedConfig.upgradeType === UpgradeType.CODE_UPGRADE) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (allowedConfig.upgradeType === UpgradeType.PROXY) {
|
|
131
|
-
return (
|
|
132
|
-
allowedConfig.proxyType ===
|
|
133
|
-
(upgradeableConfig as ProxyUpgradeableConfig).proxyType
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
assertUnreachable(allowedConfig);
|
|
138
|
-
})
|
|
139
|
-
) {
|
|
140
|
-
// included in allowed array
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
throw new NonRetryableError(
|
|
145
|
-
`Upgrade config ${JSON.stringify(upgradeableConfig)} is not compatible with any of the allowed upgrade configs ${JSON.stringify(allowedUpgradeConfigs)}`,
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export const assertUpgradability = <AllowedUpgradeConfigs extends UpgradeableConfig[]>(
|
|
150
|
-
allowedUpgradeConfigs: AllowedUpgradeConfigs,
|
|
151
|
-
// Eventually make this nonoptional once callers are upgraded
|
|
152
|
-
upgradeableConfig?: UpgradeableConfig,
|
|
153
|
-
): asserts upgradeableConfig is AllowedUpgradeConfigs[number] => {
|
|
154
|
-
if (!upgradeableConfig) {
|
|
155
|
-
throw new NonRetryableError('Will not handle undefined upgrade config');
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return weakAssertUpgradability(allowedUpgradeConfigs, upgradeableConfig);
|
|
159
|
-
};
|
package/src/wire/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './schemata';
|
package/src/wire/schemata.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
import { chainNameSchema } from '@layerzerolabs/layerzero-definitions';
|
|
4
|
-
|
|
5
|
-
export const wireWorkflowFilterArgsSchema = {
|
|
6
|
-
// chain filters
|
|
7
|
-
onlyFrom: z
|
|
8
|
-
.array(chainNameSchema)
|
|
9
|
-
.optional()
|
|
10
|
-
.describe('Only wire pathways originating FROM these chains'),
|
|
11
|
-
onlyTo: z
|
|
12
|
-
.array(chainNameSchema)
|
|
13
|
-
.optional()
|
|
14
|
-
.describe('Only wire pathways going TO these chains'),
|
|
15
|
-
excludeFrom: z
|
|
16
|
-
.array(chainNameSchema)
|
|
17
|
-
.optional()
|
|
18
|
-
.describe('Exclude wiring pathways originating FROM these chains'),
|
|
19
|
-
excludeTo: z
|
|
20
|
-
.array(chainNameSchema)
|
|
21
|
-
.optional()
|
|
22
|
-
.describe('Exclude wiring pathways going TO these chains'),
|
|
23
|
-
|
|
24
|
-
// operation filters
|
|
25
|
-
onlyOperations: z.array(z.string()).optional().describe('Only perform these operations'),
|
|
26
|
-
excludeOperations: z.array(z.string()).optional().describe('Exclude these operations'),
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const wireWorkflowChainResultSchema = z.object({
|
|
30
|
-
results: z.array(
|
|
31
|
-
z.union([
|
|
32
|
-
z.object({
|
|
33
|
-
name: z.string(),
|
|
34
|
-
success: z.literal(false),
|
|
35
|
-
error: z.string(),
|
|
36
|
-
}),
|
|
37
|
-
z.object({
|
|
38
|
-
name: z.string(),
|
|
39
|
-
success: z.literal(true),
|
|
40
|
-
txHash: z.string(),
|
|
41
|
-
}),
|
|
42
|
-
]),
|
|
43
|
-
),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export const wireWorkflowChainStateSchema = wireWorkflowChainResultSchema.extend({
|
|
47
|
-
srcChain: chainNameSchema.optional(),
|
|
48
|
-
status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]).default('RUNNING'),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export type WireWorkflowChainState = z.infer<typeof wireWorkflowChainStateSchema>;
|
|
52
|
-
export type WireWorkflowChainResult = z.infer<typeof wireWorkflowChainResultSchema>;
|
|
53
|
-
|
|
54
|
-
export const wireWorkflowOrchestratorResultSchema = z.object({
|
|
55
|
-
stateByChain: z.partialRecord(chainNameSchema, wireWorkflowChainResultSchema).default({}),
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const wireWorkflowOrchestratorStateSchema = wireWorkflowOrchestratorResultSchema.extend({
|
|
59
|
-
status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]).default('RUNNING'),
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export type WireWorkflowOrchestratorState = z.infer<typeof wireWorkflowOrchestratorStateSchema>;
|
|
63
|
-
export type WireWorkflowOrchestratorResult = z.infer<typeof wireWorkflowOrchestratorResultSchema>;
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@layerzerolabs/typescript-configuration/tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "./dist",
|
|
6
|
-
"strictPropertyInitialization": false,
|
|
7
|
-
"noUnusedLocals": false,
|
|
8
|
-
"noUnusedParameters": false,
|
|
9
|
-
"jsx": "react-jsx"
|
|
10
|
-
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"node_modules",
|
|
13
|
-
"**/__mocks__/*",
|
|
14
|
-
"**/__tests__/*",
|
|
15
|
-
"**/*.spec.ts",
|
|
16
|
-
"**/*.test.ts",
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
19
|
-
"include": ["src/**/*"]
|
|
20
|
-
}
|