Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Oct 15, 2024
1 parent 440e729 commit 18a5ed7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions yarn-project/aztec.js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ export {
computeInnerAuthWitHashFromAction,
computeInnerAuthWitHash,
generatePublicKey,
readFieldCompressedString,
waitForAccountSynch,
waitForPXE,
} from './utils/index.js';

export { NoteSelector } from '@aztec/foundation/abi';

export { createPXEClient, createCompatibleClient } from './rpc_clients/index.js';
Expand Down
27 changes: 27 additions & 0 deletions yarn-project/aztec.js/src/utils/field_compressed_string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Fr } from '@aztec/circuits.js';

/**
* The representation of a FieldCompressedString in aztec.nr
*/
interface NoirFieldCompressedString {
/**
* The field value of the string
*/
value: bigint;
}
/**
* This turns
* @param field - The field that contains the string
* @returns - the string that is decoded from the field
*/
export const readFieldCompressedString = (field: NoirFieldCompressedString): string => {
const vals: number[] = Array.from(new Fr(field.value).toBuffer());

let str = '';
for (let i = 0; i < vals.length; i++) {
if (vals[i] != 0) {
str += String.fromCharCode(Number(vals[i]));
}
}
return str;
};
1 change: 1 addition & 0 deletions yarn-project/aztec.js/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './authwit.js';
export * from './pxe.js';
export * from './account.js';
export * from './anvil_test_watcher.js';
export * from './field_compressed_string.js';
4 changes: 2 additions & 2 deletions yarn-project/protocol-contracts/src/protocol_contract_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress>

export const ProtocolContractLeaf = {
AuthRegistry: Fr.fromString('0x2ace300b02ca5ab0a25052b1e852913a47292096997ca09f758c0e3624e84560'),
ContractInstanceDeployer: Fr.fromString('0x25d93dc07b5baaf53a98caeae2679df3528cb83e11e2640a57a0a53abbaaadb9'),
ContractInstanceDeployer: Fr.fromString('0x21e432f60f69ac5eb7582c26c03c6c7e4a3eb577720774bc8e1521561ca752a1'),
ContractClassRegisterer: Fr.fromString('0x1b6d5873cef5a35f681ab9468527f356c96e09b3c64603aef404ec2ad80aa3a9'),
MultiCallEntrypoint: Fr.fromString('0x0966ead8d11933bb3c72547bb997898971715f2275acd4c7d5d86fdf614ba1a2'),
FeeJuice: Fr.fromString('0x24388f7ef1b9c9e661721f3331a989a2f10cba300539471e4401c38629b27816'),
Router: Fr.fromString('0x1d8f25db3e8faa6a96cb1ecf57876a2ee04581deb3c4f181488ccd817abcbdb0'),
};

export const protocolContractTreeRoot = Fr.fromString(
'0x25e5bd75edc23b6b74ef6235acd1a1a27bcada41199a11c089a1c4e3e59bc774',
'0x0ce9f44ae6605f375e5f5267ceb769861703ce8e4235f16f7afc137ec34dcf06',
);

0 comments on commit 18a5ed7

Please sign in to comment.