@midnight-ntwrk/testkit-js 3.0.0-alpha.0
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/README.md +256 -0
- package/dist/assertions.d.ts +15 -0
- package/dist/assertions.d.ts.map +1 -0
- package/dist/client/faucet-client.d.ts +30 -0
- package/dist/client/faucet-client.d.ts.map +1 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/indexer-client.d.ts +18 -0
- package/dist/client/indexer-client.d.ts.map +1 -0
- package/dist/client/node-client.d.ts +66 -0
- package/dist/client/node-client.d.ts.map +1 -0
- package/dist/client/proof-server-client.d.ts +25 -0
- package/dist/client/proof-server-client.d.ts.map +1 -0
- package/dist/configuration-types.d.ts +68 -0
- package/dist/configuration-types.d.ts.map +1 -0
- package/dist/configuration.d.ts +6 -0
- package/dist/configuration.d.ts.map +1 -0
- package/dist/contract/contract-types.d.ts +16 -0
- package/dist/contract/contract-types.d.ts.map +1 -0
- package/dist/contract/in-memory-private-state-provider.d.ts +10 -0
- package/dist/contract/in-memory-private-state-provider.d.ts.map +1 -0
- package/dist/contract/index.d.ts +4 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/providers.d.ts +24 -0
- package/dist/contract/providers.d.ts.map +1 -0
- package/dist/env-vars.d.ts +10 -0
- package/dist/env-vars.d.ts.map +1 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.cjs +2067 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +789 -0
- package/dist/index.d.mts +789 -0
- package/dist/index.d.ts +789 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1993 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/proof-server-container.d.ts +83 -0
- package/dist/proof-server-container.d.ts.map +1 -0
- package/dist/test-environment/environment-configuration.d.ts +23 -0
- package/dist/test-environment/environment-configuration.d.ts.map +1 -0
- package/dist/test-environment/environment-provider.d.ts +9 -0
- package/dist/test-environment/environment-provider.d.ts.map +1 -0
- package/dist/test-environment/index.d.ts +4 -0
- package/dist/test-environment/index.d.ts.map +1 -0
- package/dist/test-environment/test-environments/env-var-remote-test-environment.d.ts +22 -0
- package/dist/test-environment/test-environments/env-var-remote-test-environment.d.ts.map +1 -0
- package/dist/test-environment/test-environments/index.d.ts +7 -0
- package/dist/test-environment/test-environments/index.d.ts.map +1 -0
- package/dist/test-environment/test-environments/local-test-environment.d.ts +96 -0
- package/dist/test-environment/test-environments/local-test-environment.d.ts.map +1 -0
- package/dist/test-environment/test-environments/qanet-test-environment.d.ts +19 -0
- package/dist/test-environment/test-environments/qanet-test-environment.d.ts.map +1 -0
- package/dist/test-environment/test-environments/remote-test-environment.d.ts +40 -0
- package/dist/test-environment/test-environments/remote-test-environment.d.ts.map +1 -0
- package/dist/test-environment/test-environments/test-environment.d.ts +50 -0
- package/dist/test-environment/test-environments/test-environment.d.ts.map +1 -0
- package/dist/test-environment/test-environments/testnet2-test-environment.d.ts +19 -0
- package/dist/test-environment/test-environments/testnet2-test-environment.d.ts.map +1 -0
- package/dist/utils.d.ts +19 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/wallet/bigint-serialization.d.ts +7 -0
- package/dist/wallet/bigint-serialization.d.ts.map +1 -0
- package/dist/wallet/fluent-wallet-builder.d.ts +23 -0
- package/dist/wallet/fluent-wallet-builder.d.ts.map +1 -0
- package/dist/wallet/gzip-file.d.ts +29 -0
- package/dist/wallet/gzip-file.d.ts.map +1 -0
- package/dist/wallet/index.d.ts +9 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/midnight-wallet-provider.d.ts +28 -0
- package/dist/wallet/midnight-wallet-provider.d.ts.map +1 -0
- package/dist/wallet/wallet-configuration-mapper.d.ts +10 -0
- package/dist/wallet/wallet-configuration-mapper.d.ts.map +1 -0
- package/dist/wallet/wallet-factory.d.ts +21 -0
- package/dist/wallet/wallet-factory.d.ts.map +1 -0
- package/dist/wallet/wallet-seed.d.ts +13 -0
- package/dist/wallet/wallet-seed.d.ts.map +1 -0
- package/dist/wallet/wallet-state-provider.d.ts +43 -0
- package/dist/wallet/wallet-state-provider.d.ts.map +1 -0
- package/dist/wallet/wallet-utils.d.ts +11 -0
- package/dist/wallet/wallet-utils.d.ts.map +1 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# What is this?
|
|
2
|
+
A comprehensive testing solution for your Midnight.JS applications, providing seamless integration with various test environments.
|
|
3
|
+
|
|
4
|
+
This package was created for the [Midnight network](https://midnight.network).
|
|
5
|
+
|
|
6
|
+
Please visit the [Midnight Developer Hub](https://midnight.network/developer-hub) to learn more.
|
|
7
|
+
|
|
8
|
+
# Use only in Midnight test environments
|
|
9
|
+
Image exclusively for Midnight test environments use.
|
|
10
|
+
|
|
11
|
+
# Agree to Terms
|
|
12
|
+
By downloading and using this image, you agree to [Midnight’s Terms and Conditions](https://midnight.network/static/terms.pdf), which includes the [Privacy Policy](https://midnight.network/static/privacy-policy.pdf).
|
|
13
|
+
|
|
14
|
+
# License
|
|
15
|
+
The software provided herein is licensed under the [Apache License V2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
|
16
|
+
|
|
17
|
+
## Table of Contents
|
|
18
|
+
1. [Installation](#installation)
|
|
19
|
+
2. [Getting Started](#getting-started)
|
|
20
|
+
3. [Features](#Features)
|
|
21
|
+
4. [Limitations](#Limitations)
|
|
22
|
+
5. [Examples of Usage](#Examples-of-Usage)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
Before using the testing library, ensure you have the following prerequisites:
|
|
28
|
+
1. Node.js and yarn installed
|
|
29
|
+
2. Docker Desktop (optional for local dockerized tests)
|
|
30
|
+
3. Midnight.JS project set up
|
|
31
|
+
|
|
32
|
+
Install the testing library by running the following command in your terminal:
|
|
33
|
+
```
|
|
34
|
+
yarn add -D @midnight-ntwrk/testkit-js
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Getting Started
|
|
38
|
+
To use the testing library, create a new file called `midnight.test.js` in the `__tests__` directory of your project. In this file, import the necessary dependencies:
|
|
39
|
+
```typescript
|
|
40
|
+
import { getTestEnvironment } from '@midnight-ntwrk/testkit-js';
|
|
41
|
+
|
|
42
|
+
beforeAll(async () => {
|
|
43
|
+
testEnvironment = getTestEnvironment(logger);
|
|
44
|
+
environmentConfiguration = await testEnvironment.start();
|
|
45
|
+
walletProvider = await testEnvironment.getMidnightWalletProvider();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterAll(async () => {
|
|
49
|
+
await testEnvironment.shutdown();
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Features
|
|
56
|
+
|
|
57
|
+
Set of functions that simplify testing of DApps in Midnight
|
|
58
|
+
|
|
59
|
+
- [x] Standard Dockerized environment setup - both live and local
|
|
60
|
+
- [x] Predefined Midnight environments configuration
|
|
61
|
+
- [x] Proof server control
|
|
62
|
+
- [x] Wallets management
|
|
63
|
+
- [x] Fund wallets
|
|
64
|
+
- [x] Check system health
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Environment variables
|
|
69
|
+
|
|
70
|
+
### Environment selection:
|
|
71
|
+
- MN_TEST_ENVIRONMENT controls the environment to be used for testing. It can take one of these values:
|
|
72
|
+
- undeployed
|
|
73
|
+
- devnet
|
|
74
|
+
- testnet
|
|
75
|
+
- env-var-remote
|
|
76
|
+
|
|
77
|
+
If **MN_TEST_ENVIRONMENT** is not set, the default value will be `undeployed`.
|
|
78
|
+
If **MN_TEST_ENVIRONMENT** is set to `undeployed`, the testing environment will be deployed locally using Docker.
|
|
79
|
+
If **MN_TEST_ENVIRONMENT** is set to `devnet`,`testnet, env-var-remote` the testing environment will the corresponding live network, with proof server setup using predefined NETWORK_ID.
|
|
80
|
+
If **MN_TEST_ENVIRONMENT** is set to `env-var-remote`, below environment variables must be set:
|
|
81
|
+
- *MN_TEST_NETWORK_ID* - Proof server NETWORK_ID
|
|
82
|
+
- *MN_TEST_INDEXER* - Indexer URL
|
|
83
|
+
- *MN_TEST_INDEXER_WS* - Indexer WebSocket URL
|
|
84
|
+
- *MN_TEST_NODE* - Node URL
|
|
85
|
+
- *MN_TEST_FAUCET* - Faucet URL
|
|
86
|
+
|
|
87
|
+
### Wallet setup:
|
|
88
|
+
- MN_TEST_WALLET_SEED can be used to set a specific seed phrase for the wallet. If not set, a random seed phrase will be used.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Limitations
|
|
93
|
+
|
|
94
|
+
- Localnet wallets limit count is 4
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Examples of Usage
|
|
99
|
+
|
|
100
|
+
### 1. Selecting Different Environments
|
|
101
|
+
|
|
102
|
+
You can control the test environment using the `MN_TEST_ENVIRONMENT` environment variable. Here's how you can set it:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const testEnvironment = getTestEnvironment(logger);
|
|
106
|
+
environmentConfiguration = await testEnvironment.start();
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```shell
|
|
110
|
+
# Example: Set the environment variable before initializing the test environment
|
|
111
|
+
MN_TEST_ENVIRONMENT='devnet'; yarn test
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This allows you to easily switch between predefined environments like `devnet`, `testnet`, and others.
|
|
115
|
+
Default (undefined) value is `undeployed` which will deploy the testing environment locally using Docker.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### 2. Creating and Managing Wallets
|
|
120
|
+
|
|
121
|
+
Here's an example of creating wallets in your test environment:
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Example: Create multiple wallets in a test environment
|
|
125
|
+
const testEnvironment = getTestEnvironment(logger);
|
|
126
|
+
await testEnvironment.start();
|
|
127
|
+
|
|
128
|
+
// Create 2 wallets
|
|
129
|
+
const wallets = await testEnvironment.startMidnightWalletProviders(2);
|
|
130
|
+
|
|
131
|
+
// Verify wallet properties
|
|
132
|
+
expect(wallets).toHaveLength(2);
|
|
133
|
+
wallets.forEach(async (wallet) => {
|
|
134
|
+
expect(wallet.coinPublicKey).not.toBeUndefined();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Shutdown the environment after testing
|
|
138
|
+
await testEnvironment.shutdown();
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
This demonstrates how to create wallets and verify their properties, such as the `coinPublicKey`.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### 3. Setting Wallet Seeds
|
|
146
|
+
|
|
147
|
+
If you need to use specific wallet seeds for testing, you can do the following:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
// Example: Create a wallet with a predefined seed phrase
|
|
151
|
+
const wallet = await testEnvironment.getMidnightWalletProvider();
|
|
152
|
+
|
|
153
|
+
expect(wallet.coinPublicKey).not.toBeUndefined();
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```shell
|
|
157
|
+
# Example: Set the environment variable before initializing the test environment
|
|
158
|
+
MN_TEST_WALLET_SEED='00000000000000000000000000000042'; yarn test
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This allows you to test specific scenarios using known wallet seeds.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### 4. Handling Environment Configuration
|
|
166
|
+
|
|
167
|
+
You can also customize the test environment configuration by modifying the `defaultContainersConfiguration` object:
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import {
|
|
171
|
+
defaultContainersConfiguration,
|
|
172
|
+
getContainersConfiguration,
|
|
173
|
+
setContainersConfiguration
|
|
174
|
+
} from '../configuration';
|
|
175
|
+
|
|
176
|
+
// Example: Modify default environment configuration before starting
|
|
177
|
+
const config: ContainersConfiguration = {
|
|
178
|
+
...defaultContainersConfiguration,
|
|
179
|
+
proofServer: {
|
|
180
|
+
...defaultContainersConfiguration.proofServer,
|
|
181
|
+
fileName: 'proof-server.yml'
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
setContainersConfiguration(config);
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
This gives developers flexibility in configuring the test environment according to their needs.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### 5. Error Handling
|
|
192
|
+
|
|
193
|
+
Here's an example of handling errors when setting up wallets:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Example: Test for maximum wallet limit exceeded
|
|
197
|
+
process.env.MN_TEST_ENVIRONMENT = undefined; // Use local environment
|
|
198
|
+
const testEnvironment = getTestEnvironment(logger);
|
|
199
|
+
await testEnvironment.start();
|
|
200
|
+
|
|
201
|
+
try {
|
|
202
|
+
await testEnvironment.startMidnightWalletProviders(5); // Assuming max is 4
|
|
203
|
+
} catch (error) {
|
|
204
|
+
expect(error.message).toContain('Maximum supported number of wallets for this environment reached');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
await testEnvironment.shutdown();
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
This demonstrates how to handle cases where the wallet limit is exceeded.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### 6. Advanced Usage with Proof Server
|
|
215
|
+
|
|
216
|
+
Here's an example of integrating with the proof server:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
// Example: Start a proof server with networkd ID = testnet and ID = 123
|
|
220
|
+
const proofServer = await DynamicProofServerContainer.start(logger, '123', 'testnet');
|
|
221
|
+
|
|
222
|
+
//stop the proof server
|
|
223
|
+
await proofServer.stop();
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
This shows how to integrate with and customize the proof server for testing.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### 7. Customized test environments
|
|
231
|
+
|
|
232
|
+
Library is provided with set of predefined environment configurations i.e.:
|
|
233
|
+
|
|
234
|
+
- LocalTestEnvironment
|
|
235
|
+
- Testnet2TestEnvironment
|
|
236
|
+
|
|
237
|
+
By using `getTestEnvironment(logger);` based on environment variable MN_TEST_ENVIRONMENT test environment configuration is provided.
|
|
238
|
+
However, you can either create your own class defining the environment endpoints or use below enviroment variables.
|
|
239
|
+
|
|
240
|
+
Here's an example of fully customized endpoints of the test environment, that you can provide using environment variables:
|
|
241
|
+
|
|
242
|
+
```shell
|
|
243
|
+
MN_TEST_ENVIRONMENT="env-var-remote" \
|
|
244
|
+
MN_TEST_NETWORK_ID="undeployed" \
|
|
245
|
+
MN_TEST_INDEXER="http://localhost:3085/api/" \
|
|
246
|
+
MN_TEST_INDEXER_WS="ws://localhost:3085/ws/" \
|
|
247
|
+
MN_TEST_NODE="http://localhost:3086" \
|
|
248
|
+
yarn test
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### 8. System health check before tests
|
|
255
|
+
|
|
256
|
+
For the remote test environemnts (testnet-02, ...) simple health check is performed for each of the components to check their state before test.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Contract } from '@midnight-ntwrk/compact-js';
|
|
2
|
+
import type { StateValue } from '@midnight-ntwrk/compact-runtime';
|
|
3
|
+
import type { Bindingish, Proofish, Signaturish, Transaction } from '@midnight-ntwrk/ledger-v7';
|
|
4
|
+
import type { CallTxOptions, DeployContractOptions, DeployTxOptions, FinalizedCallTxData, FinalizedDeployTxData, FinalizedDeployTxDataBase } from '@midnight-ntwrk/midnight-js-contracts';
|
|
5
|
+
import { type FinalizedTxData, type MidnightProviders, type PrivateStateId } from '@midnight-ntwrk/midnight-js-types';
|
|
6
|
+
export declare const stateValueEqual: (a: StateValue, b: StateValue) => boolean;
|
|
7
|
+
export declare const txsEqual: <S extends Signaturish, P extends Proofish, B extends Bindingish>(a: Transaction<S, P, B>, b: Transaction<S, P, B>) => boolean;
|
|
8
|
+
export declare const expectFoundAndDeployedTxPublicDataEqual: <C extends Contract.Any>(deployTxData: FinalizedDeployTxData<C>, foundDeployTxData: FinalizedDeployTxDataBase<C>) => void;
|
|
9
|
+
export declare const expectFoundAndDeployedTxPrivateDataEqual: <C extends Contract.Any>(deployTxData: FinalizedDeployTxData<C>, foundDeployTxData: FinalizedDeployTxDataBase<C>) => void;
|
|
10
|
+
export declare const expectFoundAndDeployedTxDataEqual: <C extends Contract.Any>(deployTxData: FinalizedDeployTxData<C>, foundDeployTxData: FinalizedDeployTxDataBase<C>) => void;
|
|
11
|
+
export declare const expectFoundAndDeployedStatesEqual: <C extends Contract.Any>(providers: MidnightProviders<Contract.ImpureCircuitId<C>, PrivateStateId, Contract.PrivateState<C> | unknown>, deployTxData: FinalizedDeployTxData<C>, foundDeployTxData: FinalizedDeployTxDataBase<C>, privateStateId?: PrivateStateId, initialPrivateState?: Contract.PrivateState<C>) => Promise<void>;
|
|
12
|
+
export declare const expectSuccessfulTxData: (finalizedTxData: FinalizedTxData) => void;
|
|
13
|
+
export declare const expectSuccessfulDeployTx: <C extends Contract.Any>(providers: MidnightProviders<Contract.ImpureCircuitId<C>, PrivateStateId, Contract.PrivateState<C> | unknown>, deployTxData: FinalizedDeployTxData<C>, deployTxOptions?: DeployContractOptions<C> | DeployTxOptions<C>) => Promise<void>;
|
|
14
|
+
export declare const expectSuccessfulCallTx: <C extends Contract.Any, ICK extends Contract.ImpureCircuitId<C>>(providers: MidnightProviders<Contract.ImpureCircuitId<C>, PrivateStateId, Contract.PrivateState<C> | unknown>, callTxData: FinalizedCallTxData<C, ICK>, callTxOptions?: CallTxOptions<C, ICK>, nextPrivateState?: Contract.PrivateState<C>) => Promise<void>;
|
|
15
|
+
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Logger } from 'pino';
|
|
2
|
+
/**
|
|
3
|
+
* Client for interacting with the Midnight faucet service.
|
|
4
|
+
* Provides functionality to request test tokens for wallet addresses.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FaucetClient {
|
|
7
|
+
readonly faucetUrl: string;
|
|
8
|
+
private logger;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new FaucetClient instance.
|
|
11
|
+
* @param {string} faucetUrl - The URL of the faucet service endpoint
|
|
12
|
+
* @param {Logger} logger - Logger instance for recording operations
|
|
13
|
+
*/
|
|
14
|
+
constructor(faucetUrl: string, logger: Logger);
|
|
15
|
+
/**
|
|
16
|
+
* Checks the health status of the faucet service.
|
|
17
|
+
* Makes a GET request to the health endpoint of the faucet service.
|
|
18
|
+
* @returns {Promise<AxiosResponse | void>} A promise that resolves to the response of the health check or logs an error if the request fails
|
|
19
|
+
*/
|
|
20
|
+
health(): Promise<void | import("axios").AxiosResponse<any, any, {}>>;
|
|
21
|
+
/**
|
|
22
|
+
* Requests test tokens from the faucet for a specified wallet address.
|
|
23
|
+
* Makes a POST request to the faucet service with the wallet address.
|
|
24
|
+
* @param {string} walletAddress - The address to receive the test tokens
|
|
25
|
+
* @returns {Promise<void>} A promise that resolves when the request is complete
|
|
26
|
+
* @throws Will log but not throw if the request fails
|
|
27
|
+
*/
|
|
28
|
+
requestTokens(walletAddress: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=faucet-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faucet-client.d.ts","sourceRoot":"","sources":["../../src/client/faucet-client.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC;;;GAGG;AACH,qBAAa,YAAY;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;OAIG;gBACS,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK7C;;;;OAIG;IACG,MAAM;IAaZ;;;;;;OAMG;IACG,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAyB1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAeA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Logger } from 'pino';
|
|
2
|
+
export declare class IndexerClient {
|
|
3
|
+
readonly indexerUrl: string;
|
|
4
|
+
private logger;
|
|
5
|
+
/**
|
|
6
|
+
* Creates an instance of IndexerClient.
|
|
7
|
+
* @param {string} indexerUrl - The URL of the indexer service.
|
|
8
|
+
* @param {Logger} logger - The logger instance for logging information.
|
|
9
|
+
*/
|
|
10
|
+
constructor(indexerUrl: string, logger: Logger);
|
|
11
|
+
/**
|
|
12
|
+
* Checks the health status of the indexer service.
|
|
13
|
+
* Makes a GET request to the status endpoint of the indexer service.
|
|
14
|
+
* @returns {Promise<AxiosResponse | void>} A promise that resolves to the response of the health check or logs an error if the request fails.
|
|
15
|
+
*/
|
|
16
|
+
health(): Promise<void | import("axios").AxiosResponse<any, any, {}>>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=indexer-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer-client.d.ts","sourceRoot":"","sources":["../../src/client/indexer-client.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,qBAAa,aAAa;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;OAIG;gBACS,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK9C;;;;OAIG;IACG,MAAM;CAYb"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ContractAddress } from '@midnight-ntwrk/compact-runtime';
|
|
2
|
+
import { ContractState, LedgerState } from '@midnight-ntwrk/ledger-v7';
|
|
3
|
+
import type { BlockHash } from '@midnight-ntwrk/midnight-js-types';
|
|
4
|
+
import { type AxiosResponse } from 'axios';
|
|
5
|
+
import type { Logger } from 'pino';
|
|
6
|
+
/**
|
|
7
|
+
* Client for interacting with a Midnight node's JSON-RPC API
|
|
8
|
+
*/
|
|
9
|
+
export declare class NodeClient {
|
|
10
|
+
readonly nodeURL: string;
|
|
11
|
+
private logger;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new NodeClient instance
|
|
14
|
+
* @param {string} nodeURL - URL of the Midnight node
|
|
15
|
+
* @param {Logger} logger - Logger instance for recording operations
|
|
16
|
+
*/
|
|
17
|
+
constructor(nodeURL: string, logger: Logger);
|
|
18
|
+
/**
|
|
19
|
+
* Checks the health status of the node.
|
|
20
|
+
* Makes a GET request to the health endpoint of the node.
|
|
21
|
+
* @returns {Promise<AxiosResponse | void>} A promise that resolves to the response of the health check or logs an error if the request fails.
|
|
22
|
+
*/
|
|
23
|
+
health(): Promise<void | AxiosResponse<any, any, {}>>;
|
|
24
|
+
/**
|
|
25
|
+
* Validates response format and throws if unexpected
|
|
26
|
+
* @param {AxiosResponse} response - Response from node API
|
|
27
|
+
* @throws {Error} If response format is unexpected
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
private static throwOnUnexpected;
|
|
31
|
+
/**
|
|
32
|
+
* Makes a JSON-RPC request to the node
|
|
33
|
+
* @param {string} method - RPC method name
|
|
34
|
+
* @param {any[]} params - RPC method parameters
|
|
35
|
+
* @returns {Promise<string>} Response result as string
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private jsonRPC;
|
|
39
|
+
/**
|
|
40
|
+
* Fetches the state of a contract
|
|
41
|
+
* @param {ContractAddress} contractAddress - Address of the contract
|
|
42
|
+
* @returns {Promise<ContractState | null>} Contract state or null if not found
|
|
43
|
+
*/
|
|
44
|
+
contractState(contractAddress: ContractAddress): Promise<ContractState | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetches the ledger state at a given block
|
|
47
|
+
* @param {BlockHash} blockHash - Hash of the block
|
|
48
|
+
* @returns {Promise<LedgerState>} Ledger state
|
|
49
|
+
*/
|
|
50
|
+
ledgerState(blockHash: BlockHash): Promise<LedgerState>;
|
|
51
|
+
/**
|
|
52
|
+
* Fetches the raw ledger state blob at a given block
|
|
53
|
+
* @param {BlockHash} blockHash - Hash of the block
|
|
54
|
+
* @returns {Promise<Uint8Array>} Raw ledger state data
|
|
55
|
+
* @throws {Error} If no ledger state is found
|
|
56
|
+
*/
|
|
57
|
+
ledgerStateBlob(blockHash: BlockHash): Promise<Uint8Array>;
|
|
58
|
+
/**
|
|
59
|
+
* Fetches the ledger version at a given block
|
|
60
|
+
* @param {BlockHash} blockHash - Hash of the block
|
|
61
|
+
* @returns {Promise<string>} Ledger version
|
|
62
|
+
* @throws {Error} If no ledger version is found
|
|
63
|
+
*/
|
|
64
|
+
ledgerVersion(blockHash: BlockHash): Promise<string>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=node-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/client/node-client.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC;;GAEG;AACH,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK3C;;;;OAIG;IACG,MAAM;IAaZ;;;;;OAKG;IAEH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAMhC;;;;;;OAMG;YAEW,OAAO;IAoBrB;;;;OAIG;IACG,aAAa,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAQpF;;;;OAIG;IACG,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAK7D;;;;;OAKG;IACG,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAShE;;;;;OAKG;IACG,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;CAQ3D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { Logger } from 'pino';
|
|
3
|
+
export declare class ProofServerClient {
|
|
4
|
+
readonly proofServer: string;
|
|
5
|
+
private logger;
|
|
6
|
+
/**
|
|
7
|
+
* Creates an instance of ProofServerClient.
|
|
8
|
+
* @param {string} proofServer - The URL of the proof server service.
|
|
9
|
+
* @param {Logger} logger - The logger instance for logging information.
|
|
10
|
+
*/
|
|
11
|
+
constructor(proofServer: string, logger: Logger);
|
|
12
|
+
/**
|
|
13
|
+
* Checks the health status of the indexer service.
|
|
14
|
+
* Makes a GET request to the status endpoint of the indexer service.
|
|
15
|
+
* @returns {Promise<AxiosResponse | void>} A promise that resolves to the response of the health check or logs an error if the request fails.
|
|
16
|
+
*/
|
|
17
|
+
health(): Promise<void | import("axios").AxiosResponse<any, any, {}>>;
|
|
18
|
+
/**
|
|
19
|
+
* Proves a transaction by sending a POST request to the proof server.
|
|
20
|
+
* @param data serialized transaction data
|
|
21
|
+
* @param config Axios request configuration
|
|
22
|
+
*/
|
|
23
|
+
proveTx(data?: ArrayBuffer, config?: AxiosRequestConfig): Promise<void | import("axios").AxiosResponse<any, any, {}>>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=proof-server-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-server-client.d.ts","sourceRoot":"","sources":["../../src/client/proof-server-client.ts"],"names":[],"mappings":"AAeA,OAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;OAIG;gBACS,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK/C;;;;OAIG;IACG,MAAM;IAaZ;;;;OAIG;IACG,OAAO,CACX,IAAI,CAAC,EAAE,WAAW,EAClB,MAAM,GAAE,kBAEP;CAaJ"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type WaitStrategy } from 'testcontainers';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a proof server container instance
|
|
4
|
+
*/
|
|
5
|
+
export interface ProofServerContainerConfiguration {
|
|
6
|
+
/** Directory path where container configuration is located */
|
|
7
|
+
path: string;
|
|
8
|
+
/** Name of the container configuration file */
|
|
9
|
+
fileName: string;
|
|
10
|
+
/** Network endpoint configuration for the container */
|
|
11
|
+
container: ContainerEndpoints;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Network endpoint configuration for a container
|
|
15
|
+
*/
|
|
16
|
+
export interface ContainerEndpoints {
|
|
17
|
+
/** Name of the container */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Port number the container listens on */
|
|
20
|
+
port: number;
|
|
21
|
+
/** TestContainers WaitStrategy to use for container start */
|
|
22
|
+
waitStrategy: WaitStrategy;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Container endpoint configurations for standalone mode services
|
|
26
|
+
*/
|
|
27
|
+
export interface StandaloneContainerNames {
|
|
28
|
+
/** Proof server container configuration */
|
|
29
|
+
proofServer: ContainerEndpoints;
|
|
30
|
+
/** Blockchain node container configuration */
|
|
31
|
+
node: ContainerEndpoints;
|
|
32
|
+
/** Indexer service container configuration */
|
|
33
|
+
indexer: ContainerEndpoints;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for standalone mode containers
|
|
37
|
+
*/
|
|
38
|
+
export interface StandaloneContainersConfiguration {
|
|
39
|
+
/** Directory path where container configuration is located */
|
|
40
|
+
path: string;
|
|
41
|
+
/** Name of the container configuration file */
|
|
42
|
+
fileName: string;
|
|
43
|
+
/** Container endpoint configurations */
|
|
44
|
+
container: StandaloneContainerNames;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for test logging
|
|
48
|
+
*/
|
|
49
|
+
export interface LogConfiguration {
|
|
50
|
+
/** Directory path where log files will be written */
|
|
51
|
+
path: string;
|
|
52
|
+
/** Name of the log file */
|
|
53
|
+
fileName: string;
|
|
54
|
+
/** Log level (e.g. 'info', 'debug', etc) */
|
|
55
|
+
level: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Top-level configuration for all test containers
|
|
59
|
+
*/
|
|
60
|
+
export interface ContainersConfiguration {
|
|
61
|
+
/** Proof server container configuration */
|
|
62
|
+
proofServer: ProofServerContainerConfiguration;
|
|
63
|
+
/** Standalone mode containers configuration */
|
|
64
|
+
standalone: StandaloneContainersConfiguration;
|
|
65
|
+
/** Logging configuration */
|
|
66
|
+
log: LogConfiguration;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=configuration-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-types.d.ts","sourceRoot":"","sources":["../src/configuration-types.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,WAAW,EAAE,kBAAkB,CAAC;IAChC,8CAA8C;IAC9C,IAAI,EAAE,kBAAkB,CAAC;IACzB,8CAA8C;IAC9C,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,SAAS,EAAE,wBAAwB,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,2CAA2C;IAC3C,WAAW,EAAE,iCAAiC,CAAC;IAC/C,+CAA+C;IAC/C,UAAU,EAAE,iCAAiC,CAAC;IAC9C,4BAA4B;IAC5B,GAAG,EAAE,gBAAgB,CAAC;CACvB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContainersConfiguration } from './configuration-types';
|
|
2
|
+
export declare const defaultContainersConfiguration: ContainersConfiguration;
|
|
3
|
+
export declare const latestContainersConfiguration: ContainersConfiguration;
|
|
4
|
+
export declare const getContainersConfiguration: () => ContainersConfiguration;
|
|
5
|
+
export declare const setContainersConfiguration: (containersConfig: ContainersConfiguration) => void;
|
|
6
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAIrE,eAAO,MAAM,8BAA8B,EAAE,uBAoC5C,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,uBAU3C,CAAC;AAIF,eAAO,MAAM,0BAA0B,+BAEtC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,kBAAkB,uBAAuB,SAEnF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration interface for Midnight contracts.
|
|
3
|
+
*/
|
|
4
|
+
export interface ContractConfiguration {
|
|
5
|
+
/**
|
|
6
|
+
* Name of the store used for persisting private state data.
|
|
7
|
+
* This is used as a base name - a signing key store will also be created with "-signing-keys" appended.
|
|
8
|
+
*/
|
|
9
|
+
readonly privateStateStoreName: string;
|
|
10
|
+
/**
|
|
11
|
+
* File system path to the zero-knowledge proof configuration files.
|
|
12
|
+
* This should point to the directory containing the circuit verification keys and other ZK artifacts.
|
|
13
|
+
*/
|
|
14
|
+
readonly zkConfigPath: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=contract-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-types.d.ts","sourceRoot":"","sources":["../../src/contract/contract-types.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAEvC;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Contract } from '@midnight-ntwrk/compact-js';
|
|
2
|
+
import { type PrivateStateId, type PrivateStateProvider } from '@midnight-ntwrk/midnight-js-types';
|
|
3
|
+
/**
|
|
4
|
+
* A simple in-memory implementation of private state provider. Makes it easy to capture and rewrite private state from deploy.
|
|
5
|
+
* @template PSI - Type of the private state identifier.
|
|
6
|
+
* @template PS - Type of the private state.
|
|
7
|
+
* @returns {PrivateStateProvider<PSI, PS>} An in-memory private state provider.
|
|
8
|
+
*/
|
|
9
|
+
export declare const inMemoryPrivateStateProvider: <PSI extends PrivateStateId, PS extends Contract.PrivateState<Contract.Any>>() => PrivateStateProvider<PSI, PS>;
|
|
10
|
+
//# sourceMappingURL=in-memory-private-state-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory-private-state-provider.d.ts","sourceRoot":"","sources":["../../src/contract/in-memory-private-state-provider.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GACvC,GAAG,SAAS,cAAc,EAC1B,EAAE,SAAS,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,OAC3C,oBAAoB,CAAC,GAAG,EAAE,EAAE,CAgFhC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAeA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type MidnightProviders, type PrivateStateId } from '@midnight-ntwrk/midnight-js-types';
|
|
2
|
+
import { type EnvironmentConfiguration } from '@/test-environment';
|
|
3
|
+
import { type MidnightWalletProvider } from '@/wallet';
|
|
4
|
+
import { type ContractConfiguration } from './contract-types';
|
|
5
|
+
/**
|
|
6
|
+
* Configures and returns the required providers for a Midnight contract.
|
|
7
|
+
*
|
|
8
|
+
* @template ICK - Type parameter for the input circuit key string
|
|
9
|
+
* @template PS - Type parameter for the private state
|
|
10
|
+
*
|
|
11
|
+
* @param {MidnightWalletProvider} midnightWalletProvider - The midnightWalletProvider provider instance to use for transactions
|
|
12
|
+
* @param {EnvironmentConfiguration} environmentConfiguration - Configuration for the environment including indexer and proof server details
|
|
13
|
+
* @param {ContractConfiguration} contractConfiguration - Configuration specific to the contract including storage names and ZK config path
|
|
14
|
+
*
|
|
15
|
+
* @returns {MidnightProviders} An object containing all configured providers:
|
|
16
|
+
* - privateStateProvider: For managing private contract state
|
|
17
|
+
* - publicDataProvider: For accessing public blockchain data
|
|
18
|
+
* - zkConfigProvider: For zero-knowledge proof configurations
|
|
19
|
+
* - proofProvider: For generating and verifying proofs
|
|
20
|
+
* - walletProvider: For midnightWalletProvider operations
|
|
21
|
+
* - midnightProvider: For Midnight-specific operations
|
|
22
|
+
*/
|
|
23
|
+
export declare const initializeMidnightProviders: <ICK extends string, PS>(midnightWalletProvider: MidnightWalletProvider, environmentConfiguration: EnvironmentConfiguration, contractConfiguration: ContractConfiguration) => MidnightProviders<ICK, PrivateStateId, PS>;
|
|
24
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/contract/providers.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEhG,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,GAAI,GAAG,SAAS,MAAM,EAAE,EAAE,EAChE,wBAAwB,sBAAsB,EAC9C,0BAA0B,wBAAwB,EAClD,uBAAuB,qBAAqB,KAC3C,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,CAe3C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const getEnvVarEnvironment: () => string;
|
|
2
|
+
export declare const getEnvVarWalletSeeds: () => string[] | undefined;
|
|
3
|
+
export declare const MN_TEST_INDEXER: string | undefined;
|
|
4
|
+
export declare const MN_TEST_INDEXER_WS: string | undefined;
|
|
5
|
+
export declare const MN_TEST_NODE: string | undefined;
|
|
6
|
+
export declare const MN_TEST_NODE_WS: string | undefined;
|
|
7
|
+
export declare const MN_TEST_FAUCET: string | undefined;
|
|
8
|
+
export declare const MN_TEST_NETWORK_ID: string | undefined;
|
|
9
|
+
export declare const MN_TEST_WALLET_NETWORK_ID: string | undefined;
|
|
10
|
+
//# sourceMappingURL=env-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-vars.d.ts","sourceRoot":"","sources":["../src/env-vars.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,oBAAoB,cAKhC,CAAC;AACF,eAAO,MAAM,oBAAoB,4BAGhC,CAAC;AACF,eAAO,MAAM,eAAe,oBAA8B,CAAC;AAC3D,eAAO,MAAM,kBAAkB,oBAAiC,CAAC;AACjE,eAAO,MAAM,YAAY,oBAA2B,CAAC;AACrD,eAAO,MAAM,eAAe,oBAA8B,CAAC;AAC3D,eAAO,MAAM,cAAc,oBAA6B,CAAC;AACzD,eAAO,MAAM,kBAAkB,oBAAiC,CAAC;AACjE,eAAO,MAAM,yBAAyB,oBAAwC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error representing a required, but missing, environment variable.
|
|
3
|
+
*/
|
|
4
|
+
export declare class MissingEnvironmentVariable extends Error {
|
|
5
|
+
readonly environmentVariable: string;
|
|
6
|
+
/**
|
|
7
|
+
* @param environmentVariable The name of the missing environment variable.
|
|
8
|
+
*/
|
|
9
|
+
constructor(environmentVariable: string);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAIvB,mBAAmB,EAAE,MAAM;IAHvD;;OAEG;gBACyB,mBAAmB,EAAE,MAAM;CAGxD"}
|