@sig-net/midnight 0.19.0 → 0.21.0-rc.1
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 +42 -2
- package/dist/abi-serde.d.ts +32 -30
- package/dist/abi-serde.d.ts.map +1 -1
- package/dist/abi-serde.js +139 -75
- package/dist/abi-serde.js.map +1 -1
- package/dist/byte-codecs.d.ts +62 -0
- package/dist/byte-codecs.d.ts.map +1 -0
- package/dist/byte-codecs.js +116 -0
- package/dist/byte-codecs.js.map +1 -0
- package/dist/compact-descriptors.d.ts +89 -0
- package/dist/compact-descriptors.d.ts.map +1 -0
- package/dist/compact-descriptors.js +139 -0
- package/dist/compact-descriptors.js.map +1 -0
- package/dist/constants.d.ts +18 -43
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +19 -45
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +66 -96
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +115 -140
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/epsilon-derivation.d.ts +24 -31
- package/dist/epsilon-derivation.d.ts.map +1 -1
- package/dist/epsilon-derivation.js +52 -62
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +0 -22
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +0 -3
- package/dist/managed/contract/index.js +102 -225
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/raw-contract-state.d.ts +25 -0
- package/dist/raw-contract-state.d.ts.map +1 -0
- package/dist/raw-contract-state.js +52 -0
- package/dist/raw-contract-state.js.map +1 -0
- package/dist/signature-requests-state-reader.d.ts +18 -44
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +82 -146
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +9 -8
- package/dist/signature-response-verification.d.ts.map +1 -1
- package/dist/signature-response-verification.js +20 -17
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-events.d.ts +67 -66
- package/dist/signet-contract-events.d.ts.map +1 -1
- package/dist/signet-contract-events.js +57 -52
- package/dist/signet-contract-events.js.map +1 -1
- package/dist/signet-evtype2tx-record-decoding.d.ts +18 -0
- package/dist/signet-evtype2tx-record-decoding.d.ts.map +1 -0
- package/dist/signet-evtype2tx-record-decoding.js +97 -0
- package/dist/signet-evtype2tx-record-decoding.js.map +1 -0
- package/dist/signet-evtype2tx-requests.d.ts +43 -87
- package/dist/signet-evtype2tx-requests.d.ts.map +1 -1
- package/dist/signet-evtype2tx-requests.js +59 -130
- package/dist/signet-evtype2tx-requests.js.map +1 -1
- package/dist/signet-request-id.d.ts +14 -0
- package/dist/signet-request-id.d.ts.map +1 -0
- package/dist/signet-request-id.js +27 -0
- package/dist/signet-request-id.js.map +1 -0
- package/dist/signet-request-response-reader.d.ts +34 -56
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +56 -68
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +28 -92
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +39 -141
- package/dist/signet-requests.js.map +1 -1
- package/dist/testing.d.ts +3 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +20 -0
- package/dist/testing.js.map +1 -0
- package/package.json +12 -3
- package/src/Signet.compact +149 -198
- package/src/circuits.compact +9 -16
- package/dist/signature-state-reading.d.ts +0 -43
- package/dist/signature-state-reading.d.ts.map +0 -1
- package/dist/signature-state-reading.js +0 -74
- package/dist/signature-state-reading.js.map +0 -1
- package/dist/signet-request-feed.d.ts +0 -126
- package/dist/signet-request-feed.d.ts.map +0 -1
- package/dist/signet-request-feed.js +0 -216
- package/dist/signet-request-feed.js.map +0 -1
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
//
|
|
3
3
|
// This belongs in github.com/sig-net/signet.js, kept here until upstreamed.
|
|
4
4
|
//
|
|
5
|
-
// v2.0.0 (COLON-separated) is the only scheme the MPC answers
|
|
6
|
-
//
|
|
7
|
-
// the Compact contracts also assert `keyVersion >= 1`, which selects v2. The
|
|
8
|
-
// two schemes hash different strings and derive different accounts, so a
|
|
9
|
-
// v1 signer silently gets the wrong address rather than an error.
|
|
5
|
+
// v2.0.0 (COLON-separated) is the only scheme the MPC answers: the Compact
|
|
6
|
+
// contracts assert `keyVersion >= 1`, which selects v2.
|
|
10
7
|
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
11
8
|
import { computeAddress, keccak256, SigningKey, toUtf8Bytes } from "ethers";
|
|
9
|
+
import { bigintToBytes32BE, bytesToBigintBE, stripHexPrefix } from "./byte-codecs.js";
|
|
12
10
|
import { SECP256K1_ORDER } from "./ecdsa-attestation.js";
|
|
13
11
|
/**
|
|
14
12
|
* Domain prefix of the sig-net v2.0.0 epsilon derivation scheme. The full
|
|
@@ -23,42 +21,50 @@ export const EPSILON_DERIVATION_PREFIX = "sig.network v2.0.0 epsilon derivation"
|
|
|
23
21
|
export const MIDNIGHT_TESTNET_CHAIN_ID = "midnight:testnet";
|
|
24
22
|
/**
|
|
25
23
|
* The FIXED derivation path of the MPC's respond-bidirectional RESPONSE key
|
|
26
|
-
* for Midnight client contracts
|
|
27
|
-
* `<chain> response key` convention
|
|
28
|
-
* chain-signatures/node/src/respond_bidirectional.rs
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* address is a hash over the deploy (constructor arguments included), so the
|
|
35
|
-
* key cannot exist before the deploy transaction is built. Client contracts
|
|
36
|
-
* therefore pin its hash with a one-shot `initialise` circuit right after
|
|
37
|
-
* deploy (never a constructor seal) and verify RespondBidirectionalEvents
|
|
38
|
-
* against the pin.
|
|
24
|
+
* for Midnight client contracts. It enters the derivation string verbatim,
|
|
25
|
+
* mirroring the real MPC's per-chain `<chain> response key` convention
|
|
26
|
+
* (sig-net/mpc chain-signatures/node/src/respond_bidirectional.rs). The
|
|
27
|
+
* response key is derived PER CLIENT CONTRACT from (the client contract's
|
|
28
|
+
* own address, this path): it is not the MPC root key and not the key that
|
|
29
|
+
* signs the requested transaction. Client contracts pin its hash with a
|
|
30
|
+
* one-shot `initialise` circuit after deploy and verify
|
|
31
|
+
* RespondBidirectionalEvents against the pin.
|
|
39
32
|
*/
|
|
40
33
|
export const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response key";
|
|
34
|
+
/**
|
|
35
|
+
* Normalise a Midnight contract address for use as the requester component
|
|
36
|
+
* of the derivation string: strip an optional `0x` prefix and lowercase.
|
|
37
|
+
* Both sides of the protocol (the deploy pinning a key and the MPC signing
|
|
38
|
+
* with it) derive through this, so the rendering always agrees.
|
|
39
|
+
*
|
|
40
|
+
* @param contractAddress - The Midnight contract address, with or without `0x`.
|
|
41
|
+
* @returns The address as lowercase hex with no prefix.
|
|
42
|
+
*/
|
|
43
|
+
function normaliseRequesterAddress(contractAddress) {
|
|
44
|
+
return stripHexPrefix(contractAddress).toLowerCase();
|
|
45
|
+
}
|
|
41
46
|
/**
|
|
42
47
|
* Derive the EVM address the MPC network signs from for a given Midnight
|
|
43
48
|
* contract and derivation path, using the sig-net v2.0.0 epsilon scheme:
|
|
44
|
-
* `epsilon = keccak256("<prefix>:<chainId>:<
|
|
45
|
-
* `derivedPubKey = mpcRootPubKey + epsilon * G` on secp256k1.
|
|
46
|
-
*
|
|
47
|
-
* The MPC treats `path` as an opaque string: the vault's own account uses the
|
|
48
|
-
* literal path `"vault"`, a user's account uses the lowercase hex of their
|
|
49
|
-
* identity commitment.
|
|
49
|
+
* `epsilon = keccak256("<prefix>:<chainId>:<requester>:<path>")` and
|
|
50
|
+
* `derivedPubKey = mpcRootPubKey + epsilon * G` on secp256k1. The MPC
|
|
51
|
+
* treats `path` as an opaque string.
|
|
50
52
|
*
|
|
51
53
|
* @param mpcSecp256k1PubkeyHex - The MPC root secp256k1 public key as 0x-hex
|
|
52
|
-
* (compressed or uncompressed
|
|
54
|
+
* (compressed or uncompressed, normalised internally).
|
|
53
55
|
* @param contractAddress - The Midnight contract address the request
|
|
54
|
-
* originates from (
|
|
55
|
-
*
|
|
56
|
-
*
|
|
56
|
+
* originates from (`0x` prefix optional, case-insensitive: it enters the
|
|
57
|
+
* derivation string through {@link normaliseRequesterAddress}).
|
|
58
|
+
* @param path - The derivation path string. For an account derived from an
|
|
59
|
+
* on-ledger request record, this is the MPC's rendering of the record's
|
|
60
|
+
* `path: Bytes<32>`: the lowercase hex of the FULL 32 bytes, no `0x`
|
|
61
|
+
* prefix and no trimming ({@link bytesToHex} of the raw bytes), so
|
|
62
|
+
* `0xab..00` and `0xab..` derive different accounts.
|
|
57
63
|
* @param chainId - CAIP-2 chain id component of the derivation string.
|
|
58
64
|
* @returns The derived EVM address as a 0x-prefixed EIP-55 checksummed string.
|
|
59
65
|
*/
|
|
60
66
|
export function deriveEvmAddress(mpcSecp256k1PubkeyHex, contractAddress, path, chainId = MIDNIGHT_TESTNET_CHAIN_ID) {
|
|
61
|
-
const derivedPoint = deriveChildPoint(mpcSecp256k1PubkeyHex, contractAddress, path, chainId);
|
|
67
|
+
const derivedPoint = deriveChildPoint(mpcSecp256k1PubkeyHex, normaliseRequesterAddress(contractAddress), path, chainId);
|
|
62
68
|
return computeAddress(`0x${derivedPoint.toHex(false)}`);
|
|
63
69
|
}
|
|
64
70
|
/**
|
|
@@ -79,32 +85,26 @@ export function deriveEpsilon(requester, path, chainId = MIDNIGHT_TESTNET_CHAIN_
|
|
|
79
85
|
// server's scalar arithmetic reduces implicitly.
|
|
80
86
|
return BigInt(keccak256(toUtf8Bytes(fullPath))) % SECP256K1_ORDER;
|
|
81
87
|
}
|
|
82
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Derive the child public key as a noble curve point (internal shape).
|
|
90
|
+
*
|
|
91
|
+
* @param mpcSecp256k1PubkeyHex - The MPC root public key in SEC1 hex.
|
|
92
|
+
* @param requester - The normalised requester address.
|
|
93
|
+
* @param path - The derivation path component.
|
|
94
|
+
* @param chainId - The chain id component.
|
|
95
|
+
* @returns The derived child point on secp256k1.
|
|
96
|
+
*/
|
|
83
97
|
function deriveChildPoint(mpcSecp256k1PubkeyHex, requester, path, chainId) {
|
|
84
98
|
const epsilon = deriveEpsilon(requester, path, chainId);
|
|
85
99
|
const rootPubKeyHex = SigningKey.computePublicKey(mpcSecp256k1PubkeyHex, false);
|
|
86
100
|
const rootPoint = secp256k1.Point.fromHex(rootPubKeyHex.slice(2));
|
|
87
101
|
return epsilon === 0n ? rootPoint : rootPoint.add(secp256k1.Point.BASE.multiply(epsilon));
|
|
88
102
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Normalise a Midnight contract address for use as the requester component
|
|
91
|
-
* of the derivation string: strip an optional `0x` prefix and lowercase.
|
|
92
|
-
* Both sides of the protocol (the deploy pinning a key and the MPC signing
|
|
93
|
-
* with it) derive through this, so the rendering always agrees.
|
|
94
|
-
*/
|
|
95
|
-
function normaliseRequesterAddress(contractAddress) {
|
|
96
|
-
const hex = contractAddress.startsWith("0x") || contractAddress.startsWith("0X")
|
|
97
|
-
? contractAddress.slice(2)
|
|
98
|
-
: contractAddress;
|
|
99
|
-
return hex.toLowerCase();
|
|
100
|
-
}
|
|
101
103
|
/**
|
|
102
104
|
* Derive the MPC's respond-bidirectional RESPONSE key for one client
|
|
103
105
|
* contract, public side: what the client pins via its `initialise` circuit
|
|
104
|
-
*
|
|
105
|
-
* {@link MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH} for the scheme
|
|
106
|
-
* is the client contract's own address, mirroring the real MPC's
|
|
107
|
-
* sender-scoped derivation).
|
|
106
|
+
* and what response verification checks against. See
|
|
107
|
+
* {@link MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH} for the scheme.
|
|
108
108
|
*
|
|
109
109
|
* @param mpcSecp256k1PubkeyHex - The MPC root secp256k1 public key as 0x-hex
|
|
110
110
|
* (compressed or uncompressed).
|
|
@@ -120,34 +120,24 @@ export function deriveMidnightResponseKey(mpcSecp256k1PubkeyHex, clientContractA
|
|
|
120
120
|
* Derive the MPC's respond-bidirectional RESPONSE key for one client
|
|
121
121
|
* contract, secret side: `(rootSecret + epsilon) mod n`. MPC-side only
|
|
122
122
|
* (the fakenet signer, test harnesses): a real client never holds the root
|
|
123
|
-
* key.
|
|
123
|
+
* key.
|
|
124
124
|
*
|
|
125
|
-
* @param mpcRootSecretKey - The 32-byte MPC root secret key (big-endian
|
|
126
|
-
* standard secp256k1 encoding).
|
|
125
|
+
* @param mpcRootSecretKey - The 32-byte MPC root secret key (big-endian).
|
|
127
126
|
* @param clientContractAddress - The client contract's Midnight address
|
|
128
127
|
* (`0x` prefix optional, case-insensitive).
|
|
129
128
|
* @returns The 32-byte response secret key (big-endian).
|
|
130
|
-
* @throws Error
|
|
129
|
+
* @throws {Error} If the root key is not 32 bytes or the derived scalar is 0.
|
|
131
130
|
*/
|
|
132
131
|
export function deriveMidnightResponseSecretKey(mpcRootSecretKey, clientContractAddress) {
|
|
133
132
|
if (mpcRootSecretKey.length !== 32) {
|
|
134
|
-
throw new Error(`MPC root secret key must be 32 bytes, got ${mpcRootSecretKey.length}`);
|
|
135
|
-
}
|
|
136
|
-
let root = 0n;
|
|
137
|
-
for (const byte of mpcRootSecretKey) {
|
|
138
|
-
root = (root << 8n) | BigInt(byte);
|
|
133
|
+
throw new Error(`MPC root secret key must be 32 bytes, got ${String(mpcRootSecretKey.length)}`);
|
|
139
134
|
}
|
|
135
|
+
const root = bytesToBigintBE(mpcRootSecretKey);
|
|
140
136
|
const epsilon = deriveEpsilon(normaliseRequesterAddress(clientContractAddress), MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH, MIDNIGHT_TESTNET_CHAIN_ID);
|
|
141
137
|
const child = (root + epsilon) % SECP256K1_ORDER;
|
|
142
138
|
if (child === 0n) {
|
|
143
139
|
throw new Error("derived response secret key is zero (invalid scalar)");
|
|
144
140
|
}
|
|
145
|
-
|
|
146
|
-
let value = child;
|
|
147
|
-
for (let i = 31; i >= 0; i--) {
|
|
148
|
-
out[i] = Number(value & 0xffn);
|
|
149
|
-
value >>= 8n;
|
|
150
|
-
}
|
|
151
|
-
return out;
|
|
141
|
+
return bigintToBytes32BE(child);
|
|
152
142
|
}
|
|
153
143
|
//# sourceMappingURL=epsilon-derivation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epsilon-derivation.js","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"epsilon-derivation.js","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,2EAA2E;AAC3E,wDAAwD;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAuB,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,uCAAuC,CAAC;AAEjF;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;;;;;;GAQG;AACH,SAAS,yBAAyB,CAAC,eAAuB;IACxD,OAAO,cAAc,CAAC,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,CAAC;AAC5F,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CACvC,qBAA6B,EAC7B,qBAA6B;IAE7B,MAAM,KAAK,GAAG,gBAAgB,CAC5B,qBAAqB,EACrB,yBAAyB,CAAC,qBAAqB,CAAC,EAChD,mCAAmC,EACnC,yBAAyB,CAC1B,CAAC;IACF,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAA4B,EAC5B,qBAA6B;IAE7B,IAAI,gBAAgB,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,6CAA6C,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;IACD,MAAM,IAAI,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,aAAa,CAC3B,yBAAyB,CAAC,qBAAqB,CAAC,EAChD,mCAAmC,EACnC,yBAAyB,CAC1B,CAAC;IACF,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,eAAe,CAAC;IACjD,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export * from "./abi-serde.ts";
|
|
2
|
-
export
|
|
3
|
-
export * from "./
|
|
4
|
-
export
|
|
2
|
+
export { bigintToBytes32, bigintToBytes32BE, BLS_ORDER, bytesToBigint, bytesToBigintBE, bytesToHex, hexToBytes, stripHexPrefix, } from "./byte-codecs.ts";
|
|
3
|
+
export * from "./constants.ts";
|
|
4
|
+
export { deriveEpsilon, deriveEvmAddress, deriveMidnightResponseKey, EPSILON_DERIVATION_PREFIX, MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH, MIDNIGHT_TESTNET_CHAIN_ID, } from "./epsilon-derivation.ts";
|
|
5
|
+
export { type RawContractState, signetFieldNodeByPath } from "./raw-contract-state.ts";
|
|
5
6
|
export * from "./signature-requests-state-reader.ts";
|
|
6
|
-
export * from "./signet-contract-events.ts";
|
|
7
7
|
export * from "./signature-response-verification.ts";
|
|
8
|
+
export * from "./signet-contract-events.ts";
|
|
9
|
+
export { abiWordToBool, abiWordToUint128, assembleCalldata, boolAbiWord, type EvmAccessListEntry, evmAddressAbiWord, type EvmCalldata, type EvmType2TxParams, numericAbiWord, signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.ts";
|
|
10
|
+
export { calculateRequestId } from "./signet-request-id.ts";
|
|
8
11
|
export * from "./signet-request-response-reader.ts";
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export * from "./epsilon-derivation.ts";
|
|
12
|
-
export * from "./ecdsa-attestation.ts";
|
|
12
|
+
export { type ContractAddress, type Maybe, MPCDestination, MPCSignatureAlgorithm, parseRequestIdHex, PATH_BYTES, type RequestId, requestIdBytes, type RequestIdHex, requestIdHex, type SignBidirectionalEvent, type SignBidirectionalEventIndex, type SignBidirectionalEventLedgerMap, toSignBidirectionalEventIndex, TxParamType, } from "./signet-requests.ts";
|
|
13
|
+
export { formatSecp256k1PublicKey, parseSecp256k1PublicKey, respondBidirectionalEventToCircuitInput, SECP256K1_ORDER, type Secp256k1Point, signatureRespondedEventToSignature, verifyRespondBidirectionalSignature, } from "./ecdsa-attestation.ts";
|
|
13
14
|
/**
|
|
14
15
|
* Compiled pure circuits of Signet.compact (run `yarn compile` first).
|
|
15
16
|
* Off-chain code MUST use these instead of re-porting the algorithms:
|
|
16
17
|
* they are the same compiled logic the contracts prove.
|
|
17
18
|
*/
|
|
18
|
-
export {
|
|
19
|
+
export { type PureCircuits, pureCircuits } from "./managed/contract/index.js";
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAI1B,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,mCAAmC,EACnC,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACvF,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,cAAc,EACd,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,KAAK,SAAS,EACd,cAAc,EACd,KAAK,YAAY,EACjB,YAAY,EACZ,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,6BAA6B,EAC7B,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uCAAuC,EACvC,eAAe,EACf,KAAK,cAAc,EACnB,kCAAkC,EAClC,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,OAAO,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,17 +2,26 @@
|
|
|
2
2
|
// library (wire structs, state readers, event decoders, request feed,
|
|
3
3
|
// crypto) plus the compiled pure circuits of the shared Compact module.
|
|
4
4
|
export * from "./abi-serde.js";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export { bigintToBytes32, bigintToBytes32BE, BLS_ORDER, bytesToBigint, bytesToBigintBE, bytesToHex, hexToBytes, stripHexPrefix, } from "./byte-codecs.js";
|
|
6
|
+
// Explicit lists for the request/state modules: the runtime descriptor
|
|
7
|
+
// toolkit (compact-descriptors.ts and the per-module record descriptors) is
|
|
8
|
+
// package-internal, consumed only through the reader and request functions.
|
|
9
|
+
export * from "./constants.js";
|
|
10
|
+
// Selective: deriveMidnightResponseSecretKey takes the MPC root secret, so
|
|
11
|
+
// it is exported through ./testing with the other secret-taking helpers.
|
|
12
|
+
export { deriveEpsilon, deriveEvmAddress, deriveMidnightResponseKey, EPSILON_DERIVATION_PREFIX, MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH, MIDNIGHT_TESTNET_CHAIN_ID, } from "./epsilon-derivation.js";
|
|
13
|
+
export { signetFieldNodeByPath } from "./raw-contract-state.js";
|
|
8
14
|
export * from "./signature-requests-state-reader.js";
|
|
9
|
-
export * from "./signet-contract-events.js";
|
|
10
15
|
export * from "./signature-response-verification.js";
|
|
16
|
+
export * from "./signet-contract-events.js";
|
|
17
|
+
export { abiWordToBool, abiWordToUint128, assembleCalldata, boolAbiWord, evmAddressAbiWord, numericAbiWord, signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.js";
|
|
18
|
+
export { calculateRequestId } from "./signet-request-id.js";
|
|
11
19
|
export * from "./signet-request-response-reader.js";
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
export { MPCDestination, MPCSignatureAlgorithm, parseRequestIdHex, PATH_BYTES, requestIdBytes, requestIdHex, toSignBidirectionalEventIndex, TxParamType, } from "./signet-requests.js";
|
|
21
|
+
// Explicit list: ecdsa-attestation.ts also backs the ./testing entry point
|
|
22
|
+
// (the attestation-minting helpers that take a secret key live THERE), and
|
|
23
|
+
// its record decoder (mpcSignatureToEcdsaSignature) is package-internal.
|
|
24
|
+
export { formatSecp256k1PublicKey, parseSecp256k1PublicKey, respondBidirectionalEventToCircuitInput, SECP256K1_ORDER, signatureRespondedEventToSignature, verifyRespondBidirectionalSignature, } from "./ecdsa-attestation.js";
|
|
16
25
|
/**
|
|
17
26
|
* Compiled pure circuits of Signet.compact (run `yarn compile` first).
|
|
18
27
|
* Off-chain code MUST use these instead of re-porting the algorithms:
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,sEAAsE;AACtE,wEAAwE;AAExE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,sEAAsE;AACtE,wEAAwE;AAExE,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,eAAe,E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k",
|
|
74
|
-
"type": {
|
|
75
|
-
"type-name": "Alias",
|
|
76
|
-
"name": "Secp256k1Point",
|
|
77
|
-
"type": {
|
|
78
|
-
"type-name": "Opaque",
|
|
79
|
-
"tsType": "Secp256k1Point"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"result-type": {
|
|
85
|
-
"type-name": "Bytes",
|
|
86
|
-
"length": 32
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
67
|
{
|
|
90
68
|
"name": "evmAddressAbiWord",
|
|
91
69
|
"pure": true,
|
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
"type": "directory",
|
|
8
8
|
"contract-info.json": {
|
|
9
9
|
"type": "file",
|
|
10
|
-
"size":
|
|
11
|
-
"hash": "
|
|
10
|
+
"size": 7740,
|
|
11
|
+
"hash": "90cf4d016fbbcfae53716bb2849b230df5593d2d0e3c63cf7b0eea54a4c7b429"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"contract": {
|
|
15
15
|
"type": "directory",
|
|
16
16
|
"index.d.ts": {
|
|
17
17
|
"type": "file",
|
|
18
|
-
"size":
|
|
19
|
-
"hash": "
|
|
18
|
+
"size": 6274,
|
|
19
|
+
"hash": "a8033193fc158fb0432c3636d04670db812a2ba97c22f5e669ae77e4d3dac0cd"
|
|
20
20
|
},
|
|
21
21
|
"index.js": {
|
|
22
22
|
"type": "file",
|
|
23
|
-
"size":
|
|
24
|
-
"hash": "
|
|
23
|
+
"size": 38481,
|
|
24
|
+
"hash": "b9a95365410dd59527b651a0b6c4f96b464667f6bd3d0f30bb3f393a2d2a9e3d"
|
|
25
25
|
},
|
|
26
26
|
"index.js.map": {
|
|
27
27
|
"type": "file",
|
|
28
|
-
"size":
|
|
29
|
-
"hash": "
|
|
28
|
+
"size": 4291,
|
|
29
|
+
"hash": "813db2ccfb2cc310777b361899a7213f2734aea8e09566072e5aaa30380e2b80"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -16,7 +16,6 @@ export type PureCircuits = {
|
|
|
16
16
|
requestsPath_0: bigint[]): { version: bigint,
|
|
17
17
|
payload: Uint8Array
|
|
18
18
|
};
|
|
19
|
-
signetKeyHash(pk_0: __compactRuntime.Secp256k1Point): Uint8Array;
|
|
20
19
|
evmAddressAbiWord(addr_0: Uint8Array): Uint8Array;
|
|
21
20
|
numericAbiWord(value_0: bigint): Uint8Array;
|
|
22
21
|
boolAbiWord(value_0: boolean): Uint8Array;
|
|
@@ -48,8 +47,6 @@ export type Circuits<PS> = {
|
|
|
48
47
|
requestsPath_0: bigint[]): Promise<__compactRuntime.CircuitResults<PS, { version: bigint,
|
|
49
48
|
payload: Uint8Array
|
|
50
49
|
}>>;
|
|
51
|
-
signetKeyHash(context: __compactRuntime.CircuitContext<PS>,
|
|
52
|
-
pk_0: __compactRuntime.Secp256k1Point): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
|
|
53
50
|
evmAddressAbiWord(context: __compactRuntime.CircuitContext<PS>,
|
|
54
51
|
addr_0: Uint8Array): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
|
|
55
52
|
numericAbiWord(context: __compactRuntime.CircuitContext<PS>, value_0: bigint): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
|