Skip to content

Commit

Permalink
Support dvkam contribution of website adjustments (#2563)
Browse files Browse the repository at this point in the history
* Fix issue #1652 (#2547)

* fix issues from #1652

* added TZIP link above the column caption

* removed the TZIP link at the bottom of the page

* updated rxjs version from 6 to 7, ts to 4.2.4, and some refactor (#2535)

* updated rxjs version from 6 to 7, ts to 4.2.4, and some necessary refactors

* updated unit tests, and refactored necessary packages

* updated example

* addressed PR comments

* debug tests

* debug flextesa failure

* remove debug statements

* trigger build

* try previous flextesa version

* fix issues from #1652

* changed color back to brown like it was before

---------

Co-authored-by: Davis Sawali <davis.sawali@ecadlabs.com>
Co-authored-by: David <david.kaminski93@gmail.com>

* docs: extended website adjustment changes to next version

* revert: package-lock.json to comply with master

* docs: removed broken link in lambda_view and update sapling contract for live code example

* docs: updated version 17.1.0 doc changes accordingly

---------

Co-authored-by: dvkam <82422481+dvkam@users.noreply.github.com>
Co-authored-by: Davis Sawali <davis.sawali@ecadlabs.com>
Co-authored-by: David <david.kaminski93@gmail.com>
  • Loading branch information
4 people authored Jul 17, 2023
1 parent fb9752d commit 6815352
Show file tree
Hide file tree
Showing 16 changed files with 97 additions and 112 deletions.
Binary file modified docs/images/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/gitlab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions docs/lambda_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ title: Lambda View
---

:::caution note
Lambda View implementation have recently changed due to a recent protocol update. Lambda Views now utilize the `run_view` endpoint. For more information refer to [this document](https://tezos.gitlab.io/CHANGES.html?highlight=run_view#id16)
Lambda View implementation have recently changed due to a recent protocol update. Lambda Views now utilize the `run_view` endpoint. For more information refer to [this document](https://tezos.gitlab.io/CHANGES.html?highlight=run_view#id16)
:::
Lambda View is a way to retrieve data from a smart contract's storage
without incurring fees via a contract's view method.
without incurring fees via a contract's view method.

## Recap: Views & Callbacks

Expand All @@ -20,18 +20,13 @@ specify parameters around what data you'd like to retrieve. They also require
you to supply a callback contract whose storage will update as a result of
executing the view method.

You can read more about views by going through the [FA1.2 Lorentz Tutorial][lorentz-tutorial]
in the TQ Tezos Assets Portal.

[lorentz-tutorial]: https://assets.tqtezos.com/docs/token-contracts/fa12/3-fa12-lorentz/#views

## Limitations to Views & Callbacks

One issue with using views and callbacks is that, just like any operation
executed on Tezos, each read has a small fee attached to it. The amount is
trivial for occasional reads, but it becomes a burden at higher volumes.

Another drawback is speed: since we're invoking a contract method, we have to wait for confirmation to retrieve the requested data. You may not find this
Another drawback is speed: since we're invoking a contract method, we have to wait for confirmation to retrieve the requested data. You may not find this
acceptable if the application you're working on requires consistent, faster
response times.

Expand Down
54 changes: 27 additions & 27 deletions docs/sapling.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Sapling Toolkit
author: Roxane Letourneau
---

Sapling is a protocol allowing private transactions in a decentralized environment.
Sapling is a protocol allowing private transactions in a decentralized environment.
Sapling was introduced in Tezos in the Edo protocol. Refer to the Tezos documentation for more information on Sapling: https://tezos.gitlab.io/active/sapling.html

## Keys
Expand Down Expand Up @@ -33,7 +33,7 @@ Here is an example on how to retrieve addresses: [InMemoryViewingKey](./sapling_

# Sapling toolkit

The `@taquito/sapling` package provides a `SaplingToolkit` class that surfaces all of the Sapling capabilities, allowing it to read from a Sapling state and prepare transactions.
The `@taquito/sapling` package provides a `SaplingToolkit` class that surfaces all of the Sapling capabilities, allowing it to read from a Sapling state and prepare transactions.

The constructor of the `SaplingToolkit` takes the following properties:
- the first parameter is an object containing:
Expand All @@ -55,20 +55,20 @@ import { RpcClient } from '@taquito/rpc';

const tezos = new TezosToolkit('https://ghostnet.ecadinfra.com/');
const readProvider = new RpcReadAdapter(new RpcClient('https://YOUR_PREFERRED_RPC_URL'));
const saplingContract = await tezos.contract.at('KT1UYwMR6Q6LZnwQEi77DSBrAjKT1tEJb245');
const saplingContract = await tezos.contract.at('KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf');

const inMemorySpendingKey = await InMemorySpendingKey.fromMnemonic('YOUR_MNEMONIC');

const saplingToolkit = new SaplingToolkit(
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContract.address, memoSize: 8 },
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContract.address, memoSize: 8 },
readProvider
)
```

## How to retrieve my balance in the Sapling shielded pool?

When calling the `getSaplingTransactionViewer` method of the `SaplingToolkit` class, an instance of the `SaplingTransactionViewer` class is returned. The `SaplingTransactionViewer` class allows retrieving and decrypting Sapling transactions for the specified viewing key and calculating the unspent balance.
When calling the `getSaplingTransactionViewer` method of the `SaplingToolkit` class, an instance of the `SaplingTransactionViewer` class is returned. The `SaplingTransactionViewer` class allows retrieving and decrypting Sapling transactions for the specified viewing key and calculating the unspent balance.

For each entry in the shielded pool, the `SaplingTransactionViewer` class will try to decrypt them using the viewing key as if it were the receiver. If a ciphertext is successfully decrypted, the configured account was the receiver of the output. The `SaplingTransactionViewer` will find which inputs were not spent by computing their nullifier. If an input is spent, its nullifier will be in the Sapling state. If the nullifier is not present, the input has not been spent, and its value will be considered in the calculated balance.

Expand All @@ -89,8 +89,8 @@ const inMemorySpendingKey = new InMemorySpendingKey(aliceSk);
const readProvider = new RpcReadAdapter(new RpcClient('https://ghostnet.ecadinfra.com/'));

const saplingToolkit = new SaplingToolkit(
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: 'KT1JMDxmQ4DAbzXpzAJmL6QeZ9HB7DTVnZYd', memoSize: 8 },
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: 'KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf', memoSize: 8 },
readProvider
);

Expand Down Expand Up @@ -122,8 +122,8 @@ const inMemorySpendingKey = new InMemorySpendingKey(aliceSk);
const readProvider = new RpcReadAdapter(new RpcClient('https://ghostnet.ecadinfra.com/'));

const saplingToolkit = new SaplingToolkit(
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: 'KT1JMDxmQ4DAbzXpzAJmL6QeZ9HB7DTVnZYd', memoSize: 8 },
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: 'KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf', memoSize: 8 },
readProvider
);

Expand All @@ -138,7 +138,7 @@ saplingToolkit.getSaplingTransactionViewer()

## How to prepare a shielded transaction?

A shielded transaction allows sending tokens from a Tezos account (tz1, tz2, tz3) to a Sapling address (zet). The `prepareShieldedTransaction` method of the `SaplingToolkit` takes an array of `ParametersSaplingTransaction`, making it possible to send tez to multiple addresses at once if needed.
A shielded transaction allows sending tokens from a Tezos account (tz1, tz2, tz3) to a Sapling address (zet). The `prepareShieldedTransaction` method of the `SaplingToolkit` takes an array of `ParametersSaplingTransaction`, making it possible to send tez to multiple addresses at once if needed.

The `ParametersSaplingTransaction` is an object made of:
- a `to` property, which is the destination address (zet)
Expand All @@ -155,7 +155,7 @@ Here is an example of how to prepare and inject a shielded transaction using Taq
// import { SaplingToolkit, InMemorySpendingKey } from '@taquito/sapling';
// import { RpcClient } from '@taquito/rpc';

const saplingContractAddress = 'KT1JMDxmQ4DAbzXpzAJmL6QeZ9HB7DTVnZYd'
const saplingContractAddress = 'KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf'
const rpcUrl = 'https://ghostnet.ecadinfra.com/';
const readProvider = new RpcReadAdapter(new RpcClient(rpcUrl));
// const Tezos = new TezosToolkit(rpcUrl);
Expand All @@ -167,8 +167,8 @@ const aliceSk = 'sask27SLmU9herddHz4qFJBLMjWYMbJF8RtS579w9ej9mfCYK7VUdyCJPHK8AzW
const inMemorySpendingKey = new InMemorySpendingKey(aliceSk);

const saplingToolkit = new SaplingToolkit(
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContractAddress, memoSize: 8 },
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContractAddress, memoSize: 8 },
readProvider
);

Expand Down Expand Up @@ -206,15 +206,15 @@ inMemorySpendingKey.getSaplingViewingKeyProvider()

## How to prepare a Sapling transaction?

A Sapling transaction allows sending tokens from an address (zet) to an address (zet). The `prepareSaplingTransaction` method of the `SaplingToolkit` takes an array of `ParametersSaplingTransaction`, making it possible to send tez to multiple addresses at once if needed.
A Sapling transaction allows sending tokens from an address (zet) to an address (zet). The `prepareSaplingTransaction` method of the `SaplingToolkit` takes an array of `ParametersSaplingTransaction`, making it possible to send tez to multiple addresses at once if needed.

The `ParametersSaplingTransaction` is an object made of:
- a `to` property, which is the destination address (zet)
- an `amount` property, which is the amount to shield in tez by default
- an optional `memo` that cannot be longer than the specified memo size
- an optional `mutez` property that must be set to true if the specified amount is in mutez rather than tez

The `prepareSaplingTransaction` method returns the crafted Sapling transaction parameter but does not perform any change on the shielded pool. A subsequent step where the Sapling transaction parameter is submitted to the smart contract must be done.
The `prepareSaplingTransaction` method returns the crafted Sapling transaction parameter but does not perform any change on the shielded pool. A subsequent step where the Sapling transaction parameter is submitted to the smart contract must be done.

:::note
A user should not use their own implicit account (tz1, tz2, tz3) to submit a Sapling transaction but rather have a third party inject it.
Expand All @@ -227,7 +227,7 @@ Here is an example of how to prepare and inject a Sapling transaction using Taqu
// import { SaplingToolkit, InMemorySpendingKey } from '@taquito/sapling';
// import { RpcClient } from '@taquito/rpc';

const saplingContractAddress = 'KT1JMDxmQ4DAbzXpzAJmL6QeZ9HB7DTVnZYd'
const saplingContractAddress = 'KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf'
const rpcUrl = 'https://ghostnet.ecadinfra.com/';
const readProvider = new RpcReadAdapter(new RpcClient(rpcUrl));
// const Tezos = new TezosToolkit(rpcUrl);
Expand All @@ -239,8 +239,8 @@ const aliceSk = 'sask27SLmU9herddHz4qFJBLMjWYMbJF8RtS579w9ej9mfCYK7VUdyCJPHK8AzW
const inMemorySpendingKey = new InMemorySpendingKey(aliceSk);

const saplingToolkit = new SaplingToolkit(
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContractAddress, memoSize: 8 },
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContractAddress, memoSize: 8 },
readProvider
);

Expand Down Expand Up @@ -276,7 +276,7 @@ The `ParametersUnshieldedTransaction` is an object made of:
- an `amount` property, which is the amount to shield in tez by default
- an optional `mutez` property that must be set to true if the specified amount is in mutez rather than tez

The `prepareUnshieldedTransaction` method returns the crafted Sapling transaction parameter but does not perform any change on the shielded pool. A subsequent step where the Sapling transaction parameter is submitted to the smart contract must be done to retrieve the tokens from the pool.
The `prepareUnshieldedTransaction` method returns the crafted Sapling transaction parameter but does not perform any change on the shielded pool. A subsequent step where the Sapling transaction parameter is submitted to the smart contract must be done to retrieve the tokens from the pool.

Here is an example of how to prepare and inject an unshielded transaction using Taquito:

Expand All @@ -285,7 +285,7 @@ Here is an example of how to prepare and inject an unshielded transaction using
// import { SaplingToolkit, InMemorySpendingKey } from '@taquito/sapling';
// import { RpcClient } from '@taquito/rpc';

const saplingContractAddress = 'KT1JMDxmQ4DAbzXpzAJmL6QeZ9HB7DTVnZYd'
const saplingContractAddress = 'KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf'
const rpcUrl = 'https://ghostnet.ecadinfra.com/';
const readProvider = new RpcReadAdapter(new RpcClient(rpcUrl));
// const Tezos = new TezosToolkit(rpcUrl);
Expand All @@ -297,8 +297,8 @@ const aliceSk = 'sask27SLmU9herddHz4qFJBLMjWYMbJF8RtS579w9ej9mfCYK7VUdyCJPHK8AzW
const inMemorySpendingKey = new InMemorySpendingKey(aliceSk);

const saplingToolkit = new SaplingToolkit(
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContractAddress, memoSize: 8 },
{ saplingSigner: inMemorySpendingKey },
{ contractAddress: saplingContractAddress, memoSize: 8 },
readProvider
);

Expand Down Expand Up @@ -329,7 +329,7 @@ saplingToolkit.prepareUnshieldedTransaction({
We don't require the spending key to retrieve the balance and transaction history. It can be done using the viewing key and the SaplingTransactionViewer class.

The constructor of the `SaplingTransactionViewer` takes the following properties:
- an instance of `InMemoryViewingKey`
- an instance of `InMemoryViewingKey`
- the second parameter is an object containing:
- the address of the Sapling contract or a Sapling id if the contract contains more than one Sapling state.
- an instance of a class implementing the `TzReadProvider` interface, which allows getting data from the blockchain
Expand All @@ -344,15 +344,15 @@ import { RpcClient } from '@taquito/rpc';
const readProvider = new RpcReadAdapter(new RpcClient('https://YOUR_PREFERRED_RPC_URL'));
const tezos = new TezosToolkit('https://ghostnet.ecadinfra.com/');

const saplingContract = await tezos.contract.at('KT1JMDxmQ4DAbzXpzAJmL6QeZ9HB7DTVnZYd');
const saplingContract = await tezos.contract.at('KT1ToBD7bovonshNrxs3i4KMFuZ8PE2LUmQf');

const inMemoryViewingKey = new InMemoryViewingKey(
'000000000000000000977d725fc96387e8ec1e603e7ae60c6e63529fb84e36e126770e9db9899d7f2344259fd700dc80120d3c9ca65d698f6064043b048b079caa4f198aed96271740b1d6fd523d71b15cd0b3d75644afbe9abfedb6883e299165665ab692c14ca5c835c61a0e53de553a751c78fbc42d5e7eca807fd441206651c84bf88de803efba837583145a5f338b1a7af8a5f9bec4783054f9d063d365f2352f72cbced95e0a'
);

const saplingTransactionViewer = new SaplingTransactionViewer(
inMemoryViewingKey,
{ contractAddress: saplingContract.address },
inMemoryViewingKey,
{ contractAddress: saplingContract.address },
readProvider
)
```
Expand Down
4 changes: 2 additions & 2 deletions docs/wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ author: Michael Kernaghan

## Wallets available for use with Tezos

Here's a list of the Tezos wallets we know of. Wallets that support the TZIP-10: Wallet Interaction standard should work with Tezos dApps.
Here's a list of the Tezos wallets we know of. Wallets that support the [TZIP-10](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-10/tzip-10.md): Wallet Interaction standard should work with Tezos dApps.

| Name | Type | [TZIP-10](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-10/tzip-10.md) | Product web site | Source code |
| Name | Type | TZIP-10 | Product web site | Source code |
| :---------------: | :---------------------: | :---------------------------------------------------------------------------------: | :-------------------------------------: | :------------------------------------------------------------------------------------------: |
| **Temple** | Browser Extension | Yes | https://templewallet.com | [![Github](images/github.png)](https://github.com/madfish-solutions/templewallet-extension/) |
| **Kukai** | Web | Yes | https://wallet.kukai.app | [![Github](images/github.png)](https://github.com/kukai-wallet/kukai/) |
Expand Down
2 changes: 1 addition & 1 deletion website/src/css/tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ table {
font-family: Source Sans Pro;
font-style: normal;
font-weight: 500;
font-size: 12px;
font-size: 16px;
line-height: 16px;
table-layout: auto !important;
// border-color: rgba(211, 131, 43, 0.1);
Expand Down
Binary file modified website/versioned_docs/version-17.0.0/images/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/versioned_docs/version-17.0.0/images/gitlab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions website/versioned_docs/version-17.0.0/lambda_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ title: Lambda View
---

:::caution note
Lambda View implementation have recently changed due to a recent protocol update. Lambda Views now utilize the `run_view` endpoint. For more information refer to [this document](https://tezos.gitlab.io/CHANGES.html?highlight=run_view#id16)
Lambda View implementation have recently changed due to a recent protocol update. Lambda Views now utilize the `run_view` endpoint. For more information refer to [this document](https://tezos.gitlab.io/CHANGES.html?highlight=run_view#id16)
:::
Lambda View is a way to retrieve data from a smart contract's storage
without incurring fees via a contract's view method.
without incurring fees via a contract's view method.

## Recap: Views & Callbacks

Expand All @@ -20,18 +20,13 @@ specify parameters around what data you'd like to retrieve. They also require
you to supply a callback contract whose storage will update as a result of
executing the view method.

You can read more about views by going through the [FA1.2 Lorentz Tutorial][lorentz-tutorial]
in the TQ Tezos Assets Portal.

[lorentz-tutorial]: https://assets.tqtezos.com/docs/token-contracts/fa12/3-fa12-lorentz/#views

## Limitations to Views & Callbacks

One issue with using views and callbacks is that, just like any operation
executed on Tezos, each read has a small fee attached to it. The amount is
trivial for occasional reads, but it becomes a burden at higher volumes.

Another drawback is speed: since we're invoking a contract method, we have to wait for confirmation to retrieve the requested data. You may not find this
Another drawback is speed: since we're invoking a contract method, we have to wait for confirmation to retrieve the requested data. You may not find this
acceptable if the application you're working on requires consistent, faster
response times.

Expand Down
Loading

0 comments on commit 6815352

Please sign in to comment.