@proto-kit/module 0.1.1-develop.298 → 0.1.1-develop.299
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeMethod.d.ts","sourceRoot":"","sources":["../../src/method/runtimeMethod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtimeMethod.d.ts","sourceRoot":"","sources":["../../src/method/runtimeMethod.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,eAAe,EAGf,kBAAkB,EAEnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAoBjE,wBAAgB,sBAAsB,CAEpC,gBAAgB,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,+CAczC;AAGD,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,kBAAkB,CAAC;AAEvE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,EAC5B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAC7C,eAAe,EAAE,WAAW,EAAE,iBAgG/B;AAED,wBAAgB,iBAAiB,CAC/B,iBAAiB,EAAE,MAAM,EACzB,UAAU,EAAE,MAAM,UAGnB;AAED,eAAO,MAAM,wBAAwB,eAAe,CAAC;AACrD,eAAO,MAAM,6BAA6B,8BAA8B,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,WAAW,EAAE,MAAM,WAKpB;AAED,wBAAgB,aAAa,aAEjB,cAAc,OAAO,CAAC,cAClB,MAAM,cACN,kBAAkB,UAwFjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Field, Poseidon, Proof } from "o1js";
|
|
1
|
+
import { Field, Poseidon, Proof, } from "o1js";
|
|
2
2
|
import { container } from "tsyringe";
|
|
3
3
|
import { DefaultProvableHashList, ProvableStateTransition, MethodPublicOutput, RuntimeMethodExecutionContext, } from "@proto-kit/protocol";
|
|
4
4
|
import { toProver, } from "@proto-kit/common";
|
|
@@ -47,10 +47,12 @@ export function toWrappedMethod(methodName, moduleMethod, methodArguments) {
|
|
|
47
47
|
*/
|
|
48
48
|
const argsFields = args.flatMap((argument, index) => {
|
|
49
49
|
if (argument instanceof Proof) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
];
|
|
50
|
+
const publicOutputType = parameterTypes[index]
|
|
51
|
+
?.publicOutputType;
|
|
52
|
+
const publicInputType = parameterTypes[index]?.publicInputType;
|
|
53
|
+
const inputFields = publicInputType?.toFields(argument.publicInput) ?? [];
|
|
54
|
+
const outputFields = publicOutputType?.toFields(argument.publicOutput) ?? [];
|
|
55
|
+
return [...inputFields, ...outputFields];
|
|
54
56
|
}
|
|
55
57
|
else {
|
|
56
58
|
return parameterTypes[index].toFields(argument);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@proto-kit/module",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.1-develop.
|
|
5
|
+
"version": "0.1.1-develop.299+fbe92e3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -p tsconfig.json",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"o1js": "0.13.1",
|
|
32
32
|
"tsyringe": "^4.7.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "fbe92e36c7103001875d853888ab3b6728936cc9"
|
|
35
35
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Field,
|
|
3
|
+
FlexibleProvable,
|
|
4
|
+
Poseidon,
|
|
5
|
+
Proof,
|
|
6
|
+
ProvableExtended,
|
|
7
|
+
} from "o1js";
|
|
2
8
|
import { container } from "tsyringe";
|
|
3
9
|
import {
|
|
4
10
|
StateTransition,
|
|
@@ -99,7 +105,7 @@ export function toWrappedMethod(
|
|
|
99
105
|
"Runtimemethod called with wrong methodId on the transaction object"
|
|
100
106
|
);
|
|
101
107
|
|
|
102
|
-
const parameterTypes:
|
|
108
|
+
const parameterTypes: ProvableExtended<unknown>[] = Reflect.getMetadata(
|
|
103
109
|
"design:paramtypes",
|
|
104
110
|
this,
|
|
105
111
|
methodName
|
|
@@ -111,10 +117,16 @@ export function toWrappedMethod(
|
|
|
111
117
|
*/
|
|
112
118
|
const argsFields = args.flatMap((argument, index) => {
|
|
113
119
|
if (argument instanceof Proof) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
const publicOutputType = (parameterTypes[index] as any)
|
|
121
|
+
?.publicOutputType;
|
|
122
|
+
const publicInputType = (parameterTypes[index] as any)?.publicInputType;
|
|
123
|
+
|
|
124
|
+
const inputFields =
|
|
125
|
+
publicInputType?.toFields(argument.publicInput) ?? [];
|
|
126
|
+
const outputFields =
|
|
127
|
+
publicOutputType?.toFields(argument.publicOutput) ?? [];
|
|
128
|
+
|
|
129
|
+
return [...inputFields, ...outputFields];
|
|
118
130
|
} else {
|
|
119
131
|
return parameterTypes[index].toFields(argument as any);
|
|
120
132
|
}
|