@aztec/types
Advanced tools
Comparing version 0.1.0-alpha33 to 0.1.0-alpha34
@@ -50,3 +50,16 @@ /// <reference types="node" resolution-mode="require"/> | ||
static empty(): FunctionL2Logs; | ||
/** | ||
* Convert a FunctionL2Logs class object to a plain JSON object. | ||
* @returns A plain object with FunctionL2Logs properties. | ||
*/ | ||
toJSON(): { | ||
logs: string[]; | ||
}; | ||
/** | ||
* Convert a plain JSON object to a FunctionL2Logs class object. | ||
* @param obj - A plain FunctionL2Logs JSON object. | ||
* @returns A FunctionL2Logs class object. | ||
*/ | ||
static fromJSON(obj: any): FunctionL2Logs; | ||
} | ||
//# sourceMappingURL=function_l2_logs.d.ts.map |
@@ -78,3 +78,21 @@ import { sha256 } from '@aztec/foundation/crypto'; | ||
} | ||
/** | ||
* Convert a FunctionL2Logs class object to a plain JSON object. | ||
* @returns A plain object with FunctionL2Logs properties. | ||
*/ | ||
toJSON() { | ||
return { | ||
logs: this.logs.map(log => log.toString('hex')), | ||
}; | ||
} | ||
/** | ||
* Convert a plain JSON object to a FunctionL2Logs class object. | ||
* @param obj - A plain FunctionL2Logs JSON object. | ||
* @returns A FunctionL2Logs class object. | ||
*/ | ||
static fromJSON(obj) { | ||
const logs = obj.logs.map((log) => Buffer.from(log, 'hex')); | ||
return new FunctionL2Logs(logs); | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnVuY3Rpb25fbDJfbG9ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dzL2Z1bmN0aW9uX2wyX2xvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ2xELE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUNqRCxPQUFPLEVBQUUsWUFBWSxFQUFFLHVCQ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QUFDLEdBQUcsR0FBRyxLQUFLLENBQUMsYUFBYSxDQUFDLENBQUM7WUFDaEUsSUFBSSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsZ0JBQWdCLEVBQUUsZUFBZSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDO1NBQzFFO1FBQ0QsT0FBTyxJQUFJLGNBQWMsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNsQyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0ksTUFBTSxDQUFDLEtBQUs7UUFDakIsT0FBTyxJQUFJLGNBQWMsQ0FBQyxFQUFFLENBQUMsQ0FBQztJQUNoQyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0ksTUFBTTtRQUNYLE9BQU87WUFDTCxJQUFJLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDO1NBQ2hELENBQUM7SUFDSixDQUFDO0lBRUQ7Ozs7T0FJRztJQUNJLE1BQU0sQ0FBQyxRQUFRLENBQUMsR0FBUTtRQUM3QixNQUFNLElBQUksR0FBRyxHQUFHLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLEdBQVcsRUFBRSxFQUFFLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUUsS0FBSyxDQUFDLENBQUMsQ0FBQztRQUNwRSxPQUFPLElBQUksY0FBYyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ2xDLENBQUM7Q0FDRiJ9 |
@@ -48,3 +48,20 @@ /// <reference types="node" resolution-mode="require"/> | ||
static unrollLogs(blockLogs: L2BlockL2Logs[]): Buffer[]; | ||
/** | ||
* Convert a L2BlockL2Logs class object to a plain JSON object. | ||
* @returns A plain object with L2BlockL2Logs properties. | ||
*/ | ||
toJSON(): { | ||
txLogs: { | ||
functionLogs: { | ||
logs: string[]; | ||
}[]; | ||
}[]; | ||
}; | ||
/** | ||
* Convert a plain JSON object to a L2BlockL2Logs class object. | ||
* @param obj - A plain L2BlockL2Logs JSON object. | ||
* @returns A L2BlockL2Logs class object. | ||
*/ | ||
static fromJSON(obj: any): L2BlockL2Logs; | ||
} | ||
//# sourceMappingURL=l2_block_l2_logs.d.ts.map |
@@ -73,3 +73,21 @@ import { BufferReader, serializeBufferToVector } from '@aztec/foundation/serialize'; | ||
} | ||
/** | ||
* Convert a L2BlockL2Logs class object to a plain JSON object. | ||
* @returns A plain object with L2BlockL2Logs properties. | ||
*/ | ||
toJSON() { | ||
return { | ||
txLogs: this.txLogs.map(log => log.toJSON()), | ||
}; | ||
} | ||
/** | ||
* Convert a plain JSON object to a L2BlockL2Logs class object. | ||
* @param obj - A plain L2BlockL2Logs JSON object. | ||
* @returns A L2BlockL2Logs class object. | ||
*/ | ||
static fromJSON(obj) { | ||
const txLogs = obj.txLogs.map((log) => TxL2Logs.fromJSON(log)); | ||
return new L2BlockL2Logs(txLogs); | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfYmxvY2tfbDJfbG9ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dzL2wyX2Jsb2NrX2wyX2xvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSx1QkFBdUIsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRXBGLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUUzQzs7R0FFRztBQUNILE1BQU0sT0FBTyxhQUFhO0lBQ3hCO0lBQ0U7O09BRUc7SUFDYSxNQUFrQjtRQUFsQixXQUFNLEdBQU4sTUFBTSxDQUFZO0lBQ2pDLENBQU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ksTUFBTTtRQUNYLE9BQU87WUFDTCxNQUFNLEVBQUUsSUFBSSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsTUFBTSxFQUFFLENBQUM7U0FDN0MsQ0FBQztJQUNKLENBQUM7SUFFRDs7OztPQUlHO0lBQ0ksTUFBTSxDQUFDLFFBQVEsQ0FBQyxHQUFRO1FBQzdCLE1BQU0sTUFBTSxHQUFHLEdBQUcsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBUSxFQUFFLEVBQUUsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7UUFDcEUsT0FBTyxJQUFJLGFBQWEsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNuQyxDQUFDO0NBQ0YifQ== |
@@ -15,3 +15,9 @@ import { L2BlockL2Logs } from './l2_block_l2_logs.js'; | ||
}); | ||
it('serialises to and from JSON', () => { | ||
const l2Logs = L2BlockL2Logs.random(3, 6, 2); | ||
const json = l2Logs.toJSON(); | ||
const recovered = L2BlockL2Logs.fromJSON(json); | ||
expect(recovered).toEqual(l2Logs); | ||
}); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfYmxvY2tfbDJfbG9ncy50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvZ3MvbDJfYmxvY2tfbDJfbG9ncy50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV0RCxRQUFRLENBQUMsZUFBZSxFQUFFLEdBQUcsRUFBRTtJQUM3QixFQUFFLENBQUMsc0NBQXNDLEVBQUUsR0FBRyxFQUFFO1FBQzlDLE1BQU0sTUFBTSxH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SUFBSSxHQUFHLE1BQU0sQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUM3QixNQUFNLFNBQVMsR0FBRyxhQUFhLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQy9DLE1BQU0sQ0FBQyxTQUFTLENBQUMsQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDcEMsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDLENBQUMsQ0FBQyJ9 |
@@ -48,3 +48,18 @@ /// <reference types="node" resolution-mode="require"/> | ||
static random(numFunctionInvocations: number, numLogsIn1Invocation: number): TxL2Logs; | ||
/** | ||
* Convert a TxL2Logs class object to a plain JSON object. | ||
* @returns A plain object with TxL2Logs properties. | ||
*/ | ||
toJSON(): { | ||
functionLogs: { | ||
logs: string[]; | ||
}[]; | ||
}; | ||
/** | ||
* Convert a plain JSON object to a TxL2Logs class object. | ||
* @param obj - A plain TxL2Logs JSON object. | ||
* @returns A TxL2Logs class object. | ||
*/ | ||
static fromJSON(obj: any): TxL2Logs; | ||
} | ||
//# sourceMappingURL=tx_l2_logs.d.ts.map |
@@ -66,3 +66,21 @@ import { BufferReader, serializeBufferToVector } from '@aztec/foundation/serialize'; | ||
} | ||
/** | ||
* Convert a TxL2Logs class object to a plain JSON object. | ||
* @returns A plain object with TxL2Logs properties. | ||
*/ | ||
toJSON() { | ||
return { | ||
functionLogs: this.functionLogs.map(log => log.toJSON()), | ||
}; | ||
} | ||
/** | ||
* Convert a plain JSON object to a TxL2Logs class object. | ||
* @param obj - A plain TxL2Logs JSON object. | ||
* @returns A TxL2Logs class object. | ||
*/ | ||
static fromJSON(obj) { | ||
const functionLogs = obj.functionLogs.map((log) => FunctionL2Logs.fromJSON(log)); | ||
return new TxL2Logs(functionLogs); | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfbDJfbG9ncy5qcyIsInNvdXJjZVJvb3QiOiIi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xHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsQ0FBQyxNQUFNLEVBQUUsQ0FBQztTQUN6RCxDQUFDO0lBQ0osQ0FBQztJQUVEOzs7O09BSUc7SUFDSSxNQUFNLENBQUMsUUFBUSxDQUFDLEdBQVE7UUFDN0IsTUFBTSxZQUFZLEdBQUcsR0FBRyxDQUFDLFlBQVksQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFRLEVBQUUsRUFBRSxDQUFDLGNBQWMsQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztRQUN0RixPQUFPLElBQUksUUFBUSxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQ3BDLENBQUM7Q0FDRiJ9 |
{ | ||
"name": "@aztec/types", | ||
"version": "0.1.0-alpha33", | ||
"version": "0.1.0-alpha34", | ||
"exports": "./dest/index.js", | ||
"type": "module", | ||
"dependencies": { | ||
"@aztec/circuits.js": "0.1.0-alpha33", | ||
"@aztec/foundation": "0.1.0-alpha33", | ||
"@aztec/circuits.js": "0.1.0-alpha34", | ||
"@aztec/foundation": "0.1.0-alpha34", | ||
"browserify-cipher": "^1.0.1", | ||
@@ -10,0 +10,0 @@ "lodash.clonedeep": "^4.5.0", |
@@ -87,2 +87,22 @@ import { sha256 } from '@aztec/foundation/crypto'; | ||
} | ||
/** | ||
* Convert a FunctionL2Logs class object to a plain JSON object. | ||
* @returns A plain object with FunctionL2Logs properties. | ||
*/ | ||
public toJSON() { | ||
return { | ||
logs: this.logs.map(log => log.toString('hex')), | ||
}; | ||
} | ||
/** | ||
* Convert a plain JSON object to a FunctionL2Logs class object. | ||
* @param obj - A plain FunctionL2Logs JSON object. | ||
* @returns A FunctionL2Logs class object. | ||
*/ | ||
public static fromJSON(obj: any) { | ||
const logs = obj.logs.map((log: string) => Buffer.from(log, 'hex')); | ||
return new FunctionL2Logs(logs); | ||
} | ||
} |
@@ -21,2 +21,9 @@ import { L2BlockL2Logs } from './l2_block_l2_logs.js'; | ||
}); | ||
it('serialises to and from JSON', () => { | ||
const l2Logs = L2BlockL2Logs.random(3, 6, 2); | ||
const json = l2Logs.toJSON(); | ||
const recovered = L2BlockL2Logs.fromJSON(json); | ||
expect(recovered).toEqual(l2Logs); | ||
}); | ||
}); |
@@ -81,2 +81,22 @@ import { BufferReader, serializeBufferToVector } from '@aztec/foundation/serialize'; | ||
} | ||
/** | ||
* Convert a L2BlockL2Logs class object to a plain JSON object. | ||
* @returns A plain object with L2BlockL2Logs properties. | ||
*/ | ||
public toJSON() { | ||
return { | ||
txLogs: this.txLogs.map(log => log.toJSON()), | ||
}; | ||
} | ||
/** | ||
* Convert a plain JSON object to a L2BlockL2Logs class object. | ||
* @param obj - A plain L2BlockL2Logs JSON object. | ||
* @returns A L2BlockL2Logs class object. | ||
*/ | ||
public static fromJSON(obj: any) { | ||
const txLogs = obj.txLogs.map((log: any) => TxL2Logs.fromJSON(log)); | ||
return new L2BlockL2Logs(txLogs); | ||
} | ||
} |
@@ -74,2 +74,22 @@ import { BufferReader, serializeBufferToVector } from '@aztec/foundation/serialize'; | ||
} | ||
/** | ||
* Convert a TxL2Logs class object to a plain JSON object. | ||
* @returns A plain object with TxL2Logs properties. | ||
*/ | ||
public toJSON() { | ||
return { | ||
functionLogs: this.functionLogs.map(log => log.toJSON()), | ||
}; | ||
} | ||
/** | ||
* Convert a plain JSON object to a TxL2Logs class object. | ||
* @param obj - A plain TxL2Logs JSON object. | ||
* @returns A TxL2Logs class object. | ||
*/ | ||
public static fromJSON(obj: any) { | ||
const functionLogs = obj.functionLogs.map((log: any) => FunctionL2Logs.fromJSON(log)); | ||
return new TxL2Logs(functionLogs); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
561661
8597
+ Added@aztec/circuits.js@0.1.0-alpha34(transitive)
+ Added@aztec/foundation@0.1.0-alpha34(transitive)
- Removed@aztec/circuits.js@0.1.0-alpha33(transitive)
- Removed@aztec/foundation@0.1.0-alpha33(transitive)