@proto-kit/protocol 0.1.1-develop.1661 → 0.1.1-develop.1665

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "MIT",
4
4
  "private": false,
5
5
  "type": "module",
6
- "version": "0.1.1-develop.1661+ec6f5592",
6
+ "version": "0.1.1-develop.1665+66550e65",
7
7
  "scripts": {
8
8
  "build": "tsc -p tsconfig.json",
9
9
  "dev": "tsc -p tsconfig.json --watch",
@@ -32,5 +32,5 @@
32
32
  "@jest/globals": "^29.5.0",
33
33
  "@types/lodash": "^4.14.194"
34
34
  },
35
- "gitHead": "ec6f55921b35d7faaab233f1ca9cf591c6263d01"
35
+ "gitHead": "66550e6515f3194fc9495f4474f3a08bb24a6130"
36
36
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Withdrawal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Withdrawal.d.ts","sourceRoot":"","sources":["../../../src/settlement/messages/Withdrawal.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export {};
2
- // TODO Remove
3
- //# sourceMappingURL=Withdrawal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Withdrawal.js","sourceRoot":"","sources":["../../../src/settlement/messages/Withdrawal.ts"],"names":[],"mappings":";AAGA,cAAc"}
@@ -1,6 +0,0 @@
1
- import { Field } from "o1js";
2
- export interface SimpleAsyncStateService {
3
- get: (key: Field) => Promise<Field[] | undefined>;
4
- set: (key: Field, value: Field[] | undefined) => Promise<void>;
5
- }
6
- //# sourceMappingURL=SimpleAsyncStateService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SimpleAsyncStateService.d.ts","sourceRoot":"","sources":["../../src/state/SimpleAsyncStateService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC,KAAK,EAAE,GAAG,SAAS,CAAC,CAAC;IAClD,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=SimpleAsyncStateService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SimpleAsyncStateService.js","sourceRoot":"","sources":["../../src/state/SimpleAsyncStateService.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import { ProvableStateTransition, StateTransition } from "../model/StateTransition";
2
- import { ProvableReductionHashList } from "./ProvableReductionHashList";
3
- export declare class StateTransitionReductionList extends ProvableReductionHashList<ProvableStateTransition> {
4
- push(value: ProvableStateTransition): this;
5
- pushWithMetadata(value: ProvableStateTransition): {
6
- popLast: import("o1js/dist/node/lib/provable/bool").Bool;
7
- value: ProvableStateTransition;
8
- };
9
- }
10
- export declare function reduceStateTransitions(transitions: StateTransition<unknown>[]): StateTransition<unknown>[];
11
- //# sourceMappingURL=StateTransitionReductionList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StateTransitionReductionList.d.ts","sourceRoot":"","sources":["../../src/utils/StateTransitionReductionList.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EACvB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,qBAAa,4BAA6B,SAAQ,yBAAyB,CAAC,uBAAuB,CAAC;IAC3F,IAAI,CAAC,KAAK,EAAE,uBAAuB;IAMnC,gBAAgB,CAAC,KAAK,EAAE,uBAAuB;;;;CAyCvD;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,GACtC,eAAe,CAAC,OAAO,CAAC,EAAE,CA0B5B"}
@@ -1,61 +0,0 @@
1
- import { Provable } from "o1js";
2
- import { ProvableOption } from "../model/Option";
3
- import { ProvableStateTransition, StateTransition, } from "../model/StateTransition";
4
- import { ProvableReductionHashList } from "./ProvableReductionHashList";
5
- export class StateTransitionReductionList extends ProvableReductionHashList {
6
- push(value) {
7
- this.pushWithMetadata(value);
8
- return this;
9
- }
10
- pushWithMetadata(value) {
11
- return this.pushAndReduce(value, (previous) => {
12
- const pathsMatch = previous.path.equals(value.path);
13
- // Take the previous.from if the paths match, otherwise leave ST as is
14
- const from = Provable.if(pathsMatch, ProvableOption, previous.from, value.from);
15
- // In case we have a layout like
16
- // { from: 5, to: 10 }, { from: 10, to: none }
17
- // we just take the first and discard the second
18
- const to = Provable.if(value.to.isSome.or(pathsMatch.not()), ProvableOption, value.to, previous.to);
19
- const transition = new ProvableStateTransition({
20
- path: value.path,
21
- from: new ProvableOption(from),
22
- to: new ProvableOption(to),
23
- });
24
- // Assert that connection is correct
25
- previous.to.value
26
- .equals(value.from.value)
27
- .or(previous.to.isSome
28
- .not()
29
- .and(previous.from.value.equals(value.from.value)))
30
- .or(pathsMatch.not())
31
- .assertTrue();
32
- return [transition, pathsMatch];
33
- });
34
- }
35
- }
36
- export function reduceStateTransitions(transitions) {
37
- const reduced = [];
38
- transitions.forEach((st) => {
39
- if (reduced.length === 0) {
40
- reduced.push(st);
41
- return;
42
- }
43
- const last = reduced.at(-1);
44
- if (last.path.equals(st.path).toBoolean()) {
45
- if (st.toValue.isSome.toBoolean()) {
46
- reduced.pop();
47
- reduced.push(new StateTransition(st.path, last.fromValue, st.toValue));
48
- }
49
- else {
50
- // Do nothing, because we discard that ST
51
- // { from: 5, to: 10 }, { from: 10, to: none }
52
- // cancel the 2nd
53
- }
54
- }
55
- else {
56
- reduced.push(st);
57
- }
58
- });
59
- return reduced;
60
- }
61
- //# sourceMappingURL=StateTransitionReductionList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"St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