Skip to content

Commit

Permalink
Beacon 4.2.2 (#2924)
Browse files Browse the repository at this point in the history
* feat: updated beacon to 4.2.2-beta.0

* feat: feat: updated beacon to 4.2.2-beta.1

* feat: feat: updated beacon to 4.2.2-beta.2

* chore(releng) bump version to 19.2.1-beta.0

* feat: updated beacon to 4.2.2-beta.3

* feat: updating to private prc nodes

* reverted config to use public testnets instead

* fix: updating back to public node

* chore(releng) bump version to 19.2.1-beta.1

* feat: updated beacon to 4.2.2-beta.4

* Revert "Merge branch 'master' of https://github.com/ecadlabs/taquito into beacon-4.2.2"

This reverts commit caf851a, reversing
changes made to ecd6f5a.

* chore(releng) bump version to 19.2.1-beta.2

* 2958 eventsub (#2960)

* updated taquito-beacon-wallet to use eventsub

* removed comments

* removed console log

* trigger ci build

* updated beacon version to v4.2.2

* chore(releng) bump version to 19.2.1

---------

Co-authored-by: Davis Sawali <davis.sawali@ecadlabs.com>
  • Loading branch information
hui-an-yang and dsawali authored May 15, 2024
1 parent adcb483 commit 88a5dfb
Show file tree
Hide file tree
Showing 66 changed files with 854 additions and 2,349 deletions.
14 changes: 7 additions & 7 deletions apps/taquito-test-dapp/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "taquito-test-dapp-vite",
"private": true,
"version": "19.2.0",
"version": "19.2.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -24,12 +24,12 @@
"vite": "^4.4.11"
},
"dependencies": {
"@airgap/beacon-sdk": "^4.2.1",
"@airgap/beacon-types": "^4.2.1",
"@taquito/beacon-wallet": "^19.2.0",
"@taquito/core": "^19.1.0",
"@taquito/taquito": "^19.2.0",
"@taquito/utils": "^19.2.0",
"@airgap/beacon-sdk": "^4.2.2",
"@airgap/beacon-types": "^4.2.2",
"@taquito/beacon-wallet": "^19.2.1",
"@taquito/core": "^19.2.1",
"@taquito/taquito": "^19.2.1",
"@taquito/utils": "^19.2.1",
"buffer": "^6.0.3",
"svelte-select": "^5.7.0",
"vite-compatible-readable-stream": "^3.6.1"
Expand Down
24 changes: 3 additions & 21 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, amount: 0, address: "" };
let input = { text: "", fee: 400, storageLimit: 400, gasLimit: 1320 };
let testResult: { id: string; title: string; body: any };
const run = async () => {
Expand All @@ -28,7 +28,6 @@
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 @@ -189,7 +188,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 @@ -303,19 +302,6 @@
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 @@ -352,11 +338,7 @@
{#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
13 changes: 8 additions & 5 deletions apps/taquito-test-dapp/src/lib/Wallet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
import { BeaconEvent, type DAppClientOptions } from "@airgap/beacon-sdk";
import store from "../store";
import { formatTokenAmount, shortenHash } from "../utils";
import { defaultMatrixNode, getRpcUrl, defaultNetworkType, type SupportedNetworks } from "../config";
import {
defaultMatrixNode,
getRpcUrl,
defaultNetworkType,
type SupportedNetworks,
} from "../config";
import type { TezosAccountAddress } from "../types";
let showDialog = false;
let connectedWallet = "";
const createNewWallet = (config: {
networkType: SupportedNetworks,
}) => {
const createNewWallet = (config: { networkType: SupportedNetworks }) => {
const options: DAppClientOptions = {
name: "Taquito Test Dapp",
matrixNodes: [defaultMatrixNode] as any,
Expand All @@ -23,7 +26,7 @@
rpcUrl: getRpcUrl(config.networkType),
},
walletConnectOptions: {
projectId: 'ba97fd7d1e89eae02f7c330e14ce1f36',
projectId: "ba97fd7d1e89eae02f7c330e14ce1f36",
},
enableMetrics: $store.enableMetrics,
};
Expand Down
42 changes: 2 additions & 40 deletions apps/taquito-test-dapp/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,6 @@ 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 @@ -321,7 +302,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 @@ -474,7 +455,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 @@ -567,7 +548,6 @@ 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 @@ -602,24 +582,6 @@ 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" | "etherlink";
inputType?: "string" | "set-limits" | "sapling";
lastResult: { option: "none" | "some"; val: boolean };
}

Expand Down
1 change: 0 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"edsk",
"Ejara",
"entrypoints",
"etherlink",
"eztz",
"FAILWITH",
"flextesa",
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 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.
- 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.
- 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: 0 additions & 3 deletions docs/rpc_nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ 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) |
| Marigold | Oxfordnet | https://oxfordnet.tezos.marigold.dev/ | [Check](https://oxfordnet.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 verifying 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 verifiying 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
24 changes: 12 additions & 12 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@taquito/example",
"private": true,
"version": "19.2.0",
"version": "19.2.1",
"scripts": {
"example": "node -r ts-node/register --preserve-symlinks example-node.ts",
"example:activation": "node -r ts-node/register --preserve-symlinks example-activate.ts",
Expand Down Expand Up @@ -41,17 +41,17 @@
"example:scan-path-ledger": "node -r ts-node/register --preserve-symlinks scan-path-ledger.ts"
},
"dependencies": {
"@ledgerhq/hw-transport-node-hid": "^6.28.5",
"@taquito/ledger-signer": "^19.2.0",
"@taquito/local-forging": "^19.2.0",
"@taquito/michel-codec": "^19.2.0",
"@taquito/michelson-encoder": "^19.2.0",
"@taquito/rpc": "^19.2.0",
"@taquito/sapling": "^19.2.0",
"@taquito/signer": "^19.2.0",
"@taquito/taquito": "^19.2.0",
"@taquito/tzip16": "^19.2.0",
"@taquito/utils": "^19.2.0",
"@ledgerhq/hw-transport-node-hid": "^6.27.21",
"@taquito/ledger-signer": "^19.2.1",
"@taquito/local-forging": "^19.2.1",
"@taquito/michel-codec": "^19.2.1",
"@taquito/michelson-encoder": "^19.2.1",
"@taquito/rpc": "^19.2.1",
"@taquito/sapling": "^19.2.1",
"@taquito/signer": "^19.2.1",
"@taquito/taquito": "^19.2.1",
"@taquito/tzip16": "^19.2.1",
"@taquito/utils": "^19.2.1",
"bignumber.js": "^9.1.2"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FieldNumberingStrategy } from "@taquito/michelson-encoder";
import { CONFIGS } from "../../config";
import { noAnnotCode, noAnnotInit } from "../../data/token_without_annotation";

Expand All @@ -11,70 +10,59 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
beforeEach(async () => {
await setup()
})
it('Verify contract.originate for a contract with no annotations for methods using methodObjects', async () => {
// Constants to replace annotations
const ACCOUNTS = '0';
const BALANCE = '0';
const ALLOWANCES = '1';
const TRANSFER = '0';
const APPROVE = '2';

// Constants to replace annotations
const ACCOUNTS = '0';
const BALANCE = '0';
const ALLOWANCES = '1';
const TRANSFER = '0';
const APPROVE = '2';
// Actual tests

// Actual tests
const ACCOUNT1_ADDRESS = await Tezos.signer.publicKeyHash()
const ACCOUNT2_ADDRESS = 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu'

const ACCOUNT2_ADDRESS = 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu'

// Runs the entire tests for a given fieldNumberingStrategy
const testContract = (strategy: FieldNumberingStrategy, innerObjectStartingIndex: number) => {
it(`Verify contract.originate for a contract with no annotations for methods using methodObjects with fieldNumberingStrategy: ${strategy}`, async () => {
Tezos.setFieldNumberingStrategy(strategy);
const ACCOUNT1_ADDRESS = await Tezos.signer.publicKeyHash()
// Originate a contract with a known state
const op = await Tezos.contract.originate({
balance: "1",
code: noAnnotCode,
init: noAnnotInit(await Tezos.signer.publicKeyHash())
})
await op.confirmation()
const contract = await op.contract()
// Originate a contract with a known state
const op = await Tezos.contract.originate({
balance: "1",
code: noAnnotCode,
init: noAnnotInit(await Tezos.signer.publicKeyHash())
})
await op.confirmation()
const contract = await op.contract()

// Make a transfer
// Make a transfer

const operation = await contract.methodsObject[TRANSFER]({
0: ACCOUNT1_ADDRESS,
1: ACCOUNT2_ADDRESS,
2: "1"
}).send();
const operation = await contract.methodsObject[TRANSFER]({
0: ACCOUNT1_ADDRESS,
1: ACCOUNT2_ADDRESS,
2: "1"
}).send();

await operation.confirmation();
expect(operation.status).toEqual('applied')
await operation.confirmation();
expect(operation.status).toEqual('applied')

// Verify that the transfer was done as expected
const storage = await contract.storage<any>()
let account1 = await storage[ACCOUNTS].get(ACCOUNT1_ADDRESS)
expect(account1[BALANCE].toString()).toEqual('16')
// Verify that the transfer was done as expected
const storage = await contract.storage<any>()
let account1 = await storage[ACCOUNTS].get(ACCOUNT1_ADDRESS)
expect(account1[BALANCE].toString()).toEqual('16')

const account2 = await storage[ACCOUNTS].get(ACCOUNT2_ADDRESS)
expect(account2[BALANCE].toString()).toEqual('1')
const account2 = await storage[ACCOUNTS].get(ACCOUNT2_ADDRESS)
expect(account2[BALANCE].toString()).toEqual('1')

// Approve
const operation2 = await contract.methodsObject[APPROVE]({
[innerObjectStartingIndex]: ACCOUNT2_ADDRESS,
[innerObjectStartingIndex + 1]: "1"
}).send();
// Approve
const operation2 = await contract.methodsObject[APPROVE]({
2: ACCOUNT2_ADDRESS,
3: "1"
}).send();

await operation2.confirmation();
expect(operation2.status).toEqual('applied')

// Verify that the allowance was done as expected
account1 = await storage[ACCOUNTS].get(ACCOUNT1_ADDRESS)
expect(account1[ALLOWANCES].get(ACCOUNT2_ADDRESS).toString()).toEqual('1')
});
};

// Run the tests for all fieldNumberingStrategies
testContract('Legacy', 2);
testContract('ResetFieldNumbersInNestedObjects', 0);
testContract('Latest', 0);
await operation2.confirmation();
expect(operation2.status).toEqual('applied')

// Verify that the allowance was done as expected
account1 = await storage[ACCOUNTS].get(ACCOUNT1_ADDRESS)
expect(account1[ALLOWANCES].get(ACCOUNT2_ADDRESS).toString()).toEqual('1')
})
});
});
})
Loading

0 comments on commit 88a5dfb

Please sign in to comment.