-
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 arithmetic types, plaintext, and conversion of plaintext & records to JS objects #944
base: mainnet
Are you sure you want to change the base?
[Feature] Add arithmetic types, plaintext, and conversion of plaintext & records to JS objects #944
Conversation
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.
There's various small nits that need to be fixed, otherwise it looks good to me.
website/src/workers/worker.js
Outdated
@@ -418,5 +418,7 @@ self.addEventListener("message", (ev) => { | |||
programManager.setHost(defaultHost); | |||
} | |||
})(); | |||
} else if (ev.data.type === "PROPOSE_GAME") { |
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.
What's the purpose of this?
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.
This is a mistake, I shall remove.
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.
Feedback addressed, @Pauan - when there's time to double check, let me know.
website/src/workers/worker.js
Outdated
@@ -418,5 +418,7 @@ self.addEventListener("message", (ev) => { | |||
programManager.setHost(defaultHost); | |||
} | |||
})(); | |||
} else if (ev.data.type === "PROPOSE_GAME") { |
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.
This is a mistake, I shall remove.
wasm/src/ledger/transaction.rs
Outdated
let tpk = Group::from(transition.tpk()); | ||
let tcm = Field::from(transition.tcm()); | ||
let scm = Field::from(transition.scm()); | ||
if convert_to_js { |
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.
This will only work if its first wrapped in JsValue, which seems acceptable.
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.
Couple more minor issues to fix, otherwise it looks good to me.
Motivation
From several requests and issues surrounding the SDK, the following features have been flagged as important to add.
Addition Field, Scalar, and Group Types
Addition of
Field
,Group
, andScalar
types and core arithmetic methods on those types allowing useful work to be done using algebraic types.Accessible Plaintext and Record Data + Conversion of Aleo types to JS type.
This PR adds the ability to access:
Record
directlyStruct
fieldsPlaintext
types into JS objects. This includes AleoLiteral
( i.e.address
,boolean
,i8/i16/i32/i64/i128/u8/u16/u32/u64/u128
,field
,scalar
,signature
),Struct
, andArray
types) into JS types.Transition and Transaction Data Accessor Methods
The ability to search for
records
, and get theinputs
andoutputs
ofTransitions
andTransactions
.Addition of
GraphKey
andComputeKey
This PR adds both the
GraphKey
andComputeKey
to the sdk, allowing GraphKeys to be used directly to determine ownershiprecords
.Test Plan