Skip to content

Commit

Permalink
resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
dsawali committed May 14, 2024
2 parents 7dfd058 + adcb483 commit 4c6e079
Show file tree
Hide file tree
Showing 22 changed files with 1,941 additions and 444 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ Welcome, Web3 developer!

Taquito is a fast and lightweight [TypeScript](https://www.typescriptlang.org/) library to accelerate DApp development on the [Tezos](https://tezos.com/developers) blockchain. With it, you can easily interact with Smart Contracts deployed to Tezos. It is distributed as a suite of individual `npm` packages, to reduce bloat and improve application startup times.

## What about Smart Contract Development?

If you are a current or aspiring "full-stack" blockchain developer, be sure to check out Taquito's sister project [Taqueria](https://taqueria.io). Taqueria is a Developer Tool Suite with *rich support* for Smart Contract development and orchestration on Tezos, and fully compliments Taquito.

## What is Included in Taquito?

Taquito is primarily targeted at Front-End Web3 developers, so it comes with batteries included, such as a [React Template Project](https://github.com/ecadlabs/taquito-react-template), an extensible framework, and many helpful utilities. It can be used in *many* execution contexts, including Serverless, Node.js, Deno, and Electron (to name a few) and has minimal dependencies.
Expand Down Expand Up @@ -45,11 +41,9 @@ Taquito currently supports the following versions of Node.js®:
| ---------------- | ---------- |
| v12 LTS ||
| v14 LTS ||
| v16.13.1 ||
| v16 LTS/Gallium ||
| 17.3.x ||
| v18 LTS/Hydrogen ||
| v20 ||
| v20 LTS/Iron ||

While other versions often work, the above are what we officially support. YMMV!

Expand All @@ -64,27 +58,34 @@ We are active and enthusiastic participants of the following community support c

Taquito is organized as a [monorepo](https://en.wikipedia.org/wiki/Monorepo), and is composed of several npm packages that are [published to npmjs.org](https://www.npmjs.com/package/@taquito/taquito) under the `@taquito` handle. Each package has its own README which can be found in the corresponding directory within `packages/`.

| High-Level Packages | Responsibility |
| -------------------------------------------------------------- | ------------------------------------------------------------ |
| High-Level Packages | Responsibility |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| [@taquito/taquito](packages/taquito) | [Facade](https://en.wikipedia.org/wiki/Facade_pattern) to lower-level, package-specific functionality |

| Low-Level Packages | Responsibility |
| ---------------------------------------------------------------- | ------------------------------------------------------------- |
| [@taquito/local-forging](packages/taquito-local-forging) | Local "forging": serialization of Tezos operations as bytes |
| [@taquito/michelson-encoder](packages/taquito-michelson-encoder) | Creates JS abstractions of Smart Contracts |
| [@taquito/michel-codec](packages/taquito-michel-codec) | Converts Michelson between forms, expands Macros, etc |
| [@taquito/remote-signer](packages/taquito-remote-signer) | Provides the facility to use a remote signer, such as https://signatory.io |
| [@taquito/rpc](packages/taquito-rpc) | RPC client library: every rpc endpoint has its own method |
| [@taquito/signer](packages/taquito-signer) | Provides functionality to sign data using tezos keys |
| [@taquito/utils](packages/taquito-utils) | Provides different encoding and decoding utilities |
| [@taquito/tzip12](packages/taquito-tzip12) | TZIP-12 allows retrieving NFT/token metadata |
| [@taquito/tzip16](packages/taquito-tzip16) | TZIP-16 allows retrieving contract metadata and executing off-chain views |
| [@taquito/beacon-wallet](packages/taquito-beacon-wallet) | TZIP-10 implementation of a Wallet API |
| Low-Level Packages | Responsibility |
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| [@taquito/local-forging](packages/taquito-local-forging) | Local "forging": serialization of Tezos operations as bytes |
| [@taquito/michelson-encoder](packages/taquito-michelson-encoder) | Creates JS abstractions of Smart Contracts |
| [@taquito/michel-codec](packages/taquito-michel-codec) | Converts Michelson between forms, expands Macros, etc |
| [@taquito/remote-signer](packages/taquito-remote-signer) | Provides the facility to use a remote signer, such as https://signatory.io |
| [@taquito/rpc](packages/taquito-rpc) | RPC client library: every rpc endpoint has its own method |
| [@taquito/signer](packages/taquito-signer) | Provides functionality to sign data using tezos keys |
| [@taquito/utils](packages/taquito-utils) | Provides different encoding and decoding utilities |
| [@taquito/tzip12](packages/taquito-tzip12) | TZIP-12 allows retrieving NFT/token metadata |
| [@taquito/tzip16](packages/taquito-tzip16) | TZIP-16 allows retrieving contract metadata and executing off-chain views |
| [@taquito/beacon-wallet](packages/taquito-beacon-wallet) | TZIP-10 implementation of a Wallet API |
| [@taquito/http-utils](packages/taquito-http-utils) | Provides functionality to configure and customize http requests |
| [@taquito/core](packages/taquito-core) | Provides parent and core types, classes, and interfaces for other Taquito packages or external uses |
| [@taquito/sapling](packages/taquito-sapling) | Provides functionality to prepare and read sapling transactions |
| [@taquito/contracts-library](packages/taquito-contracts-library) | Provides functionality specify static data related to contracts |
| [@taquito/ledger-signer](packages/taquito-ledger-signer) | Provides functionality for ledger signer provider |
| [@taquito/timelock](packages/taquito-timelock) | Provides functionality to create and open timelocks |

## API Documentation

TypeDoc API documentation for Taquito [is available here](https://taquito.io/typedoc).


## Versioning Strategy

Supported versions of Taquito packages are maintained for the *current* and *next* (beta) protocol versions.
Expand Down
24 changes: 21 additions & 3 deletions apps/taquito-test-dapp/src/lib/TestContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
let loading = false;
let success: boolean | undefined;
let opHash = "";
let input = { text: "", fee: 400, storageLimit: 400, gasLimit: 1320 };
let input = { text: "", fee: 400, storageLimit: 400, gasLimit: 1320, amount: 0, address: "" };
let testResult: { id: string; title: string; body: any };
const run = async () => {
Expand All @@ -28,6 +28,7 @@
test.id === "sign-payload-and-send" ||
test.id === "sign-failingNoop" ||
test.id === "verify-signature" ||
test.id === "send-tez-to-etherlink" ||
test.id === "set-transaction-limits"
) {
result = await test.run(input);
Expand Down Expand Up @@ -188,7 +189,7 @@
/* ----------------------------------------------
* Generated by Animista on 2022-4-21 9:31:8
* Licensed under FreeBSD License.
* See http://animista.net/license for more info.
* See http://animista.net/license for more info.
* w: http://animista.net, t: @cssanimista
* ---------------------------------------------- */
Expand Down Expand Up @@ -302,6 +303,19 @@
bind:value={input.text}
/>
</div>
{:else if test.inputRequired && test.inputType === "etherlink"}
<div class="test-input test-send-tez-to-etherlink">
<label for="etherlink-address">
<span>Etherlink address</span>
<input type="string" id="etherlink-address" bind:value={input.address} />
</label>
<br />
<br />
<label for="send-amount">
<span>amount</span>
<input type="number" id="send-amount" bind:value={input.amount} />
</label>
</div>
{:else if test.inputRequired && test.inputType === "set-limits"}
<div class="test-input test-limits">
<label for="set-limit-fee">
Expand Down Expand Up @@ -338,7 +352,11 @@
{#if $store.networkType === NetworkType.CUSTOM}
{shortenHash(opHash)}
{:else}
<a href={`${getTzKtUrl($store.networkType)}/${opHash}`} target="_blank" rel="noopener noreferrer">
<a
href={`${getTzKtUrl($store.networkType)}/${opHash}`}
target="_blank"
rel="noopener noreferrer"
>
{shortenHash(opHash)}
</a>
{/if}
Expand Down
42 changes: 40 additions & 2 deletions apps/taquito-test-dapp/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@ const preparePayloadToSign = (
};
};

const sendTezToEtherlink = async (
amount: number,
address: string,
tezos: TezosToolkit,
): Promise<TestResult> => {
let opHash = "";
try {
const contract = await tezos.wallet.at('KT1VEjeQfDBSfpDH5WeBM5LukHPGM2htYEh3')
let op = await contract.methodsObject.deposit({ evm_address: 'sr18wx6ezkeRjt1SZSeZ2UQzQN3Uc3YLMLqg', l2_address: address }).send({ amount });
await op.confirmation()
opHash = op.hasOwnProperty("opHash") ? op["opHash"] : op["hash"];
console.log("Operation successful with op hash:", opHash);
return { success: true, opHash };
} catch (error) {
console.log(error);
return { success: false, opHash: "" };
}
};

const sendTez = async (Tezos: TezosToolkit): Promise<TestResult> => {
let opHash = "";
try {
Expand Down Expand Up @@ -302,7 +321,7 @@ const signPayloadAndSend = async (
const publicKey = activeAccount.publicKey;
// sends transaction to contract
const op = await contract.methodsObject
.check_signature({0: publicKey, 1: signedPayload.signature, 2: payload.payload})
.check_signature({ 0: publicKey, 1: signedPayload.signature, 2: payload.payload })
.send();
await op.confirmation();
return {
Expand Down Expand Up @@ -455,7 +474,7 @@ const permit = async (Tezos: TezosToolkit, wallet: BeaconWallet) => {
const contract = await Tezos.wallet.at(contractAddress);
// hashes the parameter for the contract call
const mintParam: any = contract.methodsObject
.mint({0: store.userAddress, 1: 100})
.mint({ 0: store.userAddress, 1: 100 })
.toTransferParams().parameter?.value;
const mintParamType = contract.entrypoints.entrypoints["mint"];
// packs the entrypoint call
Expand Down Expand Up @@ -548,6 +567,7 @@ const saplingShielded = async (

export const list = [
"Send tez",
"Send tez from Ghostnet to Etherlink",
"Contract call with int",
"Contract call with (pair nat string)",
"Contract call that fails",
Expand Down Expand Up @@ -582,6 +602,24 @@ export const init = (
inputRequired: false,
lastResult: { option: "none", val: false }
},
{
id: "send-tez-to-etherlink",
name: "Send tez from Ghostnet to Etherlink",
description:
"This test allows you send your ghostnet tez to etherlink address",
documentation: '',
keyword: 'etherlink',
run: input =>
sendTezToEtherlink(
input.amount,
input.address,
Tezos
),
showExecutionTime: false,
inputRequired: true,
inputType: "etherlink",
lastResult: { option: "none", val: false }
},
{
id: "contract-call-simple-type",
name: "Contract call with int",
Expand Down
2 changes: 1 addition & 1 deletion apps/taquito-test-dapp/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface TestSettings {
run: (input?: any) => Promise<TestResult>;
showExecutionTime: boolean;
inputRequired: boolean;
inputType?: "string" | "set-limits" | "sapling";
inputType?: "string" | "set-limits" | "sapling" | "etherlink";
lastResult: { option: "none" | "some"; val: boolean };
}

Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"edsk",
"Ejara",
"entrypoints",
"etherlink",
"eztz",
"FAILWITH",
"Finalizable",
Expand Down
2 changes: 1 addition & 1 deletion docs/dapp_prelaunch.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ author: Claude Barde
- Did you enable `Local Pack` in your dapp? Local Pack reduces the search time in bigmaps by 50%, and you can easily add it to your dapp by providing a new instance of the `MichelCodecPacker` class to the `setPackerProvider` method of the `TezosToolkit`.
- Are you creating a single instance of the `BeaconWallet` that you can reuse throughout the different components of your dapp? The JavaScript frameworks generally offer a solution to easily share data between components (the Context API in React, Provide/Inject in Vue, or a Svelte store). The instance of the `BeaconWallet` must be saved there in order to use the same one in every component. Creating multiple instances of the `BeaconWallet` may create errors when forging new transactions.
- Is your dapp making HTTP requests on update only when necessary? The JavaScript frameworks provide different solutions to rerender the DOM when internal data is updated (React `useEffect`, Vue `beforeUpdate` and Svelte `afterUpdate`). These data may be based on call responses to Tezos nodes or indexers, which is why it is crucial to optimize them. Unnecessary HTTP requests increase the traffic to Tezos nodes and indexer servers and slow down your dapp.
- Does your application wait for a confirmation of an operation, and does it check if the operation was successfull or failed when receiving the transaction receipt? This piece of information is crucial to your users in order to know if the transaction went through or not.
- Does your application wait for a confirmation of an operation, and does it check if the operation was successful or failed when receiving the transaction receipt? This piece of information is crucial to your users in order to know if the transaction went through or not.
- Do you display user-friendly error messages, for example, when a transaction fails? A lack of visual feedback when transactions don't go through as expected can be confusing for users. Users must be informed about skipped, backtracked, and failed transactions.
- Are you handling big numbers? Because numbers in Michelson are arbitrary-precision, they can become quite long, and JavaScript switches to the scientific notation to represent them, which can be confusing for users. You can use the `bignumber.js` library to handle potentially long numbers coming from the blockchain.
- Do you have error reporting enabled on your dapp? An error reporting tool like [BugSnag](https://www.bugsnag.com/platforms/javascript) allows you to understand the issues your users face when using your dapp.
3 changes: 3 additions & 0 deletions docs/rpc_nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ values={[
| SmartPy | Mainnet | https://mainnet.smartpy.io | [Check](https://mainnet.smartpy.io/chains/main/blocks/head/header) |
| SmartPy | Ghostnet | https://ghostnet.smartpy.io | [Check](https://ghostnet.smartpy.io/chains/main/blocks/head/header) |
| Tezos Foundation | Mainnet | https://rpc.tzbeta.net/ | [Check](https://rpc.tzbeta.net/chains/main/blocks/head/header) |
| Tezos Foundation | Ghostnet | https://rpc.ghostnet.teztnets.com/ | [Check](https://rpc.ghostnet.teztnets.com/chains/main/blocks/head/header) |
| Tezos Foundation | Oxfordnet | https://rpc.oxfordnet.teztnets.com/ | [Check](https://rpc.oxfordnet.teztnets.com/chains/main/blocks/head/header) |
| Tezos Foundation | Parisnet | https://rpc.parisnet.teztnets.com/ | [Check](https://rpc.parisnet.teztnets.com/chains/main/blocks/head/header) |
| Marigold | Mainnet | https://mainnet.tezos.marigold.dev/ | [Check](https://mainnet.tezos.marigold.dev/chains/main/blocks/head/header) |
| Marigold | Ghostnet | https://ghostnet.tezos.marigold.dev/ | [Check](https://ghostnet.tezos.marigold.dev/chains/main/blocks/head/header) |

Expand Down
2 changes: 1 addition & 1 deletion docs/signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const isVerified = verifySignature(

## Signing Michelson data

Taquito also offers the possibility to sign Michelson code. This feature can be useful, for example, if you need to send a lambda to a contract to be executed but want to restrict the number of users who can submit a lambda by verifiying the signer's address. The signing of Michelson code requires the use of the `michel-codec` package:
Taquito also offers the possibility to sign Michelson code. This feature can be useful, for example, if you need to send a lambda to a contract to be executed but want to restrict the number of users who can submit a lambda by verifying the signer's address. The signing of Michelson code requires the use of the `michel-codec` package:

```js live noInline
// import { TezosToolkit } from '@taquito/taquito';
Expand Down
Loading

0 comments on commit 4c6e079

Please sign in to comment.