@sig-net/midnight-contract-deploy 0.25.1 → 0.26.0-rc.2

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  # @sig-net/midnight-contract-deploy
2
2
 
3
- Deploy tooling for the central [Sig Network](https://sig.network) signet contract on the [Midnight blockchain](https://midnight.network), self-contained for npm:
3
+ Deploy tooling for the [Sig Network](https://sig.network) protocol contracts on the [Midnight blockchain](https://midnight.network), the central signet contract and the signet responder, self-contained for npm:
4
4
 
5
- - **The operator deploy flow** (`deploySignetContract`): builds, balances, proves and submits the signet contract's deploy transaction through a synced wallet, using the compiled assets shipped in [`@sig-net/midnight-contract`](https://www.npmjs.com/package/@sig-net/midnight-contract).
6
- - **The Node binding** of `@sig-net/midnight-contract` to its compiled assets (zk config, private state).
5
+ - **The operator deploy flows** (`deploySignetContract`, `deploySignetResponder`): build, balance, prove and submit the contract's deploy transaction through a synced wallet, using the compiled assets shipped in [`@sig-net/midnight-contract`](https://www.npmjs.com/package/@sig-net/midnight-contract) or [`@sig-net/midnight-responder`](https://www.npmjs.com/package/@sig-net/midnight-responder).
6
+ - **The Node bindings** of `@sig-net/midnight-contract` and `@sig-net/midnight-responder` to their compiled assets (zk config, private state).
7
7
  - **Generic deploy/wallet plumbing** any Compact contract's deploy script composes: network config, seed parsing and key derivation, the wallet facade lifecycle, funding primitives (a root wallet funds role wallets and registers NIGHT for dust generation), and unproven-transaction build/submit.
8
8
 
9
9
  ## Install
@@ -25,35 +25,38 @@ Everything is read from the environment:
25
25
  | `MPC_SECP256K1_PUBKEY` | Optional on a deployed network: the MPC root public key a requester's derived accounts start from, in SEC1 hex or NEAR `secp256k1:<base58>` form. `resolveMpcRootPublicKey` takes the key `@sig-net/midnight` publishes for the network when it is unset, refuses a set value that disagrees with it, and returns `0x04…` uncompressed hex either way. |
26
26
  | `MIDNIGHT_FAUCET_URL` | The faucet named in the unfunded-wallet hint. Built in per network: stagenet `https://faucet.stagenet.shielded.tools`, preview `https://midnight-tmnight-preview.nethermind.dev`, preprod `https://midnight-tmnight-preprod.nethermind.dev`. Set it to override one of those, or to name a faucet for a network without one. |
27
27
 
28
- In a checkout of the [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration) repository, `yarn deploy:signet-contract` also loads the repository root's `.env` file whenever one exists. A variable already set in the shell takes precedence over the same key in the file.
28
+ In a checkout of the [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration) repository, `yarn deploy:signet-contract` and `yarn deploy:signet-responder` also load the repository root's `.env` file whenever one exists. A variable already set in the shell takes precedence over the same key in the file.
29
29
 
30
30
  ## Usage
31
31
 
32
32
  ```ts
33
- import { deploySignetContract } from "@sig-net/midnight-contract-deploy";
33
+ import { deploySignetContract, deploySignetResponder } from "@sig-net/midnight-contract-deploy";
34
34
 
35
- const { contractAddress, txId } = await deploySignetContract(process.env);
35
+ const singleton = await deploySignetContract(process.env);
36
+ const responder = await deploySignetResponder(process.env);
36
37
  ```
37
38
 
39
+ Each returns the deployed `contractAddress` and the deploy transaction's `txId`.
40
+
38
41
  The generic plumbing (network config, wallets, funding, transaction submission) is exported from the package root as well, for deploy scripts of other Compact contracts.
39
42
 
40
- A pipeline that touches several wallets, or one wallet several times, holds them in a `WalletRegistry`: the first request for a seed builds, starts and fully syncs its facade (on a deployed network a fresh facade scans the chain from nothing, and the sync logs a heartbeat with each sub-wallet's position every ten seconds), every later request returns the same running facade, and `close()` stops them all once. `deploySignetContract(env, wallets)` and the funding primitives (`assertRootFunded`, `readAccountFunding`, `fundChildFromRoot`) take the registry. Without one, `deploySignetContract` opens a private registry for its single wallet and closes it after.
43
+ A pipeline that touches several wallets, or one wallet several times, holds them in a `WalletRegistry`: the first request for a seed builds, starts and fully syncs its facade (on a deployed network a fresh facade scans the chain from nothing, and the sync logs a heartbeat with each sub-wallet's position every ten seconds), every later request returns the same running facade, and `close()` stops them all once. `deploySignetContract(env, wallets)`, `deploySignetResponder(env, wallets)` and the funding primitives (`assertRootFunded`, `readAccountFunding`, `fundChildFromRoot`) take the registry. Without one, each deploy flow opens a private registry for its single wallet and closes it after.
41
44
 
42
45
  ## Deploying from CI
43
46
 
44
- The [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration) repository deploys the singleton through its manually dispatched `deploy` workflow, which picks a network and a release tag and runs this flow on a runner with a local proof server.
47
+ The [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration) repository deploys the singleton and the responder through its manually dispatched `deploy` workflow, which picks a contract, a network and a release tag and runs that contract's flow on a runner with a local proof server.
45
48
 
46
49
  - **The wallet needs faucet-funded NIGHT and nothing else.** The flow registers that NIGHT for dust generation and waits for the first spendable DUST, so a freshly funded seed works on the first run. A run whose wallet holds no NIGHT yet fails printing the wallet's NIGHT receive address (`mn_addr…`) and the network's faucet URL, ready to paste into the faucet.
47
- - **The deployed address is recorded by a bot PR.** The workflow writes it into the `signetContractAddresses` table of [`@sig-net/midnight`](https://www.npmjs.com/package/@sig-net/midnight) and opens a pull request, so a human reviews the address before it ships to npm consumers.
50
+ - **The deployed address is recorded by a bot PR.** The workflow writes it into the contract's address table (`signetContractAddresses` or `responderContractAddresses`) of [`@sig-net/midnight`](https://www.npmjs.com/package/@sig-net/midnight) and opens a pull request into the branch the workflow was dispatched from, so a human reviews the address before it ships to npm consumers.
48
51
  - **A deploy sets NO contract maintenance authority.** The maintenance signing key is sampled and dropped, so a deployed contract can never be updated: every run creates a fresh, permanent contract instance, and moving forward means a new deployment while the existing contracts stay exactly as they are.
49
52
 
50
53
  ## Documentation
51
54
 
52
- The deployed contract is the singleton of the [sign bidirectional flow](https://github.com/sig-net/midnight-integration/blob/main/README.md#sign-bidirectional-protocol-flow), documented in the [sig-net/midnight-integration README](https://github.com/sig-net/midnight-integration/blob/main/README.md).
55
+ The deployed contracts are the singleton and the responder of the [sign bidirectional flow](https://github.com/sig-net/midnight-integration/blob/main/README.md#sign-bidirectional-protocol-flow), documented in the [sig-net/midnight-integration README](https://github.com/sig-net/midnight-integration/blob/main/README.md).
53
56
 
54
57
  ## Related packages
55
58
 
56
- - [`@sig-net/midnight-contract`](https://www.npmjs.com/package/@sig-net/midnight-contract): the contract this package deploys.
59
+ - [`@sig-net/midnight-contract`](https://www.npmjs.com/package/@sig-net/midnight-contract) and [`@sig-net/midnight-responder`](https://www.npmjs.com/package/@sig-net/midnight-responder): the contracts this package deploys.
57
60
  - [`@sig-net/midnight`](https://www.npmjs.com/package/@sig-net/midnight): the client-agnostic protocol library.
58
61
 
59
62
  Developed in [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration). Example applications live in [sig-net/midnight-examples](https://github.com/sig-net/midnight-examples).
@@ -0,0 +1,67 @@
1
+ import { type DeployTransaction } from "./plumbing/deploy.ts";
2
+ import { type MidnightNodeConfig } from "./plumbing/midnight-node-config.ts";
3
+ import type { NetworkId } from "./plumbing/network-id.ts";
4
+ import { type TransactionIdentifier, WalletRegistry } from "./plumbing/wallet.ts";
5
+ /** The outcome of a successful contract deployment. */
6
+ export interface ContractDeployment {
7
+ /** Address of the deployed contract on Midnight. */
8
+ contractAddress: string;
9
+ /** Identifier of the submitted deploy transaction. */
10
+ txId: TransactionIdentifier;
11
+ }
12
+ /** Where a deploy setting's effective value came from. */
13
+ export declare enum DeploySettingSource {
14
+ /** The environment variable is set. */
15
+ Environment = "environment",
16
+ /** The variable is unset or blank, so the built-in value applies. */
17
+ Default = "default"
18
+ }
19
+ /** One row of {@link deployEnvironmentTable}. */
20
+ export interface DeploySettingRow {
21
+ /** The value the deploy runs with. */
22
+ value: string;
23
+ /** Whether the environment or the built-in default supplied {@link value}. */
24
+ source: DeploySettingSource;
25
+ }
26
+ /**
27
+ * Tabulate every environment variable {@link deployProtocolContract} runs
28
+ * with, except the secret `DEPLOYER_SEED`, each with its effective value.
29
+ *
30
+ * @param env - The environment the deploy reads.
31
+ * @param midnightNodeConfig - The node config resolved from `env`.
32
+ * @returns One row per variable, keyed by variable name.
33
+ */
34
+ export declare function deployEnvironmentTable(env: Record<string, string | undefined>, midnightNodeConfig: MidnightNodeConfig): Record<string, DeploySettingRow>;
35
+ /**
36
+ * Build one contract's unproven deploy transaction, typically a
37
+ * `buildDeployTransaction` call over the contract's compiled assets.
38
+ *
39
+ * @param networkId - The network the transaction targets.
40
+ * @param coinPublicKeyHex - The deploying wallet's Zswap coin public key (hex).
41
+ * @returns The contract address and the serialized unproven transaction.
42
+ */
43
+ export type DeployTransactionBuilder = (networkId: NetworkId, coinPublicKeyHex: string) => Promise<DeployTransaction>;
44
+ /**
45
+ * Deploy a protocol contract: read config from `env`, build and prove the deploy
46
+ * transaction and submit it through a synced wallet. Progress is logged to
47
+ * the console, ending with `deployed <name> at <address>`, the line the
48
+ * deploy workflow reads the address from. Any funded wallet can deploy, and
49
+ * nothing about the deployer is sealed. The wallet needs NIGHT only:
50
+ * {@link ensureFeeReady} registers it for dust generation and waits for the
51
+ * deploy transaction's fee in spendable DUST when the wallet holds less.
52
+ *
53
+ * @param name - The contract's package directory name, for the log.
54
+ * @param buildTransaction - Builds the contract's deploy transaction.
55
+ * @param env - Environment map providing `DEPLOYER_SEED` and the shared
56
+ * Midnight node configuration (see `getMidnightNodeConfig`).
57
+ * @param wallets - A registry to take the deployer wallet from, when the caller
58
+ * keeps wallets open across steps. Without one, a private registry is opened
59
+ * for this deploy and closed after it.
60
+ * @returns The deployed contract address and deploy transaction id.
61
+ * @throws {WalletUnfundedError} If the deployer wallet holds no NIGHT and
62
+ * less DUST than the deploy fee: the error carries the wallet's NIGHT receive address to fund.
63
+ * @throws {Error} If the deploy's fee does not generate in spendable DUST after
64
+ * registering the wallet's NIGHT, or submission fails.
65
+ */
66
+ export declare function deployProtocolContract(name: string, buildTransaction: DeployTransactionBuilder, env: Record<string, string | undefined>, wallets?: WalletRegistry): Promise<ContractDeployment>;
67
+ //# sourceMappingURL=deploy-protocol-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-protocol-contract.d.ts","sourceR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OAAO,CAAC,kBAAkB,CAAC,CAsC7B"}
@@ -0,0 +1,94 @@
1
+ // The operator deploy flow of the protocol contracts, the signet singleton
2
+ // and the signet responder: builds, balances, proves and submits a
3
+ // contract's deploy transaction using the generic plumbing in ./plumbing.
4
+ // What differs per contract, its compiled assets and private state, arrives
5
+ // as the transaction builder.
6
+ import { getDeployConfig } from "./plumbing/deploy.js";
7
+ import { envOrUndefined } from "./plumbing/env.js";
8
+ import { ensureFeeReady } from "./plumbing/funding.js";
9
+ import { FAUCET_URL_ENV_VAR, getFaucetUrl, MIDNIGHT_NODE_CONFIG_ENV_VARS, } from "./plumbing/midnight-node-config.js";
10
+ import { estimateUnprovenTransactionFee, submitUnprovenTransaction, WalletRegistry, } from "./plumbing/wallet.js";
11
+ /** Where a deploy setting's effective value came from. */
12
+ export var DeploySettingSource;
13
+ (function (DeploySettingSource) {
14
+ /** The environment variable is set. */
15
+ DeploySettingSource["Environment"] = "environment";
16
+ /** The variable is unset or blank, so the built-in value applies. */
17
+ DeploySettingSource["Default"] = "default";
18
+ })(DeploySettingSource || (DeploySettingSource = {}));
19
+ /**
20
+ * Tabulate every environment variable {@link deployProtocolContract} runs
21
+ * with, except the secret `DEPLOYER_SEED`, each with its effective value.
22
+ *
23
+ * @param env - The environment the deploy reads.
24
+ * @param midnightNodeConfig - The node config resolved from `env`.
25
+ * @returns One row per variable, keyed by variable name.
26
+ */
27
+ export function deployEnvironmentTable(env, midnightNodeConfig) {
28
+ const values = {
29
+ [MIDNIGHT_NODE_CONFIG_ENV_VARS.networkId]: midnightNodeConfig.networkId,
30
+ [MIDNIGHT_NODE_CONFIG_ENV_VARS.nodeUrl]: midnightNodeConfig.nodeUrl,
31
+ [MIDNIGHT_NODE_CONFIG_ENV_VARS.indexerUrl]: midnightNodeConfig.indexerUrl,
32
+ [MIDNIGHT_NODE_CONFIG_ENV_VARS.indexerWsUrl]: midnightNodeConfig.indexerWsUrl,
33
+ [MIDNIGHT_NODE_CONFIG_ENV_VARS.proofServerUrl]: midnightNodeConfig.proofServerUrl,
34
+ [FAUCET_URL_ENV_VAR]: getFaucetUrl(env, midnightNodeConfig.networkId) ?? "(none)",
35
+ };
36
+ return Object.fromEntries(Object.entries(values).map(([name, value]) => [
37
+ name,
38
+ {
39
+ value,
40
+ source: envOrUndefined(env, name) === undefined
41
+ ? DeploySettingSource.Default
42
+ : DeploySettingSource.Environment,
43
+ },
44
+ ]));
45
+ }
46
+ /**
47
+ * Deploy a protocol contract: read config from `env`, build and prove the deploy
48
+ * transaction and submit it through a synced wallet. Progress is logged to
49
+ * the console, ending with `deployed <name> at <address>`, the line the
50
+ * deploy workflow reads the address from. Any funded wallet can deploy, and
51
+ * nothing about the deployer is sealed. The wallet needs NIGHT only:
52
+ * {@link ensureFeeReady} registers it for dust generation and waits for the
53
+ * deploy transaction's fee in spendable DUST when the wallet holds less.
54
+ *
55
+ * @param name - The contract's package directory name, for the log.
56
+ * @param buildTransaction - Builds the contract's deploy transaction.
57
+ * @param env - Environment map providing `DEPLOYER_SEED` and the shared
58
+ * Midnight node configuration (see `getMidnightNodeConfig`).
59
+ * @param wallets - A registry to take the deployer wallet from, when the caller
60
+ * keeps wallets open across steps. Without one, a private registry is opened
61
+ * for this deploy and closed after it.
62
+ * @returns The deployed contract address and deploy transaction id.
63
+ * @throws {WalletUnfundedError} If the deployer wallet holds no NIGHT and
64
+ * less DUST than the deploy fee: the error carries the wallet's NIGHT receive address to fund.
65
+ * @throws {Error} If the deploy's fee does not generate in spendable DUST after
66
+ * registering the wallet's NIGHT, or submission fails.
67
+ */
68
+ export async function deployProtocolContract(name, buildTransaction, env, wallets) {
69
+ const deployConfig = getDeployConfig(env);
70
+ const { networkId } = deployConfig.midnightNodeConfig;
71
+ const registry = wallets ?? new WalletRegistry(deployConfig.midnightNodeConfig);
72
+ console.log(`deploying ${name} to ${networkId} with:`);
73
+ console.table(deployEnvironmentTable(env, deployConfig.midnightNodeConfig));
74
+ try {
75
+ const { facade, keys } = await registry.wallet(deployConfig.deployerSeed, "deployer");
76
+ const deployTransaction = await buildTransaction(networkId, keys.shieldedSecretKeys.coinPublicKey);
77
+ console.log(`contract address (pre-submit): ${deployTransaction.contractAddress}`);
78
+ // The one transaction this deploy submits, priced before anything is sent.
79
+ const fee = await estimateUnprovenTransactionFee(facade, deployTransaction.serializedTransaction);
80
+ console.log(`fee budget: 1 transaction at about ${String(fee)} DUST`);
81
+ const state = await facade.waitForSyncedState();
82
+ await ensureFeeReady(facade, keys, state, networkId, getFaucetUrl(env, networkId), fee);
83
+ const txId = await submitUnprovenTransaction(facade, keys, deployTransaction.serializedTransaction);
84
+ const { contractAddress } = deployTransaction;
85
+ console.log(`submitted deploy tx ${txId}`);
86
+ console.log(`deployed ${name} at ${contractAddress}`);
87
+ return { contractAddress, txId };
88
+ }
89
+ finally {
90
+ if (wallets === undefined)
91
+ await registry.close();
92
+ }
93
+ }
94
+ //# sourceMappingURL=deploy-protocol-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-protocol-contract.js","sourceRoot":"","sources":["../src/deploy-protocol-contract.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,mEAAmE;AACnE,0EAA0E;AAC1E,4EAA4E;AAC5E,8BAA8B;AAE9B,OAAO,EAA0B,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,6BAA6B,GAE9B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EAEzB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAU9B,0DAA0D;AAC1D,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,uCAAuC;IACvC,kDAA2B,CAAA;IAC3B,qEAAqE;IACrE,0CAAmB,CAAA;AACrB,CAAC,EAL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,CAAC;IACnC,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;IACpD,CAAC;AACH,CAAC"}
@@ -1,43 +1,8 @@
1
- import { type MidnightNodeConfig } from "./plumbing/midnight-node-config.ts";
2
- import { type TransactionIdentifier, WalletRegistry } from "./plumbing/wallet.ts";
3
- /** The outcome of a successful signet-contract deployment. */
4
- export interface SignetContractDeployment {
5
- /** Address of the deployed signet contract on Midnight. */
6
- contractAddress: string;
7
- /** Identifier of the submitted deploy transaction. */
8
- txId: TransactionIdentifier;
9
- }
10
- /** Where a deploy setting's effective value came from. */
11
- export declare enum DeploySettingSource {
12
- /** The environment variable is set. */
13
- Environment = "environment",
14
- /** The variable is unset or blank, so the built-in value applies. */
15
- Default = "default"
16
- }
17
- /** One row of {@link deployEnvironmentTable}. */
18
- export interface DeploySettingRow {
19
- /** The value the deploy runs with. */
20
- value: string;
21
- /** Whether the environment or the built-in default supplied {@link value}. */
22
- source: DeploySettingSource;
23
- }
1
+ import { type ContractDeployment } from "./deploy-protocol-contract.ts";
2
+ import type { WalletRegistry } from "./plumbing/wallet.ts";
24
3
  /**
25
- * Tabulate every environment variable a signet-contract deploy runs with,
26
- * except the secret `DEPLOYER_SEED`, each with its effective value.
27
- *
28
- * @param env - The environment the deploy reads.
29
- * @param midnightNodeConfig - The node config resolved from `env`.
30
- * @returns One row per variable, keyed by variable name.
31
- */
32
- export declare function deployEnvironmentTable(env: Record<string, string | undefined>, midnightNodeConfig: MidnightNodeConfig): Record<string, DeploySettingRow>;
33
- /**
34
- * Deploy the signet contract: read config from `env`, build and prove the
35
- * deploy transaction and submit it through a synced wallet. Progress is
36
- * logged to the console. The contract takes no constructor arguments. Any
37
- * funded wallet can deploy, and nothing about the deployer is sealed. The wallet
38
- * needs NIGHT only: {@link ensureFeeReady} registers it for dust generation
39
- * and waits for the deploy transaction's fee in spendable DUST when the
40
- * wallet holds less.
4
+ * Deploy the signet contract through {@link deployProtocolContract}, which
5
+ * logs `deployed signet-contract at <address>` on success.
41
6
  *
42
7
  * @param env - Environment map providing `DEPLOYER_SEED` and the shared
43
8
  * Midnight node configuration (see `getMidnightNodeConfig`).
@@ -50,5 +15,5 @@ export declare function deployEnvironmentTable(env: Record<string, string | unde
50
15
  * @throws {Error} If the deploy's fee does not generate in spendable DUST after
51
16
  * registering the wallet's NIGHT, or submission fails.
52
17
  */
53
- export declare function deploySignetContract(env?: Record<string, string | undefined>, wallets?: WalletRegistry): Promise<SignetContractDeployment>;
18
+ export declare function deploySignetContract(env?: Record<string, string | undefined>, wallets?: WalletRegistry): Promise<ContractDeployment>;
54
19
  //# sourceMappingURL=deploy-signet-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-signet-contract.d.ts","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAWA,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGL,KAAK,qBAAqB,EAC1B,cAAc,EACf,MAAM,sBAAsB,CAAC;AAM9B,8DAA8D;AAC9D,MAAM,WAAW,wBAAwB;IACvC,2DAA2D;IAC3D,eAAe,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,IAAI,EAAE,qBAAqB,CAAC;CAC7B;AAED,0DAA0D;AAC1D,oBAAY,mBAAmB;IAC7B,uCAAuC;IACvC,WAAW,gBAAgB;IAC3B,qEAAqE;IACrE,OAAO,YAAY;CACpB;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,kBAAkB,EAAE,kBAAkB,GACrC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAqBlC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,wBAAwB,CAAC,CAwCnC"}
1
+ {"version":3,"file":"deploy-signet-contract.d.ts","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,+BAA+B,CAAC;AAEhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAa7B"}
@@ -1,59 +1,15 @@
1
- // Signet-contract deploy flow: builds, balances, proves and submits the
2
- // contract's deploy transaction using the generic plumbing in ./plumbing.
3
- // Everything contract-specific lives HERE: the (empty) private state. The
4
- // contract has no constructor arguments (it only emits unauthenticated
5
- // events: verification is the reader's job). Requires the contract
6
- // package's compiled assets to carry keys (its published dist/managed
7
- // always does; an in-repo checkout needs `yarn compile:zk`).
8
- import { buildDeployTransaction, getDeployConfig } from "./plumbing/deploy.js";
9
- import { envOrUndefined } from "./plumbing/env.js";
10
- import { ensureFeeReady } from "./plumbing/funding.js";
11
- import { FAUCET_URL_ENV_VAR, getFaucetUrl, MIDNIGHT_NODE_CONFIG_ENV_VARS, } from "./plumbing/midnight-node-config.js";
12
- import { estimateUnprovenTransactionFee, submitUnprovenTransaction, WalletRegistry, } from "./plumbing/wallet.js";
1
+ // Signet-contract deploy flow: the shared protocol-contract flow over the
2
+ // signet contract's compiled assets. The contract has no constructor
3
+ // arguments (it only emits unauthenticated events: verification is the
4
+ // reader's job) and an empty private state. Requires the contract package's
5
+ // compiled assets to carry keys (its published dist/managed always does; an
6
+ // in-repo checkout needs `yarn compile:zk`).
7
+ import { deployProtocolContract } from "./deploy-protocol-contract.js";
8
+ import { buildDeployTransaction } from "./plumbing/deploy.js";
13
9
  import { createSignetContractPrivateState, signetContractCompiledContract, } from "./signet-contract-binding.js";
14
- /** Where a deploy setting's effective value came from. */
15
- export var DeploySettingSource;
16
- (function (DeploySettingSource) {
17
- /** The environment variable is set. */
18
- DeploySettingSource["Environment"] = "environment";
19
- /** The variable is unset or blank, so the built-in value applies. */
20
- DeploySettingSource["Default"] = "default";
21
- })(DeploySettingSource || (DeploySettingSource = {}));
22
10
  /**
23
- * Tabulate every environment variable a signet-contract deploy runs with,
24
- * except the secret `DEPLOYER_SEED`, each with its effective value.
25
- *
26
- * @param env - The environment the deploy reads.
27
- * @param midnightNodeConfig - The node config resolved from `env`.
28
- * @returns One row per variable, keyed by variable name.
29
- */
30
- export function deployEnvironmentTable(env, midnightNodeConfig) {
31
- const values = {
32
- [MIDNIGHT_NODE_CONFIG_ENV_VARS.networkId]: midnightNodeConfig.networkId,
33
- [MIDNIGHT_NODE_CONFIG_ENV_VARS.nodeUrl]: midnightNodeConfig.nodeUrl,
34
- [MIDNIGHT_NODE_CONFIG_ENV_VARS.indexerUrl]: midnightNodeConfig.indexerUrl,
35
- [MIDNIGHT_NODE_CONFIG_ENV_VARS.indexerWsUrl]: midnightNodeConfig.indexerWsUrl,
36
- [MIDNIGHT_NODE_CONFIG_ENV_VARS.proofServerUrl]: midnightNodeConfig.proofServerUrl,
37
- [FAUCET_URL_ENV_VAR]: getFaucetUrl(env, midnightNodeConfig.networkId) ?? "(none)",
38
- };
39
- return Object.fromEntries(Object.entries(values).map(([name, value]) => [
40
- name,
41
- {
42
- value,
43
- source: envOrUndefined(env, name) === undefined
44
- ? DeploySettingSource.Default
45
- : DeploySettingSource.Environment,
46
- },
47
- ]));
48
- }
49
- /**
50
- * Deploy the signet contract: read config from `env`, build and prove the
51
- * deploy transaction and submit it through a synced wallet. Progress is
52
- * logged to the console. The contract takes no constructor arguments. Any
53
- * funded wallet can deploy, and nothing about the deployer is sealed. The wallet
54
- * needs NIGHT only: {@link ensureFeeReady} registers it for dust generation
55
- * and waits for the deploy transaction's fee in spendable DUST when the
56
- * wallet holds less.
11
+ * Deploy the signet contract through {@link deployProtocolContract}, which
12
+ * logs `deployed signet-contract at <address>` on success.
57
13
  *
58
14
  * @param env - Environment map providing `DEPLOYER_SEED` and the shared
59
15
  * Midnight node configuration (see `getMidnightNodeConfig`).
@@ -67,29 +23,6 @@ export function deployEnvironmentTable(env, midnightNodeConfig) {
67
23
  * registering the wallet's NIGHT, or submission fails.
68
24
  */
69
25
  export async function deploySignetContract(env = process.env, wallets) {
70
- const deployConfig = getDeployConfig(env);
71
- const { networkId } = deployConfig.midnightNodeConfig;
72
- const registry = wallets ?? new WalletRegistry(deployConfig.midnightNodeConfig);
73
- console.log(`deploying signet-contract to ${networkId} with:`);
74
- console.table(deployEnvironmentTable(env, deployConfig.midnightNodeConfig));
75
- try {
76
- const { facade, keys } = await registry.wallet(deployConfig.deployerSeed, "deployer");
77
- const deployTransaction = await buildDeployTransaction(signetContractCompiledContract, networkId, keys.shieldedSecretKeys.coinPublicKey, createSignetContractPrivateState());
78
- console.log(`contract address (pre-submit): ${deployTransaction.contractAddress}`);
79
- // The one transaction this deploy submits, priced before anything is sent.
80
- const fee = await estimateUnprovenTransactionFee(facade, deployTransaction.serializedTransaction);
81
- console.log(`fee budget: 1 transaction at about ${String(fee)} DUST`);
82
- const state = await facade.waitForSyncedState();
83
- await ensureFeeReady(facade, keys, state, networkId, getFaucetUrl(env, networkId), fee);
84
- const txId = await submitUnprovenTransaction(facade, keys, deployTransaction.serializedTransaction);
85
- const { contractAddress } = deployTransaction;
86
- console.log(`submitted deploy tx ${txId}`);
87
- console.log(`deployed signet-contract at ${contractAddress}`);
88
- return { contractAddress, txId };
89
- }
90
- finally {
91
- if (wallets === undefined)
92
- await registry.close();
93
- }
26
+ return deployProtocolContract("signet-contract", (networkId, coinPublicKeyHex) => buildDeployTransaction(signetContractCompiledContract, networkId, coinPublicKeyHex, createSignetContractPrivateState()), env, wallets);
94
27
  }
95
28
  //# sourceMappingURL=deploy-signet-contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-signet-contract.js","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,mEAAmE;AACnE,sEAAsE;AACtE,6DAA6D;AAE7D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,6BAA6B,GAE9B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EAEzB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gCAAgC,EAChC,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AAUtC,0DAA0D;AAC1D,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,uCAAuC;IACvC,kDAA2B,CAAA;IAC3B,qEAAqE;IACrE,0CAAmB,CAAA;AACrB,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AAUD;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,GAAuC,EACvC,kBAAsC;IAEtC,MAAM,MAAM,GAA2B;QACrC,CAAC,6BAA6B,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,SAAS;QACvE,CAAC,6BAA6B,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO;QACnE,CAAC,6BAA6B,CAAC,UA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E;AAC5E,6CAA6C;AAE7C,OAAO,EAA2B,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EACL,gCAAgC,EAChC,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAG,GAAuC,OAAO,CAAC,GAAG,EACrD,OAAwB;IAExB,OAAO,sBAAsB,CAC3B,iBAAiB,EACjB,CAAC,SAAS,EAAE,gBAAgB,EAAE,EAAE,CAC9B,sBAAsB,CACpB,8BAA8B,EAC9B,SAAS,EACT,gBAAgB,EAChB,gCAAgC,EAAE,CACnC,EACH,GAAG,EACH,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type ContractDeployment } from "./deploy-protocol-contract.ts";
2
+ import type { WalletRegistry } from "./plumbing/wallet.ts";
3
+ /**
4
+ * Deploy the signet responder through {@link deployProtocolContract}, which
5
+ * logs `deployed signet-responder at <address>` on success.
6
+ *
7
+ * @param env - Environment map providing `DEPLOYER_SEED` and the shared
8
+ * Midnight node configuration (see `getMidnightNodeConfig`).
9
+ * @param wallets - A registry to take the deployer wallet from, when the caller
10
+ * keeps wallets open across steps. Without one, a private registry is opened
11
+ * for this deploy and closed after it.
12
+ * @returns The deployed contract address and deploy transaction id.
13
+ * @throws {WalletUnfundedError} If the deployer wallet holds no NIGHT and
14
+ * less DUST than the deploy fee: the error carries the wallet's NIGHT receive address to fund.
15
+ * @throws {Error} If the deploy's fee does not generate in spendable DUST after
16
+ * registering the wallet's NIGHT, or submission fails.
17
+ */
18
+ export declare function deploySignetResponder(env?: Record<string, string | undefined>, wallets?: WalletRegistry): Promise<ContractDeployment>;
19
+ //# sourceMappingURL=deploy-signet-responder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-signet-responder.d.ts","sourceRoot":"","sources":["../src/deploy-signet-responder.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,+BAA+B,CAAC;AAEhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAa7B"}
@@ -0,0 +1,27 @@
1
+ // Signet-responder deploy flow: the shared protocol-contract flow over the
2
+ // responder's compiled assets. Like the singleton, the responder has no
3
+ // constructor arguments and an empty private state. Requires its compiled
4
+ // assets to carry keys (its published dist/managed always does; an in-repo
5
+ // checkout needs `yarn compile:signet-responder:zk`).
6
+ import { deployProtocolContract } from "./deploy-protocol-contract.js";
7
+ import { buildDeployTransaction } from "./plumbing/deploy.js";
8
+ import { createSignetResponderPrivateState, signetResponderCompiledContract, } from "./signet-responder-binding.js";
9
+ /**
10
+ * Deploy the signet responder through {@link deployProtocolContract}, which
11
+ * logs `deployed signet-responder at <address>` on success.
12
+ *
13
+ * @param env - Environment map providing `DEPLOYER_SEED` and the shared
14
+ * Midnight node configuration (see `getMidnightNodeConfig`).
15
+ * @param wallets - A registry to take the deployer wallet from, when the caller
16
+ * keeps wallets open across steps. Without one, a private registry is opened
17
+ * for this deploy and closed after it.
18
+ * @returns The deployed contract address and deploy transaction id.
19
+ * @throws {WalletUnfundedError} If the deployer wallet holds no NIGHT and
20
+ * less DUST than the deploy fee: the error carries the wallet's NIGHT receive address to fund.
21
+ * @throws {Error} If the deploy's fee does not generate in spendable DUST after
22
+ * registering the wallet's NIGHT, or submission fails.
23
+ */
24
+ export async function deploySignetResponder(env = process.env, wallets) {
25
+ return deployProtocolContract("signet-responder", (networkId, coinPublicKeyHex) => buildDeployTransaction(signetResponderCompiledContract, networkId, coinPublicKeyHex, createSignetResponderPrivateState()), env, wallets);
26
+ }
27
+ //# sourceMappingURL=deploy-signet-responder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-signet-responder.js","sourceRoot":"","sources":["../src/deploy-signet-responder.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,sDAAsD;AAEtD,OAAO,EAA2B,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EACL,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,GAAG,GAAuC,OAAO,CAAC,GAAG,EACrD,OAAwB;IAExB,OAAO,sBAAsB,CAC3B,kBAAkB,EAClB,CAAC,SAAS,EAAE,gBAAgB,EAAE,EAAE,CAC9B,sBAAsB,CACpB,+BAA+B,EAC/B,SAAS,EACT,gBAAgB,EAChB,iCAAiC,EAAE,CACpC,EACH,GAAG,EACH,OAAO,CACR,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ export * from "./deploy-protocol-contract.ts";
1
2
  export * from "./deploy-signet-contract.ts";
3
+ export * from "./deploy-signet-responder.ts";
2
4
  export * from "./plumbing/counterparties.ts";
3
5
  export * from "./plumbing/deploy.ts";
4
6
  export * from "./plumbing/env.ts";
@@ -9,4 +11,5 @@ export * from "./plumbing/network-id.ts";
9
11
  export * from "./plumbing/seed.ts";
10
12
  export * from "./plumbing/wallet.ts";
11
13
  export * from "./signet-contract-binding.ts";
14
+ export * from "./signet-responder-binding.ts";
12
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,14 @@
1
- // Deploy tooling for the central signet contract, self-contained for npm:
2
- // the operator deploy flow, the Node binding of @sig-net/midnight-contract
3
- // to its compiled assets, and the generic Midnight deploy/wallet plumbing
4
- // (config, seed parsing, key derivation, wallet facade, unproven-tx
5
- // build/submit) the flow is built from. The plumbing is generic on purpose —
6
- // any contract package's deploy script composes it.
1
+ // Deploy tooling for the signet contracts, self-contained for npm: the
2
+ // operator deploy flows of the signet singleton and the signet responder,
3
+ // the Node bindings of @sig-net/midnight-contract and
4
+ // @sig-net/midnight-responder to their compiled assets, and the generic
5
+ // Midnight deploy/wallet plumbing (config, seed parsing, key derivation,
6
+ // wallet facade, unproven-tx build/submit) the flows are built from. The
7
+ // plumbing is generic on purpose — any contract package's deploy script
8
+ // composes it.
9
+ export * from "./deploy-protocol-contract.js";
7
10
  export * from "./deploy-signet-contract.js";
11
+ export * from "./deploy-signet-responder.js";
8
12
  export * from "./plumbing/counterparties.js";
9
13
  export * from "./plumbing/deploy.js";
10
14
  export * from "./plumbing/env.js";
@@ -15,4 +19,5 @@ export * from "./plumbing/network-id.js";
15
19
  export * from "./plumbing/seed.js";
16
20
  export * from "./plumbing/wallet.js";
17
21
  export * from "./signet-contract-binding.js";
22
+ export * from "./signet-responder-binding.js";
18
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,oEAAoE;AACpE,6EAA6E;AAC7E,oDAAoD;AAEpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,0EAA0E;AAC1E,sDAAsD;AACtD,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,eAAe;AAEf,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Contract, createSignetResponderPrivateState, type SignetResponderPrivateState } from "@sig-net/midnight-responder";
2
+ /** Absolute path of the signet responder's `managed/` zk config root. */
3
+ export declare const signetResponderManagedPath: string;
4
+ /**
5
+ * The signet-responder compact-js compiled-contract binding: generated module
6
+ * (the contract declares no witnesses) and the compiled assets on disk.
7
+ * Consumed by deploy tooling.
8
+ */
9
+ export declare const signetResponderCompiledContract: import("@midnight-ntwrk/compact-js/effect/CompiledContract").CompiledContract<Contract<SignetResponderPrivateState, import("@sig-net/midnight-responder").Witnesses<SignetResponderPrivateState>>, SignetResponderPrivateState, never>;
10
+ export { createSignetResponderPrivateState };
11
+ //# sourceMappingURL=signet-responder-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signet-responder-binding.d.ts","sourceRoot":"","sources":["../src/signet-responder-binding.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EACR,iCAAiC,EACjC,KAAK,2BAA2B,EACjC,MAAM,6BAA6B,CAAC;AASrC,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,QAGtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,wOAGe,CAAC;AAI5D,OAAO,EAAE,iCAAiC,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ // The NODE binding of the signet responder to its compiled assets: the
2
+ // environment-specific half @sig-net/midnight-responder does not ship, the
3
+ // responder's counterpart of signet-contract-binding.ts.
4
+ import { createRequire } from "node:module";
5
+ import { dirname, join } from "node:path";
6
+ import { Contract, createSignetResponderPrivateState, } from "@sig-net/midnight-responder";
7
+ import { makeVacantCompiledContract } from "./plumbing/deploy.js";
8
+ // Resolved through the package specifier, as signetContractManagedPath is:
9
+ // the managed/ dir sits beside the entry module both in the repo
10
+ // (src/index.ts + src/managed, keys from `yarn compile:signet-responder:zk`)
11
+ // and in the npm tarball (dist/index.js + dist/managed, which always carries
12
+ // the keys).
13
+ /** Absolute path of the signet responder's `managed/` zk config root. */
14
+ export const signetResponderManagedPath = join(dirname(createRequire(import.meta.url).resolve("@sig-net/midnight-responder")), "managed");
15
+ /**
16
+ * The signet-responder compact-js compiled-contract binding: generated module
17
+ * (the contract declares no witnesses) and the compiled assets on disk.
18
+ * Consumed by deploy tooling.
19
+ */
20
+ export const signetResponderCompiledContract = makeVacantCompiledContract("signet-responder", Contract, signetResponderManagedPath);
21
+ // Re-exported so deploy-side callers get the private state builder from the
22
+ // same module as the binding it pairs with.
23
+ export { createSignetResponderPrivateState };
24
+ //# sourceMappingURL=signet-responder-binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signet-responder-binding.js","sourceRoot":"","sources":["../src/signet-responder-binding.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,yDAAyD;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EACL,QAAQ,EACR,iCAAiC,GAElC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,2EAA2E;AAC3E,iEAAiE;AACjE,6EAA6E;AAC7E,6EAA6E;AAC7E,aAAa;AACb,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAC5C,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,EAC9E,SAAS,CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,0BAA0B,CAGvE,kBAAkB,EAAE,QAAQ,EAAE,0BAA0B,CAAC,CAAC;AAE5D,4EAA4E;AAC5E,4CAA4C;AAC5C,OAAO,EAAE,iCAAiC,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@sig-net/midnight-contract-deploy",
3
- "version": "0.25.1",
3
+ "version": "0.26.0-rc.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sig-net/midnight-integration",
7
7
  "directory": "packages/signet-contract-deploy"
8
8
  },
9
9
  "type": "module",
10
- "description": "Deploy tooling for the central signet contract on Midnight: the operator deploy flow, the Node binding of @sig-net/midnight-contract to its compiled assets, and the generic deploy/wallet plumbing (node config, seed parsing, key derivation, wallet facade, unproven-tx build/submit) any Compact contract's deploy script composes.",
10
+ "description": "Deploy tooling for the signet contracts on Midnight: the operator deploy flows of the central signet contract and the signet responder, the Node bindings of @sig-net/midnight-contract and @sig-net/midnight-responder to their compiled assets, and the generic deploy/wallet plumbing (node config, seed parsing, key derivation, wallet facade, unproven-tx build/submit) any Compact contract's deploy script composes.",
11
11
  "//exports": "Local dev consumes raw TS source. `publishConfig.exports` below swaps this to the emitted ./dist at publish time, so npm consumers get JS + .d.ts while the monorepo keeps resolving to src.",
12
12
  "exports": {
13
13
  ".": {
@@ -22,7 +22,8 @@
22
22
  "build": "rm -rf dist && tsc -p tsconfig.json && tsc -p tsconfig.build.json",
23
23
  "prepack": "yarn build",
24
24
  "test": "vitest run",
25
- "deploy": "tsx --env-file-if-exists=../../.env deploy.ts"
25
+ "deploy": "tsx --env-file-if-exists=../../.env deploy.ts",
26
+ "deploy:signet-responder": "tsx --env-file-if-exists=../../.env deploy-signet-responder.ts"
26
27
  },
27
28
  "publishConfig": {
28
29
  "access": "public",
@@ -50,8 +51,9 @@
50
51
  "@midnightntwrk/wallet-sdk-shielded": "4.0.0-beta.2",
51
52
  "@midnightntwrk/wallet-sdk-unshielded-wallet": "4.0.0-beta.2",
52
53
  "@scure/bip39": "^2.2.0",
53
- "@sig-net/midnight": "^0.25.1",
54
- "@sig-net/midnight-contract": "^0.25.1",
54
+ "@sig-net/midnight": "^0.26.0-rc.2",
55
+ "@sig-net/midnight-contract": "^0.26.0-rc.2",
56
+ "@sig-net/midnight-responder": "^0.26.0-rc.2",
55
57
  "effect": "^3.22.2"
56
58
  },
57
59
  "devDependencies": {