Skip to content
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

reorg JS stuff as Secure Distributed Computing in JavaScript; integrate videos #579

Merged
merged 5 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions main/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,15 @@ module.exports = {
]
},
{
title: 'JavaScript Programming',
title: 'JavaScript Framework',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing that the title in the side panel is "JavaScript Framework" but in the main panel it is "Secure Distributed Computing in JavaScript". I understand that the second is too long for the side panel, but that means we need something shorter that both can agree on. Also, this section is (will be) about "Endo", so perhaps we should start using that name now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying out "JavaScript Framework for Secure Distributed Computing" in the main panel.

path: '/guides/js-programming/',
collapsible: false,
children: [
'/guides/js-programming/agoric-js-overview',
'/guides/js-programming/hardened-js',
'/guides/js-programming/eventual-send',
'/guides/js-programming/far',
'/guides/js-programming/notifiers',
'/guides/js-programming/ses/',
'/guides/js-programming/bigint',
'/guides/js-programming/vats',
'/guides/js-programming/far',
'/guides/js-programming/eventual-send',
'/guides/js-programming/notifiers',
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions main/.vuepress/themeConfig/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ module.exports = [
link: '/zoe/guide/'
},
{
text: 'Agoric JavaScript Programming',
ariaLabel: 'Agoric JS Programming',
text: 'JavaScript Framework',
ariaLabel: 'JavaScript Framework',
Comment on lines +84 to +85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above re title of this section

link: '/guides/js-programming/',
},
{
Expand Down
1 change: 1 addition & 0 deletions main/assets/Introduction.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/assets/counter-animation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions main/assets/remote-presence-fig.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions main/assets/zoe-partitions-risk-slide.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 12 additions & 23 deletions main/ertp/api/amount-math.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ specified when `issuerKit()` creates the issuer and brand.

We recommend you import the two `AssetKind` values from `@agoric/ERTP` instead of making the
strings yourself.
- `AssetKind.NAT` (`nat`): Used with fungible assets. `amount` `values` are natural numbers (non-negative `BigInts`).
- `AssetKind.SET` (`set`): Used with non-fungible assets. `amount` `values` are objects or records with multiple properties.
- `AssetKind.NAT` (`nat`): Used with fungible assets. Values are natural numbers using the JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type to avoid overflow risks from using the usual JavaScript `Number` type.
- `AssetKind.SET` (`set`): Used with non-fungible assets. Values are arrays of objects such as strings.

Use `makeIssuerKit(allegedName, assetKind, displayInfo)` to specify which `AssetKind`
your contract uses. The second parameter, `assetKind` is optional and
Expand All @@ -46,18 +46,18 @@ An empty `purse` has 0 Quatloos.
```js
someAmount: {
brand: someBrand,
value: someValue,}
value: someValue,
}
```

## Value

`values` describe how much of something can be owned or shared. A fungible `value` is
normally represented by a natural number `BigInt`. Other `values` may be represented as strings
naming a particular right, or an arbitrary object that sensibly represents the rights at issue.
`values` describe how much of something can be owned or shared.
A value is either a non-negative `BigInt` for a fungible amount
or, for a non-fungible amount, [copyArray](/guides/js-programming/far.md#passstyleof-api)
such as a hardened array of strings.

Note that numbers in a value are represented as type `BigInt`, which allows for arbitrarily
large numbers. `BigInts` are depicted as an integer with an appended "n"; e.g. `10n`, `137n`.
See the [`BigInt` section in the JavaScript Distributed Programming Guide](/guides/js-programming/bigint.md) for details.
Recall that `BigInt`s are written with an `n` at the end: `10n`, `137n`, etc.

## Brand parameters

Expand All @@ -79,17 +79,7 @@ not equal, an error is thrown.
- `allegedValue` `{Value}`
- Returns: `{Amount}`

Make an `amount` from a `value` by adding the `brand`.

Remember that numbers in `values` are represented as `BigInts`; integers
with an appended "n". As seen in the below example, we strongly encourage
using BigInts as the argument to `AmountMath.make()`. While `AmountMath.make()`
does coerce a `Number` argument to a `BigInt`, so both `4` and `4n` return an
amount with a value of `4n`, using `Numbers` is likely to confuse later viewers
of your code.

See the [BigInt section in the JavaScript Distributed Programming Guide](/guides/js-programming/bigint.md) for
details about `BigInts`.
Make an `amount` from a `value` and a `brand`.

```js
//amount837 = { value: 837n, brand: quatloos }
Expand All @@ -115,8 +105,7 @@ const verifiedAmount = AmountMath.coerce(quatloosBrand, allegedAmount);
- `amount` `{Amount}`
- Returns: `{Value}`

Returns the `value` from the given `amount`. Remember, numeric values
are represented as `BigInts`, not `Numbers`.
Returns the `value` from the given `amount`.

```js
const quatloos123 = AmountMath.make(quatloosBrand, 123n);
Expand All @@ -130,7 +119,7 @@ const myValue = AmountMath.getValue(quatloosBrand, quatloos123);
Returns the `amount` representing an empty `Amount` for the `brand` argument's
`Brand`. This is the identity element for `AmountMath.add()`
and `AmountMath.subtract()`. The empty `value` depends
on whether the `assetKind` is `AssetKind.NAT` (`0`) of `AssetKind.SET` (`[]`).
on whether the `assetKind` is `AssetKind.NAT` (`0n`) or `AssetKind.SET` (`[]`).

```js
// Returns an empty amount.
Expand Down
Loading