-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
596d52d
commit 53fd463
Showing
6 changed files
with
22 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './contract/index.js'; | ||
export * from './contract_deployer/index.js'; | ||
export * from './utils/index.js'; | ||
|
||
// TODO - only export necessary stuffs | ||
export * from '@aztec/aztec-rpc'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './utils.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { CircuitsWasm, Fr } from '@aztec/circuits.js'; | ||
import { computeSecretMessageHash } from '@aztec/circuits.js/abis'; | ||
|
||
/** | ||
* Given a secret, it computes its pederson hash - used to send l1 to l2 messages | ||
* @param secret - the secret to hash (defaults to a random field element) | ||
* @returns secret and its pederson hash (in hex). | ||
*/ | ||
export async function createMessageSecretAndHash(secret = Fr.random()) { | ||
const wasm = await CircuitsWasm.get(); | ||
const secretHash = computeSecretMessageHash(wasm, secret); | ||
const secretHashHex = `0x${secretHash.toBuffer().toString('hex')}` as `0x${string}`; | ||
return secretHashHex; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters