@sig-net/midnight-contract-deploy 0.0.4 → 0.0.6
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
|
@@ -21,7 +21,7 @@ Everything is read from the environment:
|
|
|
21
21
|
| `NETWORK_ID` | Target network: `undeployed` (local stack, the default), `stagenet`, `preview`, `preprod` or `mainnet`. Selects the default endpoints. |
|
|
22
22
|
| `MIDNIGHT_NODE_URL`, `MIDNIGHT_NODE_INDEXER_URL`, `MIDNIGHT_NODE_INDEXER_WS_URL`, `MIDNIGHT_NODE_PROOF_SERVER_URL` | Optional per-endpoint overrides of the network defaults. |
|
|
23
23
|
| `DEPLOYER_SEED` | The deploying wallet's seed (hex or mnemonic). On the local stack it defaults to the pre-funded genesis mint wallet. |
|
|
24
|
-
| `
|
|
24
|
+
| `MPC_SECP256K1_PUBKEY` | The MPC attestation key, as compressed or uncompressed 0x-hex. The contract seals its hash at deploy time. |
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
@@ -10,14 +10,14 @@ export interface SignetContractDeployment {
|
|
|
10
10
|
* Deploy the signet contract: read config from `env`, build and prove the
|
|
11
11
|
* deploy transaction and submit it through a synced wallet. Progress is
|
|
12
12
|
* logged to the console. The one constructor argument is the MPC attestation
|
|
13
|
-
* key (`
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* key (`MPC_SECP256K1_PUBKEY`, compressed or uncompressed 0x-hex), whose hash
|
|
14
|
+
* the contract seals — remote execution attestations must be ECDSA-signed by
|
|
15
|
+
* it. Any funded wallet can deploy; nothing about the deployer is sealed.
|
|
16
16
|
*
|
|
17
17
|
* @param env - Environment map providing `DEPLOYER_SEED`,
|
|
18
|
-
* `
|
|
18
|
+
* `MPC_SECP256K1_PUBKEY` and the shared Midnight node configuration (see `getMidnightNodeConfig`).
|
|
19
19
|
* @returns The deployed contract address and deploy transaction id.
|
|
20
|
-
* @throws If `
|
|
20
|
+
* @throws If `MPC_SECP256K1_PUBKEY` is missing/malformed, the deployer
|
|
21
21
|
* wallet holds no funds, or submission fails.
|
|
22
22
|
*/
|
|
23
23
|
export declare function deploySignetContract(env?: Record<string, string | undefined>): Promise<SignetContractDeployment>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// constructor arg and the (empty) private state. Requires the contract
|
|
5
5
|
// package's compiled assets to carry keys (its published dist/managed
|
|
6
6
|
// always does; an in-repo checkout needs `yarn compile:zk`).
|
|
7
|
-
import {
|
|
7
|
+
import { parseSecp256k1PublicKey } from "@sig-net/midnight";
|
|
8
8
|
import { assertDeployerFunded, buildDeployTransaction, getDeployConfig, } from "./plumbing/deploy.js";
|
|
9
9
|
import { deriveAccountKeys, submitUnprovenTransaction, withSyncedWalletFacade, } from "./plumbing/wallet.js";
|
|
10
10
|
import { createSignetContractPrivateState, signetContractCompiledContract, } from "./signet-contract-binding.js";
|
|
@@ -12,24 +12,24 @@ import { createSignetContractPrivateState, signetContractCompiledContract, } fro
|
|
|
12
12
|
* Deploy the signet contract: read config from `env`, build and prove the
|
|
13
13
|
* deploy transaction and submit it through a synced wallet. Progress is
|
|
14
14
|
* logged to the console. The one constructor argument is the MPC attestation
|
|
15
|
-
* key (`
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* key (`MPC_SECP256K1_PUBKEY`, compressed or uncompressed 0x-hex), whose hash
|
|
16
|
+
* the contract seals — remote execution attestations must be ECDSA-signed by
|
|
17
|
+
* it. Any funded wallet can deploy; nothing about the deployer is sealed.
|
|
18
18
|
*
|
|
19
19
|
* @param env - Environment map providing `DEPLOYER_SEED`,
|
|
20
|
-
* `
|
|
20
|
+
* `MPC_SECP256K1_PUBKEY` and the shared Midnight node configuration (see `getMidnightNodeConfig`).
|
|
21
21
|
* @returns The deployed contract address and deploy transaction id.
|
|
22
|
-
* @throws If `
|
|
22
|
+
* @throws If `MPC_SECP256K1_PUBKEY` is missing/malformed, the deployer
|
|
23
23
|
* wallet holds no funds, or submission fails.
|
|
24
24
|
*/
|
|
25
25
|
export async function deploySignetContract(env = process.env) {
|
|
26
26
|
const deployConfig = getDeployConfig(env);
|
|
27
27
|
const { networkId } = deployConfig.midnightNodeConfig;
|
|
28
|
-
const mpcPkRaw = env.
|
|
28
|
+
const mpcPkRaw = env.MPC_SECP256K1_PUBKEY?.trim();
|
|
29
29
|
if (!mpcPkRaw) {
|
|
30
|
-
throw new Error("
|
|
30
|
+
throw new Error("MPC_SECP256K1_PUBKEY is required (the MPC attestation key, as compressed/uncompressed 0x-hex)");
|
|
31
31
|
}
|
|
32
|
-
const mpcPk =
|
|
32
|
+
const mpcPk = parseSecp256k1PublicKey(mpcPkRaw);
|
|
33
33
|
const accountKeys = deriveAccountKeys(deployConfig.deployerSeed, networkId);
|
|
34
34
|
console.log(`deploying signet-contract to ${networkId} (${deployConfig.midnightNodeConfig.nodeUrl})`);
|
|
35
35
|
console.log(`mpc attestation key: x=${mpcPk.x} y=${mpcPk.y}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-signet-contract.js","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0EAA0E;AAC1E,mEAAmE;AACnE,uEAAuE;AACvE,sEAAsE;AACtE,6DAA6D;AAE7D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy-signet-contract.js","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0EAA0E;AAC1E,mEAAmE;AACnE,uEAAuE;AACvE,sEAAsE;AACtE,6DAA6D;AAE7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,GAEvB,MAAM,sBAAsB,CAAC;AAC9B,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,yBAAyB,CACnD,MAAM,EACN,WAAW,EACX,iBAAiB,CAAC,qBAAqB,CACxC,CAAC;QACF,OAAO,EAAE,eAAe,EAAE,iBAAiB,CAAC,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IACrF,CAAC,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,+BAA+B,eAAe,EAAE,CAAC,CAAC;IAE9D,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AACnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sig-net/midnight-contract-deploy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sig-net/midnight-integration",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@midnightntwrk/wallet-sdk-shielded": "4.0.0-beta.2",
|
|
51
51
|
"@midnightntwrk/wallet-sdk-unshielded-wallet": "4.0.0-beta.2",
|
|
52
52
|
"@scure/bip39": "^2.2.0",
|
|
53
|
-
"@sig-net/midnight": "^0.0.
|
|
54
|
-
"@sig-net/midnight-contract": "^0.0.
|
|
53
|
+
"@sig-net/midnight": "^0.0.6",
|
|
54
|
+
"@sig-net/midnight-contract": "^0.0.6",
|
|
55
55
|
"effect": "^3.21.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|