@layerzerolabs/lz-config-types 3.0.15 → 3.0.17
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/CHANGELOG.md +20 -0
- package/README.md +101 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +109 -2
- package/dist/index.d.ts +109 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @layerzerolabs/lz-config-types
|
|
2
2
|
|
|
3
|
+
## 3.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 40f2269: islander mainnet
|
|
8
|
+
- 40f2269: testnets
|
|
9
|
+
- Updated dependencies [40f2269]
|
|
10
|
+
- Updated dependencies [40f2269]
|
|
11
|
+
- @layerzerolabs/lz-core@3.0.17
|
|
12
|
+
- @layerzerolabs/lz-definitions@3.0.17
|
|
13
|
+
|
|
14
|
+
## 3.0.16
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 87a4bc9: islander mainnet
|
|
19
|
+
- Updated dependencies [87a4bc9]
|
|
20
|
+
- @layerzerolabs/lz-core@3.0.16
|
|
21
|
+
- @layerzerolabs/lz-definitions@3.0.16
|
|
22
|
+
|
|
3
23
|
## 3.0.15
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @layerzerolabs/lz-config-types
|
|
2
2
|
|
|
3
3
|
This package defines the core interface for the tooling stack, and only includes neutral interfaces unrelated to the LayerZero protocol.
|
|
4
4
|
|
|
@@ -6,3 +6,103 @@ This package defines the core interface for the tooling stack, and only includes
|
|
|
6
6
|
- `Provider` Interface: Define the connectors to a chain node.
|
|
7
7
|
- `Signer` Interface: Sign message and transaction.
|
|
8
8
|
- `Deployment` interface: Represent the structure for deployment information
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
To install the LayerZero Config Types package, you can use npm or yarn:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @layerzerolabs/lz-config-types
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
or
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
yarn add @layerzerolabs/lz-config-types
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Provider Configuration
|
|
28
|
+
|
|
29
|
+
#### ProviderManager
|
|
30
|
+
|
|
31
|
+
Provides methods to retrieve providers based on the specified chain and environment.
|
|
32
|
+
|
|
33
|
+
- chain: The chain for which to retrieve the provider.
|
|
34
|
+
- env: The environment for which to retrieve the provider.
|
|
35
|
+
- Returns: A promise that resolves to the provider.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { ProviderManager } from "@layerzerolabs/lz-config-types";
|
|
39
|
+
import { Chain, Environment } from "@layerzerolabs/lz-definitions";
|
|
40
|
+
|
|
41
|
+
const providerManager: ProviderManager = {
|
|
42
|
+
async getProvider(chain: Chain, env: Environment): Promise<Provider> {
|
|
43
|
+
// Implementation to retrieve the provider
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const chain: Chain = "ethereum";
|
|
48
|
+
const env: Environment = "mainnet";
|
|
49
|
+
|
|
50
|
+
providerManager.getProvider(chain, env).then((provider) => {
|
|
51
|
+
console.log(`Provider: ${provider}`);
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Signer Configuration
|
|
56
|
+
|
|
57
|
+
#### SignerManager
|
|
58
|
+
|
|
59
|
+
Provides methods to retrieve signers based on the specified chain, stage, environment, and key name.
|
|
60
|
+
|
|
61
|
+
- chain: The chain for which to retrieve the signer.
|
|
62
|
+
- stage: The stage for which to retrieve the signer.
|
|
63
|
+
- env: The environment for which to retrieve the signer.
|
|
64
|
+
- keyName: The key name for which to retrieve the signer.
|
|
65
|
+
- Returns: A promise that resolves to the signer.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { SignerManager } from "@layerzerolabs/lz-config-types";
|
|
69
|
+
import { Chain, Stage, Environment } from "@layerzerolabs/lz-definitions";
|
|
70
|
+
|
|
71
|
+
const signerManager: SignerManager = {
|
|
72
|
+
async getSigner(chain: Chain, stage: Stage, env: Environment, keyName: string): Promise<Signer> {
|
|
73
|
+
// Implementation to retrieve the signer
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const chain: Chain = "ethereum";
|
|
78
|
+
const stage: Stage = "development";
|
|
79
|
+
const env: Environment = "sandbox";
|
|
80
|
+
const keyName = "key1";
|
|
81
|
+
|
|
82
|
+
signerManager.getSigner(chain, stage, env, keyName).then((signer) => {
|
|
83
|
+
console.log(`Signer: ${signer}`);
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Configuration Manager
|
|
88
|
+
|
|
89
|
+
#### ConfigManager
|
|
90
|
+
|
|
91
|
+
Provides methods to retrieve configuration values based on a specified path.
|
|
92
|
+
|
|
93
|
+
- path: The path to the configuration value.
|
|
94
|
+
- Returns: A promise that resolves to the configuration value.
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { ConfigManager } from "@layerzerolabs/lz-config-types";
|
|
98
|
+
|
|
99
|
+
const configManager: ConfigManager = {
|
|
100
|
+
async get(...path: (string | number | (string | number)[])[]): Promise<unknown> {
|
|
101
|
+
// Implementation to retrieve the configuration value
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
configManager.get("database", "host").then((value) => {
|
|
106
|
+
console.log(`Configuration Value: ${value}`);
|
|
107
|
+
});
|
|
108
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -23,5 +23,5 @@ function isCombinedSquadsItemConfig(obj) {
|
|
|
23
23
|
exports.isCombinedGnosisItemConfig = isCombinedGnosisItemConfig;
|
|
24
24
|
exports.isCombinedSquadsItemConfig = isCombinedSquadsItemConfig;
|
|
25
25
|
exports.isGnosisItemConfig = isGnosisItemConfig;
|
|
26
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=index.cjs.map
|
|
27
27
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/signer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/signer.ts"],"names":[],"mappings":";;;AAgJO,SAAS,mBAAmB,GAAuC,EAAA;AACtE,EAAI,IAAA,GAAA,KAAQ,KAAa,CAAA,IAAA,GAAA,KAAQ,IAAM,EAAA;AACnC,IAAO,OAAA,KAAA;AAAA;AAGX,EAAA,OAAO,OAAO,GAAA,KAAQ,QAAY,IAAA,SAAA,IAAa,OAAO,aAAiB,IAAA,GAAA;AAC3E;AAQO,SAAS,2BAA2B,GAA+C,EAAA;AACtF,EAAI,IAAA,GAAA,KAAQ,KAAa,CAAA,IAAA,GAAA,KAAQ,IAAM,EAAA;AACnC,IAAO,OAAA,KAAA;AAAA;AAGX,EAAO,OAAA,OAAO,QAAQ,QAAY,IAAA,SAAA,IAAa,OAAO,aAAiB,IAAA,GAAA,KAAQ,UAAc,IAAA,GAAA,IAAO,IAAQ,IAAA,GAAA,CAAA;AAChH;AAQO,SAAS,2BAA2B,GAA+C,EAAA;AACtF,EAAI,IAAA,GAAA,KAAQ,KAAa,CAAA,IAAA,GAAA,KAAQ,IAAM,EAAA;AACnC,IAAO,OAAA,KAAA;AAAA;AAGX,EAAO,OAAA,OAAO,GAAQ,KAAA,QAAA,IAAY,iBAAqB,IAAA,GAAA;AAC3D","file":"index.cjs","sourcesContent":["import { ContractNetworksConfig } from '@safe-global/protocol-kit'\ntype ContractNetworkConfig = ContractNetworksConfig[string]\n\n// ------------------ Account/Signer Config ------------------\n\nimport { Signer } from '@layerzerolabs/lz-core'\nimport { Chain, ChainType, Environment, Stage } from '@layerzerolabs/lz-definitions'\n\n/**\n * Interface representing the configuration for a signer item.\n */\nexport interface SignerItemConfig {\n /**\n * The mnemonic for the signer.\n */\n mnemonic?: string\n /**\n * The derivation path for the signer.\n */\n path?: string\n /**\n * The address of the signer.\n */\n address?: string\n /**\n * The private key of the signer.\n */\n pk?: string\n}\n\n/**\n * Interface representing the configuration for a Gnosis item.\n */\nexport interface GnosisItemConfig {\n /**\n * The URL of the Gnosis safe.\n */\n safeUrl: string\n /**\n * The address of the Gnosis safe.\n */\n safeAddress: string\n /**\n * The contract networks configuration for the Gnosis safe (optional).\n * @see {@link ContractNetworksConfig}\n */\n contractNetworks?: { [key: string]: Partial<ContractNetworkConfig> }\n}\n\n/**\n * Interface representing the configuration for a Squads item.\n */\nexport interface SquadsItemConfig {\n /**\n * The address of the multisig.\n */\n multisigAddress: string\n}\n\n/**\n * Type representing the configuration for Gnosis by stage and chain.\n * @see {@link GnosisItemConfig}, {@link SquadsItemConfig}, {@link ChainType}, {@link Chain}\n */\nexport type GnosisStageConfig = {\n [chainOrType in ChainType | Chain]?: { [key: string]: GnosisItemConfig | SquadsItemConfig }\n}\n\n/**\n * Type representing the configuration for Gnosis by stage.\n * This type maps stages to their corresponding Gnosis stage configurations.\n */\nexport type GnosisConfig = {\n /**\n * The stage of the configuration.\n * @see {@link Stage}, {@link GnosisStageConfig}\n */\n [stage in Stage]?: GnosisStageConfig\n}\n\n/**\n * Type representing the combined configuration for Gnosis and signer items.\n */\nexport type CombinedGnosisItemConfig = GnosisItemConfig & SignerItemConfig\n\n/**\n * Type representing the combined configuration for Squads and signer items.\n */\nexport type CombinedSquadsItemConfig = SquadsItemConfig & SignerItemConfig\n/**\n * Type representing the configuration for signers by stage, chain, and key name.\n * @example\n * ```json\n * {\n * \"sandbox\": {\n * \"ethereum\": {\n * \"key1\": {\n * \"mnemonic\": \"xxx\",\n * \"path\": \"xxx\"\n * },\n * \"key2\": {\n * \"pk\": \"xxx\",\n * \"path\": \"xxx\"\n * safeUrl: \"xxx\",\n * safeAddress: \"xxx\"\n * }\n * }\n * }\n * }\n *\n * @see {@link SignerItemConfig}, {@link CombinedGnosisItemConfig}, {@link CombinedSquadsItemConfig}, {@link ChainType}, {@link Chain}\n * ```\n */\nexport type SignerConfig = {\n [stage in Stage]?: {\n [chainOrType in ChainType | Chain]?: {\n [key: string]: SignerItemConfig | CombinedGnosisItemConfig | CombinedSquadsItemConfig\n }\n }\n}\n\n/**\n * Interface representing a signer manager.\n * Provides methods to retrieve signers based on the specified chain, stage, environment, and key name.\n */\nexport interface SignerManager {\n /**\n * Retrieves a signer based on the specified chain, stage, environment, and key name.\n *\n * @param {Chain} chain - The chain for which to retrieve the signer.\n * @param {Stage} stage - The stage for which to retrieve the signer.\n * @param {Environment} env - The environment for which to retrieve the signer.\n * @param {string} keyName - The key name for which to retrieve the signer.\n * @returns {Promise<Signer>} A promise that resolves to the signer.\n */\n getSigner(chain: Chain, stage: Stage, env: Environment, keyName: string): Promise<Signer>\n}\n\n/**\n * Checks if the given object is a Gnosis item configuration.\n *\n * @param {unknown} obj - The object to check.\n * @returns {boolean} True if the object is a Gnosis item configuration, false otherwise.\n * @see {@link GnosisItemConfig}\n */\nexport function isGnosisItemConfig(obj: unknown): obj is GnosisItemConfig {\n if (obj === undefined || obj === null) {\n return false\n }\n\n return typeof obj === 'object' && 'safeUrl' in obj && 'safeAddress' in obj\n}\n\n/**\n * Checks if the given object is a combined Gnosis item configuration.\n *\n * @param {unknown} obj - The object to check.\n * @returns {boolean} True if the object is a combined Gnosis item configuration, false otherwise.\n */\nexport function isCombinedGnosisItemConfig(obj: unknown): obj is CombinedGnosisItemConfig {\n if (obj === undefined || obj === null) {\n return false\n }\n\n return typeof obj === 'object' && 'safeUrl' in obj && 'safeAddress' in obj && ('mnemonic' in obj || 'pk' in obj)\n}\n\n/**\n * Checks if the given object is a combined Squads item configuration.\n *\n * @param {unknown} obj - The object to check.\n * @returns {boolean} True if the object is a combined Squads item configuration, false otherwise.\n */\nexport function isCombinedSquadsItemConfig(obj: unknown): obj is CombinedSquadsItemConfig {\n if (obj === undefined || obj === null) {\n return false\n }\n\n return typeof obj === 'object' && 'multisigAddress' in obj\n}\n"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -2,50 +2,123 @@ import { Provider, Signer } from '@layerzerolabs/lz-core';
|
|
|
2
2
|
import { Environment, Chain, ChainType, Stage } from '@layerzerolabs/lz-definitions';
|
|
3
3
|
import { ContractNetworksConfig } from '@safe-global/protocol-kit';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Type representing the settings for a provider.
|
|
7
|
+
* It can be either an object with a URL and an optional API key, or a string representing the URL.
|
|
8
|
+
*/
|
|
5
9
|
type ProviderSetting = {
|
|
10
|
+
/**
|
|
11
|
+
* The URL of the provider.
|
|
12
|
+
*/
|
|
6
13
|
url: string;
|
|
14
|
+
/**
|
|
15
|
+
* The API key for the provider (optional).
|
|
16
|
+
*/
|
|
7
17
|
apiKey?: string;
|
|
8
18
|
} | string;
|
|
19
|
+
/**
|
|
20
|
+
* Type representing the configuration for providers.
|
|
21
|
+
* It maps environments to chains and their corresponding provider settings.
|
|
22
|
+
*/
|
|
9
23
|
type ProviderConfig = {
|
|
10
24
|
[env in Environment]?: {
|
|
11
25
|
[chain in Chain]?: ProviderSetting;
|
|
12
26
|
};
|
|
13
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Interface representing a provider manager.
|
|
30
|
+
* Provides methods to retrieve providers based on the specified chain and environment.
|
|
31
|
+
*/
|
|
14
32
|
interface ProviderManager {
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves a provider based on the specified chain and environment.
|
|
35
|
+
*
|
|
36
|
+
* @param {Chain} chain - The chain for which to retrieve the provider.
|
|
37
|
+
* @param {Environment} env - The environment for which to retrieve the provider.
|
|
38
|
+
* @returns {Promise<Provider>} A promise that resolves to the provider.
|
|
39
|
+
*/
|
|
15
40
|
getProvider(chain: Chain, env: Environment): Promise<Provider>;
|
|
16
41
|
}
|
|
17
42
|
|
|
18
43
|
type ContractNetworkConfig = ContractNetworksConfig[string];
|
|
19
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Interface representing the configuration for a signer item.
|
|
47
|
+
*/
|
|
20
48
|
interface SignerItemConfig {
|
|
49
|
+
/**
|
|
50
|
+
* The mnemonic for the signer.
|
|
51
|
+
*/
|
|
21
52
|
mnemonic?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The derivation path for the signer.
|
|
55
|
+
*/
|
|
22
56
|
path?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The address of the signer.
|
|
59
|
+
*/
|
|
23
60
|
address?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The private key of the signer.
|
|
63
|
+
*/
|
|
24
64
|
pk?: string;
|
|
25
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Interface representing the configuration for a Gnosis item.
|
|
68
|
+
*/
|
|
26
69
|
interface GnosisItemConfig {
|
|
70
|
+
/**
|
|
71
|
+
* The URL of the Gnosis safe.
|
|
72
|
+
*/
|
|
27
73
|
safeUrl: string;
|
|
74
|
+
/**
|
|
75
|
+
* The address of the Gnosis safe.
|
|
76
|
+
*/
|
|
28
77
|
safeAddress: string;
|
|
78
|
+
/**
|
|
79
|
+
* The contract networks configuration for the Gnosis safe (optional).
|
|
80
|
+
* @see {@link ContractNetworksConfig}
|
|
81
|
+
*/
|
|
29
82
|
contractNetworks?: {
|
|
30
83
|
[key: string]: Partial<ContractNetworkConfig>;
|
|
31
84
|
};
|
|
32
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Interface representing the configuration for a Squads item.
|
|
88
|
+
*/
|
|
33
89
|
interface SquadsItemConfig {
|
|
90
|
+
/**
|
|
91
|
+
* The address of the multisig.
|
|
92
|
+
*/
|
|
34
93
|
multisigAddress: string;
|
|
35
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Type representing the configuration for Gnosis by stage and chain.
|
|
97
|
+
* @see {@link GnosisItemConfig}, {@link SquadsItemConfig}, {@link ChainType}, {@link Chain}
|
|
98
|
+
*/
|
|
36
99
|
type GnosisStageConfig = {
|
|
37
100
|
[chainOrType in ChainType | Chain]?: {
|
|
38
101
|
[key: string]: GnosisItemConfig | SquadsItemConfig;
|
|
39
102
|
};
|
|
40
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Type representing the configuration for Gnosis by stage.
|
|
106
|
+
* This type maps stages to their corresponding Gnosis stage configurations.
|
|
107
|
+
*/
|
|
41
108
|
type GnosisConfig = {
|
|
42
109
|
[stage in Stage]?: GnosisStageConfig;
|
|
43
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* Type representing the combined configuration for Gnosis and signer items.
|
|
113
|
+
*/
|
|
44
114
|
type CombinedGnosisItemConfig = GnosisItemConfig & SignerItemConfig;
|
|
115
|
+
/**
|
|
116
|
+
* Type representing the combined configuration for Squads and signer items.
|
|
117
|
+
*/
|
|
45
118
|
type CombinedSquadsItemConfig = SquadsItemConfig & SignerItemConfig;
|
|
46
119
|
/**
|
|
47
|
-
*
|
|
48
|
-
* example
|
|
120
|
+
* Type representing the configuration for signers by stage, chain, and key name.
|
|
121
|
+
* @example
|
|
49
122
|
* ```json
|
|
50
123
|
* {
|
|
51
124
|
* "sandbox": {
|
|
@@ -63,6 +136,8 @@ type CombinedSquadsItemConfig = SquadsItemConfig & SignerItemConfig;
|
|
|
63
136
|
* }
|
|
64
137
|
* }
|
|
65
138
|
* }
|
|
139
|
+
*
|
|
140
|
+
* @see {@link SignerItemConfig}, {@link CombinedGnosisItemConfig}, {@link CombinedSquadsItemConfig}, {@link ChainType}, {@link Chain}
|
|
66
141
|
* ```
|
|
67
142
|
*/
|
|
68
143
|
type SignerConfig = {
|
|
@@ -72,11 +147,43 @@ type SignerConfig = {
|
|
|
72
147
|
};
|
|
73
148
|
};
|
|
74
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* Interface representing a signer manager.
|
|
152
|
+
* Provides methods to retrieve signers based on the specified chain, stage, environment, and key name.
|
|
153
|
+
*/
|
|
75
154
|
interface SignerManager {
|
|
155
|
+
/**
|
|
156
|
+
* Retrieves a signer based on the specified chain, stage, environment, and key name.
|
|
157
|
+
*
|
|
158
|
+
* @param {Chain} chain - The chain for which to retrieve the signer.
|
|
159
|
+
* @param {Stage} stage - The stage for which to retrieve the signer.
|
|
160
|
+
* @param {Environment} env - The environment for which to retrieve the signer.
|
|
161
|
+
* @param {string} keyName - The key name for which to retrieve the signer.
|
|
162
|
+
* @returns {Promise<Signer>} A promise that resolves to the signer.
|
|
163
|
+
*/
|
|
76
164
|
getSigner(chain: Chain, stage: Stage, env: Environment, keyName: string): Promise<Signer>;
|
|
77
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Checks if the given object is a Gnosis item configuration.
|
|
168
|
+
*
|
|
169
|
+
* @param {unknown} obj - The object to check.
|
|
170
|
+
* @returns {boolean} True if the object is a Gnosis item configuration, false otherwise.
|
|
171
|
+
* @see {@link GnosisItemConfig}
|
|
172
|
+
*/
|
|
78
173
|
declare function isGnosisItemConfig(obj: unknown): obj is GnosisItemConfig;
|
|
174
|
+
/**
|
|
175
|
+
* Checks if the given object is a combined Gnosis item configuration.
|
|
176
|
+
*
|
|
177
|
+
* @param {unknown} obj - The object to check.
|
|
178
|
+
* @returns {boolean} True if the object is a combined Gnosis item configuration, false otherwise.
|
|
179
|
+
*/
|
|
79
180
|
declare function isCombinedGnosisItemConfig(obj: unknown): obj is CombinedGnosisItemConfig;
|
|
181
|
+
/**
|
|
182
|
+
* Checks if the given object is a combined Squads item configuration.
|
|
183
|
+
*
|
|
184
|
+
* @param {unknown} obj - The object to check.
|
|
185
|
+
* @returns {boolean} True if the object is a combined Squads item configuration, false otherwise.
|
|
186
|
+
*/
|
|
80
187
|
declare function isCombinedSquadsItemConfig(obj: unknown): obj is CombinedSquadsItemConfig;
|
|
81
188
|
|
|
82
189
|
export { type CombinedGnosisItemConfig, type CombinedSquadsItemConfig, type GnosisConfig, type GnosisItemConfig, type GnosisStageConfig, type ProviderConfig, type ProviderManager, type ProviderSetting, type SignerConfig, type SignerItemConfig, type SignerManager, type SquadsItemConfig, isCombinedGnosisItemConfig, isCombinedSquadsItemConfig, isGnosisItemConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,50 +2,123 @@ import { Provider, Signer } from '@layerzerolabs/lz-core';
|
|
|
2
2
|
import { Environment, Chain, ChainType, Stage } from '@layerzerolabs/lz-definitions';
|
|
3
3
|
import { ContractNetworksConfig } from '@safe-global/protocol-kit';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Type representing the settings for a provider.
|
|
7
|
+
* It can be either an object with a URL and an optional API key, or a string representing the URL.
|
|
8
|
+
*/
|
|
5
9
|
type ProviderSetting = {
|
|
10
|
+
/**
|
|
11
|
+
* The URL of the provider.
|
|
12
|
+
*/
|
|
6
13
|
url: string;
|
|
14
|
+
/**
|
|
15
|
+
* The API key for the provider (optional).
|
|
16
|
+
*/
|
|
7
17
|
apiKey?: string;
|
|
8
18
|
} | string;
|
|
19
|
+
/**
|
|
20
|
+
* Type representing the configuration for providers.
|
|
21
|
+
* It maps environments to chains and their corresponding provider settings.
|
|
22
|
+
*/
|
|
9
23
|
type ProviderConfig = {
|
|
10
24
|
[env in Environment]?: {
|
|
11
25
|
[chain in Chain]?: ProviderSetting;
|
|
12
26
|
};
|
|
13
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Interface representing a provider manager.
|
|
30
|
+
* Provides methods to retrieve providers based on the specified chain and environment.
|
|
31
|
+
*/
|
|
14
32
|
interface ProviderManager {
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves a provider based on the specified chain and environment.
|
|
35
|
+
*
|
|
36
|
+
* @param {Chain} chain - The chain for which to retrieve the provider.
|
|
37
|
+
* @param {Environment} env - The environment for which to retrieve the provider.
|
|
38
|
+
* @returns {Promise<Provider>} A promise that resolves to the provider.
|
|
39
|
+
*/
|
|
15
40
|
getProvider(chain: Chain, env: Environment): Promise<Provider>;
|
|
16
41
|
}
|
|
17
42
|
|
|
18
43
|
type ContractNetworkConfig = ContractNetworksConfig[string];
|
|
19
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Interface representing the configuration for a signer item.
|
|
47
|
+
*/
|
|
20
48
|
interface SignerItemConfig {
|
|
49
|
+
/**
|
|
50
|
+
* The mnemonic for the signer.
|
|
51
|
+
*/
|
|
21
52
|
mnemonic?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The derivation path for the signer.
|
|
55
|
+
*/
|
|
22
56
|
path?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The address of the signer.
|
|
59
|
+
*/
|
|
23
60
|
address?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The private key of the signer.
|
|
63
|
+
*/
|
|
24
64
|
pk?: string;
|
|
25
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Interface representing the configuration for a Gnosis item.
|
|
68
|
+
*/
|
|
26
69
|
interface GnosisItemConfig {
|
|
70
|
+
/**
|
|
71
|
+
* The URL of the Gnosis safe.
|
|
72
|
+
*/
|
|
27
73
|
safeUrl: string;
|
|
74
|
+
/**
|
|
75
|
+
* The address of the Gnosis safe.
|
|
76
|
+
*/
|
|
28
77
|
safeAddress: string;
|
|
78
|
+
/**
|
|
79
|
+
* The contract networks configuration for the Gnosis safe (optional).
|
|
80
|
+
* @see {@link ContractNetworksConfig}
|
|
81
|
+
*/
|
|
29
82
|
contractNetworks?: {
|
|
30
83
|
[key: string]: Partial<ContractNetworkConfig>;
|
|
31
84
|
};
|
|
32
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Interface representing the configuration for a Squads item.
|
|
88
|
+
*/
|
|
33
89
|
interface SquadsItemConfig {
|
|
90
|
+
/**
|
|
91
|
+
* The address of the multisig.
|
|
92
|
+
*/
|
|
34
93
|
multisigAddress: string;
|
|
35
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Type representing the configuration for Gnosis by stage and chain.
|
|
97
|
+
* @see {@link GnosisItemConfig}, {@link SquadsItemConfig}, {@link ChainType}, {@link Chain}
|
|
98
|
+
*/
|
|
36
99
|
type GnosisStageConfig = {
|
|
37
100
|
[chainOrType in ChainType | Chain]?: {
|
|
38
101
|
[key: string]: GnosisItemConfig | SquadsItemConfig;
|
|
39
102
|
};
|
|
40
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Type representing the configuration for Gnosis by stage.
|
|
106
|
+
* This type maps stages to their corresponding Gnosis stage configurations.
|
|
107
|
+
*/
|
|
41
108
|
type GnosisConfig = {
|
|
42
109
|
[stage in Stage]?: GnosisStageConfig;
|
|
43
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* Type representing the combined configuration for Gnosis and signer items.
|
|
113
|
+
*/
|
|
44
114
|
type CombinedGnosisItemConfig = GnosisItemConfig & SignerItemConfig;
|
|
115
|
+
/**
|
|
116
|
+
* Type representing the combined configuration for Squads and signer items.
|
|
117
|
+
*/
|
|
45
118
|
type CombinedSquadsItemConfig = SquadsItemConfig & SignerItemConfig;
|
|
46
119
|
/**
|
|
47
|
-
*
|
|
48
|
-
* example
|
|
120
|
+
* Type representing the configuration for signers by stage, chain, and key name.
|
|
121
|
+
* @example
|
|
49
122
|
* ```json
|
|
50
123
|
* {
|
|
51
124
|
* "sandbox": {
|
|
@@ -63,6 +136,8 @@ type CombinedSquadsItemConfig = SquadsItemConfig & SignerItemConfig;
|
|
|
63
136
|
* }
|
|
64
137
|
* }
|
|
65
138
|
* }
|
|
139
|
+
*
|
|
140
|
+
* @see {@link SignerItemConfig}, {@link CombinedGnosisItemConfig}, {@link CombinedSquadsItemConfig}, {@link ChainType}, {@link Chain}
|
|
66
141
|
* ```
|
|
67
142
|
*/
|
|
68
143
|
type SignerConfig = {
|
|
@@ -72,11 +147,43 @@ type SignerConfig = {
|
|
|
72
147
|
};
|
|
73
148
|
};
|
|
74
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* Interface representing a signer manager.
|
|
152
|
+
* Provides methods to retrieve signers based on the specified chain, stage, environment, and key name.
|
|
153
|
+
*/
|
|
75
154
|
interface SignerManager {
|
|
155
|
+
/**
|
|
156
|
+
* Retrieves a signer based on the specified chain, stage, environment, and key name.
|
|
157
|
+
*
|
|
158
|
+
* @param {Chain} chain - The chain for which to retrieve the signer.
|
|
159
|
+
* @param {Stage} stage - The stage for which to retrieve the signer.
|
|
160
|
+
* @param {Environment} env - The environment for which to retrieve the signer.
|
|
161
|
+
* @param {string} keyName - The key name for which to retrieve the signer.
|
|
162
|
+
* @returns {Promise<Signer>} A promise that resolves to the signer.
|
|
163
|
+
*/
|
|
76
164
|
getSigner(chain: Chain, stage: Stage, env: Environment, keyName: string): Promise<Signer>;
|
|
77
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Checks if the given object is a Gnosis item configuration.
|
|
168
|
+
*
|
|
169
|
+
* @param {unknown} obj - The object to check.
|
|
170
|
+
* @returns {boolean} True if the object is a Gnosis item configuration, false otherwise.
|
|
171
|
+
* @see {@link GnosisItemConfig}
|
|
172
|
+
*/
|
|
78
173
|
declare function isGnosisItemConfig(obj: unknown): obj is GnosisItemConfig;
|
|
174
|
+
/**
|
|
175
|
+
* Checks if the given object is a combined Gnosis item configuration.
|
|
176
|
+
*
|
|
177
|
+
* @param {unknown} obj - The object to check.
|
|
178
|
+
* @returns {boolean} True if the object is a combined Gnosis item configuration, false otherwise.
|
|
179
|
+
*/
|
|
79
180
|
declare function isCombinedGnosisItemConfig(obj: unknown): obj is CombinedGnosisItemConfig;
|
|
181
|
+
/**
|
|
182
|
+
* Checks if the given object is a combined Squads item configuration.
|
|
183
|
+
*
|
|
184
|
+
* @param {unknown} obj - The object to check.
|
|
185
|
+
* @returns {boolean} True if the object is a combined Squads item configuration, false otherwise.
|
|
186
|
+
*/
|
|
80
187
|
declare function isCombinedSquadsItemConfig(obj: unknown): obj is CombinedSquadsItemConfig;
|
|
81
188
|
|
|
82
189
|
export { type CombinedGnosisItemConfig, type CombinedSquadsItemConfig, type GnosisConfig, type GnosisItemConfig, type GnosisStageConfig, type ProviderConfig, type ProviderManager, type ProviderSetting, type SignerConfig, type SignerItemConfig, type SignerManager, type SquadsItemConfig, isCombinedGnosisItemConfig, isCombinedSquadsItemConfig, isGnosisItemConfig };
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/signer.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/signer.ts"],"names":[],"mappings":";AAgJO,SAAS,mBAAmB,GAAuC,EAAA;AACtE,EAAI,IAAA,GAAA,KAAQ,KAAa,CAAA,IAAA,GAAA,KAAQ,IAAM,EAAA;AACnC,IAAO,OAAA,KAAA;AAAA;AAGX,EAAA,OAAO,OAAO,GAAA,KAAQ,QAAY,IAAA,SAAA,IAAa,OAAO,aAAiB,IAAA,GAAA;AAC3E;AAQO,SAAS,2BAA2B,GAA+C,EAAA;AACtF,EAAI,IAAA,GAAA,KAAQ,KAAa,CAAA,IAAA,GAAA,KAAQ,IAAM,EAAA;AACnC,IAAO,OAAA,KAAA;AAAA;AAGX,EAAO,OAAA,OAAO,QAAQ,QAAY,IAAA,SAAA,IAAa,OAAO,aAAiB,IAAA,GAAA,KAAQ,UAAc,IAAA,GAAA,IAAO,IAAQ,IAAA,GAAA,CAAA;AAChH;AAQO,SAAS,2BAA2B,GAA+C,EAAA;AACtF,EAAI,IAAA,GAAA,KAAQ,KAAa,CAAA,IAAA,GAAA,KAAQ,IAAM,EAAA;AACnC,IAAO,OAAA,KAAA;AAAA;AAGX,EAAO,OAAA,OAAO,GAAQ,KAAA,QAAA,IAAY,iBAAqB,IAAA,GAAA;AAC3D","file":"index.mjs","sourcesContent":["import { ContractNetworksConfig } from '@safe-global/protocol-kit'\ntype ContractNetworkConfig = ContractNetworksConfig[string]\n\n// ------------------ Account/Signer Config ------------------\n\nimport { Signer } from '@layerzerolabs/lz-core'\nimport { Chain, ChainType, Environment, Stage } from '@layerzerolabs/lz-definitions'\n\n/**\n * Interface representing the configuration for a signer item.\n */\nexport interface SignerItemConfig {\n /**\n * The mnemonic for the signer.\n */\n mnemonic?: string\n /**\n * The derivation path for the signer.\n */\n path?: string\n /**\n * The address of the signer.\n */\n address?: string\n /**\n * The private key of the signer.\n */\n pk?: string\n}\n\n/**\n * Interface representing the configuration for a Gnosis item.\n */\nexport interface GnosisItemConfig {\n /**\n * The URL of the Gnosis safe.\n */\n safeUrl: string\n /**\n * The address of the Gnosis safe.\n */\n safeAddress: string\n /**\n * The contract networks configuration for the Gnosis safe (optional).\n * @see {@link ContractNetworksConfig}\n */\n contractNetworks?: { [key: string]: Partial<ContractNetworkConfig> }\n}\n\n/**\n * Interface representing the configuration for a Squads item.\n */\nexport interface SquadsItemConfig {\n /**\n * The address of the multisig.\n */\n multisigAddress: string\n}\n\n/**\n * Type representing the configuration for Gnosis by stage and chain.\n * @see {@link GnosisItemConfig}, {@link SquadsItemConfig}, {@link ChainType}, {@link Chain}\n */\nexport type GnosisStageConfig = {\n [chainOrType in ChainType | Chain]?: { [key: string]: GnosisItemConfig | SquadsItemConfig }\n}\n\n/**\n * Type representing the configuration for Gnosis by stage.\n * This type maps stages to their corresponding Gnosis stage configurations.\n */\nexport type GnosisConfig = {\n /**\n * The stage of the configuration.\n * @see {@link Stage}, {@link GnosisStageConfig}\n */\n [stage in Stage]?: GnosisStageConfig\n}\n\n/**\n * Type representing the combined configuration for Gnosis and signer items.\n */\nexport type CombinedGnosisItemConfig = GnosisItemConfig & SignerItemConfig\n\n/**\n * Type representing the combined configuration for Squads and signer items.\n */\nexport type CombinedSquadsItemConfig = SquadsItemConfig & SignerItemConfig\n/**\n * Type representing the configuration for signers by stage, chain, and key name.\n * @example\n * ```json\n * {\n * \"sandbox\": {\n * \"ethereum\": {\n * \"key1\": {\n * \"mnemonic\": \"xxx\",\n * \"path\": \"xxx\"\n * },\n * \"key2\": {\n * \"pk\": \"xxx\",\n * \"path\": \"xxx\"\n * safeUrl: \"xxx\",\n * safeAddress: \"xxx\"\n * }\n * }\n * }\n * }\n *\n * @see {@link SignerItemConfig}, {@link CombinedGnosisItemConfig}, {@link CombinedSquadsItemConfig}, {@link ChainType}, {@link Chain}\n * ```\n */\nexport type SignerConfig = {\n [stage in Stage]?: {\n [chainOrType in ChainType | Chain]?: {\n [key: string]: SignerItemConfig | CombinedGnosisItemConfig | CombinedSquadsItemConfig\n }\n }\n}\n\n/**\n * Interface representing a signer manager.\n * Provides methods to retrieve signers based on the specified chain, stage, environment, and key name.\n */\nexport interface SignerManager {\n /**\n * Retrieves a signer based on the specified chain, stage, environment, and key name.\n *\n * @param {Chain} chain - The chain for which to retrieve the signer.\n * @param {Stage} stage - The stage for which to retrieve the signer.\n * @param {Environment} env - The environment for which to retrieve the signer.\n * @param {string} keyName - The key name for which to retrieve the signer.\n * @returns {Promise<Signer>} A promise that resolves to the signer.\n */\n getSigner(chain: Chain, stage: Stage, env: Environment, keyName: string): Promise<Signer>\n}\n\n/**\n * Checks if the given object is a Gnosis item configuration.\n *\n * @param {unknown} obj - The object to check.\n * @returns {boolean} True if the object is a Gnosis item configuration, false otherwise.\n * @see {@link GnosisItemConfig}\n */\nexport function isGnosisItemConfig(obj: unknown): obj is GnosisItemConfig {\n if (obj === undefined || obj === null) {\n return false\n }\n\n return typeof obj === 'object' && 'safeUrl' in obj && 'safeAddress' in obj\n}\n\n/**\n * Checks if the given object is a combined Gnosis item configuration.\n *\n * @param {unknown} obj - The object to check.\n * @returns {boolean} True if the object is a combined Gnosis item configuration, false otherwise.\n */\nexport function isCombinedGnosisItemConfig(obj: unknown): obj is CombinedGnosisItemConfig {\n if (obj === undefined || obj === null) {\n return false\n }\n\n return typeof obj === 'object' && 'safeUrl' in obj && 'safeAddress' in obj && ('mnemonic' in obj || 'pk' in obj)\n}\n\n/**\n * Checks if the given object is a combined Squads item configuration.\n *\n * @param {unknown} obj - The object to check.\n * @returns {boolean} True if the object is a combined Squads item configuration, false otherwise.\n */\nexport function isCombinedSquadsItemConfig(obj: unknown): obj is CombinedSquadsItemConfig {\n if (obj === undefined || obj === null) {\n return false\n }\n\n return typeof obj === 'object' && 'multisigAddress' in obj\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/lz-config-types",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "LayerZero Core Library",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"exports": {
|
|
@@ -23,20 +23,19 @@
|
|
|
23
23
|
"clean-prebuild": "rimraf dist"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@layerzerolabs/lz-core": "^3.0.
|
|
27
|
-
"@layerzerolabs/lz-definitions": "^3.0.
|
|
28
|
-
"@safe-global/protocol-kit": "^1.3.0"
|
|
29
|
-
"tiny-invariant": "^1.3.1"
|
|
26
|
+
"@layerzerolabs/lz-core": "^3.0.17",
|
|
27
|
+
"@layerzerolabs/lz-definitions": "^3.0.17",
|
|
28
|
+
"@safe-global/protocol-kit": "^1.3.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@jest/globals": "^29.7.0",
|
|
33
|
-
"@layerzerolabs/tsup-config-next": "^3.0.
|
|
34
|
-
"@layerzerolabs/typescript-config-next": "^3.0.
|
|
32
|
+
"@layerzerolabs/tsup-config-next": "^3.0.17",
|
|
33
|
+
"@layerzerolabs/typescript-config-next": "^3.0.17",
|
|
35
34
|
"@types/jest": "^29.5.10",
|
|
36
35
|
"jest": "^29.7.0",
|
|
37
36
|
"rimraf": "^5.0.5",
|
|
38
37
|
"ts-jest": "^29.1.1",
|
|
39
|
-
"tsup": "^8.
|
|
38
|
+
"tsup": "^8.3.5",
|
|
40
39
|
"typescript": "~5.2.2"
|
|
41
40
|
},
|
|
42
41
|
"publishConfig": {
|