@sig-net/midnight-contract-deploy 0.0.5 → 0.0.7
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.
|
@@ -9,16 +9,13 @@ export interface SignetContractDeployment {
|
|
|
9
9
|
/**
|
|
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
|
-
* logged to the console. The
|
|
13
|
-
*
|
|
14
|
-
* whose hash the contract seals — remote execution responses must be signed
|
|
15
|
-
* by it. Any funded wallet can deploy; nothing about the deployer is sealed.
|
|
12
|
+
* logged to the console. The contract takes no constructor arguments. Any
|
|
13
|
+
* funded wallet can deploy; nothing about the deployer is sealed.
|
|
16
14
|
*
|
|
17
|
-
* @param env - Environment map providing `DEPLOYER_SEED
|
|
18
|
-
*
|
|
15
|
+
* @param env - Environment map providing `DEPLOYER_SEED` and the shared
|
|
16
|
+
* Midnight node configuration (see `getMidnightNodeConfig`).
|
|
19
17
|
* @returns The deployed contract address and deploy transaction id.
|
|
20
|
-
* @throws If
|
|
21
|
-
* wallet holds no funds, or submission fails.
|
|
18
|
+
* @throws If the deployer wallet holds no funds or submission fails.
|
|
22
19
|
*/
|
|
23
20
|
export declare function deploySignetContract(env?: Record<string, string | undefined>): Promise<SignetContractDeployment>;
|
|
24
21
|
//# 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":"AAaA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,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
|
|
1
|
+
{"version":3,"file":"deploy-signet-contract.d.ts","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAaA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,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;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAAC,wBAAwB,CAAC,CAmCnC"}
|
|
@@ -1,41 +1,32 @@
|
|
|
1
1
|
// Signet-contract deploy flow: builds, balances, proves and submits the
|
|
2
2
|
// contract's deploy transaction using the generic plumbing in ./plumbing.
|
|
3
|
-
// Everything contract-specific lives HERE: the
|
|
4
|
-
//
|
|
3
|
+
// Everything contract-specific lives HERE: the (empty) private state — the
|
|
4
|
+
// contract has no constructor arguments (every store is an unauthenticated
|
|
5
|
+
// append-only log; verification is the reader's job). Requires the contract
|
|
5
6
|
// package's compiled assets to carry keys (its published dist/managed
|
|
6
7
|
// always does; an in-repo checkout needs `yarn compile:zk`).
|
|
7
|
-
import { parseJubjubPublicKey } 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";
|
|
11
11
|
/**
|
|
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
|
-
* logged to the console. The
|
|
15
|
-
*
|
|
16
|
-
* whose hash the contract seals — remote execution responses must be signed
|
|
17
|
-
* by it. Any funded wallet can deploy; nothing about the deployer is sealed.
|
|
14
|
+
* logged to the console. The contract takes no constructor arguments. Any
|
|
15
|
+
* funded wallet can deploy; nothing about the deployer is sealed.
|
|
18
16
|
*
|
|
19
|
-
* @param env - Environment map providing `DEPLOYER_SEED
|
|
20
|
-
*
|
|
17
|
+
* @param env - Environment map providing `DEPLOYER_SEED` and the shared
|
|
18
|
+
* Midnight node configuration (see `getMidnightNodeConfig`).
|
|
21
19
|
* @returns The deployed contract address and deploy transaction id.
|
|
22
|
-
* @throws If
|
|
23
|
-
* wallet holds no funds, or submission fails.
|
|
20
|
+
* @throws If the deployer wallet holds no funds or submission fails.
|
|
24
21
|
*/
|
|
25
22
|
export async function deploySignetContract(env = process.env) {
|
|
26
23
|
const deployConfig = getDeployConfig(env);
|
|
27
24
|
const { networkId } = deployConfig.midnightNodeConfig;
|
|
28
|
-
const mpcPkRaw = env.MPC_JUBJUB_PK?.trim();
|
|
29
|
-
if (!mpcPkRaw) {
|
|
30
|
-
throw new Error("MPC_JUBJUB_PK is required (the MPC attestation key, as \"x,y\")");
|
|
31
|
-
}
|
|
32
|
-
const mpcPk = parseJubjubPublicKey(mpcPkRaw);
|
|
33
25
|
const accountKeys = deriveAccountKeys(deployConfig.deployerSeed, networkId);
|
|
34
26
|
console.log(`deploying signet-contract to ${networkId} (${deployConfig.midnightNodeConfig.nodeUrl})`);
|
|
35
|
-
console.log(`mpc attestation key: x=${mpcPk.x} y=${mpcPk.y}`);
|
|
36
27
|
const { contractAddress, txId } = await withSyncedWalletFacade(accountKeys, deployConfig.midnightNodeConfig, async (facade, state) => {
|
|
37
28
|
assertDeployerFunded(state);
|
|
38
|
-
const deployTransaction = await buildDeployTransaction(signetContractCompiledContract, networkId, accountKeys.shieldedSecretKeys.coinPublicKey, createSignetContractPrivateState()
|
|
29
|
+
const deployTransaction = await buildDeployTransaction(signetContractCompiledContract, networkId, accountKeys.shieldedSecretKeys.coinPublicKey, createSignetContractPrivateState());
|
|
39
30
|
console.log(`contract address (pre-submit): ${deployTransaction.contractAddress}`);
|
|
40
31
|
const submittedTxId = await submitUnprovenTransaction(facade, accountKeys, deployTransaction.serializedTransaction);
|
|
41
32
|
return { contractAddress: deployTransaction.contractAddress, txId: submittedTxId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-signet-contract.js","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"deploy-signet-contract.js","sourceRoot":"","sources":["../src/deploy-signet-contract.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,sEAAsE;AACtE,6DAA6D;AAE7D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,GAEvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gCAAgC,EAChC,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AAUtC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0C,OAAO,CAAC,GAAG;IAErD,MAAM,YAAY,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,EAAE,SAAS,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC;IAEtD,MAAM,WAAW,GAAG,iBAAiB,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAE5E,OAAO,CAAC,GAAG,CAAC,gCAAgC,SAAS,KAAK,YAAY,CAAC,kBAAkB,CAAC,OAAO,GAAG,CAAC,CAAC;IAEtG,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,MAAM,sBAAsB,CAC5D,WAAW,EACX,YAAY,CAAC,kBAAkB,EAC/B,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QACtB,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAE5B,MAAM,iBAAiB,GAAG,MAAM,sBAAsB,CACpD,8BAA8B,EAC9B,SAAS,EACT,WAAW,CAAC,kBAAkB,CAAC,aAAa,EAC5C,gCAAgC,EAAE,CACnC,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,kCAAkC,iBAAiB,CAAC,eAAe,EAAE,CAAC,CAAC;QAEnF,MAAM,aAAa,GAAG,MAAM,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.7",
|
|
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.7",
|
|
54
|
+
"@sig-net/midnight-contract": "^0.0.7",
|
|
55
55
|
"effect": "^3.21.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|