-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add Field, Group, Scalar, Plaintext, Ciphertext, Transitions, and Transactions to JS SDK. #948
base: feat/record-scanning-and-arithmetic
Are you sure you want to change the base?
[Feature] Add Field, Group, Scalar, Plaintext, Ciphertext, Transitions, and Transactions to JS SDK. #948
Changes from all commits
f9d061e
0aa0798
7d3742a
610c16c
5d18001
105266b
d3d771b
a7e4a83
e22f778
13119b8
d236665
034e638
871dab6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { TransactionModel } from "./transactionModel"; | ||
import { TransactionJSON } from "./transaction/transactionJSON"; | ||
|
||
export type ConfirmedTransaction = { | ||
type: string; | ||
id: string; | ||
transaction: TransactionModel; | ||
transaction: TransactionJSON; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { FunctionObject } from "./functionObject"; | ||
|
||
export type DeploymentMetadata = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
"programId" : string, | ||
"functions" : FunctionObject[] | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { TransitionJSON } from "./transition/transitionJSON"; | ||
|
||
export type ExecutionJSON = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
edition: number; | ||
transitions?: (TransitionJSON)[]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { VerifyingKey } from "@provablehq/wasm"; | ||
|
||
export type FunctionObject = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
"name" : string, | ||
"constraints" : number, | ||
"variables" : number, | ||
"verifyingKey" : string | VerifyingKey, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
export type Input = { | ||
/** | ||
* Object representation of an Input as raw JSON returned from a SnarkOS node. | ||
*/ | ||
export type InputJSON = { | ||
type: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
id: string; | ||
tag?: string; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Aleo function Input represented as a typed typescript object. | ||
*/ | ||
import { Ciphertext, Field } from "@provablehq/wasm"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be importing |
||
import { Plaintext } from "@provablehq/wasm/mainnet.js"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this importing |
||
import { PlaintextObject } from "../plaintext/plaintext"; | ||
|
||
/** | ||
* Object representation of an Input as raw JSON returned from a SnarkOS node. | ||
*/ | ||
export type InputObject = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
type: "string", | ||
id: "string" | Field, | ||
tag?: string | Field, | ||
value?: Ciphertext | Plaintext | PlaintextObject, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export type Output = { | ||
export type OutputJSON = { | ||
type: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
id: string; | ||
checksum: string; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Aleo function Input represented as a typed typescript object. | ||
*/ | ||
import { Field, Ciphertext, Plaintext } from "@provablehq/wasm"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should import |
||
import { PlaintextObject } from "../plaintext/plaintext"; | ||
|
||
/** | ||
* Object representation of an Input as raw JSON returned from a SnarkOS node. | ||
*/ | ||
export type OutputObject = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
type: string, | ||
id: string | Field, | ||
value?: Ciphertext | Plaintext | PlaintextObject, | ||
checksum?: string | Field, | ||
programId?: string, | ||
functionName?: string, | ||
arguments?: Array<Plaintext> | Array<OutputObject> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { PlaintextLiteral } from "./literal"; | ||
import { PlaintextStruct } from "./struct"; | ||
|
||
export type PlaintextArray = PlaintextLiteral[] | PlaintextStruct[] | PlaintextArray[]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type PlaintextLiteral = boolean | bigint | number | string; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { PlaintextArray } from "./array"; | ||
import { PlaintextLiteral } from "./literal"; | ||
import { PlaintextStruct } from "./struct"; | ||
|
||
export type PlaintextObject = PlaintextArray| PlaintextLiteral | PlaintextStruct |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { PlaintextArray } from "./array"; | ||
import { PlaintextLiteral } from "./literal"; | ||
|
||
export type PlaintextStruct = { | ||
[key: string]: PlaintextArray | PlaintextLiteral | PlaintextStruct; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ExecutionJSON } from "../executionJSON"; | ||
|
||
export type TransactionJSON = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
type: string; | ||
id: string; | ||
execution: ExecutionJSON; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { TransitionObject } from "../transition/transitionObject"; | ||
import { DeploymentMetadata } from "../deploy"; | ||
|
||
export type TransactionSummary = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
id : string; | ||
type : string; | ||
fee : bigint; | ||
baseFee : bigint; | ||
priorityFee : bigint; | ||
transitions : TransitionObject[]; | ||
deployment?: DeploymentMetadata; | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { InputJSON } from "../input/inputJSON"; | ||
import { OutputJSON } from "../output/outputJSON"; | ||
|
||
export type TransitionJSON = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
id: string; | ||
program: string; | ||
function: string; | ||
inputs?: (InputJSON)[]; | ||
outputs?: (OutputJSON)[]; | ||
proof: string; | ||
tpk: string; | ||
tcm: string; | ||
fee: bigint; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { InputObject } from "../input/inputObject"; | ||
import { OutputObject } from "../output/outputObject"; | ||
import { Field, Group } from "@provablehq/wasm"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should import |
||
|
||
export type TransitionObject = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, this should be an |
||
id: string; | ||
program: string; | ||
functionName: string; | ||
inputs?: (InputObject)[]; | ||
outputs?: (OutputObject)[]; | ||
proof: string; | ||
tpk: string | Group; | ||
tcm: string | Field; | ||
scm: string | Field; | ||
fee: bigint; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For objects, it's better to use an
interface
instead oftype