@sig-net/midnight 0.27.0-rc.2 → 0.27.0-rc.3
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 +1 -1
- package/dist/abi-serde.d.ts +27 -0
- package/dist/abi-serde.d.ts.map +1 -1
- package/dist/abi-serde.js +101 -0
- package/dist/abi-serde.js.map +1 -1
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -34
- package/dist/constants.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +444 -0
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +102 -0
- package/dist/managed/contract/index.js +298 -178
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/mpc-output-cache.d.ts +2 -3
- package/dist/mpc-output-cache.d.ts.map +1 -1
- package/dist/mpc-output-cache.js +1 -2
- package/dist/mpc-output-cache.js.map +1 -1
- package/dist/signature-response-verification.d.ts +17 -14
- package/dist/signature-response-verification.d.ts.map +1 -1
- package/dist/signature-response-verification.js +53 -34
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-events.js +1 -1
- package/dist/signet-contract-events.js.map +1 -1
- package/dist/signet-evtype2tx-requests.d.ts +1 -1
- package/dist/signet-evtype2tx-requests.js +1 -1
- package/dist/signet-request-response-reader.d.ts +33 -31
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +76 -75
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/tron-transactions.d.ts +8 -1
- package/dist/tron-transactions.d.ts.map +1 -1
- package/dist/tron-transactions.js +17 -3
- package/dist/tron-transactions.js.map +1 -1
- package/package.json +2 -2
- package/src/circuits.compact +12 -0
|
@@ -5,20 +5,42 @@
|
|
|
5
5
|
// UNAUTHENTICATED routing data: VERIFICATION establishes authenticity.
|
|
6
6
|
// Single-shot: each call queries once, and the caller owns any poll loop.
|
|
7
7
|
import { ContractState } from "@midnight-ntwrk/compact-runtime";
|
|
8
|
+
import { getAddress } from "ethers";
|
|
8
9
|
import { verifyAttestedOutput, verifyRespondBidirectionalAttestation, } from "./ecdsa-attestation.js";
|
|
9
10
|
import { lookupSignetRequestAt } from "./signature-requests-state-reader.js";
|
|
10
|
-
import {
|
|
11
|
+
import { recoverEvmSignatureResponseSigner, recoverTronSignatureResponseSigner, verifyEvmSignatureRespondedEvent, verifyTronSignatureRespondedEvent, } from "./signature-response-verification.js";
|
|
11
12
|
import { decodeSignetEventNamed, SignetEventName, signetEventRecordsOf, } from "./signet-contract-events.js";
|
|
12
13
|
import { signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.js";
|
|
13
14
|
import { isEvmType2SignBidirectionalEvent, isTronSignBidirectionalEvent, } from "./signet-requests.js";
|
|
14
|
-
import { buildSignedTronTransaction, buildTronRawTransaction,
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
import { buildSignedTronTransaction, buildTronRawTransaction, deriveSignBidirectionalEventSignerTronAddress, } from "./tron-transactions.js";
|
|
16
|
+
function judgeSignatureResponses(responses, expectedSigner, recover, verify) {
|
|
17
|
+
const verdicts = responses.map((response, position) => {
|
|
18
|
+
const index = BigInt(position);
|
|
19
|
+
let signer;
|
|
20
|
+
try {
|
|
21
|
+
signer = recover(response);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return {
|
|
25
|
+
index,
|
|
26
|
+
response,
|
|
27
|
+
rejectedReason: `not a decodable signature (${String(error)})`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (!verify(response)) {
|
|
31
|
+
return {
|
|
32
|
+
index,
|
|
33
|
+
response,
|
|
34
|
+
signer,
|
|
35
|
+
rejectedReason: `signed by ${signer}, expected ${expectedSigner}`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return { index, response, signer };
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
verified: verdicts.find((v) => v.rejectedReason === undefined)?.response,
|
|
42
|
+
verdicts,
|
|
43
|
+
};
|
|
22
44
|
}
|
|
23
45
|
/**
|
|
24
46
|
* The first (oldest) of a request's respond-bidirectional posts whose
|
|
@@ -173,21 +195,29 @@ export class SignetRequestResponseReader {
|
|
|
173
195
|
}
|
|
174
196
|
/**
|
|
175
197
|
* Fetch the signature responses posted under `requestId` and verify each
|
|
176
|
-
* against the request: a valid post's signature recovers to
|
|
177
|
-
* `expectedSigner`
|
|
178
|
-
*
|
|
179
|
-
* candidate gets a verdict.
|
|
198
|
+
* against the evmType2 request: a valid post's signature recovers to
|
|
199
|
+
* `expectedSigner` over the signing hash of the request's transaction. The
|
|
200
|
+
* first valid post wins, and every candidate gets a verdict.
|
|
180
201
|
*
|
|
181
202
|
* @param requestId - The request id to fetch a verified response for.
|
|
182
|
-
* @param expectedSigner - The EVM address (0x hex, any case)
|
|
183
|
-
*
|
|
184
|
-
* MPC-derived address.
|
|
203
|
+
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
204
|
+
* response must be signed by: the requester's MPC-derived address.
|
|
185
205
|
* @returns The first valid response (if any) plus per-post verdicts.
|
|
186
|
-
* @throws {Error} When the requester contract has no state
|
|
187
|
-
* not on its ledger
|
|
206
|
+
* @throws {Error} When the requester contract has no state, the request is
|
|
207
|
+
* not on its ledger, the request is not an evmType2 record, or
|
|
208
|
+
* `expectedSigner` is not an EVM address.
|
|
188
209
|
*/
|
|
189
210
|
async getVerifiedSignatureRespondedEvent(requestId, expectedSigner) {
|
|
190
|
-
return this.
|
|
211
|
+
return this.verifyEvmSignatureResponses(requestId, expectedSigner, await this.getSignatureRespondedEvents(requestId));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @param requestId - The Tron request id to fetch a verified response for
|
|
215
|
+
* @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the expected owner is derived from it and the record's `sender` and `path`
|
|
216
|
+
* @returns The first valid response (if any) plus per-post verdicts, signers in base58
|
|
217
|
+
* @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
|
|
218
|
+
*/
|
|
219
|
+
async getVerifiedTronSignatureRespondedEvent(requestId, mpcRootPublicKey) {
|
|
220
|
+
return this.verifyTronSignatureResponses(requestId, mpcRootPublicKey, await this.getSignatureRespondedEvents(requestId));
|
|
191
221
|
}
|
|
192
222
|
/**
|
|
193
223
|
* {@link getVerifiedSignatureRespondedEvent} over decoded events already in
|
|
@@ -195,65 +225,36 @@ export class SignetRequestResponseReader {
|
|
|
195
225
|
* responder contract's event history. For a consumer that streamed and decoded
|
|
196
226
|
* the history once and verifies many requests against it.
|
|
197
227
|
*
|
|
198
|
-
* @param requestId - The request id to verify responses for.
|
|
199
|
-
* @param expectedSigner - The EVM address (0x hex, any case)
|
|
200
|
-
*
|
|
201
|
-
* MPC-derived address.
|
|
228
|
+
* @param requestId - The evmType2 request id to verify responses for.
|
|
229
|
+
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
230
|
+
* response must be signed by: the requester's MPC-derived address.
|
|
202
231
|
* @param events - Decoded signet events of any kinds and request ids, in
|
|
203
232
|
* emission order. Only signature responses declaring `requestId` are judged.
|
|
204
233
|
* @returns The first valid response (if any) plus per-post verdicts.
|
|
205
|
-
* @throws {Error} When the requester contract has no state
|
|
206
|
-
* not on its ledger
|
|
234
|
+
* @throws {Error} When the requester contract has no state, the request is
|
|
235
|
+
* not on its ledger, the request is not an evmType2 record, or
|
|
236
|
+
* `expectedSigner` is not an EVM address.
|
|
207
237
|
*/
|
|
208
238
|
async verifySignatureRespondedEvents(requestId, expectedSigner, events) {
|
|
209
|
-
return this.
|
|
239
|
+
return this.verifyEvmSignatureResponses(requestId, expectedSigner, signetEventRecordsOf(events, SignetEventName.SignatureRespondedEvent, requestId));
|
|
210
240
|
}
|
|
211
241
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* @
|
|
217
|
-
* @param expectedSigner - The EVM or base58 Tron address the genuine response
|
|
218
|
-
* must be signed by.
|
|
219
|
-
* @param responses - The request's posted responses, in emission order.
|
|
220
|
-
* @returns The first valid response (if any) plus per-post verdicts.
|
|
221
|
-
* @throws {Error} When the requester contract has no state or the request is
|
|
222
|
-
* not on its ledger.
|
|
242
|
+
* @param requestId - The Tron request id to verify responses for
|
|
243
|
+
* @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`
|
|
244
|
+
* @param events - Decoded signet events of any kinds and request ids, in emission order
|
|
245
|
+
* @returns The first valid response (if any) plus per-post verdicts, signers in base58
|
|
246
|
+
* @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
|
|
223
247
|
*/
|
|
224
|
-
async
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
({ signer, matches } = recoverAndMatchSigner(request, response, expectedSigner));
|
|
235
|
-
}
|
|
236
|
-
catch (error) {
|
|
237
|
-
return {
|
|
238
|
-
index,
|
|
239
|
-
response,
|
|
240
|
-
rejectedReason: `not a decodable signature (${String(error)})`,
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
if (!matches) {
|
|
244
|
-
return {
|
|
245
|
-
index,
|
|
246
|
-
response,
|
|
247
|
-
signer,
|
|
248
|
-
rejectedReason: `signed by ${signer}, expected ${expectedSigner}`,
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
return { index, response, signer };
|
|
252
|
-
});
|
|
253
|
-
return {
|
|
254
|
-
verified: verdicts.find((v) => v.rejectedReason === undefined)?.response,
|
|
255
|
-
verdicts,
|
|
256
|
-
};
|
|
248
|
+
async verifyTronSignatureRespondedEvents(requestId, mpcRootPublicKey, events) {
|
|
249
|
+
return this.verifyTronSignatureResponses(requestId, mpcRootPublicKey, signetEventRecordsOf(events, SignetEventName.SignatureRespondedEvent, requestId));
|
|
250
|
+
}
|
|
251
|
+
async verifyEvmSignatureResponses(requestId, expectedSigner, responses) {
|
|
252
|
+
const request = await this.getEvmType2SignatureRequest(requestId);
|
|
253
|
+
return judgeSignatureResponses(responses, getAddress(expectedSigner), (response) => recoverEvmSignatureResponseSigner(request, response), (response) => verifyEvmSignatureRespondedEvent(request, response, expectedSigner));
|
|
254
|
+
}
|
|
255
|
+
async verifyTronSignatureResponses(requestId, mpcRootPublicKey, responses) {
|
|
256
|
+
const request = await this.getTronSignatureRequest(requestId);
|
|
257
|
+
return judgeSignatureResponses(responses, deriveSignBidirectionalEventSignerTronAddress(mpcRootPublicKey, request).base58, (response) => recoverTronSignatureResponseSigner(request, response, mpcRootPublicKey), (response) => verifyTronSignatureRespondedEvent(request, response, mpcRootPublicKey));
|
|
257
258
|
}
|
|
258
259
|
/**
|
|
259
260
|
* Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
|
|
@@ -295,17 +296,17 @@ export class SignetRequestResponseReader {
|
|
|
295
296
|
}
|
|
296
297
|
/**
|
|
297
298
|
* @param requestId - The request id to produce a signed transaction for
|
|
298
|
-
* @param
|
|
299
|
+
* @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion` (e.g. `getMpcRootPublicKey(network)`); the owner is derived from it and the record's `sender` and `path`
|
|
299
300
|
* @returns The signed protobuf `Transaction` bytes, or `undefined` when no valid response has been posted yet
|
|
300
|
-
* @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or
|
|
301
|
+
* @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
|
|
301
302
|
*/
|
|
302
|
-
async getSignedTronTransaction(requestId,
|
|
303
|
+
async getSignedTronTransaction(requestId, mpcRootPublicKey) {
|
|
303
304
|
const request = await this.getTronSignatureRequest(requestId);
|
|
304
|
-
const { verified } = await this.
|
|
305
|
+
const { verified } = await this.getVerifiedTronSignatureRespondedEvent(requestId, mpcRootPublicKey);
|
|
305
306
|
if (verified === undefined) {
|
|
306
307
|
return undefined;
|
|
307
308
|
}
|
|
308
|
-
return buildSignedTronTransaction(buildTronRawTransaction(request.txParams,
|
|
309
|
+
return buildSignedTronTransaction(buildTronRawTransaction(request.txParams, deriveSignBidirectionalEventSignerTronAddress(mpcRootPublicKey, request).bytes), verified.signature);
|
|
309
310
|
}
|
|
310
311
|
/**
|
|
311
312
|
* Fetch every decodable respond-bidirectional response posted under
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,uEAAuE;AACvE,uEAAuE;AACvE,0EAA0E;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,uEAAuE;AACvE,uEAAuE;AACvE,0EAA0E;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKhE,OAAO,EAAE,UAAU,EAAoB,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAEL,oBAAoB,EACpB,qCAAqC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EAClC,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,sBAAsB,EAGtB,eAAe,EAEf,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,g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OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,0BAA0B,CAC/B,uBAAuB,CACrB,OAAO,CAAC,QAAQ,EAChB,6CAA6C,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,KAAK,CAC/E,EACD,QAAQ,CAAC,SAAS,CACnB,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,6BAA6B,CACjC,SAAuB;QAEvB,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,oCAAoC,CACxC,SAAuB,EACvB,gBAA4B,EAC5B,cAA8B;QAE9B,OAAO,sCAAsC,CAC3C,gBAAgB,EAChB,cAAc,EACd,MAAM,IAAI,CAAC,6BAA6B,CAAC,SAAS,CAAC,CACpD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SignBidirectionalEventKeySelector } from "./epsilon-derivation.ts";
|
|
1
2
|
import type { MpcSignature } from "./signet-contract-events.ts";
|
|
2
3
|
import type { TronTxParams } from "./signet-tron-requests.ts";
|
|
3
4
|
/**
|
|
@@ -15,7 +16,7 @@ export declare function tronAddressToBase58(address: Uint8Array): string;
|
|
|
15
16
|
/**
|
|
16
17
|
* @param text - The base58check text (`T…`)
|
|
17
18
|
* @returns The 21-byte Tron address
|
|
18
|
-
* @throws {Error} If the text is not base58, not 25 bytes, fails its checksum
|
|
19
|
+
* @throws {Error} If the text is not base58, not 25 bytes, fails its checksum, does not carry the `0x41` prefix or is not the canonical spelling of its bytes
|
|
19
20
|
*/
|
|
20
21
|
export declare function tronAddressFromBase58(text: string): Uint8Array;
|
|
21
22
|
/** */
|
|
@@ -30,6 +31,12 @@ export interface TronAddress {
|
|
|
30
31
|
* @returns The derived address in both forms
|
|
31
32
|
*/
|
|
32
33
|
export declare function deriveTronAddress(mpcSecp256k1PublicKey: string, contractAddress: string, path: string): TronAddress;
|
|
34
|
+
/**
|
|
35
|
+
* @param mpcSecp256k1PublicKey - The MPC root secp256k1 public key of the record's `keyVersion`, in any spelling `parseSecp256k1PublicKey` accepts
|
|
36
|
+
* @param request - The on-ledger request record, or its `sender` and `path`
|
|
37
|
+
* @returns The Tron address the MPC signs that request's transaction from, in both forms
|
|
38
|
+
*/
|
|
39
|
+
export declare function deriveSignBidirectionalEventSignerTronAddress(mpcSecp256k1PublicKey: string, request: SignBidirectionalEventKeySelector): TronAddress;
|
|
33
40
|
/**
|
|
34
41
|
* @param params - The request's transaction parameters
|
|
35
42
|
* @param owner - The 21-byte Tron address of the request signing key (see {@link deriveTronAddress})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tron-transactions.d.ts","sourceRoot":"","sources":["../src/tron-transactions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tron-transactions.d.ts","sourceRoot":"","sources":["../src/tron-transactions.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAY9D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAYvE;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAG/D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAoB9D;AAED,MAAM;AACN,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,qBAAqB,EAAE,MAAM,EAC7B,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,GACX,WAAW,CAEb;AAED;;;;GAIG;AACH,wBAAgB,6CAA6C,CAC3D,qBAAqB,EAAE,MAAM,EAC7B,OAAO,EAAE,iCAAiC,GACzC,WAAW,CAIb;AAwDD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAkC3F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,GAAG,UAAU,CAW/F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decodeBase58, encodeBase58, getBytes, sha256, toBeArray } from "ethers";
|
|
2
2
|
import { bigintToBytes32BE, hexToBytes, stripHexPrefix } from "./byte-codecs.js";
|
|
3
3
|
import { mpcSignatureToEcdsaSignature } from "./ecdsa-attestation.js";
|
|
4
|
-
import { deriveEvmAddress } from "./epsilon-derivation.js";
|
|
4
|
+
import { deriveEvmAddress, deriveSignBidirectionalEventSignerEvmAddress, } from "./epsilon-derivation.js";
|
|
5
5
|
import { pureCircuits } from "./managed/contract/index.js";
|
|
6
6
|
const TRON_ADDRESS_PREFIX = 0x41;
|
|
7
7
|
const TRON_ADDRESS_BYTES = 21;
|
|
@@ -43,7 +43,7 @@ export function tronAddressToBase58(address) {
|
|
|
43
43
|
/**
|
|
44
44
|
* @param text - The base58check text (`T…`)
|
|
45
45
|
* @returns The 21-byte Tron address
|
|
46
|
-
* @throws {Error} If the text is not base58, not 25 bytes, fails its checksum
|
|
46
|
+
* @throws {Error} If the text is not base58, not 25 bytes, fails its checksum, does not carry the `0x41` prefix or is not the canonical spelling of its bytes
|
|
47
47
|
*/
|
|
48
48
|
export function tronAddressFromBase58(text) {
|
|
49
49
|
let decoded;
|
|
@@ -62,6 +62,9 @@ export function tronAddressFromBase58(text) {
|
|
|
62
62
|
throw new Error("base58check checksum mismatch");
|
|
63
63
|
}
|
|
64
64
|
assertTronAddress(address, "Tron address");
|
|
65
|
+
if (encodeBase58(decoded) !== text) {
|
|
66
|
+
throw new Error(`not a canonical base58 Tron address: "${text}"`);
|
|
67
|
+
}
|
|
65
68
|
return address;
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
@@ -71,7 +74,18 @@ export function tronAddressFromBase58(text) {
|
|
|
71
74
|
* @returns The derived address in both forms
|
|
72
75
|
*/
|
|
73
76
|
export function deriveTronAddress(mpcSecp256k1PublicKey, contractAddress, path) {
|
|
74
|
-
|
|
77
|
+
return tronAddressOfEvm(deriveEvmAddress(mpcSecp256k1PublicKey, contractAddress, path));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @param mpcSecp256k1PublicKey - The MPC root secp256k1 public key of the record's `keyVersion`, in any spelling `parseSecp256k1PublicKey` accepts
|
|
81
|
+
* @param request - The on-ledger request record, or its `sender` and `path`
|
|
82
|
+
* @returns The Tron address the MPC signs that request's transaction from, in both forms
|
|
83
|
+
*/
|
|
84
|
+
export function deriveSignBidirectionalEventSignerTronAddress(mpcSecp256k1PublicKey, request) {
|
|
85
|
+
return tronAddressOfEvm(deriveSignBidirectionalEventSignerEvmAddress(mpcSecp256k1PublicKey, request));
|
|
86
|
+
}
|
|
87
|
+
function tronAddressOfEvm(evm) {
|
|
88
|
+
const bytes = tronAddressFromEvm(evm);
|
|
75
89
|
return { bytes, base58: tronAddressToBase58(bytes) };
|
|
76
90
|
}
|
|
77
91
|
const TRIGGER_SMART_CONTRACT_TYPE_URL = "type.googleapis.com/protocol.TriggerSmartContract";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tron-transactions.js","sourceRoot":"","sources":["../src/tron-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,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AC,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,GAAe,EAAE,SAAuB;IACjF,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACrE,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;QACrC,GAAG,iBAAiB,CAAC,CAAC,CAAC;QACvB,GAAG,iBAAiB,CAAC,CAAC,CAAC;QACvB,UAAU;KACX,CAAC,CAAC;IACH,OAAO,UAAU,CAAC,IAAI,CAAC;QACrB,GAAG,oBAAoB,CAAC,CAAC,EAAE,GAAG,CAAC;QAC/B,GAAG,oBAAoB,CAAC,CAAC,EAAE,cAAc,CAAC;KAC3C,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sig-net/midnight",
|
|
3
|
-
"version": "0.27.0-rc.
|
|
3
|
+
"version": "0.27.0-rc.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sig-net/midnight-integration",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@midnight-ntwrk/compact-runtime": "0.21.0",
|
|
50
50
|
"@midnight-ntwrk/midnight-js-types": "5.0.0",
|
|
51
51
|
"@noble/curves": "^2.2.0",
|
|
52
|
-
"@sig-net/midnight-serde": "^0.27.0-rc.
|
|
52
|
+
"@sig-net/midnight-serde": "^0.27.0-rc.3",
|
|
53
53
|
"ethers": "^6.17.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/src/circuits.compact
CHANGED
|
@@ -180,3 +180,15 @@ export pure circuit calculateTronRequestIdV1_2_0(
|
|
|
180
180
|
): RequestId {
|
|
181
181
|
return calculateTronRequestIdV1<2, 0>(request);
|
|
182
182
|
}
|
|
183
|
+
|
|
184
|
+
export pure circuit calculateTronRequestIdV1_1_34(
|
|
185
|
+
request: SignBidirectionalEventV1<TronTxParams<1>, 34, 0>
|
|
186
|
+
): RequestId {
|
|
187
|
+
return calculateTronRequestIdV1<1, 34>(request);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export pure circuit calculateTronRequestIdV1_2_34(
|
|
191
|
+
request: SignBidirectionalEventV1<TronTxParams<2>, 34, 0>
|
|
192
|
+
): RequestId {
|
|
193
|
+
return calculateTronRequestIdV1<2, 34>(request);
|
|
194
|
+
}
|