@sig-net/midnight 0.0.7 → 0.0.9

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.
Files changed (35) hide show
  1. package/dist/epsilon-derivation.d.ts +25 -25
  2. package/dist/epsilon-derivation.d.ts.map +1 -1
  3. package/dist/epsilon-derivation.js +27 -27
  4. package/dist/epsilon-derivation.js.map +1 -1
  5. package/dist/index.d.ts +5 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +5 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/managed/compiler/contract-info.json +54 -0
  10. package/dist/managed/compiler/contract-manifest.json +8 -8
  11. package/dist/managed/contract/index.d.ts +8 -0
  12. package/dist/managed/contract/index.js +250 -35
  13. package/dist/managed/contract/index.js.map +1 -1
  14. package/dist/signature-requests-state-reader.d.ts.map +1 -1
  15. package/dist/signature-requests-state-reader.js +2 -1
  16. package/dist/signature-requests-state-reader.js.map +1 -1
  17. package/dist/signature-response-verification.d.ts +1 -1
  18. package/dist/signature-response-verification.d.ts.map +1 -1
  19. package/dist/signature-response-verification.js +1 -1
  20. package/dist/signature-response-verification.js.map +1 -1
  21. package/dist/signet-evtype2tx-requests.d.ts +228 -0
  22. package/dist/signet-evtype2tx-requests.d.ts.map +1 -0
  23. package/dist/signet-evtype2tx-requests.js +340 -0
  24. package/dist/signet-evtype2tx-requests.js.map +1 -0
  25. package/dist/signet-request-response-reader.d.ts +1 -1
  26. package/dist/signet-request-response-reader.d.ts.map +1 -1
  27. package/dist/signet-request-response-reader.js +1 -1
  28. package/dist/signet-request-response-reader.js.map +1 -1
  29. package/dist/signet-requests.d.ts +36 -202
  30. package/dist/signet-requests.d.ts.map +1 -1
  31. package/dist/signet-requests.js +29 -298
  32. package/dist/signet-requests.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/Signet.compact +57 -3
  35. package/src/circuits.compact +4 -1
@@ -12,20 +12,19 @@ export declare const EPSILON_DERIVATION_PREFIX = "sig.network v1.0.0 epsilon der
12
12
  export declare const MIDNIGHT_TESTNET_CHAIN_ID = "midnight:testnet";
13
13
  /**
14
14
  * The FIXED derivation path of the MPC's respond-bidirectional RESPONSE key
15
- * for Midnight client contracts (mirrors the MPC's per-chain
16
- * `<chain> response key` convention, sig-net/mpc
17
- * chain-signatures/node/src/respond_bidirectional.rs). The response key is
18
- * derived from (the SIGNET SINGLETON contract address, this path): it is not
19
- * the MPC root key and not the key that signs the requested transaction.
20
- * Client contracts pin its hash at deploy time and verify
21
- * RespondBidirectionalEvents against it.
15
+ * for Midnight client contracts, mirroring the real MPC's per-chain
16
+ * `<chain> response key` convention (sig-net/mpc
17
+ * chain-signatures/node/src/respond_bidirectional.rs, where the epsilon
18
+ * requester is the requesting tx's SENDER). The response key is derived PER
19
+ * CLIENT CONTRACT from (the client contract's own address, this path): it is
20
+ * not the MPC root key and not the key that signs the requested transaction.
22
21
  *
23
- * Why the SIGNET address and not the client contract's own address: the pin
24
- * is sealed in the client's CONSTRUCTOR, and a Midnight contract address is
25
- * a hash over the deploy (constructor arguments included), so a key derived
26
- * from the client's own address could never be known at the moment it must
27
- * be sealed. The signet singleton deploys first, so its address is available
28
- * to every client deploy, and the key stays scoped per signet deployment.
22
+ * The key depends on the client contract's address, and a Midnight contract
23
+ * address is a hash over the deploy (constructor arguments included), so the
24
+ * key cannot exist before the deploy transaction is built. Client contracts
25
+ * therefore pin its hash with a one-shot `initialise` circuit right after
26
+ * deploy (never a constructor seal) and verify RespondBidirectionalEvents
27
+ * against the pin.
29
28
  */
30
29
  export declare const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response key";
31
30
  /**
@@ -62,31 +61,32 @@ export declare function deriveEvmAddress(mpcSecp256k1PubkeyHex: string, contract
62
61
  */
63
62
  export declare function deriveEpsilon(requester: string, path: string, chainId?: string): bigint;
64
63
  /**
65
- * Derive the MPC's respond-bidirectional RESPONSE key for a signet
66
- * deployment, public side: what client-contract deploys pin
64
+ * Derive the MPC's respond-bidirectional RESPONSE key for one client
65
+ * contract, public side: what the client pins via its `initialise` circuit
67
66
  * (`MPC_RESPONSE_KEY`) and what response verification checks against. See
68
- * {@link MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH} for the scheme and why the
69
- * requester is the signet singleton's address.
67
+ * {@link MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH} for the scheme (the requester
68
+ * is the client contract's own address, mirroring the real MPC's
69
+ * sender-scoped derivation).
70
70
  *
71
71
  * @param mpcSecp256k1PubkeyHex - The MPC root secp256k1 public key as 0x-hex
72
72
  * (compressed or uncompressed).
73
- * @param signetContractAddress - The signet singleton's Midnight contract
74
- * address (`0x` prefix optional, case-insensitive).
73
+ * @param clientContractAddress - The client contract's Midnight address
74
+ * (`0x` prefix optional, case-insensitive).
75
75
  * @returns The response public key as a Compact-runtime `Secp256k1Point`.
76
76
  */
77
- export declare function deriveMidnightResponseKey(mpcSecp256k1PubkeyHex: string, signetContractAddress: string): Secp256k1Point;
77
+ export declare function deriveMidnightResponseKey(mpcSecp256k1PubkeyHex: string, clientContractAddress: string): Secp256k1Point;
78
78
  /**
79
- * Derive the MPC's respond-bidirectional RESPONSE key for a signet
80
- * deployment, secret side: `(rootSecret + epsilon) mod n`. MPC-side only
79
+ * Derive the MPC's respond-bidirectional RESPONSE key for one client
80
+ * contract, secret side: `(rootSecret + epsilon) mod n`. MPC-side only
81
81
  * (the fakenet signer, test harnesses): a real client never holds the root
82
82
  * key. The result feeds `signAttestationDigest` directly.
83
83
  *
84
84
  * @param mpcRootSecretKey - The 32-byte MPC root secret key (big-endian, the
85
85
  * standard secp256k1 encoding).
86
- * @param signetContractAddress - The signet singleton's Midnight contract
87
- * address (`0x` prefix optional, case-insensitive).
86
+ * @param clientContractAddress - The client contract's Midnight address
87
+ * (`0x` prefix optional, case-insensitive).
88
88
  * @returns The 32-byte response secret key (big-endian).
89
89
  * @throws Error if the root key is not 32 bytes or the derived scalar is 0.
90
90
  */
91
- export declare function deriveMidnightResponseSecretKey(mpcRootSecretKey: Uint8Array, signetContractAddress: string): Uint8Array;
91
+ export declare function deriveMidnightResponseSecretKey(mpcRootSecretKey: Uint8Array, clientContractAddress: string): Uint8Array;
92
92
  //# sourceMappingURL=epsilon-derivation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"epsilon-derivation.d.ts","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAeA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,0CAA0C,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mCAAmC,0BAA0B,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,qBAAqB,EAAE,MAAM,EAC7B,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAkC,GAC1C,MAAM,CAGR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAkC,GAC1C,MAAM,CAKR;AA6BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,qBAAqB,EAAE,MAAM,EAC7B,qBAAqB,EAAE,MAAM,GAC5B,cAAc,CAQhB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,UAAU,EAC5B,qBAAqB,EAAE,MAAM,GAC5B,UAAU,CAwBZ"}
1
+ {"version":3,"file":"epsilon-derivation.d.ts","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAeA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,0CAA0C,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mCAAmC,0BAA0B,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,qBAAqB,EAAE,MAAM,EAC7B,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAkC,GAC1C,MAAM,CAGR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAkC,GAC1C,MAAM,CAKR;AA6BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,qBAAqB,EAAE,MAAM,EAC7B,qBAAqB,EAAE,MAAM,GAC5B,cAAc,CAQhB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,UAAU,EAC5B,qBAAqB,EAAE,MAAM,GAC5B,UAAU,CAwBZ"}
@@ -25,20 +25,19 @@ export const EPSILON_DERIVATION_PREFIX = "sig.network v1.0.0 epsilon derivation"
25
25
  export const MIDNIGHT_TESTNET_CHAIN_ID = "midnight:testnet";
26
26
  /**
27
27
  * The FIXED derivation path of the MPC's respond-bidirectional RESPONSE key
28
- * for Midnight client contracts (mirrors the MPC's per-chain
29
- * `<chain> response key` convention, sig-net/mpc
30
- * chain-signatures/node/src/respond_bidirectional.rs). The response key is
31
- * derived from (the SIGNET SINGLETON contract address, this path): it is not
32
- * the MPC root key and not the key that signs the requested transaction.
33
- * Client contracts pin its hash at deploy time and verify
34
- * RespondBidirectionalEvents against it.
28
+ * for Midnight client contracts, mirroring the real MPC's per-chain
29
+ * `<chain> response key` convention (sig-net/mpc
30
+ * chain-signatures/node/src/respond_bidirectional.rs, where the epsilon
31
+ * requester is the requesting tx's SENDER). The response key is derived PER
32
+ * CLIENT CONTRACT from (the client contract's own address, this path): it is
33
+ * not the MPC root key and not the key that signs the requested transaction.
35
34
  *
36
- * Why the SIGNET address and not the client contract's own address: the pin
37
- * is sealed in the client's CONSTRUCTOR, and a Midnight contract address is
38
- * a hash over the deploy (constructor arguments included), so a key derived
39
- * from the client's own address could never be known at the moment it must
40
- * be sealed. The signet singleton deploys first, so its address is available
41
- * to every client deploy, and the key stays scoped per signet deployment.
35
+ * The key depends on the client contract's address, and a Midnight contract
36
+ * address is a hash over the deploy (constructor arguments included), so the
37
+ * key cannot exist before the deploy transaction is built. Client contracts
38
+ * therefore pin its hash with a one-shot `initialise` circuit right after
39
+ * deploy (never a constructor seal) and verify RespondBidirectionalEvents
40
+ * against the pin.
42
41
  */
43
42
  export const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response key";
44
43
  /**
@@ -102,36 +101,37 @@ function normaliseRequesterAddress(contractAddress) {
102
101
  return hex.toLowerCase();
103
102
  }
104
103
  /**
105
- * Derive the MPC's respond-bidirectional RESPONSE key for a signet
106
- * deployment, public side: what client-contract deploys pin
104
+ * Derive the MPC's respond-bidirectional RESPONSE key for one client
105
+ * contract, public side: what the client pins via its `initialise` circuit
107
106
  * (`MPC_RESPONSE_KEY`) and what response verification checks against. See
108
- * {@link MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH} for the scheme and why the
109
- * requester is the signet singleton's address.
107
+ * {@link MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH} for the scheme (the requester
108
+ * is the client contract's own address, mirroring the real MPC's
109
+ * sender-scoped derivation).
110
110
  *
111
111
  * @param mpcSecp256k1PubkeyHex - The MPC root secp256k1 public key as 0x-hex
112
112
  * (compressed or uncompressed).
113
- * @param signetContractAddress - The signet singleton's Midnight contract
114
- * address (`0x` prefix optional, case-insensitive).
113
+ * @param clientContractAddress - The client contract's Midnight address
114
+ * (`0x` prefix optional, case-insensitive).
115
115
  * @returns The response public key as a Compact-runtime `Secp256k1Point`.
116
116
  */
117
- export function deriveMidnightResponseKey(mpcSecp256k1PubkeyHex, signetContractAddress) {
118
- const point = deriveChildPoint(mpcSecp256k1PubkeyHex, normaliseRequesterAddress(signetContractAddress), MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH, MIDNIGHT_TESTNET_CHAIN_ID);
117
+ export function deriveMidnightResponseKey(mpcSecp256k1PubkeyHex, clientContractAddress) {
118
+ const point = deriveChildPoint(mpcSecp256k1PubkeyHex, normaliseRequesterAddress(clientContractAddress), MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH, MIDNIGHT_TESTNET_CHAIN_ID);
119
119
  return { x: point.x, y: point.y, identity: false };
120
120
  }
121
121
  /**
122
- * Derive the MPC's respond-bidirectional RESPONSE key for a signet
123
- * deployment, secret side: `(rootSecret + epsilon) mod n`. MPC-side only
122
+ * Derive the MPC's respond-bidirectional RESPONSE key for one client
123
+ * contract, secret side: `(rootSecret + epsilon) mod n`. MPC-side only
124
124
  * (the fakenet signer, test harnesses): a real client never holds the root
125
125
  * key. The result feeds `signAttestationDigest` directly.
126
126
  *
127
127
  * @param mpcRootSecretKey - The 32-byte MPC root secret key (big-endian, the
128
128
  * standard secp256k1 encoding).
129
- * @param signetContractAddress - The signet singleton's Midnight contract
130
- * address (`0x` prefix optional, case-insensitive).
129
+ * @param clientContractAddress - The client contract's Midnight address
130
+ * (`0x` prefix optional, case-insensitive).
131
131
  * @returns The 32-byte response secret key (big-endian).
132
132
  * @throws Error if the root key is not 32 bytes or the derived scalar is 0.
133
133
  */
134
- export function deriveMidnightResponseSecretKey(mpcRootSecretKey, signetContractAddress) {
134
+ export function deriveMidnightResponseSecretKey(mpcRootSecretKey, clientContractAddress) {
135
135
  if (mpcRootSecretKey.length !== 32) {
136
136
  throw new Error(`MPC root secret key must be 32 bytes, got ${mpcRootSecretKey.length}`);
137
137
  }
@@ -139,7 +139,7 @@ export function deriveMidnightResponseSecretKey(mpcRootSecretKey, signetContract
139
139
  for (const byte of mpcRootSecretKey) {
140
140
  root = (root << 8n) | BigInt(byte);
141
141
  }
142
- const epsilon = deriveEpsilon(normaliseRequesterAddress(signetContractAddress), MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH, MIDNIGHT_TESTNET_CHAIN_ID);
142
+ const epsilon = deriveEpsilon(normaliseRequesterAddress(clientContractAddress), MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH, MIDNIGHT_TESTNET_CHAIN_ID);
143
143
  const child = (root + epsilon) % SECP256K1_ORDER;
144
144
  if (child === 0n) {
145
145
  throw new Error("derived response secret key is zero (invalid scalar)");
@@ -1 +1 @@
1
- {"version":3,"file":"epsilon-derivation.js","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,uDAAuD;AACvD,0EAA0E;AAC1E,uEAAuE;AACvE,oDAAoD;AACpD,4EAA4E;AAC5E,yEAAyE;AACzE,sBAAsB;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5E,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;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,qBAA6B,EAC7B,eAAuB,EACvB,IAAY,EACZ,UAAkB,yBAAyB;IAE3C,MAAM,YAAY,GAAG,gBAAgB,CAAC,qBAAqB,EAAE,eAAe,EAAE,IAAI,E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+1,5 @@
1
1
  export * from "./signet-requests.ts";
2
+ export * from "./signet-evtype2tx-requests.ts";
2
3
  export * from "./signature-state-reading.ts";
3
4
  export * from "./signature-requests-state-reader.ts";
4
5
  export * from "./signet-contract-state-reader.ts";
@@ -14,8 +15,10 @@ export * from "./ecdsa-attestation.ts";
14
15
  * executable reference implementation of the client-agnostic circuits —
15
16
  * the attestation digest (`signetAttestationDigest`), response verification
16
17
  * (`verifyRespondBidirectionalEvent`), the deploy-time key pin
17
- * (`signetKeyHash`), and the notification packer
18
- * (`constructSignBidirectionalEventNotificationV1`). Off-chain code MUST use
18
+ * (`signetKeyHash`), the notification packer
19
+ * (`constructSignBidirectionalEventNotificationV1`), and the ABI word
20
+ * builders/reader (`evmAddressAbiWord`, `numericAbiWord`,
21
+ * `abiWordToUint128`). Off-chain code MUST use
19
22
  * these instead of re-porting the algorithms — they are the same compiled
20
23
  * logic the contracts prove. The generic request circuits cannot be compiled
21
24
  * here (type-parameterized): request construction is contract-only, and
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // library (wire structs, state readers, request feed/resolver, crypto) plus
3
3
  // the compiled pure circuits of the shared Compact module.
4
4
  export * from "./signet-requests.js";
5
+ export * from "./signet-evtype2tx-requests.js";
5
6
  export * from "./signature-state-reading.js";
6
7
  export * from "./signature-requests-state-reader.js";
7
8
  export * from "./signet-contract-state-reader.js";
@@ -17,8 +18,10 @@ export * from "./ecdsa-attestation.js";
17
18
  * executable reference implementation of the client-agnostic circuits —
18
19
  * the attestation digest (`signetAttestationDigest`), response verification
19
20
  * (`verifyRespondBidirectionalEvent`), the deploy-time key pin
20
- * (`signetKeyHash`), and the notification packer
21
- * (`constructSignBidirectionalEventNotificationV1`). Off-chain code MUST use
21
+ * (`signetKeyHash`), the notification packer
22
+ * (`constructSignBidirectionalEventNotificationV1`), and the ABI word
23
+ * builders/reader (`evmAddressAbiWord`, `numericAbiWord`,
24
+ * `abiWordToUint128`). Off-chain code MUST use
22
25
  * these instead of re-porting the algorithms — they are the same compiled
23
26
  * logic the contracts prove. The generic request circuits cannot be compiled
24
27
  * here (type-parameterized): request construction is contract-only, and
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,2DAA2D;AAE3D,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,2DAA2D;AAE3D,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC"}
@@ -186,6 +186,60 @@
186
186
  "type-name": "Bytes",
187
187
  "length": 32
188
188
  }
189
+ },
190
+ {
191
+ "name": "evmAddressAbiWord",
192
+ "pure": true,
193
+ "proof": false,
194
+ "arguments": [
195
+ {
196
+ "name": "addr",
197
+ "type": {
198
+ "type-name": "Bytes",
199
+ "length": 20
200
+ }
201
+ }
202
+ ],
203
+ "result-type": {
204
+ "type-name": "Bytes",
205
+ "length": 32
206
+ }
207
+ },
208
+ {
209
+ "name": "numericAbiWord",
210
+ "pure": true,
211
+ "proof": false,
212
+ "arguments": [
213
+ {
214
+ "name": "value",
215
+ "type": {
216
+ "type-name": "Uint",
217
+ "maxval": 340282366920938463463374607431768211455
218
+ }
219
+ }
220
+ ],
221
+ "result-type": {
222
+ "type-name": "Bytes",
223
+ "length": 32
224
+ }
225
+ },
226
+ {
227
+ "name": "abiWordToUint128",
228
+ "pure": true,
229
+ "proof": false,
230
+ "arguments": [
231
+ {
232
+ "name": "word",
233
+ "type": {
234
+ "type-name": "Bytes",
235
+ "length": 32
236
+ }
237
+ }
238
+ ],
239
+ "result-type": {
240
+ "type-name": "Uint",
241
+ "maxval": 340282366920938463463374607431768211455
242
+ }
189
243
  }
190
244
  ],
191
245
  "witnesses": [
@@ -7,26 +7,26 @@
7
7
  "type": "directory",
8
8
  "contract-info.json": {
9
9
  "type": "file",
10
- "size": 4397,
11
- "hash": "a9962a641c6b791f1a476adc5875d36de5cedb28b2377f016a8efb7ff644e526"
10
+ "size": 5483,
11
+ "hash": "a3009b5f78d1ee2cc012aa72b6265976b3469b6f3963f31674b27b5badc9b185"
12
12
  }
13
13
  },
14
14
  "contract": {
15
15
  "type": "directory",
16
16
  "index.d.ts": {
17
17
  "type": "file",
18
- "size": 4176,
19
- "hash": "6319da925c6f853b419c1794e449f732179d94d04b76b7334a634d4eed8f838d"
18
+ "size": 4787,
19
+ "hash": "e5e0a5b0e3f6fbf3a5d55a6158d2e45df6b16430dd5e6a12b859b0c7f7309fc6"
20
20
  },
21
21
  "index.js": {
22
22
  "type": "file",
23
- "size": 21045,
24
- "hash": "15e7ced35995de9bc5fad3bb3fb9fe070e2d63f59f205140293bdd4b896d3b83"
23
+ "size": 38312,
24
+ "hash": "c433d66e108dd7b99981f4c405ef01a8daef9e0c87a967ca590b7509ccf45847"
25
25
  },
26
26
  "index.js.map": {
27
27
  "type": "file",
28
- "size": 1922,
29
- "hash": "b78095e48c3a891b91e89c87b687b420ee1ad595e7d11ac27ed4656a74cc0ea7"
28
+ "size": 3162,
29
+ "hash": "0e5e8f0a696c10549bd21fdb6ee7b57a45fff74ff578b9761033868c6b9d3c0c"
30
30
  }
31
31
  }
32
32
  }
@@ -27,6 +27,9 @@ export type PureCircuits = {
27
27
  },
28
28
  mpcResponseKey_0: __compactRuntime.Secp256k1Point): boolean;
29
29
  signetKeyHash(pk_0: __compactRuntime.Secp256k1Point): Uint8Array;
30
+ evmAddressAbiWord(addr_0: Uint8Array): Uint8Array;
31
+ numericAbiWord(value_0: bigint): Uint8Array;
32
+ abiWordToUint128(word_0: Uint8Array): bigint;
30
33
  }
31
34
 
32
35
  export type Circuits<PS> = {
@@ -51,6 +54,11 @@ export type Circuits<PS> = {
51
54
  mpcResponseKey_0: __compactRuntime.Secp256k1Point): Promise<__compactRuntime.CircuitResults<PS, boolean>>;
52
55
  signetKeyHash(context: __compactRuntime.CircuitContext<PS>,
53
56
  pk_0: __compactRuntime.Secp256k1Point): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
57
+ evmAddressAbiWord(context: __compactRuntime.CircuitContext<PS>,
58
+ addr_0: Uint8Array): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
59
+ numericAbiWord(context: __compactRuntime.CircuitContext<PS>, value_0: bigint): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
60
+ abiWordToUint128(context: __compactRuntime.CircuitContext<PS>,
61
+ word_0: Uint8Array): Promise<__compactRuntime.CircuitResults<PS, bigint>>;
54
62
  }
55
63
 
56
64
  export type Ledger = {